fukasawa e60969
# configure.ac
fukasawa e60969
fukasawa e60969
dnl Process this file with autoconf to produce a configure script.
fukasawa e60969
dnl
fukasawa e60969
dnl Minor upgrades (compatible ABI): increment the package version
fukasawa e60969
dnl (third field in two places below) and set the PNGLIB_RELEASE
fukasawa e60969
dnl variable.
fukasawa e60969
dnl
fukasawa e60969
dnl Major upgrades (incompatible ABI): increment the package major
fukasawa e60969
dnl version (second field, or first if desired), set the minor
fukasawa e60969
dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
fukasawa e60969
dnl Makefile.am to upgrade the package name.
fukasawa e60969
fukasawa e60969
dnl This is here to prevent earlier autoconf from being used, it
fukasawa e60969
dnl should not be necessary to regenerate configure if the time
fukasawa e60969
dnl stamps are correct
fukasawa e60969
AC_PREREQ([2.68])
fukasawa e60969
fukasawa e60969
dnl Version number stuff here:
fukasawa e60969
fukasawa e60969
AC_INIT([libpng],[1.6.21],[png-mng-implement@lists.sourceforge.net])
fukasawa e60969
AC_CONFIG_MACRO_DIR([scripts])
fukasawa e60969
fukasawa e60969
# libpng does not follow GNU file name conventions (hence 'foreign')
fukasawa e60969
# color-tests requires automake 1.11 or later
fukasawa e60969
# silent-rules requires automake 1.11 or later
fukasawa e60969
# dist-xz requires automake 1.11 or later
fukasawa e60969
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
fukasawa e60969
# 1.13 is required for parallel tests
fukasawa e60969
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
fukasawa e60969
# The following line causes --disable-maintainer-mode to be the default to
fukasawa e60969
# configure, this is necessary because libpng distributions cannot rely on the
fukasawa e60969
# time stamps of the autotools generated files being correct
fukasawa e60969
AM_MAINTAINER_MODE
fukasawa e60969
fukasawa e60969
dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later
fukasawa e60969
dnl version; aclocal.m4 will generate a failure if you use a prior version of
fukasawa e60969
dnl automake, so the following is not necessary (and is not defined anyway):
fukasawa e60969
dnl AM_PREREQ([1.11.2])
fukasawa e60969
dnl stop configure from automagically running automake
fukasawa e60969
fukasawa e60969
PNGLIB_VERSION=1.6.21
fukasawa e60969
PNGLIB_MAJOR=1
fukasawa e60969
PNGLIB_MINOR=6
fukasawa e60969
PNGLIB_RELEASE=21
fukasawa e60969
fukasawa e60969
dnl End of version number stuff
fukasawa e60969
fukasawa e60969
AC_CONFIG_SRCDIR([pngget.c])
fukasawa e60969
AC_CONFIG_HEADERS([config.h])
fukasawa e60969
fukasawa e60969
# Checks for programs.
fukasawa e60969
AC_LANG([C])
fukasawa e60969
AC_PROG_CC
fukasawa e60969
AM_PROG_AS
fukasawa e60969
LT_PATH_LD
fukasawa e60969
AC_PROG_CPP
fukasawa e60969
AC_PROG_AWK
fukasawa e60969
AC_PROG_INSTALL
fukasawa e60969
AC_PROG_LN_S
fukasawa e60969
AC_PROG_MAKE_SET
fukasawa e60969
fukasawa e60969
dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any
fukasawa e60969
dnl compatible later version may be used
fukasawa e60969
LT_INIT([win32-dll])
fukasawa e60969
LT_PREREQ([2.4.2])
fukasawa e60969
fukasawa e60969
# Some awks crash when confronted with pnglibconf.dfa, do a test run now
fukasawa e60969
# to make sure this doesn't happen
fukasawa e60969
AC_MSG_CHECKING([that AWK works])
fukasawa e60969
if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\
fukasawa e60969
   ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
fukasawa e60969
   ${srcdir}/pngusr.dfa 1>&2
fukasawa e60969
then
fukasawa e60969
   AC_MSG_RESULT([ok])
fukasawa e60969
else
fukasawa e60969
   AC_MSG_FAILURE([failed], 1)
fukasawa e60969
fi
fukasawa e60969
fukasawa e60969
# This is a remnant of the old cc -E validation, where it may have been
fukasawa e60969
# necessary to use a different preprocessor for .dfn files
fukasawa e60969
DFNCPP="$CPP"
fukasawa e60969
AC_SUBST(DFNCPP)
fukasawa e60969
fukasawa e60969
# -Werror cannot be passed to GCC in CFLAGS because configure will fail (it
fukasawa e60969
# checks the compiler with a program that generates a warning), add the
fukasawa e60969
# following option to deal with this
fukasawa e60969
AC_ARG_VAR(PNG_COPTS,
fukasawa e60969
   [additional flags for the C compiler, use this for options that would]
fukasawa e60969
   [cause configure itself to fail])
