Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 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 |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 6 | dnl (third field in two places below) and set the PNGLIB_RELEASE |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 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.59) |
| 18 | |
| 19 | dnl Version number stuff here: |
| 20 | |
Glenn Randers-Pehrson | 67ee8ce | 2011-12-22 08:21:00 -0600 | [diff] [blame] | 21 | AC_INIT([libpng], [1.6.0beta04], [png-mng-implement@lists.sourceforge.net]) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 22 | AM_INIT_AUTOMAKE |
| 23 | dnl stop configure from automagically running automake |
| 24 | AM_MAINTAINER_MODE |
| 25 | |
Glenn Randers-Pehrson | 67ee8ce | 2011-12-22 08:21:00 -0600 | [diff] [blame] | 26 | PNGLIB_VERSION=1.6.0beta04 |
Glenn Randers-Pehrson | 8568f6e | 2009-07-28 17:20:26 -0500 | [diff] [blame] | 27 | PNGLIB_MAJOR=1 |
Glenn Randers-Pehrson | 15ea1fa | 2011-11-23 15:28:01 -0600 | [diff] [blame] | 28 | PNGLIB_MINOR=6 |
| 29 | PNGLIB_RELEASE=0 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 30 | |
| 31 | dnl End of version number stuff |
| 32 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 33 | AC_CONFIG_SRCDIR([pngget.c]) |
Glenn Randers-Pehrson | 73b064c | 2006-05-15 06:44:21 -0500 | [diff] [blame] | 34 | AM_CONFIG_HEADER(config.h) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 35 | |
| 36 | # Checks for programs. |
John Bowler | 71a10f2 | 2011-01-22 17:03:33 -0600 | [diff] [blame] | 37 | AC_LANG([C]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 38 | AC_PROG_CC |
Glenn Randers-Pehrson | 6d7705e | 2011-11-03 00:42:58 -0500 | [diff] [blame] | 39 | AM_PROG_AS |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 40 | AC_PROG_LD |
| 41 | AC_PROG_CPP |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 42 | AC_CHECK_TOOL(SED, sed, :) |
Glenn Randers-Pehrson | c551c0d | 2010-03-16 07:52:34 -0500 | [diff] [blame] | 43 | AC_CHECK_TOOL(AWK, awk, :) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 44 | AC_PROG_INSTALL |
| 45 | AC_PROG_LN_S |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 46 | AC_PROG_MAKE_SET |
Glenn Randers-Pehrson | 9f65059 | 2010-08-11 08:06:11 -0500 | [diff] [blame] | 47 | LT_INIT([win32-dll]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 48 | |
John Bowler | 71a10f2 | 2011-01-22 17:03:33 -0600 | [diff] [blame] | 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) |
| 69 | fi |
| 70 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 71 | # Checks for header files. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 72 | AC_HEADER_STDC |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 73 | AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 74 | |
| 75 | # Checks for typedefs, structures, and compiler characteristics. |
| 76 | AC_C_CONST |
| 77 | AC_TYPE_SIZE_T |
| 78 | AC_STRUCT_TM |
John Bowler | fc45f68 | 2011-11-04 21:03:39 -0500 | [diff] [blame] | 79 | AC_C_RESTRICT |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 80 | |
| 81 | # Checks for library functions. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 82 | AC_FUNC_STRTOD |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 83 | AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc])) |
Glenn Randers-Pehrson | 5c60b23 | 2006-03-07 07:09:22 -0600 | [diff] [blame] | 84 | AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) ) |
Glenn Randers-Pehrson | 977f6eb | 2011-01-04 09:07:45 -0600 | [diff] [blame] | 85 | AC_ARG_WITH(zlib-prefix, |
| 86 | AC_HELP_STRING([--with-zlib-prefix], |
Glenn Randers-Pehrson | 571db95 | 2010-12-09 06:03:03 -0600 | [diff] [blame] | 87 | [prefix that may have been used in installed zlib]), |
Glenn Randers-Pehrson | 977f6eb | 2011-01-04 09:07:45 -0600 | [diff] [blame] | 88 | [ZPREFIX=${withval}], |
| 89 | [ZPREFIX='z_']) |
Glenn Randers-Pehrson | 571db95 | 2010-12-09 06:03:03 -0600 | [diff] [blame] | 90 | AC_CHECK_LIB(z, zlibVersion, , |
Glenn Randers-Pehrson | 977f6eb | 2011-01-04 09:07:45 -0600 | [diff] [blame] | 91 | AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , |
Glenn Randers-Pehrson | 571db95 | 2010-12-09 06:03:03 -0600 | [diff] [blame] | 92 | AC_ERROR([zlib not installed]))) |
| 93 | |
John Bowler | fc45f68 | 2011-11-04 21:03:39 -0500 | [diff] [blame] | 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]) |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 99 | |
Glenn Randers-Pehrson | 83bd94f | 2011-09-01 14:06:49 -0500 | [diff] [blame] | 100 | AC_MSG_CHECKING([if using Solaris linker]) |
| 101 | SLD=`$LD --version 2>&1 | grep Solaris` |
| 102 | if test "$SLD"; then |
| 103 | have_solaris_ld=yes |
| 104 | AC_MSG_RESULT(yes) |
| 105 | else |
| 106 | have_solaris_ld=no |
| 107 | AC_MSG_RESULT(no) |
| 108 | fi |
| 109 | AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes") |
| 110 | |
Gilles Espinasse | f87ef8b | 2011-12-26 13:10:01 -0600 | [diff] [blame^] | 111 | AC_MSG_CHECKING([if libraries can be versioned]) |
Glenn Randers-Pehrson | ccff383 | 2011-09-09 07:55:25 -0500 | [diff] [blame] | 112 | # Special case for PE/COFF platforms: ld reports |
| 113 | # support for version-script, but doesn't actually |
| 114 | # DO anything with it. |
| 115 | case $host in |
| 116 | *cygwin* | *mingw32* | *interix* ) |
| 117 | have_ld_version_script=no |
| 118 | AC_MSG_RESULT(no) |
| 119 | ;; |
| 120 | * ) |
| 121 | |
Glenn Randers-Pehrson | 83bd94f | 2011-09-01 14:06:49 -0500 | [diff] [blame] | 122 | if test "$have_solaris_ld" = "yes"; then |
| 123 | GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'` |
| 124 | else |
| 125 | GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` |
| 126 | fi |
| 127 | |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 128 | if test "$GLD"; then |
| 129 | have_ld_version_script=yes |
| 130 | AC_MSG_RESULT(yes) |
| 131 | else |
| 132 | have_ld_version_script=no |
| 133 | AC_MSG_RESULT(no) |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 134 | AC_MSG_WARN(*** You have not enabled versioned symbols.) |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 135 | fi |
Glenn Randers-Pehrson | 9f65059 | 2010-08-11 08:06:11 -0500 | [diff] [blame] | 136 | ;; |
| 137 | esac |
| 138 | |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 139 | AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 140 | |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 141 | if test "$have_ld_version_script" = "yes"; then |
| 142 | AC_MSG_CHECKING([for symbol prefix]) |
| 143 | SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ |
| 144 | | ${CPP-${CC-gcc} -E} - 2>&1 \ |
| 145 | | ${EGREP-grep} "^PREFIX=" \ |
| 146 | | ${SED-sed} "s:^PREFIX=::"` |
| 147 | AC_SUBST(SYMBOL_PREFIX) |
| 148 | AC_MSG_RESULT($SYMBOL_PREFIX) |
| 149 | fi |
| 150 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 151 | # Substitutions for .in files |
| 152 | AC_SUBST(PNGLIB_VERSION) |
| 153 | AC_SUBST(PNGLIB_MAJOR) |
| 154 | AC_SUBST(PNGLIB_MINOR) |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 155 | AC_SUBST(PNGLIB_RELEASE) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 156 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 157 | # Additional arguments (and substitutions) |
| 158 | # Allow the pkg-config directory to be set |
| 159 | AC_ARG_WITH(pkgconfigdir, |
| 160 | AC_HELP_STRING([--with-pkgconfigdir], |
Glenn Randers-Pehrson | b511b60 | 2006-04-16 19:45:31 -0500 | [diff] [blame] | 161 | [Use the specified pkgconfig dir (default is libdir/pkgconfig)]), |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 162 | [pkgconfigdir=${withval}], |
| 163 | [pkgconfigdir='${libdir}/pkgconfig']) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 164 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 165 | AC_SUBST([pkgconfigdir]) |
| 166 | AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 167 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 168 | # Make the *-config binary config scripts optional |
| 169 | AC_ARG_WITH(binconfigs, |
| 170 | AC_HELP_STRING([--with-binconfigs], |
| 171 | [Generate shell libpng-config scripts as well as pkg-config data] |
| 172 | [@<:@default=yes@:>@]), |
| 173 | [if test "${withval}" = no; then |
| 174 | binconfigs= |
| 175 | AC_MSG_NOTICE([libpng-config scripts will not be built]) |
| 176 | else |
| 177 | binconfigs='${binconfigs}' |
| 178 | fi], |
| 179 | [binconfigs='${binconfigs}']) |
| 180 | AC_SUBST([binconfigs]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 181 | |
Glenn Randers-Pehrson | c2d8399 | 2011-11-16 14:30:24 -0600 | [diff] [blame] | 182 | # Because GCC by default assembles code with an executable stack, even though it |
| 183 | # compiles C code with a non-executable stack, it is necessary to do a fixup |
| 184 | # here (this may by GCC specific) |
Glenn Randers-Pehrson | d92c1fc | 2011-11-17 21:03:07 -0600 | [diff] [blame] | 185 | AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack]) |
John Bowler | 7006dc4 | 2011-11-16 22:25:47 -0600 | [diff] [blame] | 186 | |
Glenn Randers-Pehrson | 6d7705e | 2011-11-03 00:42:58 -0500 | [diff] [blame] | 187 | AC_ARG_ENABLE([arm-neon], |
Glenn Randers-Pehrson | c2d8399 | 2011-11-16 14:30:24 -0600 | [diff] [blame] | 188 | AC_HELP_STRING([--enable-arm-neon], [Enable ARM NEON optimizations]), |
Glenn Randers-Pehrson | 6d7705e | 2011-11-03 00:42:58 -0500 | [diff] [blame] | 189 | [if test "${enableval}" = yes; then |
Glenn Randers-Pehrson | c2d8399 | 2011-11-16 14:30:24 -0600 | [diff] [blame] | 190 | AC_DEFINE([PNG_ARM_NEON], [1], [Enable ARM NEON optimizations]) |
Glenn Randers-Pehrson | 6d7705e | 2011-11-03 00:42:58 -0500 | [diff] [blame] | 191 | AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1], [Align row buffers]) |
| 192 | fi]) |
| 193 | AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes]) |
| 194 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 195 | # Config files, substituting as above |
Glenn Randers-Pehrson | a687af1 | 2009-12-25 16:17:30 -0600 | [diff] [blame] | 196 | AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in]) |
Glenn Randers-Pehrson | 28d4aae | 2009-11-13 16:29:45 -0600 | [diff] [blame] | 197 | AC_CONFIG_FILES([libpng-config:libpng-config.in], |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 198 | [chmod +x libpng-config]) |
| 199 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 200 | AC_OUTPUT |