Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1 | # configure.ac |
| 2 | |
Glenn Randers-Pehrson | 93b3476 | 2017-01-03 22:18:22 -0600 | [diff] [blame] | 3 | # Copyright (c) 2004-2016 Glenn Randers-Pehrson |
| 4 | # Last changed in libpng 1.6.25 [September 1, 2016] |
Glenn Randers-Pehrson | 6c3d5bd | 2016-02-22 16:38:10 -0600 | [diff] [blame] | 5 | |
| 6 | # This code is released under the libpng license. |
| 7 | # For conditions of distribution and use, see the disclaimer |
| 8 | # and license in png.h |
| 9 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 10 | dnl Process this file with autoconf to produce a configure script. |
| 11 | dnl |
| 12 | dnl Minor upgrades (compatible ABI): increment the package version |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 13 | 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] | 14 | dnl variable. |
| 15 | dnl |
| 16 | dnl Major upgrades (incompatible ABI): increment the package major |
| 17 | dnl version (second field, or first if desired), set the minor |
| 18 | dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in |
| 19 | dnl Makefile.am to upgrade the package name. |
| 20 | |
| 21 | dnl This is here to prevent earlier autoconf from being used, it |
| 22 | dnl should not be necessary to regenerate configure if the time |
| 23 | dnl stamps are correct |
John Bowler | feecc89 | 2012-01-28 00:48:08 -0600 | [diff] [blame] | 24 | AC_PREREQ([2.68]) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 25 | |
| 26 | dnl Version number stuff here: |
| 27 | |
Glenn Randers-Pehrson | 23b5199 | 2017-07-05 06:41:18 -0500 | [diff] [blame] | 28 | AC_INIT([libpng],[1.6.31beta02],[png-mng-implement@lists.sourceforge.net]) |
John Bowler | a23f3db | 2012-01-27 10:24:21 -0600 | [diff] [blame] | 29 | AC_CONFIG_MACRO_DIR([scripts]) |
John Bowler | 05cbe5a | 2012-01-28 18:06:55 -0600 | [diff] [blame] | 30 | |
| 31 | # libpng does not follow GNU file name conventions (hence 'foreign') |
| 32 | # color-tests requires automake 1.11 or later |
| 33 | # silent-rules requires automake 1.11 or later |
| 34 | # dist-xz requires automake 1.11 or later |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 35 | # 1.12.2 fixes a security issue in 1.11.2 and 1.12.1 |
| 36 | # 1.13 is required for parallel tests |
John Bowler | 940b37b | 2013-10-04 19:56:19 -0500 | [diff] [blame] | 37 | AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects]) |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 38 | # The following line causes --disable-maintainer-mode to be the default to |
Glenn Randers-Pehrson | faa3e53 | 2016-07-25 07:49:34 -0500 | [diff] [blame] | 39 | # configure. This is necessary because libpng distributions cannot rely on the |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 40 | # time stamps of the autotools generated files being correct |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 41 | AM_MAINTAINER_MODE |
| 42 | |
John Bowler | feecc89 | 2012-01-28 00:48:08 -0600 | [diff] [blame] | 43 | dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later |
| 44 | dnl version; aclocal.m4 will generate a failure if you use a prior version of |
| 45 | dnl automake, so the following is not necessary (and is not defined anyway): |
| 46 | dnl AM_PREREQ([1.11.2]) |
| 47 | dnl stop configure from automagically running automake |
| 48 | |
Glenn Randers-Pehrson | 23b5199 | 2017-07-05 06:41:18 -0500 | [diff] [blame] | 49 | PNGLIB_VERSION=1.6.31beta02 |
Glenn Randers-Pehrson | 8568f6e | 2009-07-28 17:20:26 -0500 | [diff] [blame] | 50 | PNGLIB_MAJOR=1 |
Glenn Randers-Pehrson | 15ea1fa | 2011-11-23 15:28:01 -0600 | [diff] [blame] | 51 | PNGLIB_MINOR=6 |
Glenn Randers-Pehrson | 145361a | 2017-06-28 14:35:23 -0500 | [diff] [blame] | 52 | PNGLIB_RELEASE=31 |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 53 | |
| 54 | dnl End of version number stuff |
| 55 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 56 | AC_CONFIG_SRCDIR([pngget.c]) |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 57 | AC_CONFIG_HEADERS([config.h]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 58 | |
| 59 | # Checks for programs. |
John Bowler | 71a10f2 | 2011-01-22 17:03:33 -0600 | [diff] [blame] | 60 | AC_LANG([C]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 61 | AC_PROG_CC |
Glenn Randers-Pehrson | 6d7705e | 2011-11-03 00:42:58 -0500 | [diff] [blame] | 62 | AM_PROG_AS |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 63 | LT_PATH_LD |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 64 | AC_PROG_CPP |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 65 | AC_PROG_AWK |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 66 | AC_PROG_INSTALL |
| 67 | AC_PROG_LN_S |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 68 | AC_PROG_MAKE_SET |
John Bowler | feecc89 | 2012-01-28 00:48:08 -0600 | [diff] [blame] | 69 | |
Glenn Randers-Pehrson | faa3e53 | 2016-07-25 07:49:34 -0500 | [diff] [blame] | 70 | dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any |
John Bowler | feecc89 | 2012-01-28 00:48:08 -0600 | [diff] [blame] | 71 | dnl compatible later version may be used |
Glenn Randers-Pehrson | 9f65059 | 2010-08-11 08:06:11 -0500 | [diff] [blame] | 72 | LT_INIT([win32-dll]) |
John Bowler | feecc89 | 2012-01-28 00:48:08 -0600 | [diff] [blame] | 73 | LT_PREREQ([2.4.2]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 74 | |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 75 | # Some awks crash when confronted with pnglibconf.dfa, do a test run now |
| 76 | # to make sure this doesn't happen |
| 77 | AC_MSG_CHECKING([that AWK works]) |
| 78 | if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\ |
| 79 | ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ |
| 80 | ${srcdir}/pngusr.dfa 1>&2 |
| 81 | then |
| 82 | AC_MSG_RESULT([ok]) |
John Bowler | 71a10f2 | 2011-01-22 17:03:33 -0600 | [diff] [blame] | 83 | else |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 84 | AC_MSG_FAILURE([failed], 1) |
John Bowler | 71a10f2 | 2011-01-22 17:03:33 -0600 | [diff] [blame] | 85 | fi |
| 86 | |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 87 | # This is a remnant of the old cc -E validation, where it may have been |
| 88 | # necessary to use a different preprocessor for .dfn files |
| 89 | DFNCPP="$CPP" |
| 90 | AC_SUBST(DFNCPP) |
| 91 | |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 92 | # -Werror cannot be passed to GCC in CFLAGS because configure will fail (it |
| 93 | # checks the compiler with a program that generates a warning), add the |
| 94 | # following option to deal with this |
| 95 | AC_ARG_VAR(PNG_COPTS, |
| 96 | [additional flags for the C compiler, use this for options that would] |
| 97 | [cause configure itself to fail]) |
| 98 | AC_ARG_ENABLE(werror, |
| 99 | AS_HELP_STRING([[[--enable-werror[=OPT]]]], |
| 100 | [Pass -Werror or the given argument to the compiler if it is supported]), |
| 101 | [test "$enable_werror" = "yes" && enable_werror="-Werror" |
| 102 | if test "$enable_werror" != "no"; then |
| 103 | sav_CFLAGS="$CFLAGS" |
| 104 | CFLAGS="$enable_werror $CFLAGS" |
| 105 | AC_MSG_CHECKING([if the compiler allows $enable_werror]) |
| 106 | AC_COMPILE_IFELSE( |
| 107 | [AC_LANG_SOURCE([ |
| 108 | [int main(int argc, char **argv){] |
| 109 | [return argv[argc-1][0];] |
| 110 | [}]])], |
| 111 | AC_MSG_RESULT(yes) |
| 112 | PNG_COPTS="$PNG_COPTS $enable_werror", |
| 113 | AC_MSG_RESULT(no)) |
| 114 | CFLAGS="$sav_CFLAGS" |
| 115 | fi],) |
| 116 | |
Dagobert Michelsen | 12e63e9 | 2016-03-14 16:21:06 +0100 | [diff] [blame] | 117 | # For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89 |
| 118 | # In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1 |
| 119 | # This is incompatible with the new default mode, so we test for that and force the |
Glenn Randers-Pehrson | 46861bc | 2016-03-15 07:55:41 -0500 | [diff] [blame] | 120 | # "-std=c89" compiler option: |
Dagobert Michelsen | 12e63e9 | 2016-03-14 16:21:06 +0100 | [diff] [blame] | 121 | AC_MSG_CHECKING([if we need to force back C standard to C89]) |
Glenn Randers-Pehrson | 46861bc | 2016-03-15 07:55:41 -0500 | [diff] [blame] | 122 | AC_COMPILE_IFELSE( |
| 123 | [AC_LANG_PROGRAM([ |
| 124 | [#define _POSIX_SOURCE 1] |
| 125 | [#include <stdio.h>] |
| 126 | ])], |
| 127 | AC_MSG_RESULT(no),[ |
| 128 | if test "x$GCC" != "xyes"; then |
| 129 | AC_MSG_ERROR( |
| 130 | [Forcing back to C89 is required but the flags are only known for GCC]) |
| 131 | fi |
| 132 | AC_MSG_RESULT(yes) |
| 133 | CFLAGS="$CFLAGS -std=c89" |
Dagobert Michelsen | 12e63e9 | 2016-03-14 16:21:06 +0100 | [diff] [blame] | 134 | ]) |
| 135 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 136 | # Checks for header files. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 137 | AC_HEADER_STDC |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 138 | |
| 139 | # Checks for typedefs, structures, and compiler characteristics. |
| 140 | AC_C_CONST |
| 141 | AC_TYPE_SIZE_T |
| 142 | AC_STRUCT_TM |
John Bowler | fc45f68 | 2011-11-04 21:03:39 -0500 | [diff] [blame] | 143 | AC_C_RESTRICT |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 144 | |
| 145 | # Checks for library functions. |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 146 | AC_FUNC_STRTOD |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 147 | AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc)) |
| 148 | AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) ) |
Glenn Randers-Pehrson | d6e5a72 | 2016-05-17 18:35:59 -0500 | [diff] [blame] | 149 | |
| 150 | # Some later POSIX 1003.1 functions are required for test programs, failure here |
| 151 | # is soft (the corresponding test program is not built). |
| 152 | AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])]) |
| 153 | AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"]) |
| 154 | |
Glenn Randers-Pehrson | 977f6eb | 2011-01-04 09:07:45 -0600 | [diff] [blame] | 155 | AC_ARG_WITH(zlib-prefix, |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 156 | AS_HELP_STRING([[[--with-zlib-prefix]]], |
| 157 | [prefix that may have been used in installed zlib]), |
| 158 | [ZPREFIX=${withval}], |
| 159 | [ZPREFIX='z_']) |
Glenn Randers-Pehrson | 571db95 | 2010-12-09 06:03:03 -0600 | [diff] [blame] | 160 | AC_CHECK_LIB(z, zlibVersion, , |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 161 | AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed))) |
Glenn Randers-Pehrson | 571db95 | 2010-12-09 06:03:03 -0600 | [diff] [blame] | 162 | |
John Bowler | fc45f68 | 2011-11-04 21:03:39 -0500 | [diff] [blame] | 163 | # The following is for pngvalid, to ensure it catches FP errors even on |
| 164 | # platforms that don't enable FP exceptions, the function appears in the math |
| 165 | # library (typically), it's not an error if it is not found. |
| 166 | AC_CHECK_LIB([m], [feenableexcept]) |
| 167 | AC_CHECK_FUNCS([feenableexcept]) |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 168 | |
Glenn Randers-Pehrson | 83bd94f | 2011-09-01 14:06:49 -0500 | [diff] [blame] | 169 | AC_MSG_CHECKING([if using Solaris linker]) |
| 170 | SLD=`$LD --version 2>&1 | grep Solaris` |
| 171 | if test "$SLD"; then |
| 172 | have_solaris_ld=yes |
| 173 | AC_MSG_RESULT(yes) |
| 174 | else |
| 175 | have_solaris_ld=no |
| 176 | AC_MSG_RESULT(no) |
| 177 | fi |
| 178 | AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes") |
| 179 | |
Gilles Espinasse | f87ef8b | 2011-12-26 13:10:01 -0600 | [diff] [blame] | 180 | AC_MSG_CHECKING([if libraries can be versioned]) |
Glenn Randers-Pehrson | ccff383 | 2011-09-09 07:55:25 -0500 | [diff] [blame] | 181 | # Special case for PE/COFF platforms: ld reports |
| 182 | # support for version-script, but doesn't actually |
| 183 | # DO anything with it. |
| 184 | case $host in |
| 185 | *cygwin* | *mingw32* | *interix* ) |
| 186 | have_ld_version_script=no |
| 187 | AC_MSG_RESULT(no) |
| 188 | ;; |
| 189 | * ) |
| 190 | |
Glenn Randers-Pehrson | 83bd94f | 2011-09-01 14:06:49 -0500 | [diff] [blame] | 191 | if test "$have_solaris_ld" = "yes"; then |
| 192 | GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'` |
| 193 | else |
| 194 | GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` |
| 195 | fi |
| 196 | |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 197 | if test "$GLD"; then |
| 198 | have_ld_version_script=yes |
| 199 | AC_MSG_RESULT(yes) |
| 200 | else |
| 201 | have_ld_version_script=no |
| 202 | AC_MSG_RESULT(no) |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 203 | AC_MSG_WARN(*** You have not enabled versioned symbols.) |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 204 | fi |
Glenn Randers-Pehrson | 9f65059 | 2010-08-11 08:06:11 -0500 | [diff] [blame] | 205 | ;; |
| 206 | esac |
| 207 | |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 208 | 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] | 209 | |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 210 | if test "$have_ld_version_script" = "yes"; then |
| 211 | AC_MSG_CHECKING([for symbol prefix]) |
| 212 | SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 213 | | ${CPP-${CC-gcc} -E} - 2>&1 \ |
| 214 | | ${EGREP-grep} "^PREFIX=" \ |
| 215 | | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"` |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 216 | AC_SUBST(SYMBOL_PREFIX) |
| 217 | AC_MSG_RESULT($SYMBOL_PREFIX) |
| 218 | fi |
| 219 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 220 | # Substitutions for .in files |
| 221 | AC_SUBST(PNGLIB_VERSION) |
| 222 | AC_SUBST(PNGLIB_MAJOR) |
| 223 | AC_SUBST(PNGLIB_MINOR) |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 224 | AC_SUBST(PNGLIB_RELEASE) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 225 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 226 | # Additional arguments (and substitutions) |
| 227 | # Allow the pkg-config directory to be set |
| 228 | AC_ARG_WITH(pkgconfigdir, |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 229 | AS_HELP_STRING([[[--with-pkgconfigdir]]], |
| 230 | [Use the specified pkgconfig dir (default is libdir/pkgconfig)]), |
| 231 | [pkgconfigdir=${withval}], |
| 232 | [pkgconfigdir='${libdir}/pkgconfig']) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 233 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 234 | AC_SUBST([pkgconfigdir]) |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 235 | AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 236 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 237 | # Make the *-config binary config scripts optional |
| 238 | AC_ARG_WITH(binconfigs, |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 239 | AS_HELP_STRING([[[--with-binconfigs]]], |
| 240 | [Generate shell libpng-config scripts as well as pkg-config data] |
| 241 | [@<:@default=yes@:>@]), |
| 242 | [if test "${withval}" = no; then |
| 243 | binconfigs= |
| 244 | AC_MSG_NOTICE([[libpng-config scripts will not be built]]) |
| 245 | else |
| 246 | binconfigs='${binconfigs}' |
| 247 | fi], |
| 248 | [binconfigs='${binconfigs}']) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 249 | AC_SUBST([binconfigs]) |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 250 | |
John Bowler | 42369cc | 2012-01-31 07:28:13 -0600 | [diff] [blame] | 251 | # Support for prefixes to the API function names; this will generate defines |
| 252 | # at the start of the build to rename exported library functions |
| 253 | AC_ARG_WITH(libpng-prefix, |
| 254 | AS_HELP_STRING([[[--with-libpng-prefix]]], |
| 255 | [prefix libpng exported function (API) names with the given value]), |
| 256 | [if test "${withval:-no}" != "no"; then |
| 257 | AC_SUBST([PNG_PREFIX], [${withval}]) |
| 258 | fi]) |
John Bowler | 516c9c9 | 2012-02-01 07:14:24 -0600 | [diff] [blame] | 259 | AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"]) |
John Bowler | 42369cc | 2012-01-31 07:28:13 -0600 | [diff] [blame] | 260 | |
John Bowler | d0479d2 | 2013-12-29 19:31:56 -0600 | [diff] [blame] | 261 | # Control over what links are made for installed files. Versioned files are |
| 262 | # always installed, when the following options are turned on corresponding |
| 263 | # unversioned links are also created (normally as symbolic links): |
| 264 | AC_ARG_ENABLE([unversioned-links], |
| 265 | AS_HELP_STRING([[[--enable-unversioned-links]]], |
| 266 | [Installed libpng header files are placed in a versioned subdirectory] |
| 267 | [and installed libpng library (including DLL) files are versioned.] |
| 268 | [If this option is enabled unversioned links will be created pointing to] |
| 269 | [the corresponding installed files. If you use libpng.pc or] |
| 270 | [libpng-config for all builds you do not need these links, but if you] |
| 271 | [compile programs directly they will typically #include <png.h> and] |
| 272 | [link with -lpng; in that case you need the links.] |
| 273 | [The links can be installed manually using 'make install-header-links'] |
| 274 | [and 'make install-library-links' and can be removed using the] |
| 275 | [corresponding uninstall- targets. If you do enable this option every] |
| 276 | [libpng 'make install' will recreate the links to point to the just] |
| 277 | [installed version of libpng. The default is to create the links;] |
| 278 | [use --disable-unversioned-links to change this])) |
| 279 | |
| 280 | # The AM_CONDITIONAL test is written so that the default is enabled; |
| 281 | # --disable-unversioned-links must be given to turn the option off. |
| 282 | AM_CONDITIONAL([DO_INSTALL_LINKS],[test "$enable_unversioned_links" != "no"]) |
| 283 | |
| 284 | AC_ARG_ENABLE([unversioned-libpng-pc], |
| 285 | AS_HELP_STRING([[[--enable-unversioned-libpng-pc]]], |
| 286 | [Install the configuration file 'libpng.pc' as a link to the versioned] |
| 287 | [version. This is done by default - use --disable-unversioned-libpng-pc] |
| 288 | [to change this.])) |
| 289 | AM_CONDITIONAL([DO_INSTALL_LIBPNG_PC], |
| 290 | [test "$enable_unversioned_libpng_pc" != "no"]) |
| 291 | |
| 292 | AC_ARG_ENABLE([unversioned-libpng-config], |
| 293 | AS_HELP_STRING([[[--enable-unversioned-libpng-config]]], |
| 294 | [Install the configuration file 'libpng-config' as a link to the] |
| 295 | [versioned version. This is done by default - use] |
| 296 | [--disable-unversioned-libpng-config to change this.])) |
| 297 | AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG], |
| 298 | [test "$enable_unversioned_libpng_config" != "no"]) |
| 299 | |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 300 | # HOST SPECIFIC OPTIONS |
| 301 | # ===================== |
| 302 | # |
Glenn Randers-Pehrson | 50b6df5 | 2017-07-08 12:59:23 -0500 | [diff] [blame] | 303 | # DEFAULT |
| 304 | # ======= |
| 305 | # |
| 306 | AC_ARG_ENABLE([hardware-optimizations], |
| 307 | AS_HELP_STRING([[[--enable-hardware-optimizations]]], |
| 308 | [Enable hardware optimizations: =no/off, yes/on:]), |
| 309 | [case "$enableval" in |
| 310 | no|off) |
| 311 | # disable hardware optimization on all systems: |
| 312 | enable_arm_neon=no |
| 313 | AC_DEFINE([PNG_ARM_NEON_OPT], [0], |
| 314 | [Disable ARM_NEON optimizations]) |
| 315 | enable_mips_msa=no |
| 316 | AC_DEFINE([PNG_MIPS_MSA_OPT], [0], |
| 317 | [Disable MIPS_MSA optimizations]) |
| 318 | enable_powerpc_vsx=no |
| 319 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [0], |
| 320 | [Disable POWERPC VSX optimizations]) |
| 321 | enable_intel_sse=no |
| 322 | AC_DEFINE([PNG_INTEL_SSE_OPT], [0], |
| 323 | [Disable INTEL_SSE optimizations]) |
Glenn Randers-Pehrson | bd5a826 | 2017-07-08 12:56:14 -0500 | [diff] [blame^] | 324 | ;; |
Glenn Randers-Pehrson | 50b6df5 | 2017-07-08 12:59:23 -0500 | [diff] [blame] | 325 | *) |
| 326 | # allow enabling hardware optimization on any system: |
| 327 | case "$host_cpu" in |
| 328 | arm*|aarch64*) |
| 329 | enable_arm_neon=yes |
| 330 | AC_DEFINE([PNG_ARM_NEON_OPT], [0], |
| 331 | [Enable ARM_NEON optimizations]) |
| 332 | ;; |
| 333 | mipsel*|mips64el*) |
| 334 | enable_mips_msa=yes |
| 335 | AC_DEFINE([PNG_MIPS_MSA_OPT], [0], |
| 336 | [Enable MIPS_MSA optimizations]) |
| 337 | ;; |
| 338 | i?86|x86_64) |
| 339 | enable_intel_sse=yes |
| 340 | AC_DEFINE([PNG_INTEL_SSE_OPT], [1], |
| 341 | [Enable Intel SSE optimizations]) |
| 342 | ;; |
| 343 | powerpc*|ppc64*) |
| 344 | enable_powerpc_vsx=yes |
| 345 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], |
| 346 | [Enable POWERPC VSX optimizations]) |
| 347 | ;; |
| 348 | esac |
| 349 | ;; |
| 350 | esac]) |
| 351 | |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 352 | # ARM |
| 353 | # === |
| 354 | # |
| 355 | # ARM NEON (SIMD) support. |
| 356 | |
Glenn Randers-Pehrson | 6d7705e | 2011-11-03 00:42:58 -0500 | [diff] [blame] | 357 | AC_ARG_ENABLE([arm-neon], |
Glenn Randers-Pehrson | 871b1d0 | 2013-03-02 14:58:22 -0600 | [diff] [blame] | 358 | AS_HELP_STRING([[[--enable-arm-neon]]], |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 359 | [Enable ARM NEON optimizations: =no/off, check, api, yes/on:] |
| 360 | [no/off: disable the optimizations; check: use internal checking code] |
John Bowler | f372810 | 2013-03-04 16:26:31 -0600 | [diff] [blame] | 361 | [(deprecated and poorly supported); api: disable by default, enable by] |
John Bowler | aa22442 | 2013-06-06 12:49:53 -0500 | [diff] [blame] | 362 | [a call to png_set_option; yes/on: turn on unconditionally.] |
| 363 | [If not specified: determined by the compiler.]), |
John Bowler | f372810 | 2013-03-04 16:26:31 -0600 | [diff] [blame] | 364 | [case "$enableval" in |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 365 | no|off) |
| 366 | # disable the default enabling on __ARM_NEON__ systems: |
John Bowler | 18dd07e | 2013-06-08 13:07:13 -0500 | [diff] [blame] | 367 | AC_DEFINE([PNG_ARM_NEON_OPT], [0], |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 368 | [Disable ARM Neon optimizations]) |
| 369 | # Prevent inclusion of the assembler files below: |
| 370 | enable_arm_neon=no;; |
John Bowler | 83a841a | 2013-10-15 21:19:56 -0500 | [diff] [blame] | 371 | check) |
John Bowler | f372810 | 2013-03-04 16:26:31 -0600 | [diff] [blame] | 372 | AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [], |
| 373 | [Check for ARM Neon support at run-time]);; |
John Bowler | 83a841a | 2013-10-15 21:19:56 -0500 | [diff] [blame] | 374 | api) |
John Bowler | f372810 | 2013-03-04 16:26:31 -0600 | [diff] [blame] | 375 | AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [], |
| 376 | [Turn on ARM Neon optimizations at run-time]);; |
John Bowler | 83a841a | 2013-10-15 21:19:56 -0500 | [diff] [blame] | 377 | yes|on) |
John Bowler | 18dd07e | 2013-06-08 13:07:13 -0500 | [diff] [blame] | 378 | AC_DEFINE([PNG_ARM_NEON_OPT], [2], |
| 379 | [Enable ARM Neon optimizations]) |
| 380 | AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if] |
| 381 | [you want the optimizations unconditionally pass -mfpu=neon] |
| 382 | [to the compiler.]);; |
John Bowler | f372810 | 2013-03-04 16:26:31 -0600 | [diff] [blame] | 383 | *) |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 384 | AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value]) |
John Bowler | f372810 | 2013-03-04 16:26:31 -0600 | [diff] [blame] | 385 | esac]) |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 386 | |
John Bowler | ac09cd0 | 2013-04-25 23:13:08 -0500 | [diff] [blame] | 387 | # Add ARM specific files to all builds where the host_cpu is arm ('arm*') or |
| 388 | # where ARM optimizations were explicitly requested (this allows a fallback if a |
| 389 | # future host CPU does not match 'arm*') |
John Bowler | 7b1da52 | 2013-04-25 10:03:42 -0500 | [diff] [blame] | 390 | |
| 391 | AM_CONDITIONAL([PNG_ARM_NEON], |
| 392 | [test "$enable_arm_neon" != 'no' && |
John Bowler | ac09cd0 | 2013-04-25 23:13:08 -0500 | [diff] [blame] | 393 | case "$host_cpu" in |
John Bowler | 445475a | 2014-11-03 19:44:39 -0600 | [diff] [blame] | 394 | arm*|aarch64*) :;; |
John Bowler | ac09cd0 | 2013-04-25 23:13:08 -0500 | [diff] [blame] | 395 | *) test "$enable_arm_neon" != '';; |
| 396 | esac]) |
Glenn Randers-Pehrson | 6d7705e | 2011-11-03 00:42:58 -0500 | [diff] [blame] | 397 | |
Mandar Sahastrabuddhe | ee5e398 | 2016-08-29 19:07:25 +0530 | [diff] [blame] | 398 | # MIPS |
| 399 | # === |
| 400 | # |
| 401 | # MIPS MSA (SIMD) support. |
| 402 | |
| 403 | AC_ARG_ENABLE([mips-msa], |
| 404 | AS_HELP_STRING([[[--enable-mips-msa]]], |
| 405 | [Enable MIPS MSA optimizations: =no/off, check, api, yes/on:] |
| 406 | [no/off: disable the optimizations; check: use internal checking code] |
| 407 | [(deprecated and poorly supported); api: disable by default, enable by] |
| 408 | [a call to png_set_option; yes/on: turn on unconditionally.] |
| 409 | [If not specified: determined by the compiler.]), |
| 410 | [case "$enableval" in |
| 411 | no|off) |
| 412 | # disable the default enabling on __mips_msa systems: |
| 413 | AC_DEFINE([PNG_MIPS_MSA_OPT], [0], |
| 414 | [Disable MIPS MSA optimizations]) |
| 415 | # Prevent inclusion of the assembler files below: |
| 416 | enable_mips_msa=no;; |
| 417 | check) |
| 418 | AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [], |
| 419 | [Check for MIPS MSA support at run-time]);; |
| 420 | api) |
| 421 | AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [], |
| 422 | [Turn on MIPS MSA optimizations at run-time]);; |
| 423 | yes|on) |
| 424 | AC_DEFINE([PNG_MIPS_MSA_OPT], [2], |
| 425 | [Enable MIPS MSA optimizations]) |
| 426 | AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if] |
| 427 | [you want the optimizations unconditionally pass '-mmsa -mfp64'] |
| 428 | [to the compiler.]);; |
| 429 | *) |
| 430 | AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value]) |
| 431 | esac]) |
| 432 | |
| 433 | # Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or |
| 434 | # where MIPS optimizations were explicitly requested (this allows a fallback if a |
| 435 | # future host CPU does not match 'mips*') |
| 436 | |
| 437 | AM_CONDITIONAL([PNG_MIPS_MSA], |
| 438 | [test "$enable_mips_msa" != 'no' && |
| 439 | case "$host_cpu" in |
| 440 | mipsel*|mips64el*) :;; |
| 441 | esac]) |
| 442 | |
Glenn Randers-Pehrson | 8c6c9e6 | 2017-01-05 18:11:59 -0600 | [diff] [blame] | 443 | # INTEL |
| 444 | # ===== |
| 445 | # |
| 446 | # INTEL SSE (SIMD) support. |
| 447 | |
| 448 | AC_ARG_ENABLE([intel-sse], |
| 449 | AS_HELP_STRING([[[--enable-intel-sse]]], |
| 450 | [Enable Intel SSE optimizations: =no/off, yes/on:] |
| 451 | [no/off: disable the optimizations;] |
| 452 | [yes/on: enable the optimizations.] |
| 453 | [If not specified: determined by the compiler.]), |
| 454 | [case "$enableval" in |
| 455 | no|off) |
| 456 | # disable the default enabling: |
| 457 | AC_DEFINE([PNG_INTEL_SSE_OPT], [0], |
| 458 | [Disable Intel SSE optimizations]) |
| 459 | # Prevent inclusion of the assembler files below: |
| 460 | enable_intel_sse=no;; |
| 461 | yes|on) |
| 462 | AC_DEFINE([PNG_INTEL_SSE_OPT], [1], |
| 463 | [Enable Intel SSE optimizations]);; |
| 464 | *) |
| 465 | AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value]) |
| 466 | esac]) |
| 467 | |
| 468 | # Add Intel specific files to all builds where the host_cpu is Intel ('x86*') |
| 469 | # or where Intel optimizations were explicitly requested (this allows a |
| 470 | # fallback if a future host CPU does not match 'x86*') |
| 471 | AM_CONDITIONAL([PNG_INTEL_SSE], |
| 472 | [test "$enable_intel_sse" != 'no' && |
| 473 | case "$host_cpu" in |
| 474 | i?86|x86_64) :;; |
| 475 | *) test "$enable_intel_sse" != '';; |
| 476 | esac]) |
| 477 | |
Vadim Barkov | 2b6e59d | 2017-01-14 16:05:33 +0300 | [diff] [blame] | 478 | # PowerPC |
| 479 | # === |
| 480 | # |
| 481 | # PowerPC VSX (SIMD) support. |
| 482 | |
| 483 | AC_ARG_ENABLE([powerpc-vsx], |
| 484 | AS_HELP_STRING([[[--enable-powerpc-vsx]]], |
| 485 | [Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:] |
| 486 | [no/off: disable the optimizations; check: use internal checking code] |
Vadim Barkov | 2cc569e | 2017-01-31 12:00:02 +0000 | [diff] [blame] | 487 | [api: disable by default, enable by a call to png_set_option] |
| 488 | [yes/on: turn on unconditionally.] |
Vadim Barkov | 2b6e59d | 2017-01-14 16:05:33 +0300 | [diff] [blame] | 489 | [If not specified: determined by the compiler.]), |
| 490 | [case "$enableval" in |
| 491 | no|off) |
| 492 | # disable the default enabling on __ppc64__ systems: |
| 493 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [0], |
| 494 | [Disable POWERPC VSX optimizations]) |
| 495 | # Prevent inclusion of the platform specific files below: |
| 496 | enable_powerpc_vsx=no;; |
| 497 | check) |
| 498 | AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [], |
Vadim Barkov | 8a24266 | 2017-02-01 14:26:02 +0000 | [diff] [blame] | 499 | [Check for POWERPC VSX support at run-time]) |
| 500 | AC_MSG_WARN([--enable-powerpc-vsx Please check contrib/powerpc/README file] |
| 501 | [for the list of supported OSes.]);; |
Vadim Barkov | 2b6e59d | 2017-01-14 16:05:33 +0300 | [diff] [blame] | 502 | api) |
| 503 | AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [], |
| 504 | [Turn on POWERPC VSX optimizations at run-time]);; |
| 505 | yes|on) |
| 506 | AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], |
| 507 | [Enable POWERPC VSX optimizations]) |
| 508 | AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if] |
Vadim Barkov | 565d4be | 2017-01-29 19:07:12 +0300 | [diff] [blame] | 509 | [you want the optimizations unconditionally pass '-maltivec -mvsx'] |
root | 6ff408d | 2017-01-14 18:35:36 +0300 | [diff] [blame] | 510 | [or '-mcpu=power8'to the compiler.]);; |
Vadim Barkov | 2b6e59d | 2017-01-14 16:05:33 +0300 | [diff] [blame] | 511 | *) |
| 512 | AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value]) |
| 513 | esac]) |
| 514 | |
| 515 | # Add PowerPC specific files to all builds where the host_cpu is powerpc('powerpc*') or |
| 516 | # where POWERPC optimizations were explicitly requested (this allows a fallback if a |
| 517 | # future host CPU does not match 'powerpc*') |
| 518 | |
| 519 | AM_CONDITIONAL([PNG_POWERPC_VSX], |
| 520 | [test "$enable_powerpc_vsx" != 'no' && |
| 521 | case "$host_cpu" in |
debian | 3907feb | 2017-01-31 03:50:45 +0000 | [diff] [blame] | 522 | powerpc*|ppc64*) :;; |
Vadim Barkov | 2b6e59d | 2017-01-14 16:05:33 +0300 | [diff] [blame] | 523 | esac]) |
| 524 | |
Glenn Randers-Pehrson | f6d358f | 2017-02-21 20:45:49 -0600 | [diff] [blame] | 525 | |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 526 | AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]]) |
| 527 | |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 528 | # Config files, substituting as above |
Glenn Randers-Pehrson | a687af1 | 2009-12-25 16:17:30 -0600 | [diff] [blame] | 529 | AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in]) |
Glenn Randers-Pehrson | 28d4aae | 2009-11-13 16:29:45 -0600 | [diff] [blame] | 530 | AC_CONFIG_FILES([libpng-config:libpng-config.in], |
John Bowler | 1eb2c48 | 2012-01-25 08:07:29 -0600 | [diff] [blame] | 531 | [chmod +x libpng-config]) |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 532 | |
Glenn Randers-Pehrson | 917648e | 2004-12-02 18:14:51 -0600 | [diff] [blame] | 533 | AC_OUTPUT |