break up acinclude.m4

it's now in a more maintainable set of .m4 files in m4-safe
This commit is contained in:
John Cupitt 2016-05-18 10:41:05 +01:00
parent 1add582047
commit 91aa288a44
13 changed files with 918 additions and 893 deletions

3
.gitignore vendored
View File

@ -48,8 +48,7 @@ libtool
libvips/include/vips/version.h
fred
ltmain.sh
m4/*
!m4/python.m4
m4
missing
mkinstalldirs
po/Makefile.in.in

View File

@ -6,6 +6,7 @@
felixbuenemann
- allow nested [] in CLI args
- restore BandFmt on unpremultiply in vipsthumbnail
- better python detection and build [Felix Bünemann]
18/5/16 started 8.3.2
- more robust vips image reading

View File

@ -1,806 +0,0 @@
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_ZIP[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find ZIP libraries and headers
dnl
dnl Put includes stuff in ZIP_INCLUDES
dnl Put link stuff in ZIP_LIBS
dnl Define HAVE_ZIP if found
dnl
AC_DEFUN([FIND_ZIP], [
AC_REQUIRE([AC_PATH_XTRA])
ZIP_INCLUDES=""
ZIP_LIBS=""
AC_ARG_WITH(zip,
AS_HELP_STRING([--without-zip], [build without libx (default: test)]))
# Treat --without-zip like --without-zip-includes --without-zip-libraries.
if test "$with_zip" = "no"; then
ZIP_INCLUDES=no
ZIP_LIBS=no
fi
AC_ARG_WITH(zip-includes,
AS_HELP_STRING([--with-zip-includes=DIR], [libz includes are in DIR]),
ZIP_INCLUDES="-I$withval")
AC_ARG_WITH(zip-libraries,
AS_HELP_STRING([--with-zip-libraries=DIR], [libz libraries are in DIR]),
ZIP_LIBS="-L$withval -lz")
AC_MSG_CHECKING(for ZIP)
# Look for zlib.h
if test "$ZIP_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <zlib.h>],[int a;],[
ZIP_INCLUDES=""
], [
# zlib.h is not in the standard search path, try
# $prefix
zip_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <zlib.h>],[int a;],[
ZIP_INCLUDES="-I${prefix}/include"
], [
ZIP_INCLUDES="no"
])
INCLUDES=$zip_save_INCLUDES
])
fi
# Now for the libraries
if test "$ZIP_LIBS" = ""; then
zip_save_LIBS="$LIBS"
zip_save_INCLUDES="$INCLUDES"
LIBS="-lz $LIBS"
INCLUDES="$ZIP_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [
ZIP_LIBS="-lz"
], [
# libz is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [
ZIP_LIBS="-L${prefix}/lib -lz"
], [
ZIP_LIBS=no
])
])
LIBS="$zip_save_LIBS"
INCLUDES="$zip_save_INCLUDES"
fi
AC_SUBST(ZIP_LIBS)
AC_SUBST(ZIP_INCLUDES)
# Print a helpful message
zip_libraries_result="$ZIP_LIBS"
zip_includes_result="$ZIP_INCLUDES"
if test x"$zip_libraries_result" = x""; then
zip_libraries_result="in default path"
fi
if test x"$zip_includes_result" = x""; then
zip_includes_result="in default path"
fi
if test "$zip_libraries_result" = "no"; then
zip_libraries_result="(none)"
fi
if test "$zip_includes_result" = "no"; then
zip_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $zip_libraries_result, headers $zip_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$ZIP_INCLUDES" != "no" && test "$ZIP_LIBS" != "no"; then
AC_DEFINE(HAVE_ZIP,1,[Define if you have libz libraries and header files.])
$1
else
ZIP_LIBS=""
ZIP_INCLUDES=""
$2
fi
])dnl
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_TIFF[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find TIFF libraries and headers
dnl
dnl Put compile stuff in TIFF_INCLUDES
dnl Put link stuff in TIFF_LIBS
dnl Define HAVE_TIFF if found
dnl
AC_DEFUN([FIND_TIFF], [
AC_REQUIRE([AC_PATH_XTRA])
TIFF_INCLUDES=""
TIFF_LIBS=""
AC_ARG_WITH(tiff,
AS_HELP_STRING([--without-tiff], [build without libtiff (default: test)]))
# Treat --without-tiff like --without-tiff-includes --without-tiff-libraries.
if test "$with_tiff" = "no"; then
TIFF_INCLUDES=no
TIFF_LIBS=no
fi
AC_ARG_WITH(tiff-includes,
AS_HELP_STRING([--with-tiff-includes=DIR], [libtiff includes are in DIR]),
TIFF_INCLUDES="-I$withval")
AC_ARG_WITH(tiff-libraries,
AS_HELP_STRING([--with-tiff-libraries=DIR], [libtiff libraries are in DIR]),
TIFF_LIBS="-L$withval -ltiff")
AC_MSG_CHECKING(for TIFF)
# Look for tiff.h
if test "$TIFF_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <tiff.h>],[int a;],[
TIFF_INCLUDES=""
], [
# tiff.h is not in the standard search path, try
# $prefix
tiff_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <tiff.h>],[int a;],[
TIFF_INCLUDES="-I${prefix}/include"
], [
TIFF_INCLUDES="no"
])
INCLUDES=$tiff_save_INCLUDES
])
fi
# Now for the libraries
if test "$TIFF_LIBS" = ""; then
tiff_save_LIBS="$LIBS"
tiff_save_INCLUDES="$INCLUDES"
LIBS="-ltiff -lm $LIBS"
INCLUDES="$TIFF_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [
TIFF_LIBS="-ltiff"
], [
# libtiff is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [
TIFF_LIBS="-L${prefix}/lib -ltiff"
], [
TIFF_LIBS=no
])
])
LIBS="$tiff_save_LIBS"
INCLUDES="$tiff_save_INCLUDES"
fi
AC_SUBST(TIFF_LIBS)
AC_SUBST(TIFF_INCLUDES)
# Print a helpful message
tiff_libraries_result="$TIFF_LIBS"
tiff_includes_result="$TIFF_INCLUDES"
if test x"$tiff_libraries_result" = x""; then
tiff_libraries_result="in default path"
fi
if test x"$tiff_includes_result" = x""; then
tiff_includes_result="in default path"
fi
if test "$tiff_libraries_result" = "no"; then
tiff_libraries_result="(none)"
fi
if test "$tiff_includes_result" = "no"; then
tiff_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $tiff_libraries_result, headers $tiff_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$TIFF_INCLUDES" != "no" && test "$TIFF_LIBS" != "no"; then
AC_DEFINE(HAVE_TIFF,1,[Define if you have tiff libraries and header files.])
$1
else
TIFF_INCLUDES=""
TIFF_LIBS=""
$2
fi
])dnl
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_JPEG[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find JPEG libraries and headers
dnl
dnl Put compile stuff in JPEG_INCLUDES
dnl Put link stuff in JPEG_LIBS
dnl Define HAVE_JPEG if found
dnl
AC_DEFUN([FIND_JPEG], [
AC_REQUIRE([AC_PATH_XTRA])
JPEG_INCLUDES=""
JPEG_LIBS=""
AC_ARG_WITH(jpeg,
AS_HELP_STRING([--without-jpeg], [build without libjpeg (default: test)]))
# Treat --without-jpeg like --without-jpeg-includes --without-jpeg-libraries.
if test "$with_jpeg" = "no"; then
JPEG_INCLUDES=no
JPEG_LIBS=no
fi
AC_ARG_WITH(jpeg-includes,
AS_HELP_STRING([--with-jpeg-includes=DIR], [libjpeg includes are in DIR]),
JPEG_INCLUDES="-I$withval")
AC_ARG_WITH(jpeg-libraries,
AS_HELP_STRING([--with-jpeg-libraries=DIR], [libjpeg libraries are in DIR]),
JPEG_LIBS="-L$withval -ljpeg")
AC_MSG_CHECKING(for JPEG)
# Look for jpeglib.h
if test "$JPEG_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <stdio.h>
#include <jpeglib.h>],[int a;],[
JPEG_INCLUDES=""
], [
# jpeglib.h is not in the standard search path, try
# $prefix
jpeg_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <stdio.h>
#include <jpeglib.h>],[int a;],[
JPEG_INCLUDES="-I${prefix}/include"
], [
JPEG_INCLUDES="no"
])
INCLUDES=$jpeg_save_INCLUDES
])
fi
# Now for the libraries
if test "$JPEG_LIBS" = ""; then
jpeg_save_LIBS="$LIBS"
jpeg_save_INCLUDES="$INCLUDES"
LIBS="-ljpeg $LIBS"
INCLUDES="$JPEG_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <stdio.h>
#include <jpeglib.h>
],[jpeg_abort((void*)0)], [
JPEG_LIBS="-ljpeg"
], [
# libjpeg is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <stdio.h>
#include <jpeg.h>
],[jpeg_abort((void*)0)], [
JPEG_LIBS="-L${prefix}/lib -ljpeg"
], [
JPEG_LIBS=no
])
])
LIBS="$jpeg_save_LIBS"
INCLUDES="$jpeg_save_INCLUDES"
fi
AC_SUBST(JPEG_LIBS)
AC_SUBST(JPEG_INCLUDES)
# Print a helpful message
jpeg_libraries_result="$JPEG_LIBS"
jpeg_includes_result="$JPEG_INCLUDES"
if test x"$jpeg_libraries_result" = x""; then
jpeg_libraries_result="in default path"
fi
if test x"$jpeg_includes_result" = x""; then
jpeg_includes_result="in default path"
fi
if test "$jpeg_libraries_result" = "no"; then
jpeg_libraries_result="(none)"
fi
if test "$jpeg_includes_result" = "no"; then
jpeg_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $jpeg_libraries_result, headers $jpeg_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$JPEG_INCLUDES" != "no" && test "$JPEG_LIBS" != "no"; then
AC_DEFINE(HAVE_JPEG,1,[Define if you have jpeg libraries and header files.])
$1
else
JPEG_INCLUDES=""
JPEG_LIBS=""
$2
fi
])dnl
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_PNG[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find PNG libraries and headers
dnl
dnl Put compile stuff in PNG_INCLUDES
dnl Put link stuff in PNG_LIBS
dnl Define HAVE_PNG if found.
dnl
AC_DEFUN([FIND_PNG], [
AC_REQUIRE([AC_PATH_XTRA])
PNG_INCLUDES=""
PNG_LIBS=""
AC_ARG_WITH(png,
AS_HELP_STRING([--without-png], [build without libpng (default: test)]))
# Treat --without-png like --without-png-includes --without-png-libraries.
if test "$with_png" = "no"; then
PNG_INCLUDES=no
PNG_LIBS=no
fi
AC_ARG_WITH(png-includes,
AS_HELP_STRING([--with-png-includes=DIR], [libpng includes are in DIR]),
PNG_INCLUDES="-I$withval")
AC_ARG_WITH(png-libraries,
AS_HELP_STRING([--with-png-libraries=DIR], [libpng libraries are in DIR]),
PNG_LIBS="-L$withval -lpng")
AC_MSG_CHECKING(for libpng)
# Look for png.h
if test "$PNG_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <png.h>],[int a;],[
PNG_INCLUDES=""
], [
# png.h is not in the standard search path, try
# $prefix
png_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <png.h>],[int a;],[
PNG_INCLUDES="-I${prefix}/include"
], [
PNG_INCLUDES="no"
])
INCLUDES=$png_save_INCLUDES
])
fi
# Now for the libraries
if test "$PNG_LIBS" = ""; then
png_save_LIBS="$LIBS"
png_save_INCLUDES="$INCLUDES"
LIBS="-lpng $LIBS"
INCLUDES="$PNG_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [
PNG_LIBS="-lpng"
], [
# libpng is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [
PNG_LIBS="-L${prefix}/lib -lpng"
], [
PNG_LIBS=no
])
])
LIBS="$png_save_LIBS"
INCLUDES="$png_save_INCLUDES"
fi
AC_SUBST(PNG_LIBS)
AC_SUBST(PNG_INCLUDES)
# Print a helpful message
png_libraries_result="$PNG_LIBS"
png_includes_result="$PNG_INCLUDES"
if test x"$png_libraries_result" = x""; then
png_libraries_result="in default path"
fi
if test x"$png_includes_result" = x""; then
png_includes_result="in default path"
fi
if test "$png_libraries_result" = "no"; then
png_libraries_result="(none)"
fi
if test "$png_includes_result" = "no"; then
png_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $png_libraries_result, headers $png_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$PNG_INCLUDES" != "no" && test "$PNG_LIBS" != "no"; then
AC_DEFINE(HAVE_PNG,1,[Define if you have png libraries and header files.])
$1
else
PNG_INCLUDES=""
PNG_LIBS=""
$2
fi
])dnl
dnl a macro to check for ability to create python extensions
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
dnl function also defines PYTHON_INCLUDES
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[AC_REQUIRE([AM_PATH_PYTHON])
AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print(sys.prefix)"`
py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi
AC_SUBST(PYTHON_INCLUDES)
dnl check if the headers exist:
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
AC_TRY_CPP([#include <Python.h>],dnl
[AC_MSG_RESULT(found)
$1],dnl
[AC_MSG_RESULT(not found)
$2])
CPPFLAGS="$save_CPPFLAGS"
])
dnl @synopsis AC_FUNC_MKDIR
dnl
dnl Check whether mkdir() is mkdir or _mkdir, and whether it takes one
dnl or two arguments.
dnl
dnl This macro can define HAVE_MKDIR, HAVE__MKDIR, and
dnl MKDIR_TAKES_ONE_ARG, which are expected to be used as follows:
dnl
dnl #if HAVE_MKDIR
dnl # if MKDIR_TAKES_ONE_ARG
dnl /* MinGW32 */
dnl # define mkdir(a, b) mkdir(a)
dnl # endif
dnl #else
dnl # if HAVE__MKDIR
dnl /* plain Windows 32 */
dnl # define mkdir(a, b) _mkdir(a)
dnl # else
dnl # error "Don't know how to create a directory on this system."
dnl # endif
dnl #endif
dnl
dnl @category C
dnl @author Alexandre Duret-Lutz <adl@gnu.org>
dnl @version 2003-12-28
dnl @license GPLWithACException
AC_DEFUN([AC_FUNC_MKDIR],
[AC_CHECK_FUNCS([mkdir _mkdir])
AC_CACHE_CHECK([whether mkdir takes one argument],
[ac_cv_mkdir_takes_one_arg],
[AC_TRY_COMPILE([
#include <sys/stat.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
], [mkdir (".");],
[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
[Define if mkdir takes only one argument.])
fi
])
dnl Note:
dnl =====
dnl I have not implemented the following suggestion because I don't have
dnl access to such a broken environment to test the macro. So I'm just
dnl appending the comments here in case you have, and want to fix
dnl AC_FUNC_MKDIR that way.
dnl
dnl |Thomas E. Dickey (dickey@herndon4.his.com) said:
dnl | it doesn't cover the problem areas (compilers that mistreat mkdir
dnl | may prototype it in dir.h and dirent.h, for instance).
dnl |
dnl |Alexandre:
dnl | Would it be sufficient to check for these headers and #include
dnl | them in the AC_TRY_COMPILE block? (and is AC_HEADER_DIRENT
dnl | suitable for this?)
dnl |
dnl |Thomas:
dnl | I think that might be a good starting point (with the set of recommended
dnl | ifdef's and includes for AC_HEADER_DIRENT, of course).
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_GIFLIB[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ---------------------------------------------------
dnl
dnl Find GIFLIB libraries and headers
dnl
dnl Put compile stuff in GIFLIB_INCLUDES
dnl Put link stuff in GIFLIB_LIBS
dnl Define HAVE_GIFLIB if found.
dnl
AC_DEFUN([FIND_GIFLIB], [
AC_REQUIRE([AC_PATH_XTRA])
GIFLIB_INCLUDES=""
GIFLIB_LIBS=""
AC_ARG_WITH(giflib,
AS_HELP_STRING([--without-giflib], [build without giflib (default: test)]))
# Treat --without-giflib like --without-giflib-includes --without-giflib-libraries.
if test "$with_giflib" = "no"; then
GIFLIB_INCLUDES=no
GIFLIB_LIBS=no
fi
AC_ARG_WITH(giflib-includes,
AS_HELP_STRING([--with-giflib-includes=DIR], [giflib includes are in DIR]),
GIFLIB_INCLUDES="-I$withval")
AC_ARG_WITH(giflib-libraries,
AS_HELP_STRING([--with-giflib-libraries=DIR], [giflib libraries are in DIR]),
GIFLIB_LIBS="-L$withval -lgif")
AC_MSG_CHECKING(for giflib)
# Look for gif_lib.h
if test "$GIFLIB_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <gif_lib.h>],[int a;],[
GIFLIB_INCLUDES=""
], [
# gif_lib.h is not in the standard search path, try
# $prefix
giflib_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <gif_lib.h>],[int a;],[
GIFLIB_INCLUDES="-I${prefix}/include"
], [
GIFLIB_INCLUDES="no"
])
INCLUDES=$giflib_save_INCLUDES
])
fi
# Now for the libraries
if test "$GIFLIB_LIBS" = ""; then
giflib_save_LIBS="$LIBS"
giflib_save_INCLUDES="$INCLUDES"
LIBS="-lgif $LIBS"
INCLUDES="$GIFLIB_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
GIFLIB_LIBS="-lgif"
], [
# giflib is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
GIFLIB_LIBS="-L${prefix}/lib -lgif"
], [
GIFLIB_LIBS=no
])
])
LIBS="$giflib_save_LIBS"
INCLUDES="$giflib_save_INCLUDES"
fi
AC_SUBST(GIFLIB_LIBS)
AC_SUBST(GIFLIB_INCLUDES)
# Print a helpful message
giflib_libraries_result="$GIFLIB_LIBS"
giflib_includes_result="$GIFLIB_INCLUDES"
if test x"$giflib_libraries_result" = x""; then
giflib_libraries_result="in default path"
fi
if test x"$giflib_includes_result" = x""; then
giflib_includes_result="in default path"
fi
if test "$giflib_libraries_result" = "no"; then
giflib_libraries_result="(none)"
fi
if test "$giflib_includes_result" = "no"; then
giflib_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $giflib_libraries_result, headers $giflib_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$GIFLIB_INCLUDES" != "no" && test "$GIFLIB_LIBS" != "no"; then
AC_DEFINE(HAVE_GIFLIB,1,[Define if you have giflib libraries and header files.])
$1
else
GIFLIB_INCLUDES=""
GIFLIB_LIBS=""
$2
fi
])dnl
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_LIBWEBP[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ---------------------------------------------------
dnl
dnl Find webp libraries and headers ... useful for platforms which are missing
dnl the webp .pc file
dnl
dnl Put compile stuff in LIBWEBP_INCLUDES
dnl Put link stuff in LIBWEBP_LIBS
dnl Define HAVE_LIBWEBP if found.
dnl
AC_DEFUN([FIND_LIBWEBP], [
AC_REQUIRE([AC_PATH_XTRA])
LIBWEBP_INCLUDES=""
LIBWEBP_LIBS=""
AC_ARG_WITH(libwebp,
AS_HELP_STRING([--without-libwebp], [build without libwebp (default: test)]))
# Treat --without-libwebp like --without-libwebp-includes --without-libwebp-libraries.
if test "$with_libwebp" = "no"; then
LIBWEBP_INCLUDES=no
LIBWEBP_LIBS=no
fi
AC_ARG_WITH(libwebp-includes,
AS_HELP_STRING([--with-libwebp-includes=DIR], [libwebp includes are in DIR]),
LIBWEBP_INCLUDES="-I$withval")
AC_ARG_WITH(libwebp-libraries,
AS_HELP_STRING([--with-libwebp-libraries=DIR], [libwebp libraries are in DIR]),
LIBWEBP_LIBS="-L$withval -lwebp")
AC_MSG_CHECKING(for libwebp)
# Look for webp/decode.h
if test "$LIBWEBP_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
LIBWEBP_INCLUDES=""
], [
# webp/decode.h is not in the standard search path, try
# $prefix
libwebp_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
LIBWEBP_INCLUDES="-I${prefix}/include"
], [
LIBWEBP_INCLUDES="no"
])
INCLUDES=$libwebp_save_INCLUDES
])
fi
# Now for the libraries
if test "$LIBWEBP_LIBS" = ""; then
libwebp_save_LIBS="$LIBS"
libwebp_save_INCLUDES="$INCLUDES"
LIBS="-lwebp $LIBS"
INCLUDES="$LIBWEBP_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
LIBWEBP_LIBS="-lwebp"
], [
# libwebp is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
LIBWEBP_LIBS="-L${prefix}/lib -lwebp"
], [
LIBWEBP_LIBS=no
])
])
LIBS="$libwebp_save_LIBS"
INCLUDES="$libwebp_save_INCLUDES"
fi
AC_SUBST(LIBWEBP_LIBS)
AC_SUBST(LIBWEBP_INCLUDES)
# Print a helpful message
libwebp_libraries_result="$LIBWEBP_LIBS"
libwebp_includes_result="$LIBWEBP_INCLUDES"
if test x"$libwebp_libraries_result" = x""; then
libwebp_libraries_result="in default path"
fi
if test x"$libwebp_includes_result" = x""; then
libwebp_includes_result="in default path"
fi
if test "$libwebp_libraries_result" = "no"; then
libwebp_libraries_result="(none)"
fi
if test "$libwebp_includes_result" = "no"; then
libwebp_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $libwebp_libraries_result, headers $libwebp_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$LIBWEBP_INCLUDES" != "no" && test "$LIBWEBP_LIBS" != "no"; then
AC_DEFINE(HAVE_LIBWEBP,1,[Define if you have libwebp libraries and header files.])
$1
else
LIBWEBP_INCLUDES=""
LIBWEBP_LIBS=""
$2
fi
])dnl

