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