Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| 4 | AC_PREREQ([2.61]) |
| 5 | AC_INIT([libjpeg], [6.b]) |
| 6 | |
| 7 | AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) |
| 8 | |
| 9 | # Always build with prototypes |
| 10 | AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) |
| 11 | # Don't use undefined types |
| 12 | AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) |
| 13 | |
| 14 | # Checks for programs. |
| 15 | AC_PROG_CC |
| 16 | AC_PROG_INSTALL |
| 17 | AC_PROG_LIBTOOL |
| 18 | AC_PROG_LN_S |
| 19 | |
| 20 | # Checks for libraries. |
| 21 | |
| 22 | # Checks for header files. |
| 23 | AC_HEADER_STDC |
| 24 | AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) |
| 25 | AC_CHECK_HEADER([sys/types.h], AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h])) |
| 26 | |
| 27 | # Checks for typedefs, structures, and compiler characteristics. |
| 28 | AC_C_CONST |
| 29 | AC_C_CHAR_UNSIGNED |
| 30 | AC_C_INLINE |
| 31 | AC_TYPE_SIZE_T |
| 32 | AC_CHECK_TYPES([unsigned char, unsigned short]) |
| 33 | |
| 34 | AC_MSG_CHECKING([if right shift is signed]) |
| 35 | AC_TRY_RUN( |
| 36 | [#include <stdio.h> |
| 37 | int is_shifting_signed (long arg) { |
| 38 | long res = arg >> 4; |
| 39 | |
| 40 | if (res == -0x7F7E80CL) |
| 41 | return 1; /* right shift is signed */ |
| 42 | |
| 43 | /* see if unsigned-shift hack will fix it. */ |
| 44 | /* we can't just test exact value since it depends on width of long... */ |
| 45 | res |= (~0L) << (32-4); |
| 46 | if (res == -0x7F7E80CL) |
| 47 | return 0; /* right shift is unsigned */ |
| 48 | |
| 49 | printf("Right shift isn't acting as I expect it to.\n"); |
| 50 | printf("I fear the JPEG software will not work at all.\n\n"); |
| 51 | return 0; /* try it with unsigned anyway */ |
| 52 | } |
| 53 | int main (void) { |
| 54 | exit(is_shifting_signed(-0x7F7E80B1L)); |
| 55 | }], |
| 56 | [AC_MSG_RESULT(no) |
| 57 | AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])], |
| 58 | [AC_MSG_RESULT(yes)], |
| 59 | [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) |
| 60 | |
| 61 | # test whether global names are unique to at least 15 chars |
| 62 | AC_MSG_CHECKING([for short external names]) |
| 63 | AC_TRY_LINK( |
| 64 | [int possibly_duplicate_function () { return 0; } |
| 65 | int possibly_dupli_function () { return 1; }], [ ], |
| 66 | [AC_MSG_RESULT(ok)], |
| 67 | [AC_MSG_RESULT(short) |
| 68 | AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, [Define if you need short function names])]) |
| 69 | |
| 70 | # Checks for library functions. |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 71 | AC_CHECK_FUNCS([memset memcpy], [], |
| 72 | [AC_DEFINE([NEED_BSD_STRINGS], 1, |
| 73 | [Define if you have BSD-like bzero and bcopy])]) |
| 74 | |
Pierre Ossman | ba0ce39 | 2009-03-06 15:30:42 +0000 | [diff] [blame^] | 75 | # jconfig.h is the file we use, but we have another before that to |
| 76 | # fool autoheader. the reason is that we include this header in our |
| 77 | # API headers, which can screw things up for users of the lib. |
| 78 | # jconfig.h is a minimal version that allows this package to be built |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 79 | AC_CONFIG_HEADERS([config.h]) |
| 80 | AC_CONFIG_HEADERS([jconfig.h]) |
| 81 | AC_CONFIG_FILES([Makefile]) |
| 82 | AC_OUTPUT |