View File

@ -5,7 +5,10 @@
# a bunch of cleaning up ... make certain everything will be regenerated
rm -f Makefile Makefile.in aclocal.m4
rm -rf autom4te.cache
find m4 ! -name python.m4 -type f -name '*.m4' -delete
# m4/ contains only stuff from the build system ... the m4 files we have
# written and maintain are in m4-safe
rm m4/*
cp m4-safe/* m4/
rm -f config.* configure depcomp
rm -f install-sh intltool-* libtool ltmain.sh missing mkinstalldirs
rm -f stamp-* vipsCC-7.19.pc vips-7.19.spec vips-7.19.pc

View File

@ -349,30 +349,36 @@ PKG_CHECK_MODULES(REQUIRED, glib-2.0 >= 2.6 gmodule-2.0 libxml-2.0 gobject-2.0)
PACKAGES_USED="$PACKAGES_USED glib-2.0 libxml-2.0 gmodule-2.0 gobject-2.0"
# after 2.28 we have a monotonic timer
PKG_CHECK_MODULES(MONOTONIC, glib-2.0 >= 2.28,[
AC_DEFINE(HAVE_MONOTONIC_TIME,1,[define if your glib has g_get_monotonic_time().])
],[:
PKG_CHECK_MODULES(MONOTONIC, glib-2.0 >= 2.28,
[AC_DEFINE(HAVE_MONOTONIC_TIME,1,
[define if your glib has g_get_monotonic_time().]
)
],
[:
]
)
# after 2.32 there are a new set of thread functions, annoyingly
PKG_CHECK_MODULES(THREADS, glib-2.0 >= 2.32,[
AC_DEFINE(HAVE_MUTEX_INIT,1,[define if your glib has g_mutex_init().])
AC_DEFINE(HAVE_COND_INIT,1,[define if your glib has g_cond_init().])
AC_DEFINE(HAVE_THREAD_NEW,1,[define if your glib has g_thread_new().])
AC_DEFINE(HAVE_PRIVATE_INIT,1,[define if your glib has G_PRIVATE_INIT().])
AC_DEFINE(HAVE_VALUE_GET_SCHAR,1,[define if your glib has g_value_get_schar().])
],[
# the old threading system ... we need to link against gthread
PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
PACKAGES_USED="$PACKAGES_USED gthread-2.0"
PKG_CHECK_MODULES(THREADS, glib-2.0 >= 2.32,
[AC_DEFINE(HAVE_MUTEX_INIT,1,[define if your glib has g_mutex_init().])
AC_DEFINE(HAVE_COND_INIT,1,[define if your glib has g_cond_init().])
AC_DEFINE(HAVE_THREAD_NEW,1,[define if your glib has g_thread_new().])
AC_DEFINE(HAVE_PRIVATE_INIT,1,[define if your glib has G_PRIVATE_INIT().])
AC_DEFINE(HAVE_VALUE_GET_SCHAR,1,
[define if your glib has g_value_get_schar().]
)
],
[# the old threading system ... we need to link against gthread
PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
PACKAGES_USED="$PACKAGES_USED gthread-2.0"
]
)
# with 2.36 and after the type system inits itself
PKG_CHECK_MODULES(TYPE_INIT, glib-2.0 < 2.36,[
AC_DEFINE(NEED_TYPE_INIT,1,[define if your glib needs g_type_init().])
],[:
PKG_CHECK_MODULES(TYPE_INIT, glib-2.0 < 2.36,
[AC_DEFINE(NEED_TYPE_INIT,1,[define if your glib needs g_type_init().])
],
[:
]
)
@ -389,9 +395,12 @@ if test x"$with_gsf" != "xno"; then
PKG_CHECK_MODULES(GSF, libgsf-1 >= 1.14.27,
[AC_DEFINE(HAVE_GSF,1,[define if you have libgsf-1 installed.])
with_gsf=yes
PACKAGES_USED="$PACKAGES_USED libgsf-1"],
PACKAGES_USED="$PACKAGES_USED libgsf-1"
],
[AC_MSG_WARN([libgsf-1 not found; disabling dzsave support])
with_gsf=no])
with_gsf=no
]
)
fi
AC_ARG_WITH([fftw],
@ -401,9 +410,12 @@ if test x"$with_fftw" != "xno"; then
PKG_CHECK_MODULES(FFTW, fftw3,
[AC_DEFINE(HAVE_FFTW,1,[define if you have fftw3 installed.])
with_fftw=yes
PACKAGES_USED="$PACKAGES_USED fftw3"],
PACKAGES_USED="$PACKAGES_USED fftw3"
],
[AC_MSG_WARN([fftw not found; disabling fftw support])
with_fftw=no])
with_fftw=no
]
)
fi
# ImageMagick ... detect attribute iteration too
@ -419,36 +431,43 @@ AC_ARG_WITH([magickpackage],
# MagickWand, so by default we test for that first
if test x"$with_magickpackage" = "x"; then
PKG_CHECK_MODULES(MAGICK_WAND, MagickWand,
[with_magickpackage=MagickWand],
[with_magickpackage=MagickWand
],
[PKG_CHECK_MODULES(IMAGE_MAGICK, ImageMagick,
[with_magickpackage=ImageMagick],
[AC_MSG_WARN([neither MagickWand nor ImageMagick found; disabling Magick support])
with_magick=no
])])
[with_magickpackage=ImageMagick
],
[AC_MSG_WARN([neither MagickWand nor ImageMagick found; disabling Magick support])
with_magick=no
]
)
]
)
fi
if test x"$with_magick" != "xno"; then
if test x"$with_magick" != x"no"; then
PKG_CHECK_MODULES(MAGICK, $with_magickpackage,
[AC_DEFINE(HAVE_MAGICK,1,[define if you have libMagick installed.])
with_magick=yes
PACKAGES_USED="$PACKAGES_USED $with_magickpackage"],
PACKAGES_USED="$PACKAGES_USED $with_magickpackage"
],
[AC_MSG_WARN([$with_magickpackage not found; disabling Magick support])
with_magick=no
])
]
)
fi
if test x"$with_magick" != "xno"; then
if test x"$with_magick" != x"no"; then
# we SetImageOption to disable some DICOM read processing, but that's only
# in more recent imagemagicks and not in graphicsmagick
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
AC_CHECK_FUNCS(SetImageOption,
AC_DEFINE(HAVE_SETIMAGEOPTION,1,
[define if your magick has SetImageOption.]))
AC_DEFINE(HAVE_SETIMAGEOPTION,1,[define if your magick has SetImageOption.])
)
LIBS="$save_LIBS"
fi
if test x"$with_magick" != "xno"; then
if test x"$with_magick" != x"no"; then
# newer ImageMagicks use MagickCoreGenesis instead of InitializeMagick argh
save_LIBS="$LIBS"
LIBS="$LIBS $MAGICK_LIBS"
@ -521,7 +540,8 @@ if test x"$with_orc" != "xno"; then
],
[AC_MSG_WARN([orc-0.4.11 or later not found; disabling orc support])
with_orc=no
])
]
)
fi
# lcms ... look for lcms2 first, it has better threading support
@ -532,14 +552,19 @@ if test x"$with_lcms" != "xno"; then
PKG_CHECK_MODULES(LCMS, lcms2,
[AC_DEFINE(HAVE_LCMS2,1,[define if you have lcms2 installed.])
with_lcms="yes (lcms2)"
PACKAGES_USED="$PACKAGES_USED lcms2"],
PACKAGES_USED="$PACKAGES_USED lcms2"
],
[PKG_CHECK_MODULES(LCMS, lcms,
[AC_DEFINE(HAVE_LCMS,1,[define if you have lcms installed.])
with_lcms="yes (lcms1)"
PACKAGES_USED="$PACKAGES_USED lcms"],
[AC_MSG_WARN([lcms2/lcms not found; disabling lcms support])
with_lcms=no])
])
[AC_DEFINE(HAVE_LCMS,1,[define if you have lcms installed.])
with_lcms="yes (lcms1)"
PACKAGES_USED="$PACKAGES_USED lcms"
],
[AC_MSG_WARN([lcms2/lcms not found; disabling lcms support])
with_lcms=no
]
)
]
)
fi
# OpenEXR
@ -626,10 +651,12 @@ if test x"$with_matio" != "xno"; then
PKG_CHECK_MODULES(MATIO, matio,
[AC_DEFINE(HAVE_MATIO,1,[define if you have matio installed.])
with_matio=yes
PACKAGES_USED="$PACKAGES_USED matio"],
PACKAGES_USED="$PACKAGES_USED matio"
],
[AC_MSG_WARN([matio not found; disabling matio support])
with_matio=no
])
]
)
fi
# not external libraries, but have options to disable them, helps to
@ -667,10 +694,12 @@ if test x"$with_cfitsio" != "xno"; then
PKG_CHECK_MODULES(CFITSIO, cfitsio,
[AC_DEFINE(HAVE_CFITSIO,1,[define if you have cfitsio installed.])
with_cfitsio=yes
PACKAGES_USED="$PACKAGES_USED cfitsio"],
PACKAGES_USED="$PACKAGES_USED cfitsio"
],
[AC_MSG_WARN([cfitsio not found; disabling cfitsio support])
with_cfitsio=no
])
]
)
fi
# libwebp
@ -683,13 +712,15 @@ if test x"$with_libwebp" != "xno"; then
PKG_CHECK_MODULES(LIBWEBP, libwebp >= 0.1.3,
[AC_DEFINE(HAVE_LIBWEBP,1,[define if you have libwebp installed.])
with_libwebp=yes
PACKAGES_USED="$PACKAGES_USED libwebp"],
[FIND_LIBWEBP([
with_libwebp="yes (found by search)"
], [
AC_MSG_WARN([libwebp not found; disabling WEBP support])
with_libwebp=no
])
PACKAGES_USED="$PACKAGES_USED libwebp"
],
[FIND_LIBWEBP(
[with_libwebp="yes (found by search)"
],
[AC_MSG_WARN([libwebp not found; disabling WEBP support])
with_libwebp=no
]
)
]
)
fi
@ -707,19 +738,24 @@ if test x"$with_pangoft2" != "xno"; then
],
[AC_MSG_WARN([pangoft2 not found; disabling pangoft2 support])
with_pangoft2=no
])
]
)
fi
# install vips8 python
AC_ARG_ENABLE([pyvips8],
AS_HELP_STRING([--enable-pyvips8],
[install vips8 Python overrides (default: test)]),
[enable_pyvips8=$enableval],
[enable_pyvips8="auto"])
[enable_pyvips8=$enableval
],
[enable_pyvips8="auto"
]
)
if test "x$enable_pyvips8" = "xauto"; then
PKG_CHECK_EXISTS([pygobject-3.0 >= 3.12.0],
[enable_pyvips8=yes],
[enable_pyvips8=yes
],
[AC_MSG_WARN([pygobject-3.0 not found; disabling vips8 python support])
enable_pyvips8=no
]
@ -729,7 +765,8 @@ fi
if test x"$enable_pyvips8" = x"yes"; then
JD_PATH_PYTHON(2.7,,
[enable_pyvips8=no
AC_MSG_WARN([Python not found; disabling vips8 Python binding])]
AC_MSG_WARN([Python not found; disabling vips8 Python binding])
]
)
fi
@ -743,10 +780,12 @@ AM_CONDITIONAL(ENABLE_PYVIPS8, test x"$enable_pyvips8" = x"yes")
# hmm, these don't have .pc files on ubuntu 5.10, how odd
FIND_ZIP(
[with_zip=yes],
[with_zip=yes
],
[AC_MSG_WARN([libz not found; disabling ZIP support])
with_zip=no
])
]
)
# look for TIFF with pkg-config ... fall back to our tester
# pkgconfig support for libtiff starts with libtiff-4
@ -757,22 +796,26 @@ if test x"$with_tiff" != "xno"; then
PKG_CHECK_MODULES(TIFF, libtiff-4,
[AC_DEFINE(HAVE_TIFF,1,[define if you have libtiff installed.])
with_tiff="yes (pkg-config libtiff-4)"
PACKAGES_USED="$PACKAGES_USED libtiff-4"],
PACKAGES_USED="$PACKAGES_USED libtiff-4"
],
[FIND_TIFF(
with_tiff="yes (found by search)",
[AC_MSG_WARN([libtiff not found; disabling TIFF support])
with_tiff=no
])
])
with_tiff="yes (found by search)",
[AC_MSG_WARN([libtiff not found; disabling TIFF support])
with_tiff=no
]
)
]
)
fi
# giflib
FIND_GIFLIB([
with_giflib="yes (found by search)"
], [
AC_MSG_WARN([giflib not found; disabling direct GIF support])
with_giflib=no
])
FIND_GIFLIB(
[with_giflib="yes (found by search)"
],
[AC_MSG_WARN([giflib not found; disabling direct GIF support])
with_giflib=no
]
)
# look for PNG with pkg-config ... fall back to our tester
AC_ARG_WITH([png],
@ -782,21 +825,27 @@ if test x"$with_png" != "xno"; then
PKG_CHECK_MODULES(PNG, libpng >= 1.2.9,
[AC_DEFINE(HAVE_PNG,1,[define if you have libpng installed.])
with_png="yes (pkg-config libpng >= 1.2.9)"
PACKAGES_USED="$PACKAGES_USED libpng"],
PACKAGES_USED="$PACKAGES_USED libpng"
],
[FIND_PNG(
with_png="yes (found by search)",
[AC_MSG_WARN([libpng not found; disabling PNG support])
with_png=no
])
])
[with_png="yes (found by search)"
],
[AC_MSG_WARN([libpng not found; disabling PNG support])
with_png=no
]
)
]
)
fi
FIND_JPEG(
[with_jpeg=yes
EXTRA_LIBS_USED="$EXTRA_LIBS_USED -ljpeg"],
EXTRA_LIBS_USED="$EXTRA_LIBS_USED -ljpeg"
],
[AC_MSG_WARN([libjpeg not found; disabling JPEG support])
with_jpeg=no
])
]
)
# JPEG extension parameters available in libjpeg-turbo >=1.5.0, mozjpeg >=3.0
if test x"$with_jpeg" != "xno"; then
@ -816,10 +865,12 @@ if test x"$with_libexif" != "xno"; then
PKG_CHECK_MODULES(EXIF, libexif >= 0.6,
[AC_DEFINE(HAVE_EXIF,1,[define if you have libexif >= 0.6 installed.])
with_libexif=yes
PACKAGES_USED="$PACKAGES_USED libexif"],
PACKAGES_USED="$PACKAGES_USED libexif"
],
[AC_MSG_WARN([libexif >= 0.6 not found; disabling exif support])
with_libexif=no
])
]
)
fi
# some libexif packages need include <libexif/poop.h>, some just <poop.h>
@ -849,7 +900,8 @@ fi
if test x"$with_python" != x"no"; then
JD_PATH_PYTHON(2.7,,
[with_python=no
AC_MSG_WARN([Python >= 2.7 not found; disabling vips7 Python binding])]
AC_MSG_WARN([Python >= 2.7 not found; disabling vips7 Python binding])
]
)
fi
@ -857,14 +909,17 @@ if test x"$with_python" != x"no"; then
# The SWIG bindings don't compile on python3 (see issue #334).
AM_PYTHON_CHECK_VERSION([$PYTHON], [3.0],
[with_python=no
AC_MSG_WARN([Python >= 3.0 found; disabling vips7 Python binding])]
AC_MSG_WARN([Python >= 3.0 found; disabling vips7 Python binding])
]
)
fi
if test x"$with_python" != x"no"; then
AM_CHECK_PYTHON_HEADERS(,
[with_python=no
AC_MSG_WARN([Python headers not found; disabling vips7 Python binding])])
AC_MSG_WARN([Python headers not found; disabling vips7 Python binding])
]
)
fi
# we don't check for swig: we include the generated bindings in the
@ -997,7 +1052,7 @@ use libexif to load/save JPEG metadata: $with_libexif
if test x"$found_introspection" = xyes -a "$VIPS_LIBDIR/girepository-1.0" != "$INTROSPECTION_TYPELIBDIR"; then
case "$VIPS_LIBDIR" in
/usr/local/Cellar/vips/*)
;; # ingnore for homebrew
;; # ignore for homebrew
*)
AC_MSG_RESULT([dnl
Vips-8.0.typelib will install to $VIPS_LIBDIR/girepository-1.0, but your

117
m4-safe/gif.m4 Normal file
View File

@ -0,0 +1,117 @@
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_GIFLIB[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ---------------------------------------------------
dnl
dnl Find GIFLIB libraries and headers
dnl
dnl Put compile stuff in GIFLIB_INCLUDES
dnl Put link stuff in GIFLIB_LIBS
dnl Define HAVE_GIFLIB if found.
dnl
AC_DEFUN([FIND_GIFLIB], [
AC_REQUIRE([AC_PATH_XTRA])
GIFLIB_INCLUDES=""
GIFLIB_LIBS=""
AC_ARG_WITH(giflib,
AS_HELP_STRING([--without-giflib], [build without giflib (default: test)]))
# Treat --without-giflib like --without-giflib-includes --without-giflib-libraries.
if test "$with_giflib" = "no"; then
GIFLIB_INCLUDES=no
GIFLIB_LIBS=no
fi
AC_ARG_WITH(giflib-includes,
AS_HELP_STRING([--with-giflib-includes=DIR], [giflib includes are in DIR]),
GIFLIB_INCLUDES="-I$withval")
AC_ARG_WITH(giflib-libraries,
AS_HELP_STRING([--with-giflib-libraries=DIR], [giflib libraries are in DIR]),
GIFLIB_LIBS="-L$withval -lgif")
AC_MSG_CHECKING(for giflib)
# Look for gif_lib.h
if test "$GIFLIB_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <gif_lib.h>],[int a;],[
GIFLIB_INCLUDES=""
], [
# gif_lib.h is not in the standard search path, try
# $prefix
giflib_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <gif_lib.h>],[int a;],[
GIFLIB_INCLUDES="-I${prefix}/include"
], [
GIFLIB_INCLUDES="no"
])
INCLUDES=$giflib_save_INCLUDES
])
fi
# Now for the libraries
if test "$GIFLIB_LIBS" = ""; then
giflib_save_LIBS="$LIBS"
giflib_save_INCLUDES="$INCLUDES"
LIBS="-lgif $LIBS"
INCLUDES="$GIFLIB_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
GIFLIB_LIBS="-lgif"
], [
# giflib is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
GIFLIB_LIBS="-L${prefix}/lib -lgif"
], [
GIFLIB_LIBS=no
])
])
LIBS="$giflib_save_LIBS"
INCLUDES="$giflib_save_INCLUDES"
fi
AC_SUBST(GIFLIB_LIBS)
AC_SUBST(GIFLIB_INCLUDES)
# Print a helpful message
giflib_libraries_result="$GIFLIB_LIBS"
giflib_includes_result="$GIFLIB_INCLUDES"
if test x"$giflib_libraries_result" = x""; then
giflib_libraries_result="in default path"
fi
if test x"$giflib_includes_result" = x""; then
giflib_includes_result="in default path"
fi
if test "$giflib_libraries_result" = "no"; then
giflib_libraries_result="(none)"
fi
if test "$giflib_includes_result" = "no"; then
giflib_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $giflib_libraries_result, headers $giflib_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$GIFLIB_INCLUDES" != "no" && test "$GIFLIB_LIBS" != "no"; then
AC_DEFINE(HAVE_GIFLIB,1,[Define if you have giflib libraries and header files.])
$1
else
GIFLIB_INCLUDES=""
GIFLIB_LIBS=""
$2
fi
])dnl

123
m4-safe/jpeg.m4 Normal file
View File

@ -0,0 +1,123 @@
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_JPEG[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find JPEG libraries and headers
dnl
dnl Put compile stuff in JPEG_INCLUDES
dnl Put link stuff in JPEG_LIBS
dnl Define HAVE_JPEG if found
dnl
AC_DEFUN([FIND_JPEG], [
AC_REQUIRE([AC_PATH_XTRA])
JPEG_INCLUDES=""
JPEG_LIBS=""
AC_ARG_WITH(jpeg,
AS_HELP_STRING([--without-jpeg], [build without libjpeg (default: test)]))
# Treat --without-jpeg like --without-jpeg-includes --without-jpeg-libraries.
if test "$with_jpeg" = "no"; then
JPEG_INCLUDES=no
JPEG_LIBS=no
fi
AC_ARG_WITH(jpeg-includes,
AS_HELP_STRING([--with-jpeg-includes=DIR], [libjpeg includes are in DIR]),
JPEG_INCLUDES="-I$withval")
AC_ARG_WITH(jpeg-libraries,
AS_HELP_STRING([--with-jpeg-libraries=DIR], [libjpeg libraries are in DIR]),
JPEG_LIBS="-L$withval -ljpeg")
AC_MSG_CHECKING(for JPEG)
# Look for jpeglib.h
if test "$JPEG_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <stdio.h>
#include <jpeglib.h>],[int a;],[
JPEG_INCLUDES=""
], [
# jpeglib.h is not in the standard search path, try
# $prefix
jpeg_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <stdio.h>
#include <jpeglib.h>],[int a;],[
JPEG_INCLUDES="-I${prefix}/include"
], [
JPEG_INCLUDES="no"
])
INCLUDES=$jpeg_save_INCLUDES
])
fi
# Now for the libraries
if test "$JPEG_LIBS" = ""; then
jpeg_save_LIBS="$LIBS"
jpeg_save_INCLUDES="$INCLUDES"
LIBS="-ljpeg $LIBS"
INCLUDES="$JPEG_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <stdio.h>
#include <jpeglib.h>
],[jpeg_abort((void*)0)], [
JPEG_LIBS="-ljpeg"
], [
# libjpeg is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <stdio.h>
#include <jpeg.h>
],[jpeg_abort((void*)0)], [
JPEG_LIBS="-L${prefix}/lib -ljpeg"
], [
JPEG_LIBS=no
])
])
LIBS="$jpeg_save_LIBS"
INCLUDES="$jpeg_save_INCLUDES"
fi
AC_SUBST(JPEG_LIBS)
AC_SUBST(JPEG_INCLUDES)
# Print a helpful message
jpeg_libraries_result="$JPEG_LIBS"
jpeg_includes_result="$JPEG_INCLUDES"
if test x"$jpeg_libraries_result" = x""; then
jpeg_libraries_result="in default path"
fi
if test x"$jpeg_includes_result" = x""; then
jpeg_includes_result="in default path"
fi
if test "$jpeg_libraries_result" = "no"; then
jpeg_libraries_result="(none)"
fi
if test "$jpeg_includes_result" = "no"; then
jpeg_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $jpeg_libraries_result, headers $jpeg_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$JPEG_INCLUDES" != "no" && test "$JPEG_LIBS" != "no"; then
AC_DEFINE(HAVE_JPEG,1,[Define if you have jpeg libraries and header files.])
$1
else
JPEG_INCLUDES=""
JPEG_LIBS=""
$2
fi
])dnl

63
m4-safe/mkdir.m4 Normal file
View File

@ -0,0 +1,63 @@
dnl @synopsis AC_FUNC_MKDIR
dnl
dnl Check whether mkdir() is mkdir or _mkdir, and whether it takes one
dnl or two arguments.
dnl
dnl This macro can define HAVE_MKDIR, HAVE__MKDIR, and
dnl MKDIR_TAKES_ONE_ARG, which are expected to be used as follows:
dnl
dnl #if HAVE_MKDIR
dnl # if MKDIR_TAKES_ONE_ARG
dnl /* MinGW32 */
dnl # define mkdir(a, b) mkdir(a)
dnl # endif
dnl #else
dnl # if HAVE__MKDIR
dnl /* plain Windows 32 */
dnl # define mkdir(a, b) _mkdir(a)
dnl # else
dnl # error "Don't know how to create a directory on this system."
dnl # endif
dnl #endif
dnl
dnl @category C
dnl @author Alexandre Duret-Lutz <adl@gnu.org>
dnl @version 2003-12-28
dnl @license GPLWithACException
AC_DEFUN([AC_FUNC_MKDIR],
[AC_CHECK_FUNCS([mkdir _mkdir])
AC_CACHE_CHECK([whether mkdir takes one argument],
[ac_cv_mkdir_takes_one_arg],
[AC_TRY_COMPILE([
#include <sys/stat.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
], [mkdir (".");],
[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
[Define if mkdir takes only one argument.])
fi
])
dnl Note:
dnl =====
dnl I have not implemented the following suggestion because I don't have
dnl access to such a broken environment to test the macro. So I'm just
dnl appending the comments here in case you have, and want to fix
dnl AC_FUNC_MKDIR that way.
dnl
dnl |Thomas E. Dickey (dickey@herndon4.his.com) said:
dnl | it doesn't cover the problem areas (compilers that mistreat mkdir
dnl | may prototype it in dir.h and dirent.h, for instance).
dnl |
dnl |Alexandre:
dnl | Would it be sufficient to check for these headers and #include
dnl | them in the AC_TRY_COMPILE block? (and is AC_HEADER_DIRENT
dnl | suitable for this?)
dnl |
dnl |Thomas:
dnl | I think that might be a good starting point (with the set of recommended
dnl | ifdef's and includes for AC_HEADER_DIRENT, of course).

117
m4-safe/png.m4 Normal file
View File

@ -0,0 +1,117 @@
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_PNG[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find PNG libraries and headers
dnl
dnl Put compile stuff in PNG_INCLUDES
dnl Put link stuff in PNG_LIBS
dnl Define HAVE_PNG if found.
dnl
AC_DEFUN([FIND_PNG], [
AC_REQUIRE([AC_PATH_XTRA])
PNG_INCLUDES=""
PNG_LIBS=""
AC_ARG_WITH(png,
AS_HELP_STRING([--without-png], [build without libpng (default: test)]))
# Treat --without-png like --without-png-includes --without-png-libraries.
if test "$with_png" = "no"; then
PNG_INCLUDES=no
PNG_LIBS=no
fi
AC_ARG_WITH(png-includes,
AS_HELP_STRING([--with-png-includes=DIR], [libpng includes are in DIR]),
PNG_INCLUDES="-I$withval")
AC_ARG_WITH(png-libraries,
AS_HELP_STRING([--with-png-libraries=DIR], [libpng libraries are in DIR]),
PNG_LIBS="-L$withval -lpng")
AC_MSG_CHECKING(for libpng)
# Look for png.h
if test "$PNG_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <png.h>],[int a;],[
PNG_INCLUDES=""
], [
# png.h is not in the standard search path, try
# $prefix
png_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <png.h>],[int a;],[
PNG_INCLUDES="-I${prefix}/include"
], [
PNG_INCLUDES="no"
])
INCLUDES=$png_save_INCLUDES
])
fi
# Now for the libraries
if test "$PNG_LIBS" = ""; then
png_save_LIBS="$LIBS"
png_save_INCLUDES="$INCLUDES"
LIBS="-lpng $LIBS"
INCLUDES="$PNG_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [
PNG_LIBS="-lpng"
], [
# libpng is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [
PNG_LIBS="-L${prefix}/lib -lpng"
], [
PNG_LIBS=no
])
])
LIBS="$png_save_LIBS"
INCLUDES="$png_save_INCLUDES"
fi
AC_SUBST(PNG_LIBS)
AC_SUBST(PNG_INCLUDES)
# Print a helpful message
png_libraries_result="$PNG_LIBS"
png_includes_result="$PNG_INCLUDES"
if test x"$png_libraries_result" = x""; then
png_libraries_result="in default path"
fi
if test x"$png_includes_result" = x""; then
png_includes_result="in default path"
fi
if test "$png_libraries_result" = "no"; then
png_libraries_result="(none)"
fi
if test "$png_includes_result" = "no"; then
png_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $png_libraries_result, headers $png_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$PNG_INCLUDES" != "no" && test "$PNG_LIBS" != "no"; then
AC_DEFINE(HAVE_PNG,1,[Define if you have png libraries and header files.])
$1
else
PNG_INCLUDES=""
PNG_LIBS=""
$2
fi
])dnl

