# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.56]) AC_INIT([libjpeg-turbo], [1.4.0]) BUILD=`date +%Y%m%d` AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # Checks for programs. SAVED_CFLAGS=${CFLAGS} SAVED_CPPFLAGS=${CPPFLAGS} AC_PROG_CPP AC_PROG_CC m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AM_PROG_AS AM_PROG_CC_C_O 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*) ;; *) AC_CHECK_SIZEOF(long) if test "${ac_cv_sizeof_long}" = "8"; then libdir='${exec_prefix}/lib64' elif test "${ac_cv_sizeof_long}" = "4"; then libdir='${exec_prefix}/lib32' fi ;; 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 locale.h string.h]) AC_CHECK_HEADER([sys/types.h], AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include to get size_t.])) # 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 your (broken) compiler shifts signed values as if they were unsigned.])], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) # Checks for library functions. AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, [Define if you have BSD-like bzero and bcopy in rather than memset/memcpy in .])]) 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 <