diff --git a/Makefile.am b/Makefile.am index 73097dbccc9337bf6bd20571b69c2992ed0cd71f..13b8cc002a502720ed28f2a910352e7800ee22b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -76,11 +76,15 @@ lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\ pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\ pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\ - png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa - -if PNG_ARM_NEON -libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\ - arm/filter_neon.S arm/filter_neon_intrinsics.c + png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngchunk.h \ + pngusr.dfa + +# Include libpng extensions, if appropriate. This uses a Makefile.am fragment, +# pre-set things that might be changed by addition: +AM_CPPFLAGS = +DFA_EXTENSION = +if LIBPNG_EXTENSIONS +include $(top_srcdir)/contrib/extensions.am endif nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h @@ -123,12 +127,12 @@ EXTRA_DIST= \ $(TESTS) $(XFAIL_TESTS) tests/pngstest \ CMakeLists.txt example.c libpng-manual.txt -SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk +SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.c CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \ check.new pnglibconf.h pngprefix.h symbols.new pngtest-log.txt \ - pnglibconf.out pnglibconf.c pnglibconf.pre pnglibconf.dfn \ + pnglibconf.out pnglibconf.c pnglibconf.dfn pnglibconf.pre \ $(SCRIPT_CLEANFILES) MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \ @@ -140,8 +144,8 @@ config.sub configure depcomp install-sh ltmain.sh missing PNG_COPTS = @PNG_COPTS@ AM_CFLAGS = ${PNG_COPTS} -# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe -# other operating systems (NeXT?) the C preprocessor selected by configure +# DFNCPP is normally just "CPP -E" - the C preprocessor - but on Solaris and +# maybe other operating systems (NeXT?) the C preprocessor selected by configure # checks input tokens for validity - effectively it performs part of the ANSI-C # parsing - and therefore fails with the .df files. configure.ac has special # checks for this and sets DFNCPP appropriately. @@ -160,6 +164,8 @@ scripts/prefix.out: png.h pngconf.h pnglibconf.out scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt scripts/intprefix.out: pnglibconf.h +pnglibconf.out: config.h + libpng.sym: scripts/sym.out rm -f $@ cp $? $@ @@ -171,7 +177,7 @@ if DO_PNG_PREFIX # Rename functions in scripts/prefix.out with a PNG_PREFIX prefix. # Rename macros in scripts/macro.lst from PNG_PREFIXpng_ to PNG_ (the actual # implementation of the macro). -pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst +pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst config.h rm -f $@ $(AWK) 's==0 && NR>1{print prev}\ s==0{prev=$$0}\ @@ -236,17 +242,17 @@ endif rm -f $@ $*.tf[12] test -d scripts || mkdir scripts || test -d scripts $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\ - $(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1 + $(AM_CPPFLAGS) $(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1 $(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2 rm -f $*.tf1 mv $*.tf2 $@ # The .c file for pnglibconf.h is machine generated -pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA) +pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_EXTENSION) $(DFA_XTRA) rm -f $@ $*.tf[45] $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ - ${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2 + $(DFA_EXTENSION) ${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2 $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2 rm $*.tf4 mv $*.tf5 $@ @@ -264,8 +270,8 @@ scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.ou # be empty - no non-standard defines scripts/pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h rm -f $@ pnglibconf.tf[67] - test -z "$(CPPFLAGS)" - echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\ + test -z "$(CPPFLAGS)" -a -z "$(AM_CPPFLAGS)" + echo "com libpng @PNGLIB_VERSION@ STANDARD API DEFINITION" |\ $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\ logunsupported=1 version=search ${srcdir}/pngconf.h -\ ${srcdir}/scripts/pnglibconf.dfa 1>&2 @@ -274,7 +280,7 @@ scripts/pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h rm pnglibconf.tf6 mv pnglibconf.tf7 $@ -$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \ +$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h pngchunk.h \ pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h pngprefix.h test: check-am diff --git a/configure.ac b/configure.ac index 1f699ff5d75f97aa5ffdf3d28d4653980109f0ac..6a76ae6d36519dc0f995950a403208c982137ec2 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ AC_PREREQ([2.68]) dnl Version number stuff here: -AC_INIT([libpng],[1.6.19beta04],[png-mng-implement@lists.sourceforge.net]) +AC_INIT([libpng],[1.7.0beta66],[png-mng-implement@lists.sourceforge.net]) AC_CONFIG_MACRO_DIR([scripts]) # libpng does not follow GNU file name conventions (hence 'foreign') @@ -27,7 +27,8 @@ AC_CONFIG_MACRO_DIR([scripts]) # dist-xz requires automake 1.11 or later # 1.12.2 fixes a security issue in 1.11.2 and 1.12.1 # 1.13 is required for parallel tests -AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects]) +# 1.14.1 is required for %reldir% support +AM_INIT_AUTOMAKE([1.15 foreign dist-xz color-tests silent-rules subdir-objects]) # The following line causes --disable-maintainer-mode to be the default to # configure, this is necessary because libpng distributions cannot rely on the # time stamps of the autotools generated files being correct @@ -39,10 +40,10 @@ dnl automake, so the following is not necessary (and is not defined anyway): dnl AM_PREREQ([1.11.2]) dnl stop configure from automagically running automake -PNGLIB_VERSION=1.6.19beta04 +PNGLIB_VERSION=1.7.0beta66 PNGLIB_MAJOR=1 -PNGLIB_MINOR=6 -PNGLIB_RELEASE=19 +PNGLIB_MINOR=7 +PNGLIB_RELEASE=0 dnl End of version number stuff @@ -60,10 +61,10 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any +dnl libtool/libtoolize; version 2.4.4 is the tested version, this or any dnl compatible later version may be used LT_INIT([win32-dll]) -LT_PREREQ([2.4.2]) +LT_PREREQ([2.4.4]) # Some awks crash when confronted with pnglibconf.dfa, do a test run now # to make sure this doesn't happen @@ -79,7 +80,7 @@ fi # This is a remnant of the old cc -E validation, where it may have been # necessary to use a different preprocessor for .dfn files -DFNCPP="$CPP" +DFNCPP="$CPP -E" AC_SUBST(DFNCPP) # -Werror cannot be passed to GCC in CFLAGS because configure will fail (it @@ -109,30 +110,146 @@ AC_ARG_ENABLE(werror, # Checks for header files. AC_HEADER_STDC +# Headers used in pngpriv.h: +AC_CHECK_HEADERS([assert.h stdlib.h string.h float.h fp.h math.h m68881.h]) +# Additional headers used in pngconf.h: +AC_CHECK_HEADERS([limits.h stddef.h stdio.h setjmp.h time.h]) +# Used by pngread.c (for the simplified API): +AC_CHECK_HEADERS([errno.h]) +# The following are not required for the standard 'make' build of libpng: +# Additional requirements of contrib/libtests/makepng.c: +AC_CHECK_HEADERS([ctype.h]) +# Additional requirements of contrib/libtests/pngvalid.c: +AC_CHECK_HEADERS([fenv.h]) # Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T -AC_STRUCT_TM +# Most of these have been removed from 1.7.0 because they checked for non-ANSI-C +# behaviors and the result were, anyway, not used by earlier versions of libpng. AC_C_RESTRICT -# Checks for library functions. -AC_FUNC_STRTOD -AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc)) -AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) ) -AC_ARG_WITH(zlib-prefix, - AS_HELP_STRING([[[--with-zlib-prefix]]], - [prefix that may have been used in installed zlib]), - [ZPREFIX=${withval}], - [ZPREFIX='z_']) -AC_CHECK_LIB(z, zlibVersion, , - AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed))) +# Checks for library functions; these need to be in order, least demanding to +# most because the -l directives are added to the head of the list at each +# check. +# ANSI-C functions: all are required but they don't have to be implemented in +# libc, it is perfectly ok to configure with an extra, wrapper, library preset +# in LIBS. NOTE: this list may not be complete +AC_CHECK_FUNCS([memset memcpy strncpy],, + AC_MSG_FAILURE([missing ANSI-C functions])) + +# floor and ceil are required for FLOATING_POINT, but they can be turned off on +# the configure command line (and they are independent.) Default is to 'on' +AC_ARG_ENABLE([floating-point], + AS_HELP_STRING([[[--enabled-floating-point]]], + [Enable floating point APIs (default: yes)]),, + [enable_floating_point=yes]) + +AC_ARG_ENABLE([fixed-point], + AS_HELP_STRING([[[--enable-fixed-point]]], + [Enable fixed point APIs (default: yes)]),, + [enable_fixed_point=yes]) + +AC_ARG_ENABLE([floating-arithmetic], + AS_HELP_STRING([[[--enable-floating-arithmetic]]], + [Use floating point arithmetic internally (default: yes)]),, + [enable_floating_arithmetic=yes]) + +# Check for a requirement for math library support +if test "$enable_floating_arithmetic" = yes +then + AC_SEARCH_LIBS([floor],[m],, + [AC_MSG_WARN([not found]) + enable_floating_arithmetic=no]) + AC_SEARCH_LIBS([frexp],[m],, + [AC_MSG_WARN([not found]) + enable_floating_arithmetic=no]) + AC_SEARCH_LIBS([modf],[m],, + [AC_MSG_WARN([not found]) + enable_floating_arithmetic=no]) + AC_SEARCH_LIBS([atof],[m],, + [AC_MSG_WARN([not found]) + enable_floating_arithmetic=no]) + AC_SEARCH_LIBS([pow],[m],, + [AC_MSG_WARN([not found]) + enable_floating_arithmetic=no]) +fi + +# Set the relevant defines if required (only if required), this will override +# anything on the command line. +if test "$enable_floating_point" != yes +then + AC_MSG_NOTICE([Floating point APIs disabled]) + AC_DEFINE([PNG_NO_FLOATING_POINT],[1], + [No support for floating point APIs]) +fi +if test "$enable_fixed_point" != yes +then + AC_MSG_NOTICE([Fixed point APIs disabled]) + AC_DEFINE([PNG_NO_FIXED_POINT],[1], + [No support for fixed point APIs]) +fi +if test "$enable_floating_arithmetic" != yes +then + AC_MSG_NOTICE([Fixed point arithmetic will be used]) + AC_DEFINE([PNG_NO_FLOATING_ARITHMETIC],[1], + [No support for floating point arithmetic]) +fi # The following is for pngvalid, to ensure it catches FP errors even on # platforms that don't enable FP exceptions, the function appears in the math # library (typically), it's not an error if it is not found. -AC_CHECK_LIB([m], [feenableexcept]) -AC_CHECK_FUNCS([feenableexcept]) +AC_SEARCH_LIBS([feenableexcept],[m],AC_DEFINE([HAVE_FEENABLEEXCEPT],[1], + [Define to 1 if the feenableexcept function is available])) +# Required by pngvalid: +AC_SEARCH_LIBS([ceil],[m]) + +# zlib checks and arguments; +# package zlib: argument is the name of the library +# zlib-header: the name of the header file +# zlib-prefix: the prefix for library functions, if any +AC_ARG_WITH([zlib], + AS_HELP_STRING([[[--with-zlib=]]], + [base name of the zlib implementation (e.g. 'z')]),, + [with_zlib='z']) + +z_prefix= +AC_ARG_WITH([zlib-prefix], + AS_HELP_STRING([[[--with-zlib-prefix=]]], + [prefix for zlib API functions]), + [if test "$withval" = "" -o "$withval" = yes; then + with_zlib_prefix='z_' + AC_DEFINE([PNG_ZLIB_PREFIX],[z_],[Standard zlib prefix]) + elif test "${withval}" != "no"; then + AC_DEFINE_UNQUOTED([PNG_ZLIB_PREFIX],[${withval}], + [User defined zlib prefix]) + else + with_zlib_prefix= + fi + if test "$with_zlib_prefix" != ""; then + AC_DEFINE([Z_PREFIX],[1],[Tell zlib.h to prefix function names]) + z_prefix="#define Z_PREFIX 1" + fi]) + +AC_ARG_WITH([zlib-header], + AS_HELP_STRING([[[--with-zlib-header='' or '"file"']]], + [C include argument to locate zlib header file, e.g. , take + care to put single quotes round this on the command line]), + [AC_DEFINE_UNQUOTED([PNG_ZLIB_HEADER],[${withval}],[Zlib header file])], + with_zlib_header='') + +# AC_CHECK_LIB isn't quite enough for this because we need the special header +# file too. +LIBS="-l${with_zlib} $LIBS" +AC_MSG_CHECKING( + [[Library '${with_zlib}' and #include ${with_zlib_header} for symbol '${with_zlib_prefix}zlibVersion']]) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +${z_prefix} +#include ${with_zlib_header} + ]], + [[(void)${with_zlib_prefix}zlibVersion();]])], + AC_MSG_RESULT([ok]), + AC_MSG_FAILURE([not found])) AC_MSG_CHECKING([if using Solaris linker]) SLD=`$LD --version 2>&1 | grep Solaris` @@ -178,7 +295,7 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") if test "$have_ld_version_script" = "yes"; then AC_MSG_CHECKING([for symbol prefix]) SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ - | ${CPP-${CC-gcc} -E} - 2>&1 \ + | ${DFNCPP-${CC-gcc -E}} - 2>&1 \ | ${EGREP-grep} "^PREFIX=" \ | ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"` AC_SUBST(SYMBOL_PREFIX) @@ -265,60 +382,16 @@ AC_ARG_ENABLE([unversioned-libpng-config], AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG], [test "$enable_unversioned_libpng_config" != "no"]) -# HOST SPECIFIC OPTIONS -# ===================== -# -# ARM -# === -# -# ARM NEON (SIMD) support. - -AC_ARG_ENABLE([arm-neon], - AS_HELP_STRING([[[--enable-arm-neon]]], - [Enable ARM NEON optimizations: =no/off, check, api, yes/on:] - [no/off: disable the optimizations; check: use internal checking code] - [(deprecated and poorly supported); api: disable by default, enable by] - [a call to png_set_option; yes/on: turn on unconditionally.] - [If not specified: determined by the compiler.]), - [case "$enableval" in - no|off) - # disable the default enabling on __ARM_NEON__ systems: - AC_DEFINE([PNG_ARM_NEON_OPT], [0], - [Disable ARM Neon optimizations]) - # Prevent inclusion of the assembler files below: - enable_arm_neon=no;; - check) - AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [], - [Check for ARM Neon support at run-time]);; - api) - AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [], - [Turn on ARM Neon optimizations at run-time]);; - yes|on) - AC_DEFINE([PNG_ARM_NEON_OPT], [2], - [Enable ARM Neon optimizations]) - AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if] - [you want the optimizations unconditionally pass -mfpu=neon] - [to the compiler.]);; - *) - AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value]) - esac]) - -# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or -# where ARM optimizations were explicitly requested (this allows a fallback if a -# future host CPU does not match 'arm*') - -AM_CONDITIONAL([PNG_ARM_NEON], - [test "$enable_arm_neon" != 'no' && - case "$host_cpu" in - arm*|aarch64*) :;; - *) test "$enable_arm_neon" != '';; - esac]) +# EXTENSIONS +# Configure (and all other) support for extensions is included when autoconf is +# run by virtue of the existence (or not) of the following file: +sinclude([contrib/extensions.ac]) +AM_CONDITIONAL([LIBPNG_EXTENSIONS],[test -n "$libpng_automake_extensions"]) AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]]) # Config files, substituting as above -AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in]) -AC_CONFIG_FILES([libpng-config:libpng-config.in], - [chmod +x libpng-config]) +AC_CONFIG_FILES([Makefile libpng.pc]) +AC_CONFIG_FILES([libpng-config], [chmod +x libpng-config]) AC_OUTPUT