Home | History | Annotate | Line # | Download | only in zlib
      1 dnl Process this with autoconf to create configure
      2 
      3 AC_INIT([zlib], [1.1.4])
      4 AC_CONFIG_SRCDIR([zlib.h])
      5 
      6 if test -n "${with_target_subdir}"; then
      7   AM_ENABLE_MULTILIB(, ..)
      8 fi
      9 
     10 AC_CANONICAL_TARGET
     11 
     12 # This works around an automake problem.
     13 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
     14 AC_SUBST(mkinstalldirs)
     15 
     16 AM_INIT_AUTOMAKE
     17 AM_SILENT_RULES([yes])
     18 
     19 AM_MAINTAINER_MODE
     20 
     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])
     25 
     26 if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
     27    COMPPATH=.
     28 else
     29    COMPPATH=..
     30 fi
     31 AC_SUBST(COMPPATH)
     32 
     33 AC_ARG_WITH(cross-host,
     34 [  --with-cross-host=HOST  configuring with a cross compiler])
     35 
     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
     44 
     45 AC_ARG_WITH(system-zlib,
     46 [  --with-system-zlib      use installed libz])
     47 
     48 # Make sure we don't test executables when making cross-tools.
     49 GCC_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 
     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])
     60 
     61 AC_SUBST(CFLAGS)
     62 
     63 LT_INIT
     64 
     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
     68 
     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.
     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
     81 else
     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
     90 fi
     91 
     92 AC_SUBST(target_all)
     93 
     94 AC_CHECK_HEADERS(unistd.h)
     95 
     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)'
    103 fi
    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=
    111 fi
    112 toolexeclibdir=${toolexeclibdir}${multiosdir}
    113 AC_SUBST(toolexecdir)
    114 AC_SUBST(toolexeclibdir)
    115 
    116 AM_CONDITIONAL(TARGET_LIBRARY, test -n "$with_target_subdir")
    117 
    118 if test "${multilib}" = "yes"; then
    119   multilib_arg="--enable-multilib"
    120 else
    121   multilib_arg=
    122 fi
    123 
    124 # Enable --enable-host-shared.
    125 AC_ARG_ENABLE(host-shared,
    126 [AS_HELP_STRING([--enable-host-shared],
    127 		[build host code as shared libraries])])
    128 AC_SUBST(enable_host_shared)
    129 
    130 # Enable --enable-host-pie.
    131 AC_ARG_ENABLE(host-pie,
    132 [AS_HELP_STRING([--enable-host-pie],
    133 		[build host code as PIE])])
    134 AC_SUBST(enable_host_pie)
    135 
    136 if test x$enable_host_shared = xyes; then
    137   PICFLAG=-fPIC
    138 elif test x$enable_host_pie = xyes; then
    139   PICFLAG=-fPIE
    140 else
    141   PICFLAG=
    142 fi
    143 
    144 AC_SUBST(PICFLAG)
    145 AC_CONFIG_FILES([Makefile])
    146 AC_OUTPUT
    147