From 71a10f2ca184104e64a2db07a9eabcebaf825c33 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sat, 22 Jan 2011 17:03:33 -0600 Subject: [PATCH] [devel] Attempted to fix cpp on Solaris with S. Studio 12 cc, fix build Added a make macro DFNCPP that is a CPP that will accept the tokens in a .dfn file and adds configure stuff to test for such a CPP. ./configure should fail if one is not available. --- ANNOUNCE | 4 ++++ CHANGES | 4 ++++ Makefile.am | 9 ++++++++- configure.ac | 25 ++++++++++++++++++++++++- png.h | 3 ++- 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index e3bd444ab..edb918c6c 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -76,6 +76,10 @@ Version 1.5.1beta08 [January 22, 2011] to the manual. Removed the synopses from libpngpf.3 because they were out of date and no longer useful. Better information can be obtained by reading the prototypes and comments in pngpriv.h + Attempted to fix cpp on Solaris with S. Studio 12 cc, fix build + Added a make macro DFNCPP that is a CPP that will accept the tokens in + a .dfn file and adds configure stuff to test for such a CPP. ./configure + should fail if one is not available. Version 1.5.1rc01 [January 22, 2011] diff --git a/CHANGES b/CHANGES index 8ed94f00e..cc42f412b 100644 --- a/CHANGES +++ b/CHANGES @@ -3192,6 +3192,10 @@ Version 1.5.1beta08 [January 22, 2011] to the manual. Removed the synopses from libpngpf.3 because they were out of date and no longer useful. Better information can be obtained by reading the prototypes and comments in pngpriv.h + Attempted to fix cpp on Solaris with S. Studio 12 cc, fix build + Added a make macro DFNCPP that is a CPP that will accept the tokens in + a .dfn file and adds configure stuff to test for such a CPP. ./configure + should fail if one is not available. Version 1.5.1rc01 [January 22, 2011] diff --git a/Makefile.am b/Makefile.am index 1370465b7..81e173270 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,6 +81,13 @@ CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \ config.sub configure depcomp install-sh ltmain.sh missing +# DFNCPP is normally just CPP - 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. +DFNCPP = @DFNCPP@ + SUFFIXES = .chk .dfn .out $(PNGLIB_BASENAME).pc: libpng.pc @@ -119,7 +126,7 @@ SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\ rm -f $@ dfn.c dfn?.out test -d scripts || mkdir scripts echo '#include "$<"' >dfn.c - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ + $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\ dfn1.out >dfn2.out diff --git a/configure.ac b/configure.ac index e1452c4c3..56b25dde0 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,7 @@ AC_CONFIG_SRCDIR([pngget.c]) AM_CONFIG_HEADER(config.h) # Checks for programs. +AC_LANG([C]) AC_PROG_CC AC_PROG_LD AC_PROG_CPP @@ -44,6 +45,28 @@ AC_PROG_LN_S AC_PROG_MAKE_SET LT_INIT([win32-dll]) +# On Solaris 10 and 12 CPP gets set to cc -E, however this still +# does some input parsing. We need strict ANSI-C style tokenization, +# check this: +AC_REQUIRE_CPP +AC_MSG_CHECKING([for a C preprocessor that does not parse its input]) +AC_TRY_CPP([1.5.0 16BIT], + [DFNCPP="$CPP"], + [DFNCPP="" + sav_CPP="$CPP" + for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"; do + AC_TRY_CPP([1.5.0 16BIT], + [DFNCPP="$CPP"] + [break],,) + done + CPP="$sav_CPP"]) +if test -n "$DFNCPP"; then + AC_MSG_RESULT([$DFNCPP]) + AC_SUBST(DFNCPP) +else + AC_MSG_FAILURE([not found], 1) +fi + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h]) @@ -76,7 +99,7 @@ AC_MSG_CHECKING([if libraries can be versioned]) # support for version-script, but doesn't actually # DO anything with it. case $host in -*cygwin* | *mingw32* ) +*cygwin* | *mingw32* | *interix* ) have_ld_version_script=no AC_MSG_RESULT(no) ;; diff --git a/png.h b/png.h index f143742de..29ec464e9 100644 --- a/png.h +++ b/png.h @@ -2232,7 +2232,8 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); */ /* The last ordinal number (this is the *last* one already used; the next - * one to use is one more than this.) + * one to use is one more than this.) Maintainer, remember to add an entry to + * scripts/symbols.def as well. */ #ifdef PNG_EXPORT_LAST_ORDINAL PNG_EXPORT_LAST_ORDINAL(216); -- GitLab