The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [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 |
| 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 |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 17 | AC_PREREQ([2.68]) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 18 | |
| 19 | dnl Version number stuff here: |
| 20 | |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 21 | AC_INIT([libpng],[1.6.3],[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 | # 1.13 is required for parallel tests |
| 30 | AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules]) |
| 31 | # The following line causes --disable-maintainer-mode to be the default to |
| 32 | # configure, this is necessary because libpng distributions cannot rely on the |
| 33 | # time stamps of the autotools generated files being correct |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 34 | AM_MAINTAINER_MODE |
| 35 | |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 36 | dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later |
| 37 | dnl version; aclocal.m4 will generate a failure if you use a prior version of |
| 38 | dnl automake, so the following is not necessary (and is not defined anyway): |
| 39 | dnl AM_PREREQ([1.11.2]) |
| 40 | dnl stop configure from automagically running automake |
| 41 | |
| 42 | PNGLIB_VERSION=1.6.3 |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 43 | PNGLIB_MAJOR=1 |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 44 | PNGLIB_MINOR=6 |
| 45 | PNGLIB_RELEASE=3 |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 46 | |
| 47 | dnl End of version number stuff |
| 48 | |
| 49 | AC_CONFIG_SRCDIR([pngget.c]) |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 50 | AC_CONFIG_HEADERS([config.h]) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 51 | |
| 52 | # Checks for programs. |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 53 | AC_LANG([C]) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 54 | AC_PROG_CC |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 55 | AM_PROG_AS |
| 56 | LT_PATH_LD |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 57 | AC_PROG_CPP |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 58 | AC_PROG_AWK |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 59 | AC_PROG_INSTALL |
| 60 | AC_PROG_LN_S |
| 61 | AC_PROG_MAKE_SET |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 62 | |
| 63 | dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any |
| 64 | dnl compatible later version may be used |
| 65 | LT_INIT([win32-dll]) |
| 66 | LT_PREREQ([2.4.2]) |
| 67 | |
| 68 | # Some awks crash when confronted with pnglibconf.dfa, do a test run now |
| 69 | # to make sure this doesn't happen |
| 70 | AC_MSG_CHECKING([that AWK works]) |
| 71 | if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\ |
| 72 | ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ |
| 73 | ${srcdir}/pngusr.dfa 1>&2 |
| 74 | then |
| 75 | AC_MSG_RESULT([ok]) |
| 76 | else |
| 77 | AC_MSG_FAILURE([failed], 1) |
| 78 | fi |
| 79 | |
| 80 | # This is a remnant of the old cc -E validation, where it may have been |
| 81 | # necessary to use a different preprocessor for .dfn files |
| 82 | DFNCPP="$CPP" |
| 83 | AC_SUBST(DFNCPP) |
| 84 | |
| 85 | # -Werror cannot be passed to GCC in CFLAGS because configure will fail (it |
| 86 | # checks the compiler with a program that generates a warning), add the |
| 87 | # following option to deal with this |
| 88 | AC_ARG_VAR(PNG_COPTS, |
| 89 | [additional flags for the C compiler, use this for options that would] |
| 90 | [cause configure itself to fail]) |
| 91 | AC_ARG_ENABLE(werror, |
| 92 | AS_HELP_STRING([[[--enable-werror[=OPT]]]], |
| 93 | [Pass -Werror or the given argument to the compiler if it is supported]), |
| 94 | [test "$enable_werror" = "yes" && enable_werror="-Werror" |
| 95 | if test "$enable_werror" != "no"; then |
| 96 | sav_CFLAGS="$CFLAGS" |
| 97 | CFLAGS="$enable_werror $CFLAGS" |
| 98 | AC_MSG_CHECKING([if the compiler allows $enable_werror]) |
| 99 | AC_COMPILE_IFELSE( |
| 100 | [AC_LANG_SOURCE([ |
| 101 | [int main(int argc, char **argv){] |
| 102 | [return argv[argc-1][0];] |
| 103 | [}]])], |
| 104 | AC_MSG_RESULT(yes) |
| 105 | PNG_COPTS="$PNG_COPTS $enable_werror", |
| 106 | AC_MSG_RESULT(no)) |
| 107 | CFLAGS="$sav_CFLAGS" |
| 108 | fi],) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 109 | |
| 110 | # Checks for header files. |
| 111 | AC_HEADER_STDC |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 112 | |
| 113 | # Checks for typedefs, structures, and compiler characteristics. |
| 114 | AC_C_CONST |
| 115 | AC_TYPE_SIZE_T |
| 116 | AC_STRUCT_TM |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 117 | AC_C_RESTRICT |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 118 | |
| 119 | # Checks for library functions. |
| 120 | AC_FUNC_STRTOD |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 121 | AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc)) |
| 122 | AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) ) |
| 123 | AC_ARG_WITH(zlib-prefix, |
| 124 | AS_HELP_STRING([[[--with-zlib-prefix]]], |
| 125 | [prefix that may have been used in installed zlib]), |
| 126 | [ZPREFIX=${withval}], |
| 127 | [ZPREFIX='z_']) |
| 128 | AC_CHECK_LIB(z, zlibVersion, , |
| 129 | AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed))) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 130 | |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 131 | # The following is for pngvalid, to ensure it catches FP errors even on |
| 132 | # platforms that don't enable FP exceptions, the function appears in the math |
| 133 | # library (typically), it's not an error if it is not found. |
| 134 | AC_CHECK_LIB([m], [feenableexcept]) |
| 135 | AC_CHECK_FUNCS([feenableexcept]) |
| 136 | |
| 137 | AC_MSG_CHECKING([if using Solaris linker]) |
| 138 | SLD=`$LD --version 2>&1 | grep Solaris` |
| 139 | if test "$SLD"; then |
| 140 | have_solaris_ld=yes |
| 141 | AC_MSG_RESULT(yes) |
| 142 | else |
| 143 | have_solaris_ld=no |
| 144 | AC_MSG_RESULT(no) |
| 145 | fi |
| 146 | AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes") |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 147 | |
| 148 | AC_MSG_CHECKING([if libraries can be versioned]) |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 149 | # Special case for PE/COFF platforms: ld reports |
| 150 | # support for version-script, but doesn't actually |
| 151 | # DO anything with it. |
| 152 | case $host in |
| 153 | *cygwin* | *mingw32* | *interix* ) |
| 154 | have_ld_version_script=no |
| 155 | AC_MSG_RESULT(no) |
| 156 | ;; |
| 157 | * ) |
| 158 | |
| 159 | if test "$have_solaris_ld" = "yes"; then |
| 160 | GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'` |
| 161 | else |
| 162 | GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` |
| 163 | fi |
| 164 | |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 165 | if test "$GLD"; then |
| 166 | have_ld_version_script=yes |
| 167 | AC_MSG_RESULT(yes) |
| 168 | else |
| 169 | have_ld_version_script=no |
| 170 | AC_MSG_RESULT(no) |
| 171 | AC_MSG_WARN(*** You have not enabled versioned symbols.) |
| 172 | fi |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 173 | ;; |
| 174 | esac |
| 175 | |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 176 | AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") |
| 177 | |
| 178 | if test "$have_ld_version_script" = "yes"; then |
| 179 | AC_MSG_CHECKING([for symbol prefix]) |
| 180 | SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 181 | | ${CPP-${CC-gcc} -E} - 2>&1 \ |
| 182 | | ${EGREP-grep} "^PREFIX=" \ |
| 183 | | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"` |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 184 | AC_SUBST(SYMBOL_PREFIX) |
| 185 | AC_MSG_RESULT($SYMBOL_PREFIX) |
| 186 | fi |
| 187 | |
| 188 | # Substitutions for .in files |
| 189 | AC_SUBST(PNGLIB_VERSION) |
| 190 | AC_SUBST(PNGLIB_MAJOR) |
| 191 | AC_SUBST(PNGLIB_MINOR) |
| 192 | AC_SUBST(PNGLIB_RELEASE) |
| 193 | |
| 194 | # Additional arguments (and substitutions) |
| 195 | # Allow the pkg-config directory to be set |
| 196 | AC_ARG_WITH(pkgconfigdir, |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 197 | AS_HELP_STRING([[[--with-pkgconfigdir]]], |
| 198 | [Use the specified pkgconfig dir (default is libdir/pkgconfig)]), |
| 199 | [pkgconfigdir=${withval}], |
| 200 | [pkgconfigdir='${libdir}/pkgconfig']) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 201 | |
| 202 | AC_SUBST([pkgconfigdir]) |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 203 | AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]]) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 204 | |
| 205 | # Make the *-config binary config scripts optional |
| 206 | AC_ARG_WITH(binconfigs, |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 207 | AS_HELP_STRING([[[--with-binconfigs]]], |
| 208 | [Generate shell libpng-config scripts as well as pkg-config data] |
| 209 | [@<:@default=yes@:>@]), |
| 210 | [if test "${withval}" = no; then |
| 211 | binconfigs= |
| 212 | AC_MSG_NOTICE([[libpng-config scripts will not be built]]) |
| 213 | else |
| 214 | binconfigs='${binconfigs}' |
| 215 | fi], |
| 216 | [binconfigs='${binconfigs}']) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 217 | AC_SUBST([binconfigs]) |
| 218 | |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 219 | # Support for prefixes to the API function names; this will generate defines |
| 220 | # at the start of the build to rename exported library functions |
| 221 | AC_ARG_WITH(libpng-prefix, |
| 222 | AS_HELP_STRING([[[--with-libpng-prefix]]], |
| 223 | [prefix libpng exported function (API) names with the given value]), |
| 224 | [if test "${withval:-no}" != "no"; then |
| 225 | AC_SUBST([PNG_PREFIX], [${withval}]) |
| 226 | fi]) |
| 227 | AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"]) |
| 228 | |
| 229 | # HOST SPECIFIC OPTIONS |
| 230 | # ===================== |
| 231 | # |
| 232 | # ARM |
| 233 | # === |
| 234 | # |
| 235 | # ARM NEON (SIMD) support. |
| 236 | |
| 237 | AC_ARG_ENABLE([arm-neon], |
| 238 | AS_HELP_STRING([[[--enable-arm-neon]]], |
| 239 | [Enable ARM NEON optimizations: =no/off, check, api, yes/on:] |
| 240 | [no/off: disable the optimizations; check: use internal checking code] |
| 241 | [(deprecated and poorly supported); api: disable by default, enable by] |
| 242 | [a call to png_set_option; yes/on: turn on unconditionally.] |
| 243 | [If not specified: determined by the compiler.]), |
| 244 | [case "$enableval" in |
| 245 | no|off) |
| 246 | # disable the default enabling on __ARM_NEON__ systems: |
| 247 | AC_DEFINE([PNG_ARM_NEON_OPT], [0], |
| 248 | [Disable ARM Neon optimizations]) |
| 249 | # Prevent inclusion of the assembler files below: |
| 250 | enable_arm_neon=no;; |
| 251 | check) |
| 252 | AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [], |
| 253 | [Check for ARM Neon support at run-time]);; |
| 254 | api) |
| 255 | AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [], |
| 256 | [Turn on ARM Neon optimizations at run-time]);; |
| 257 | yes|on) |
| 258 | AC_DEFINE([PNG_ARM_NEON_OPT], [2], |
| 259 | [Enable ARM Neon optimizations]) |
| 260 | AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if] |
| 261 | [you want the optimizations unconditionally pass -mfpu=neon] |
| 262 | [to the compiler.]);; |
| 263 | *) |
| 264 | AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value]) |
| 265 | esac]) |
| 266 | |
| 267 | # Add ARM specific files to all builds where the host_cpu is arm ('arm*') or |
| 268 | # where ARM optimizations were explicitly requested (this allows a fallback if a |
| 269 | # future host CPU does not match 'arm*') |
| 270 | |
| 271 | AM_CONDITIONAL([PNG_ARM_NEON], |
| 272 | [test "$enable_arm_neon" != 'no' && |
| 273 | case "$host_cpu" in |
| 274 | arm*) :;; |
| 275 | *) test "$enable_arm_neon" != '';; |
| 276 | esac]) |
| 277 | |
| 278 | AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]]) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 279 | |
| 280 | # Config files, substituting as above |
Chris Craik | b50c217 | 2013-07-29 15:28:30 -0700 | [diff] [blame^] | 281 | AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in]) |
| 282 | AC_CONFIG_FILES([libpng-config:libpng-config.in], |
| 283 | [chmod +x libpng-config]) |
The Android Open Source Project | 893912b | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 284 | |
| 285 | AC_OUTPUT |