1dnl Process this with autoconf to create configure
2
3AC_INIT([zlib], [1.1.4])
4AC_CONFIG_SRCDIR([zlib.h])
5
6if test -n "${with_target_subdir}"; then
7  AM_ENABLE_MULTILIB(, ..)
8fi
9
10AC_CANONICAL_SYSTEM
11
12# This works around an automake problem.
13mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
14AC_SUBST(mkinstalldirs)
15
16AM_INIT_AUTOMAKE
17
18AM_MAINTAINER_MODE
19
20dnl We use these options to decide which functions to include.
21AC_ARG_WITH(target-subdir,
22[  --with-target-subdir=SUBDIR
23                          configuring in a subdirectory])
24
25if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
26   COMPPATH=.
27else
28   COMPPATH=..
29fi
30AC_SUBST(COMPPATH)
31
32AC_ARG_WITH(cross-host,
33[  --with-cross-host=HOST  configuring with a cross compiler])
34
35dnl Default to --enable-multilib
36AC_ARG_ENABLE(multilib,
37[  --enable-multilib       build many library versions (default)],
38[case "${enableval}" in
39  yes) multilib=yes ;;
40  no)  multilib=no ;;
41  *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
42 esac], [test -z "$with_target_subdir" && multilib=no || multilib=yes])dnl
43
44AC_ARG_WITH(system-zlib,
45[  --with-system-zlib      use installed libz])
46
47# Make sure we don't test executables when making cross-tools.
48GCC_NO_EXECUTABLES
49
50# The same as in boehm-gc and libstdc++. Have to borrow it from there.
51# We must force CC to /not/ be precious variables; otherwise
52# the wrong, non-multilib-adjusted value will be used in multilibs.
53# As a side effect, we have to subst CFLAGS ourselves.
54
55m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
56m4_define([_AC_ARG_VAR_PRECIOUS],[])
57AC_PROG_CC
58m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
59
60AC_SUBST(CFLAGS)
61
62AC_PROG_LIBTOOL
63
64# Find CPP now so that any conditional tests below won't do it and
65# thereby make the resulting definitions conditional.
66AC_PROG_CPP
67
68if test -n "$with_cross_host"; then
69   # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
70   # may not work correctly, because the compiler may not be able to
71   # link executables.
72
73   # We assume newlib.  This lets us hard-code the functions we know
74   # we'll have.
75   AC_DEFINE(HAVE_MEMCPY)
76   AC_DEFINE(HAVE_STRERROR)
77
78   # We ignore --with-system-zlib in this case.
79   target_all=libzgcj.la
80else
81   AC_FUNC_MMAP
82   AC_CHECK_FUNCS(memcpy strerror)
83
84   if test "$with_system_zlib" = yes; then
85      AC_CHECK_LIB(z, deflate, target_all=, target_all=libzgcj.la)
86   else
87      target_all=libzgcj.la
88   fi
89fi
90
91AC_SUBST(target_all)
92
93AC_CHECK_HEADERS(unistd.h)
94
95if test -n "$with_cross_host" &&
96   test x"$with_cross_host" != x"no"; then
97  toolexecdir='$(exec_prefix)/$(target_alias)'
98  toolexeclibdir='$(toolexecdir)/lib'
99else
100  toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
101  toolexeclibdir='$(libdir)'
102fi
103if test "$GCC" = yes && $CC -print-multi-os-directory > /dev/null 2>&1; then
104  multiosdir=/`$CC -print-multi-os-directory`
105  case $multiosdir in
106    /.) multiosdir= ;; # Avoid trailing /.
107  esac
108else
109  multiosdir=
110fi
111toolexeclibdir=${toolexeclibdir}${multiosdir}
112AC_SUBST(toolexecdir)
113AC_SUBST(toolexeclibdir)
114
115AM_CONDITIONAL(TARGET_LIBRARY, test -n "$with_target_subdir")
116
117if test "${multilib}" = "yes"; then
118  multilib_arg="--enable-multilib"
119else
120  multilib_arg=
121fi
122
123AC_ARG_ENABLE(host-shared,
124[AS_HELP_STRING([--enable-host-shared],
125		[build host code as shared libraries])],
126[PICFLAG=-fPIC], [PICFLAG=])
127AC_SUBST(PICFLAG)
128
129AC_CONFIG_FILES([Makefile])
130AC_OUTPUT
131