2008-09-28 09:08:48 +04:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2010-02-13 01:22:01 +03:00
AC_PREREQ([2.56])
2012-12-31 13:44:31 +04:00
AC_INIT([libjpeg-turbo], [1.2.90])
2010-02-15 14:32:23 +03:00
BUILD=`date +%Y%m%d`
2008-09-28 09:08:48 +04:00
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
2010-02-15 14:08:57 +03:00
AC_PREFIX_DEFAULT(/opt/libjpeg-turbo)
2008-09-28 09:08:48 +04:00
# Always build with prototypes
AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes])
# Checks for programs.
2010-02-14 10:39:07 +03:00
SAVED_CFLAGS=${CFLAGS}
2011-02-27 00:07:50 +03:00
SAVED_CPPFLAGS=${CPPFLAGS}
2009-03-09 16:21:27 +03:00
AC_PROG_CPP
2008-09-28 09:08:48 +04:00
AC_PROG_CC
2011-05-03 12:47:43 +04:00
AM_PROG_AS
2008-09-28 09:08:48 +04:00
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
2010-08-22 01:14:17 +04:00
# 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.])])
2010-02-14 10:39:07 +03:00
if test "x${GCC}" = "xyes"; then
if test "x${SAVED_CFLAGS}" = "x"; then
CFLAGS=-O3
fi
2011-02-27 00:07:50 +03:00
if test "x${SAVED_CPPFLAGS}" = "x"; then
CPPFLAGS=-Wall
fi
2010-02-14 10:39:07 +03:00
fi
2010-02-17 01:35:25 +03:00
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
2008-09-28 09:08:48 +04:00
# 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 <stdio.h>
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])])
2010-10-18 04:15:31 +04:00
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],
2011-02-18 10:00:38 +03:00
AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
2010-10-18 04:15:31 +04:00
if test "x${with_jpeg8}" = "xyes"; then
JPEG_LIB_VERSION=80
2010-10-08 12:05:44 +04:00
else
2010-10-18 04:15:31 +04:00
if test "x${with_jpeg7}" = "xyes"; then
JPEG_LIB_VERSION=70
else
JPEG_LIB_VERSION=62
fi
2010-10-08 12:05:44 +04:00
fi
2009-06-27 04:00:00 +04:00
fi
2010-10-18 04:15:31 +04:00
JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
2010-10-19 10:38:57 +04:00
AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
2010-10-18 04:15:31 +04:00
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
2013-01-19 03:42:31 +04:00
# 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)
fi
fi
AC_MSG_CHECKING([libjpeg shared library version])
AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
SO_MAJOR_VERSION=`expr $SO_MAJOR_VERSION + $SO_AGE`
2010-10-18 04:15:31 +04:00
AC_SUBST(SO_MAJOR_VERSION)
AC_SUBST(SO_MINOR_VERSION)
2013-01-19 03:42:31 +04:00
AC_SUBST(SO_AGE)
AC_SUBST(MEM_SRCDST_FUNCTIONS)
2010-10-08 12:05:44 +04:00
2011-12-18 20:29:35 +04:00
AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
2010-11-07 22:12:30 +03:00
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], [])
2010-10-19 10:38:57 +04:00
AC_MSG_CHECKING([whether the linker supports version scripts])
SAVED_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
cat > conftest.map <<EOF
VERS_1 {
global: *;
};
EOF
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
[VERSION_SCRIPT_FLAG=-Wl,--version-script,; AC_MSG_RESULT([yes (GNU style)])], [])
if test "x$VERSION_SCRIPT_FLAG" = "x"; then
LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
[VERSION_SCRIPT_FLAG=-Wl,-M,; AC_MSG_RESULT([yes (Sun style)])], [])
fi
if test "x$VERSION_SCRIPT_FLAG" = "x"; then
VERSION_SCRIPT=no
AC_MSG_RESULT(no)
fi
LDFLAGS="$SAVED_LDFLAGS"
2011-02-25 03:23:44 +03:00
AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
2010-10-19 10:38:57 +04:00
AC_MSG_RESULT($VERSION_SCRIPT)
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
AC_SUBST(VERSION_SCRIPT_FLAG)
2011-09-07 10:31:00 +04:00
# Check for non-broken inline under various spellings
AC_MSG_CHECKING(for inline)
ljt_cv_inline=""
AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; }
int bar() { return foo();], ljt_cv_inline="__attribute__((always_inline))",
AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
int bar() { return foo();], ljt_cv_inline="__inline__",
AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
int bar() { return foo();], ljt_cv_inline="__inline",
AC_TRY_COMPILE(, [} inline int foo() { return 0; }
int bar() { return foo();], ljt_cv_inline="inline"))))
AC_MSG_RESULT($ljt_cv_inline)
AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
2013-01-13 15:25:20 +04:00
# Arithmetic coding support
2011-01-05 00:40:11 +03:00
AC_MSG_CHECKING([whether to include arithmetic encoding support])
2010-11-23 09:50:14 +03:00
AC_ARG_WITH([arith-enc],
2013-01-18 01:48:11 +04:00
AC_HELP_STRING([--without-arith-enc], [Do not include arithmetic encoding support]))
2010-11-23 09:50:14 +03:00
if test "x$with_arith_enc" = "xno"; then
AC_MSG_RESULT(no)
else
AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
2011-01-05 00:40:11 +03:00
AC_MSG_CHECKING([whether to include arithmetic decoding support])
2010-11-23 09:50:14 +03:00
AC_ARG_WITH([arith-dec],
2013-01-18 01:48:11 +04:00
AC_HELP_STRING([--without-arith-dec], [Do not include arithmetic decoding support]))
2010-11-23 09:50:14 +03:00
if test "x$with_arith_dec" = "xno"; then
AC_MSG_RESULT(no)
else
AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
2013-01-13 15:25:20 +04:00
# TurboJPEG support
AC_MSG_CHECKING([whether to build TurboJPEG/OSS C wrapper])
AC_ARG_WITH([turbojpeg],
2013-01-18 01:48:11 +04:00
AC_HELP_STRING([--without-turbojpeg],[Do not include the TurboJPEG/OSS wrapper library and associated test programs]))
2013-01-13 15:25:20 +04:00
if test "x$with_turbojpeg" = "xno"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
# Java support
2011-04-01 04:20:33 +04:00
AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
if test "x$JAVAC" = "x"; then
JAVAC=javac
fi
AC_SUBST(JAVAC)
AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
AC_SUBST(JAVACFLAGS)
AC_ARG_VAR(JAR, [Java archive command (default: jar)])
if test "x$JAR" = "x"; then
JAR=jar
fi
AC_SUBST(JAR)
AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
if test "x$JAVA" = "x"; then
JAVA=java
fi
AC_SUBST(JAVA)
AC_ARG_VAR(JNI_CFLAGS, [C compiler flags needed to include jni.h (default: -I/System/Library/Frameworks/JavaVM.framework/Headers on OS X, '-I/usr/java/include -I/usr/java/include/solaris' on Solaris, and '-I/usr/java/default/include -I/usr/java/default/include/linux' on Linux)])
2011-02-05 01:16:41 +03:00
2011-04-01 04:20:33 +04:00
AC_MSG_CHECKING([whether to build TurboJPEG/OSS Java wrapper])
AC_ARG_WITH([java],
AC_HELP_STRING([--with-java],[Build Java wrapper for the TurboJPEG/OSS library]))
2013-01-13 15:25:20 +04:00
if test "x$with_turbojpeg" = "xno"; then
with_java=no
fi
2011-02-06 18:35:38 +03:00
2011-02-06 18:51:27 +03:00
RPM_CONFIG_ARGS=
2011-04-01 04:20:33 +04:00
WITH_JAVA=0
if test "x$with_java" = "xyes"; then
2011-02-04 14:06:36 +03:00
AC_MSG_RESULT(yes)
2011-02-06 18:35:38 +03:00
case $host_os in
darwin*)
2011-03-31 12:03:26 +04:00
DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
2011-02-06 18:35:38 +03:00
;;
solaris*)
2011-03-31 12:03:26 +04:00
DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
2011-02-06 18:35:38 +03:00
;;
linux*)
2011-03-31 12:03:26 +04:00
DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
2011-02-06 18:35:38 +03:00
;;
esac
2011-03-31 12:03:26 +04:00
if test "x$JNI_CFLAGS" = "x"; then
JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
2011-02-06 18:35:38 +03:00
fi
2011-02-05 01:16:41 +03:00
SAVE_CPPFLAGS=${CPPFLAGS}
2011-03-31 12:03:26 +04:00
CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
2011-02-05 01:16:41 +03:00
AC_CHECK_HEADERS([jni.h], [DUMMY=1],
[AC_MSG_ERROR([Could not find JNI header file])])
CPPFLAGS=${SAVE_CPPFLAGS}
2011-03-31 12:03:26 +04:00
AC_SUBST(JNI_CFLAGS)
2011-02-06 18:51:27 +03:00
2011-04-01 04:20:33 +04:00
RPM_CONFIG_ARGS=--with-java
JAVA_RPM_CONTENTS_1='%dir /opt/%{name}/classes'
JAVA_RPM_CONTENTS_2=/opt/%{name}/classes/turbojpeg.jar
WITH_JAVA=1
2011-02-04 14:06:36 +03:00
else
AC_MSG_RESULT(no)
fi
2011-04-01 04:20:33 +04:00
AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
AC_SUBST(WITH_JAVA)
AC_SUBST(JAVA_RPM_CONTENTS_1)
AC_SUBST(JAVA_RPM_CONTENTS_2)
2011-02-06 18:51:27 +03:00
AC_SUBST(RPM_CONFIG_ARGS)
2011-02-04 14:06:36 +03:00
2011-06-15 02:16:50 +04:00
# optionally force using gas-preprocessor.pl for compatibility testing
AC_ARG_WITH([gas-preprocessor],
AC_HELP_STRING([--with-gas-preprocessor],[Force using gas-preprocessor.pl on ARM.]))
if test "x${with_gas_preprocessor}" = "xyes"; then
case $host_os in
darwin*)
CCAS="gas-preprocessor.pl -fix-unreq $CC"
;;
*)
CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
;;
esac
AC_SUBST([CCAS])
fi
2010-02-12 08:37:07 +03:00
# SIMD is optional
AC_ARG_WITH([simd],
2013-01-18 01:48:11 +04:00
AC_HELP_STRING([--without-simd],[Do not include SIMD extensions]))
2010-02-12 08:37:07 +03:00
if test "x${with_simd}" != "xno"; then
# Check if we're on a supported CPU
AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
case "$host_cpu" in
2010-05-18 00:47:57 +04:00
x86_64 | amd64)
2010-02-12 08:37:07 +03:00
AC_MSG_RESULT([yes (x86_64)])
AC_PROG_NASM
simd_arch=x86_64
;;
i*86 | x86 | ia32)
AC_MSG_RESULT([yes (i386)])
AC_PROG_NASM
simd_arch=i386
;;
2011-05-03 12:47:43 +04:00
arm*)
AC_MSG_RESULT([yes (arm)])
AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
[AC_MSG_RESULT([yes])
simd_arch=arm],
[AC_MSG_RESULT([no])
with_simd=no
AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])])
;;
2010-02-12 08:37:07 +03:00
*)
AC_MSG_RESULT([no ("$host_cpu")])
2010-06-10 22:52:41 +04:00
AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
with_simd=no;
2010-02-12 08:37:07 +03:00
;;
esac
if test "x${with_simd}" != "xno"; then
AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
fi
fi
AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
2011-05-03 12:47:43 +04:00
AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
2009-06-29 15:20:42 +04:00
AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
2011-05-03 12:47:43 +04:00
AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
2010-05-18 00:47:57 +04:00
AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
2013-01-13 15:25:20 +04:00
AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
2009-03-09 16:15:56 +03:00
2010-02-15 14:32:23 +03:00
case "$host_cpu" in
x86_64)
RPMARCH=x86_64
2010-02-15 15:06:27 +03:00
DEBARCH=amd64
2010-02-15 14:32:23 +03:00
;;
i*86 | x86 | ia32)
RPMARCH=i386
2010-02-15 15:06:27 +03:00
DEBARCH=i386
2010-02-15 14:32:23 +03:00
;;
esac
AC_SUBST(RPMARCH)
2010-02-15 15:06:27 +03:00
AC_SUBST(DEBARCH)
2010-02-15 14:32:23 +03:00
AC_SUBST(BUILD)
2010-10-10 10:54:21 +04:00
AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
2010-02-15 14:32:23 +03:00
2009-03-06 18:30:42 +03:00
# jconfig.h is the file we use, but we have another before that to
# fool autoheader. the reason is that we include this header in our
# API headers, which can screw things up for users of the lib.
# jconfig.h is a minimal version that allows this package to be built
2008-09-28 09:08:48 +04:00
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([jconfig.h])
2011-03-22 12:31:25 +03:00
AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec:release/libjpeg-turbo.spec.in])
AC_CONFIG_FILES([pkgscripts/makecygwinpkg:release/makecygwinpkg.in])
AC_CONFIG_FILES([pkgscripts/makedpkg:release/makedpkg.in])
AC_CONFIG_FILES([pkgscripts/makemacpkg:release/makemacpkg.in])
AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in])
AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in])
AC_CONFIG_FILES([pkgscripts/uninstall:release/uninstall.in])
2013-01-13 15:25:20 +04:00
if test "x$with_turbojpeg" != "xno"; then
2012-01-31 15:38:13 +04:00
AC_CONFIG_FILES([tjbenchtest])
2013-01-13 15:25:20 +04:00
fi
if test "x$with_java" = "xyes"; then
2012-09-24 06:27:55 +04:00
AC_CONFIG_FILES([tjbenchtest.java])
2012-01-31 15:38:13 +04:00
AC_CONFIG_FILES([tjexampletest])
2013-01-13 15:25:20 +04:00
fi
2010-10-19 10:38:57 +04:00
AC_CONFIG_FILES([libjpeg.map])
2009-03-16 16:34:18 +03:00
AC_CONFIG_FILES([Makefile simd/Makefile])
2011-04-01 04:37:20 +04:00
AC_CONFIG_FILES([java/Makefile])
2008-09-28 09:08:48 +04:00
AC_OUTPUT