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