epoger@google.com | 38a9134 | 2011-06-15 13:45:10 +0000 | [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 |
| 17 | AC_PREREQ(2.59) |
| 18 | |
| 19 | dnl Version number stuff here: |
| 20 | |
| 21 | AC_INIT([libpng], [1.5.2], [png-mng-implement@lists.sourceforge.net]) |
| 22 | AM_INIT_AUTOMAKE |
| 23 | dnl stop configure from automagically running automake |
| 24 | AM_MAINTAINER_MODE |
| 25 | |
| 26 | PNGLIB_VERSION=1.5.2 |
| 27 | PNGLIB_MAJOR=1 |
| 28 | PNGLIB_MINOR=5 |
| 29 | PNGLIB_RELEASE=2 |
| 30 | |
| 31 | dnl End of version number stuff |
| 32 | |
| 33 | AC_CONFIG_SRCDIR([pngget.c]) |
| 34 | AM_CONFIG_HEADER(config.h) |
| 35 | |
| 36 | # Checks for programs. |
| 37 | AC_LANG([C]) |
| 38 | AC_PROG_CC |
| 39 | AC_PROG_LD |
| 40 | AC_PROG_CPP |
| 41 | AC_CHECK_TOOL(SED, sed, :) |
| 42 | AC_CHECK_TOOL(AWK, awk, :) |
| 43 | AC_PROG_INSTALL |
| 44 | AC_PROG_LN_S |
| 45 | AC_PROG_MAKE_SET |
| 46 | LT_INIT([win32-dll]) |
| 47 | |
| 48 | # On Solaris 10 and 12 CPP gets set to cc -E, however this still |
| 49 | # does some input parsing. We need strict ANSI-C style tokenization, |
| 50 | # check this: |
| 51 | AC_REQUIRE_CPP |
| 52 | AC_MSG_CHECKING([for a C preprocessor that does not parse its input]) |
| 53 | AC_TRY_CPP([1.5.0 16BIT], |
| 54 | [DFNCPP="$CPP"], |
| 55 | [DFNCPP="" |
| 56 | sav_CPP="$CPP" |
| 57 | for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"; do |
| 58 | AC_TRY_CPP([1.5.0 16BIT], |
| 59 | [DFNCPP="$CPP"] |
| 60 | [break],,) |
| 61 | done |
| 62 | CPP="$sav_CPP"]) |
| 63 | if test -n "$DFNCPP"; then |
| 64 | AC_MSG_RESULT([$DFNCPP]) |
| 65 | AC_SUBST(DFNCPP) |
| 66 | else |
| 67 | AC_MSG_FAILURE([not found], 1) |
| 68 | fi |
| 69 | |
| 70 | # Checks for header files. |
| 71 | AC_HEADER_STDC |
| 72 | AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h]) |
| 73 | |
| 74 | # Checks for typedefs, structures, and compiler characteristics. |
| 75 | AC_C_CONST |
| 76 | AC_TYPE_SIZE_T |
| 77 | AC_STRUCT_TM |
| 78 | |
| 79 | # Checks for library functions. |
| 80 | AC_FUNC_STRTOD |
| 81 | AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc])) |
| 82 | AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) ) |
| 83 | AC_ARG_WITH(zlib-prefix, |
| 84 | AC_HELP_STRING([--with-zlib-prefix], |
| 85 | [prefix that may have been used in installed zlib]), |
| 86 | [ZPREFIX=${withval}], |
| 87 | [ZPREFIX='z_']) |
| 88 | AC_CHECK_LIB(z, zlibVersion, , |
| 89 | AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , |
| 90 | AC_ERROR([zlib not installed]))) |
| 91 | |
| 92 | |
| 93 | LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG |
| 94 | LIBPNG_DEFINES=$LIBPNG_DEFINES |
| 95 | AC_SUBST(LIBPNG_DEFINES) |
| 96 | |
| 97 | AC_MSG_CHECKING([if libraries can be versioned]) |
| 98 | # Special case for PE/COFF platforms: ld reports |
| 99 | # support for version-script, but doesn't actually |
| 100 | # DO anything with it. |
| 101 | case $host in |
| 102 | *cygwin* | *mingw32* | *interix* ) |
| 103 | have_ld_version_script=no |
| 104 | AC_MSG_RESULT(no) |
| 105 | ;; |
| 106 | * ) |
| 107 | GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` |
| 108 | if test "$GLD"; then |
| 109 | have_ld_version_script=yes |
| 110 | AC_MSG_RESULT(yes) |
| 111 | else |
| 112 | have_ld_version_script=no |
| 113 | AC_MSG_RESULT(no) |
| 114 | AC_MSG_WARN(*** You have not enabled versioned symbols.) |
| 115 | fi |
| 116 | ;; |
| 117 | esac |
| 118 | |
| 119 | AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") |
| 120 | |
| 121 | if test "$have_ld_version_script" = "yes"; then |
| 122 | AC_MSG_CHECKING([for symbol prefix]) |
| 123 | SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ |
| 124 | | ${CPP-${CC-gcc} -E} - 2>&1 \ |
| 125 | | ${EGREP-grep} "^PREFIX=" \ |
| 126 | | ${SED-sed} "s:^PREFIX=::"` |
| 127 | AC_SUBST(SYMBOL_PREFIX) |
| 128 | AC_MSG_RESULT($SYMBOL_PREFIX) |
| 129 | fi |
| 130 | |
| 131 | # Substitutions for .in files |
| 132 | AC_SUBST(PNGLIB_VERSION) |
| 133 | AC_SUBST(PNGLIB_MAJOR) |
| 134 | AC_SUBST(PNGLIB_MINOR) |
| 135 | AC_SUBST(PNGLIB_RELEASE) |
| 136 | |
| 137 | # Additional arguments (and substitutions) |
| 138 | # Allow the pkg-config directory to be set |
| 139 | AC_ARG_WITH(pkgconfigdir, |
| 140 | AC_HELP_STRING([--with-pkgconfigdir], |
| 141 | [Use the specified pkgconfig dir (default is libdir/pkgconfig)]), |
| 142 | [pkgconfigdir=${withval}], |
| 143 | [pkgconfigdir='${libdir}/pkgconfig']) |
| 144 | |
| 145 | AC_SUBST([pkgconfigdir]) |
| 146 | AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}]) |
| 147 | |
| 148 | # Make the *-config binary config scripts optional |
| 149 | AC_ARG_WITH(binconfigs, |
| 150 | AC_HELP_STRING([--with-binconfigs], |
| 151 | [Generate shell libpng-config scripts as well as pkg-config data] |
| 152 | [@<:@default=yes@:>@]), |
| 153 | [if test "${withval}" = no; then |
| 154 | binconfigs= |
| 155 | AC_MSG_NOTICE([libpng-config scripts will not be built]) |
| 156 | else |
| 157 | binconfigs='${binconfigs}' |
| 158 | fi], |
| 159 | [binconfigs='${binconfigs}']) |
| 160 | AC_SUBST([binconfigs]) |
| 161 | |
| 162 | # Config files, substituting as above |
| 163 | AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in]) |
| 164 | AC_CONFIG_FILES([libpng-config:libpng-config.in], |
| 165 | [chmod +x libpng-config]) |
| 166 | |
| 167 | AC_OUTPUT |