blob: c327db58f2905accfac266898388c4d312601635 [file] [log] [blame]
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +00001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
DRCbf0fab92010-02-12 22:22:01 +00004AC_PREREQ([2.56])
DRC17745dd2013-04-25 09:45:50 +00005AC_INIT([libjpeg-turbo], [1.3.80])
DRC079b4342010-02-15 11:32:23 +00006BUILD=`date +%Y%m%d`
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +00007
8AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
DRC8ff1f252010-02-15 11:08:57 +00009AC_PREFIX_DEFAULT(/opt/libjpeg-turbo)
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000010
11# Always build with prototypes
12AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000013
14# Checks for programs.
DRCe7b699d2010-02-14 07:39:07 +000015SAVED_CFLAGS=${CFLAGS}
DRCb4a50ce2011-02-26 21:07:50 +000016SAVED_CPPFLAGS=${CPPFLAGS}
Pierre Ossman2ae181c2009-03-09 13:21:27 +000017AC_PROG_CPP
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000018AC_PROG_CC
DRC321e0682011-05-03 08:47:43 +000019AM_PROG_AS
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000020AC_PROG_INSTALL
21AC_PROG_LIBTOOL
22AC_PROG_LN_S
23
DRC764e1e22013-04-19 04:25:14 +000024# When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is
25# being created, and thus we install things into specific locations.
26
27old_prefix=${prefix}
28if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
29 prefix=$ac_default_prefix
30fi
31DATADIR=`eval echo ${datadir}`
32DATADIR=`eval echo $DATADIR`
33if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
34 datadir='${prefix}'
35fi
DRC7175e512013-04-23 22:29:00 +000036DATADIR=`eval echo ${datarootdir}`
37DATADIR=`eval echo $DATADIR`
38if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
39 datarootdir='${prefix}'
40fi
DRC764e1e22013-04-19 04:25:14 +000041
42old_exec_prefix=${exec_prefix}
43if test "x$exec_prefix" = "xNONE"; then
44 exec_prefix=${prefix}
45fi
46
47if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
48 LIBDIR=`eval echo ${libdir}`
49 LIBDIR=`eval echo $LIBDIR`
50 if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then
51 case $host_os in
52 darwin*)
53 ;;
54 *)
DRCc32e0c22013-08-11 22:57:19 +000055 AC_CHECK_SIZEOF(long)
56 if test "${ac_cv_sizeof_long}" = "8"; then
57 libdir='${exec_prefix}/lib64'
58 elif test "${ac_cv_sizeof_long}" = "4"; then
59 libdir='${exec_prefix}/lib32'
60 fi
DRC764e1e22013-04-19 04:25:14 +000061 ;;
62 esac
63 fi
64fi
65exec_prefix=${old_exec_prefix}
66prefix=${old_prefix}
67
DRCbdb12882010-08-21 21:14:17 +000068# Check whether compiler supports pointers to undefined structures
69AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
70AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], ,
DRC0ddff3b2013-04-11 05:17:53 +000071 AC_MSG_RESULT(yes),
72 [AC_MSG_RESULT(no)
73 AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
74 [Compiler does not support pointers to undefined structures.])])
DRCbdb12882010-08-21 21:14:17 +000075
DRCe7b699d2010-02-14 07:39:07 +000076if test "x${GCC}" = "xyes"; then
77 if test "x${SAVED_CFLAGS}" = "x"; then
78 CFLAGS=-O3
79 fi
DRCb4a50ce2011-02-26 21:07:50 +000080 if test "x${SAVED_CPPFLAGS}" = "x"; then
81 CPPFLAGS=-Wall
82 fi
DRCe7b699d2010-02-14 07:39:07 +000083fi
84
DRC1e2f2982010-02-16 22:35:25 +000085AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
86if test "x${SUNCC}" = "xyes"; then
87 if test "x${SAVED_CFLAGS}" = "x"; then
88 CFLAGS=-xO5
89 fi
DRC1e2f2982010-02-16 22:35:25 +000090fi
91
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000092# Checks for libraries.
93
94# Checks for header files.
95AC_HEADER_STDC
96AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
DRC0ddff3b2013-04-11 05:17:53 +000097AC_CHECK_HEADER([sys/types.h],
98 AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h]))
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000099
100# Checks for typedefs, structures, and compiler characteristics.
101AC_C_CONST
102AC_C_CHAR_UNSIGNED
103AC_C_INLINE
104AC_TYPE_SIZE_T
105AC_CHECK_TYPES([unsigned char, unsigned short])
106
107AC_MSG_CHECKING([if right shift is signed])
108AC_TRY_RUN(
DRC0ddff3b2013-04-11 05:17:53 +0000109 [#include <stdio.h>
110 int is_shifting_signed (long arg) {
111 long res = arg >> 4;
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000112
DRC0ddff3b2013-04-11 05:17:53 +0000113 if (res == -0x7F7E80CL)
114 return 1; /* right shift is signed */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000115
DRC0ddff3b2013-04-11 05:17:53 +0000116 /* see if unsigned-shift hack will fix it. */
117 /* we can't just test exact value since it depends on width of long... */
118 res |= (~0L) << (32-4);
119 if (res == -0x7F7E80CL)
120 return 0; /* right shift is unsigned */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000121
DRC0ddff3b2013-04-11 05:17:53 +0000122 printf("Right shift isn't acting as I expect it to.\n");
123 printf("I fear the JPEG software will not work at all.\n\n");
124 return 0; /* try it with unsigned anyway */
125 }
126 int main (void) {
127 exit(is_shifting_signed(-0x7F7E80B1L));
128 }],
129 [AC_MSG_RESULT(no)
130 AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])],
131 [AC_MSG_RESULT(yes)],
132 [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000133
134# test whether global names are unique to at least 15 chars
135AC_MSG_CHECKING([for short external names])
136AC_TRY_LINK(
DRC0ddff3b2013-04-11 05:17:53 +0000137 [int possibly_duplicate_function () { return 0; }
138 int possibly_dupli_function () { return 1; }], [ ],
139 [AC_MSG_RESULT(ok)],
140 [AC_MSG_RESULT(short)
141 AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1,
142 [Define if you need short function names])])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000143
144# Checks for library functions.
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000145AC_CHECK_FUNCS([memset memcpy], [],
DRC0ddff3b2013-04-11 05:17:53 +0000146 [AC_DEFINE([NEED_BSD_STRINGS], 1,
147 [Define if you have BSD-like bzero and bcopy])])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000148
DRC1f80a102010-10-18 00:15:31 +0000149AC_MSG_CHECKING([libjpeg API version])
150AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
151if test "x$JPEG_LIB_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000152 AC_ARG_WITH([jpeg7],
153 AC_HELP_STRING([--with-jpeg7],
154 [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
155 AC_ARG_WITH([jpeg8],
156 AC_HELP_STRING([--with-jpeg8],
157 [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
158 if test "x${with_jpeg8}" = "xyes"; then
159 JPEG_LIB_VERSION=80
160 else
161 if test "x${with_jpeg7}" = "xyes"; then
162 JPEG_LIB_VERSION=70
DRC36a6eec2010-10-08 08:05:44 +0000163 else
DRC0ddff3b2013-04-11 05:17:53 +0000164 JPEG_LIB_VERSION=62
DRC36a6eec2010-10-08 08:05:44 +0000165 fi
DRC0ddff3b2013-04-11 05:17:53 +0000166 fi
DRC36a6eec2010-10-08 08:05:44 +0000167fi
DRC1f80a102010-10-18 00:15:31 +0000168JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
DRC8515d3d2010-10-19 06:38:57 +0000169AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
DRC1f80a102010-10-18 00:15:31 +0000170AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
DRC0ddff3b2013-04-11 05:17:53 +0000171AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
172 [libjpeg API version])
DRC1f80a102010-10-18 00:15:31 +0000173
DRC0ddff3b2013-04-11 05:17:53 +0000174AC_ARG_VAR(SO_MAJOR_VERSION,
175 [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
176AC_ARG_VAR(SO_MINOR_VERSION,
177 [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
DRC1f80a102010-10-18 00:15:31 +0000178if test "x$SO_MAJOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000179 case "$JPEG_LIB_VERSION" in
180 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
181 *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
182 esac
DRC1f80a102010-10-18 00:15:31 +0000183fi
184if test "x$SO_MINOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000185 case "$JPEG_LIB_VERSION" in
186 80) SO_MINOR_VERSION=2 ;;
187 *) SO_MINOR_VERSION=0 ;;
188 esac
DRC1f80a102010-10-18 00:15:31 +0000189fi
DRCab706232013-01-18 23:42:31 +0000190
DRC6da61db2013-01-19 01:06:46 +0000191RPM_CONFIG_ARGS=
192
DRCab706232013-01-18 23:42:31 +0000193# Memory source/destination managers
194SO_AGE=0
195MEM_SRCDST_FUNCTIONS=
196if test "x${with_jpeg8}" != "xyes"; then
197 AC_MSG_CHECKING([whether to include in-memory source/destination managers])
198 AC_ARG_WITH([mem-srcdst],
DRC0ddff3b2013-04-11 05:17:53 +0000199 AC_HELP_STRING([--without-mem-srcdst],
200 [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI]))
DRCab706232013-01-18 23:42:31 +0000201 if test "x$with_mem_srcdst" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000202 AC_MSG_RESULT(yes)
203 AC_DEFINE([MEM_SRCDST_SUPPORTED], [1],
204 [Support in-memory source/destination managers])
205 SO_AGE=1
206 MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;";
DRCab706232013-01-18 23:42:31 +0000207 else
DRC0ddff3b2013-04-11 05:17:53 +0000208 AC_MSG_RESULT(no)
209 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst"
DRCab706232013-01-18 23:42:31 +0000210 fi
211fi
212
213AC_MSG_CHECKING([libjpeg shared library version])
214AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
DRC6da61db2013-01-19 01:06:46 +0000215LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
216AC_SUBST(LIBTOOL_CURRENT)
DRC1f80a102010-10-18 00:15:31 +0000217AC_SUBST(SO_MAJOR_VERSION)
218AC_SUBST(SO_MINOR_VERSION)
DRCab706232013-01-18 23:42:31 +0000219AC_SUBST(SO_AGE)
220AC_SUBST(MEM_SRCDST_FUNCTIONS)
DRC36a6eec2010-10-08 08:05:44 +0000221
DRCab64b622011-12-18 16:29:35 +0000222AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
223
DRC7a0478e2010-11-07 19:12:30 +0000224VERSION_SCRIPT=yes
225AC_ARG_ENABLE([ld-version-script],
226 AS_HELP_STRING([--disable-ld-version-script],
227 [Disable linker version script for libjpeg-turbo (default is to use linker version script if the linker supports it)]),
DRC0ddff3b2013-04-11 05:17:53 +0000228 [VERSION_SCRIPT=$enableval], [])
DRC8515d3d2010-10-19 06:38:57 +0000229
230AC_MSG_CHECKING([whether the linker supports version scripts])
231SAVED_LDFLAGS="$LDFLAGS"
232LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
233cat > conftest.map <<EOF
234VERS_1 {
235 global: *;
236};
237EOF
238AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
DRC0ddff3b2013-04-11 05:17:53 +0000239 [VERSION_SCRIPT_FLAG=-Wl,--version-script,;
240 AC_MSG_RESULT([yes (GNU style)])],
241 [])
DRC8515d3d2010-10-19 06:38:57 +0000242if test "x$VERSION_SCRIPT_FLAG" = "x"; then
243 LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
244 AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
DRC0ddff3b2013-04-11 05:17:53 +0000245 [VERSION_SCRIPT_FLAG=-Wl,-M,;
246 AC_MSG_RESULT([yes (Sun style)])],
247 [])
DRC8515d3d2010-10-19 06:38:57 +0000248fi
249if test "x$VERSION_SCRIPT_FLAG" = "x"; then
250 VERSION_SCRIPT=no
251 AC_MSG_RESULT(no)
252fi
DRC8515d3d2010-10-19 06:38:57 +0000253LDFLAGS="$SAVED_LDFLAGS"
254
DRC9fa95592011-02-25 00:23:44 +0000255AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
DRC8515d3d2010-10-19 06:38:57 +0000256AC_MSG_RESULT($VERSION_SCRIPT)
257
258AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
DRC8515d3d2010-10-19 06:38:57 +0000259AC_SUBST(VERSION_SCRIPT_FLAG)
DRC8515d3d2010-10-19 06:38:57 +0000260
DRCb4570bb2011-09-07 06:31:00 +0000261# Check for non-broken inline under various spellings
262AC_MSG_CHECKING(for inline)
263ljt_cv_inline=""
264AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; }
265int bar() { return foo();], ljt_cv_inline="__attribute__((always_inline))",
266AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
267int bar() { return foo();], ljt_cv_inline="__inline__",
268AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
269int bar() { return foo();], ljt_cv_inline="__inline",
270AC_TRY_COMPILE(, [} inline int foo() { return 0; }
271int bar() { return foo();], ljt_cv_inline="inline"))))
272AC_MSG_RESULT($ljt_cv_inline)
273AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
274
DRC211d1e72013-01-13 11:25:20 +0000275# Arithmetic coding support
DRC990e28d2011-01-04 21:40:11 +0000276AC_MSG_CHECKING([whether to include arithmetic encoding support])
DRCe3720042010-11-23 06:50:14 +0000277AC_ARG_WITH([arith-enc],
DRC0ddff3b2013-04-11 05:17:53 +0000278 AC_HELP_STRING([--without-arith-enc],
279 [Do not include arithmetic encoding support]))
DRCe3720042010-11-23 06:50:14 +0000280if test "x$with_arith_enc" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000281 AC_MSG_RESULT(no)
282 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
DRCe3720042010-11-23 06:50:14 +0000283else
DRC0ddff3b2013-04-11 05:17:53 +0000284 AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
285 AC_MSG_RESULT(yes)
DRCe3720042010-11-23 06:50:14 +0000286fi
287AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
288
DRC990e28d2011-01-04 21:40:11 +0000289AC_MSG_CHECKING([whether to include arithmetic decoding support])
DRCe3720042010-11-23 06:50:14 +0000290AC_ARG_WITH([arith-dec],
DRC0ddff3b2013-04-11 05:17:53 +0000291 AC_HELP_STRING([--without-arith-dec],
292 [Do not include arithmetic decoding support]))
DRCe3720042010-11-23 06:50:14 +0000293if test "x$with_arith_dec" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000294 AC_MSG_RESULT(no)
295 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
DRCe3720042010-11-23 06:50:14 +0000296else
DRC0ddff3b2013-04-11 05:17:53 +0000297 AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
298 AC_MSG_RESULT(yes)
DRCe3720042010-11-23 06:50:14 +0000299fi
300AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
301
DRC0ddff3b2013-04-11 05:17:53 +0000302AM_CONDITIONAL([WITH_ARITH],
303 [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
DRCe3720042010-11-23 06:50:14 +0000304
DRC211d1e72013-01-13 11:25:20 +0000305# TurboJPEG support
DRC5039d732013-01-21 23:42:12 +0000306AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
DRC211d1e72013-01-13 11:25:20 +0000307AC_ARG_WITH([turbojpeg],
DRC0ddff3b2013-04-11 05:17:53 +0000308 AC_HELP_STRING([--without-turbojpeg],
309 [Do not include the TurboJPEG wrapper library and associated test programs]))
DRC211d1e72013-01-13 11:25:20 +0000310if test "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000311 AC_MSG_RESULT(no)
312 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
DRC211d1e72013-01-13 11:25:20 +0000313else
DRC0ddff3b2013-04-11 05:17:53 +0000314 AC_MSG_RESULT(yes)
DRC211d1e72013-01-13 11:25:20 +0000315fi
316
317# Java support
DRCf2602ce2011-04-01 00:20:33 +0000318AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
319if test "x$JAVAC" = "x"; then
320 JAVAC=javac
321fi
322AC_SUBST(JAVAC)
323AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
324AC_SUBST(JAVACFLAGS)
325AC_ARG_VAR(JAR, [Java archive command (default: jar)])
326if test "x$JAR" = "x"; then
327 JAR=jar
328fi
329AC_SUBST(JAR)
330AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
331if test "x$JAVA" = "x"; then
332 JAVA=java
333fi
334AC_SUBST(JAVA)
DRC0ddff3b2013-04-11 05:17:53 +0000335AC_ARG_VAR(JNI_CFLAGS,
336 [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)])
DRC063ab492011-02-04 22:16:41 +0000337
DRC5039d732013-01-21 23:42:12 +0000338AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
DRCf2602ce2011-04-01 00:20:33 +0000339AC_ARG_WITH([java],
DRC0ddff3b2013-04-11 05:17:53 +0000340 AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
DRC211d1e72013-01-13 11:25:20 +0000341if test "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000342 with_java=no
DRC211d1e72013-01-13 11:25:20 +0000343fi
DRC1421a262011-02-06 15:35:38 +0000344
DRCf2602ce2011-04-01 00:20:33 +0000345WITH_JAVA=0
346if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000347 AC_MSG_RESULT(yes)
DRC1421a262011-02-06 15:35:38 +0000348
DRC0ddff3b2013-04-11 05:17:53 +0000349 case $host_os in
350 darwin*)
351 DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
352 ;;
353 solaris*)
354 DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
355 ;;
356 linux*)
357 DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
358 ;;
359 esac
360 if test "x$JNI_CFLAGS" = "x"; then
361 JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
362 fi
DRC1421a262011-02-06 15:35:38 +0000363
DRC0ddff3b2013-04-11 05:17:53 +0000364 SAVE_CPPFLAGS=${CPPFLAGS}
365 CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
366 AC_CHECK_HEADERS([jni.h], [DUMMY=1],
367 [AC_MSG_ERROR([Could not find JNI header file])])
368 CPPFLAGS=${SAVE_CPPFLAGS}
369 AC_SUBST(JNI_CFLAGS)
DRC1b0c3b02011-02-06 15:51:27 +0000370
DRC0ddff3b2013-04-11 05:17:53 +0000371 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --with-java"
DRC764e1e22013-04-19 04:25:14 +0000372 JAVA_RPM_CONTENTS_1='%dir %{_datadir}/classes'
373 JAVA_RPM_CONTENTS_2=%{_datadir}/classes/turbojpeg.jar
DRC0ddff3b2013-04-11 05:17:53 +0000374 WITH_JAVA=1
DRCf8e00552011-02-04 11:06:36 +0000375else
DRC0ddff3b2013-04-11 05:17:53 +0000376 AC_MSG_RESULT(no)
DRCf8e00552011-02-04 11:06:36 +0000377fi
DRCf2602ce2011-04-01 00:20:33 +0000378AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
379AC_SUBST(WITH_JAVA)
380AC_SUBST(JAVA_RPM_CONTENTS_1)
381AC_SUBST(JAVA_RPM_CONTENTS_2)
DRCf8e00552011-02-04 11:06:36 +0000382
DRC4346f912011-06-14 22:16:50 +0000383# optionally force using gas-preprocessor.pl for compatibility testing
384AC_ARG_WITH([gas-preprocessor],
DRC0ddff3b2013-04-11 05:17:53 +0000385 AC_HELP_STRING([--with-gas-preprocessor],
386 [Force using gas-preprocessor.pl on ARM.]))
DRC4346f912011-06-14 22:16:50 +0000387if test "x${with_gas_preprocessor}" = "xyes"; then
388 case $host_os in
389 darwin*)
390 CCAS="gas-preprocessor.pl -fix-unreq $CC"
391 ;;
392 *)
393 CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
394 ;;
395 esac
396 AC_SUBST([CCAS])
397fi
398
DRC60cddeb2010-02-12 05:37:07 +0000399# SIMD is optional
400AC_ARG_WITH([simd],
DRC0ddff3b2013-04-11 05:17:53 +0000401 AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
DRC60cddeb2010-02-12 05:37:07 +0000402if test "x${with_simd}" != "xno"; then
DRC8ca34d42013-09-25 04:36:44 +0000403 require_simd=no
404 if test "x${with_simd}" = "xyes"; then
405 require_simd=yes
406 fi
DRC60cddeb2010-02-12 05:37:07 +0000407 # Check if we're on a supported CPU
408 AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
409 case "$host_cpu" in
DRC49597872010-05-17 20:47:57 +0000410 x86_64 | amd64)
DRC60cddeb2010-02-12 05:37:07 +0000411 AC_MSG_RESULT([yes (x86_64)])
412 AC_PROG_NASM
413 simd_arch=x86_64
DRC0ddff3b2013-04-11 05:17:53 +0000414 ;;
DRC60cddeb2010-02-12 05:37:07 +0000415 i*86 | x86 | ia32)
416 AC_MSG_RESULT([yes (i386)])
417 AC_PROG_NASM
418 simd_arch=i386
DRC0ddff3b2013-04-11 05:17:53 +0000419 ;;
DRC321e0682011-05-03 08:47:43 +0000420 arm*)
421 AC_MSG_RESULT([yes (arm)])
422 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
423 AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
424 [AC_MSG_RESULT([yes])
425 simd_arch=arm],
426 [AC_MSG_RESULT([no])
DRC8ca34d42013-09-25 04:36:44 +0000427 with_simd=no])
DRC596b9662013-10-26 00:29:53 +0000428 if test "x${with_simd}" = "xno"; then
429 if test "x${require_simd}" = "xyes"; then
430 AC_MSG_ERROR([SIMD support can't be enabled.])
431 else
432 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
433 fi
DRC8ca34d42013-09-25 04:36:44 +0000434 fi
DRC0ddff3b2013-04-11 05:17:53 +0000435 ;;
DRC0be9fa52013-07-24 21:50:20 +0000436 mipsel*)
437 AC_MSG_RESULT([yes (mipsel)])
438 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
439 AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE(
440 [AC_MSG_RESULT([yes])
441 simd_arch=mipsel],
442 [AC_MSG_RESULT([no])
DRC8ca34d42013-09-25 04:36:44 +0000443 with_simd=no])
DRC596b9662013-10-26 00:29:53 +0000444 if test "x${with_simd}" = "xno"; then
445 if test "x${require_simd}" = "xyes"; then
446 AC_MSG_ERROR([SIMD support can't be enabled.])
447 else
448 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
449 fi
DRC8ca34d42013-09-25 04:36:44 +0000450 fi
DRC0be9fa52013-07-24 21:50:20 +0000451 ;;
DRC60cddeb2010-02-12 05:37:07 +0000452 *)
453 AC_MSG_RESULT([no ("$host_cpu")])
DRC83f21442010-06-10 18:52:41 +0000454 with_simd=no;
DRC596b9662013-10-26 00:29:53 +0000455 if test "x${require_simd}" = "xyes"; then
DRC8ca34d42013-09-25 04:36:44 +0000456 AC_MSG_ERROR([SIMD support not available for this CPU.])
457 else
458 AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
459 fi
DRC0ddff3b2013-04-11 05:17:53 +0000460 ;;
DRC60cddeb2010-02-12 05:37:07 +0000461 esac
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000462
DRC60cddeb2010-02-12 05:37:07 +0000463 if test "x${with_simd}" != "xno"; then
464 AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
465 fi
DRC6da61db2013-01-19 01:06:46 +0000466else
467 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
DRC60cddeb2010-02-12 05:37:07 +0000468fi
DRC411dcf52010-02-12 04:28:29 +0000469
DRC60cddeb2010-02-12 05:37:07 +0000470AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
DRC321e0682011-05-03 08:47:43 +0000471AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000472AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
473AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
DRC321e0682011-05-03 08:47:43 +0000474AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
DRC0be9fa52013-07-24 21:50:20 +0000475AM_CONDITIONAL([SIMD_MIPSEL], [test "x$simd_arch" = "xmipsel"])
DRC49597872010-05-17 20:47:57 +0000476AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
DRC211d1e72013-01-13 11:25:20 +0000477AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
Pierre Ossman59a39382009-03-09 13:15:56 +0000478
DRC764e1e22013-04-19 04:25:14 +0000479AC_ARG_VAR(PKGNAME, [distribution package name (default: libjpeg-turbo)])
480if test "x$PKGNAME" = "x"; then
481 PKGNAME=$PACKAGE_NAME
482fi
483AC_SUBST(PKGNAME)
484
DRC079b4342010-02-15 11:32:23 +0000485case "$host_cpu" in
486 x86_64)
487 RPMARCH=x86_64
DRC52a19f22010-02-15 12:06:27 +0000488 DEBARCH=amd64
DRC079b4342010-02-15 11:32:23 +0000489 ;;
490 i*86 | x86 | ia32)
491 RPMARCH=i386
DRC52a19f22010-02-15 12:06:27 +0000492 DEBARCH=i386
DRC079b4342010-02-15 11:32:23 +0000493 ;;
494esac
495
496AC_SUBST(RPMARCH)
DRC6da61db2013-01-19 01:06:46 +0000497AC_SUBST(RPM_CONFIG_ARGS)
DRC52a19f22010-02-15 12:06:27 +0000498AC_SUBST(DEBARCH)
DRC079b4342010-02-15 11:32:23 +0000499AC_SUBST(BUILD)
DRC2cdd2ae2010-10-10 06:54:21 +0000500AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
DRC079b4342010-02-15 11:32:23 +0000501
Pierre Ossmanba0ce392009-03-06 15:30:42 +0000502# jconfig.h is the file we use, but we have another before that to
503# fool autoheader. the reason is that we include this header in our
504# API headers, which can screw things up for users of the lib.
505# jconfig.h is a minimal version that allows this package to be built
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000506AC_CONFIG_HEADERS([config.h])
507AC_CONFIG_HEADERS([jconfig.h])
DRC764e1e22013-04-19 04:25:14 +0000508AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
DRC7175e512013-04-23 22:29:00 +0000509AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
DRC764e1e22013-04-19 04:25:14 +0000510AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
DRC7175e512013-04-23 22:29:00 +0000511AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
DRCb94f2de2011-03-22 09:31:25 +0000512AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in])
513AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in])
DRC7175e512013-04-23 22:29:00 +0000514AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
DRC211d1e72013-01-13 11:25:20 +0000515if test "x$with_turbojpeg" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000516 AC_CONFIG_FILES([tjbenchtest])
DRC211d1e72013-01-13 11:25:20 +0000517fi
518if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000519 AC_CONFIG_FILES([tjbenchtest.java])
520 AC_CONFIG_FILES([tjexampletest])
DRC211d1e72013-01-13 11:25:20 +0000521fi
DRC8515d3d2010-10-19 06:38:57 +0000522AC_CONFIG_FILES([libjpeg.map])
Pierre Ossman3a65ef42009-03-16 13:34:18 +0000523AC_CONFIG_FILES([Makefile simd/Makefile])
DRCdffd53d2011-04-01 00:37:20 +0000524AC_CONFIG_FILES([java/Makefile])
DRC0bf58f22013-02-06 23:51:08 +0000525AC_CONFIG_FILES([md5/Makefile])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000526AC_OUTPUT