117
m4-safe/tiff.m4 Normal file
View File

@ -0,0 +1,117 @@
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_TIFF[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find TIFF libraries and headers
dnl
dnl Put compile stuff in TIFF_INCLUDES
dnl Put link stuff in TIFF_LIBS
dnl Define HAVE_TIFF if found
dnl
AC_DEFUN([FIND_TIFF], [
AC_REQUIRE([AC_PATH_XTRA])
TIFF_INCLUDES=""
TIFF_LIBS=""
AC_ARG_WITH(tiff,
AS_HELP_STRING([--without-tiff], [build without libtiff (default: test)]))
# Treat --without-tiff like --without-tiff-includes --without-tiff-libraries.
if test "$with_tiff" = "no"; then
TIFF_INCLUDES=no
TIFF_LIBS=no
fi
AC_ARG_WITH(tiff-includes,
AS_HELP_STRING([--with-tiff-includes=DIR], [libtiff includes are in DIR]),
TIFF_INCLUDES="-I$withval")
AC_ARG_WITH(tiff-libraries,
AS_HELP_STRING([--with-tiff-libraries=DIR], [libtiff libraries are in DIR]),
TIFF_LIBS="-L$withval -ltiff")
AC_MSG_CHECKING(for TIFF)
# Look for tiff.h
if test "$TIFF_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <tiff.h>],[int a;],[
TIFF_INCLUDES=""
], [
# tiff.h is not in the standard search path, try
# $prefix
tiff_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <tiff.h>],[int a;],[
TIFF_INCLUDES="-I${prefix}/include"
], [
TIFF_INCLUDES="no"
])
INCLUDES=$tiff_save_INCLUDES
])
fi
# Now for the libraries
if test "$TIFF_LIBS" = ""; then
tiff_save_LIBS="$LIBS"
tiff_save_INCLUDES="$INCLUDES"
LIBS="-ltiff -lm $LIBS"
INCLUDES="$TIFF_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [
TIFF_LIBS="-ltiff"
], [
# libtiff is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [
TIFF_LIBS="-L${prefix}/lib -ltiff"
], [
TIFF_LIBS=no
])
])
LIBS="$tiff_save_LIBS"
INCLUDES="$tiff_save_INCLUDES"
fi
AC_SUBST(TIFF_LIBS)
AC_SUBST(TIFF_INCLUDES)
# Print a helpful message
tiff_libraries_result="$TIFF_LIBS"
tiff_includes_result="$TIFF_INCLUDES"
if test x"$tiff_libraries_result" = x""; then
tiff_libraries_result="in default path"
fi
if test x"$tiff_includes_result" = x""; then
tiff_includes_result="in default path"
fi
if test "$tiff_libraries_result" = "no"; then
tiff_libraries_result="(none)"
fi
if test "$tiff_includes_result" = "no"; then
tiff_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $tiff_libraries_result, headers $tiff_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$TIFF_INCLUDES" != "no" && test "$TIFF_LIBS" != "no"; then
AC_DEFINE(HAVE_TIFF,1,[Define if you have tiff libraries and header files.])
$1
else
TIFF_INCLUDES=""
TIFF_LIBS=""
$2
fi
])dnl

