* MAINTAINERS (Write After Approval): Add myself.
[gcc.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 AM_INIT_AUTOMAKE(zlib, 1.1.3)
28
29 AM_MAINTAINER_MODE
30
31 dnl We use these options to decide which functions to include.
32 AC_ARG_WITH(target-subdir,
33 [ --with-target-subdir=SUBDIR
34 configuring in a subdirectory])
35 AC_ARG_WITH(cross-host,
36 [ --with-cross-host=HOST configuring with a cross compiler])
37
38 dnl Default to --enable-multilib
39 AC_ARG_ENABLE(multilib,
40 [ --enable-multilib build many library versions (default)],
41 [case "${enableval}" in
42 yes) multilib=yes ;;
43 no) multilib=no ;;
44 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
45 esac], [test -z "$with_target_subdir" && multilib=no || multilib=yes])dnl
46
47 AC_ARG_WITH(system-zlib,
48 [ --with-system-zlib use installed libz])
49
50 LIB_AC_PROG_CC
51 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
52 # at least currently, we never actually build a program, so we never
53 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
54 # fails, because we are probably configuring with a cross compiler
55 # which cant create executables. So we include AC_EXEEXT to keep
56 # automake happy, but we dont execute it, since we dont care about
57 # the result.
58 if false; then
59 AC_EXEEXT
60 fi
61 AM_PROG_LIBTOOL
62
63 if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
64 COMPPATH=.
65 else
66 COMPPATH=..
67 fi
68 AC_SUBST(COMPPATH)
69
70 # Find CPP now so that any conditional tests below won't do it and
71 # thereby make the resulting definitions conditional.
72 AC_PROG_CPP
73
74 if test -n "$with_cross_host"; then
75 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
76 # may not work correctly, because the compiler may not be able to
77 # link executables.
78
79 # We assume newlib. This lets us hard-code the functions we know
80 # we'll have.
81 AC_DEFINE(HAVE_MEMCPY)
82 AC_DEFINE(HAVE_STRERROR)
83
84 # We ignore --with-system-zlib in this case.
85 target_all=libzgcj.la
86 else
87 AC_FUNC_MMAP
88 AC_CHECK_FUNCS(memcpy strerror)
89
90 if test "$with_system_zlib" = yes; then
91 AC_CHECK_LIB(z, deflate, target_all=, target_all=libzgcj.la)
92 else
93 target_all=libzgcj.la
94 fi
95 fi
96
97 AC_SUBST(target_all)
98
99 AC_CHECK_HEADERS(unistd.h)
100
101 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
102 AM_CONDITIONAL(TARGET_LIBRARY, test -n "$with_target_subdir")
103
104 if test "${multilib}" = "yes"; then
105 multilib_arg="--enable-multilib"
106 else
107 multilib_arg=
108 fi
109
110 AC_OUTPUT(Makefile,
111 [if test -n "$CONFIG_FILES"; then
112 ac_file=Makefile . ${zlib_basedir}/../config-ml.in
113 fi],
114 srcdir=${srcdir}
115 host=${host}
116 target=${target}
117 with_multisubdir=${with_multisubdir}
118 ac_configure_args="${multilib_arg} ${ac_configure_args}"
119 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
120 zlib_basedir=${zlib_basedir}
121 CC="${CC}"
122 CXX="${CXX}"
123 )