16fae3cbedf5981d99d937ea906f28ba4c0e2ccc
[gcc.git] / zlib / configure.in
1 dnl Process this with autoconf to create configure
2
3 AC_INIT(zlib.h)
4 AC_CANONICAL_SYSTEM
5 AM_INIT_AUTOMAKE(zlib, 1.1.3)
6
7 AM_MAINTAINER_MODE
8 AC_EXEEXT
9
10 AC_CONFIG_AUX_DIR(..)
11
12 dnl We use these options to decide which functions to include.
13 AC_ARG_WITH(target-subdir,
14 [ --with-target-subdir=SUBDIR Configuring in a subdirectory])
15 AC_ARG_WITH(cross-host,
16 [ --with-cross-host=HOST Configuring with a cross compiler])
17
18 dnl Default to --enable-multilib
19 AC_ARG_ENABLE(multilib,
20 [ --enable-multilib build many library versions (default)],
21 [case "${enableval}" in
22 yes) multilib=yes ;;
23 no) multilib=no ;;
24 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
25 esac], [multilib=yes])dnl
26
27 dnl We may get other options which we dont document:
28 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
29
30 if test "[$]{srcdir}" = "."; then
31 if test "[$]{with_target_subdir}" != "."; then
32 zlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../"
33 else
34 zlib_basedir="[$]{srcdir}/[$]{with_multisrctop}"
35 fi
36 else
37 zlib_basedir="[$]{srcdir}/"
38 fi
39 AC_SUBST(zlib_basedir)
40
41 LIB_AC_PROG_CC
42 AM_PROG_LIBTOOL
43
44 if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
45 COMPPATH=.
46 else
47 COMPPATH=..
48 fi
49 AC_SUBST(COMPPATH)
50
51
52 if test -n "$with_cross_host"; then
53 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
54 # may not work correctly, because the compiler may not be able to
55 # link executables.
56
57 # We assume newlib. This lets us hard-code the functions we know
58 # we'll have.
59 AC_DEFINE(HAVE_MEMCPY)
60 AC_DEFINE(HAVE_STRERROR)
61 else
62 AC_FUNC_MMAP
63 AC_CHECK_FUNCS(memcpy strerror)
64 fi
65
66 AC_CHECK_HEADERS(unistd.h)
67
68 if test "${multilib}" = "yes"; then
69 multilib_arg="--enable-multilib"
70 else
71 multilib_arg=
72 fi
73
74 AC_OUTPUT(Makefile,
75 [if test -n "$CONFIG_FILES"; then
76 ac_file=Makefile . ${zlib_basedir}/../config-ml.in
77 fi],
78 srcdir=${srcdir}
79 host=${host}
80 target=${target}
81 with_multisubdir=${with_multisubdir}
82 ac_configure_args="${multilib_arg} ${ac_configure_args}"
83 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
84 zlib_basedir=${zlib_basedir}
85 CC="${CC}"
86 CXX="${CXX}"
87 )