119
m4-safe/webp.m4 Normal file
View File

@ -0,0 +1,119 @@
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_LIBWEBP[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ---------------------------------------------------
dnl
dnl Find webp libraries and headers ... useful for platforms which are missing
dnl the webp .pc file
dnl
dnl Put compile stuff in LIBWEBP_INCLUDES
dnl Put link stuff in LIBWEBP_LIBS
dnl Define HAVE_LIBWEBP if found.
dnl
AC_DEFUN([FIND_LIBWEBP], [
AC_REQUIRE([AC_PATH_XTRA])
LIBWEBP_INCLUDES=""
LIBWEBP_LIBS=""
AC_ARG_WITH(libwebp,
AS_HELP_STRING([--without-libwebp], [build without libwebp (default: test)]))
# Treat --without-libwebp like --without-libwebp-includes --without-libwebp-libraries.
if test "$with_libwebp" = "no"; then
LIBWEBP_INCLUDES=no
LIBWEBP_LIBS=no
fi
AC_ARG_WITH(libwebp-includes,
AS_HELP_STRING([--with-libwebp-includes=DIR], [libwebp includes are in DIR]),
LIBWEBP_INCLUDES="-I$withval")
AC_ARG_WITH(libwebp-libraries,
AS_HELP_STRING([--with-libwebp-libraries=DIR], [libwebp libraries are in DIR]),
LIBWEBP_LIBS="-L$withval -lwebp")
AC_MSG_CHECKING(for libwebp)
# Look for webp/decode.h
if test "$LIBWEBP_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
LIBWEBP_INCLUDES=""
], [
# webp/decode.h is not in the standard search path, try
# $prefix
libwebp_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
LIBWEBP_INCLUDES="-I${prefix}/include"
], [
LIBWEBP_INCLUDES="no"
])
INCLUDES=$libwebp_save_INCLUDES
])
fi
# Now for the libraries
if test "$LIBWEBP_LIBS" = ""; then
libwebp_save_LIBS="$LIBS"
libwebp_save_INCLUDES="$INCLUDES"
LIBS="-lwebp $LIBS"
INCLUDES="$LIBWEBP_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
LIBWEBP_LIBS="-lwebp"
], [
# libwebp is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
LIBWEBP_LIBS="-L${prefix}/lib -lwebp"
], [
LIBWEBP_LIBS=no
])
])
LIBS="$libwebp_save_LIBS"
INCLUDES="$libwebp_save_INCLUDES"
fi
AC_SUBST(LIBWEBP_LIBS)
AC_SUBST(LIBWEBP_INCLUDES)
# Print a helpful message
libwebp_libraries_result="$LIBWEBP_LIBS"
libwebp_includes_result="$LIBWEBP_INCLUDES"
if test x"$libwebp_libraries_result" = x""; then
libwebp_libraries_result="in default path"
fi
if test x"$libwebp_includes_result" = x""; then
libwebp_includes_result="in default path"
fi
if test "$libwebp_libraries_result" = "no"; then
libwebp_libraries_result="(none)"
fi
if test "$libwebp_includes_result" = "no"; then
libwebp_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $libwebp_libraries_result, headers $libwebp_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$LIBWEBP_INCLUDES" != "no" && test "$LIBWEBP_LIBS" != "no"; then
AC_DEFINE(HAVE_LIBWEBP,1,[Define if you have libwebp libraries and header files.])
$1
else
LIBWEBP_INCLUDES=""
LIBWEBP_LIBS=""
$2
fi
])dnl

