blob: 92520a485f914523ae33516cf6baacdb6dfacdc4 [file] [log] [blame]
The Android Open Source Project893912b2009-03-03 19:30:05 -08001# 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.2.29], [png-mng-implement@lists.sourceforge.net])
22AM_INIT_AUTOMAKE
23dnl stop configure from automagically running automake
24AM_MAINTAINER_MODE
25
26PNGLIB_VERSION=1.2.29
27PNGLIB_MAJOR=1
28PNGLIB_MINOR=2
29PNGLIB_RELEASE=29
30
31dnl End of version number stuff
32
33AC_CONFIG_SRCDIR([pngget.c])
34AM_CONFIG_HEADER(config.h)
35
36# Checks for programs.
37AC_PROG_CC
38AC_PROG_LD
39AC_PROG_CPP
40AC_CHECK_TOOL(SED, sed, :)
41AC_LIBTOOL_WIN32_DLL
42AC_PROG_INSTALL
43AC_PROG_LN_S
44AC_PROG_MAKE_SET
45AC_PROG_LIBTOOL
46
47# Checks for header files.
48AC_HEADER_STDC
49AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
50
51# Checks for typedefs, structures, and compiler characteristics.
52AC_C_CONST
53AC_TYPE_SIZE_T
54AC_STRUCT_TM
55
56# Checks for library functions.
57AC_FUNC_STRTOD
58AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
59AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
60AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
61
62LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
63AC_MSG_CHECKING(
64 [if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
65AC_TRY_COMPILE(
66 [#include "$srcdir/pnggccrd.c"],
67 [return 0;],
68 AC_MSG_RESULT(yes)
69 LIBPNG_NO_MMX="",
70 AC_MSG_RESULT(no)
71 LIBPNG_NO_MMX=-DPNG_NO_MMX_CODE)
72LIBPNG_DEFINES=$LIBPNG_DEFINES\ $LIBPNG_NO_MMX
73AC_SUBST(LIBPNG_DEFINES)
74AC_SUBST(LIBPNG_NO_MMX)
75
76AC_MSG_CHECKING([if libraries can be versioned])
77GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
78if test "$GLD"; then
79 have_ld_version_script=yes
80 AC_MSG_RESULT(yes)
81else
82 have_ld_version_script=no
83 AC_MSG_RESULT(no)
84 AC_MSG_WARN(*** You have not enabled versioned symbols.)
85fi
86AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
87
88if test "$have_ld_version_script" = "yes"; then
89 AC_MSG_CHECKING([for symbol prefix])
90 SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
91 | ${CPP-${CC-gcc} -E} - 2>&1 \
92 | ${EGREP-grep} "^PREFIX=" \
93 | ${SED-sed} "s:^PREFIX=::"`
94 AC_SUBST(SYMBOL_PREFIX)
95 AC_MSG_RESULT($SYMBOL_PREFIX)
96fi
97
98# Substitutions for .in files
99AC_SUBST(PNGLIB_VERSION)
100AC_SUBST(PNGLIB_MAJOR)
101AC_SUBST(PNGLIB_MINOR)
102AC_SUBST(PNGLIB_RELEASE)
103
104# Additional arguments (and substitutions)
105# Allow the pkg-config directory to be set
106AC_ARG_WITH(pkgconfigdir,
107 AC_HELP_STRING([--with-pkgconfigdir],
108 [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
109 [pkgconfigdir=${withval}],
110 [pkgconfigdir='${libdir}/pkgconfig'])
111
112AC_SUBST([pkgconfigdir])
113AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}])
114
115# Make the *-config binary config scripts optional
116AC_ARG_WITH(binconfigs,
117 AC_HELP_STRING([--with-binconfigs],
118 [Generate shell libpng-config scripts as well as pkg-config data]
119 [@<:@default=yes@:>@]),
120 [if test "${withval}" = no; then
121 binconfigs=
122 AC_MSG_NOTICE([libpng-config scripts will not be built])
123 else
124 binconfigs='${binconfigs}'
125 fi],
126 [binconfigs='${binconfigs}'])
127AC_SUBST([binconfigs])
128
129# Allow the old version number library, libpng.so, to be removed from
130# the build
131AC_ARG_WITH(libpng-compat,
132 AC_HELP_STRING([--with-libpng-compat],
133 [Generate the obsolete libpng.so library @<:@default=yes@:>@]),
134 [if test "${withval}" = no; then
135 compatlib=
136 AC_MSG_NOTICE([libpng.so will not be built])
137 else
138 compatlib=libpng.la
139 fi],
140 [compatlib=libpng.la])
141AC_SUBST([compatlib])
142
143# Config files, substituting as above
144AC_CONFIG_FILES([Makefile libpng.pc:scripts/libpng.pc-configure.in])
145AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in],
146 [chmod +x libpng-config])
147
148AC_OUTPUT