]> git.ipfire.org Git - thirdparty/gcc.git/blob - zlib/configure.in
configure.in (zlib_basedir): Cope with empty with_target_subdir
[thirdparty/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
9 AC_CONFIG_AUX_DIR(..)
10
11 dnl We use these options to decide which functions to include.
12 AC_ARG_WITH(target-subdir,
13 [ --with-target-subdir=SUBDIR
14 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], [test -z "$with_target_subdir" && multilib=no || 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 "x[$]{with_target_subdir}" != x && \
31 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}/"
39 fi
40 AC_SUBST(zlib_basedir)
41
42 AC_ARG_WITH(system-zlib,
43 [ --with-system-zlib use installed libz])
44
45 LIB_AC_PROG_CC
46 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
47 # at least currently, we never actually build a program, so we never
48 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
49 # fails, because we are probably configuring with a cross compiler
50 # which cant create executables. So we include AC_EXEEXT to keep
51 # automake happy, but we dont execute it, since we dont care about
52 # the result.
53 if false; then
54 AC_EXEEXT
55 fi
56 AM_PROG_LIBTOOL
57
58 if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
59 COMPPATH=.
60 else
61 COMPPATH=..
62 fi
63 AC_SUBST(COMPPATH)
64
65
66 if test -n "$with_cross_host"; then
67 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
68 # may not work correctly, because the compiler may not be able to
69 # link executables.
70
71 # We assume newlib. This lets us hard-code the functions we know
72 # we'll have.
73 AC_DEFINE(HAVE_MEMCPY)
74 AC_DEFINE(HAVE_STRERROR)
75
76 # We ignore --with-system-zlib in this case.
77 target_all=libzgcj.la
78 else
79 AC_FUNC_MMAP
80 AC_CHECK_FUNCS(memcpy strerror)
81
82 if test "$with_system_zlib" = yes; then
83 AC_CHECK_LIB(z, deflate, target_all=, target_all=libzgcj.la)
84 else
85 target_all=libzgcj.la
86 fi
87 fi
88
89 AC_SUBST(target_all)
90
91 AC_CHECK_HEADERS(unistd.h)
92
93 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
94 AM_CONDITIONAL(TARGET_LIBRARY, test -n "$with_target_subdir")
95
96 if test "${multilib}" = "yes"; then
97 multilib_arg="--enable-multilib"
98 else
99 multilib_arg=
100 fi
101
102 AC_OUTPUT(Makefile,
103 [if test -n "$CONFIG_FILES"; then
104 ac_file=Makefile . ${zlib_basedir}/../config-ml.in
105 fi],
106 srcdir=${srcdir}
107 host=${host}
108 target=${target}
109 with_multisubdir=${with_multisubdir}
110 ac_configure_args="${multilib_arg} ${ac_configure_args}"
111 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
112 zlib_basedir=${zlib_basedir}
113 CC="${CC}"
114 CXX="${CXX}"
115 )