117
m4-safe/zip.m4 Normal file
View File

@ -0,0 +1,117 @@
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
dnl
dnl FIND_ZIP[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
dnl ------------------------------------------------
dnl
dnl Find ZIP libraries and headers
dnl
dnl Put includes stuff in ZIP_INCLUDES
dnl Put link stuff in ZIP_LIBS
dnl Define HAVE_ZIP if found
dnl
AC_DEFUN([FIND_ZIP], [
AC_REQUIRE([AC_PATH_XTRA])
ZIP_INCLUDES=""
ZIP_LIBS=""
AC_ARG_WITH(zip,
AS_HELP_STRING([--without-zip], [build without libx (default: test)]))
# Treat --without-zip like --without-zip-includes --without-zip-libraries.
if test "$with_zip" = "no"; then
ZIP_INCLUDES=no
ZIP_LIBS=no
fi
AC_ARG_WITH(zip-includes,
AS_HELP_STRING([--with-zip-includes=DIR], [libz includes are in DIR]),
ZIP_INCLUDES="-I$withval")
AC_ARG_WITH(zip-libraries,
AS_HELP_STRING([--with-zip-libraries=DIR], [libz libraries are in DIR]),
ZIP_LIBS="-L$withval -lz")
AC_MSG_CHECKING(for ZIP)
# Look for zlib.h
if test "$ZIP_INCLUDES" = ""; then
# Check the standard search path
AC_TRY_COMPILE([#include <zlib.h>],[int a;],[
ZIP_INCLUDES=""
], [
# zlib.h is not in the standard search path, try
# $prefix
zip_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <zlib.h>],[int a;],[
ZIP_INCLUDES="-I${prefix}/include"
], [
ZIP_INCLUDES="no"
])
INCLUDES=$zip_save_INCLUDES
])
fi
# Now for the libraries
if test "$ZIP_LIBS" = ""; then
zip_save_LIBS="$LIBS"
zip_save_INCLUDES="$INCLUDES"
LIBS="-lz $LIBS"
INCLUDES="$ZIP_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [
ZIP_LIBS="-lz"
], [
# libz is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [
ZIP_LIBS="-L${prefix}/lib -lz"
], [
ZIP_LIBS=no
])
])
LIBS="$zip_save_LIBS"
INCLUDES="$zip_save_INCLUDES"
fi
AC_SUBST(ZIP_LIBS)
AC_SUBST(ZIP_INCLUDES)
# Print a helpful message
zip_libraries_result="$ZIP_LIBS"
zip_includes_result="$ZIP_INCLUDES"
if test x"$zip_libraries_result" = x""; then
zip_libraries_result="in default path"
fi
if test x"$zip_includes_result" = x""; then
zip_includes_result="in default path"
fi
if test "$zip_libraries_result" = "no"; then
zip_libraries_result="(none)"
fi
if test "$zip_includes_result" = "no"; then
zip_includes_result="(none)"
fi
AC_MSG_RESULT([libraries $zip_libraries_result, headers $zip_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$ZIP_INCLUDES" != "no" && test "$ZIP_LIBS" != "no"; then
AC_DEFINE(HAVE_ZIP,1,[Define if you have libz libraries and header files.])
$1
else
ZIP_LIBS=""
ZIP_INCLUDES=""
$2
fi
])dnl