* Makefile.in (PREPROCESSOR_DEFINES): New macro.
[official-gcc.git] / zlib / configure.in
blob8e30c1852b9ed41eb3b7bb8b75959a4ea47c921c
1 dnl Process this with autoconf to create configure
3 AC_INIT(zlib.h)
4 AC_CANONICAL_SYSTEM
5 AM_INIT_AUTOMAKE(zlib, 1.1.3)
7 AM_MAINTAINER_MODE
8 AC_EXEEXT
10 AC_CONFIG_AUX_DIR(..)
12 dnl We use these options to decide which functions to include.
13 AC_ARG_WITH(target-subdir,
14 [  --with-target-subdir=SUBDIR
15                           configuring in a subdirectory])
16 AC_ARG_WITH(cross-host,
17 [  --with-cross-host=HOST  configuring with a cross compiler])
19 dnl Default to --enable-multilib
20 AC_ARG_ENABLE(multilib,
21 [  --enable-multilib       build many library versions (default)],
22 [case "${enableval}" in
23   yes) multilib=yes ;;
24   no)  multilib=no ;;
25   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
26  esac], [multilib=yes])dnl
28 dnl We may get other options which we dont document:
29 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
31 if test "[$]{srcdir}" = "."; then
32   if test "[$]{with_target_subdir}" != "."; then
33     zlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../"
34   else
35     zlib_basedir="[$]{srcdir}/[$]{with_multisrctop}"
36   fi
37 else
38   zlib_basedir="[$]{srcdir}/"
40 AC_SUBST(zlib_basedir)
42 AC_ARG_WITH(system-zlib,
43 [  --with-system-zlib      use installed libz])
45 LIB_AC_PROG_CC
46 AM_PROG_LIBTOOL
48 if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
49    COMPPATH=.
50 else
51    COMPPATH=..
53 AC_SUBST(COMPPATH)
56 if test -n "$with_cross_host"; then
57    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
58    # may not work correctly, because the compiler may not be able to
59    # link executables.
61    # We assume newlib.  This lets us hard-code the functions we know
62    # we'll have.
63    AC_DEFINE(HAVE_MEMCPY)
64    AC_DEFINE(HAVE_STRERROR)
66    # We ignore --with-system-zlib in this case.
67    target_all=libzgcj.la
68 else
69    AC_FUNC_MMAP
70    AC_CHECK_FUNCS(memcpy strerror)
72    if test "$with_system_zlib" = yes; then
73       AC_CHECK_LIB(z, deflate, target_all=, target_all=libzgcj.la)
74    else
75       target_all=libzgcj.la
76    fi
79 AC_SUBST(target_all)
81 AC_CHECK_HEADERS(unistd.h)
83 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
85 if test "${multilib}" = "yes"; then
86   multilib_arg="--enable-multilib"
87 else
88   multilib_arg=
91 AC_OUTPUT(Makefile,
92 [if test -n "$CONFIG_FILES"; then
93   ac_file=Makefile . ${zlib_basedir}/../config-ml.in
94 fi],
95 srcdir=${srcdir}
96 host=${host}
97 target=${target}
98 with_multisubdir=${with_multisubdir}
99 ac_configure_args="${multilib_arg} ${ac_configure_args}"
100 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
101 zlib_basedir=${zlib_basedir}
102 CC="${CC}"
103 CXX="${CXX}"