# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.56]) AC_INIT([libjpeg-turbo], [1.3.0]) BUILD=`date +%Y%m%d` AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) # Always build with prototypes AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) # Checks for programs. SAVED_CFLAGS=${CFLAGS} SAVED_CPPFLAGS=${CPPFLAGS} AC_PROG_CPP AC_PROG_CC AM_PROG_AS AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_LN_S # When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is # being created, and thus we install things into specific locations. old_prefix=${prefix} if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then prefix=$ac_default_prefix fi DATADIR=`eval echo ${datadir}` DATADIR=`eval echo $DATADIR` if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then datadir='${prefix}' fi DATADIR=`eval echo ${datarootdir}` DATADIR=`eval echo $DATADIR` if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then datarootdir='${prefix}' fi old_exec_prefix=${exec_prefix} if test "x$exec_prefix" = "xNONE"; then exec_prefix=${prefix} fi if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then LIBDIR=`eval echo ${libdir}` LIBDIR=`eval echo $LIBDIR` if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then case $host_os in darwin*) ;; *) case "$host_cpu" in x86_64 | amd64) libdir='${exec_prefix}/lib64' ;; i*86 | x86 | ia32) libdir='${exec_prefix}/lib32' ;; esac ;; esac fi fi exec_prefix=${old_exec_prefix} prefix=${old_prefix} # Check whether compiler supports pointers to undefined structures AC_MSG_CHECKING(whether compiler supports pointers to undefined structures) AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], , AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1], [Compiler does not support pointers to undefined structures.])]) if test "x${GCC}" = "xyes"; then if test "x${SAVED_CFLAGS}" = "x"; then CFLAGS=-O3 fi if test "x${SAVED_CPPFLAGS}" = "x"; then CPPFLAGS=-Wall fi fi AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) if test "x${SUNCC}" = "xyes"; then if test "x${SAVED_CFLAGS}" = "x"; then CFLAGS=-xO5 fi fi # Checks for libraries. # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) AC_CHECK_HEADER([sys/types.h], AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h])) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_CHAR_UNSIGNED AC_C_INLINE AC_TYPE_SIZE_T AC_CHECK_TYPES([unsigned char, unsigned short]) AC_MSG_CHECKING([if right shift is signed]) AC_TRY_RUN( [#include int is_shifting_signed (long arg) { long res = arg >> 4; if (res == -0x7F7E80CL) return 1; /* right shift is signed */ /* see if unsigned-shift hack will fix it. */ /* we can't just test exact value since it depends on width of long... */ res |= (~0L) << (32-4); if (res == -0x7F7E80CL) return 0; /* right shift is unsigned */ printf("Right shift isn't acting as I expect it to.\n"); printf("I fear the JPEG software will not work at all.\n\n"); return 0; /* try it with unsigned anyway */ } int main (void) { exit(is_shifting_signed(-0x7F7E80B1L)); }], [AC_MSG_RESULT(no) AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) # test whether global names are unique to at least 15 chars AC_MSG_CHECKING([for short external names]) AC_TRY_LINK( [int possibly_duplicate_function () { return 0; } int possibly_dupli_function () { return 1; }], [ ], [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(short) AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, [Define if you need short function names])]) # Checks for library functions. AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, [Define if you have BSD-like bzero and bcopy])]) AC_MSG_CHECKING([libjpeg API version]) AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)]) if test "x$JPEG_LIB_VERSION" = "x"; then AC_ARG_WITH([jpeg7], AC_HELP_STRING([--with-jpeg7], [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)])) AC_ARG_WITH([jpeg8], AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)])) if test "x${with_jpeg8}" = "xyes"; then JPEG_LIB_VERSION=80 else if test "x${with_jpeg7}" = "xyes"; then JPEG_LIB_VERSION=70 else JPEG_LIB_VERSION=62 fi fi fi JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10` AC_SUBST(JPEG_LIB_VERSION_DECIMAL) AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL]) AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION], [libjpeg API version]) AC_ARG_VAR(SO_MAJOR_VERSION, [Major version of the libjpeg-turbo shared library (default is determined by the API version)]) AC_ARG_VAR(SO_MINOR_VERSION, [Minor version of the libjpeg-turbo shared library (default is determined by the API version)]) if test "x$SO_MAJOR_VERSION" = "x"; then case "$JPEG_LIB_VERSION" in 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;; *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;; esac fi if test "x$SO_MINOR_VERSION" = "x"; then case "$JPEG_LIB_VERSION" in 80) SO_MINOR_VERSION=2 ;; *) SO_MINOR_VERSION=0 ;; esac fi RPM_CONFIG_ARGS= # Memory source/destination managers SO_AGE=0 MEM_SRCDST_FUNCTIONS= if test "x${with_jpeg8}" != "xyes"; then AC_MSG_CHECKING([whether to include in-memory source/destination managers]) AC_ARG_WITH([mem-srcdst], AC_HELP_STRING([--without-mem-srcdst], [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI])) if test "x$with_mem_srcdst" != "xno"; then AC_MSG_RESULT(yes) AC_DEFINE([MEM_SRCDST_SUPPORTED], [1], [Support in-memory source/destination managers]) SO_AGE=1 MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;"; else AC_MSG_RESULT(no) RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst" fi fi AC_MSG_CHECKING([libjpeg shared library version]) AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION]) LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE` AC_SUBST(LIBTOOL_CURRENT) AC_SUBST(SO_MAJOR_VERSION) AC_SUBST(SO_MINOR_VERSION) AC_SUBST(SO_AGE) AC_SUBST(MEM_SRCDST_FUNCTIONS) AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version]) VERSION_SCRIPT=yes AC_ARG_ENABLE([ld-version-script], AS_HELP_STRING([--disable-ld-version-script], [Disable linker version script for libjpeg-turbo (default is to use linker version script if the linker supports it)]), [VERSION_SCRIPT=$enableval], []) AC_MSG_CHECKING([whether the linker supports version scripts]) SAVED_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map" cat > conftest.map <