Imported Upstream version 1.4.2
[platform/upstream/libjpeg-turbo.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.56])
5 AC_INIT([libjpeg-turbo], [1.4.2])
6
7 AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
8 AC_PREFIX_DEFAULT(/opt/libjpeg-turbo)
9
10 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
12 # Checks for programs.
13 SAVED_CFLAGS=${CFLAGS}
14 SAVED_CPPFLAGS=${CPPFLAGS}
15 AC_PROG_CPP
16 AC_PROG_CC
17 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
18 AM_PROG_AS
19 AM_PROG_CC_C_O
20 AC_PROG_INSTALL
21 AC_PROG_LIBTOOL
22 AC_PROG_LN_S
23
24 AC_ARG_WITH([build-date], [Use custom build string to enable reproducible builds (default: YYMMDD)],
25   [BUILD="$with_build_date"],
26   [BUILD=`date +%Y%m%d`])
27
28 # 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
31 old_prefix=${prefix}
32 if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
33   prefix=$ac_default_prefix
34 fi
35 DATADIR=`eval echo ${datadir}`
36 DATADIR=`eval echo $DATADIR`
37 if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
38   datadir='${prefix}'
39 fi
40 DATADIR=`eval echo ${datarootdir}`
41 DATADIR=`eval echo $DATADIR`
42 if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
43   datarootdir='${prefix}'
44 fi
45 DOCDIR=`eval echo ${docdir}`
46 DOCDIR=`eval echo $DOCDIR`
47 if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then
48   docdir='${datadir}/doc'
49 fi
50
51 old_exec_prefix=${exec_prefix}
52 if test "x$exec_prefix" = "xNONE"; then
53   exec_prefix=${prefix}
54 fi
55
56 AC_CHECK_SIZEOF(size_t)
57
58 if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
59   LIBDIR=`eval echo ${libdir}`
60   LIBDIR=`eval echo $LIBDIR`
61   if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then
62     case $host_os in
63       darwin*)
64         ;;
65       *)
66         if test "${ac_cv_sizeof_size_t}" = "8"; then
67           libdir='${exec_prefix}/lib64'
68         elif test "${ac_cv_sizeof_size_t}" = "4"; then
69           libdir='${exec_prefix}/lib32'
70         fi
71         ;;
72     esac
73   fi
74 fi
75 exec_prefix=${old_exec_prefix}
76 prefix=${old_prefix}
77
78 # Check whether compiler supports pointers to undefined structures
79 AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
80 AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], ,
81   AC_MSG_RESULT(yes),
82   [AC_MSG_RESULT(no)
83    AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
84      [Compiler does not support pointers to undefined structures.])])
85
86 if test "x${GCC}" = "xyes"; then
87   if test "x${SAVED_CFLAGS}" = "x"; then
88     CFLAGS=-O3
89   fi
90   if test "x${SAVED_CPPFLAGS}" = "x"; then
91     CPPFLAGS=-Wall
92   fi
93 fi
94
95 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
96 if test "x${SUNCC}" = "xyes"; then
97   if test "x${SAVED_CFLAGS}" = "x"; then
98     CFLAGS=-xO5
99   fi
100 fi
101
102 # Checks for libraries.
103
104 # Checks for header files.
105 AC_HEADER_STDC
106 AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h])
107 AC_CHECK_HEADER([sys/types.h],
108   AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include <sys/types.h> to get size_t.]))
109
110 # Checks for typedefs, structures, and compiler characteristics.
111 AC_C_CONST
112 AC_C_CHAR_UNSIGNED
113 AC_C_INLINE
114 AC_TYPE_SIZE_T
115 AC_CHECK_TYPES([unsigned char, unsigned short])
116
117 AC_MSG_CHECKING([if right shift is signed])
118 AC_TRY_RUN(
119   [#include <stdio.h>
120    int is_shifting_signed (long arg) {
121      long res = arg >> 4;
122
123      if (res == -0x7F7E80CL)
124        return 1; /* right shift is signed */
125
126      /* see if unsigned-shift hack will fix it. */
127      /* we can't just test exact value since it depends on width of long... */
128      res |= (~0L) << (32-4);
129      if (res == -0x7F7E80CL)
130        return 0; /* right shift is unsigned */
131
132      printf("Right shift isn't acting as I expect it to.\n");
133      printf("I fear the JPEG software will not work at all.\n\n");
134      return 0; /* try it with unsigned anyway */
135    }
136    int main (void) {
137      exit(is_shifting_signed(-0x7F7E80B1L));
138    }],
139   [AC_MSG_RESULT(no)
140    AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1,
141      [Define if your (broken) compiler shifts signed values as if they were unsigned.])],
142   [AC_MSG_RESULT(yes)],
143   [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
144
145 # Checks for library functions.
146 AC_CHECK_FUNCS([memset memcpy], [],
147   [AC_DEFINE([NEED_BSD_STRINGS], 1,
148      [Define if you have BSD-like bzero and bcopy in <strings.h> rather than memset/memcpy in <string.h>.])])
149
150 AC_MSG_CHECKING([libjpeg API version])
151 AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
152 if test "x$JPEG_LIB_VERSION" = "x"; then
153   AC_ARG_WITH([jpeg7],
154     AC_HELP_STRING([--with-jpeg7],
155       [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
156   AC_ARG_WITH([jpeg8],
157     AC_HELP_STRING([--with-jpeg8],
158       [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
159   if test "x${with_jpeg8}" = "xyes"; then
160     JPEG_LIB_VERSION=80
161   else
162     if test "x${with_jpeg7}" = "xyes"; then
163       JPEG_LIB_VERSION=70
164     else
165       JPEG_LIB_VERSION=62
166     fi
167   fi
168 fi
169 JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
170 AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
171 AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
172 AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
173   [libjpeg API version])
174
175 AC_ARG_VAR(SO_MAJOR_VERSION,
176   [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
177 AC_ARG_VAR(SO_MINOR_VERSION,
178   [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
179 if test "x$SO_MAJOR_VERSION" = "x"; then
180   case "$JPEG_LIB_VERSION" in
181     62)  SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
182     *)   SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
183   esac
184 fi
185 if test "x$SO_MINOR_VERSION" = "x"; then
186   case "$JPEG_LIB_VERSION" in
187     80)  SO_MINOR_VERSION=2 ;;
188     *)   SO_MINOR_VERSION=0 ;;
189   esac
190 fi
191
192 RPM_CONFIG_ARGS=
193
194 # Memory source/destination managers
195 SO_AGE=0
196 MEM_SRCDST_FUNCTIONS=
197 if test "x${with_jpeg8}" != "xyes"; then
198   AC_MSG_CHECKING([whether to include in-memory source/destination managers])
199   AC_ARG_WITH([mem-srcdst],
200     AC_HELP_STRING([--without-mem-srcdst],
201       [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI]))
202   if test "x$with_mem_srcdst" != "xno"; then
203     AC_MSG_RESULT(yes)
204     AC_DEFINE([MEM_SRCDST_SUPPORTED], [1],
205       [Support in-memory source/destination managers])
206     SO_AGE=1
207     MEM_SRCDST_FUNCTIONS="global:  jpeg_mem_dest;  jpeg_mem_src;";
208   else
209     AC_MSG_RESULT(no)
210     RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst"
211   fi
212 fi
213
214 AC_MSG_CHECKING([libjpeg shared library version])
215 AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
216 LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
217 AC_SUBST(LIBTOOL_CURRENT)
218 AC_SUBST(SO_MAJOR_VERSION)
219 AC_SUBST(SO_MINOR_VERSION)
220 AC_SUBST(SO_AGE)
221 AC_SUBST(MEM_SRCDST_FUNCTIONS)
222
223 AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
224
225 VERSION_SCRIPT=yes
226 AC_ARG_ENABLE([ld-version-script],
227   AS_HELP_STRING([--disable-ld-version-script],
228     [Disable linker version script for libjpeg-turbo (default is to use linker version script if the linker supports it)]),
229   [VERSION_SCRIPT=$enableval], [])
230
231 AC_MSG_CHECKING([whether the linker supports version scripts])
232 SAVED_LDFLAGS="$LDFLAGS"
233 LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
234 cat > conftest.map <<EOF
235 VERS_1 {
236   global: *;
237 };
238 EOF
239 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
240   [VERSION_SCRIPT_FLAG=-Wl,--version-script,;
241    AC_MSG_RESULT([yes (GNU style)])],
242   [])
243 if test "x$VERSION_SCRIPT_FLAG" = "x"; then
244   LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
245   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
246     [VERSION_SCRIPT_FLAG=-Wl,-M,;
247      AC_MSG_RESULT([yes (Sun style)])],
248     [])
249 fi
250 if test "x$VERSION_SCRIPT_FLAG" = "x"; then
251   VERSION_SCRIPT=no
252   AC_MSG_RESULT(no)
253 fi
254 LDFLAGS="$SAVED_LDFLAGS"
255
256 AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
257 AC_MSG_RESULT($VERSION_SCRIPT)
258
259 AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
260 AC_SUBST(VERSION_SCRIPT_FLAG)
261
262 # Check for non-broken inline under various spellings
263 AC_MSG_CHECKING(for inline)
264 ljt_cv_inline=""
265 AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; }
266 int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))",
267 AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
268 int bar() { return foo();], ljt_cv_inline="__inline__",
269 AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
270 int bar() { return foo();], ljt_cv_inline="__inline",
271 AC_TRY_COMPILE(, [} inline int foo() { return 0; }
272 int bar() { return foo();], ljt_cv_inline="inline"))))
273 AC_MSG_RESULT($ljt_cv_inline)
274 AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
275
276 # Arithmetic coding support
277 AC_MSG_CHECKING([whether to include arithmetic encoding support])
278 AC_ARG_WITH([arith-enc],
279   AC_HELP_STRING([--without-arith-enc],
280     [Do not include arithmetic encoding support]))
281 if test "x$with_12bit" = "xyes"; then
282   with_arith_enc=no
283 fi
284 if test "x$with_arith_enc" = "xno"; then
285   AC_MSG_RESULT(no)
286   RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
287 else
288   AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
289   AC_MSG_RESULT(yes)
290 fi
291 AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
292
293 AC_MSG_CHECKING([whether to include arithmetic decoding support])
294 AC_ARG_WITH([arith-dec],
295   AC_HELP_STRING([--without-arith-dec],
296     [Do not include arithmetic decoding support]))
297 if test "x$with_12bit" = "xyes"; then
298   with_arith_dec=no
299 fi
300 if test "x$with_arith_dec" = "xno"; then
301   AC_MSG_RESULT(no)
302   RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
303 else
304   AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
305   AC_MSG_RESULT(yes)
306 fi
307 AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
308
309 AM_CONDITIONAL([WITH_ARITH],
310   [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
311
312 # 12-bit component support
313 AC_MSG_CHECKING([whether to use 12-bit samples])
314 AC_ARG_WITH([12bit],
315   AC_HELP_STRING([--with-12bit], [Encode/decode JPEG images with 12-bit samples (implies --without-simd --without-turbojpeg --without-arith-dec --without-arith-enc)]))
316 if test "x$with_12bit" = "xyes"; then
317   AC_DEFINE([BITS_IN_JSAMPLE], [12], [use 8 or 12])
318   AC_MSG_RESULT(yes)
319 else
320   AC_MSG_RESULT(no)
321 fi
322 AM_CONDITIONAL([WITH_12BIT], [test "x$with_12bit" = "xyes"])
323
324 # TurboJPEG support
325 AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
326 AC_ARG_WITH([turbojpeg],
327   AC_HELP_STRING([--without-turbojpeg],
328     [Do not include the TurboJPEG wrapper library and associated test programs]))
329 if test "x$with_12bit" = "xyes"; then
330   with_turbojpeg=no
331 fi
332 if test "x$with_turbojpeg" = "xno"; then
333   AC_MSG_RESULT(no)
334   RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
335 else
336   AC_MSG_RESULT(yes)
337 fi
338
339 # Java support
340 AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
341 if test "x$JAVAC" = "x"; then
342   JAVAC=javac
343 fi
344 AC_SUBST(JAVAC)
345 AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
346 AC_SUBST(JAVACFLAGS)
347 AC_ARG_VAR(JAR, [Java archive command (default: jar)])
348 if test "x$JAR" = "x"; then
349   JAR=jar
350 fi
351 AC_SUBST(JAR)
352 AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
353 if test "x$JAVA" = "x"; then
354   JAVA=java
355 fi
356 AC_SUBST(JAVA)
357 AC_ARG_VAR(JNI_CFLAGS,
358   [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)])
359
360 AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
361 AC_ARG_WITH([java],
362   AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
363 if test "x$with_12bit" = "xyes" -o "x$with_turbojpeg" = "xno"; then
364   with_java=no
365 fi
366
367 WITH_JAVA=0
368 if test "x$with_java" = "xyes"; then
369   AC_MSG_RESULT(yes)
370
371   case $host_os in
372     darwin*)
373       DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
374       ;;
375     solaris*)
376       DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
377       ;;
378     linux*)
379       DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
380       ;;
381   esac
382   if test "x$JNI_CFLAGS" = "x"; then
383     JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
384   fi
385
386   SAVE_CPPFLAGS=${CPPFLAGS}
387   CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
388   AC_CHECK_HEADERS([jni.h], [DUMMY=1],
389     [AC_MSG_ERROR([Could not find JNI header file])])
390   CPPFLAGS=${SAVE_CPPFLAGS}
391   AC_SUBST(JNI_CFLAGS)
392
393   RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --with-java"
394   JAVA_RPM_CONTENTS_1='%dir %{_datadir}/classes'
395   JAVA_RPM_CONTENTS_2=%{_datadir}/classes/turbojpeg.jar
396   WITH_JAVA=1
397 else
398   AC_MSG_RESULT(no)
399 fi
400 AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
401 AC_SUBST(WITH_JAVA)
402 AC_SUBST(JAVA_RPM_CONTENTS_1)
403 AC_SUBST(JAVA_RPM_CONTENTS_2)
404
405 # optionally force using gas-preprocessor.pl for compatibility testing
406 AC_ARG_WITH([gas-preprocessor],
407   AC_HELP_STRING([--with-gas-preprocessor],
408     [Force using gas-preprocessor.pl on ARM.]))
409 if test "x${with_gas_preprocessor}" = "xyes"; then
410   case $host_os in
411     darwin*)
412       CCAS="gas-preprocessor.pl -fix-unreq $CC"
413       ;;
414     *)
415       CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
416       ;;
417   esac
418   AC_SUBST([CCAS])
419 fi
420
421 # SIMD is optional
422 AC_ARG_WITH([simd],
423   AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
424 if test "x$with_12bit" = "xyes"; then
425   with_simd=no
426 fi
427 if test "x${with_simd}" != "xno"; then
428   require_simd=no
429   if test "x${with_simd}" = "xyes"; then
430     require_simd=yes
431   fi
432   # Check if we're on a supported CPU
433   AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
434   case "$host_cpu" in
435     x86_64 | amd64)
436       AC_MSG_RESULT([yes (x86_64)])
437       AC_PROG_NASM
438       simd_arch=x86_64
439       ;;
440     i*86 | x86 | ia32)
441       AC_MSG_RESULT([yes (i386)])
442       AC_PROG_NASM
443       simd_arch=i386
444       ;;
445     arm*)
446       AC_MSG_RESULT([yes (arm)])
447       AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
448       AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
449         [if test "x$ac_use_gas_preprocessor" = "xyes"; then
450            AC_MSG_RESULT([yes (with gas-preprocessor)])
451          else
452            AC_MSG_RESULT([yes])
453          fi
454          simd_arch=arm],
455         [AC_MSG_RESULT([no])
456          with_simd=no])
457       if test "x${with_simd}" = "xno"; then
458         if test "x${require_simd}" = "xyes"; then
459           AC_MSG_ERROR([SIMD support can't be enabled.])
460         else
461           AC_MSG_WARN([SIMD support can't be enabled.  Performance will suffer.])
462         fi
463       fi
464       ;;
465     aarch64*)
466       AC_MSG_RESULT([yes (arm64)])
467       AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
468       AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE(
469         [if test "x$ac_use_gas_preprocessor" = "xyes"; then
470            AC_MSG_RESULT([yes (with gas-preprocessor)])
471          else
472            AC_MSG_RESULT([yes])
473          fi
474          simd_arch=aarch64],
475         [AC_MSG_RESULT([no])
476          with_simd=no])
477       if test "x${with_simd}" = "xno"; then
478         if test "x${require_simd}" = "xyes"; then
479           AC_MSG_ERROR([SIMD support can't be enabled.])
480         else
481           AC_MSG_WARN([SIMD support can't be enabled.  Performance will suffer.])
482         fi
483       fi
484       ;;
485     mips*)
486       AC_MSG_RESULT([yes (mips)])
487       AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
488       AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE(
489         [AC_MSG_RESULT([yes])
490          simd_arch=mips],
491         [AC_MSG_RESULT([no])
492          with_simd=no])
493       if test "x${with_simd}" = "xno"; then
494         if test "x${require_simd}" = "xyes"; then
495           AC_MSG_ERROR([SIMD support can't be enabled.])
496         else
497           AC_MSG_WARN([SIMD support can't be enabled.  Performance will suffer.])
498         fi
499       fi
500       ;;
501     *)
502       AC_MSG_RESULT([no ("$host_cpu")])
503       with_simd=no;
504       if test "x${require_simd}" = "xyes"; then
505         AC_MSG_ERROR([SIMD support not available for this CPU.])
506       else
507         AC_MSG_WARN([SIMD support not available for this CPU.  Performance will suffer.])
508       fi
509       ;;
510   esac
511
512   if test "x${with_simd}" != "xno"; then
513     AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
514   fi
515 else
516   RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
517 fi
518
519 AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
520 AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
521 AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
522 AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
523 AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
524 AM_CONDITIONAL([SIMD_ARM_64], [test "x$simd_arch" = "xaarch64"])
525 AM_CONDITIONAL([SIMD_MIPS], [test "x$simd_arch" = "xmips"])
526 AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
527 AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
528
529 AC_ARG_VAR(PKGNAME, [distribution package name (default: libjpeg-turbo)])
530 if test "x$PKGNAME" = "x"; then
531   PKGNAME=$PACKAGE_NAME
532 fi
533 AC_SUBST(PKGNAME)
534
535 case "$host_cpu" in
536   x86_64)
537     RPMARCH=x86_64
538     DEBARCH=amd64
539     ;;
540   i*86 | x86 | ia32)
541     RPMARCH=i386
542     DEBARCH=i386
543     ;;
544   *)
545     RPMARCH=`uname -m`
546     DEBARCH=$RPMARCH
547     ;;
548 esac
549
550 if test "${docdir}" = ""; then
551   docdir=${datadir}/doc
552   AC_SUBST(docdir)
553 fi
554
555 AC_SUBST(RPMARCH)
556 AC_SUBST(RPM_CONFIG_ARGS)
557 AC_SUBST(DEBARCH)
558 AC_SUBST(BUILD)
559 AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number])
560
561 # NOTE: autoheader automatically modifies the input file of the first
562 # invocation of AC_CONFIG_HEADERS, so we put config.h first to prevent
563 # jconfig.h.in from being clobbered.  config.h is used only internally, whereas
564 # jconfig.h contains macros that are relevant to external programs (macros that
565 # specify which features were built into the library.)
566 AC_CONFIG_HEADERS([config.h])
567 AC_CONFIG_HEADERS([jconfig.h])
568 AC_CONFIG_HEADERS([jconfigint.h])
569 AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
570 AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
571 AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
572 AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
573 AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
574 if test "x$with_turbojpeg" != "xno"; then
575   AC_CONFIG_FILES([tjbenchtest])
576 fi
577 if test "x$with_java" = "xyes"; then
578   AC_CONFIG_FILES([tjbenchtest.java])
579   AC_CONFIG_FILES([tjexampletest])
580 fi
581 AC_CONFIG_FILES([libjpeg.map])
582 AC_CONFIG_FILES([Makefile simd/Makefile])
583 AC_CONFIG_FILES([java/Makefile])
584 AC_CONFIG_FILES([md5/Makefile])
585 AC_OUTPUT