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 | |
DRC | ec84a6b | 2010-02-15 11:05:53 +0000 | [diff] [blame] | 4 | echo prefix=$prefix |
| 5 | echo libdir=$libdir |
| 6 | |
DRC | bf0fab9 | 2010-02-12 22:22:01 +0000 | [diff] [blame] | 7 | AC_PREREQ([2.56]) |
DRC | ec84a6b | 2010-02-15 11:05:53 +0000 | [diff] [blame] | 8 | AC_INIT([libjpeg-turbo], [0.0.90]) |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 9 | |
| 10 | AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) |
DRC | 8ff1f25 | 2010-02-15 11:08:57 +0000 | [diff] [blame^] | 11 | AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 12 | |
| 13 | # Always build with prototypes |
| 14 | AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) |
| 15 | # Don't use undefined types |
| 16 | AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) |
| 17 | |
| 18 | # Checks for programs. |
DRC | e7b699d | 2010-02-14 07:39:07 +0000 | [diff] [blame] | 19 | SAVED_CFLAGS=${CFLAGS} |
| 20 | SAVED_CXXFLAGS=${CXXFLAGS} |
Pierre Ossman | 2ae181c | 2009-03-09 13:21:27 +0000 | [diff] [blame] | 21 | AC_PROG_CPP |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 22 | AC_PROG_CC |
Adam Tkac | 6e075fc | 2009-04-03 14:47:50 +0000 | [diff] [blame] | 23 | AC_PROG_CXX |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 24 | AC_PROG_INSTALL |
| 25 | AC_PROG_LIBTOOL |
| 26 | AC_PROG_LN_S |
| 27 | |
DRC | e7b699d | 2010-02-14 07:39:07 +0000 | [diff] [blame] | 28 | if test "x${GCC}" = "xyes"; then |
| 29 | if test "x${SAVED_CFLAGS}" = "x"; then |
| 30 | CFLAGS=-O3 |
| 31 | fi |
| 32 | if test "x${SAVED_CXXFLAGS}" = "x"; then |
| 33 | CXXFLAGS=-O3 |
| 34 | fi |
| 35 | fi |
| 36 | |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 37 | # Checks for libraries. |
| 38 | |
| 39 | # Checks for header files. |
| 40 | AC_HEADER_STDC |
| 41 | AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) |
| 42 | AC_CHECK_HEADER([sys/types.h], AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h])) |
| 43 | |
| 44 | # Checks for typedefs, structures, and compiler characteristics. |
| 45 | AC_C_CONST |
| 46 | AC_C_CHAR_UNSIGNED |
| 47 | AC_C_INLINE |
| 48 | AC_TYPE_SIZE_T |
| 49 | AC_CHECK_TYPES([unsigned char, unsigned short]) |
| 50 | |
| 51 | AC_MSG_CHECKING([if right shift is signed]) |
| 52 | AC_TRY_RUN( |
| 53 | [#include <stdio.h> |
| 54 | int is_shifting_signed (long arg) { |
| 55 | long res = arg >> 4; |
| 56 | |
| 57 | if (res == -0x7F7E80CL) |
| 58 | return 1; /* right shift is signed */ |
| 59 | |
| 60 | /* see if unsigned-shift hack will fix it. */ |
| 61 | /* we can't just test exact value since it depends on width of long... */ |
| 62 | res |= (~0L) << (32-4); |
| 63 | if (res == -0x7F7E80CL) |
| 64 | return 0; /* right shift is unsigned */ |
| 65 | |
| 66 | printf("Right shift isn't acting as I expect it to.\n"); |
| 67 | printf("I fear the JPEG software will not work at all.\n\n"); |
| 68 | return 0; /* try it with unsigned anyway */ |
| 69 | } |
| 70 | int main (void) { |
| 71 | exit(is_shifting_signed(-0x7F7E80B1L)); |
| 72 | }], |
| 73 | [AC_MSG_RESULT(no) |
| 74 | AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])], |
| 75 | [AC_MSG_RESULT(yes)], |
| 76 | [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) |
| 77 | |
| 78 | # test whether global names are unique to at least 15 chars |
| 79 | AC_MSG_CHECKING([for short external names]) |
| 80 | AC_TRY_LINK( |
| 81 | [int possibly_duplicate_function () { return 0; } |
| 82 | int possibly_dupli_function () { return 1; }], [ ], |
| 83 | [AC_MSG_RESULT(ok)], |
| 84 | [AC_MSG_RESULT(short) |
| 85 | AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, [Define if you need short function names])]) |
| 86 | |
| 87 | # Checks for library functions. |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 88 | AC_CHECK_FUNCS([memset memcpy], [], |
| 89 | [AC_DEFINE([NEED_BSD_STRINGS], 1, |
| 90 | [Define if you have BSD-like bzero and bcopy])]) |
| 91 | |
Pierre Ossman | 2ae181c | 2009-03-09 13:21:27 +0000 | [diff] [blame] | 92 | # Set flags to indicate platform |
| 93 | case "$host_os" in |
| 94 | cygwin* | mingw* | pw32* | interix*) |
| 95 | is_win32=1 |
| 96 | ;; |
| 97 | esac |
| 98 | AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "x1"]) |
| 99 | |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 100 | # SIMD is optional |
| 101 | AC_ARG_WITH([simd], |
| 102 | AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.])) |
| 103 | if test "x${with_simd}" != "xno"; then |
| 104 | # Check if we're on a supported CPU |
| 105 | AC_MSG_CHECKING([if we have SIMD optimisations for cpu type]) |
| 106 | case "$host_cpu" in |
| 107 | x86_64) |
| 108 | AC_MSG_RESULT([yes (x86_64)]) |
| 109 | AC_PROG_NASM |
| 110 | simd_arch=x86_64 |
| 111 | ;; |
| 112 | i*86 | x86 | ia32) |
| 113 | AC_MSG_RESULT([yes (i386)]) |
| 114 | AC_PROG_NASM |
| 115 | simd_arch=i386 |
| 116 | ;; |
| 117 | *) |
| 118 | AC_MSG_RESULT([no ("$host_cpu")]) |
| 119 | AC_MSG_ERROR([CPU is not supported]) |
| 120 | ;; |
| 121 | esac |
Pierre Ossman | ba82ddf | 2009-06-29 11:20:42 +0000 | [diff] [blame] | 122 | |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 123 | if test "x${with_simd}" != "xno"; then |
| 124 | AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) |
| 125 | fi |
| 126 | fi |
DRC | 411dcf5 | 2010-02-12 04:28:29 +0000 | [diff] [blame] | 127 | |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 128 | AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) |
Pierre Ossman | ba82ddf | 2009-06-29 11:20:42 +0000 | [diff] [blame] | 129 | AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) |
| 130 | AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 131 | |
Pierre Ossman | ba0ce39 | 2009-03-06 15:30:42 +0000 | [diff] [blame] | 132 | # jconfig.h is the file we use, but we have another before that to |
| 133 | # fool autoheader. the reason is that we include this header in our |
| 134 | # API headers, which can screw things up for users of the lib. |
| 135 | # 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] | 136 | AC_CONFIG_HEADERS([config.h]) |
| 137 | AC_CONFIG_HEADERS([jconfig.h]) |
Pierre Ossman | 3a65ef4 | 2009-03-16 13:34:18 +0000 | [diff] [blame] | 138 | AC_CONFIG_FILES([Makefile simd/Makefile]) |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 139 | AC_OUTPUT |