configure.ac 20 KB

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