Update LOCAL_PATCHES after libsanitizer merge.
[official-gcc.git] / zlib / configure.ac
blob57d6fa56b69b2a90d8a637309639b4ef5c90e196
1 dnl Process this with autoconf to create configure
3 AC_PREREQ(2.64)
4 AC_INIT
5 AC_CONFIG_SRCDIR([zlib.h])
7 if test -n "${with_target_subdir}"; then
8   AM_ENABLE_MULTILIB(, ..)
9 fi
11 AC_CANONICAL_SYSTEM
13 # This works around an automake problem.
14 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
15 AC_SUBST(mkinstalldirs)
17 AM_INIT_AUTOMAKE(zlib, 1.1.4)
19 AM_MAINTAINER_MODE
21 dnl We use these options to decide which functions to include.
22 AC_ARG_WITH(target-subdir,
23 [  --with-target-subdir=SUBDIR
24                           configuring in a subdirectory])
26 if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
27    COMPPATH=.
28 else
29    COMPPATH=..
31 AC_SUBST(COMPPATH)
33 AC_ARG_WITH(cross-host,
34 [  --with-cross-host=HOST  configuring with a cross compiler])
36 dnl Default to --enable-multilib
37 AC_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
45 AC_ARG_WITH(system-zlib,
46 [  --with-system-zlib      use installed libz])
48 # Make sure we don't test executables when making cross-tools.
49 GCC_NO_EXECUTABLES
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.
56 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
57 m4_define([_AC_ARG_VAR_PRECIOUS],[])
58 AC_PROG_CC
59 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
61 AC_SUBST(CFLAGS)
63 AC_PROG_LIBTOOL
65 # Find CPP now so that any conditional tests below won't do it and
66 # thereby make the resulting definitions conditional.
67 AC_PROG_CPP
69 if 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.
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)
79    # We ignore --with-system-zlib in this case.
80    target_all=libzgcj.la
81 else
82    AC_FUNC_MMAP
83    AC_CHECK_FUNCS(memcpy strerror)
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
92 AC_SUBST(target_all)
94 AC_CHECK_HEADERS(unistd.h)
96 if test -n "$with_cross_host" &&
97    test x"$with_cross_host" != x"no"; then
98   toolexecdir='$(exec_prefix)/$(target_alias)'
99   toolexeclibdir='$(toolexecdir)/lib'
100 else
101   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
102   toolexeclibdir='$(libdir)'
104 if 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
109 else
110   multiosdir=
112 toolexeclibdir=${toolexeclibdir}${multiosdir}
113 AC_SUBST(toolexecdir)
114 AC_SUBST(toolexeclibdir)
116 AM_CONDITIONAL(TARGET_LIBRARY, test -n "$with_target_subdir")
118 if test "${multilib}" = "yes"; then
119   multilib_arg="--enable-multilib"
120 else
121   multilib_arg=
124 AC_ARG_ENABLE(host-shared,
125 [AS_HELP_STRING([--enable-host-shared],
126                 [build host code as shared libraries])],
127 [PICFLAG=-fPIC], [PICFLAG=])
128 AC_SUBST(PICFLAG)
130 AC_CONFIG_FILES([Makefile])
131 AC_OUTPUT