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