blob: 34cc4b89674e42dfe75bab815cb6a19903e8756c [file] [log] [blame]
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -06001# configure.ac
2
3dnl Process this file with autoconf to produce a configure script.
4dnl
5dnl Minor upgrades (compatible ABI): increment the package version
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -05006dnl (third field in two places below) and set the PNGLIB_RELEASE
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -06007dnl variable.
8dnl
9dnl Major upgrades (incompatible ABI): increment the package major
10dnl version (second field, or first if desired), set the minor
11dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
12dnl Makefile.am to upgrade the package name.
13
14dnl This is here to prevent earlier autoconf from being used, it
15dnl should not be necessary to regenerate configure if the time
16dnl stamps are correct
17AC_PREREQ(2.59)
18
19dnl Version number stuff here:
20
Glenn Randers-Pehrsonc32de8c2011-11-11 20:23:42 -060021AC_INIT([libpng], [1.5.7beta03], [png-mng-implement@lists.sourceforge.net])
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060022AM_INIT_AUTOMAKE
23dnl stop configure from automagically running automake
24AM_MAINTAINER_MODE
25
Glenn Randers-Pehrsonc32de8c2011-11-11 20:23:42 -060026PNGLIB_VERSION=1.5.7beta03
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050027PNGLIB_MAJOR=1
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -060028PNGLIB_MINOR=5
Glenn Randers-Pehrson2b7d7302011-11-02 23:06:45 -050029PNGLIB_RELEASE=7
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060030
31dnl End of version number stuff
32
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060033AC_CONFIG_SRCDIR([pngget.c])
Glenn Randers-Pehrson73b064c2006-05-15 06:44:21 -050034AM_CONFIG_HEADER(config.h)
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060035
36# Checks for programs.
John Bowler71a10f22011-01-22 17:03:33 -060037AC_LANG([C])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060038AC_PROG_CC
Glenn Randers-Pehrson6d7705e2011-11-03 00:42:58 -050039AM_PROG_AS
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060040AC_PROG_LD
41AC_PROG_CPP
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060042AC_CHECK_TOOL(SED, sed, :)
Glenn Randers-Pehrsonc551c0d2010-03-16 07:52:34 -050043AC_CHECK_TOOL(AWK, awk, :)
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060044AC_PROG_INSTALL
45AC_PROG_LN_S
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060046AC_PROG_MAKE_SET
Glenn Randers-Pehrson9f650592010-08-11 08:06:11 -050047LT_INIT([win32-dll])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060048
John Bowler71a10f22011-01-22 17:03:33 -060049# 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:
52AC_REQUIRE_CPP
53AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
54AC_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"])
64if test -n "$DFNCPP"; then
65 AC_MSG_RESULT([$DFNCPP])
66 AC_SUBST(DFNCPP)
67else
68 AC_MSG_FAILURE([not found], 1)
69fi
70
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060071# Checks for header files.
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060072AC_HEADER_STDC
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060073AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060074
75# Checks for typedefs, structures, and compiler characteristics.
76AC_C_CONST
77AC_TYPE_SIZE_T
78AC_STRUCT_TM
John Bowlerfc45f682011-11-04 21:03:39 -050079AC_C_RESTRICT
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060080
81# Checks for library functions.
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060082AC_FUNC_STRTOD
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060083AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060084AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
Glenn Randers-Pehrson977f6eb2011-01-04 09:07:45 -060085AC_ARG_WITH(zlib-prefix,
86 AC_HELP_STRING([--with-zlib-prefix],
Glenn Randers-Pehrson571db952010-12-09 06:03:03 -060087 [prefix that may have been used in installed zlib]),
Glenn Randers-Pehrson977f6eb2011-01-04 09:07:45 -060088 [ZPREFIX=${withval}],
89 [ZPREFIX='z_'])
Glenn Randers-Pehrson571db952010-12-09 06:03:03 -060090AC_CHECK_LIB(z, zlibVersion, ,
Glenn Randers-Pehrson977f6eb2011-01-04 09:07:45 -060091 AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, ,
Glenn Randers-Pehrson571db952010-12-09 06:03:03 -060092 AC_ERROR([zlib not installed])))
93
John Bowlerfc45f682011-11-04 21:03:39 -050094# 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.
97AC_CHECK_LIB([m], [feenableexcept])
98AC_CHECK_FUNCS([feenableexcept])
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060099
Glenn Randers-Pehrsona24fc2e2010-02-19 14:11:03 -0600100LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
Glenn Randers-Pehrson glennrp@comcast.net0a2547e2009-05-02 15:23:38 -0500101LIBPNG_DEFINES=$LIBPNG_DEFINES
Glenn Randers-Pehrson629330e2006-04-17 14:33:23 -0500102AC_SUBST(LIBPNG_DEFINES)
Glenn Randers-Pehrsonb511b602006-04-16 19:45:31 -0500103
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600104AC_MSG_CHECKING([if libraries can be versioned])
Glenn Randers-Pehrson83bd94f2011-09-01 14:06:49 -0500105
106AC_MSG_CHECKING([if using Solaris linker])
107SLD=`$LD --version 2>&1 | grep Solaris`
108if test "$SLD"; then
109 have_solaris_ld=yes
110 AC_MSG_RESULT(yes)
111else
112 have_solaris_ld=no
113 AC_MSG_RESULT(no)
114fi
115AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
116
Glenn Randers-Pehrsonccff3832011-09-09 07:55:25 -0500117# Special case for PE/COFF platforms: ld reports
118# support for version-script, but doesn't actually
119# DO anything with it.
120case $host in
121*cygwin* | *mingw32* | *interix* )
122 have_ld_version_script=no
123 AC_MSG_RESULT(no)
124;;
125* )
126
Glenn Randers-Pehrson83bd94f2011-09-01 14:06:49 -0500127if test "$have_solaris_ld" = "yes"; then
128 GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
129else
130 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
131fi
132
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600133if test "$GLD"; then
134 have_ld_version_script=yes
135 AC_MSG_RESULT(yes)
136else
137 have_ld_version_script=no
138 AC_MSG_RESULT(no)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500139 AC_MSG_WARN(*** You have not enabled versioned symbols.)
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600140fi
Glenn Randers-Pehrson9f650592010-08-11 08:06:11 -0500141;;
142esac
143
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600144AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600145
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500146if test "$have_ld_version_script" = "yes"; then
147 AC_MSG_CHECKING([for symbol prefix])
148 SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
149 | ${CPP-${CC-gcc} -E} - 2>&1 \
150 | ${EGREP-grep} "^PREFIX=" \
151 | ${SED-sed} "s:^PREFIX=::"`
152 AC_SUBST(SYMBOL_PREFIX)
153 AC_MSG_RESULT($SYMBOL_PREFIX)
154fi
155
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600156# Substitutions for .in files
157AC_SUBST(PNGLIB_VERSION)
158AC_SUBST(PNGLIB_MAJOR)
159AC_SUBST(PNGLIB_MINOR)
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500160AC_SUBST(PNGLIB_RELEASE)
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600161
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600162# Additional arguments (and substitutions)
163# Allow the pkg-config directory to be set
164AC_ARG_WITH(pkgconfigdir,
165 AC_HELP_STRING([--with-pkgconfigdir],
Glenn Randers-Pehrsonb511b602006-04-16 19:45:31 -0500166 [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600167 [pkgconfigdir=${withval}],
168 [pkgconfigdir='${libdir}/pkgconfig'])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600169
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600170AC_SUBST([pkgconfigdir])
171AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600172
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600173# Make the *-config binary config scripts optional
174AC_ARG_WITH(binconfigs,
175 AC_HELP_STRING([--with-binconfigs],
176 [Generate shell libpng-config scripts as well as pkg-config data]
177 [@<:@default=yes@:>@]),
178 [if test "${withval}" = no; then
179 binconfigs=
180 AC_MSG_NOTICE([libpng-config scripts will not be built])
181 else
182 binconfigs='${binconfigs}'
183 fi],
184 [binconfigs='${binconfigs}'])
185AC_SUBST([binconfigs])
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600186
Glenn Randers-Pehrsonc2d83992011-11-16 14:30:24 -0600187# Because GCC by default assembles code with an executable stack, even though it
188# compiles C code with a non-executable stack, it is necessary to do a fixup
189# here (this may by GCC specific)
190AC_SUBST([AM_CCASFLAGS], [--noexecstack])
191
Glenn Randers-Pehrson6d7705e2011-11-03 00:42:58 -0500192AC_ARG_ENABLE([arm-neon],
Glenn Randers-Pehrsonc2d83992011-11-16 14:30:24 -0600193 AC_HELP_STRING([--enable-arm-neon], [Enable ARM NEON optimizations]),
Glenn Randers-Pehrson6d7705e2011-11-03 00:42:58 -0500194 [if test "${enableval}" = yes; then
Glenn Randers-Pehrsonc2d83992011-11-16 14:30:24 -0600195 AC_DEFINE([PNG_ARM_NEON], [1], [Enable ARM NEON optimizations])
Glenn Randers-Pehrson6d7705e2011-11-03 00:42:58 -0500196 AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1], [Align row buffers])
197 fi])
198AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
199
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600200# Config files, substituting as above
Glenn Randers-Pehrsona687af12009-12-25 16:17:30 -0600201AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
Glenn Randers-Pehrson28d4aae2009-11-13 16:29:45 -0600202AC_CONFIG_FILES([libpng-config:libpng-config.in],
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600203 [chmod +x libpng-config])
204
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600205AC_OUTPUT