2
# Process this file with autoconf to produce a configure script.
5
AC_INIT([libjpeg-turbo], [1.1.90])
8
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
9
AC_PREFIX_DEFAULT(/opt/libjpeg-turbo)
11
# Always build with prototypes
12
AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes])
14
# Checks for programs.
15
SAVED_CFLAGS=${CFLAGS}
16
SAVED_CPPFLAGS=${CPPFLAGS}
24
# Check whether compiler supports pointers to undefined structures
25
AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
26
AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], ,
29
AC_DEFINE([INCOMPLETE_TYPES_BROKEN],[1],[Compiler does not support pointers to undefined structures.])])
31
if test "x${GCC}" = "xyes"; then
32
if test "x${SAVED_CFLAGS}" = "x"; then
35
if test "x${SAVED_CPPFLAGS}" = "x"; then
40
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
41
if test "x${SUNCC}" = "xyes"; then
42
if test "x${SAVED_CFLAGS}" = "x"; then
47
# Checks for libraries.
49
# Checks for header files.
51
AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
52
AC_CHECK_HEADER([sys/types.h], AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h]))
54
# Checks for typedefs, structures, and compiler characteristics.
59
AC_CHECK_TYPES([unsigned char, unsigned short])
61
AC_MSG_CHECKING([if right shift is signed])
64
int is_shifting_signed (long arg) {
67
if (res == -0x7F7E80CL)
68
return 1; /* right shift is signed */
70
/* see if unsigned-shift hack will fix it. */
71
/* we can't just test exact value since it depends on width of long... */
72
res |= (~0L) << (32-4);
73
if (res == -0x7F7E80CL)
74
return 0; /* right shift is unsigned */
76
printf("Right shift isn't acting as I expect it to.\n");
77
printf("I fear the JPEG software will not work at all.\n\n");
78
return 0; /* try it with unsigned anyway */
81
exit(is_shifting_signed(-0x7F7E80B1L));
84
AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])],
86
[AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
88
# test whether global names are unique to at least 15 chars
89
AC_MSG_CHECKING([for short external names])
91
[int possibly_duplicate_function () { return 0; }
92
int possibly_dupli_function () { return 1; }], [ ],
95
AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, [Define if you need short function names])])
97
# Checks for library functions.
98
AC_CHECK_FUNCS([memset memcpy], [],
99
[AC_DEFINE([NEED_BSD_STRINGS], 1,
100
[Define if you have BSD-like bzero and bcopy])])
102
AC_MSG_CHECKING([libjpeg API version])
103
AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
104
if test "x$JPEG_LIB_VERSION" = "x"; then
106
AC_HELP_STRING([--with-jpeg7], [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
108
AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
109
if test "x${with_jpeg8}" = "xyes"; then
112
if test "x${with_jpeg7}" = "xyes"; then
119
JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
120
AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
121
AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
122
AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION], [libjpeg API version])
124
AC_MSG_CHECKING([libjpeg shared library version])
125
AC_ARG_VAR(SO_MAJOR_VERSION, [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
126
AC_ARG_VAR(SO_MINOR_VERSION, [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
127
if test "x$SO_MAJOR_VERSION" = "x"; then
128
case "$JPEG_LIB_VERSION" in
129
62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
130
*) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
133
if test "x$SO_MINOR_VERSION" = "x"; then
134
case "$JPEG_LIB_VERSION" in
135
80) SO_MINOR_VERSION=2 ;;
136
*) SO_MINOR_VERSION=0 ;;
139
AC_MSG_RESULT([$SO_MAJOR_VERSION:$SO_MINOR_VERSION])
140
AC_SUBST(SO_MAJOR_VERSION)
141
AC_SUBST(SO_MINOR_VERSION)
144
AC_ARG_ENABLE([ld-version-script],
145
AS_HELP_STRING([--disable-ld-version-script],
146
[Disable linker version script for libjpeg-turbo (default is to use linker version script if the linker supports it)]),
147
[VERSION_SCRIPT=$enableval], [])
149
AC_MSG_CHECKING([whether the linker supports version scripts])
150
SAVED_LDFLAGS="$LDFLAGS"
151
LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
152
cat > conftest.map <<EOF
157
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
158
[VERSION_SCRIPT_FLAG=-Wl,--version-script,; AC_MSG_RESULT([yes (GNU style)])], [])
159
if test "x$VERSION_SCRIPT_FLAG" = "x"; then
160
LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
161
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
162
[VERSION_SCRIPT_FLAG=-Wl,-M,; AC_MSG_RESULT([yes (Sun style)])], [])
164
if test "x$VERSION_SCRIPT_FLAG" = "x"; then
168
LDFLAGS="$SAVED_LDFLAGS"
170
AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
171
AC_MSG_RESULT($VERSION_SCRIPT)
173
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
174
AC_SUBST(VERSION_SCRIPT_FLAG)
176
# Check for non-broken inline under various spellings
177
AC_MSG_CHECKING(for inline)
179
AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; }
180
int bar() { return foo();], ljt_cv_inline="__attribute__((always_inline))",
181
AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
182
int bar() { return foo();], ljt_cv_inline="__inline__",
183
AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
184
int bar() { return foo();], ljt_cv_inline="__inline",
185
AC_TRY_COMPILE(, [} inline int foo() { return 0; }
186
int bar() { return foo();], ljt_cv_inline="inline"))))
187
AC_MSG_RESULT($ljt_cv_inline)
188
AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
190
AC_MSG_CHECKING([whether to include arithmetic encoding support])
191
AC_ARG_WITH([arith-enc],
192
AC_HELP_STRING([--without-arith-enc], [Omit arithmetic encoding support]))
193
if test "x$with_arith_enc" = "xno"; then
196
AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
199
AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
201
AC_MSG_CHECKING([whether to include arithmetic decoding support])
202
AC_ARG_WITH([arith-dec],
203
AC_HELP_STRING([--without-arith-dec], [Omit arithmetic decoding support]))
204
if test "x$with_arith_dec" = "xno"; then
207
AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
210
AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
212
AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
214
AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
215
if test "x$JAVAC" = "x"; then
219
AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
221
AC_ARG_VAR(JAR, [Java archive command (default: jar)])
222
if test "x$JAR" = "x"; then
226
AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
227
if test "x$JAVA" = "x"; then
231
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)])
233
AC_MSG_CHECKING([whether to build TurboJPEG/OSS Java wrapper])
235
AC_HELP_STRING([--with-java],[Build Java wrapper for the TurboJPEG/OSS library]))
239
if test "x$with_java" = "xyes"; then
244
DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
247
DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
250
DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
253
if test "x$JNI_CFLAGS" = "x"; then
254
JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
257
SAVE_CPPFLAGS=${CPPFLAGS}
258
CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
259
AC_CHECK_HEADERS([jni.h], [DUMMY=1],
260
[AC_MSG_ERROR([Could not find JNI header file])])
261
CPPFLAGS=${SAVE_CPPFLAGS}
264
RPM_CONFIG_ARGS=--with-java
265
JAVA_RPM_CONTENTS_1='%dir /opt/%{name}/classes'
266
JAVA_RPM_CONTENTS_2=/opt/%{name}/classes/turbojpeg.jar
271
AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
273
AC_SUBST(JAVA_RPM_CONTENTS_1)
274
AC_SUBST(JAVA_RPM_CONTENTS_2)
275
AC_SUBST(RPM_CONFIG_ARGS)
277
# optionally force using gas-preprocessor.pl for compatibility testing
278
AC_ARG_WITH([gas-preprocessor],
279
AC_HELP_STRING([--with-gas-preprocessor],[Force using gas-preprocessor.pl on ARM.]))
280
if test "x${with_gas_preprocessor}" = "xyes"; then
283
CCAS="gas-preprocessor.pl -fix-unreq $CC"
286
CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
294
AC_HELP_STRING([--without-simd],[Omit SIMD extensions.]))
295
if test "x${with_simd}" != "xno"; then
296
# Check if we're on a supported CPU
297
AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
300
AC_MSG_RESULT([yes (x86_64)])
305
AC_MSG_RESULT([yes (i386)])
310
AC_MSG_RESULT([yes (arm)])
311
AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
312
AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
313
[AC_MSG_RESULT([yes])
317
AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])])
320
AC_MSG_RESULT([no ("$host_cpu")])
321
AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
326
if test "x${with_simd}" != "xno"; then
327
AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
331
AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
332
AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
333
AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
334
AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
335
AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
336
AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
352
AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
354
# jconfig.h is the file we use, but we have another before that to
355
# fool autoheader. the reason is that we include this header in our
356
# API headers, which can screw things up for users of the lib.
357
# jconfig.h is a minimal version that allows this package to be built
358
AC_CONFIG_HEADERS([config.h])
359
AC_CONFIG_HEADERS([jconfig.h])
360
AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec:release/libjpeg-turbo.spec.in])
361
AC_CONFIG_FILES([pkgscripts/makecygwinpkg:release/makecygwinpkg.in])
362
AC_CONFIG_FILES([pkgscripts/makedpkg:release/makedpkg.in])
363
AC_CONFIG_FILES([pkgscripts/makemacpkg:release/makemacpkg.in])
364
AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in])
365
AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in])
366
AC_CONFIG_FILES([pkgscripts/uninstall:release/uninstall.in])
367
AC_CONFIG_FILES([pkgscripts/makesunpkg:release/makesunpkg.in])
368
AC_CONFIG_FILES([pkgscripts/pkginfo:release/pkginfo.in])
369
AC_CONFIG_FILES([libjpeg.map])
370
AC_CONFIG_FILES([Makefile simd/Makefile])
371
AC_CONFIG_FILES([java/Makefile])