fukasawa e60969
AC_ARG_ENABLE(werror,
fukasawa e60969
   AS_HELP_STRING([[[--enable-werror[=OPT]]]],
fukasawa e60969
      [Pass -Werror or the given argument to the compiler if it is supported]),
fukasawa e60969
   [test "$enable_werror" = "yes" && enable_werror="-Werror"
fukasawa e60969
    if test "$enable_werror" != "no"; then
fukasawa e60969
      sav_CFLAGS="$CFLAGS"
fukasawa e60969
      CFLAGS="$enable_werror $CFLAGS"
fukasawa e60969
      AC_MSG_CHECKING([if the compiler allows $enable_werror])
fukasawa e60969
      AC_COMPILE_IFELSE(
fukasawa e60969
         [AC_LANG_SOURCE([
fukasawa e60969
            [int main(int argc, char **argv){]
fukasawa e60969
            [return argv[argc-1][0];]
fukasawa e60969
            [}]])],
fukasawa e60969
         AC_MSG_RESULT(yes)
fukasawa e60969
         PNG_COPTS="$PNG_COPTS $enable_werror",
fukasawa e60969
         AC_MSG_RESULT(no))
fukasawa e60969
      CFLAGS="$sav_CFLAGS"
fukasawa e60969
    fi],)
fukasawa e60969
fukasawa e60969
# Checks for header files.
fukasawa e60969
AC_HEADER_STDC
fukasawa e60969
fukasawa e60969
# Checks for typedefs, structures, and compiler characteristics.
fukasawa e60969
AC_C_CONST
fukasawa e60969
AC_TYPE_SIZE_T
fukasawa e60969
AC_STRUCT_TM
fukasawa e60969
AC_C_RESTRICT
fukasawa e60969
fukasawa e60969
# Checks for library functions.
fukasawa e60969
AC_FUNC_STRTOD
fukasawa e60969
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
fukasawa e60969
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
fukasawa e60969
AC_ARG_WITH(zlib-prefix,
fukasawa e60969
   AS_HELP_STRING([[[--with-zlib-prefix]]],
fukasawa e60969
      [prefix that may have been used in installed zlib]),
fukasawa e60969
      [ZPREFIX=${withval}],
fukasawa e60969
      [ZPREFIX='z_'])
fukasawa e60969
AC_CHECK_LIB(z, zlibVersion, ,
fukasawa e60969
    AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
fukasawa e60969
fukasawa e60969
# The following is for pngvalid, to ensure it catches FP errors even on
fukasawa e60969
# platforms that don't enable FP exceptions, the function appears in the math
fukasawa e60969
# library (typically), it's not an error if it is not found.
fukasawa e60969
AC_CHECK_LIB([m], [feenableexcept])
fukasawa e60969
AC_CHECK_FUNCS([feenableexcept])
fukasawa e60969
fukasawa e60969
AC_MSG_CHECKING([if using Solaris linker])
fukasawa e60969
SLD=`$LD --version 2>&1 | grep Solaris`
fukasawa e60969
if test "$SLD"; then
fukasawa e60969
    have_solaris_ld=yes
fukasawa e60969
    AC_MSG_RESULT(yes)
fukasawa e60969
else
fukasawa e60969
    have_solaris_ld=no
fukasawa e60969
    AC_MSG_RESULT(no)
fukasawa e60969
fi
fukasawa e60969
AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
fukasawa e60969
fukasawa e60969
AC_MSG_CHECKING([if libraries can be versioned])
fukasawa e60969
# Special case for PE/COFF platforms: ld reports
fukasawa e60969
# support for version-script, but doesn't actually
fukasawa e60969
# DO anything with it.
fukasawa e60969
case $host in
fukasawa e60969
*cygwin* | *mingw32* | *interix* )
fukasawa e60969
    have_ld_version_script=no
fukasawa e60969
    AC_MSG_RESULT(no)
fukasawa e60969
;;
fukasawa e60969
* )
fukasawa e60969
fukasawa e60969
if test "$have_solaris_ld" = "yes"; then
fukasawa e60969
    GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
fukasawa e60969
else
fukasawa e60969
    GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
fukasawa e60969
fi
fukasawa e60969
fukasawa e60969
if test "$GLD"; then
fukasawa e60969
    have_ld_version_script=yes
fukasawa e60969
    AC_MSG_RESULT(yes)
fukasawa e60969
else
fukasawa e60969
    have_ld_version_script=no
fukasawa e60969
    AC_MSG_RESULT(no)
fukasawa e60969
    AC_MSG_WARN(*** You have not enabled versioned symbols.)
