OSDN Git Service

2002-01-04 H.J. Lu <hjl@gnu.org>
[pf3gnuchains/gcc-fork.git] / zlib / configure.in
1 dnl Process this with autoconf to create configure
2
3 AC_INIT(zlib.h)
4
5 dnl We may get other options which we dont document:
6 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
7
8 if test "x[$]{with_target_subdir}" != x && \
9    test "[$]{srcdir}" = "."; then
10   if test "[$]{with_target_subdir}" != "."; then
11     zlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../"
12   else
13     zlib_basedir="[$]{srcdir}/[$]{with_multisrctop}"
14   fi
15 else
16   zlib_basedir="[$]{srcdir}/"
17 fi
18 AC_SUBST(zlib_basedir)
19 AC_CONFIG_AUX_DIR($zlib_basedir..)
20 if :; then :; else
21   # This overrides the previous occurrence for automake, but not for
22   # autoconf, which is exactly what we want.
23   AC_CONFIG_AUX_DIR(..)
24 fi
25
26 AC_CANONICAL_SYSTEM
27
28 # This works around an automake problem.
29 mkinstalldirs="`cd $ac_aux_dir && pwd`/mkinstalldirs"
30 AC_SUBST(mkinstalldirs)
31
32 AM_INIT_AUTOMAKE(zlib, 1.1.3)
33
34 AM_MAINTAINER_MODE
35
36 dnl We use these options to decide which functions to include.
37 AC_ARG_WITH(target-subdir,
38 [  --with-target-subdir=SUBDIR
39                           configuring in a subdirectory])
40 AC_ARG_WITH(cross-host,
41 [  --with-cross-host=HOST  configuring with a cross compiler])
42
43 dnl Default to --enable-multilib
44 AC_ARG_ENABLE(multilib,
45 [  --enable-multilib       build many library versions (default)],
46 [case "${enableval}" in
47   yes) multilib=yes ;;
48   no)  multilib=no ;;
49   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
50  esac], [test -z "$with_target_subdir" && multilib=no || multilib=yes])dnl
51
52 AC_ARG_WITH(system-zlib,
53 [  --with-system-zlib      use installed libz])
54
55 LIB_AC_PROG_CC
56 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
57 # at least currently, we never actually build a program, so we never
58 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
59 # fails, because we are probably configuring with a cross compiler
60 # which cant create executables.  So we include AC_EXEEXT to keep
61 # automake happy, but we dont execute it, since we dont care about
62 # the result.
63 if false; then
64   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
65   # to nothing, so nothing would remain between `then' and `fi' if it
66   # were not for the `:' below.
67   :
68   AC_EXEEXT
69 fi
70 AM_PROG_LIBTOOL
71
72 if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
73    COMPPATH=.
74 else
75    COMPPATH=..
76 fi
77 AC_SUBST(COMPPATH)
78
79 # Find CPP now so that any conditional tests below won't do it and
80 # thereby make the resulting definitions conditional.
81 AC_PROG_CPP
82
83 if test -n "$with_cross_host"; then
84    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
85    # may not work correctly, because the compiler may not be able to
86    # link executables.
87
88    # We assume newlib.  This lets us hard-code the functions we know
89    # we'll have.
90    AC_DEFINE(HAVE_MEMCPY)
91    AC_DEFINE(HAVE_STRERROR)
92
93    # We ignore --with-system-zlib in this case.
94    target_all=libzgcj.la
95 else
96    AC_FUNC_MMAP
97    AC_CHECK_FUNCS(memcpy strerror)
98
99    if test "$with_system_zlib" = yes; then
100       AC_CHECK_LIB(z, deflate, target_all=, target_all=libzgcj.la)
101    else
102       target_all=libzgcj.la
103    fi
104 fi
105
106 AC_SUBST(target_all)
107
108 AC_CHECK_HEADERS(unistd.h)
109
110 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
111 AM_CONDITIONAL(TARGET_LIBRARY, test -n "$with_target_subdir")
112
113 if test "${multilib}" = "yes"; then
114   multilib_arg="--enable-multilib"
115 else
116   multilib_arg=
117 fi
118
119 AC_OUTPUT(Makefile,
120 [if test -n "$CONFIG_FILES"; then
121   ac_file=Makefile . ${zlib_basedir}/../config-ml.in
122 fi],
123 srcdir=${srcdir}
124 host=${host}
125 target=${target}
126 with_multisubdir=${with_multisubdir}
127 ac_configure_args="${multilib_arg} ${ac_configure_args}"
128 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
129 zlib_basedir=${zlib_basedir}
130 CC="${CC}"
131 CXX="${CXX}"
132 )