blob: 01a2690bee50d5e4a753883b9241854f9fd2924b [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
DRCc56cb472014-02-15 07:02:04 +000019AM_PROG_AR
DRC321e0682011-05-03 08:47:43 +000020AM_PROG_AS
DRCc56cb472014-02-15 07:02:04 +000021AM_PROG_CC_C_O
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000022AC_PROG_INSTALL
23AC_PROG_LIBTOOL
24AC_PROG_LN_S
25
DRC764e1e22013-04-19 04:25:14 +000026# When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is
27# being created, and thus we install things into specific locations.
28
29old_prefix=${prefix}
30if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
31 prefix=$ac_default_prefix
32fi
33DATADIR=`eval echo ${datadir}`
34DATADIR=`eval echo $DATADIR`
35if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
36 datadir='${prefix}'
37fi
DRC7175e512013-04-23 22:29:00 +000038DATADIR=`eval echo ${datarootdir}`
39DATADIR=`eval echo $DATADIR`
40if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
41 datarootdir='${prefix}'
42fi
DRC764e1e22013-04-19 04:25:14 +000043
44old_exec_prefix=${exec_prefix}
45if test "x$exec_prefix" = "xNONE"; then
46 exec_prefix=${prefix}
47fi
48
49if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
50 LIBDIR=`eval echo ${libdir}`
51 LIBDIR=`eval echo $LIBDIR`
52 if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then
53 case $host_os in
54 darwin*)
55 ;;
56 *)
DRCc32e0c22013-08-11 22:57:19 +000057 AC_CHECK_SIZEOF(long)
58 if test "${ac_cv_sizeof_long}" = "8"; then
59 libdir='${exec_prefix}/lib64'
60 elif test "${ac_cv_sizeof_long}" = "4"; then
61 libdir='${exec_prefix}/lib32'
62 fi
DRC764e1e22013-04-19 04:25:14 +000063 ;;
64 esac
65 fi
66fi
67exec_prefix=${old_exec_prefix}
68prefix=${old_prefix}
69
DRCbdb12882010-08-21 21:14:17 +000070# Check whether compiler supports pointers to undefined structures
71AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
72AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], ,
DRC0ddff3b2013-04-11 05:17:53 +000073 AC_MSG_RESULT(yes),
74 [AC_MSG_RESULT(no)
75 AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
76 [Compiler does not support pointers to undefined structures.])])
DRCbdb12882010-08-21 21:14:17 +000077
DRCe7b699d2010-02-14 07:39:07 +000078if test "x${GCC}" = "xyes"; then
79 if test "x${SAVED_CFLAGS}" = "x"; then
80 CFLAGS=-O3
81 fi
DRCb4a50ce2011-02-26 21:07:50 +000082 if test "x${SAVED_CPPFLAGS}" = "x"; then
83 CPPFLAGS=-Wall
84 fi
DRCe7b699d2010-02-14 07:39:07 +000085fi
86
DRC1e2f2982010-02-16 22:35:25 +000087AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
88if test "x${SUNCC}" = "xyes"; then
89 if test "x${SAVED_CFLAGS}" = "x"; then
90 CFLAGS=-xO5
91 fi
DRC1e2f2982010-02-16 22:35:25 +000092fi
93
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000094# Checks for libraries.
95
96# Checks for header files.
97AC_HEADER_STDC
98AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
DRC0ddff3b2013-04-11 05:17:53 +000099AC_CHECK_HEADER([sys/types.h],
100 AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h]))
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000101
102# Checks for typedefs, structures, and compiler characteristics.
103AC_C_CONST
104AC_C_CHAR_UNSIGNED
105AC_C_INLINE
106AC_TYPE_SIZE_T
107AC_CHECK_TYPES([unsigned char, unsigned short])
108
109AC_MSG_CHECKING([if right shift is signed])
110AC_TRY_RUN(
DRC0ddff3b2013-04-11 05:17:53 +0000111 [#include <stdio.h>
112 int is_shifting_signed (long arg) {
113 long res = arg >> 4;
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000114
DRC0ddff3b2013-04-11 05:17:53 +0000115 if (res == -0x7F7E80CL)
116 return 1; /* right shift is signed */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000117
DRC0ddff3b2013-04-11 05:17:53 +0000118 /* see if unsigned-shift hack will fix it. */
119 /* we can't just test exact value since it depends on width of long... */
120 res |= (~0L) << (32-4);
121 if (res == -0x7F7E80CL)
122 return 0; /* right shift is unsigned */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000123
DRC0ddff3b2013-04-11 05:17:53 +0000124 printf("Right shift isn't acting as I expect it to.\n");
125 printf("I fear the JPEG software will not work at all.\n\n");
126 return 0; /* try it with unsigned anyway */
127 }
128 int main (void) {
129 exit(is_shifting_signed(-0x7F7E80B1L));
130 }],
131 [AC_MSG_RESULT(no)
132 AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])],
133 [AC_MSG_RESULT(yes)],
134 [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000135
136# test whether global names are unique to at least 15 chars
137AC_MSG_CHECKING([for short external names])
138AC_TRY_LINK(
DRC0ddff3b2013-04-11 05:17:53 +0000139 [int possibly_duplicate_function () { return 0; }
140 int possibly_dupli_function () { return 1; }], [ ],
141 [AC_MSG_RESULT(ok)],
142 [AC_MSG_RESULT(short)
143 AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1,
144 [Define if you need short function names])])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000145
146# Checks for library functions.
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000147AC_CHECK_FUNCS([memset memcpy], [],
DRC0ddff3b2013-04-11 05:17:53 +0000148 [AC_DEFINE([NEED_BSD_STRINGS], 1,
149 [Define if you have BSD-like bzero and bcopy])])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000150
DRC1f80a102010-10-18 00:15:31 +0000151AC_MSG_CHECKING([libjpeg API version])
152AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
153if test "x$JPEG_LIB_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000154 AC_ARG_WITH([jpeg7],
155 AC_HELP_STRING([--with-jpeg7],
156 [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
157 AC_ARG_WITH([jpeg8],
158 AC_HELP_STRING([--with-jpeg8],
159 [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
160 if test "x${with_jpeg8}" = "xyes"; then
161 JPEG_LIB_VERSION=80
162 else
163 if test "x${with_jpeg7}" = "xyes"; then
164 JPEG_LIB_VERSION=70
DRC36a6eec2010-10-08 08:05:44 +0000165 else
DRC0ddff3b2013-04-11 05:17:53 +0000166 JPEG_LIB_VERSION=62
DRC36a6eec2010-10-08 08:05:44 +0000167 fi
DRC0ddff3b2013-04-11 05:17:53 +0000168 fi
DRC36a6eec2010-10-08 08:05:44 +0000169fi
DRC1f80a102010-10-18 00:15:31 +0000170JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
DRC8515d3d2010-10-19 06:38:57 +0000171AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
DRC1f80a102010-10-18 00:15:31 +0000172AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
DRC0ddff3b2013-04-11 05:17:53 +0000173AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
174 [libjpeg API version])
DRC1f80a102010-10-18 00:15:31 +0000175
DRC0ddff3b2013-04-11 05:17:53 +0000176AC_ARG_VAR(SO_MAJOR_VERSION,
177 [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
178AC_ARG_VAR(SO_MINOR_VERSION,
179 [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
DRC1f80a102010-10-18 00:15:31 +0000180if test "x$SO_MAJOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000181 case "$JPEG_LIB_VERSION" in
182 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
183 *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
184 esac
DRC1f80a102010-10-18 00:15:31 +0000185fi
186if test "x$SO_MINOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000187 case "$JPEG_LIB_VERSION" in
188 80) SO_MINOR_VERSION=2 ;;
189 *) SO_MINOR_VERSION=0 ;;
190 esac
DRC1f80a102010-10-18 00:15:31 +0000191fi
DRCab706232013-01-18 23:42:31 +0000192
DRC6da61db2013-01-19 01:06:46 +0000193RPM_CONFIG_ARGS=
194
DRCab706232013-01-18 23:42:31 +0000195# Memory source/destination managers
196SO_AGE=0
197MEM_SRCDST_FUNCTIONS=
198if test "x${with_jpeg8}" != "xyes"; then
199 AC_MSG_CHECKING([whether to include in-memory source/destination managers])
200 AC_ARG_WITH([mem-srcdst],
DRC0ddff3b2013-04-11 05:17:53 +0000201 AC_HELP_STRING([--without-mem-srcdst],
202 [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI]))
DRCab706232013-01-18 23:42:31 +0000203 if test "x$with_mem_srcdst" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000204 AC_MSG_RESULT(yes)
205 AC_DEFINE([MEM_SRCDST_SUPPORTED], [1],
206 [Support in-memory source/destination managers])
207 SO_AGE=1
208 MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;";
DRCab706232013-01-18 23:42:31 +0000209 else
DRC0ddff3b2013-04-11 05:17:53 +0000210 AC_MSG_RESULT(no)
211 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst"
DRCab706232013-01-18 23:42:31 +0000212 fi
213fi
214
215AC_MSG_CHECKING([libjpeg shared library version])
216AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
DRC6da61db2013-01-19 01:06:46 +0000217LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
218AC_SUBST(LIBTOOL_CURRENT)
DRC1f80a102010-10-18 00:15:31 +0000219AC_SUBST(SO_MAJOR_VERSION)
220AC_SUBST(SO_MINOR_VERSION)
DRCab706232013-01-18 23:42:31 +0000221AC_SUBST(SO_AGE)
222AC_SUBST(MEM_SRCDST_FUNCTIONS)
DRC36a6eec2010-10-08 08:05:44 +0000223
DRCab64b622011-12-18 16:29:35 +0000224AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
225
DRC7a0478e2010-11-07 19:12:30 +0000226VERSION_SCRIPT=yes
227AC_ARG_ENABLE([ld-version-script],
228 AS_HELP_STRING([--disable-ld-version-script],
229 [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 +0000230 [VERSION_SCRIPT=$enableval], [])
DRC8515d3d2010-10-19 06:38:57 +0000231
232AC_MSG_CHECKING([whether the linker supports version scripts])
233SAVED_LDFLAGS="$LDFLAGS"
234LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
235cat > conftest.map <<EOF
236VERS_1 {
237 global: *;
238};
239EOF
DRCc56cb472014-02-15 07:02:04 +0000240AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
DRC0ddff3b2013-04-11 05:17:53 +0000241 [VERSION_SCRIPT_FLAG=-Wl,--version-script,;
242 AC_MSG_RESULT([yes (GNU style)])],
243 [])
DRC8515d3d2010-10-19 06:38:57 +0000244if test "x$VERSION_SCRIPT_FLAG" = "x"; then
245 LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
DRCc56cb472014-02-15 07:02:04 +0000246 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
DRC0ddff3b2013-04-11 05:17:53 +0000247 [VERSION_SCRIPT_FLAG=-Wl,-M,;
248 AC_MSG_RESULT([yes (Sun style)])],
249 [])
DRC8515d3d2010-10-19 06:38:57 +0000250fi
251if test "x$VERSION_SCRIPT_FLAG" = "x"; then
252 VERSION_SCRIPT=no
253 AC_MSG_RESULT(no)
254fi
DRC8515d3d2010-10-19 06:38:57 +0000255LDFLAGS="$SAVED_LDFLAGS"
256
DRC9fa95592011-02-25 00:23:44 +0000257AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
DRC8515d3d2010-10-19 06:38:57 +0000258AC_MSG_RESULT($VERSION_SCRIPT)
259
260AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
DRC8515d3d2010-10-19 06:38:57 +0000261AC_SUBST(VERSION_SCRIPT_FLAG)
DRC8515d3d2010-10-19 06:38:57 +0000262
DRCb4570bb2011-09-07 06:31:00 +0000263# Check for non-broken inline under various spellings
264AC_MSG_CHECKING(for inline)
265ljt_cv_inline=""
266AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; }
267int bar() { return foo();], ljt_cv_inline="__attribute__((always_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_TRY_COMPILE(, [} inline int foo() { return 0; }
273int bar() { return foo();], ljt_cv_inline="inline"))))
274AC_MSG_RESULT($ljt_cv_inline)
275AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
276
DRC211d1e72013-01-13 11:25:20 +0000277# Arithmetic coding support
DRC990e28d2011-01-04 21:40:11 +0000278AC_MSG_CHECKING([whether to include arithmetic encoding support])
DRCe3720042010-11-23 06:50:14 +0000279AC_ARG_WITH([arith-enc],
DRC0ddff3b2013-04-11 05:17:53 +0000280 AC_HELP_STRING([--without-arith-enc],
281 [Do not include arithmetic encoding support]))
DRCe3720042010-11-23 06:50:14 +0000282if test "x$with_arith_enc" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000283 AC_MSG_RESULT(no)
284 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
DRCe3720042010-11-23 06:50:14 +0000285else
DRC0ddff3b2013-04-11 05:17:53 +0000286 AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
287 AC_MSG_RESULT(yes)
DRCe3720042010-11-23 06:50:14 +0000288fi
289AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
290
DRC990e28d2011-01-04 21:40:11 +0000291AC_MSG_CHECKING([whether to include arithmetic decoding support])
DRCe3720042010-11-23 06:50:14 +0000292AC_ARG_WITH([arith-dec],
DRC0ddff3b2013-04-11 05:17:53 +0000293 AC_HELP_STRING([--without-arith-dec],
294 [Do not include arithmetic decoding support]))
DRCe3720042010-11-23 06:50:14 +0000295if test "x$with_arith_dec" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000296 AC_MSG_RESULT(no)
297 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
DRCe3720042010-11-23 06:50:14 +0000298else
DRC0ddff3b2013-04-11 05:17:53 +0000299 AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
300 AC_MSG_RESULT(yes)
DRCe3720042010-11-23 06:50:14 +0000301fi
302AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
303
DRC0ddff3b2013-04-11 05:17:53 +0000304AM_CONDITIONAL([WITH_ARITH],
305 [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
DRCe3720042010-11-23 06:50:14 +0000306
DRC211d1e72013-01-13 11:25:20 +0000307# TurboJPEG support
DRC5039d732013-01-21 23:42:12 +0000308AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
DRC211d1e72013-01-13 11:25:20 +0000309AC_ARG_WITH([turbojpeg],
DRC0ddff3b2013-04-11 05:17:53 +0000310 AC_HELP_STRING([--without-turbojpeg],
311 [Do not include the TurboJPEG wrapper library and associated test programs]))
DRC211d1e72013-01-13 11:25:20 +0000312if test "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000313 AC_MSG_RESULT(no)
314 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
DRC211d1e72013-01-13 11:25:20 +0000315else
DRC0ddff3b2013-04-11 05:17:53 +0000316 AC_MSG_RESULT(yes)
DRC211d1e72013-01-13 11:25:20 +0000317fi
318
319# Java support
DRCf2602ce2011-04-01 00:20:33 +0000320AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
321if test "x$JAVAC" = "x"; then
322 JAVAC=javac
323fi
324AC_SUBST(JAVAC)
325AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
326AC_SUBST(JAVACFLAGS)
327AC_ARG_VAR(JAR, [Java archive command (default: jar)])
328if test "x$JAR" = "x"; then
329 JAR=jar
330fi
331AC_SUBST(JAR)
332AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
333if test "x$JAVA" = "x"; then
334 JAVA=java
335fi
336AC_SUBST(JAVA)
DRC0ddff3b2013-04-11 05:17:53 +0000337AC_ARG_VAR(JNI_CFLAGS,
338 [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 +0000339
DRC5039d732013-01-21 23:42:12 +0000340AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
DRCf2602ce2011-04-01 00:20:33 +0000341AC_ARG_WITH([java],
DRC0ddff3b2013-04-11 05:17:53 +0000342 AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
DRC211d1e72013-01-13 11:25:20 +0000343if test "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000344 with_java=no
DRC211d1e72013-01-13 11:25:20 +0000345fi
DRC1421a262011-02-06 15:35:38 +0000346
DRCf2602ce2011-04-01 00:20:33 +0000347WITH_JAVA=0
348if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000349 AC_MSG_RESULT(yes)
DRC1421a262011-02-06 15:35:38 +0000350
DRC0ddff3b2013-04-11 05:17:53 +0000351 case $host_os in
352 darwin*)
353 DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
354 ;;
355 solaris*)
356 DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
357 ;;
358 linux*)
359 DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
360 ;;
361 esac
362 if test "x$JNI_CFLAGS" = "x"; then
363 JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
364 fi
DRC1421a262011-02-06 15:35:38 +0000365
DRC0ddff3b2013-04-11 05:17:53 +0000366 SAVE_CPPFLAGS=${CPPFLAGS}
367 CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
368 AC_CHECK_HEADERS([jni.h], [DUMMY=1],
369 [AC_MSG_ERROR([Could not find JNI header file])])
370 CPPFLAGS=${SAVE_CPPFLAGS}
371 AC_SUBST(JNI_CFLAGS)
DRC1b0c3b02011-02-06 15:51:27 +0000372
DRC0ddff3b2013-04-11 05:17:53 +0000373 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --with-java"
DRC764e1e22013-04-19 04:25:14 +0000374 JAVA_RPM_CONTENTS_1='%dir %{_datadir}/classes'
375 JAVA_RPM_CONTENTS_2=%{_datadir}/classes/turbojpeg.jar
DRC0ddff3b2013-04-11 05:17:53 +0000376 WITH_JAVA=1
DRCf8e00552011-02-04 11:06:36 +0000377else
DRC0ddff3b2013-04-11 05:17:53 +0000378 AC_MSG_RESULT(no)
DRCf8e00552011-02-04 11:06:36 +0000379fi
DRCf2602ce2011-04-01 00:20:33 +0000380AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
381AC_SUBST(WITH_JAVA)
382AC_SUBST(JAVA_RPM_CONTENTS_1)
383AC_SUBST(JAVA_RPM_CONTENTS_2)
DRCf8e00552011-02-04 11:06:36 +0000384
DRC4346f912011-06-14 22:16:50 +0000385# optionally force using gas-preprocessor.pl for compatibility testing
386AC_ARG_WITH([gas-preprocessor],
DRC0ddff3b2013-04-11 05:17:53 +0000387 AC_HELP_STRING([--with-gas-preprocessor],
388 [Force using gas-preprocessor.pl on ARM.]))
DRC4346f912011-06-14 22:16:50 +0000389if test "x${with_gas_preprocessor}" = "xyes"; then
390 case $host_os in
391 darwin*)
392 CCAS="gas-preprocessor.pl -fix-unreq $CC"
393 ;;
394 *)
395 CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
396 ;;
397 esac
398 AC_SUBST([CCAS])
399fi
400
DRC60cddeb2010-02-12 05:37:07 +0000401# SIMD is optional
402AC_ARG_WITH([simd],
DRC0ddff3b2013-04-11 05:17:53 +0000403 AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
DRC60cddeb2010-02-12 05:37:07 +0000404if test "x${with_simd}" != "xno"; then
DRC8ca34d42013-09-25 04:36:44 +0000405 require_simd=no
406 if test "x${with_simd}" = "xyes"; then
407 require_simd=yes
408 fi
DRC60cddeb2010-02-12 05:37:07 +0000409 # Check if we're on a supported CPU
410 AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
411 case "$host_cpu" in
DRC49597872010-05-17 20:47:57 +0000412 x86_64 | amd64)
DRC60cddeb2010-02-12 05:37:07 +0000413 AC_MSG_RESULT([yes (x86_64)])
414 AC_PROG_NASM
415 simd_arch=x86_64
DRC0ddff3b2013-04-11 05:17:53 +0000416 ;;
DRC60cddeb2010-02-12 05:37:07 +0000417 i*86 | x86 | ia32)
418 AC_MSG_RESULT([yes (i386)])
419 AC_PROG_NASM
420 simd_arch=i386
DRC0ddff3b2013-04-11 05:17:53 +0000421 ;;
DRC321e0682011-05-03 08:47:43 +0000422 arm*)
423 AC_MSG_RESULT([yes (arm)])
424 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
425 AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
426 [AC_MSG_RESULT([yes])
427 simd_arch=arm],
428 [AC_MSG_RESULT([no])
DRC8ca34d42013-09-25 04:36:44 +0000429 with_simd=no])
DRC596b9662013-10-26 00:29:53 +0000430 if test "x${with_simd}" = "xno"; then
431 if test "x${require_simd}" = "xyes"; then
432 AC_MSG_ERROR([SIMD support can't be enabled.])
433 else
434 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
DRCba55b2c2014-02-05 08:15:44 +0000435 fi
DRC596b9662013-10-26 00:29:53 +0000436 fi
DRCba55b2c2014-02-05 08:15:44 +0000437 ;;
438 aarch64*)
439 AC_MSG_RESULT([yes (arm64)])
440 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
441 AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE(
442 [AC_MSG_RESULT([yes])
443 simd_arch=aarch64],
444 [AC_MSG_RESULT([no])
445 with_simd=no])
446 if test "x${with_simd}" = "xno"; then
447 if test "x${require_simd}" = "xyes"; then
448 AC_MSG_ERROR([SIMD support can't be enabled.])
449 else
450 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
451 fi
DRC8ca34d42013-09-25 04:36:44 +0000452 fi
DRC0ddff3b2013-04-11 05:17:53 +0000453 ;;
DRC0be9fa52013-07-24 21:50:20 +0000454 mipsel*)
455 AC_MSG_RESULT([yes (mipsel)])
456 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
457 AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE(
458 [AC_MSG_RESULT([yes])
459 simd_arch=mipsel],
460 [AC_MSG_RESULT([no])
DRC8ca34d42013-09-25 04:36:44 +0000461 with_simd=no])
DRC596b9662013-10-26 00:29:53 +0000462 if test "x${with_simd}" = "xno"; then
463 if test "x${require_simd}" = "xyes"; then
464 AC_MSG_ERROR([SIMD support can't be enabled.])
465 else
466 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
467 fi
DRC8ca34d42013-09-25 04:36:44 +0000468 fi
DRC0be9fa52013-07-24 21:50:20 +0000469 ;;
DRC60cddeb2010-02-12 05:37:07 +0000470 *)
471 AC_MSG_RESULT([no ("$host_cpu")])
DRC83f21442010-06-10 18:52:41 +0000472 with_simd=no;
DRC596b9662013-10-26 00:29:53 +0000473 if test "x${require_simd}" = "xyes"; then
DRC8ca34d42013-09-25 04:36:44 +0000474 AC_MSG_ERROR([SIMD support not available for this CPU.])
475 else
476 AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
477 fi
DRC0ddff3b2013-04-11 05:17:53 +0000478 ;;
DRC60cddeb2010-02-12 05:37:07 +0000479 esac
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000480
DRC60cddeb2010-02-12 05:37:07 +0000481 if test "x${with_simd}" != "xno"; then
482 AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
483 fi
DRC6da61db2013-01-19 01:06:46 +0000484else
485 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
DRC60cddeb2010-02-12 05:37:07 +0000486fi
DRC411dcf52010-02-12 04:28:29 +0000487
DRC60cddeb2010-02-12 05:37:07 +0000488AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
DRC321e0682011-05-03 08:47:43 +0000489AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000490AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
491AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
DRC321e0682011-05-03 08:47:43 +0000492AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
DRCba55b2c2014-02-05 08:15:44 +0000493AM_CONDITIONAL([SIMD_ARM_64], [test "x$simd_arch" = "xaarch64"])
DRC0be9fa52013-07-24 21:50:20 +0000494AM_CONDITIONAL([SIMD_MIPSEL], [test "x$simd_arch" = "xmipsel"])
DRC49597872010-05-17 20:47:57 +0000495AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
DRC211d1e72013-01-13 11:25:20 +0000496AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
Pierre Ossman59a39382009-03-09 13:15:56 +0000497
DRC764e1e22013-04-19 04:25:14 +0000498AC_ARG_VAR(PKGNAME, [distribution package name (default: libjpeg-turbo)])
499if test "x$PKGNAME" = "x"; then
500 PKGNAME=$PACKAGE_NAME
501fi
502AC_SUBST(PKGNAME)
503
DRC079b4342010-02-15 11:32:23 +0000504case "$host_cpu" in
505 x86_64)
506 RPMARCH=x86_64
DRC52a19f22010-02-15 12:06:27 +0000507 DEBARCH=amd64
DRC079b4342010-02-15 11:32:23 +0000508 ;;
509 i*86 | x86 | ia32)
510 RPMARCH=i386
DRC52a19f22010-02-15 12:06:27 +0000511 DEBARCH=i386
DRC079b4342010-02-15 11:32:23 +0000512 ;;
513esac
514
515AC_SUBST(RPMARCH)
DRC6da61db2013-01-19 01:06:46 +0000516AC_SUBST(RPM_CONFIG_ARGS)
DRC52a19f22010-02-15 12:06:27 +0000517AC_SUBST(DEBARCH)
DRC079b4342010-02-15 11:32:23 +0000518AC_SUBST(BUILD)
DRC2cdd2ae2010-10-10 06:54:21 +0000519AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
DRC079b4342010-02-15 11:32:23 +0000520
Pierre Ossmanba0ce392009-03-06 15:30:42 +0000521# jconfig.h is the file we use, but we have another before that to
522# fool autoheader. the reason is that we include this header in our
523# API headers, which can screw things up for users of the lib.
524# jconfig.h is a minimal version that allows this package to be built
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000525AC_CONFIG_HEADERS([config.h])
526AC_CONFIG_HEADERS([jconfig.h])
DRC764e1e22013-04-19 04:25:14 +0000527AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
DRC7175e512013-04-23 22:29:00 +0000528AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
DRC764e1e22013-04-19 04:25:14 +0000529AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
DRC7175e512013-04-23 22:29:00 +0000530AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
DRCb94f2de2011-03-22 09:31:25 +0000531AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in])
532AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in])
DRC7175e512013-04-23 22:29:00 +0000533AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
DRC211d1e72013-01-13 11:25:20 +0000534if test "x$with_turbojpeg" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000535 AC_CONFIG_FILES([tjbenchtest])
DRC211d1e72013-01-13 11:25:20 +0000536fi
537if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000538 AC_CONFIG_FILES([tjbenchtest.java])
539 AC_CONFIG_FILES([tjexampletest])
DRC211d1e72013-01-13 11:25:20 +0000540fi
DRC8515d3d2010-10-19 06:38:57 +0000541AC_CONFIG_FILES([libjpeg.map])
Pierre Ossman3a65ef42009-03-16 13:34:18 +0000542AC_CONFIG_FILES([Makefile simd/Makefile])
DRCdffd53d2011-04-01 00:37:20 +0000543AC_CONFIG_FILES([java/Makefile])
DRC0bf58f22013-02-06 23:51:08 +0000544AC_CONFIG_FILES([md5/Makefile])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000545AC_OUTPUT