fukasawa e60969
fi
fukasawa e60969
;;
fukasawa e60969
esac
fukasawa e60969
fukasawa e60969
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
fukasawa e60969
fukasawa e60969
if test "$have_ld_version_script" = "yes"; then
fukasawa e60969
    AC_MSG_CHECKING([for symbol prefix])
fukasawa e60969
    SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
fukasawa e60969
                  | ${CPP-${CC-gcc} -E} - 2>&1 \
fukasawa e60969
                  | ${EGREP-grep} "^PREFIX=" \
fukasawa e60969
                  | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
fukasawa e60969
    AC_SUBST(SYMBOL_PREFIX)
fukasawa e60969
    AC_MSG_RESULT($SYMBOL_PREFIX)
fukasawa e60969
fi
fukasawa e60969
fukasawa e60969
# Substitutions for .in files
fukasawa e60969
AC_SUBST(PNGLIB_VERSION)
fukasawa e60969
AC_SUBST(PNGLIB_MAJOR)
fukasawa e60969
AC_SUBST(PNGLIB_MINOR)
fukasawa e60969
AC_SUBST(PNGLIB_RELEASE)
fukasawa e60969
fukasawa e60969
# Additional arguments (and substitutions)
fukasawa e60969
# Allow the pkg-config directory to be set
fukasawa e60969
AC_ARG_WITH(pkgconfigdir,
fukasawa e60969
   AS_HELP_STRING([[[--with-pkgconfigdir]]],
fukasawa e60969
      [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
fukasawa e60969
   [pkgconfigdir=${withval}],
fukasawa e60969
   [pkgconfigdir='${libdir}/pkgconfig'])
fukasawa e60969
fukasawa e60969
AC_SUBST([pkgconfigdir])
fukasawa e60969
AC_MSG_NOTICE([[pkgconfig directory is ${pkgconfigdir}]])
fukasawa e60969
fukasawa e60969
# Make the *-config binary config scripts optional
fukasawa e60969
AC_ARG_WITH(binconfigs,
fukasawa e60969
   AS_HELP_STRING([[[--with-binconfigs]]],
fukasawa e60969
      [Generate shell libpng-config scripts as well as pkg-config data]
fukasawa e60969
      [@<:@default=yes@:>@]),
fukasawa e60969
   [if test "${withval}" = no; then
fukasawa e60969
      binconfigs=
fukasawa e60969
      AC_MSG_NOTICE([[libpng-config scripts will not be built]])
fukasawa e60969
    else
fukasawa e60969
      binconfigs='${binconfigs}'
fukasawa e60969
    fi],
fukasawa e60969
   [binconfigs='${binconfigs}'])
fukasawa e60969
AC_SUBST([binconfigs])
fukasawa e60969
fukasawa e60969
# Support for prefixes to the API function names; this will generate defines
fukasawa e60969
# at the start of the build to rename exported library functions
fukasawa e60969
AC_ARG_WITH(libpng-prefix,
fukasawa e60969
   AS_HELP_STRING([[[--with-libpng-prefix]]],
fukasawa e60969
      [prefix libpng exported function (API) names with the given value]),
fukasawa e60969
   [if test "${withval:-no}" != "no"; then
fukasawa e60969
      AC_SUBST([PNG_PREFIX], [${withval}])
fukasawa e60969
    fi])
fukasawa e60969
AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
fukasawa e60969
fukasawa e60969
# Control over what links are made for installed files.  Versioned files are
fukasawa e60969
# always installed, when the following options are turned on corresponding
fukasawa e60969
# unversioned links are also created (normally as symbolic links):
fukasawa e60969
AC_ARG_ENABLE([unversioned-links],
fukasawa e60969
   AS_HELP_STRING([[[--enable-unversioned-links]]],
fukasawa e60969
      [Installed libpng header files are placed in a versioned subdirectory]
fukasawa e60969
      [and installed libpng library (including DLL) files are versioned.]
fukasawa e60969
      [If this option is enabled unversioned links will be created pointing to]
fukasawa e60969
      [the corresponding installed files.  If you use libpng.pc or]
fukasawa e60969
      [libpng-config for all builds you do not need these links, but if you]
fukasawa e60969
      [compile programs directly they will typically #include <png.h> and]</png.h>
fukasawa e60969
      [link with -lpng; in that case you need the links.]
fukasawa e60969
      [The links can be installed manually using 'make install-header-links']
fukasawa e60969
      [and 'make install-library-links' and can be removed using the]
fukasawa e60969
      [corresponding uninstall- targets.  If you do enable this option every]
fukasawa e60969
      [libpng 'make install' will recreate the links to point to the just]
fukasawa e60969
      [installed version of libpng.  The default is to create the links;]
fukasawa e60969
      [use --disable-unversioned-links to change this]))
fukasawa e60969
fukasawa e60969
# The AM_CONDITIONAL test is written so that the default is enabled;
fukasawa e60969
# --disable-unversioned-links must be given to turn the option off.
fukasawa e60969
AM_CONDITIONAL([DO_INSTALL_LINKS],[test "$enable_unversioned_links" != "no"])
fukasawa e60969
fukasawa e60969
AC_ARG_ENABLE([unversioned-libpng-pc],
fukasawa e60969
   AS_HELP_STRING([[[--enable-unversioned-libpng-pc]]],
fukasawa e60969
      [Install the configuration file 'libpng.pc' as a link to the versioned]
fukasawa e60969
      [version.  This is done by default - use --disable-unversioned-libpng-pc]
fukasawa e60969
      [to change this.]))
fukasawa e60969
AM_CONDITIONAL([DO_INSTALL_LIBPNG_PC],
fukasawa e60969
   [test "$enable_unversioned_libpng_pc" != "no"])
fukasawa e60969
fukasawa e60969
AC_ARG_ENABLE([unversioned-libpng-config],
fukasawa e60969
   AS_HELP_STRING([[[--enable-unversioned-libpng-config]]],
fukasawa e60969
      [Install the configuration file 'libpng-config' as a link to the]
fukasawa e60969
      [versioned version.  This is done by default - use]
fukasawa e60969
      [--disable-unversioned-libpng-config to change this.]))
fukasawa e60969
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
fukasawa e60969
   [test "$enable_unversioned_libpng_config" != "no"])
fukasawa e60969
fukasawa e60969
# HOST SPECIFIC OPTIONS
fukasawa e60969
# =====================
fukasawa e60969
#
fukasawa e60969
# ARM
fukasawa e60969
# ===
fukasawa e60969
#
fukasawa e60969
# ARM NEON (SIMD) support.
fukasawa e60969
fukasawa e60969
AC_ARG_ENABLE([arm-neon],
fukasawa e60969
   AS_HELP_STRING([[[--enable-arm-neon]]],
fukasawa e60969
      [Enable ARM NEON optimizations: =no/off, check, api, yes/on:]
fukasawa e60969
      [no/off: disable the optimizations; check: use internal checking code]
fukasawa e60969
      [(deprecated and poorly supported); api: disable by default, enable by]
fukasawa e60969
      [a call to png_set_option; yes/on: turn on unconditionally.]
fukasawa e60969
      [If not specified: determined by the compiler.]),
fukasawa e60969
   [case "$enableval" in
fukasawa e60969
      no|off)
fukasawa e60969
         # disable the default enabling on __ARM_NEON__ systems:
fukasawa e60969
         AC_DEFINE([PNG_ARM_NEON_OPT], [0],
fukasawa e60969
                   [Disable ARM Neon optimizations])
fukasawa e60969
         # Prevent inclusion of the assembler files below:
fukasawa e60969
         enable_arm_neon=no;;
fukasawa e60969
      check)
fukasawa e60969
         AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
fukasawa e60969
                   [Check for ARM Neon support at run-time]);;
fukasawa e60969
      api)
