blob: 9fd2948ef521d18db4761423d307d2212f6b6d5c [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])
DRC06fa20d2014-04-20 07:20:31 +00005AC_INIT([libjpeg-turbo], [1.3.2])
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
DRCc7e10b22014-03-21 08:36:06 +000014m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
15
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000016# Checks for programs.
DRCe7b699d2010-02-14 07:39:07 +000017SAVED_CFLAGS=${CFLAGS}
DRCb4a50ce2011-02-26 21:07:50 +000018SAVED_CPPFLAGS=${CPPFLAGS}
Pierre Ossman2ae181c2009-03-09 13:21:27 +000019AC_PROG_CPP
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000020AC_PROG_CC
DRCffa5e592014-02-28 05:26:24 +000021m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
DRC321e0682011-05-03 08:47:43 +000022AM_PROG_AS
DRCffa5e592014-02-28 05:26:24 +000023AM_PROG_CC_C_O
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000024AC_PROG_INSTALL
25AC_PROG_LIBTOOL
26AC_PROG_LN_S
27
DRC764e1e22013-04-19 04:25:14 +000028# When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is
29# being created, and thus we install things into specific locations.
30
31old_prefix=${prefix}
32if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
33 prefix=$ac_default_prefix
34fi
35DATADIR=`eval echo ${datadir}`
36DATADIR=`eval echo $DATADIR`
37if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
38 datadir='${prefix}'
39fi
DRC7175e512013-04-23 22:29:00 +000040DATADIR=`eval echo ${datarootdir}`
41DATADIR=`eval echo $DATADIR`
42if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
43 datarootdir='${prefix}'
44fi
DRC764e1e22013-04-19 04:25:14 +000045
46old_exec_prefix=${exec_prefix}
47if test "x$exec_prefix" = "xNONE"; then
48 exec_prefix=${prefix}
49fi
50
51if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
52 LIBDIR=`eval echo ${libdir}`
53 LIBDIR=`eval echo $LIBDIR`
54 if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then
55 case $host_os in
56 darwin*)
57 ;;
58 *)
DRCc32e0c22013-08-11 22:57:19 +000059 AC_CHECK_SIZEOF(long)
60 if test "${ac_cv_sizeof_long}" = "8"; then
61 libdir='${exec_prefix}/lib64'
62 elif test "${ac_cv_sizeof_long}" = "4"; then
63 libdir='${exec_prefix}/lib32'
64 fi
DRC764e1e22013-04-19 04:25:14 +000065 ;;
66 esac
67 fi
68fi
69exec_prefix=${old_exec_prefix}
70prefix=${old_prefix}
71
DRCbdb12882010-08-21 21:14:17 +000072# Check whether compiler supports pointers to undefined structures
73AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
74AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], ,
DRC0ddff3b2013-04-11 05:17:53 +000075 AC_MSG_RESULT(yes),
76 [AC_MSG_RESULT(no)
77 AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
78 [Compiler does not support pointers to undefined structures.])])
DRCbdb12882010-08-21 21:14:17 +000079
DRCe7b699d2010-02-14 07:39:07 +000080if test "x${GCC}" = "xyes"; then
81 if test "x${SAVED_CFLAGS}" = "x"; then
82 CFLAGS=-O3
83 fi
DRCb4a50ce2011-02-26 21:07:50 +000084 if test "x${SAVED_CPPFLAGS}" = "x"; then
85 CPPFLAGS=-Wall
86 fi
DRCe7b699d2010-02-14 07:39:07 +000087fi
88
DRC1e2f2982010-02-16 22:35:25 +000089AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
90if test "x${SUNCC}" = "xyes"; then
91 if test "x${SAVED_CFLAGS}" = "x"; then
92 CFLAGS=-xO5
93 fi
DRC1e2f2982010-02-16 22:35:25 +000094fi
95
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +000096# Checks for libraries.
97
98# Checks for header files.
99AC_HEADER_STDC
DRCff6961f2014-04-20 09:17:11 +0000100AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h])
DRC0ddff3b2013-04-11 05:17:53 +0000101AC_CHECK_HEADER([sys/types.h],
DRCff6961f2014-04-20 09:17:11 +0000102 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 +0000103
104# Checks for typedefs, structures, and compiler characteristics.
105AC_C_CONST
106AC_C_CHAR_UNSIGNED
107AC_C_INLINE
108AC_TYPE_SIZE_T
109AC_CHECK_TYPES([unsigned char, unsigned short])
110
111AC_MSG_CHECKING([if right shift is signed])
112AC_TRY_RUN(
DRC0ddff3b2013-04-11 05:17:53 +0000113 [#include <stdio.h>
114 int is_shifting_signed (long arg) {
115 long res = arg >> 4;
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000116
DRC0ddff3b2013-04-11 05:17:53 +0000117 if (res == -0x7F7E80CL)
118 return 1; /* right shift is signed */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000119
DRC0ddff3b2013-04-11 05:17:53 +0000120 /* see if unsigned-shift hack will fix it. */
121 /* we can't just test exact value since it depends on width of long... */
122 res |= (~0L) << (32-4);
123 if (res == -0x7F7E80CL)
124 return 0; /* right shift is unsigned */
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000125
DRC0ddff3b2013-04-11 05:17:53 +0000126 printf("Right shift isn't acting as I expect it to.\n");
127 printf("I fear the JPEG software will not work at all.\n\n");
128 return 0; /* try it with unsigned anyway */
129 }
130 int main (void) {
131 exit(is_shifting_signed(-0x7F7E80B1L));
132 }],
133 [AC_MSG_RESULT(no)
DRCff6961f2014-04-20 09:17:11 +0000134 AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1,
135 [Define if your (broken) compiler shifts signed values as if they were unsigned.])],
DRC0ddff3b2013-04-11 05:17:53 +0000136 [AC_MSG_RESULT(yes)],
137 [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000138
139# test whether global names are unique to at least 15 chars
140AC_MSG_CHECKING([for short external names])
141AC_TRY_LINK(
DRC0ddff3b2013-04-11 05:17:53 +0000142 [int possibly_duplicate_function () { return 0; }
143 int possibly_dupli_function () { return 1; }], [ ],
144 [AC_MSG_RESULT(ok)],
145 [AC_MSG_RESULT(short)
146 AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1,
DRCff6961f2014-04-20 09:17:11 +0000147 [Define if linker requires that the first 15 characters of global names be unique.])])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000148
149# Checks for library functions.
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000150AC_CHECK_FUNCS([memset memcpy], [],
DRC0ddff3b2013-04-11 05:17:53 +0000151 [AC_DEFINE([NEED_BSD_STRINGS], 1,
DRCff6961f2014-04-20 09:17:11 +0000152 [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 +0000153
DRC1f80a102010-10-18 00:15:31 +0000154AC_MSG_CHECKING([libjpeg API version])
155AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
156if test "x$JPEG_LIB_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000157 AC_ARG_WITH([jpeg7],
158 AC_HELP_STRING([--with-jpeg7],
159 [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
160 AC_ARG_WITH([jpeg8],
161 AC_HELP_STRING([--with-jpeg8],
162 [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
163 if test "x${with_jpeg8}" = "xyes"; then
164 JPEG_LIB_VERSION=80
165 else
166 if test "x${with_jpeg7}" = "xyes"; then
167 JPEG_LIB_VERSION=70
DRC36a6eec2010-10-08 08:05:44 +0000168 else
DRC0ddff3b2013-04-11 05:17:53 +0000169 JPEG_LIB_VERSION=62
DRC36a6eec2010-10-08 08:05:44 +0000170 fi
DRC0ddff3b2013-04-11 05:17:53 +0000171 fi
DRC36a6eec2010-10-08 08:05:44 +0000172fi
DRC1f80a102010-10-18 00:15:31 +0000173JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
DRC8515d3d2010-10-19 06:38:57 +0000174AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
DRC1f80a102010-10-18 00:15:31 +0000175AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
DRC0ddff3b2013-04-11 05:17:53 +0000176AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
177 [libjpeg API version])
DRC1f80a102010-10-18 00:15:31 +0000178
DRC0ddff3b2013-04-11 05:17:53 +0000179AC_ARG_VAR(SO_MAJOR_VERSION,
180 [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
181AC_ARG_VAR(SO_MINOR_VERSION,
182 [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
DRC1f80a102010-10-18 00:15:31 +0000183if test "x$SO_MAJOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000184 case "$JPEG_LIB_VERSION" in
185 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
186 *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
187 esac
DRC1f80a102010-10-18 00:15:31 +0000188fi
189if test "x$SO_MINOR_VERSION" = "x"; then
DRC0ddff3b2013-04-11 05:17:53 +0000190 case "$JPEG_LIB_VERSION" in
191 80) SO_MINOR_VERSION=2 ;;
192 *) SO_MINOR_VERSION=0 ;;
193 esac
DRC1f80a102010-10-18 00:15:31 +0000194fi
DRCab706232013-01-18 23:42:31 +0000195
DRC6da61db2013-01-19 01:06:46 +0000196RPM_CONFIG_ARGS=
197
DRCab706232013-01-18 23:42:31 +0000198# Memory source/destination managers
199SO_AGE=0
200MEM_SRCDST_FUNCTIONS=
201if test "x${with_jpeg8}" != "xyes"; then
202 AC_MSG_CHECKING([whether to include in-memory source/destination managers])
203 AC_ARG_WITH([mem-srcdst],
DRC0ddff3b2013-04-11 05:17:53 +0000204 AC_HELP_STRING([--without-mem-srcdst],
205 [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI]))
DRCab706232013-01-18 23:42:31 +0000206 if test "x$with_mem_srcdst" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000207 AC_MSG_RESULT(yes)
208 AC_DEFINE([MEM_SRCDST_SUPPORTED], [1],
209 [Support in-memory source/destination managers])
210 SO_AGE=1
211 MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;";
DRCab706232013-01-18 23:42:31 +0000212 else
DRC0ddff3b2013-04-11 05:17:53 +0000213 AC_MSG_RESULT(no)
214 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst"
DRCab706232013-01-18 23:42:31 +0000215 fi
216fi
217
218AC_MSG_CHECKING([libjpeg shared library version])
219AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
DRC6da61db2013-01-19 01:06:46 +0000220LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
221AC_SUBST(LIBTOOL_CURRENT)
DRC1f80a102010-10-18 00:15:31 +0000222AC_SUBST(SO_MAJOR_VERSION)
223AC_SUBST(SO_MINOR_VERSION)
DRCab706232013-01-18 23:42:31 +0000224AC_SUBST(SO_AGE)
225AC_SUBST(MEM_SRCDST_FUNCTIONS)
DRC36a6eec2010-10-08 08:05:44 +0000226
DRCab64b622011-12-18 16:29:35 +0000227AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
228
DRC7a0478e2010-11-07 19:12:30 +0000229VERSION_SCRIPT=yes
230AC_ARG_ENABLE([ld-version-script],
231 AS_HELP_STRING([--disable-ld-version-script],
232 [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 +0000233 [VERSION_SCRIPT=$enableval], [])
DRC8515d3d2010-10-19 06:38:57 +0000234
235AC_MSG_CHECKING([whether the linker supports version scripts])
236SAVED_LDFLAGS="$LDFLAGS"
237LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
238cat > conftest.map <<EOF
239VERS_1 {
240 global: *;
241};
242EOF
DRCffa5e592014-02-28 05:26:24 +0000243AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
DRC0ddff3b2013-04-11 05:17:53 +0000244 [VERSION_SCRIPT_FLAG=-Wl,--version-script,;
245 AC_MSG_RESULT([yes (GNU style)])],
246 [])
DRC8515d3d2010-10-19 06:38:57 +0000247if test "x$VERSION_SCRIPT_FLAG" = "x"; then
248 LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
DRCffa5e592014-02-28 05:26:24 +0000249 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
DRC0ddff3b2013-04-11 05:17:53 +0000250 [VERSION_SCRIPT_FLAG=-Wl,-M,;
251 AC_MSG_RESULT([yes (Sun style)])],
252 [])
DRC8515d3d2010-10-19 06:38:57 +0000253fi
254if test "x$VERSION_SCRIPT_FLAG" = "x"; then
255 VERSION_SCRIPT=no
256 AC_MSG_RESULT(no)
257fi
DRC8515d3d2010-10-19 06:38:57 +0000258LDFLAGS="$SAVED_LDFLAGS"
259
DRC9fa95592011-02-25 00:23:44 +0000260AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
DRC8515d3d2010-10-19 06:38:57 +0000261AC_MSG_RESULT($VERSION_SCRIPT)
262
263AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
DRC8515d3d2010-10-19 06:38:57 +0000264AC_SUBST(VERSION_SCRIPT_FLAG)
DRC8515d3d2010-10-19 06:38:57 +0000265
DRCb4570bb2011-09-07 06:31:00 +0000266# Check for non-broken inline under various spellings
267AC_MSG_CHECKING(for inline)
268ljt_cv_inline=""
DRCff6961f2014-04-20 09:17:11 +0000269AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; }
DRCad64b5a2014-03-21 09:22:21 +0000270int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))",
DRCb4570bb2011-09-07 06:31:00 +0000271AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
272int bar() { return foo();], ljt_cv_inline="__inline__",
273AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
274int bar() { return foo();], ljt_cv_inline="__inline",
275AC_TRY_COMPILE(, [} inline int foo() { return 0; }
276int bar() { return foo();], ljt_cv_inline="inline"))))
277AC_MSG_RESULT($ljt_cv_inline)
278AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
279
DRC211d1e72013-01-13 11:25:20 +0000280# Arithmetic coding support
DRC990e28d2011-01-04 21:40:11 +0000281AC_MSG_CHECKING([whether to include arithmetic encoding support])
DRCe3720042010-11-23 06:50:14 +0000282AC_ARG_WITH([arith-enc],
DRC0ddff3b2013-04-11 05:17:53 +0000283 AC_HELP_STRING([--without-arith-enc],
284 [Do not include arithmetic encoding support]))
DRCe3720042010-11-23 06:50:14 +0000285if test "x$with_arith_enc" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000286 AC_MSG_RESULT(no)
287 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
DRCe3720042010-11-23 06:50:14 +0000288else
DRC0ddff3b2013-04-11 05:17:53 +0000289 AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
290 AC_MSG_RESULT(yes)
DRCe3720042010-11-23 06:50:14 +0000291fi
292AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
293
DRC990e28d2011-01-04 21:40:11 +0000294AC_MSG_CHECKING([whether to include arithmetic decoding support])
DRCe3720042010-11-23 06:50:14 +0000295AC_ARG_WITH([arith-dec],
DRC0ddff3b2013-04-11 05:17:53 +0000296 AC_HELP_STRING([--without-arith-dec],
297 [Do not include arithmetic decoding support]))
DRCe3720042010-11-23 06:50:14 +0000298if test "x$with_arith_dec" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000299 AC_MSG_RESULT(no)
300 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
DRCe3720042010-11-23 06:50:14 +0000301else
DRC0ddff3b2013-04-11 05:17:53 +0000302 AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
303 AC_MSG_RESULT(yes)
DRCe3720042010-11-23 06:50:14 +0000304fi
305AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
306
DRC0ddff3b2013-04-11 05:17:53 +0000307AM_CONDITIONAL([WITH_ARITH],
308 [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
DRCe3720042010-11-23 06:50:14 +0000309
DRC211d1e72013-01-13 11:25:20 +0000310# TurboJPEG support
DRC5039d732013-01-21 23:42:12 +0000311AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
DRC211d1e72013-01-13 11:25:20 +0000312AC_ARG_WITH([turbojpeg],
DRC0ddff3b2013-04-11 05:17:53 +0000313 AC_HELP_STRING([--without-turbojpeg],
314 [Do not include the TurboJPEG wrapper library and associated test programs]))
DRC211d1e72013-01-13 11:25:20 +0000315if test "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000316 AC_MSG_RESULT(no)
317 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
DRC211d1e72013-01-13 11:25:20 +0000318else
DRC0ddff3b2013-04-11 05:17:53 +0000319 AC_MSG_RESULT(yes)
DRC211d1e72013-01-13 11:25:20 +0000320fi
321
322# Java support
DRCf2602ce2011-04-01 00:20:33 +0000323AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
324if test "x$JAVAC" = "x"; then
325 JAVAC=javac
326fi
327AC_SUBST(JAVAC)
328AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
329AC_SUBST(JAVACFLAGS)
330AC_ARG_VAR(JAR, [Java archive command (default: jar)])
331if test "x$JAR" = "x"; then
332 JAR=jar
333fi
334AC_SUBST(JAR)
335AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
336if test "x$JAVA" = "x"; then
337 JAVA=java
338fi
339AC_SUBST(JAVA)
DRC0ddff3b2013-04-11 05:17:53 +0000340AC_ARG_VAR(JNI_CFLAGS,
341 [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 +0000342
DRC5039d732013-01-21 23:42:12 +0000343AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
DRCf2602ce2011-04-01 00:20:33 +0000344AC_ARG_WITH([java],
DRC0ddff3b2013-04-11 05:17:53 +0000345 AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
DRC211d1e72013-01-13 11:25:20 +0000346if test "x$with_turbojpeg" = "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000347 with_java=no
DRC211d1e72013-01-13 11:25:20 +0000348fi
DRC1421a262011-02-06 15:35:38 +0000349
DRCf2602ce2011-04-01 00:20:33 +0000350WITH_JAVA=0
351if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000352 AC_MSG_RESULT(yes)
DRC1421a262011-02-06 15:35:38 +0000353
DRC0ddff3b2013-04-11 05:17:53 +0000354 case $host_os in
355 darwin*)
356 DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
357 ;;
358 solaris*)
359 DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
360 ;;
361 linux*)
362 DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
363 ;;
364 esac
365 if test "x$JNI_CFLAGS" = "x"; then
366 JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
367 fi
DRC1421a262011-02-06 15:35:38 +0000368
DRC0ddff3b2013-04-11 05:17:53 +0000369 SAVE_CPPFLAGS=${CPPFLAGS}
370 CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
371 AC_CHECK_HEADERS([jni.h], [DUMMY=1],
372 [AC_MSG_ERROR([Could not find JNI header file])])
373 CPPFLAGS=${SAVE_CPPFLAGS}
374 AC_SUBST(JNI_CFLAGS)
DRC1b0c3b02011-02-06 15:51:27 +0000375
DRC0ddff3b2013-04-11 05:17:53 +0000376 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --with-java"
DRC764e1e22013-04-19 04:25:14 +0000377 JAVA_RPM_CONTENTS_1='%dir %{_datadir}/classes'
378 JAVA_RPM_CONTENTS_2=%{_datadir}/classes/turbojpeg.jar
DRC0ddff3b2013-04-11 05:17:53 +0000379 WITH_JAVA=1
DRCf8e00552011-02-04 11:06:36 +0000380else
DRC0ddff3b2013-04-11 05:17:53 +0000381 AC_MSG_RESULT(no)
DRCf8e00552011-02-04 11:06:36 +0000382fi
DRCf2602ce2011-04-01 00:20:33 +0000383AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
384AC_SUBST(WITH_JAVA)
385AC_SUBST(JAVA_RPM_CONTENTS_1)
386AC_SUBST(JAVA_RPM_CONTENTS_2)
DRCf8e00552011-02-04 11:06:36 +0000387
DRC4346f912011-06-14 22:16:50 +0000388# optionally force using gas-preprocessor.pl for compatibility testing
389AC_ARG_WITH([gas-preprocessor],
DRC0ddff3b2013-04-11 05:17:53 +0000390 AC_HELP_STRING([--with-gas-preprocessor],
391 [Force using gas-preprocessor.pl on ARM.]))
DRC4346f912011-06-14 22:16:50 +0000392if test "x${with_gas_preprocessor}" = "xyes"; then
393 case $host_os in
394 darwin*)
395 CCAS="gas-preprocessor.pl -fix-unreq $CC"
396 ;;
397 *)
398 CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
399 ;;
400 esac
401 AC_SUBST([CCAS])
402fi
403
DRC60cddeb2010-02-12 05:37:07 +0000404# SIMD is optional
405AC_ARG_WITH([simd],
DRC0ddff3b2013-04-11 05:17:53 +0000406 AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
DRC60cddeb2010-02-12 05:37:07 +0000407if test "x${with_simd}" != "xno"; then
DRCf369f172013-09-25 05:24:46 +0000408 require_simd=no
409 if test "x${with_simd}" = "xyes"; then
410 require_simd=yes
411 fi
DRC60cddeb2010-02-12 05:37:07 +0000412 # Check if we're on a supported CPU
413 AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
414 case "$host_cpu" in
DRC49597872010-05-17 20:47:57 +0000415 x86_64 | amd64)
DRC60cddeb2010-02-12 05:37:07 +0000416 AC_MSG_RESULT([yes (x86_64)])
417 AC_PROG_NASM
418 simd_arch=x86_64
DRC0ddff3b2013-04-11 05:17:53 +0000419 ;;
DRC60cddeb2010-02-12 05:37:07 +0000420 i*86 | x86 | ia32)
421 AC_MSG_RESULT([yes (i386)])
422 AC_PROG_NASM
423 simd_arch=i386
DRC0ddff3b2013-04-11 05:17:53 +0000424 ;;
DRC321e0682011-05-03 08:47:43 +0000425 arm*)
426 AC_MSG_RESULT([yes (arm)])
427 AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
428 AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
429 [AC_MSG_RESULT([yes])
430 simd_arch=arm],
431 [AC_MSG_RESULT([no])
DRCf369f172013-09-25 05:24:46 +0000432 with_simd=no])
DRCf57a22d2013-10-26 00:32:23 +0000433 if test "x${with_simd}" = "xno"; then
434 if test "x${require_simd}" = "xyes"; then
435 AC_MSG_ERROR([SIMD support can't be enabled.])
436 else
437 AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
DRC88dee582014-02-06 19:31:23 +0000438 fi
DRCf369f172013-09-25 05:24:46 +0000439 fi
DRC0ddff3b2013-04-11 05:17:53 +0000440 ;;
DRC60cddeb2010-02-12 05:37:07 +0000441 *)
442 AC_MSG_RESULT([no ("$host_cpu")])
DRC83f21442010-06-10 18:52:41 +0000443 with_simd=no;
DRCf57a22d2013-10-26 00:32:23 +0000444 if test "x${require_simd}" = "xyes"; then
DRCf369f172013-09-25 05:24:46 +0000445 AC_MSG_ERROR([SIMD support not available for this CPU.])
446 else
447 AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
448 fi
DRC0ddff3b2013-04-11 05:17:53 +0000449 ;;
DRC60cddeb2010-02-12 05:37:07 +0000450 esac
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000451
DRC60cddeb2010-02-12 05:37:07 +0000452 if test "x${with_simd}" != "xno"; then
453 AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
454 fi
DRC6da61db2013-01-19 01:06:46 +0000455else
456 RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
DRC60cddeb2010-02-12 05:37:07 +0000457fi
DRC411dcf52010-02-12 04:28:29 +0000458
DRC60cddeb2010-02-12 05:37:07 +0000459AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
DRC321e0682011-05-03 08:47:43 +0000460AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
Pierre Ossmanba82ddf2009-06-29 11:20:42 +0000461AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
462AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
DRC321e0682011-05-03 08:47:43 +0000463AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
DRC49597872010-05-17 20:47:57 +0000464AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
DRC211d1e72013-01-13 11:25:20 +0000465AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
Pierre Ossman59a39382009-03-09 13:15:56 +0000466
DRC764e1e22013-04-19 04:25:14 +0000467AC_ARG_VAR(PKGNAME, [distribution package name (default: libjpeg-turbo)])
468if test "x$PKGNAME" = "x"; then
469 PKGNAME=$PACKAGE_NAME
470fi
471AC_SUBST(PKGNAME)
472
DRC079b4342010-02-15 11:32:23 +0000473case "$host_cpu" in
474 x86_64)
475 RPMARCH=x86_64
DRC52a19f22010-02-15 12:06:27 +0000476 DEBARCH=amd64
DRC079b4342010-02-15 11:32:23 +0000477 ;;
478 i*86 | x86 | ia32)
479 RPMARCH=i386
DRC52a19f22010-02-15 12:06:27 +0000480 DEBARCH=i386
DRC079b4342010-02-15 11:32:23 +0000481 ;;
482esac
483
484AC_SUBST(RPMARCH)
DRC6da61db2013-01-19 01:06:46 +0000485AC_SUBST(RPM_CONFIG_ARGS)
DRC52a19f22010-02-15 12:06:27 +0000486AC_SUBST(DEBARCH)
DRC079b4342010-02-15 11:32:23 +0000487AC_SUBST(BUILD)
DRCff6961f2014-04-20 09:17:11 +0000488AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number])
DRC079b4342010-02-15 11:32:23 +0000489
Pierre Ossmanba0ce392009-03-06 15:30:42 +0000490# jconfig.h is the file we use, but we have another before that to
491# fool autoheader. the reason is that we include this header in our
492# API headers, which can screw things up for users of the lib.
493# jconfig.h is a minimal version that allows this package to be built
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000494AC_CONFIG_HEADERS([config.h])
495AC_CONFIG_HEADERS([jconfig.h])
DRCff6961f2014-04-20 09:17:11 +0000496AC_CONFIG_HEADERS([jconfigint.h])
DRC764e1e22013-04-19 04:25:14 +0000497AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
DRC7175e512013-04-23 22:29:00 +0000498AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
DRC764e1e22013-04-19 04:25:14 +0000499AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
DRC7175e512013-04-23 22:29:00 +0000500AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
DRCb94f2de2011-03-22 09:31:25 +0000501AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in])
502AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in])
DRC7175e512013-04-23 22:29:00 +0000503AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
DRC211d1e72013-01-13 11:25:20 +0000504if test "x$with_turbojpeg" != "xno"; then
DRC0ddff3b2013-04-11 05:17:53 +0000505 AC_CONFIG_FILES([tjbenchtest])
DRC211d1e72013-01-13 11:25:20 +0000506fi
507if test "x$with_java" = "xyes"; then
DRC0ddff3b2013-04-11 05:17:53 +0000508 AC_CONFIG_FILES([tjbenchtest.java])
509 AC_CONFIG_FILES([tjexampletest])
DRC211d1e72013-01-13 11:25:20 +0000510fi
DRC8515d3d2010-10-19 06:38:57 +0000511AC_CONFIG_FILES([libjpeg.map])
Pierre Ossman3a65ef42009-03-16 13:34:18 +0000512AC_CONFIG_FILES([Makefile simd/Makefile])
DRCdffd53d2011-04-01 00:37:20 +0000513AC_CONFIG_FILES([java/Makefile])
DRC0bf58f22013-02-06 23:51:08 +0000514AC_CONFIG_FILES([md5/Makefile])
Constantin Kaplinsky0ca44252008-09-28 05:08:48 +0000515AC_OUTPUT