Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
DRC | bf0fab9 | 2010-02-12 22:22:01 +0000 | [diff] [blame] | 4 | AC_PREREQ([2.56]) |
DRC | 3367f40 | 2012-07-03 20:00:35 +0000 | [diff] [blame] | 5 | AC_INIT([libjpeg-turbo], [1.2.2]) |
DRC | 079b434 | 2010-02-15 11:32:23 +0000 | [diff] [blame] | 6 | BUILD=`date +%Y%m%d` |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 7 | |
| 8 | AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) |
DRC | 8ff1f25 | 2010-02-15 11:08:57 +0000 | [diff] [blame] | 9 | AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 10 | |
| 11 | # Always build with prototypes |
| 12 | AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 13 | |
| 14 | # Checks for programs. |
DRC | e7b699d | 2010-02-14 07:39:07 +0000 | [diff] [blame] | 15 | SAVED_CFLAGS=${CFLAGS} |
DRC | b4a50ce | 2011-02-26 21:07:50 +0000 | [diff] [blame] | 16 | SAVED_CPPFLAGS=${CPPFLAGS} |
Pierre Ossman | 2ae181c | 2009-03-09 13:21:27 +0000 | [diff] [blame] | 17 | AC_PROG_CPP |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 18 | AC_PROG_CC |
DRC | 321e068 | 2011-05-03 08:47:43 +0000 | [diff] [blame] | 19 | AM_PROG_AS |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 20 | AC_PROG_INSTALL |
| 21 | AC_PROG_LIBTOOL |
| 22 | AC_PROG_LN_S |
| 23 | |
DRC | bdb1288 | 2010-08-21 21:14:17 +0000 | [diff] [blame] | 24 | # Check whether compiler supports pointers to undefined structures |
| 25 | AC_MSG_CHECKING(whether compiler supports pointers to undefined structures) |
| 26 | AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], , |
| 27 | AC_MSG_RESULT(yes), |
| 28 | [AC_MSG_RESULT(no) |
| 29 | AC_DEFINE([INCOMPLETE_TYPES_BROKEN],[1],[Compiler does not support pointers to undefined structures.])]) |
| 30 | |
DRC | e7b699d | 2010-02-14 07:39:07 +0000 | [diff] [blame] | 31 | if test "x${GCC}" = "xyes"; then |
| 32 | if test "x${SAVED_CFLAGS}" = "x"; then |
| 33 | CFLAGS=-O3 |
| 34 | fi |
DRC | b4a50ce | 2011-02-26 21:07:50 +0000 | [diff] [blame] | 35 | if test "x${SAVED_CPPFLAGS}" = "x"; then |
| 36 | CPPFLAGS=-Wall |
| 37 | fi |
DRC | e7b699d | 2010-02-14 07:39:07 +0000 | [diff] [blame] | 38 | fi |
| 39 | |
DRC | 1e2f298 | 2010-02-16 22:35:25 +0000 | [diff] [blame] | 40 | AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) |
| 41 | if test "x${SUNCC}" = "xyes"; then |
| 42 | if test "x${SAVED_CFLAGS}" = "x"; then |
| 43 | CFLAGS=-xO5 |
| 44 | fi |
DRC | 1e2f298 | 2010-02-16 22:35:25 +0000 | [diff] [blame] | 45 | fi |
| 46 | |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 47 | # Checks for libraries. |
| 48 | |
| 49 | # Checks for header files. |
| 50 | AC_HEADER_STDC |
| 51 | AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) |
| 52 | AC_CHECK_HEADER([sys/types.h], AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h])) |
| 53 | |
| 54 | # Checks for typedefs, structures, and compiler characteristics. |
| 55 | AC_C_CONST |
| 56 | AC_C_CHAR_UNSIGNED |
| 57 | AC_C_INLINE |
| 58 | AC_TYPE_SIZE_T |
| 59 | AC_CHECK_TYPES([unsigned char, unsigned short]) |
| 60 | |
| 61 | AC_MSG_CHECKING([if right shift is signed]) |
| 62 | AC_TRY_RUN( |
| 63 | [#include <stdio.h> |
| 64 | int is_shifting_signed (long arg) { |
| 65 | long res = arg >> 4; |
| 66 | |
| 67 | if (res == -0x7F7E80CL) |
| 68 | return 1; /* right shift is signed */ |
| 69 | |
| 70 | /* see if unsigned-shift hack will fix it. */ |
| 71 | /* we can't just test exact value since it depends on width of long... */ |
| 72 | res |= (~0L) << (32-4); |
| 73 | if (res == -0x7F7E80CL) |
| 74 | return 0; /* right shift is unsigned */ |
| 75 | |
| 76 | printf("Right shift isn't acting as I expect it to.\n"); |
| 77 | printf("I fear the JPEG software will not work at all.\n\n"); |
| 78 | return 0; /* try it with unsigned anyway */ |
| 79 | } |
| 80 | int main (void) { |
| 81 | exit(is_shifting_signed(-0x7F7E80B1L)); |
| 82 | }], |
| 83 | [AC_MSG_RESULT(no) |
| 84 | AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])], |
| 85 | [AC_MSG_RESULT(yes)], |
| 86 | [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) |
| 87 | |
| 88 | # test whether global names are unique to at least 15 chars |
| 89 | AC_MSG_CHECKING([for short external names]) |
| 90 | AC_TRY_LINK( |
| 91 | [int possibly_duplicate_function () { return 0; } |
| 92 | int possibly_dupli_function () { return 1; }], [ ], |
| 93 | [AC_MSG_RESULT(ok)], |
| 94 | [AC_MSG_RESULT(short) |
| 95 | AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, [Define if you need short function names])]) |
| 96 | |
| 97 | # Checks for library functions. |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 98 | AC_CHECK_FUNCS([memset memcpy], [], |
| 99 | [AC_DEFINE([NEED_BSD_STRINGS], 1, |
| 100 | [Define if you have BSD-like bzero and bcopy])]) |
| 101 | |
DRC | 1f80a10 | 2010-10-18 00:15:31 +0000 | [diff] [blame] | 102 | AC_MSG_CHECKING([libjpeg API version]) |
| 103 | AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)]) |
| 104 | if test "x$JPEG_LIB_VERSION" = "x"; then |
| 105 | AC_ARG_WITH([jpeg7], |
| 106 | AC_HELP_STRING([--with-jpeg7], [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)])) |
| 107 | AC_ARG_WITH([jpeg8], |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 108 | AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)])) |
DRC | 1f80a10 | 2010-10-18 00:15:31 +0000 | [diff] [blame] | 109 | if test "x${with_jpeg8}" = "xyes"; then |
| 110 | JPEG_LIB_VERSION=80 |
DRC | 36a6eec | 2010-10-08 08:05:44 +0000 | [diff] [blame] | 111 | else |
DRC | 1f80a10 | 2010-10-18 00:15:31 +0000 | [diff] [blame] | 112 | if test "x${with_jpeg7}" = "xyes"; then |
| 113 | JPEG_LIB_VERSION=70 |
| 114 | else |
| 115 | JPEG_LIB_VERSION=62 |
| 116 | fi |
DRC | 36a6eec | 2010-10-08 08:05:44 +0000 | [diff] [blame] | 117 | fi |
| 118 | fi |
DRC | 1f80a10 | 2010-10-18 00:15:31 +0000 | [diff] [blame] | 119 | JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10` |
DRC | 8515d3d | 2010-10-19 06:38:57 +0000 | [diff] [blame] | 120 | AC_SUBST(JPEG_LIB_VERSION_DECIMAL) |
DRC | 1f80a10 | 2010-10-18 00:15:31 +0000 | [diff] [blame] | 121 | AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL]) |
| 122 | AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION], [libjpeg API version]) |
| 123 | |
| 124 | AC_MSG_CHECKING([libjpeg shared library version]) |
| 125 | AC_ARG_VAR(SO_MAJOR_VERSION, [Major version of the libjpeg-turbo shared library (default is determined by the API version)]) |
| 126 | AC_ARG_VAR(SO_MINOR_VERSION, [Minor version of the libjpeg-turbo shared library (default is determined by the API version)]) |
| 127 | if test "x$SO_MAJOR_VERSION" = "x"; then |
| 128 | case "$JPEG_LIB_VERSION" in |
| 129 | 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;; |
| 130 | *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;; |
| 131 | esac |
| 132 | fi |
| 133 | if test "x$SO_MINOR_VERSION" = "x"; then |
| 134 | case "$JPEG_LIB_VERSION" in |
| 135 | 80) SO_MINOR_VERSION=2 ;; |
| 136 | *) SO_MINOR_VERSION=0 ;; |
| 137 | esac |
| 138 | fi |
| 139 | AC_MSG_RESULT([$SO_MAJOR_VERSION:$SO_MINOR_VERSION]) |
| 140 | AC_SUBST(SO_MAJOR_VERSION) |
| 141 | AC_SUBST(SO_MINOR_VERSION) |
DRC | 36a6eec | 2010-10-08 08:05:44 +0000 | [diff] [blame] | 142 | |
DRC | ab64b62 | 2011-12-18 16:29:35 +0000 | [diff] [blame] | 143 | AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version]) |
| 144 | |
DRC | 7a0478e | 2010-11-07 19:12:30 +0000 | [diff] [blame] | 145 | VERSION_SCRIPT=yes |
| 146 | AC_ARG_ENABLE([ld-version-script], |
| 147 | AS_HELP_STRING([--disable-ld-version-script], |
| 148 | [Disable linker version script for libjpeg-turbo (default is to use linker version script if the linker supports it)]), |
| 149 | [VERSION_SCRIPT=$enableval], []) |
DRC | 8515d3d | 2010-10-19 06:38:57 +0000 | [diff] [blame] | 150 | |
| 151 | AC_MSG_CHECKING([whether the linker supports version scripts]) |
| 152 | SAVED_LDFLAGS="$LDFLAGS" |
| 153 | LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map" |
| 154 | cat > conftest.map <<EOF |
| 155 | VERS_1 { |
| 156 | global: *; |
| 157 | }; |
| 158 | EOF |
| 159 | AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), |
| 160 | [VERSION_SCRIPT_FLAG=-Wl,--version-script,; AC_MSG_RESULT([yes (GNU style)])], []) |
| 161 | if test "x$VERSION_SCRIPT_FLAG" = "x"; then |
| 162 | LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map" |
| 163 | AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), |
| 164 | [VERSION_SCRIPT_FLAG=-Wl,-M,; AC_MSG_RESULT([yes (Sun style)])], []) |
| 165 | fi |
| 166 | if test "x$VERSION_SCRIPT_FLAG" = "x"; then |
| 167 | VERSION_SCRIPT=no |
| 168 | AC_MSG_RESULT(no) |
| 169 | fi |
DRC | 8515d3d | 2010-10-19 06:38:57 +0000 | [diff] [blame] | 170 | LDFLAGS="$SAVED_LDFLAGS" |
| 171 | |
DRC | 9fa9559 | 2011-02-25 00:23:44 +0000 | [diff] [blame] | 172 | AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo]) |
DRC | 8515d3d | 2010-10-19 06:38:57 +0000 | [diff] [blame] | 173 | AC_MSG_RESULT($VERSION_SCRIPT) |
| 174 | |
| 175 | AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes") |
DRC | 8515d3d | 2010-10-19 06:38:57 +0000 | [diff] [blame] | 176 | AC_SUBST(VERSION_SCRIPT_FLAG) |
DRC | 8515d3d | 2010-10-19 06:38:57 +0000 | [diff] [blame] | 177 | |
DRC | b4570bb | 2011-09-07 06:31:00 +0000 | [diff] [blame] | 178 | # Check for non-broken inline under various spellings |
| 179 | AC_MSG_CHECKING(for inline) |
| 180 | ljt_cv_inline="" |
| 181 | AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; } |
| 182 | int bar() { return foo();], ljt_cv_inline="__attribute__((always_inline))", |
| 183 | AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; } |
| 184 | int bar() { return foo();], ljt_cv_inline="__inline__", |
| 185 | AC_TRY_COMPILE(, [} __inline int foo() { return 0; } |
| 186 | int bar() { return foo();], ljt_cv_inline="__inline", |
| 187 | AC_TRY_COMPILE(, [} inline int foo() { return 0; } |
| 188 | int bar() { return foo();], ljt_cv_inline="inline")))) |
| 189 | AC_MSG_RESULT($ljt_cv_inline) |
| 190 | AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.]) |
| 191 | |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 192 | AC_MSG_CHECKING([whether to include arithmetic encoding support]) |
DRC | e372004 | 2010-11-23 06:50:14 +0000 | [diff] [blame] | 193 | AC_ARG_WITH([arith-enc], |
| 194 | AC_HELP_STRING([--without-arith-enc], [Omit arithmetic encoding support])) |
| 195 | if test "x$with_arith_enc" = "xno"; then |
| 196 | AC_MSG_RESULT(no) |
| 197 | else |
| 198 | AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding]) |
| 199 | AC_MSG_RESULT(yes) |
| 200 | fi |
| 201 | AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"]) |
| 202 | |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 203 | AC_MSG_CHECKING([whether to include arithmetic decoding support]) |
DRC | e372004 | 2010-11-23 06:50:14 +0000 | [diff] [blame] | 204 | AC_ARG_WITH([arith-dec], |
| 205 | AC_HELP_STRING([--without-arith-dec], [Omit arithmetic decoding support])) |
| 206 | if test "x$with_arith_dec" = "xno"; then |
| 207 | AC_MSG_RESULT(no) |
| 208 | else |
| 209 | AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding]) |
| 210 | AC_MSG_RESULT(yes) |
| 211 | fi |
| 212 | AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"]) |
| 213 | |
| 214 | AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"]) |
| 215 | |
DRC | f2602ce | 2011-04-01 00:20:33 +0000 | [diff] [blame] | 216 | AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)]) |
| 217 | if test "x$JAVAC" = "x"; then |
| 218 | JAVAC=javac |
| 219 | fi |
| 220 | AC_SUBST(JAVAC) |
| 221 | AC_ARG_VAR(JAVACFLAGS, [Java compiler flags]) |
| 222 | AC_SUBST(JAVACFLAGS) |
| 223 | AC_ARG_VAR(JAR, [Java archive command (default: jar)]) |
| 224 | if test "x$JAR" = "x"; then |
| 225 | JAR=jar |
| 226 | fi |
| 227 | AC_SUBST(JAR) |
| 228 | AC_ARG_VAR(JAVA, [Java runtime command (default: java)]) |
| 229 | if test "x$JAVA" = "x"; then |
| 230 | JAVA=java |
| 231 | fi |
| 232 | AC_SUBST(JAVA) |
| 233 | AC_ARG_VAR(JNI_CFLAGS, [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)]) |
DRC | 063ab49 | 2011-02-04 22:16:41 +0000 | [diff] [blame] | 234 | |
DRC | f2602ce | 2011-04-01 00:20:33 +0000 | [diff] [blame] | 235 | AC_MSG_CHECKING([whether to build TurboJPEG/OSS Java wrapper]) |
| 236 | AC_ARG_WITH([java], |
| 237 | AC_HELP_STRING([--with-java],[Build Java wrapper for the TurboJPEG/OSS library])) |
DRC | 1421a26 | 2011-02-06 15:35:38 +0000 | [diff] [blame] | 238 | |
DRC | 1b0c3b0 | 2011-02-06 15:51:27 +0000 | [diff] [blame] | 239 | RPM_CONFIG_ARGS= |
DRC | f2602ce | 2011-04-01 00:20:33 +0000 | [diff] [blame] | 240 | WITH_JAVA=0 |
| 241 | if test "x$with_java" = "xyes"; then |
DRC | f8e0055 | 2011-02-04 11:06:36 +0000 | [diff] [blame] | 242 | AC_MSG_RESULT(yes) |
DRC | 1421a26 | 2011-02-06 15:35:38 +0000 | [diff] [blame] | 243 | |
| 244 | case $host_os in |
| 245 | darwin*) |
DRC | e08c05f | 2011-03-31 08:03:26 +0000 | [diff] [blame] | 246 | DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers |
DRC | 1421a26 | 2011-02-06 15:35:38 +0000 | [diff] [blame] | 247 | ;; |
| 248 | solaris*) |
DRC | e08c05f | 2011-03-31 08:03:26 +0000 | [diff] [blame] | 249 | DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris' |
DRC | 1421a26 | 2011-02-06 15:35:38 +0000 | [diff] [blame] | 250 | ;; |
| 251 | linux*) |
DRC | e08c05f | 2011-03-31 08:03:26 +0000 | [diff] [blame] | 252 | DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux' |
DRC | 1421a26 | 2011-02-06 15:35:38 +0000 | [diff] [blame] | 253 | ;; |
| 254 | esac |
DRC | e08c05f | 2011-03-31 08:03:26 +0000 | [diff] [blame] | 255 | if test "x$JNI_CFLAGS" = "x"; then |
| 256 | JNI_CFLAGS=$DEFAULT_JNI_CFLAGS |
DRC | 1421a26 | 2011-02-06 15:35:38 +0000 | [diff] [blame] | 257 | fi |
| 258 | |
DRC | 063ab49 | 2011-02-04 22:16:41 +0000 | [diff] [blame] | 259 | SAVE_CPPFLAGS=${CPPFLAGS} |
DRC | e08c05f | 2011-03-31 08:03:26 +0000 | [diff] [blame] | 260 | CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}" |
DRC | 063ab49 | 2011-02-04 22:16:41 +0000 | [diff] [blame] | 261 | AC_CHECK_HEADERS([jni.h], [DUMMY=1], |
| 262 | [AC_MSG_ERROR([Could not find JNI header file])]) |
| 263 | CPPFLAGS=${SAVE_CPPFLAGS} |
DRC | e08c05f | 2011-03-31 08:03:26 +0000 | [diff] [blame] | 264 | AC_SUBST(JNI_CFLAGS) |
DRC | 1b0c3b0 | 2011-02-06 15:51:27 +0000 | [diff] [blame] | 265 | |
DRC | f2602ce | 2011-04-01 00:20:33 +0000 | [diff] [blame] | 266 | RPM_CONFIG_ARGS=--with-java |
| 267 | JAVA_RPM_CONTENTS_1='%dir /opt/%{name}/classes' |
| 268 | JAVA_RPM_CONTENTS_2=/opt/%{name}/classes/turbojpeg.jar |
| 269 | WITH_JAVA=1 |
DRC | f8e0055 | 2011-02-04 11:06:36 +0000 | [diff] [blame] | 270 | else |
| 271 | AC_MSG_RESULT(no) |
| 272 | fi |
DRC | f2602ce | 2011-04-01 00:20:33 +0000 | [diff] [blame] | 273 | AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"]) |
| 274 | AC_SUBST(WITH_JAVA) |
| 275 | AC_SUBST(JAVA_RPM_CONTENTS_1) |
| 276 | AC_SUBST(JAVA_RPM_CONTENTS_2) |
DRC | 1b0c3b0 | 2011-02-06 15:51:27 +0000 | [diff] [blame] | 277 | AC_SUBST(RPM_CONFIG_ARGS) |
DRC | f8e0055 | 2011-02-04 11:06:36 +0000 | [diff] [blame] | 278 | |
DRC | 4346f91 | 2011-06-14 22:16:50 +0000 | [diff] [blame] | 279 | # optionally force using gas-preprocessor.pl for compatibility testing |
| 280 | AC_ARG_WITH([gas-preprocessor], |
| 281 | AC_HELP_STRING([--with-gas-preprocessor],[Force using gas-preprocessor.pl on ARM.])) |
| 282 | if test "x${with_gas_preprocessor}" = "xyes"; then |
| 283 | case $host_os in |
| 284 | darwin*) |
| 285 | CCAS="gas-preprocessor.pl -fix-unreq $CC" |
| 286 | ;; |
| 287 | *) |
| 288 | CCAS="gas-preprocessor.pl -no-fix-unreq $CC" |
| 289 | ;; |
| 290 | esac |
| 291 | AC_SUBST([CCAS]) |
| 292 | fi |
| 293 | |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 294 | # SIMD is optional |
| 295 | AC_ARG_WITH([simd], |
DRC | ddcd5a1 | 2011-04-15 00:24:02 +0000 | [diff] [blame] | 296 | AC_HELP_STRING([--without-simd],[Omit SIMD extensions.])) |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 297 | if test "x${with_simd}" != "xno"; then |
| 298 | # Check if we're on a supported CPU |
| 299 | AC_MSG_CHECKING([if we have SIMD optimisations for cpu type]) |
| 300 | case "$host_cpu" in |
DRC | 4959787 | 2010-05-17 20:47:57 +0000 | [diff] [blame] | 301 | x86_64 | amd64) |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 302 | AC_MSG_RESULT([yes (x86_64)]) |
| 303 | AC_PROG_NASM |
| 304 | simd_arch=x86_64 |
| 305 | ;; |
| 306 | i*86 | x86 | ia32) |
| 307 | AC_MSG_RESULT([yes (i386)]) |
| 308 | AC_PROG_NASM |
| 309 | simd_arch=i386 |
| 310 | ;; |
DRC | 321e068 | 2011-05-03 08:47:43 +0000 | [diff] [blame] | 311 | arm*) |
| 312 | AC_MSG_RESULT([yes (arm)]) |
| 313 | AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used]) |
| 314 | AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE( |
| 315 | [AC_MSG_RESULT([yes]) |
| 316 | simd_arch=arm], |
| 317 | [AC_MSG_RESULT([no]) |
| 318 | with_simd=no |
| 319 | AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])]) |
| 320 | ;; |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 321 | *) |
| 322 | AC_MSG_RESULT([no ("$host_cpu")]) |
DRC | 83f2144 | 2010-06-10 18:52:41 +0000 | [diff] [blame] | 323 | AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.]) |
| 324 | with_simd=no; |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 325 | ;; |
| 326 | esac |
Pierre Ossman | ba82ddf | 2009-06-29 11:20:42 +0000 | [diff] [blame] | 327 | |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 328 | if test "x${with_simd}" != "xno"; then |
| 329 | AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) |
| 330 | fi |
| 331 | fi |
DRC | 411dcf5 | 2010-02-12 04:28:29 +0000 | [diff] [blame] | 332 | |
DRC | 60cddeb | 2010-02-12 05:37:07 +0000 | [diff] [blame] | 333 | AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) |
DRC | 321e068 | 2011-05-03 08:47:43 +0000 | [diff] [blame] | 334 | AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"]) |
Pierre Ossman | ba82ddf | 2009-06-29 11:20:42 +0000 | [diff] [blame] | 335 | AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) |
| 336 | AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) |
DRC | 321e068 | 2011-05-03 08:47:43 +0000 | [diff] [blame] | 337 | AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"]) |
DRC | 4959787 | 2010-05-17 20:47:57 +0000 | [diff] [blame] | 338 | AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"]) |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 339 | |
DRC | 079b434 | 2010-02-15 11:32:23 +0000 | [diff] [blame] | 340 | case "$host_cpu" in |
| 341 | x86_64) |
| 342 | RPMARCH=x86_64 |
DRC | 52a19f2 | 2010-02-15 12:06:27 +0000 | [diff] [blame] | 343 | DEBARCH=amd64 |
DRC | 079b434 | 2010-02-15 11:32:23 +0000 | [diff] [blame] | 344 | ;; |
| 345 | i*86 | x86 | ia32) |
| 346 | RPMARCH=i386 |
DRC | 52a19f2 | 2010-02-15 12:06:27 +0000 | [diff] [blame] | 347 | DEBARCH=i386 |
DRC | 079b434 | 2010-02-15 11:32:23 +0000 | [diff] [blame] | 348 | ;; |
| 349 | esac |
| 350 | |
| 351 | AC_SUBST(RPMARCH) |
DRC | 52a19f2 | 2010-02-15 12:06:27 +0000 | [diff] [blame] | 352 | AC_SUBST(DEBARCH) |
DRC | 079b434 | 2010-02-15 11:32:23 +0000 | [diff] [blame] | 353 | AC_SUBST(BUILD) |
DRC | 2cdd2ae | 2010-10-10 06:54:21 +0000 | [diff] [blame] | 354 | AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number]) |
DRC | 079b434 | 2010-02-15 11:32:23 +0000 | [diff] [blame] | 355 | |
Pierre Ossman | ba0ce39 | 2009-03-06 15:30:42 +0000 | [diff] [blame] | 356 | # jconfig.h is the file we use, but we have another before that to |
| 357 | # fool autoheader. the reason is that we include this header in our |
| 358 | # API headers, which can screw things up for users of the lib. |
| 359 | # jconfig.h is a minimal version that allows this package to be built |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 360 | AC_CONFIG_HEADERS([config.h]) |
| 361 | AC_CONFIG_HEADERS([jconfig.h]) |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 362 | AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec:release/libjpeg-turbo.spec.in]) |
| 363 | AC_CONFIG_FILES([pkgscripts/makecygwinpkg:release/makecygwinpkg.in]) |
| 364 | AC_CONFIG_FILES([pkgscripts/makedpkg:release/makedpkg.in]) |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 365 | AC_CONFIG_FILES([pkgscripts/makemacpkg:release/makemacpkg.in]) |
| 366 | AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in]) |
| 367 | AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in]) |
| 368 | AC_CONFIG_FILES([pkgscripts/uninstall:release/uninstall.in]) |
| 369 | AC_CONFIG_FILES([pkgscripts/makesunpkg:release/makesunpkg.in]) |
| 370 | AC_CONFIG_FILES([pkgscripts/pkginfo:release/pkginfo.in]) |
DRC | 9cd4e4b | 2012-01-31 07:56:44 +0000 | [diff] [blame] | 371 | AC_CONFIG_FILES([tjbenchtest]) |
| 372 | AC_CONFIG_FILES([tjexampletest]) |
DRC | 8515d3d | 2010-10-19 06:38:57 +0000 | [diff] [blame] | 373 | AC_CONFIG_FILES([libjpeg.map]) |
Pierre Ossman | 3a65ef4 | 2009-03-16 13:34:18 +0000 | [diff] [blame] | 374 | AC_CONFIG_FILES([Makefile simd/Makefile]) |
DRC | dffd53d | 2011-04-01 00:37:20 +0000 | [diff] [blame] | 375 | AC_CONFIG_FILES([java/Makefile]) |
Constantin Kaplinsky | 0ca4425 | 2008-09-28 05:08:48 +0000 | [diff] [blame] | 376 | AC_OUTPUT |