fukasawa e60969
         AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [],
fukasawa e60969
                   [Turn on ARM Neon optimizations at run-time]);;
fukasawa e60969
      yes|on)
fukasawa e60969
         AC_DEFINE([PNG_ARM_NEON_OPT], [2],
fukasawa e60969
                   [Enable ARM Neon optimizations])
fukasawa e60969
         AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if]
fukasawa e60969
            [you want the optimizations unconditionally pass -mfpu=neon]
fukasawa e60969
            [to the compiler.]);;
fukasawa e60969
      *)
fukasawa e60969
         AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
fukasawa e60969
   esac])
fukasawa e60969
fukasawa e60969
# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or
fukasawa e60969
# where ARM optimizations were explicitly requested (this allows a fallback if a
fukasawa e60969
# future host CPU does not match 'arm*')
fukasawa e60969
fukasawa e60969
AM_CONDITIONAL([PNG_ARM_NEON],
fukasawa e60969
   [test "$enable_arm_neon" != 'no' &&
fukasawa e60969
    case "$host_cpu" in
fukasawa e60969
      arm*|aarch64*) :;;
fukasawa e60969
      *)    test "$enable_arm_neon" != '';;
fukasawa e60969
    esac])
fukasawa e60969
fukasawa e60969
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
fukasawa e60969
fukasawa e60969
# Config files, substituting as above
fukasawa e60969
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
fukasawa e60969
AC_CONFIG_FILES([libpng-config:libpng-config.in],
fukasawa e60969
   [chmod +x libpng-config])
fukasawa e60969
fukasawa e60969
AC_OUTPUT