configure.ac revision 8ff1f254f3a78f398394cd4c032e2189087ecbb2
1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4echo prefix=$prefix 5echo libdir=$libdir 6 7AC_PREREQ([2.56]) 8AC_INIT([libjpeg-turbo], [0.0.90]) 9 10AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) 11AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) 12 13# Always build with prototypes 14AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) 15# Don't use undefined types 16AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) 17 18# Checks for programs. 19SAVED_CFLAGS=${CFLAGS} 20SAVED_CXXFLAGS=${CXXFLAGS} 21AC_PROG_CPP 22AC_PROG_CC 23AC_PROG_CXX 24AC_PROG_INSTALL 25AC_PROG_LIBTOOL 26AC_PROG_LN_S 27 28if 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 35fi 36 37# Checks for libraries. 38 39# Checks for header files. 40AC_HEADER_STDC 41AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) 42AC_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. 45AC_C_CONST 46AC_C_CHAR_UNSIGNED 47AC_C_INLINE 48AC_TYPE_SIZE_T 49AC_CHECK_TYPES([unsigned char, unsigned short]) 50 51AC_MSG_CHECKING([if right shift is signed]) 52AC_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 79AC_MSG_CHECKING([for short external names]) 80AC_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. 88AC_CHECK_FUNCS([memset memcpy], [], 89 [AC_DEFINE([NEED_BSD_STRINGS], 1, 90 [Define if you have BSD-like bzero and bcopy])]) 91 92# Set flags to indicate platform 93case "$host_os" in 94 cygwin* | mingw* | pw32* | interix*) 95 is_win32=1 96 ;; 97esac 98AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "x1"]) 99 100# SIMD is optional 101AC_ARG_WITH([simd], 102 AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.])) 103if 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 122 123 if test "x${with_simd}" != "xno"; then 124 AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) 125 fi 126fi 127 128AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) 129AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) 130AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) 131 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 136AC_CONFIG_HEADERS([config.h]) 137AC_CONFIG_HEADERS([jconfig.h]) 138AC_CONFIG_FILES([Makefile simd/Makefile]) 139AC_OUTPUT 140