]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libpng/lib/dist/configure.ac
e6ff077da615d04bb2d77abbae15f5e3fb731106
[l4.git] / l4 / pkg / libpng / lib / dist / configure.ac
1 # configure.ac
2
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.
13
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.68])
18
19 dnl Version number stuff here:
20
21 AC_INIT([libpng],[1.6.0],[png-mng-implement@lists.sourceforge.net])
22 AC_CONFIG_MACRO_DIR([scripts])
23
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])
30 # was:
31 # AM_INIT_AUTOMAKE
32 AM_MAINTAINER_MODE
33
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
39
40 PNGLIB_VERSION=1.6.0
41 PNGLIB_MAJOR=1
42 PNGLIB_MINOR=6
43 PNGLIB_RELEASE=0
44
45 dnl End of version number stuff
46
47 AC_CONFIG_SRCDIR([pngget.c])
48 AC_CONFIG_HEADERS([config.h])
49
50 # Checks for programs.
51 AC_LANG([C])
52 AC_PROG_CC
53 AM_PROG_AS
54 LT_PATH_LD
55 AC_PROG_CPP
56 AC_CHECK_TOOL(SED, sed, :)
57 AC_CHECK_TOOL(AWK, awk, :)
58 AC_PROG_INSTALL
59 AC_PROG_LN_S
60 AC_PROG_MAKE_SET
61
62 dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any
63 dnl compatible later version may be used
64 LT_INIT([win32-dll])
65 LT_PREREQ([2.4.2])
66
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,
69 # check this:
70 AC_REQUIRE_CPP
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]])],
73    [DFNCPP="$CPP"],
74    [  DFNCPP=""
75       sav_CPP="$CPP"
76       for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"
77       do
78          AC_PREPROC_IFELSE([AC_LANG_SOURCE([[1.1.1 16BIT]])],
79             [DFNCPP="$CPP"]
80             [break],,)
81       done
82       CPP="$sav_CPP"
83    ])
84 if test -n "$DFNCPP"; then
85    AC_MSG_RESULT([$DFNCPP])
86    AC_SUBST(DFNCPP)
87 else
88    AC_MSG_FAILURE([not found], 1)
89 fi
90
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
94 AC_ARG_VAR(PNG_COPTS,
95    [additional flags for the C compiler, use this for options that would]
96    [cause configure itself to fail])
97 AC_ARG_ENABLE(werror,
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
102       sav_CFLAGS="$CFLAGS"
103       CFLAGS="$enable_werror $CFLAGS"
104       AC_MSG_CHECKING([if the compiler allows $enable_werror])
105       AC_COMPILE_IFELSE(
106          [AC_LANG_SOURCE([
107             [int main(int argc, char **argv){]
108             [return argv[argc-1][0];]
109             [}]])],
110          AC_MSG_RESULT(yes)
111          PNG_COPTS="$PNG_COPTS $enable_werror",
112          AC_MSG_RESULT(no))
113       CFLAGS="$sav_CFLAGS"
114     fi],)
115
116 # Checks for header files.
117 AC_HEADER_STDC
118 AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
119
120 # Checks for typedefs, structures, and compiler characteristics.
121 AC_C_CONST
122 AC_TYPE_SIZE_T
123 AC_STRUCT_TM
124 AC_C_RESTRICT
125
126 # Checks for library functions.
127 AC_FUNC_STRTOD
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}],
134       [ZPREFIX='z_'])
135 AC_CHECK_LIB(z, zlibVersion, ,
136     AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
137
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])
143
144 AC_MSG_CHECKING([if using Solaris linker])
145 SLD=`$LD --version 2>&1 | grep Solaris`
146 if test "$SLD"; then
147     have_solaris_ld=yes
148     AC_MSG_RESULT(yes)
149 else
150     have_solaris_ld=no
151     AC_MSG_RESULT(no)
152 fi
153 AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
154
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.
159 case $host in
160 *cygwin* | *mingw32* | *interix* )
161     have_ld_version_script=no
162     AC_MSG_RESULT(no)
163 ;;
164 * )
165
166 if test "$have_solaris_ld" = "yes"; then
167     GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
168 else
169     GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
170 fi
171
172 if test "$GLD"; then
173     have_ld_version_script=yes
174     AC_MSG_RESULT(yes)
175 else
176     have_ld_version_script=no
177     AC_MSG_RESULT(no)
178     AC_MSG_WARN(*** You have not enabled versioned symbols.)
179 fi
180 ;;
181 esac
182
183 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
184
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)
193 fi
194
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)
200
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'])
208
209 AC_SUBST([pkgconfigdir])
210 AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]])
211
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
218       binconfigs=
219       AC_MSG_NOTICE([[libpng-config scripts will not be built]])
220     else
221       binconfigs='${binconfigs}'
222     fi],
223    [binconfigs='${binconfigs}'])
224 AC_SUBST([binconfigs])
225
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}])
233     fi])
234 AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
235
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])
240
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],
248                 [Align row buffers])
249     fi])
250 AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
251
252 AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
253
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])
258
259 AC_OUTPUT