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