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