OSDN Git Service

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