blob: f2b8cf2e4cb8689efd49074a66f67dbacfc006ed [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])
DRC2b7a3912015-01-16 06:17:05 +00005AC_INIT([libjpeg-turbo], [1.4.1])
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
DRCc7e10b22014-03-21 08:36:06 +000011m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
12
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000013# Checks for programs.
DRCe7b699d2010-02-14 07:39:07 +000014SAVED_CFLAGS=${CFLAGS}
DRCb4a50ce2011-02-26 21:07:50 +000015SAVED_CPPFLAGS=${CPPFLAGS}
Pierre Ossman2ae181c2009-03-09 13:21:27 +000016AC_PROG_CPP
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000017AC_PROG_CC
DRC6f75a352014-02-20 19:33:44 +000018m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
DRC321e0682011-05-03 08:47:43 +000019AM_PROG_AS
DRCc56cb472014-02-15 07:02:04 +000020AM_PROG_CC_C_O
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000021AC_PROG_INSTALL
22AC_PROG_LIBTOOL
23AC_PROG_LN_S
24
DRC764e1e22013-04-19 04:25:14 +000025# When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is
26# being created, and thus we install things into specific locations.
27
28old_prefix=${prefix}
29if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
30 prefix=$ac_default_prefix
31fi
32DATADIR=`eval echo ${datadir}`
33DATADIR=`eval echo $DATADIR`
34if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
35 datadir='${prefix}'
36fi
DRC7175e512013-04-23 22:29:00 +000037DATADIR=`eval echo ${datarootdir}`
38DATADIR=`eval echo $DATADIR`
39if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
40 datarootdir='${prefix}'
41fi
DRCc69a1cd2015-02-23 19:06:44 +000042DOCDIR=`eval echo ${docdir}`
43DOCDIR=`eval echo $DOCDIR`
44if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then
45 docdir='${datadir}/doc'
46fi
DRC764e1e22013-04-19 04:25:14 +000047
48old_exec_prefix=${exec_prefix}
49if test "x$exec_prefix" = "xNONE"; then
50 exec_prefix=${prefix}
51fi
52
53if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
54 LIBDIR=`eval echo ${libdir}`
55 LIBDIR=`eval echo $LIBDIR`
56 if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then
57 case $host_os in
58 darwin*)
59 ;;
60 *)
DRCc32e0c22013-08-11 22:57:19 +000061 AC_CHECK_SIZEOF(long)
62 if test "${ac_cv_sizeof_long}" = "8"; then
63 libdir='${exec_prefix}/lib64'
64 elif test "${ac_cv_sizeof_long}" = "4"; then
65 libdir='${exec_prefix}/lib32'
66 fi
DRC764e1e22013-04-19 04:25:14 +000067 ;;
68 esac
69 fi
70fi
71exec_prefix=${old_exec_prefix}
72prefix=${old_prefix}
73
DRCbdb12882010-08-21 21:14:17 +000074# Check whether compiler supports pointers to undefined structures
75AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
76AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], ,
DRC0ddff3b2013-04-11 05:17:53 +000077 AC_MSG_RESULT(yes),
78 [AC_MSG_RESULT(no)
79 AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
80 [Compiler does not support pointers to undefined structures.])])
DRCbdb12882010-08-21 21:14:17 +000081
DRCe7b699d2010-02-14 07:39:07 +000082if test "x${GCC}" = "xyes"; then
83 if test "x${SAVED_CFLAGS}" = "x"; then
84 CFLAGS=-O3
85 fi
DRCb4a50ce2011-02-26 21:07:50 +000086 if test "x${SAVED_CPPFLAGS}" = "x"; then
87 CPPFLAGS=-Wall
88 fi
DRCe7b699d2010-02-14 07:39:07 +000089fi
90
DRC1e2f2982010-02-16 22:35:25 +000091AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
92if test "x${SUNCC}" = "xyes"; then
93 if test "x${SAVED_CFLAGS}" = "x"; then
94 CFLAGS=-xO5
95 fi
DRC1e2f2982010-02-16 22:35:25 +000096fi
97
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000098# Checks for libraries.
99
100# Checks for header files.
101AC_HEADER_STDC
DRCff6961f2014-04-20 09:17:11 +0000102AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h])
DRC0ddff3b2013-04-11 05:17:53 +0000103AC_CHECK_HEADER([sys/types.h],
DRCff6961f2014-04-20 09:17:11 +0000104 AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include <sys/types.h> to get size_t.]))
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000105
106# Checks for typedefs, structures, and compiler characteristics.
107AC_C_CONST
108AC_C_CHAR_UNSIGNED
109AC_C_INLINE
110AC_TYPE_SIZE_T
111AC_CHECK_TYPES([unsigned char, unsigned short])
112
113AC_MSG_CHECKING([if right shift is signed])
114AC_TRY_RUN(
DRC0ddff3b2013-04-11 05:17:53 +0000115 [#include <stdio.h>
116 int is_shifting_signed (long arg) {
117 long res = arg >> 4;
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000118
DRC0ddff3b2013-04-11 05:17:53 +0000119 if (res == -0x7F7E80CL)
120 return 1; /* right shift is signed */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000121
DRC0ddff3b2013-04-11 05:17:53 +0000122 /* see if unsigned-shift hack will fix it. */
123 /* we can't just test exact value since it depends on width of long... */
124 res |= (~0L) << (32-4);
125 if (res == -0x7F7E80CL)
126 return 0; /* right shift is unsigned */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000127
DRC0ddff3b2013-04-11 05:17:53 +0000128 printf("Right shift isn't acting as I expect it to.\n");
129 printf("I fear the JPEG software will not work at all.\n\n");
130 return 0; /* try it with unsigned anyway */
131 }
132 int main (void) {
133 exit(is_shifting_signed(-0x7F7E80B1L));
134 }],
135 [AC_MSG_RESULT(no)
DRCff6961f2014-04-20 09:17:11 +0000136 AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1,
137 [Define if your (broken) compiler shifts signed values as if they were unsigned.])],
DRC0ddff3b2013-04-11 05:17:53 +0000138 [AC_MSG_RESULT(yes)],
139 [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000140
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000141# Checks for library functions.
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000142AC_CHECK_FUNCS([memset memcpy], [],
DRC0ddff3b2013-04-11 05:17:53 +0000143 [AC_DEFINE([NEED_BSD_STRINGS], 1,
DRCff6961f2014-04-20 09:17:11 +0000144 [Define if you have BSD-like bzero and bcopy in <strings.h> rather than memset/memcpy in <string.h>.])])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000145
DRC1f80a102010-10-18 00:15:31 +0000146AC_MSG_CHECKING([libjpeg API version])
147AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
148if test "x$JPEG_LIB_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000149 AC_ARG_WITH([jpeg7],
150 AC_HELP_STRING([--with-jpeg7],
151 [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
152 AC_ARG_WITH([jpeg8],
153 AC_HELP_STRING([--with-jpeg8],
154 [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
155 if test "x${with_jpeg8}" = "xyes"; then
156 JPEG_LIB_VERSION=80
157 else
158 if test "x${with_jpeg7}" = "xyes"; then
159 JPEG_LIB_VERSION=70
DRC36a6eec2010-10-08 08:05:44 +0000160 else
DRC0ddff3b2013-04-11 05:17:53 +0000161 JPEG_LIB_VERSION=62
DRC36a6eec2010-10-08 08:05:44 +0000162 fi
DRC0ddff3b2013-04-11 05:17:53 +0000163 fi
DRC36a6eec2010-10-08 08:05:44 +0000164fi
DRC1f80a102010-10-18 00:15:31 +0000165JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
DRC8515d3d2010-10-19 06:38:57 +0000166AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
DRC1f80a102010-10-18 00:15:31 +0000167AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
DRC0ddff3b2013-04-11 05:17:53 +0000168AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
169 [libjpeg API version])
DRC1f80a102010-10-18 00:15:31 +0000170
DRC0ddff3b2013-04-11 05:17:53 +0000171AC_ARG_VAR(SO_MAJOR_VERSION,
172 [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
173AC_ARG_VAR(SO_MINOR_VERSION,
174 [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
DRC1f80a102010-10-18 00:15:31 +0000175if test "x$SO_MAJOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000176 case "$JPEG_LIB_VERSION" in
177 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
178 *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
179 esac
DRC1f80a102010-10-18 00:15:31 +0000180fi
181if test "x$SO_MINOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000182 case "$JPEG_LIB_VERSION" in
183 80) SO_MINOR_VERSION=2 ;;
184 *) SO_MINOR_VERSION=0 ;;
185 esac
DRC1f80a102010-10-18 00:15:31 +0000186fi
DRCab706232013-01-18 23:42:31 +0000187
DRC6da61db2013-01-19 01:06:46 +0000188RPM_CONFIG_ARGS=
189
DRCab706232013-01-18 23:42:31 +0000190# Memory source/destination managers
191SO_AGE=0
192MEM_SRCDST_FUNCTIONS=
193if test "x${with_jpeg8}" != "xyes"; then
194 AC_MSG_CHECKING([whether to include in-memory source/destination managers])
195 AC_ARG_WITH([mem-srcdst],
DRC0ddff3b2013-04-11 05:17:53 +0000196 AC_HELP_STRING([--without-mem-srcdst],
197 [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI]))
DRCab706232013-01-18 23:42:31 +0000198 if test "x$with_mem_srcdst" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000199 AC_MSG_RESULT(yes)
200 AC_DEFINE([MEM_SRCDST_SUPPORTED], [1],
201 [Support in-memory source/destination managers])
202 SO_AGE=1
203 MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;";
DRCab706232013-01-18 23:42:31 +0000204 else
DRC0ddff3b2013-04-11 05:17:53 +0000205 AC_MSG_RESULT(no)
206 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst"
DRCab706232013-01-18 23:42:31 +0000207 fi
208fi
209
210AC_MSG_CHECKING([libjpeg shared library version])
211AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
DRC6da61db2013-01-19 01:06:46 +0000212LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
213AC_SUBST(LIBTOOL_CURRENT)
DRC1f80a102010-10-18 00:15:31 +0000214AC_SUBST(SO_MAJOR_VERSION)
215AC_SUBST(SO_MINOR_VERSION)
DRCab706232013-01-18 23:42:31 +0000216AC_SUBST(SO_AGE)
217AC_SUBST(MEM_SRCDST_FUNCTIONS)
DRC36a6eec2010-10-08 08:05:44 +0000218
DRCab64b622011-12-18 16:29:35 +0000219AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
220
DRC7a0478e2010-11-07 19:12:30 +0000221VERSION_SCRIPT=yes
222AC_ARG_ENABLE([ld-version-script],
223 AS_HELP_STRING([--disable-ld-version-script],
224 [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 +0000225 [VERSION_SCRIPT=$enableval], [])
DRC8515d3d2010-10-19 06:38:57 +0000226
227AC_MSG_CHECKING([whether the linker supports version scripts])
228SAVED_LDFLAGS="$LDFLAGS"
229LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
230cat > conftest.map <<EOF
231VERS_1 {
232 global: *;
233};
234EOF
DRCc56cb472014-02-15 07:02:04 +0000235AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
DRC0ddff3b2013-04-11 05:17:53 +0000236 [VERSION_SCRIPT_FLAG=-Wl,--version-script,;
237 AC_MSG_RESULT([yes (GNU style)])],
238 [])
DRC8515d3d2010-10-19 06:38:57 +0000239if test "x$VERSION_SCRIPT_FLAG" = "x"; then
240 LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
DRCc56cb472014-02-15 07:02:04 +0000241 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
DRC0ddff3b2013-04-11 05:17:53 +0000242 [VERSION_SCRIPT_FLAG=-Wl,-M,;
243 AC_MSG_RESULT([yes (Sun style)])],
244 [])
DRC8515d3d2010-10-19 06:38:57 +0000245fi
246if test "x$VERSION_SCRIPT_FLAG" = "x"; then
247 VERSION_SCRIPT=no
248 AC_MSG_RESULT(no)
249fi
DRC8515d3d2010-10-19 06:38:57 +0000250LDFLAGS="$SAVED_LDFLAGS"
251
DRC9fa95592011-02-25 00:23:44 +0000252AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
DRC8515d3d2010-10-19 06:38:57 +0000253AC_MSG_RESULT($VERSION_SCRIPT)
254
255AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
DRC8515d3d2010-10-19 06:38:57 +0000256AC_SUBST(VERSION_SCRIPT_FLAG)
DRC8515d3d2010-10-19 06:38:57 +0000257
DRCb4570bb2011-09-07 06:31:00 +0000258# Check for non-broken inline under various spellings
259AC_MSG_CHECKING(for inline)
260ljt_cv_inline=""
DRCff6961f2014-04-20 09:17:11 +0000261AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; }
DRCad64b5a2014-03-21 09:22:21 +0000262int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))",
DRCb4570bb2011-09-07 06:31:00 +0000263AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
264int bar() { return foo();], ljt_cv_inline="__inline__",
265AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
266int bar() { return foo();], ljt_cv_inline="__inline",
267AC_TRY_COMPILE(, [} inline int foo() { return 0; }
268int bar() { return foo();], ljt_cv_inline="inline"))))
269AC_MSG_RESULT($ljt_cv_inline)
270AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
271
DRC211d1e72013-01-13 11:25:20 +0000272# Arithmetic coding support
DRC990e28d2011-01-04 21:40:11 +0000273AC_MSG_CHECKING([whether to include arithmetic encoding support])
DRCe3720042010-11-23 06:50:14 +0000274AC_ARG_WITH([arith-enc],
DRC0ddff3b2013-04-11 05:17:53 +0000275 AC_HELP_STRING([--without-arith-enc],
276 [Do not include arithmetic encoding support]))
DRCaee4f722014-08-09 23:06:07 +0000277if test "x$with_12bit" = "xyes"; then
278 with_arith_enc=no
279fi
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]))
DRCaee4f722014-08-09 23:06:07 +0000293if test "x$with_12bit" = "xyes"; then
294 with_arith_dec=no
295fi
DRCe3720042010-11-23 06:50:14 +0000296if test "x$with_arith_dec" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000297 AC_MSG_RESULT(no)
298 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
DRCe3720042010-11-23 06:50:14 +0000299else
DRC0ddff3b2013-04-11 05:17:53 +0000300 AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
301 AC_MSG_RESULT(yes)
DRCe3720042010-11-23 06:50:14 +0000302fi
303AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
304
DRC0ddff3b2013-04-11 05:17:53 +0000305AM_CONDITIONAL([WITH_ARITH],
306 [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
DRCe3720042010-11-23 06:50:14 +0000307
DRCaee4f722014-08-09 23:06:07 +0000308# 12-bit component support
309AC_MSG_CHECKING([whether to use 12-bit samples])
310AC_ARG_WITH([12bit],
311 AC_HELP_STRING([--with-12bit], [Encode/decode JPEG images with 12-bit samples (implies --without-simd --without-turbojpeg --without-arith-dec --without-arith-enc)]))
312if test "x$with_12bit" = "xyes"; then
313 AC_DEFINE([BITS_IN_JSAMPLE], [12], [use 8 or 12])
314 AC_MSG_RESULT(yes)
315else
316 AC_MSG_RESULT(no)
317fi
318AM_CONDITIONAL([WITH_12BIT], [test "x$with_12bit" = "xyes"])
319
DRC211d1e72013-01-13 11:25:20 +0000320# TurboJPEG support
DRC5039d732013-01-21 23:42:12 +0000321AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
DRC211d1e72013-01-13 11:25:20 +0000322AC_ARG_WITH([turbojpeg],
DRC0ddff3b2013-04-11 05:17:53 +0000323 AC_HELP_STRING([--without-turbojpeg],
324 [Do not include the TurboJPEG wrapper library and associated test programs]))
DRCaee4f722014-08-09 23:06:07 +0000325if test "x$with_12bit" = "xyes"; then
326 with_turbojpeg=no
327fi
DRC211d1e72013-01-13 11:25:20 +0000328if test "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000329 AC_MSG_RESULT(no)
330 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
DRC211d1e72013-01-13 11:25:20 +0000331else
DRC0ddff3b2013-04-11 05:17:53 +0000332 AC_MSG_RESULT(yes)
DRC211d1e72013-01-13 11:25:20 +0000333fi
334
335# Java support
DRCf2602ce2011-04-01 00:20:33 +0000336AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
337if test "x$JAVAC" = "x"; then
338 JAVAC=javac
339fi
340AC_SUBST(JAVAC)
341AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
342AC_SUBST(JAVACFLAGS)
343AC_ARG_VAR(JAR, [Java archive command (default: jar)])
344if test "x$JAR" = "x"; then
345 JAR=jar
346fi
347AC_SUBST(JAR)
348AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
349if test "x$JAVA" = "x"; then
350 JAVA=java
351fi
352AC_SUBST(JAVA)
DRC0ddff3b2013-04-11 05:17:53 +0000353AC_ARG_VAR(JNI_CFLAGS,
354 [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 +0000355
DRC5039d732013-01-21 23:42:12 +0000356AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
DRCf2602ce2011-04-01 00:20:33 +0000357AC_ARG_WITH([java],
DRC0ddff3b2013-04-11 05:17:53 +0000358 AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
DRCaee4f722014-08-09 23:06:07 +0000359if test "x$with_12bit" = "xyes" -o "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000360 with_java=no
DRC211d1e72013-01-13 11:25:20 +0000361fi
DRC1421a262011-02-06 15:35:38 +0000362
DRCf2602ce2011-04-01 00:20:33 +0000363WITH_JAVA=0
364if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000365 AC_MSG_RESULT(yes)
DRC1421a262011-02-06 15:35:38 +0000366
DRC0ddff3b2013-04-11 05:17:53 +0000367 case $host_os in
368 darwin*)
369 DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
370 ;;
371 solaris*)
372 DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
373 ;;
374 linux*)
375 DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
376 ;;
377 esac
378 if test "x$JNI_CFLAGS" = "x"; then
379 JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
380 fi
DRC1421a262011-02-06 15:35:38 +0000381
DRC0ddff3b2013-04-11 05:17:53 +0000382 SAVE_CPPFLAGS=${CPPFLAGS}
383 CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
384 AC_CHECK_HEADERS([jni.h], [DUMMY=1],
385 [AC_MSG_ERROR([Could not find JNI header file])])
386 CPPFLAGS=${SAVE_CPPFLAGS}
387 AC_SUBST(JNI_CFLAGS)
DRC1b0c3b02011-02-06 15:51:27 +0000388
DRC0ddff3b2013-04-11 05:17:53 +0000389 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --with-java"
DRC764e1e22013-04-19 04:25:14 +0000390 JAVA_RPM_CONTENTS_1='%dir %{_datadir}/classes'
391 JAVA_RPM_CONTENTS_2=%{_datadir}/classes/turbojpeg.jar
DRC0ddff3b2013-04-11 05:17:53 +0000392 WITH_JAVA=1
DRCf8e00552011-02-04 11:06:36 +0000393else
DRC0ddff3b2013-04-11 05:17:53 +0000394 AC_MSG_RESULT(no)
DRCf8e00552011-02-04 11:06:36 +0000395fi
DRCf2602ce2011-04-01 00:20:33 +0000396AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
397AC_SUBST(WITH_JAVA)
398AC_SUBST(JAVA_RPM_CONTENTS_1)
399AC_SUBST(JAVA_RPM_CONTENTS_2)
DRCf8e00552011-02-04 11:06:36 +0000400
DRC4346f912011-06-14 22:16:50 +0000401# optionally force using gas-preprocessor.pl for compatibility testing
402AC_ARG_WITH([gas-preprocessor],
DRC0ddff3b2013-04-11 05:17:53 +0000403 AC_HELP_STRING([--with-gas-preprocessor],
404 [Force using gas-preprocessor.pl on ARM.]))
DRC4346f912011-06-14 22:16:50 +0000405if test "x${with_gas_preprocessor}" = "xyes"; then
406 case $host_os in
407 darwin*)
408 CCAS="gas-preprocessor.pl -fix-unreq $CC"
409 ;;
410 *)
411 CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
412 ;;
413 esac
414 AC_SUBST([CCAS])
415fi
416
DRC60cddeb2010-02-12 05:37:07 +0000417# SIMD is optional
418AC_ARG_WITH([simd],
DRC0ddff3b2013-04-11 05:17:53 +0000419 AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
DRCaee4f722014-08-09 23:06:07 +0000420if test "x$with_12bit" = "xyes"; then
421 with_simd=no
422fi
DRC60cddeb2010-02-12 05:37:07 +0000423if test "x${with_simd}" != "xno"; then
DRC8ca34d42013-09-25 04:36:44 +0000424 require_simd=no
425 if test "x${with_simd}" = "xyes"; then
426 require_simd=yes
427 fi
DRC60cddeb2010-02-12 05:37:07 +0000428 # Check if we're on a supported CPU
429 AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
430 case "$host_cpu" in
DRC49597872010-05-17 20:47:57 +0000431 x86_64 | amd64)
DRC60cddeb2010-02-12 05:37:07 +0000432 AC_MSG_RESULT([yes (x86_64)])
433 AC_PROG_NASM
434 simd_arch=x86_64
DRC0ddff3b2013-04-11 05:17:53 +0000435 ;;
DRC60cddeb2010-02-12 05:37:07 +0000436 i*86 | x86 | ia32)
437 AC_MSG_RESULT([yes (i386)])
438 AC_PROG_NASM
439 simd_arch=i386
DRC0ddff3b2013-04-11 05:17:53 +0000440 ;;
DRC321e0682011-05-03 08:47:43 +0000441 arm*)
442 AC_MSG_RESULT([yes (arm)])
443 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
444 AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
DRCb9c4b582014-12-19 15:40:21 +0000445 [if test "x$ac_use_gas_preprocessor" = "xyes"; then
446 AC_MSG_RESULT([yes (with gas-preprocessor)])
447 else
448 AC_MSG_RESULT([yes])
449 fi
DRC321e0682011-05-03 08:47:43 +0000450 simd_arch=arm],
451 [AC_MSG_RESULT([no])
DRC8ca34d42013-09-25 04:36:44 +0000452 with_simd=no])
DRC596b9662013-10-26 00:29:53 +0000453 if test "x${with_simd}" = "xno"; then
454 if test "x${require_simd}" = "xyes"; then
455 AC_MSG_ERROR([SIMD support can't be enabled.])
456 else
457 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
DRCba55b2c2014-02-05 08:15:44 +0000458 fi
DRC596b9662013-10-26 00:29:53 +0000459 fi
DRCba55b2c2014-02-05 08:15:44 +0000460 ;;
461 aarch64*)
462 AC_MSG_RESULT([yes (arm64)])
463 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
464 AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE(
DRCb9c4b582014-12-19 15:40:21 +0000465 [if test "x$ac_use_gas_preprocessor" = "xyes"; then
466 AC_MSG_RESULT([yes (with gas-preprocessor)])
467 else
468 AC_MSG_RESULT([yes])
469 fi
DRCba55b2c2014-02-05 08:15:44 +0000470 simd_arch=aarch64],
471 [AC_MSG_RESULT([no])
472 with_simd=no])
473 if test "x${with_simd}" = "xno"; then
474 if test "x${require_simd}" = "xyes"; then
475 AC_MSG_ERROR([SIMD support can't be enabled.])
476 else
477 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
478 fi
DRC8ca34d42013-09-25 04:36:44 +0000479 fi
DRC0ddff3b2013-04-11 05:17:53 +0000480 ;;
DRC495e4342014-05-19 19:13:22 +0000481 mips*)
482 AC_MSG_RESULT([yes (mips)])
DRC0be9fa52013-07-24 21:50:20 +0000483 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
DRC495e4342014-05-19 19:13:22 +0000484 AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE(
DRC0be9fa52013-07-24 21:50:20 +0000485 [AC_MSG_RESULT([yes])
DRC495e4342014-05-19 19:13:22 +0000486 simd_arch=mips],
DRC0be9fa52013-07-24 21:50:20 +0000487 [AC_MSG_RESULT([no])
DRC8ca34d42013-09-25 04:36:44 +0000488 with_simd=no])
DRC596b9662013-10-26 00:29:53 +0000489 if test "x${with_simd}" = "xno"; then
490 if test "x${require_simd}" = "xyes"; then
491 AC_MSG_ERROR([SIMD support can't be enabled.])
492 else
493 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
494 fi
DRC8ca34d42013-09-25 04:36:44 +0000495 fi
DRC0be9fa52013-07-24 21:50:20 +0000496 ;;
DRC60cddeb2010-02-12 05:37:07 +0000497 *)
498 AC_MSG_RESULT([no ("$host_cpu")])
DRC83f21442010-06-10 18:52:41 +0000499 with_simd=no;
DRC596b9662013-10-26 00:29:53 +0000500 if test "x${require_simd}" = "xyes"; then
DRC8ca34d42013-09-25 04:36:44 +0000501 AC_MSG_ERROR([SIMD support not available for this CPU.])
502 else
503 AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
504 fi
DRC0ddff3b2013-04-11 05:17:53 +0000505 ;;
DRC60cddeb2010-02-12 05:37:07 +0000506 esac
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000507
DRC60cddeb2010-02-12 05:37:07 +0000508 if test "x${with_simd}" != "xno"; then
509 AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
510 fi
DRC6da61db2013-01-19 01:06:46 +0000511else
512 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
DRC60cddeb2010-02-12 05:37:07 +0000513fi
DRC411dcf52010-02-12 04:28:29 +0000514
DRC60cddeb2010-02-12 05:37:07 +0000515AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
DRC321e0682011-05-03 08:47:43 +0000516AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000517AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
518AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
DRC321e0682011-05-03 08:47:43 +0000519AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
DRCba55b2c2014-02-05 08:15:44 +0000520AM_CONDITIONAL([SIMD_ARM_64], [test "x$simd_arch" = "xaarch64"])
DRC495e4342014-05-19 19:13:22 +0000521AM_CONDITIONAL([SIMD_MIPS], [test "x$simd_arch" = "xmips"])
DRC49597872010-05-17 20:47:57 +0000522AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
DRC211d1e72013-01-13 11:25:20 +0000523AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
Pierre Ossman59a39382009-03-09 13:15:56 +0000524
DRC764e1e22013-04-19 04:25:14 +0000525AC_ARG_VAR(PKGNAME, [distribution package name (default: libjpeg-turbo)])
526if test "x$PKGNAME" = "x"; then
527 PKGNAME=$PACKAGE_NAME
528fi
529AC_SUBST(PKGNAME)
530
DRC079b4342010-02-15 11:32:23 +0000531case "$host_cpu" in
532 x86_64)
533 RPMARCH=x86_64
DRC52a19f22010-02-15 12:06:27 +0000534 DEBARCH=amd64
DRC079b4342010-02-15 11:32:23 +0000535 ;;
536 i*86 | x86 | ia32)
537 RPMARCH=i386
DRC52a19f22010-02-15 12:06:27 +0000538 DEBARCH=i386
DRC079b4342010-02-15 11:32:23 +0000539 ;;
DRCcab2a852015-02-20 20:12:15 +0000540 *)
541 RPMARCH=`uname -m`
542 DEBARCH=$RPMARCH
543 ;;
DRC079b4342010-02-15 11:32:23 +0000544esac
545
DRCc69a1cd2015-02-23 19:06:44 +0000546if test "${docdir}" = ""; then
547 docdir=${datadir}/doc
548 AC_SUBST(docdir)
549fi
550
DRC079b4342010-02-15 11:32:23 +0000551AC_SUBST(RPMARCH)
DRC6da61db2013-01-19 01:06:46 +0000552AC_SUBST(RPM_CONFIG_ARGS)
DRC52a19f22010-02-15 12:06:27 +0000553AC_SUBST(DEBARCH)
DRC079b4342010-02-15 11:32:23 +0000554AC_SUBST(BUILD)
DRCff6961f2014-04-20 09:17:11 +0000555AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number])
DRC079b4342010-02-15 11:32:23 +0000556
DRC990342c2014-04-15 03:41:31 +0000557# NOTE: autoheader automatically modifies the input file of the first
558# invocation of AC_CONFIG_HEADERS, so we put config.h first to prevent
559# jconfig.h.in from being clobbered. config.h is used only internally, whereas
560# jconfig.h contains macros that are relevant to external programs (macros that
561# specify which features were built into the library.)
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000562AC_CONFIG_HEADERS([config.h])
563AC_CONFIG_HEADERS([jconfig.h])
DRCff6961f2014-04-20 09:17:11 +0000564AC_CONFIG_HEADERS([jconfigint.h])
DRC764e1e22013-04-19 04:25:14 +0000565AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
DRC7175e512013-04-23 22:29:00 +0000566AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
DRC764e1e22013-04-19 04:25:14 +0000567AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
DRC7175e512013-04-23 22:29:00 +0000568AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
DRC7175e512013-04-23 22:29:00 +0000569AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
DRC211d1e72013-01-13 11:25:20 +0000570if test "x$with_turbojpeg" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000571 AC_CONFIG_FILES([tjbenchtest])
DRC211d1e72013-01-13 11:25:20 +0000572fi
573if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000574 AC_CONFIG_FILES([tjbenchtest.java])
575 AC_CONFIG_FILES([tjexampletest])
DRC211d1e72013-01-13 11:25:20 +0000576fi
DRC8515d3d2010-10-19 06:38:57 +0000577AC_CONFIG_FILES([libjpeg.map])
Pierre Ossman3a65ef42009-03-16 13:34:18 +0000578AC_CONFIG_FILES([Makefile simd/Makefile])
DRCdffd53d2011-04-01 00:37:20 +0000579AC_CONFIG_FILES([java/Makefile])
DRC0bf58f22013-02-06 23:51:08 +0000580AC_CONFIG_FILES([md5/Makefile])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000581AC_OUTPUT