James Zern | ce53efd | 2025-06-30 18:59:38 | [diff] [blame] | 1 | AC_INIT([libwebp], [1.6.0], |
James Zern | caa19e5 | 2024-07-18 23:27:00 | [diff] [blame] | 2 | [https://issues.webmproject.org],, |
James Zern | b6f756e | 2021-11-17 19:16:58 | [diff] [blame] | 3 | [https://developers.google.com/speed/webp]) |
Timothy Gu | 63c2fc0 | 2014-08-06 03:55:04 | [diff] [blame] | 4 | AC_CANONICAL_HOST |
James Zern | 34b02f8 | 2014-07-02 03:02:58 | [diff] [blame] | 5 | AC_PREREQ([2.60]) |
James Zern | a69b893 | 2012-03-29 05:46:12 | [diff] [blame] | 6 | AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) |
James Zern | bc9f5fb | 2013-04-03 01:45:02 | [diff] [blame] | 7 | |
| 8 | dnl === automake >= 1.12 requires this for 'unusual archivers' support. |
| 9 | dnl === it must occur before LT_INIT (AC_PROG_LIBTOOL). |
| 10 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
| 11 | |
James Zern | efa0731 | 2022-04-02 17:50:26 | [diff] [blame] | 12 | dnl === AC_PROG_LIBTOOL is deprecated. |
| 13 | m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL]) |
James Zern | 0104d73 | 2016-10-05 07:03:14 | [diff] [blame] | 14 | AC_PROG_SED |
Pascal Massimino | 1dc4611 | 2011-02-01 06:00:33 | [diff] [blame] | 15 | AM_PROG_CC_C_O |
| 16 | |
James Zern | a69b893 | 2012-03-29 05:46:12 | [diff] [blame] | 17 | dnl === Enable less verbose output when building. |
James Zern | 4e094ac | 2013-02-26 00:11:14 | [diff] [blame] | 18 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
James Zern | a69b893 | 2012-03-29 05:46:12 | [diff] [blame] | 19 | |
James Zern | 380cca4 | 2014-06-28 19:27:17 | [diff] [blame] | 20 | dnl == test endianness |
| 21 | AC_C_BIGENDIAN |
| 22 | |
James Zern | 20aa7a8 | 2013-05-02 01:13:55 | [diff] [blame] | 23 | dnl === SET_IF_UNSET(shell_var, value) |
| 24 | dnl === Set the shell variable 'shell_var' to 'value' if it is unset. |
| 25 | AC_DEFUN([SET_IF_UNSET], [test "${$1+set}" = "set" || $1=$2]) |
| 26 | |
| 27 | AC_ARG_ENABLE([everything], |
| 28 | AS_HELP_STRING([--enable-everything], |
| 29 | [Enable all optional targets. These can still be |
| 30 | disabled with --disable-target]), |
Maryla | 29cc95c | 2022-02-18 10:19:18 | [diff] [blame] | 31 | [SET_IF_UNSET([enable_libsharpyuv], [$enableval]) |
| 32 | SET_IF_UNSET([enable_libwebpdecoder], [$enableval]) |
James Zern | 20aa7a8 | 2013-05-02 01:13:55 | [diff] [blame] | 33 | SET_IF_UNSET([enable_libwebpdemux], [$enableval]) |
James Zern | 5c176d2 | 2015-03-06 07:48:46 | [diff] [blame] | 34 | SET_IF_UNSET([enable_libwebpextras], [$enableval]) |
James Zern | 20aa7a8 | 2013-05-02 01:13:55 | [diff] [blame] | 35 | SET_IF_UNSET([enable_libwebpmux], [$enableval])]) |
| 36 | |
James Zern | 9df23dd | 2021-07-03 22:37:48 | [diff] [blame] | 37 | dnl === Check whether libwebpmux should be built |
| 38 | AC_MSG_CHECKING(whether libwebpmux is to be built) |
| 39 | AC_ARG_ENABLE([libwebpmux], |
James Zern | f70819d | 2021-07-03 22:53:17 | [diff] [blame] | 40 | AS_HELP_STRING([--disable-libwebpmux], |
| 41 | [Disable libwebpmux @<:@default=no@:>@]), |
| 42 | [], [enable_libwebpmux=yes]) |
James Zern | 9df23dd | 2021-07-03 22:37:48 | [diff] [blame] | 43 | AC_MSG_RESULT(${enable_libwebpmux-no}) |
| 44 | AM_CONDITIONAL([BUILD_MUX], [test "$enable_libwebpmux" = "yes"]) |
| 45 | |
| 46 | dnl === Check whether libwebpdemux should be built |
| 47 | AC_MSG_CHECKING(whether libwebpdemux is to be built) |
| 48 | AC_ARG_ENABLE([libwebpdemux], |
| 49 | AS_HELP_STRING([--disable-libwebpdemux], |
| 50 | [Disable libwebpdemux @<:@default=no@:>@]), |
| 51 | [], [enable_libwebpdemux=yes]) |
| 52 | AC_MSG_RESULT(${enable_libwebpdemux-no}) |
| 53 | AM_CONDITIONAL([BUILD_DEMUX], [test "$enable_libwebpdemux" = "yes"]) |
| 54 | |
| 55 | dnl === Check whether decoder library should be built. |
| 56 | AC_MSG_CHECKING(whether decoder library is to be built) |
| 57 | AC_ARG_ENABLE([libwebpdecoder], |
| 58 | AS_HELP_STRING([--enable-libwebpdecoder], |
| 59 | [Build libwebpdecoder @<:@default=no@:>@])) |
| 60 | AC_MSG_RESULT(${enable_libwebpdecoder-no}) |
| 61 | AM_CONDITIONAL([BUILD_LIBWEBPDECODER], [test "$enable_libwebpdecoder" = "yes"]) |
| 62 | |
| 63 | dnl === Check whether libwebpextras should be built |
| 64 | AC_MSG_CHECKING(whether libwebpextras is to be built) |
| 65 | AC_ARG_ENABLE([libwebpextras], |
| 66 | AS_HELP_STRING([--enable-libwebpextras], |
| 67 | [Build libwebpextras @<:@default=no@:>@])) |
| 68 | AC_MSG_RESULT(${enable_libwebpextras-no}) |
| 69 | AM_CONDITIONAL([BUILD_EXTRAS], [test "$enable_libwebpextras" = "yes"]) |
| 70 | |
James Zern | b9d80fa | 2015-12-16 21:15:53 | [diff] [blame] | 71 | dnl === If --enable-asserts is not defined, define NDEBUG |
| 72 | |
| 73 | AC_MSG_CHECKING(whether asserts are enabled) |
| 74 | AC_ARG_ENABLE([asserts], |
| 75 | AS_HELP_STRING([--enable-asserts], |
| 76 | [Enable assert checks])) |
| 77 | if test "x${enable_asserts-no}" = "xno"; then |
| 78 | AM_CPPFLAGS="${AM_CPPFLAGS} -DNDEBUG" |
| 79 | fi |
| 80 | AC_MSG_RESULT(${enable_asserts-no}) |
| 81 | AC_SUBST([AM_CPPFLAGS]) |
| 82 | |
James Zern | bfbcc60 | 2012-04-24 00:57:12 | [diff] [blame] | 83 | AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=DIR], |
| 84 | [Path to the pkgconfig directory @<:@LIBDIR/pkgconfig@:>@]), |
Pascal Massimino | 217ec7f | 2012-04-12 07:13:06 | [diff] [blame] | 85 | [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) |
Pascal Massimino | c5fa726 | 2011-03-26 17:15:44 | [diff] [blame] | 86 | AC_SUBST([pkgconfigdir]) |
| 87 | |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 88 | dnl === TEST_AND_ADD_CFLAGS(var, flag) |
| 89 | dnl === Checks whether $CC supports 'flag' and adds it to 'var' |
| 90 | dnl === on success. |
| 91 | AC_DEFUN([TEST_AND_ADD_CFLAGS], |
| 92 | [SAVED_CFLAGS="$CFLAGS" |
| 93 | CFLAGS="-Werror $2" |
| 94 | AC_MSG_CHECKING([whether $CC supports $2]) |
James Zern | 8ecec68 | 2013-05-07 00:18:27 | [diff] [blame] | 95 | dnl Note AC_LANG_PROGRAM([]) uses an old-style main definition. |
| 96 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])], |
| 97 | [AC_MSG_RESULT([yes])] |
James Zern | a00380d | 2013-06-05 06:45:10 | [diff] [blame] | 98 | dnl Simply append the variable avoiding a |
| 99 | dnl compatibility ifdef for AS_VAR_APPEND as this |
| 100 | dnl variable shouldn't grow all that large. |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 101 | [$1="${$1} $2"], |
James Zern | 8ecec68 | 2013-05-07 00:18:27 | [diff] [blame] | 102 | [AC_MSG_RESULT([no])]) |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 103 | CFLAGS="$SAVED_CFLAGS"]) |
James Zern | 846caff | 2015-12-15 06:55:01 | [diff] [blame] | 104 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-fvisibility=hidden]) |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 105 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wall]) |
James Zern | 93b1275 | 2017-05-12 15:02:06 | [diff] [blame] | 106 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wconstant-conversion]) |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 107 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wdeclaration-after-statement]) |
| 108 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wextra]) |
James Zern | f4b9bc9 | 2024-02-16 02:10:26 | [diff] [blame] | 109 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wextra-semi-stmt]) |
James Zern | 3dc28d7 | 2016-06-16 06:53:48 | [diff] [blame] | 110 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wfloat-conversion]) |
James Zern | d41b8c4 | 2016-05-03 02:30:29 | [diff] [blame] | 111 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wformat -Wformat-nonliteral]) |
| 112 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wformat -Wformat-security]) |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 113 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wmissing-declarations]) |
| 114 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wmissing-prototypes]) |
| 115 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wold-style-definition]) |
James Zern | 7b01298 | 2017-06-15 23:07:07 | [diff] [blame] | 116 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wparentheses-equality]) |
James Zern | 9769bb7 | 2025-08-14 19:03:57 | [diff] [blame] | 117 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wself-assign]) |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 118 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wshadow]) |
James Zern | 71a17e5 | 2015-12-03 07:01:59 | [diff] [blame] | 119 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wshorten-64-to-32]) |
James Zern | 1fb9f3d | 2024-02-22 21:58:19 | [diff] [blame] | 120 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wstrict-prototypes]) |
James Zern | 62486a2 | 2017-07-11 22:37:32 | [diff] [blame] | 121 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wundef]) |
James Zern | 411d367 | 2020-10-27 01:43:55 | [diff] [blame] | 122 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wunreachable-code-aggressive]) |
James Zern | 71a17e5 | 2015-12-03 07:01:59 | [diff] [blame] | 123 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wunreachable-code]) |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 124 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wunused-but-set-variable]) |
| 125 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wunused]) |
| 126 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wvla]) |
James Zern | e2b8cec | 2014-08-12 02:41:05 | [diff] [blame] | 127 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62040 |
| 128 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61622 |
| 129 | AS_IF([test "$GCC" = "yes" ], [ |
| 130 | gcc_version=`$CC -dumpversion` |
| 131 | gcc_wht_bug="" |
| 132 | case "$host_cpu" in |
| 133 | aarch64|arm64) |
| 134 | case "$gcc_version" in |
| 135 | 4.9|4.9.0|4.9.1) gcc_wht_bug=yes ;; |
| 136 | esac |
| 137 | esac |
| 138 | AS_IF([test "$gcc_wht_bug" = "yes"], [ |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 139 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-frename-registers])])]) |
James Zern | 9eeabc0 | 2015-11-26 08:26:24 | [diff] [blame] | 140 | # Use -flax-vector-conversions, if available, when building intrinsics with |
| 141 | # older versions of gcc. The flag appeared in 4.3.x, but if backported, and |
| 142 | # -fno-lax-vector-conversions is set, errors may occur with the intrinsics |
| 143 | # files along with the older system includes, e.g., emmintrin.h. |
| 144 | # Originally observed with cc (GCC) 4.2.1 20070831 patched [FreeBSD] (9.3). |
| 145 | # https://bugs.chromium.org/p/webp/issues/detail?id=274 |
| 146 | AS_IF([test "$GCC" = "yes" ], [ |
| 147 | case "$host_cpu" in |
| 148 | amd64|i?86|x86_64) |
| 149 | AC_COMPILE_IFELSE( |
| 150 | dnl only check for -flax-vector-conversions with older gcc, skip |
| 151 | dnl clang as it reports itself as 4.2.1, but the flag isn't needed. |
| 152 | [AC_LANG_SOURCE([#if !defined(__clang__) && defined(__GNUC__) && \ |
| 153 | ((__GNUC__ << 8) | __GNUC_MINOR__) < 0x403 |
| 154 | #error old gcc |
| 155 | #endif |
| 156 | int main(void) { return 0; } |
| 157 | ])],, |
| 158 | [TEST_AND_ADD_CFLAGS([INTRINSICS_CFLAGS], |
| 159 | [-flax-vector-conversions])]) |
| 160 | ;; |
| 161 | esac]) |
James Zern | 8ecec68 | 2013-05-07 00:18:27 | [diff] [blame] | 162 | AC_SUBST([AM_CFLAGS]) |
| 163 | |
James Zern | 6450c48 | 2014-07-05 04:48:36 | [diff] [blame] | 164 | dnl === Check for machine specific flags |
Vincent Rabaud | f2b3f52 | 2025-03-28 10:44:03 | [diff] [blame] | 165 | AC_ARG_ENABLE([avx2], |
| 166 | AS_HELP_STRING([--disable-avx2], |
| 167 | [Disable detection of AVX2 support |
| 168 | @<:@default=auto@:>@])) |
| 169 | |
| 170 | AS_IF([test "x$enable_avx2" != "xno" -a "x$enable_sse4_1" != "xno" |
| 171 | -a "x$enable_sse2" != "xno"], [ |
| 172 | AVX2_FLAGS="$INTRINSICS_CFLAGS $AVX2_FLAGS" |
| 173 | TEST_AND_ADD_CFLAGS([AVX2_FLAGS], [-mavx2]) |
| 174 | AS_IF([test -n "$AVX2_FLAGS"], [ |
| 175 | SAVED_CFLAGS=$CFLAGS |
| 176 | CFLAGS="$CFLAGS $AVX2_FLAGS" |
| 177 | AC_CHECK_HEADER([immintrin.h], |
| 178 | [AC_DEFINE(WEBP_HAVE_AVX2, [1], |
| 179 | [Set to 1 if AVX2 is supported])], |
| 180 | [AVX2_FLAGS=""]) |
| 181 | CFLAGS=$SAVED_CFLAGS]) |
| 182 | AC_SUBST([AVX2_FLAGS])]) |
| 183 | |
James Zern | 46305ca | 2015-03-26 06:14:17 | [diff] [blame] | 184 | AC_ARG_ENABLE([sse4.1], |
| 185 | AS_HELP_STRING([--disable-sse4.1], |
| 186 | [Disable detection of SSE4.1 support |
| 187 | @<:@default=auto@:>@])) |
| 188 | |
| 189 | AS_IF([test "x$enable_sse4_1" != "xno" -a "x$enable_sse2" != "xno"], [ |
James Zern | 9eeabc0 | 2015-11-26 08:26:24 | [diff] [blame] | 190 | SSE41_FLAGS="$INTRINSICS_CFLAGS $SSE41_FLAGS" |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 191 | TEST_AND_ADD_CFLAGS([SSE41_FLAGS], [-msse4.1]) |
James Zern | 46305ca | 2015-03-26 06:14:17 | [diff] [blame] | 192 | AS_IF([test -n "$SSE41_FLAGS"], [ |
| 193 | SAVED_CFLAGS=$CFLAGS |
| 194 | CFLAGS="$CFLAGS $SSE41_FLAGS" |
| 195 | AC_CHECK_HEADER([smmintrin.h], |
| 196 | [AC_DEFINE(WEBP_HAVE_SSE41, [1], |
| 197 | [Set to 1 if SSE4.1 is supported])], |
| 198 | [SSE41_FLAGS=""]) |
| 199 | CFLAGS=$SAVED_CFLAGS]) |
| 200 | AC_SUBST([SSE41_FLAGS])]) |
| 201 | |
| 202 | AC_ARG_ENABLE([sse2], |
| 203 | AS_HELP_STRING([--disable-sse2], |
| 204 | [Disable detection of SSE2 support |
| 205 | @<:@default=auto@:>@])) |
| 206 | |
| 207 | AS_IF([test "x$enable_sse2" != "xno"], [ |
James Zern | 9eeabc0 | 2015-11-26 08:26:24 | [diff] [blame] | 208 | SSE2_FLAGS="$INTRINSICS_CFLAGS $SSE2_FLAGS" |
Pascal Massimino | 96201e5 | 2015-11-06 06:47:03 | [diff] [blame] | 209 | TEST_AND_ADD_CFLAGS([SSE2_FLAGS], [-msse2]) |
James Zern | 46305ca | 2015-03-26 06:14:17 | [diff] [blame] | 210 | AS_IF([test -n "$SSE2_FLAGS"], [ |
| 211 | SAVED_CFLAGS=$CFLAGS |
| 212 | CFLAGS="$CFLAGS $SSE2_FLAGS" |
| 213 | AC_CHECK_HEADER([emmintrin.h], |
| 214 | [AC_DEFINE(WEBP_HAVE_SSE2, [1], |
| 215 | [Set to 1 if SSE2 is supported])], |
| 216 | [SSE2_FLAGS=""]) |
| 217 | CFLAGS=$SAVED_CFLAGS]) |
| 218 | AC_SUBST([SSE2_FLAGS])]) |
James Zern | 6e61a3a | 2014-06-08 02:44:08 | [diff] [blame] | 219 | |
James Zern | 74fb56f | 2016-04-19 06:31:42 | [diff] [blame] | 220 | AC_ARG_ENABLE([neon], |
| 221 | AS_HELP_STRING([--disable-neon], |
| 222 | [Disable detection of NEON support |
| 223 | @<:@default=auto@:>@])) |
| 224 | |
| 225 | AC_ARG_ENABLE([neon_rtcd], |
| 226 | AS_HELP_STRING([--disable-neon-rtcd], |
| 227 | [Disable runtime detection of NEON support via |
| 228 | /proc/cpuinfo on Linux hosts |
| 229 | @<:@default=auto@:>@])) |
| 230 | # For ARM(7) hosts: |
| 231 | # Both NEON flags unset and NEON support detected = build all modules with NEON |
| 232 | # NEON detected with the use of -mfpu=neon = build only NEON modules with NEON |
| 233 | AS_IF([test "x$enable_neon" != "xno"], [ |
| 234 | case "$host_cpu" in |
| 235 | arm|armv7*) |
James Zern | 0104d73 | 2016-10-05 07:03:14 | [diff] [blame] | 236 | # Test for NEON support without flags before falling back to -mfpu=neon |
| 237 | for flag in '' '-mfpu=neon'; do |
| 238 | LOCAL_NEON_FLAGS="$INTRINSICS_CFLAGS $NEON_FLAGS" |
| 239 | TEST_AND_ADD_CFLAGS([LOCAL_NEON_FLAGS], [$flag]) |
| 240 | SAVED_CFLAGS=$CFLAGS |
| 241 | CFLAGS="$CFLAGS $LOCAL_NEON_FLAGS" |
| 242 | |
| 243 | dnl Note AC_LANG_PROGRAM([]) uses an old-style main definition. |
| 244 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| 245 | #include <arm_neon.h> |
| 246 | int main(void) { |
| 247 | int8x8_t v = vdup_n_s8(0); |
| 248 | (void)v; |
| 249 | return 0; |
| 250 | }])], |
| 251 | [NEON_FLAGS="$(echo $LOCAL_NEON_FLAGS | $SED 's/^ *//')" |
| 252 | AS_IF([test -n "$NEON_FLAGS"], [ |
| 253 | AS_IF([test "${host_os%%-*}" = "linux" -o \ |
| 254 | "x$enable_neon_rtcd" = "xno"], [ |
| 255 | CFLAGS=$SAVED_CFLAGS |
| 256 | AC_DEFINE(WEBP_HAVE_NEON, [1], [Set to 1 if NEON is supported]) |
| 257 | break |
| 258 | ],[ |
| 259 | AC_MSG_WARN(m4_normalize([NEON runtime cpu-detection is |
| 260 | unavailable for ${host_os%%-*}. Force |
| 261 | with CFLAGS=-mfpu=neon or |
| 262 | --disable-neon-rtcd.])) |
| 263 | enable_neon_rtcd=no |
| 264 | NEON_FLAGS="" |
| 265 | ]) |
| 266 | ],[ |
| 267 | CFLAGS=$SAVED_CFLAGS |
| 268 | AC_DEFINE(WEBP_HAVE_NEON, [1], [Set to 1 if NEON is supported]) |
| 269 | break |
| 270 | ])]) |
| 271 | CFLAGS=$SAVED_CFLAGS |
| 272 | done |
| 273 | |
| 274 | AS_IF([test -n "$NEON_FLAGS"], [ |
| 275 | # If NEON is available and rtcd is disabled apply NEON_FLAGS globally. |
| 276 | AS_IF([test "x$enable_neon_rtcd" = "xno"], [ |
| 277 | AM_CFLAGS="$AM_CFLAGS $NEON_FLAGS" |
| 278 | NEON_FLAGS=""], |
| 279 | [AC_DEFINE(WEBP_HAVE_NEON_RTCD, [1], |
| 280 | [Set to 1 if runtime detection of NEON is enabled])])]) |
James Zern | c6d1db4 | 2017-08-02 01:33:50 | [diff] [blame] | 281 | |
| 282 | case "$host_os" in |
| 283 | *android*) AC_CHECK_HEADERS([cpu-features.h]) ;; |
| 284 | esac |
| 285 | ;; |
James Zern | ece18e5 | 2021-07-17 02:27:32 | [diff] [blame] | 286 | aarch64*|arm64*) |
| 287 | AC_DEFINE(WEBP_HAVE_NEON, [1], [Set to 1 if NEON is supported]) |
| 288 | ;; |
James Zern | c6d1db4 | 2017-08-02 01:33:50 | [diff] [blame] | 289 | esac |
| 290 | AC_SUBST([NEON_FLAGS])]) |
James Zern | 74fb56f | 2016-04-19 06:31:42 | [diff] [blame] | 291 | |
James Zern | b8307cc | 2013-04-24 21:40:58 | [diff] [blame] | 292 | dnl === CLEAR_LIBVARS([var_pfx]) |
| 293 | dnl === Clears <var_pfx>_{INCLUDES,LIBS}. |
| 294 | AC_DEFUN([CLEAR_LIBVARS], [$1_INCLUDES=""; $1_LIBS=""]) |
| 295 | |
James Zern | ab22a07 | 2012-07-03 01:50:53 | [diff] [blame] | 296 | dnl === WITHLIB_OPTION([opt_pfx], [outvar_pfx]) |
| 297 | dnl === Defines --with-<opt_pfx>{include,lib}dir options which set |
| 298 | dnl === the variables <outvar_pfx>_{INCLUDES,LIBS}. |
| 299 | AC_DEFUN([WITHLIB_OPTION], |
| 300 | [AC_ARG_WITH([$1includedir], |
| 301 | AS_HELP_STRING([--with-$1includedir=DIR], |
| 302 | [use $2 includes from DIR]), |
| 303 | $2_INCLUDES="-I$withval") |
| 304 | AC_ARG_WITH([$1libdir], |
| 305 | AS_HELP_STRING([--with-$1libdir=DIR], |
| 306 | [use $2 libraries from DIR]), |
| 307 | [$2_LIBS="-L$withval"])]) |
| 308 | |
James Zern | b8307cc | 2013-04-24 21:40:58 | [diff] [blame] | 309 | dnl === LIBCHECK_PROLOGUE([var_pfx]) |
| 310 | dnl === Caches the current values of CPPFLAGS/LIBS in SAVED_* then |
| 311 | dnl === prepends the current values with <var_pfx>_{INCLUDES,LIBS}. |
| 312 | AC_DEFUN([LIBCHECK_PROLOGUE], |
| 313 | [SAVED_CPPFLAGS=$CPPFLAGS |
| 314 | SAVED_LIBS=$LIBS |
| 315 | CPPFLAGS="$$1_INCLUDES $CPPFLAGS" |
| 316 | LIBS="$$1_LIBS $LIBS"]) |
| 317 | |
| 318 | dnl === LIBCHECK_EPILOGUE([var_pfx]) |
| 319 | dnl === Restores the values of CPPFLAGS/LIBS from SAVED_* and exports |
| 320 | dnl === <var_pfx>_{INCLUDES,LIBS} with AC_SUBST. |
| 321 | AC_DEFUN([LIBCHECK_EPILOGUE], |
| 322 | [AC_SUBST($1_LIBS) |
| 323 | AC_SUBST($1_INCLUDES) |
| 324 | CPPFLAGS=$SAVED_CPPFLAGS |
| 325 | LIBS=$SAVED_LIBS]) |
| 326 | |
James Zern | 6781423 | 2014-07-04 23:56:41 | [diff] [blame] | 327 | dnl === Check for gcc builtins |
| 328 | |
| 329 | dnl === CHECK_FOR_BUILTIN([builtin], [param], [define]) |
| 330 | dnl === links a C AC_LANG_PROGRAM, with <builtin>(<param>) |
| 331 | dnl === AC_DEFINE'ing <define> if successful. |
| 332 | AC_DEFUN([CHECK_FOR_BUILTIN], |
| 333 | [AC_LANG_PUSH([C]) |
| 334 | AC_MSG_CHECKING([for $1]) |
James Zern | b74657f | 2016-01-29 07:32:33 | [diff] [blame] | 335 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [(void)$1($2)])], |
James Zern | 6781423 | 2014-07-04 23:56:41 | [diff] [blame] | 336 | [AC_MSG_RESULT([yes]) |
| 337 | AC_DEFINE([$3], [1], |
| 338 | [Set to 1 if $1 is available])], |
| 339 | [AC_MSG_RESULT([no])]), |
| 340 | AC_LANG_POP]) |
| 341 | |
| 342 | dnl AC_CHECK_FUNC doesn't work with builtin's. |
| 343 | CHECK_FOR_BUILTIN([__builtin_bswap16], [1u << 15], [HAVE_BUILTIN_BSWAP16]) |
| 344 | CHECK_FOR_BUILTIN([__builtin_bswap32], [1u << 31], [HAVE_BUILTIN_BSWAP32]) |
| 345 | CHECK_FOR_BUILTIN([__builtin_bswap64], [1ull << 63], [HAVE_BUILTIN_BSWAP64]) |
| 346 | |
James Zern | 1d40a8b | 2012-07-12 22:56:41 | [diff] [blame] | 347 | dnl === Check for pthread support |
| 348 | AC_ARG_ENABLE([threading], |
| 349 | AS_HELP_STRING([--disable-threading], |
| 350 | [Disable detection of thread support]),, |
| 351 | [enable_threading=yes]) |
| 352 | if test "$enable_threading" = "yes"; then |
| 353 | AC_MSG_NOTICE([checking for threading support...]) |
| 354 | AX_PTHREAD([AC_DEFINE([WEBP_USE_THREAD], [1], |
| 355 | [Undefine this to disable thread support.]) |
| 356 | LIBS="$PTHREAD_LIBS $LIBS" |
| 357 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
| 358 | CC="$PTHREAD_CC" |
| 359 | ], |
James Zern | 40b086f | 2014-07-20 21:56:37 | [diff] [blame] | 360 | [AC_CHECK_FUNC([_beginthreadex], |
| 361 | [AC_DEFINE([WEBP_USE_THREAD], [1], |
| 362 | [Undefine this to disable thread |
| 363 | support.])], |
| 364 | [enable_threading=no])]) |
James Zern | 1d40a8b | 2012-07-12 22:56:41 | [diff] [blame] | 365 | fi |
| 366 | AC_MSG_NOTICE([checking if threading is enabled... ${enable_threading-no}]) |
| 367 | |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 368 | dnl === check for OpenGL/GLUT support === |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 369 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 370 | AC_ARG_ENABLE([gl], AS_HELP_STRING([--disable-gl], |
| 371 | [Disable detection of OpenGL support |
| 372 | @<:@default=auto@:>@])) |
| 373 | AS_IF([test "x$enable_gl" != "xno"], [ |
| 374 | CLEAR_LIBVARS([GL]) |
| 375 | WITHLIB_OPTION([gl], [GL]) |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 376 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 377 | LIBCHECK_PROLOGUE([GL]) |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 378 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 379 | glut_cflags="none" |
| 380 | glut_ldflags="none" |
| 381 | case $host_os in |
| 382 | darwin*) |
| 383 | # Special case for OSX builds. Append these to give the user a chance to |
| 384 | # override with --with-gl* |
| 385 | glut_cflags="$glut_cflags|-framework GLUT -framework OpenGL" |
| 386 | glut_ldflags="$glut_ldflags|-framework GLUT -framework OpenGL" |
James Zern | b672bdf | 2018-03-31 07:24:53 | [diff] [blame] | 387 | # quiet deprecation warnings for glut |
| 388 | TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wno-deprecated-declarations]) |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 389 | ;; |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 390 | esac |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 391 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 392 | GLUT_SAVED_CPPFLAGS="$CPPFLAGS" |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 393 | SAVED_IFS="$IFS" |
| 394 | IFS="|" |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 395 | for flag in $glut_cflags; do |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 396 | # restore IFS immediately as the autoconf macros may need the default. |
| 397 | IFS="$SAVED_IFS" |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 398 | unset ac_cv_header_GL_glut_h |
| 399 | unset ac_cv_header_OpenGL_glut_h |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 400 | |
| 401 | case $flag in |
| 402 | none) ;; |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 403 | *) CPPFLAGS="$flag $CPPFLAGS";; |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 404 | esac |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 405 | AC_CHECK_HEADERS([GL/glut.h GLUT/glut.h OpenGL/glut.h], |
| 406 | [glut_headers=yes; |
| 407 | test "$flag" = "none" || GL_INCLUDES="$CPPFLAGS"; |
| 408 | break]) |
| 409 | CPPFLAGS="$GLUT_SAVED_CPPFLAGS" |
| 410 | test "$glut_headers" = "yes" && break |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 411 | done |
| 412 | IFS="$SAVED_IFS" |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 413 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 414 | if test "$glut_headers" = "yes"; then |
| 415 | AC_LANG_PUSH([C]) |
| 416 | GLUT_SAVED_LDFLAGS="$LDFLAGS" |
| 417 | SAVED_IFS="$IFS" |
| 418 | IFS="|" |
| 419 | for flag in $glut_ldflags; do |
| 420 | # restore IFS immediately as the autoconf macros may need the default. |
| 421 | IFS="$SAVED_IFS" |
| 422 | unset ac_cv_search_glBegin |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 423 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 424 | case $flag in |
| 425 | none) ;; |
| 426 | *) LDFLAGS="$flag $LDFLAGS";; |
| 427 | esac |
| 428 | |
| 429 | # find libGL |
| 430 | GL_SAVED_LIBS="$LIBS" |
James Zern | 10f4257 | 2014-06-28 19:10:31 | [diff] [blame] | 431 | AC_SEARCH_LIBS([glBegin], [GL OpenGL opengl32]) |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 432 | LIBS="$GL_SAVED_LIBS" |
| 433 | |
| 434 | # A direct link to libGL may not be necessary on e.g., linux. |
| 435 | GLUT_SAVED_LIBS="$LIBS" |
| 436 | for lib in "" "-lglut" "-lglut $ac_cv_search_glBegin"; do |
| 437 | LIBS="$lib" |
| 438 | AC_LINK_IFELSE( |
| 439 | [AC_LANG_PROGRAM([ |
| 440 | #ifdef __cplusplus |
| 441 | # define EXTERN_C extern "C" |
| 442 | #else |
| 443 | # define EXTERN_C |
| 444 | #endif |
| 445 | EXTERN_C char glOrtho(); |
| 446 | EXTERN_C char glutMainLoop(); |
| 447 | ],[ |
| 448 | glOrtho(); |
| 449 | glutMainLoop(); |
| 450 | ]) |
| 451 | ], |
| 452 | AC_DEFINE(WEBP_HAVE_GL, [1], |
| 453 | [Set to 1 if OpenGL is supported]) |
| 454 | [glut_support=yes], [] |
| 455 | ) |
| 456 | if test "$glut_support" = "yes"; then |
| 457 | GL_LIBS="$LDFLAGS $lib" |
| 458 | break |
| 459 | fi |
| 460 | done |
| 461 | LIBS="$GLUT_SAVED_LIBS" |
| 462 | LDFLAGS="$GLUT_SAVED_LDFLAGS" |
| 463 | test "$glut_support" = "yes" && break |
| 464 | done |
| 465 | IFS="$SAVED_IFS" |
| 466 | AC_LANG_POP |
| 467 | fi |
| 468 | |
| 469 | LIBCHECK_EPILOGUE([GL]) |
| 470 | |
| 471 | if test "$glut_support" = "yes" -a "$enable_libwebpdemux" = "yes"; then |
| 472 | build_vwebp=yes |
James Zern | dc7e2b4 | 2021-07-03 22:51:23 | [diff] [blame] | 473 | else |
| 474 | AC_MSG_NOTICE( |
| 475 | m4_normalize([Not building vwebp. |
| 476 | OpenGL libraries and --enable-libwebpdemux are required.])) |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 477 | fi |
| 478 | ]) |
James Zern | e676b04 | 2013-05-01 21:47:56 | [diff] [blame] | 479 | AM_CONDITIONAL([BUILD_VWEBP], [test "$build_vwebp" = "yes"]) |
| 480 | |
Pascal Massimino | 6524fcd | 2017-01-30 12:33:35 | [diff] [blame] | 481 | dnl === check for SDL support === |
| 482 | |
| 483 | AC_ARG_ENABLE([sdl], |
| 484 | AS_HELP_STRING([--disable-sdl], |
| 485 | [Disable detection of SDL support |
| 486 | @<:@default=auto@:>@])) |
| 487 | AS_IF([test "x$enable_sdl" != "xno"], [ |
| 488 | CLEAR_LIBVARS([SDL]) |
Vincent Rabaud | 24d7f9c | 2023-09-28 08:18:23 | [diff] [blame] | 489 | AC_PATH_PROGS([LIBSDL_CONFIG], [sdl2-config]) |
James Zern | daa9fca | 2018-03-31 06:18:55 | [diff] [blame] | 490 | if test -n "$LIBSDL_CONFIG"; then |
| 491 | SDL_INCLUDES=`$LIBSDL_CONFIG --cflags` |
| 492 | SDL_LIBS="`$LIBSDL_CONFIG --libs`" |
| 493 | fi |
| 494 | |
Pascal Massimino | 6524fcd | 2017-01-30 12:33:35 | [diff] [blame] | 495 | WITHLIB_OPTION([sdl], [SDL]) |
| 496 | |
James Zern | 0265ced | 2017-07-11 22:38:18 | [diff] [blame] | 497 | sdl_header="no" |
Pascal Massimino | 6524fcd | 2017-01-30 12:33:35 | [diff] [blame] | 498 | LIBCHECK_PROLOGUE([SDL]) |
Vincent Rabaud | 24d7f9c | 2023-09-28 08:18:23 | [diff] [blame] | 499 | AC_CHECK_HEADER([SDL2/SDL.h], [sdl_header="SDL2/SDL.h"], |
| 500 | [AC_MSG_WARN(SDL2 library not available - no SDL.h)]) |
James Zern | 0265ced | 2017-07-11 22:38:18 | [diff] [blame] | 501 | if test x"$sdl_header" != "xno"; then |
James Zern | daa9fca | 2018-03-31 06:18:55 | [diff] [blame] | 502 | AC_LANG_PUSH(C) |
| 503 | SDL_SAVED_LIBS="$LIBS" |
Vincent Rabaud | 24d7f9c | 2023-09-28 08:18:23 | [diff] [blame] | 504 | for lib in "" "-lSDL2" "-lSDL2main -lSDL2"; do |
James Zern | daa9fca | 2018-03-31 06:18:55 | [diff] [blame] | 505 | LIBS="$SDL_SAVED_LIBS $lib" |
| 506 | # Perform a full link to ensure SDL_main is resolved if needed. |
| 507 | AC_LINK_IFELSE( |
| 508 | [AC_LANG_SOURCE([ |
| 509 | #include <$sdl_header> |
| 510 | int main(int argc, char** argv) { |
| 511 | SDL_Init(0); |
| 512 | return 0; |
| 513 | }])], |
| 514 | [SDL_LIBS="$LDFLAGS $LIBS" |
| 515 | SDL_INCLUDES="$SDL_INCLUDES -DWEBP_HAVE_SDL" |
| 516 | AC_DEFINE(WEBP_HAVE_SDL, [1], |
| 517 | [Set to 1 if SDL library is installed]) |
| 518 | sdl_support=yes] |
| 519 | ) |
| 520 | if test x"$sdl_support" = "xyes"; then |
| 521 | break |
| 522 | fi |
| 523 | done |
| 524 | # LIBS is restored by LIBCHECK_EPILOGUE |
| 525 | AC_LANG_POP |
James Zern | 0265ced | 2017-07-11 22:38:18 | [diff] [blame] | 526 | if test x"$sdl_header" = "xSDL.h"; then |
Pascal Massimino | 6524fcd | 2017-01-30 12:33:35 | [diff] [blame] | 527 | SDL_INCLUDES="$SDL_INCLUDES -DWEBP_HAVE_JUST_SDL_H" |
| 528 | fi |
| 529 | fi |
| 530 | LIBCHECK_EPILOGUE([SDL]) |
| 531 | |
James Zern | daa9fca | 2018-03-31 06:18:55 | [diff] [blame] | 532 | if test x"$sdl_support" = "xyes"; then |
Pascal Massimino | 6524fcd | 2017-01-30 12:33:35 | [diff] [blame] | 533 | build_vwebp_sdl=yes |
James Zern | daa9fca | 2018-03-31 06:18:55 | [diff] [blame] | 534 | else |
James Zern | dc7e2b4 | 2021-07-03 22:51:23 | [diff] [blame] | 535 | AC_MSG_NOTICE([Not building vwebp-sdl. SDL library is required.]) |
Pascal Massimino | 6524fcd | 2017-01-30 12:33:35 | [diff] [blame] | 536 | fi |
| 537 | ]) |
| 538 | |
| 539 | AM_CONDITIONAL([BUILD_VWEBP_SDL], [test "$build_vwebp_sdl" = "yes"]) |
| 540 | |
Pascal Massimino | 1dc4611 | 2011-02-01 06:00:33 | [diff] [blame] | 541 | dnl === check for PNG support === |
| 542 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 543 | AC_ARG_ENABLE([png], AS_HELP_STRING([--disable-png], |
| 544 | [Disable detection of PNG format support |
| 545 | @<:@default=auto@:>@])) |
| 546 | AS_IF([test "x$enable_png" != "xno"], [ |
| 547 | CLEAR_LIBVARS([PNG]) |
James Zern | be70b86 | 2014-09-10 05:55:29 | [diff] [blame] | 548 | AC_PATH_PROGS([LIBPNG_CONFIG], |
| 549 | [libpng-config libpng16-config libpng15-config libpng14-config \ |
| 550 | libpng12-config]) |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 551 | if test -n "$LIBPNG_CONFIG"; then |
| 552 | PNG_INCLUDES=`$LIBPNG_CONFIG --cflags` |
James Zern | be70b86 | 2014-09-10 05:55:29 | [diff] [blame] | 553 | PNG_LIBS="`$LIBPNG_CONFIG --ldflags`" |
Pascal Massimino | 1dc4611 | 2011-02-01 06:00:33 | [diff] [blame] | 554 | fi |
Pascal Massimino | 1dc4611 | 2011-02-01 06:00:33 | [diff] [blame] | 555 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 556 | WITHLIB_OPTION([png], [PNG]) |
Pascal Massimino | 1dc4611 | 2011-02-01 06:00:33 | [diff] [blame] | 557 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 558 | LIBCHECK_PROLOGUE([PNG]) |
| 559 | AC_CHECK_HEADER(png.h, |
| 560 | AC_SEARCH_LIBS(png_get_libpng_ver, [png], |
| 561 | [test "$ac_cv_search_png_get_libpng_ver" = "none required" \ |
| 562 | || PNG_LIBS="$PNG_LIBS $ac_cv_search_png_get_libpng_ver" |
| 563 | PNG_INCLUDES="$PNG_INCLUDES -DWEBP_HAVE_PNG" |
| 564 | AC_DEFINE(WEBP_HAVE_PNG, [1], |
| 565 | [Set to 1 if PNG library is installed]) |
| 566 | png_support=yes |
| 567 | ], |
| 568 | [AC_MSG_WARN(Optional png library not found) |
| 569 | PNG_LIBS="" |
| 570 | PNG_INCLUDES="" |
| 571 | ], |
| 572 | [$MATH_LIBS]), |
| 573 | [AC_MSG_WARN(png library not available - no png.h) |
| 574 | PNG_LIBS="" |
| 575 | PNG_INCLUDES="" |
| 576 | ], |
| 577 | ) |
| 578 | LIBCHECK_EPILOGUE([PNG]) |
| 579 | ]) |
Pascal Massimino | a31f843 | 2011-08-02 00:05:57 | [diff] [blame] | 580 | |
Pascal Massimino | f61d14a | 2011-02-19 07:33:46 | [diff] [blame] | 581 | dnl === check for JPEG support === |
| 582 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 583 | AC_ARG_ENABLE([jpeg], |
| 584 | AS_HELP_STRING([--disable-jpeg], |
| 585 | [Disable detection of JPEG format support |
| 586 | @<:@default=auto@:>@])) |
| 587 | AS_IF([test "x$enable_jpeg" != "xno"], [ |
| 588 | CLEAR_LIBVARS([JPEG]) |
| 589 | WITHLIB_OPTION([jpeg], [JPEG]) |
Pascal Massimino | f61d14a | 2011-02-19 07:33:46 | [diff] [blame] | 590 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 591 | LIBCHECK_PROLOGUE([JPEG]) |
| 592 | AC_CHECK_HEADER(jpeglib.h, |
| 593 | AC_CHECK_LIB(jpeg, jpeg_set_defaults, |
| 594 | [JPEG_LIBS="$JPEG_LIBS -ljpeg" |
| 595 | JPEG_INCLUDES="$JPEG_INCLUDES -DWEBP_HAVE_JPEG" |
| 596 | AC_DEFINE(WEBP_HAVE_JPEG, [1], |
| 597 | [Set to 1 if JPEG library is installed]) |
| 598 | jpeg_support=yes |
| 599 | ], |
| 600 | AC_MSG_WARN(Optional jpeg library not found), |
| 601 | [$MATH_LIBS]), |
| 602 | AC_MSG_WARN(jpeg library not available - no jpeglib.h) |
| 603 | ) |
| 604 | LIBCHECK_EPILOGUE([JPEG]) |
| 605 | ]) |
Pascal Massimino | a31f843 | 2011-08-02 00:05:57 | [diff] [blame] | 606 | |
James Zern | c17699b | 2012-07-03 01:01:49 | [diff] [blame] | 607 | dnl === check for TIFF support === |
| 608 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 609 | AC_ARG_ENABLE([tiff], |
| 610 | AS_HELP_STRING([--disable-tiff], |
| 611 | [Disable detection of TIFF format support |
| 612 | @<:@default=auto@:>@])) |
| 613 | AS_IF([test "x$enable_tiff" != "xno"], [ |
| 614 | CLEAR_LIBVARS([TIFF]) |
| 615 | WITHLIB_OPTION([tiff], [TIFF]) |
James Zern | c17699b | 2012-07-03 01:01:49 | [diff] [blame] | 616 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 617 | LIBCHECK_PROLOGUE([TIFF]) |
| 618 | AC_CHECK_HEADER(tiffio.h, |
| 619 | AC_CHECK_LIB(tiff, TIFFGetVersion, |
| 620 | [TIFF_LIBS="$TIFF_LIBS -ltiff" |
| 621 | TIFF_INCLUDES="$TIFF_INCLUDES -DWEBP_HAVE_TIFF" |
| 622 | AC_DEFINE(WEBP_HAVE_TIFF, [1], |
| 623 | [Set to 1 if TIFF library is installed]) |
| 624 | tiff_support=yes |
| 625 | ], |
| 626 | AC_MSG_WARN(Optional tiff library not found), |
| 627 | [$MATH_LIBS]), |
| 628 | AC_MSG_WARN(tiff library not available - no tiffio.h) |
| 629 | ) |
| 630 | LIBCHECK_EPILOGUE([TIFF]) |
| 631 | ]) |
James Zern | c17699b | 2012-07-03 01:01:49 | [diff] [blame] | 632 | |
Urvang Joshi | c40efca | 2012-11-15 19:04:12 | [diff] [blame] | 633 | dnl === check for GIF support === |
| 634 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 635 | AC_ARG_ENABLE([gif], AS_HELP_STRING([--disable-gif], |
| 636 | [Disable detection of GIF format support |
| 637 | @<:@default=auto@:>@])) |
| 638 | AS_IF([test "x$enable_gif" != "xno"], [ |
| 639 | CLEAR_LIBVARS([GIF]) |
| 640 | WITHLIB_OPTION([gif], [GIF]) |
Urvang Joshi | c40efca | 2012-11-15 19:04:12 | [diff] [blame] | 641 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 642 | LIBCHECK_PROLOGUE([GIF]) |
| 643 | AC_CHECK_HEADER(gif_lib.h, |
| 644 | AC_CHECK_LIB([gif], [DGifOpenFileHandle], |
| 645 | [GIF_LIBS="$GIF_LIBS -lgif" |
| 646 | AC_DEFINE(WEBP_HAVE_GIF, [1], |
| 647 | [Set to 1 if GIF library is installed]) |
| 648 | gif_support=yes |
| 649 | ], |
| 650 | AC_MSG_WARN(Optional gif library not found), |
| 651 | [$MATH_LIBS]), |
| 652 | AC_MSG_WARN(gif library not available - no gif_lib.h) |
| 653 | ) |
| 654 | LIBCHECK_EPILOGUE([GIF]) |
Urvang Joshi | c40efca | 2012-11-15 19:04:12 | [diff] [blame] | 655 | |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 656 | if test "$gif_support" = "yes" -a \ |
Urvang Joshi | acd7b5a | 2015-05-01 23:11:49 | [diff] [blame] | 657 | "$enable_libwebpdemux" = "yes"; then |
Pascal Massimino | 501ef6e | 2017-08-28 13:56:57 | [diff] [blame] | 658 | build_anim_diff=yes |
James Zern | dc7e2b4 | 2021-07-03 22:51:23 | [diff] [blame] | 659 | else |
| 660 | AC_MSG_NOTICE( |
| 661 | [Not building anim_diff. libgif and --enable-libwebpdemux are required.]) |
Urvang Joshi | acd7b5a | 2015-05-01 23:11:49 | [diff] [blame] | 662 | fi |
| 663 | |
| 664 | if test "$gif_support" = "yes" -a \ |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 665 | "$enable_libwebpmux" = "yes"; then |
| 666 | build_gif2webp=yes |
James Zern | dc7e2b4 | 2021-07-03 22:51:23 | [diff] [blame] | 667 | else |
| 668 | AC_MSG_NOTICE( |
| 669 | [Not building gif2webp. libgif and --enable-libwebpmux are required.]) |
Paweł Hajdan, Jr | 73a304e | 2014-01-21 19:33:48 | [diff] [blame] | 670 | fi |
| 671 | ]) |
Pascal Massimino | 501ef6e | 2017-08-28 13:56:57 | [diff] [blame] | 672 | AM_CONDITIONAL([BUILD_ANIMDIFF], [test "${build_anim_diff}" = "yes"]) |
James Zern | bd56a01 | 2012-11-17 02:59:46 | [diff] [blame] | 673 | AM_CONDITIONAL([BUILD_GIF2WEBP], [test "${build_gif2webp}" = "yes"]) |
Urvang Joshi | c40efca | 2012-11-15 19:04:12 | [diff] [blame] | 674 | |
Pascal Massimino | 641cedc | 2017-03-02 16:45:42 | [diff] [blame] | 675 | if test "$enable_libwebpdemux" = "yes" -a "$enable_libwebpmux" = "yes"; then |
Pascal Massimino | 03f4095 | 2016-12-02 10:44:17 | [diff] [blame] | 676 | build_img2webp=yes |
James Zern | dc7e2b4 | 2021-07-03 22:51:23 | [diff] [blame] | 677 | else |
| 678 | AC_MSG_NOTICE( |
| 679 | m4_normalize([Not building img2webp. |
| 680 | --enable-libwebpdemux & --enable-libwebpmux are required.])) |
Pascal Massimino | 03f4095 | 2016-12-02 10:44:17 | [diff] [blame] | 681 | fi |
| 682 | AM_CONDITIONAL([BUILD_IMG2WEBP], [test "${build_img2webp}" = "yes"]) |
| 683 | |
Pascal Massimino | 274daf5 | 2017-03-14 09:00:43 | [diff] [blame] | 684 | if test "$enable_libwebpmux" = "yes"; then |
| 685 | build_webpinfo=yes |
James Zern | dc7e2b4 | 2021-07-03 22:51:23 | [diff] [blame] | 686 | else |
| 687 | AC_MSG_NOTICE([Not building webpinfo. --enable-libwebpdemux is required.]) |
Pascal Massimino | 274daf5 | 2017-03-14 09:00:43 | [diff] [blame] | 688 | fi |
| 689 | AM_CONDITIONAL([BUILD_WEBPINFO], [test "${build_webpinfo}" = "yes"]) |
| 690 | |
James Zern | 31f9dc6 | 2011-06-07 00:56:50 | [diff] [blame] | 691 | dnl === check for WIC support === |
| 692 | |
James Zern | a01e04f | 2013-12-07 19:56:34 | [diff] [blame] | 693 | AC_ARG_ENABLE([wic], |
| 694 | AS_HELP_STRING([--disable-wic], |
| 695 | [Disable Windows Imaging Component (WIC) detection. |
| 696 | @<:@default=auto@:>@]),, |
| 697 | [enable_wic=yes]) |
| 698 | |
Timothy Gu | 63c2fc0 | 2014-08-06 03:55:04 | [diff] [blame] | 699 | case $host_os in |
| 700 | mingw*) |
| 701 | if test "$enable_wic" = "yes"; then |
James Zern | 31f9dc6 | 2011-06-07 00:56:50 | [diff] [blame] | 702 | AC_CHECK_HEADERS([wincodec.h shlwapi.h windows.h]) |
| 703 | if test "$ac_cv_header_wincodec_h" = "yes"; then |
| 704 | AC_MSG_CHECKING(for Windows Imaging Component support) |
Pascal Massimino | a31f843 | 2011-08-02 00:05:57 | [diff] [blame] | 705 | SAVED_LIBS=$LIBS |
James Zern | 31f9dc6 | 2011-06-07 00:56:50 | [diff] [blame] | 706 | LIBS="-lshlwapi -lole32 $LIBS" |
| 707 | # match include structure from [cd]webp.c |
| 708 | wic_headers=" |
| 709 | #define INITGUID |
| 710 | #define CINTERFACE |
| 711 | #define COBJMACROS |
| 712 | #define _WIN32_IE 0x500 |
| 713 | |
| 714 | #include <shlwapi.h> |
| 715 | #include <windows.h> |
| 716 | #include <wincodec.h> |
| 717 | " |
| 718 | # test for functions from each lib and the GUID is created properly |
| 719 | wic_main=" |
| 720 | int main(void) { |
| 721 | CLSID_WICImagingFactory; |
| 722 | CoInitialize(NULL); |
| 723 | SHCreateStreamOnFile(NULL, 0, NULL); |
| 724 | return 0; |
| 725 | } |
| 726 | " |
| 727 | AC_LANG_PUSH(C) |
| 728 | AC_LINK_IFELSE( |
| 729 | [AC_LANG_SOURCE([ |
| 730 | $wic_headers |
| 731 | $wic_main])], |
| 732 | [wic_support=yes], |
| 733 | [wic_support=no] |
| 734 | ) |
| 735 | AC_LANG_POP |
| 736 | |
Pascal Massimino | a31f843 | 2011-08-02 00:05:57 | [diff] [blame] | 737 | test "$wic_support" = "yes" || LIBS=$SAVED_LIBS |
James Zern | 31f9dc6 | 2011-06-07 00:56:50 | [diff] [blame] | 738 | AC_MSG_RESULT(${wic_support-no}) |
| 739 | fi |
| 740 | fi |
Timothy Gu | 63c2fc0 | 2014-08-06 03:55:04 | [diff] [blame] | 741 | esac |
James Zern | 31f9dc6 | 2011-06-07 00:56:50 | [diff] [blame] | 742 | |
skal | 663a6d9 | 2017-08-01 01:53:29 | [diff] [blame] | 743 | dnl === If --enable-swap-16bit-csp is defined, add -DWEBP_SWAP_16BIT_CSP=1 |
Vikas Arora | 94a48b4 | 2013-01-19 00:23:09 | [diff] [blame] | 744 | |
| 745 | USE_SWAP_16BIT_CSP="" |
| 746 | AC_MSG_CHECKING(if --enable-swap-16bit-csp option is specified) |
| 747 | AC_ARG_ENABLE([swap-16bit-csp], |
| 748 | AS_HELP_STRING([--enable-swap-16bit-csp], |
| 749 | [Enable byte swap for 16 bit colorspaces])) |
| 750 | if test "$enable_swap_16bit_csp" = "yes"; then |
skal | 663a6d9 | 2017-08-01 01:53:29 | [diff] [blame] | 751 | USE_SWAP_16BIT_CSP="-DWEBP_SWAP_16BIT_CSP=1" |
Vikas Arora | 94a48b4 | 2013-01-19 00:23:09 | [diff] [blame] | 752 | fi |
| 753 | AC_MSG_RESULT(${enable_swap_16bit_csp-no}) |
| 754 | AC_SUBST(USE_SWAP_16BIT_CSP) |
| 755 | |
Vincent Rabaud | a80fcc4 | 2017-08-31 12:02:05 | [diff] [blame] | 756 | dnl === If --disable-near-lossless is defined, add -DWEBP_NEAR_LOSSLESS=0 |
| 757 | |
| 758 | AC_DEFINE(WEBP_NEAR_LOSSLESS, [1], [Enable near lossless encoding]) |
| 759 | AC_MSG_CHECKING(if --disable-near-lossless option is specified) |
| 760 | AC_ARG_ENABLE([near_lossless], |
| 761 | AS_HELP_STRING([--disable-near-lossless], |
| 762 | [Disable near lossless encoding]), |
| 763 | [], [enable_near_lossless=yes]) |
| 764 | if test "$enable_near_lossless" = "no"; then |
| 765 | AC_DEFINE(WEBP_NEAR_LOSSLESS, [0], [Enable near lossless encoding]) |
| 766 | AC_MSG_RESULT([yes]) |
| 767 | else |
| 768 | AC_MSG_RESULT([no]) |
| 769 | fi |
| 770 | |
Pascal Massimino | 79cc49f | 2011-05-04 22:17:54 | [diff] [blame] | 771 | dnl ========================= |
| 772 | |
James Zern | 28aedcb | 2022-10-24 23:44:42 | [diff] [blame] | 773 | dnl Add an empty webp_libname_prefix variable for use in *.pc.in. |
| 774 | AC_SUBST([webp_libname_prefix]) |
Pascal Massimino | 6421a7a | 2011-01-06 15:25:43 | [diff] [blame] | 775 | AC_CONFIG_MACRO_DIR([m4]) |
James Zern | 32b3137 | 2014-06-11 00:53:44 | [diff] [blame] | 776 | AC_CONFIG_HEADERS([src/webp/config.h]) |
Pascal Massimino | e06ac08 | 2011-09-02 21:30:08 | [diff] [blame] | 777 | AC_CONFIG_FILES([Makefile src/Makefile man/Makefile \ |
James Zern | c379b55 | 2016-07-19 23:02:55 | [diff] [blame] | 778 | examples/Makefile extras/Makefile imageio/Makefile \ |
Christopher Degawa | 7deee81 | 2022-08-02 20:46:19 | [diff] [blame] | 779 | sharpyuv/Makefile sharpyuv/libsharpyuv.pc \ |
James Zern | c379b55 | 2016-07-19 23:02:55 | [diff] [blame] | 780 | src/dec/Makefile src/enc/Makefile src/dsp/Makefile \ |
Urvang Joshi | 23782f9 | 2012-11-19 19:21:37 | [diff] [blame] | 781 | src/demux/Makefile src/mux/Makefile \ |
James Zern | ad497fb | 2016-07-19 22:23:08 | [diff] [blame] | 782 | src/utils/Makefile \ |
James Zern | 26ca843 | 2013-03-05 03:14:06 | [diff] [blame] | 783 | src/libwebp.pc src/libwebpdecoder.pc \ |
James Zern | ad497fb | 2016-07-19 22:23:08 | [diff] [blame] | 784 | src/demux/libwebpdemux.pc src/mux/libwebpmux.pc]) |
Pascal Massimino | f61d14a | 2011-02-19 07:33:46 | [diff] [blame] | 785 | |
Ozkan Sezer | 8487860 | 2024-03-05 22:11:55 | [diff] [blame] | 786 | dnl fix exports from MinGW builds |
| 787 | AC_CONFIG_COMMANDS_POST([$SED -i 's/-DDLL_EXPORT/-DWEBP_DLL/' config.status]) |
Pascal Massimino | c3f41cb | 2010-09-30 13:34:38 | [diff] [blame] | 788 | AC_OUTPUT |
James Zern | bd56a01 | 2012-11-17 02:59:46 | [diff] [blame] | 789 | |
| 790 | AC_MSG_NOTICE([ |
| 791 | WebP Configuration Summary |
| 792 | -------------------------- |
| 793 | |
| 794 | Shared libraries: ${enable_shared} |
| 795 | Static libraries: ${enable_static} |
Pascal Massimino | fb3acf1 | 2014-07-21 07:21:50 | [diff] [blame] | 796 | Threading support: ${enable_threading-no} |
James Zern | bd56a01 | 2012-11-17 02:59:46 | [diff] [blame] | 797 | libwebp: yes |
Vikas Arora | 0aeba52 | 2013-01-23 00:22:20 | [diff] [blame] | 798 | libwebpdecoder: ${enable_libwebpdecoder-no} |
James Zern | a0a6648 | 2013-03-16 03:55:54 | [diff] [blame] | 799 | libwebpdemux: ${enable_libwebpdemux-no} |
| 800 | libwebpmux: ${enable_libwebpmux-no} |
James Zern | 5c176d2 | 2015-03-06 07:48:46 | [diff] [blame] | 801 | libwebpextras: ${enable_libwebpextras-no} |
James Zern | bd56a01 | 2012-11-17 02:59:46 | [diff] [blame] | 802 | |
| 803 | Tools: |
Pascal Massimino | 641cedc | 2017-03-02 16:45:42 | [diff] [blame] | 804 | cwebp : ${enable_libwebpdemux-no} |
James Zern | bd56a01 | 2012-11-17 02:59:46 | [diff] [blame] | 805 | Input format support |
| 806 | ==================== |
| 807 | JPEG : ${jpeg_support-no} |
| 808 | PNG : ${png_support-no} |
| 809 | TIFF : ${tiff_support-no} |
| 810 | WIC : ${wic_support-no} |
Pascal Massimino | 641cedc | 2017-03-02 16:45:42 | [diff] [blame] | 811 | dwebp : ${enable_libwebpdemux-no} |
James Zern | bd56a01 | 2012-11-17 02:59:46 | [diff] [blame] | 812 | Output format support |
| 813 | ===================== |
| 814 | PNG : ${png_support-no} |
| 815 | WIC : ${wic_support-no} |
Pascal Massimino | 79ff034 | 2013-09-12 11:03:51 | [diff] [blame] | 816 | GIF support : ${gif_support-no} |
Pascal Massimino | 501ef6e | 2017-08-28 13:56:57 | [diff] [blame] | 817 | anim_diff : ${build_anim_diff-no} |
Pascal Massimino | 79ff034 | 2013-09-12 11:03:51 | [diff] [blame] | 818 | gif2webp : ${build_gif2webp-no} |
Pascal Massimino | 03f4095 | 2016-12-02 10:44:17 | [diff] [blame] | 819 | img2webp : ${build_img2webp-no} |
Pascal Massimino | 79ff034 | 2013-09-12 11:03:51 | [diff] [blame] | 820 | webpmux : ${enable_libwebpmux-no} |
| 821 | vwebp : ${build_vwebp-no} |
Pascal Massimino | 274daf5 | 2017-03-14 09:00:43 | [diff] [blame] | 822 | webpinfo : ${build_webpinfo-no} |
Pascal Massimino | 6524fcd | 2017-01-30 12:33:35 | [diff] [blame] | 823 | SDL support : ${sdl_support-no} |
| 824 | vwebp_sdl : ${build_vwebp_sdl-no} |
James Zern | bd56a01 | 2012-11-17 02:59:46 | [diff] [blame] | 825 | ]) |