1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.56])
5AC_INIT([libjpeg-turbo], [1.4.2])
6
7AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
8AC_PREFIX_DEFAULT(/opt/libjpeg-turbo)
9
10m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
12# Checks for programs.
13SAVED_CFLAGS=${CFLAGS}
14SAVED_CPPFLAGS=${CPPFLAGS}
15AC_PROG_CPP
16AC_PROG_CC
17m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
18AM_PROG_AS
19AM_PROG_CC_C_O
20AC_PROG_INSTALL
21AC_PROG_LIBTOOL
22AC_PROG_LN_S
23
24AC_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
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
40DATADIR=`eval echo ${datarootdir}`
41DATADIR=`eval echo $DATADIR`
42if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
43  datarootdir='${prefix}'
44fi
45DOCDIR=`eval echo ${docdir}`
46DOCDIR=`eval echo $DOCDIR`
47if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then
48  docdir='${datadir}/doc'
49fi
50
51old_exec_prefix=${exec_prefix}
52if test "x$exec_prefix" = "xNONE"; then
53  exec_prefix=${prefix}
54fi
55
56AC_CHECK_SIZEOF(size_t)
57
58if 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
74fi
75exec_prefix=${old_exec_prefix}
76prefix=${old_prefix}
77
78# Check whether compiler supports pointers to undefined structures
79AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
80AC_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
86if 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
93fi
94
95AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
96if test "x${SUNCC}" = "xyes"; then
97  if test "x${SAVED_CFLAGS}" = "x"; then
98    CFLAGS=-xO5
99  fi
100fi
101
102# Checks for libraries.
103
104# Checks for header files.
105AC_HEADER_STDC
106AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h])
107AC_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.
111AC_C_CONST
112AC_C_CHAR_UNSIGNED
113AC_C_INLINE
114AC_TYPE_SIZE_T
115AC_CHECK_TYPES([unsigned char, unsigned short])
116
117AC_MSG_CHECKING([if right shift is signed])
118AC_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.
146AC_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
150AC_MSG_CHECKING([libjpeg API version])
151AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
152if 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
168fi
169JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
170AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
171AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
172AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
173  [libjpeg API version])
174
175AC_ARG_VAR(SO_MAJOR_VERSION,
176  [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
177AC_ARG_VAR(SO_MINOR_VERSION,
178  [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
179if 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
184fi
185if 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
190fi
191
192RPM_CONFIG_ARGS=
193
194# Memory source/destination managers
195SO_AGE=0
196MEM_SRCDST_FUNCTIONS=
197if 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
212fi
213
214AC_MSG_CHECKING([libjpeg shared library version])
215AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
216LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
217AC_SUBST(LIBTOOL_CURRENT)
218AC_SUBST(SO_MAJOR_VERSION)
219AC_SUBST(SO_MINOR_VERSION)
220AC_SUBST(SO_AGE)
221AC_SUBST(MEM_SRCDST_FUNCTIONS)
222
223AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
224
225VERSION_SCRIPT=yes
226AC_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
231AC_MSG_CHECKING([whether the linker supports version scripts])
232SAVED_LDFLAGS="$LDFLAGS"
233LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
234cat > conftest.map <<EOF
235VERS_1 {
236  global: *;
237};
238EOF
239AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
240  [VERSION_SCRIPT_FLAG=-Wl,--version-script,;
241   AC_MSG_RESULT([yes (GNU style)])],
242  [])
243if 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    [])
249fi
250if test "x$VERSION_SCRIPT_FLAG" = "x"; then
251  VERSION_SCRIPT=no
252  AC_MSG_RESULT(no)
253fi
254LDFLAGS="$SAVED_LDFLAGS"
255
256AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
257AC_MSG_RESULT($VERSION_SCRIPT)
258
259AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
260AC_SUBST(VERSION_SCRIPT_FLAG)
261
262# Check for non-broken inline under various spellings
263AC_MSG_CHECKING(for inline)
264ljt_cv_inline=""
265AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; }
266int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))",
267AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
268int bar() { return foo();], ljt_cv_inline="__inline__",
269AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
270int bar() { return foo();], ljt_cv_inline="__inline",
271AC_TRY_COMPILE(, [} inline int foo() { return 0; }
272int bar() { return foo();], ljt_cv_inline="inline"))))
273AC_MSG_RESULT($ljt_cv_inline)
274AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
275
276# Arithmetic coding support
277AC_MSG_CHECKING([whether to include arithmetic encoding support])
278AC_ARG_WITH([arith-enc],
279  AC_HELP_STRING([--without-arith-enc],
280    [Do not include arithmetic encoding support]))
281if test "x$with_12bit" = "xyes"; then
282  with_arith_enc=no
283fi
284if test "x$with_arith_enc" = "xno"; then
285  AC_MSG_RESULT(no)
286  RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
287else
288  AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
289  AC_MSG_RESULT(yes)
290fi
291AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
292
293AC_MSG_CHECKING([whether to include arithmetic decoding support])
294AC_ARG_WITH([arith-dec],
295  AC_HELP_STRING([--without-arith-dec],
296    [Do not include arithmetic decoding support]))
297if test "x$with_12bit" = "xyes"; then
298  with_arith_dec=no
299fi
300if test "x$with_arith_dec" = "xno"; then
301  AC_MSG_RESULT(no)
302  RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
303else
304  AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
305  AC_MSG_RESULT(yes)
306fi
307AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
308
309AM_CONDITIONAL([WITH_ARITH],
310  [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
311
312# 12-bit component support
313AC_MSG_CHECKING([whether to use 12-bit samples])
314AC_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)]))
316if test "x$with_12bit" = "xyes"; then
317  AC_DEFINE([BITS_IN_JSAMPLE], [12], [use 8 or 12])
318  AC_MSG_RESULT(yes)
319else
320  AC_MSG_RESULT(no)
321fi
322AM_CONDITIONAL([WITH_12BIT], [test "x$with_12bit" = "xyes"])
323
324# TurboJPEG support
325AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
326AC_ARG_WITH([turbojpeg],
327  AC_HELP_STRING([--without-turbojpeg],
328    [Do not include the TurboJPEG wrapper library and associated test programs]))
329if test "x$with_12bit" = "xyes"; then
330  with_turbojpeg=no
331fi
332if test "x$with_turbojpeg" = "xno"; then
333  AC_MSG_RESULT(no)
334  RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
335else
336  AC_MSG_RESULT(yes)
337fi
338
339# Java support
340AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
341if test "x$JAVAC" = "x"; then
342  JAVAC=javac
343fi
344AC_SUBST(JAVAC)
345AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
346AC_SUBST(JAVACFLAGS)
347AC_ARG_VAR(JAR, [Java archive command (default: jar)])
348if test "x$JAR" = "x"; then
349  JAR=jar
350fi
351AC_SUBST(JAR)
352AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
353if test "x$JAVA" = "x"; then
354  JAVA=java
355fi
356AC_SUBST(JAVA)
357AC_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
360AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
361AC_ARG_WITH([java],
362  AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
363if test "x$with_12bit" = "xyes" -o "x$with_turbojpeg" = "xno"; then
364  with_java=no
365fi
366
367WITH_JAVA=0
368if 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
397else
398  AC_MSG_RESULT(no)
399fi
400AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
401AC_SUBST(WITH_JAVA)
402AC_SUBST(JAVA_RPM_CONTENTS_1)
403AC_SUBST(JAVA_RPM_CONTENTS_2)
404
405# optionally force using gas-preprocessor.pl for compatibility testing
406AC_ARG_WITH([gas-preprocessor],
407  AC_HELP_STRING([--with-gas-preprocessor],
408    [Force using gas-preprocessor.pl on ARM.]))
409if 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])
419fi
420
421# SIMD is optional
422AC_ARG_WITH([simd],
423  AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
424if test "x$with_12bit" = "xyes"; then
425  with_simd=no
426fi
427if 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
515else
516  RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
517fi
518
519AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
520AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
521AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
522AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
523AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
524AM_CONDITIONAL([SIMD_ARM_64], [test "x$simd_arch" = "xaarch64"])
525AM_CONDITIONAL([SIMD_MIPS], [test "x$simd_arch" = "xmips"])
526AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
527AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
528
529AC_ARG_VAR(PKGNAME, [distribution package name (default: libjpeg-turbo)])
530if test "x$PKGNAME" = "x"; then
531  PKGNAME=$PACKAGE_NAME
532fi
533AC_SUBST(PKGNAME)
534
535case "$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    ;;
548esac
549
550if test "${docdir}" = ""; then
551  docdir=${datadir}/doc
552  AC_SUBST(docdir)
553fi
554
555AC_SUBST(RPMARCH)
556AC_SUBST(RPM_CONFIG_ARGS)
557AC_SUBST(DEBARCH)
558AC_SUBST(BUILD)
559AC_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.)
566AC_CONFIG_HEADERS([config.h])
567AC_CONFIG_HEADERS([jconfig.h])
568AC_CONFIG_HEADERS([jconfigint.h])
569AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
570AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
571AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
572AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
573AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
574if test "x$with_turbojpeg" != "xno"; then
575  AC_CONFIG_FILES([tjbenchtest])
576fi
577if test "x$with_java" = "xyes"; then
578  AC_CONFIG_FILES([tjbenchtest.java])
579  AC_CONFIG_FILES([tjexampletest])
580fi
581AC_CONFIG_FILES([libjpeg.map])
582AC_CONFIG_FILES([Makefile simd/Makefile])
583AC_CONFIG_FILES([java/Makefile])
584AC_CONFIG_FILES([md5/Makefile])
585AC_OUTPUT
586