configure.ac 3.4 KB

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