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