3 dnl Process this file with autoconf to produce a configure script.
5 dnl Minor upgrades (compatible ABI): increment the package version
6 dnl (third field in two places below) and set the PNGLIB_RELEASE
9 dnl Major upgrades (incompatible ABI): increment the package major
10 dnl version (second field, or first if desired), set the minor
11 dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
12 dnl Makefile.am to upgrade the package name.
14 dnl This is here to prevent earlier autoconf from being used, it
15 dnl should not be necessary to regenerate configure if the time
16 dnl stamps are correct
19 dnl Version number stuff here:
21 AC_INIT([libpng],[1.6.0],[png-mng-implement@lists.sourceforge.net])
22 AC_CONFIG_MACRO_DIR([scripts])
24 # libpng does not follow GNU file name conventions (hence 'foreign')
25 # color-tests requires automake 1.11 or later
26 # silent-rules requires automake 1.11 or later
27 # dist-xz requires automake 1.11 or later
28 # 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
29 AM_INIT_AUTOMAKE([1.12.2 foreign dist-xz color-tests silent-rules serial-tests])
34 dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later
35 dnl version; aclocal.m4 will generate a failure if you use a prior version of
36 dnl automake, so the following is not necessary (and is not defined anyway):
37 dnl AM_PREREQ([1.11.2])
38 dnl stop configure from automagically running automake
45 dnl End of version number stuff
47 AC_CONFIG_SRCDIR([pngget.c])
48 AC_CONFIG_HEADERS([config.h])
50 # Checks for programs.
56 AC_CHECK_TOOL(SED, sed, :)
57 AC_CHECK_TOOL(AWK, awk, :)
62 dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any
63 dnl compatible later version may be used
67 # On Solaris 10 and 12 CPP gets set to cc -E, however this still
68 # does some input parsing. We need strict ANSI-C style tokenization,
71 AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
72 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[1.1.1 16BIT]])],
76 for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"
78 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[1.1.1 16BIT]])],
84 if test -n "$DFNCPP"; then
85 AC_MSG_RESULT([$DFNCPP])
88 AC_MSG_FAILURE([not found], 1)
91 # -Werror cannot be passed to GCC in CFLAGS because configure will fail (it
92 # checks the compiler with a program that generates a warning), add the
93 # following option to deal with this
95 [additional flags for the C compiler, use this for options that would]
96 [cause configure itself to fail])
98 AS_HELP_STRING([[[--enable-werror[=OPT]]]],
99 [Pass -Werror or the given argument to the compiler if it is supported]),
100 [test "$enable_werror" = "yes" && enable_werror="-Werror"
101 if test "$enable_werror" != "no"; then
103 CFLAGS="$enable_werror $CFLAGS"
104 AC_MSG_CHECKING([if the compiler allows $enable_werror])
107 [int main(int argc, char **argv){]
108 [return argv[argc-1][0];]
111 PNG_COPTS="$PNG_COPTS $enable_werror",
116 # Checks for header files.
118 AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
120 # Checks for typedefs, structures, and compiler characteristics.
126 # Checks for library functions.
128 AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
129 AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
130 AC_ARG_WITH(zlib-prefix,
131 AS_HELP_STRING([[[--with-zlib-prefix]]],
132 [prefix that may have been used in installed zlib]),
133 [ZPREFIX=${withval}],
135 AC_CHECK_LIB(z, zlibVersion, ,
136 AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
138 # The following is for pngvalid, to ensure it catches FP errors even on
139 # platforms that don't enable FP exceptions, the function appears in the math
140 # library (typically), it's not an error if it is not found.
141 AC_CHECK_LIB([m], [feenableexcept])
142 AC_CHECK_FUNCS([feenableexcept])
144 AC_MSG_CHECKING([if using Solaris linker])
145 SLD=`$LD --version 2>&1 | grep Solaris`
153 AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
155 AC_MSG_CHECKING([if libraries can be versioned])
156 # Special case for PE/COFF platforms: ld reports
157 # support for version-script, but doesn't actually
158 # DO anything with it.
160 *cygwin* | *mingw32* | *interix* )
161 have_ld_version_script=no
166 if test "$have_solaris_ld" = "yes"; then
167 GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
169 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
173 have_ld_version_script=yes
176 have_ld_version_script=no
178 AC_MSG_WARN(*** You have not enabled versioned symbols.)
183 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
185 if test "$have_ld_version_script" = "yes"; then
186 AC_MSG_CHECKING([for symbol prefix])
187 SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
188 | ${CPP-${CC-gcc} -E} - 2>&1 \
189 | ${EGREP-grep} "^PREFIX=" \
190 | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
191 AC_SUBST(SYMBOL_PREFIX)
192 AC_MSG_RESULT($SYMBOL_PREFIX)
195 # Substitutions for .in files
196 AC_SUBST(PNGLIB_VERSION)
197 AC_SUBST(PNGLIB_MAJOR)
198 AC_SUBST(PNGLIB_MINOR)
199 AC_SUBST(PNGLIB_RELEASE)
201 # Additional arguments (and substitutions)
202 # Allow the pkg-config directory to be set
203 AC_ARG_WITH(pkgconfigdir,
204 AS_HELP_STRING([[[--with-pkgconfigdir]]],
205 [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
206 [pkgconfigdir=${withval}],
207 [pkgconfigdir='${libdir}/pkgconfig'])
209 AC_SUBST([pkgconfigdir])
210 AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]])
212 # Make the *-config binary config scripts optional
213 AC_ARG_WITH(binconfigs,
214 AS_HELP_STRING([[[--with-binconfigs]]],
215 [Generate shell libpng-config scripts as well as pkg-config data]
216 [@<:@default=yes@:>@]),
217 [if test "${withval}" = no; then
219 AC_MSG_NOTICE([[libpng-config scripts will not be built]])
221 binconfigs='${binconfigs}'
223 [binconfigs='${binconfigs}'])
224 AC_SUBST([binconfigs])
226 # Support for prefixes to the API function names; this will generate defines
227 # at the start of the build to rename exported library functions
228 AC_ARG_WITH(libpng-prefix,
229 AS_HELP_STRING([[[--with-libpng-prefix]]],
230 [prefix libpng exported function (API) names with the given value]),
231 [if test "${withval:-no}" != "no"; then
232 AC_SUBST([PNG_PREFIX], [${withval}])
234 AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
236 # Because GCC by default assembles code with an executable stack, even though it
237 # compiles C code with a non-executable stack, it is necessary to do a fixup
238 # here (this may by GCC specific)
239 AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
241 AC_ARG_ENABLE([arm-neon],
242 AS_HELP_STRING([[[--enable-arm-neon]]], [Enable ARM NEON optimizations]),
243 [if test "${enableval}" = "yes"; then
244 AC_DEFINE([PNG_FILTER_OPTIMIZATIONS],
245 [png_init_filter_functions_neon],
246 [ARM NEON filter initialization function])
247 AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1],
250 AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
252 AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
254 # Config files, substituting as above
255 AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
256 AC_CONFIG_FILES([libpng-config:libpng-config.in],
257 [chmod +x libpng-config])