blob: 05540c6cd1fe55b744f54d892cd20b2d16c5d50c [file] [log] [blame]
epoger@google.com38a91342011-06-15 13:45:10 +00001# configure.ac
2
3dnl Process this file with autoconf to produce a configure script.
4dnl
5dnl Minor upgrades (compatible ABI): increment the package version
6dnl (third field in two places below) and set the PNGLIB_RELEASE
7dnl variable.
8dnl
9dnl Major upgrades (incompatible ABI): increment the package major
10dnl version (second field, or first if desired), set the minor
11dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
12dnl Makefile.am to upgrade the package name.
13
14dnl This is here to prevent earlier autoconf from being used, it
15dnl should not be necessary to regenerate configure if the time
16dnl stamps are correct
17AC_PREREQ(2.59)
18
19dnl Version number stuff here:
20
21AC_INIT([libpng], [1.5.2], [png-mng-implement@lists.sourceforge.net])
22AM_INIT_AUTOMAKE
23dnl stop configure from automagically running automake
24AM_MAINTAINER_MODE
25
26PNGLIB_VERSION=1.5.2
27PNGLIB_MAJOR=1
28PNGLIB_MINOR=5
29PNGLIB_RELEASE=2
30
31dnl End of version number stuff
32
33AC_CONFIG_SRCDIR([pngget.c])
34AM_CONFIG_HEADER(config.h)
35
36# Checks for programs.
37AC_LANG([C])
38AC_PROG_CC
39AC_PROG_LD
40AC_PROG_CPP
41AC_CHECK_TOOL(SED, sed, :)
42AC_CHECK_TOOL(AWK, awk, :)
43AC_PROG_INSTALL
44AC_PROG_LN_S
45AC_PROG_MAKE_SET
46LT_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:
51AC_REQUIRE_CPP
52AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
53AC_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"])
63if test -n "$DFNCPP"; then
64 AC_MSG_RESULT([$DFNCPP])
65 AC_SUBST(DFNCPP)
66else
67 AC_MSG_FAILURE([not found], 1)
68fi
69
70# Checks for header files.
71AC_HEADER_STDC
72AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
73
74# Checks for typedefs, structures, and compiler characteristics.
75AC_C_CONST
76AC_TYPE_SIZE_T
77AC_STRUCT_TM
78
79# Checks for library functions.
80AC_FUNC_STRTOD
81AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
82AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
83AC_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_'])
88AC_CHECK_LIB(z, zlibVersion, ,
89 AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, ,
90 AC_ERROR([zlib not installed])))
91
92
93LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
94LIBPNG_DEFINES=$LIBPNG_DEFINES
95AC_SUBST(LIBPNG_DEFINES)
96
97AC_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.
101case $host in
102*cygwin* | *mingw32* | *interix* )
103 have_ld_version_script=no
104 AC_MSG_RESULT(no)
105;;
106* )
107GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
108if test "$GLD"; then
109 have_ld_version_script=yes
110 AC_MSG_RESULT(yes)
111else
112 have_ld_version_script=no
113 AC_MSG_RESULT(no)
114 AC_MSG_WARN(*** You have not enabled versioned symbols.)
115fi
116;;
117esac
118
119AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
120
121if 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)
129fi
130
131# Substitutions for .in files
132AC_SUBST(PNGLIB_VERSION)
133AC_SUBST(PNGLIB_MAJOR)
134AC_SUBST(PNGLIB_MINOR)
135AC_SUBST(PNGLIB_RELEASE)
136
137# Additional arguments (and substitutions)
138# Allow the pkg-config directory to be set
139AC_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
145AC_SUBST([pkgconfigdir])
146AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}])
147
148# Make the *-config binary config scripts optional
149AC_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}'])
160AC_SUBST([binconfigs])
161
162# Config files, substituting as above
163AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
164AC_CONFIG_FILES([libpng-config:libpng-config.in],
165 [chmod +x libpng-config])
166
167AC_OUTPUT