2013-04-06 15:12:32 -07:00
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
# Configure template for gd library
|
|
|
|
|
2015-11-23 13:50:08 -08:00
|
|
|
AC_PREREQ(2.64)
|
2013-04-06 15:12:32 -07:00
|
|
|
|
2013-11-04 14:11:33 -08:00
|
|
|
# We extract version numbers from src/versions.h
|
|
|
|
define([gv],[perl config/getver.pl ]$1)
|
2013-05-13 07:18:40 -07:00
|
|
|
|
2013-11-04 14:11:33 -08:00
|
|
|
m4_define([gd_MAJOR],esyscmd(gv(MAJOR)))dnl
|
|
|
|
m4_define([gd_MINOR],esyscmd(gv(MINOR)))dnl
|
|
|
|
m4_define([gd_REVISION],esyscmd(gv(RELEASE)))dnl
|
|
|
|
m4_define([gd_EXTRA],esyscmd(gv(EXTRA)))dnl
|
|
|
|
m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION]gd_EXTRA)]dnl
|
2013-05-13 07:18:40 -07:00
|
|
|
|
2015-01-22 01:35:46 -08:00
|
|
|
AC_INIT([GD], gd_PKG_VERSION, [https://github.com/libgd/libgd/issues], [libgd], [http://lib.gd])
|
2013-04-06 15:12:32 -07:00
|
|
|
AC_CONFIG_SRCDIR([src/gd.c])
|
|
|
|
AC_CONFIG_AUX_DIR(config)
|
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2013-04-16 11:42:47 -07:00
|
|
|
AC_CANONICAL_HOST
|
2013-04-06 15:12:32 -07:00
|
|
|
|
2013-11-04 14:11:33 -08:00
|
|
|
# This is not used anywhere. However, Makefile.netware searches
|
|
|
|
# through configure for these definitions to find the version numbers.
|
|
|
|
# (Assuming anyone still uses Netware, that should be changed to use
|
|
|
|
# gd.h via getver.pl instead.)
|
2013-05-13 07:18:40 -07:00
|
|
|
GDLIB_MAJOR=gd_MAJOR
|
|
|
|
GDLIB_MINOR=gd_MINOR
|
|
|
|
GDLIB_REVISION=gd_REVISION
|
|
|
|
GDLIB_EXTRA=gd_EXTRA
|
2013-06-26 08:09:02 -07:00
|
|
|
GDLIB_VERSION=gd_PKG_VERSION
|
2013-04-08 00:27:45 -07:00
|
|
|
|
2015-01-20 20:06:39 -08:00
|
|
|
AC_SUBST(GDLIB_MAJOR)
|
|
|
|
AC_SUBST(GDLIB_MINOR)
|
|
|
|
AC_SUBST(GDLIB_REVISION)
|
|
|
|
AC_SUBST(GDLIB_EXTRA)
|
|
|
|
AC_SUBST(GDLIB_VERSION)
|
|
|
|
|
2013-04-08 00:27:45 -07:00
|
|
|
# Dynamic library version information
|
|
|
|
# See http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
|
2013-11-04 14:11:33 -08:00
|
|
|
|
2013-04-08 00:46:59 -07:00
|
|
|
GDLIB_CURRENT=3
|
|
|
|
GDLIB_REVISION=0
|
2013-04-12 05:53:48 -07:00
|
|
|
GDLIB_AGE=0
|
2013-04-08 00:37:55 -07:00
|
|
|
AC_SUBST(GDLIB_CURRENT)
|
|
|
|
AC_SUBST(GDLIB_REVISION)
|
|
|
|
AC_SUBST(GDLIB_AGE)
|
2013-04-08 00:27:45 -07:00
|
|
|
|
2013-04-06 15:12:32 -07:00
|
|
|
#Expanded by tests later in this file. TBB 2.0.26
|
|
|
|
#2.0.28: GIF is standard now. Doesn't depend on anything else,
|
|
|
|
#so we always build it.
|
|
|
|
FEATURES="GD_GIF GD_GIFANIM GD_OPENPOLYGON"
|
|
|
|
AC_SUBST(FEATURES)
|
|
|
|
|
2015-11-23 13:50:08 -08:00
|
|
|
AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2 dist-xz -Wall -Werror subdir-objects])
|
2013-04-08 00:12:06 -07:00
|
|
|
AC_CONFIG_HEADERS([src/config.h:src/config.hin])
|
2013-04-06 15:12:32 -07:00
|
|
|
|
2013-04-16 11:53:15 -07:00
|
|
|
AM_PROG_AR
|
2013-05-22 02:07:40 -07:00
|
|
|
AC_PROG_CC_STDC
|
2013-04-22 02:09:08 -07:00
|
|
|
AM_PROG_CC_C_O
|
2013-04-06 15:12:32 -07:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
AC_PROG_LN_S
|
|
|
|
AC_PROG_MAKE_SET
|
2013-05-10 12:07:58 -07:00
|
|
|
LT_INIT([win32-dll])
|
2013-04-16 12:22:52 -07:00
|
|
|
PKG_PROG_PKG_CONFIG
|
2013-04-06 15:12:32 -07:00
|
|
|
|
|
|
|
dnl may be required for freetype and Xpm
|
|
|
|
AC_PATH_X
|
|
|
|
|
|
|
|
if test -n "$x_includes" && test "x$x_includes" != xNONE ; then
|
2013-04-12 05:53:48 -07:00
|
|
|
CFLAGS="$CFLAGS -I$x_includes"
|
2013-04-06 15:12:32 -07:00
|
|
|
fi
|
|
|
|
if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
|
|
|
|
LDFLAGS="$LDFLAGS -L$x_libraries"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_CHECK_HEADERS([errno.h limits.h stddef.h stdlib.h string.h unistd.h])
|
|
|
|
|
2013-04-16 14:47:09 -07:00
|
|
|
dnl if we're configuring on a system w/out gettext, don't fall over
|
|
|
|
m4_ifndef([AM_ICONV],[m4_define([AM_ICONV],[:])])
|
2013-04-06 15:12:32 -07:00
|
|
|
AM_ICONV
|
|
|
|
# if test -n "$LIBICONV" ; then
|
|
|
|
# LIBS="$LIBS $LIBICONV"
|
|
|
|
# fi
|
|
|
|
|
|
|
|
AC_CHECK_HEADERS(iconv.h,
|
|
|
|
[AC_MSG_CHECKING(whether iconv.h defines iconv_t)
|
|
|
|
AC_EGREP_HEADER([typedef.*iconv_t],iconv.h,
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_ICONV_T_DEF, 1,
|
|
|
|
[Define if <iconv.h> defines iconv_t.])],
|
|
|
|
AC_MSG_RESULT(no))])
|
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
#AC_C_CONST
|
|
|
|
#AC_TYPE_SIZE_T
|
|
|
|
|
|
|
|
# Checks for library functions.
|
|
|
|
#AC_FUNC_ERROR_AT_LINE
|
|
|
|
#AC_FUNC_MALLOC
|
|
|
|
#AC_FUNC_REALLOC
|
|
|
|
#AC_FUNC_VPRINTF
|
|
|
|
#AC_CHECK_FUNCS([floor memset sqrt strchr strdup strtol])
|
|
|
|
|
|
|
|
dnl do we need to specify -lm explicitly?
|
|
|
|
AC_CHECK_FUNC(sin,,[AC_CHECK_LIB(m,sin)])
|
|
|
|
|
2015-11-23 16:06:46 -08:00
|
|
|
dnl Helper macro for working with external libraries.
|
|
|
|
dnl GD_LIB_CHECK([SYM], [FEATURE], [name], [...test...])
|
|
|
|
dnl $1 - upper case symbol
|
|
|
|
dnl $2 - GD feature name to track
|
|
|
|
dnl $3 - lower case name for user
|
|
|
|
dnl $4 - test for the feature
|
|
|
|
dnl The test code should set gd_found_lib=yes to indicate success.
|
|
|
|
m4_define([GD_LIB_CHECK], [dnl
|
|
|
|
dnl Export the flag for the user to leverage. No other logic here.
|
|
|
|
AC_MSG_CHECKING([whether to support $3])
|
|
|
|
AC_ARG_WITH([$3],
|
|
|
|
[AS_HELP_STRING([--with-$3@<:@=DIR@:>@], [Support $3 (optionally in DIR)])],
|
|
|
|
[gd_with_lib=$withval],
|
|
|
|
[gd_with_lib=auto])
|
|
|
|
AC_MSG_RESULT([$gd_with_lib])
|
|
|
|
|
|
|
|
gd_found_lib=no
|
|
|
|
if test "$gd_with_lib" != "no"; then
|
|
|
|
save_CPPFLAGS=$CPPFLAGS
|
|
|
|
save_LDFLAGS=$LDFLAGS
|
|
|
|
dnl Set up default libs/cflags vars based on the path if user gave us one.
|
|
|
|
gd_lib_ldflags=
|
|
|
|
gd_lib_cflags=
|
|
|
|
case $gd_with_lib in
|
|
|
|
yes|no|auto|"") ;;
|
|
|
|
*)
|
|
|
|
if test -d "$gd_with_lib/lib"; then
|
|
|
|
gd_lib_ldflags="-L$gd_with_lib/lib"
|
|
|
|
AS_VAR_APPEND([LDFLAGS], [" $gd_lib_ldflags"])
|
|
|
|
fi
|
|
|
|
if test -d "$gd_with_lib/include"; then
|
|
|
|
gd_lib_cflags="-I$gd_with_lib/include"
|
|
|
|
AS_VAR_APPEND([CPPFLAGS], [" $gd_lib_cflags"])
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
dnl Run the test for this feature.
|
|
|
|
$4
|
|
|
|
CPPFLAGS=$save_CPPFLAGS
|
|
|
|
LDFLAGS=$save_LDFLAGS
|
|
|
|
|
|
|
|
if test "$gd_found_lib" = "yes"; then
|
|
|
|
AC_DEFINE([HAVE_$1], [1], [Define if you have $3])
|
|
|
|
AS_VAR_APPEND([FEATURES], [" GD_$2"])
|
|
|
|
dnl Merge the flags into the main LIBS/CPPFLAGS.
|
|
|
|
$1][_LIBS="$gd_lib_ldflags $][$1][_LIBS"
|
|
|
|
$1][_CFLAGS="$gd_lib_cflags $][$1][_CFLAGS"
|
|
|
|
AS_VAR_APPEND([LIBS], [" $][$1][_LIBS"])
|
|
|
|
AS_VAR_APPEND([CPPFLAGS], [" $][$1][_CFLAGS"])
|
|
|
|
elif test "$gd_with_lib" = "yes"; then
|
|
|
|
AC_MSG_ERROR([$3 requested but not found])
|
|
|
|
else
|
|
|
|
AC_MSG_NOTICE([Disabling support for $3])
|
2013-04-06 15:12:32 -07:00
|
|
|
fi
|
2015-11-23 16:06:46 -08:00
|
|
|
fi
|
|
|
|
AM_CONDITIONAL([HAVE_$1], test "$gd_found_lib" = yes)
|
|
|
|
gd_with_$1=$gd_found_lib
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl Helper macro for working with external libraries with pkg-config support.
|
|
|
|
dnl GD_LIB_PKG_CHECK([SYM], [FEATURE], [name], [pkg-config module], [...fallback test...])
|
|
|
|
dnl $1 - upper case symbol
|
|
|
|
dnl $2 - GD feature name to track
|
|
|
|
dnl $3 - lower case name for user
|
|
|
|
dnl $4 - pkg-config module to look for
|
|
|
|
dnl $5 - fallback test for the feature
|
|
|
|
m4_define([GD_LIB_PKG_CHECK], [dnl
|
|
|
|
GD_LIB_CHECK([$1], [$2], [$3], [dnl
|
|
|
|
PKG_CHECK_MODULES([$1], [$4], [gd_found_lib=yes], [$5])
|
2013-04-16 12:22:52 -07:00
|
|
|
])
|
2015-11-23 16:06:46 -08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl Check for zlib support.
|
|
|
|
GD_LIB_PKG_CHECK([LIBZ], [ZLIB], [zlib], [zlib], [dnl
|
|
|
|
AC_CHECK_LIB([z], [deflate], [dnl
|
|
|
|
AS_VAR_APPEND([LIBZ_LIBS], [" -lz"])
|
|
|
|
gd_found_lib=yes
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl Check for libpng support.
|
|
|
|
GD_LIB_PKG_CHECK([LIBPNG], [PNG], [png], [libpng], [
|
|
|
|
LIBPNG_CONFIG=$gd_with_lib/bin/libpng-config
|
2013-04-16 12:22:52 -07:00
|
|
|
if test -e "$LIBPNG_CONFIG"; then
|
|
|
|
LIBPNG_CFLAGS=`$LIBPNG_CONFIG --cflags`
|
2013-06-20 18:03:45 -07:00
|
|
|
LIBPNG_LIBS=`$LIBPNG_CONFIG --ldflags`
|
2015-11-23 16:06:46 -08:00
|
|
|
gd_found_lib=yes
|
2013-04-06 15:12:32 -07:00
|
|
|
fi
|
2015-11-23 16:06:46 -08:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl Check for FreeType support.
|
|
|
|
GD_LIB_PKG_CHECK([LIBFREETYPE], [FREETYPE], [freetype], [freetype2 >= 9.8.3], [
|
|
|
|
FREETYPE_CONFIG=$gd_with_lib/bin/freetype-config
|
2013-04-16 12:22:52 -07:00
|
|
|
if test -e "$FREETYPE_CONFIG"; then
|
|
|
|
LIBFREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
|
|
|
|
LIBFREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
|
2015-11-23 16:06:46 -08:00
|
|
|
gd_found_lib=yes
|
2013-04-06 15:12:32 -07:00
|
|
|
fi
|
2015-11-23 16:06:46 -08:00
|
|
|
])
|
|
|
|
if test "$gd_with_LIBFREETYPE" = "yes"; then
|
|
|
|
AC_DEFINE([HAVE_FT2BUILD_H], [1], [Define if you have the ft2build.h header.])
|
2013-04-06 15:12:32 -07:00
|
|
|
fi
|
2015-11-23 16:06:46 -08:00
|
|
|
|
|
|
|
dnl Check for fontconfig support.
|
|
|
|
GD_LIB_PKG_CHECK([LIBFONTCONFIG], [FONTCONFIG], [fontconfig], [fontconfig], [
|
|
|
|
AC_CHECK_LIB([fontconfig], [FcInit], [dnl
|
|
|
|
AS_VAR_APPEND([LIBFONTCONFIG_LIBS], [" -lfontconfig"])
|
|
|
|
gd_found_lib=yes
|
2013-05-21 10:36:20 -07:00
|
|
|
])
|
2015-11-23 16:06:46 -08:00
|
|
|
])
|
2013-05-20 15:36:07 -07:00
|
|
|
|
2015-11-23 16:06:46 -08:00
|
|
|
dnl Check for jpeg support.
|
|
|
|
GD_LIB_CHECK([LIBJPEG], [JPEG], [jpeg], [
|
|
|
|
AC_CHECK_LIB([jpeg], [jpeg_set_defaults], [dnl
|
|
|
|
AS_VAR_APPEND([LIBJPEG_LIBS], [" -ljpeg"])
|
|
|
|
gd_found_lib=yes
|
2013-05-21 10:36:20 -07:00
|
|
|
])
|
2015-11-23 16:06:46 -08:00
|
|
|
])
|
2013-05-20 15:36:07 -07:00
|
|
|
|
2015-11-23 16:06:46 -08:00
|
|
|
dnl Check for xpm support.
|
|
|
|
GD_LIB_PKG_CHECK([LIBXPM], [XPM], [xpm], [xpm], [
|
|
|
|
AC_CHECK_LIB([Xpm], [XpmReadFileToXpmImage], [dnl
|
|
|
|
AS_VAR_APPEND([LIBXPM_LIBS], [" -lXpm"])
|
|
|
|
gd_found_lib=yes
|
|
|
|
])
|
|
|
|
])
|
2013-04-06 15:12:32 -07:00
|
|
|
|
2015-11-23 16:06:46 -08:00
|
|
|
dnl Check for tiff support.
|
|
|
|
GD_LIB_PKG_CHECK([LIBTIFF], [TIFF], [tiff], [libtiff-4], [
|
|
|
|
AC_CHECK_LIB([tiff], [TIFFClientOpen], [dnl
|
|
|
|
AS_VAR_APPEND([LIBTIFF_LIBS], [" -ltiff"])
|
|
|
|
gd_found_lib=yes
|
2013-05-21 10:36:20 -07:00
|
|
|
])
|
2015-11-23 16:06:46 -08:00
|
|
|
])
|
2013-05-20 15:36:07 -07:00
|
|
|
|
2015-11-23 16:06:46 -08:00
|
|
|
dnl Check for webp support.
|
|
|
|
GD_LIB_CHECK([LIBWEBP], [WEBP], [webp], [
|
|
|
|
AC_CHECK_LIB([webp], [WebPGetInfo], [dnl
|
|
|
|
AS_VAR_APPEND([LIBWEBP_LIBS], [" -lwebp"])
|
|
|
|
gd_found_lib=yes
|
|
|
|
])
|
|
|
|
])
|
2013-04-07 11:55:40 -07:00
|
|
|
|
2013-04-12 05:53:48 -07:00
|
|
|
gl_VISIBILITY()
|
|
|
|
CFLAGS="$CFLAGS $CFLAG_VISIBILITY"
|
2013-04-07 11:55:40 -07:00
|
|
|
|
2013-04-08 00:12:06 -07:00
|
|
|
AX_PTHREAD()
|
2013-04-06 15:12:32 -07:00
|
|
|
|
2013-04-22 20:36:16 -07:00
|
|
|
MINGW_AC_WIN32_NATIVE_HOST()
|
|
|
|
|
2013-05-02 00:06:49 -07:00
|
|
|
if test "$mingw_cv_win32_host" = yes; then
|
2013-04-22 20:36:16 -07:00
|
|
|
AC_DEFINE([BGDWIN32], [], [Define is you are building for Win32 API])
|
|
|
|
fi
|
|
|
|
|
2013-04-06 15:12:32 -07:00
|
|
|
dnl report configuration
|
|
|
|
AC_MSG_RESULT([
|
|
|
|
** Configuration summary for $PACKAGE $VERSION:
|
|
|
|
|
2015-11-23 16:06:46 -08:00
|
|
|
Support for Zlib: $gd_with_LIBZ
|
|
|
|
Support for PNG library: $gd_with_LIBPNG
|
|
|
|
Support for JPEG library: $gd_with_LIBJPEG
|
|
|
|
Support for WebP library: $gd_with_LIBWEBP
|
|
|
|
Support for TIFF library: $gd_with_LIBTIFF
|
|
|
|
Support for Freetype 2.x library: $gd_with_LIBFREETYPE
|
|
|
|
Support for Fontconfig library: $gd_with_LIBFONTCONFIG
|
|
|
|
Support for Xpm library: $gd_with_LIBXPM
|
2013-04-12 01:35:08 -07:00
|
|
|
Support for pthreads: $ax_pthread_ok
|
2013-04-06 15:12:32 -07:00
|
|
|
])
|
|
|
|
|
2013-04-08 00:12:06 -07:00
|
|
|
AC_CONFIG_FILES([Makefile
|
|
|
|
src/Makefile
|
2013-11-04 14:11:33 -08:00
|
|
|
tests/Makefile
|
|
|
|
tests/test_config.h
|
2013-04-08 00:12:06 -07:00
|
|
|
config/Makefile
|
2013-04-14 00:42:14 -07:00
|
|
|
config/gdlib-config
|
2013-11-04 14:11:33 -08:00
|
|
|
config/gdlib.pc])
|
2013-04-06 15:12:32 -07:00
|
|
|
|
|
|
|
AC_OUTPUT
|