Bringing libpng-1.5.10 into the main branch
[AROS.git] / workbench / libs / png / configure.ac
blob023aba43b3d8a5c2413342327ba918ffbcd81358
1 # configure.ac
3 dnl Process this file with autoconf to produce a configure script.
4 dnl
5 dnl Minor upgrades (compatible ABI): increment the package version
6 dnl (third field in two places below) and set the PNGLIB_RELEASE
7 dnl variable.
8 dnl
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
17 AC_PREREQ(2.59)
19 dnl Version number stuff here:
21 AC_INIT([libpng], [1.5.10], [png-mng-implement@lists.sourceforge.net])
22 AM_INIT_AUTOMAKE
23 dnl stop configure from automagically running automake
24 AM_MAINTAINER_MODE
26 PNGLIB_VERSION=1.5.10
27 PNGLIB_MAJOR=1
28 PNGLIB_MINOR=5
29 PNGLIB_RELEASE=10
31 dnl End of version number stuff
33 AC_CONFIG_SRCDIR([pngget.c])
34 AM_CONFIG_HEADER(config.h)
36 # Checks for programs.
37 AC_LANG([C])
38 AC_PROG_CC
39 AM_PROG_AS
40 AC_PROG_LD
41 AC_PROG_CPP
42 AC_CHECK_TOOL(SED, sed, :)
43 AC_CHECK_TOOL(AWK, awk, :)
44 AC_PROG_INSTALL
45 AC_PROG_LN_S
46 AC_PROG_MAKE_SET
47 LT_INIT([win32-dll])
49 # On Solaris 10 and 12 CPP gets set to cc -E, however this still
50 # does some input parsing.  We need strict ANSI-C style tokenization,
51 # check this:
52 AC_REQUIRE_CPP
53 AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
54 AC_TRY_CPP([1.5.0 16BIT],
55    [DFNCPP="$CPP"],
56    [DFNCPP=""
57    sav_CPP="$CPP"
58    for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"; do
59       AC_TRY_CPP([1.5.0 16BIT],
60          [DFNCPP="$CPP"]
61          [break],,)
62    done
63    CPP="$sav_CPP"])
64 if test -n "$DFNCPP"; then
65    AC_MSG_RESULT([$DFNCPP])
66    AC_SUBST(DFNCPP)
67 else
68    AC_MSG_FAILURE([not found], 1)
71 # Checks for header files.
72 AC_HEADER_STDC
73 AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
75 # Checks for typedefs, structures, and compiler characteristics.
76 AC_C_CONST
77 AC_TYPE_SIZE_T
78 AC_STRUCT_TM
79 AC_C_RESTRICT
81 # Checks for library functions.
82 AC_FUNC_STRTOD
83 AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
84 AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
85 AC_ARG_WITH(zlib-prefix,
86    AC_HELP_STRING([--with-zlib-prefix],
87                   [prefix that may have been used in installed zlib]),
88                   [ZPREFIX=${withval}],
89                   [ZPREFIX='z_'])
90 AC_CHECK_LIB(z, zlibVersion, ,
91     AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, ,
92                  AC_ERROR([zlib not installed])))
94 # The following is for pngvalid, to ensure it catches FP errors even on
95 # platforms that don't enable FP exceptions, the function appears in the math
96 # library (typically), it's not an error if it is not found.
97 AC_CHECK_LIB([m], [feenableexcept])
98 AC_CHECK_FUNCS([feenableexcept])
100 LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
101 LIBPNG_DEFINES=$LIBPNG_DEFINES
102 AC_SUBST(LIBPNG_DEFINES)
104 AC_MSG_CHECKING([if using Solaris linker])
105 SLD=`$LD --version 2>&1 | grep Solaris`
106 if test "$SLD"; then
107     have_solaris_ld=yes
108     AC_MSG_RESULT(yes)
109 else
110     have_solaris_ld=no
111     AC_MSG_RESULT(no)
113 AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
115 AC_MSG_CHECKING([if libraries can be versioned])
116 # Special case for PE/COFF platforms: ld reports
117 # support for version-script, but doesn't actually
118 # DO anything with it.
119 case $host in
120 *cygwin* | *mingw32* | *interix* )
121     have_ld_version_script=no
122     AC_MSG_RESULT(no)
124 * )
126 if test "$have_solaris_ld" = "yes"; then
127     GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
128 else
129     GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
132 if test "$GLD"; then
133     have_ld_version_script=yes
134     AC_MSG_RESULT(yes)
135 else
136     have_ld_version_script=no
137     AC_MSG_RESULT(no)
138     AC_MSG_WARN(*** You have not enabled versioned symbols.)
141 esac
143 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
145 if test "$have_ld_version_script" = "yes"; then
146     AC_MSG_CHECKING([for symbol prefix])
147     SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
148                    | ${CPP-${CC-gcc} -E} - 2>&1 \
149                    | ${EGREP-grep} "^PREFIX=" \
150                    | ${SED-sed} "s:^PREFIX=::"`
151     AC_SUBST(SYMBOL_PREFIX)
152     AC_MSG_RESULT($SYMBOL_PREFIX)
155 # Substitutions for .in files
156 AC_SUBST(PNGLIB_VERSION)
157 AC_SUBST(PNGLIB_MAJOR)
158 AC_SUBST(PNGLIB_MINOR)
159 AC_SUBST(PNGLIB_RELEASE)
161 # Additional arguments (and substitutions)
162 # Allow the pkg-config directory to be set
163 AC_ARG_WITH(pkgconfigdir,
164         AC_HELP_STRING([--with-pkgconfigdir],
165         [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
166         [pkgconfigdir=${withval}],
167         [pkgconfigdir='${libdir}/pkgconfig'])
169 AC_SUBST([pkgconfigdir])
170 AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}])
172 # Make the *-config binary config scripts optional
173 AC_ARG_WITH(binconfigs,
174         AC_HELP_STRING([--with-binconfigs],
175                 [Generate shell libpng-config scripts as well as pkg-config data]
176                 [@<:@default=yes@:>@]),
177         [if test "${withval}" = no; then
178                 binconfigs=
179                 AC_MSG_NOTICE([libpng-config scripts will not be built])
180         else
181                 binconfigs='${binconfigs}'
182         fi],
183         [binconfigs='${binconfigs}'])
184 AC_SUBST([binconfigs])
186 # Because GCC by default assembles code with an executable stack, even though it
187 # compiles C code with a non-executable stack, it is necessary to do a fixup
188 # here (this may by GCC specific)
189 AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
191 AC_ARG_ENABLE([arm-neon],
192         AC_HELP_STRING([--enable-arm-neon], [Enable ARM NEON optimizations]),
193         [if test "${enableval}" = yes; then
194                 AC_DEFINE([PNG_ARM_NEON], [1], [Enable ARM NEON optimizations])
195                 AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1], [Align row buffers])
196         fi])
197 AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
199 # Config files, substituting as above
200 AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
201 AC_CONFIG_FILES([libpng-config:libpng-config.in],
202                 [chmod +x libpng-config])
204 AC_OUTPUT