JPEGView/Independent JPEG Group/ckconfig.c

1 line
11 KiB
C
Raw Permalink Normal View History

/* * ckconfig.c * * Copyright (C) 1991-1994, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. */ /* * This program is intended to help you determine how to configure the JPEG * software for installation on a particular system. The idea is to try to * compile and execute this program. If your compiler fails to compile the * program, make changes as indicated in the comments below. Once you can * compile the program, run it, and it will produce a "jconfig.h" file for * your system. * * As a general rule, each time you try to compile this program, * pay attention only to the *first* error message you get from the compiler. * Many C compilers will issue lots of spurious error messages once they * have gotten confused. Go to the line indicated in the first error message, * and read the comments preceding that line to see what to change. * * Almost all of the edits you may need to make to this program consist of * changing a line that reads "#define SOME_SYMBOL" to "#undef SOME_SYMBOL", * or vice versa. This is called defining or undefining that symbol. */ /* First we must see if your system has the include files we need. * We start out with the assumption that your system has all the ANSI-standard * include files. If you get any error trying to include one of these files, * undefine the corresponding HAVE_xxx symbol. */ #define HAVE_STDDEF_H /* replace 'define' by 'undef' if error here */ #ifdef HAVE_STDDEF_H /* next line will be skipped if you undef... */ #include <stddef.h> #endif #define HAVE_STDLIB_H /* same thing for stdlib.h */ #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #include <stdio.h> /* If you ain't got this, you ain't got C. */ /* We have to see if your string functions are defined by * strings.h (old BSD convention) or string.h (everybody else). * We try the non-BSD convention first; define NEED_BSD_STRINGS * if the compiler says it can't find string.h. */ #undef NEED_BSD_STRINGS #ifdef NEED_BSD_STRINGS #include <strings.h> #else #include <string.h> #endif /* On some systems (especially older Unix machines), type size_t is * defined only in the include file <sys/types.h>. If you get a failure * on the size_t test below, try defining NEED_SYS_TYPES_H. */ #undef NEED_SYS_TYPES_H /* start by assuming we don't need it */ #ifdef NEED_SYS_TYPES_H #include <sys/types.h> #endif /* Usually type size_t is defined in one of the include files we've included * above. If not, you'll get an error on the "typedef size_t my_size_t;" line. * In that case, first try defining NEED_SYS_TYPES_H just above. * If that doesn't work, you'll have to search through your system library * to figure out which include file defines "size_t". Look for a line that * says "typedef something-or-other size_t;". Then, change the line below * that says "#include <someincludefile.h>" to instead include the file * you found size_t in, and define NEED_SPECIAL_INCLUDE. If you can't find * type size_t anywhere, try replacing "#include <someincludefile.h>" with * "typedef unsigned int size_t;". */ #undef NEED_SPECIAL_INCLUDE /* assume we DON'T need it, for starters */ #ifdef NEED_SPECIAL_INCLUDE #include <someincludefile.h> #endif typedef size_t my_size_t; /* The payoff: do we have size_t now? */ /* The next question is whether your compiler supports ANSI-style function * prototypes. You need to know this in order to choose between using * makefile.ansi and using makefile.unix. * The #define line below is set to assume you have ANSI function prototypes. * If you get an error in this group of lines, undefine HAVE_PROTOTYPES. */ #define HAVE_PROTOTYPES #ifdef HAVE_PROTOTYPES int testfunction (int arg1, int * arg2); /* check prototypes */ struct methods_struct { /* check method-pointer declarations */ int (*error_exit) (char *msgtext); int (*trace_message) (char *msgtext); int (*another_method) (void); }; int testfunction (int arg1, int * arg2) /* check defin