init.m4 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. # Do all the work for Automake. -*- Autoconf -*-
  2. # Copyright (C) 1996-2017 Free Software Foundation, Inc.
  3. #
  4. # This file is free software; the Free Software Foundation
  5. # gives unlimited permission to copy and/or distribute it,
  6. # with or without modifications, as long as this notice is preserved.
  7. # This macro actually does too much. Some checks are only needed if
  8. # your package does certain things. But this isn't really a big deal.
  9. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
  10. m4_define([AC_PROG_CC],
  11. m4_defn([AC_PROG_CC])
  12. [_AM_PROG_CC_C_O
  13. ])
  14. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
  15. # AM_INIT_AUTOMAKE([OPTIONS])
  16. # -----------------------------------------------
  17. # The call with PACKAGE and VERSION arguments is the old style
  18. # call (pre autoconf-2.50), which is being phased out. PACKAGE
  19. # and VERSION should now be passed to AC_INIT and removed from
  20. # the call to AM_INIT_AUTOMAKE.
  21. # We support both call styles for the transition. After
  22. # the next Automake release, Autoconf can make the AC_INIT
  23. # arguments mandatory, and then we can depend on a new Autoconf
  24. # release and drop the old call support.
  25. AC_DEFUN([AM_INIT_AUTOMAKE],
  26. [AC_PREREQ([2.65])dnl
  27. dnl Autoconf wants to disallow AM_ names. We explicitly allow
  28. dnl the ones we care about.
  29. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
  30. AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
  31. AC_REQUIRE([AC_PROG_INSTALL])dnl
  32. if test "`cd $srcdir && pwd`" != "`pwd`"; then
  33. # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
  34. # is not polluted with repeated "-I."
  35. AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
  36. # test to see if srcdir already configured
  37. if test -f $srcdir/config.status; then
  38. AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
  39. fi
  40. fi
  41. # test whether we have cygpath
  42. if test -z "$CYGPATH_W"; then
  43. if (cygpath --version) >/dev/null 2>/dev/null; then
  44. CYGPATH_W='cygpath -w'
  45. else
  46. CYGPATH_W=echo
  47. fi
  48. fi
  49. AC_SUBST([CYGPATH_W])
  50. # Define the identity of the package.
  51. dnl Distinguish between old-style and new-style calls.
  52. m4_ifval([$2],
  53. [AC_DIAGNOSE([obsolete],
  54. [$0: two- and three-arguments forms are deprecated.])
  55. m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  56. AC_SUBST([PACKAGE], [$1])dnl
  57. AC_SUBST([VERSION], [$2])],
  58. [_AM_SET_OPTIONS([$1])dnl
  59. dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
  60. m4_if(
  61. m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
  62. [ok:ok],,
  63. [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  64. AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  65. AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
  66. _AM_IF_OPTION([no-define],,
  67. [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
  68. AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
  69. # Some tools Automake needs.
  70. AC_REQUIRE([AM_SANITY_CHECK])dnl
  71. AC_REQUIRE([AC_ARG_PROGRAM])dnl
  72. AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
  73. AM_MISSING_PROG([AUTOCONF], [autoconf])
  74. AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
  75. AM_MISSING_PROG([AUTOHEADER], [autoheader])
  76. AM_MISSING_PROG([MAKEINFO], [makeinfo])
  77. AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
  78. AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
  79. AC_REQUIRE([AC_PROG_MKDIR_P])dnl
  80. # For better backward compatibility. To be removed once Automake 1.9.x
  81. # dies out for good. For more background, see:
  82. # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
  83. # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
  84. AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
  85. # We need awk for the "check" target (and possibly the TAP driver). The
  86. # system "awk" is bad on some platforms.
  87. AC_REQUIRE([AC_PROG_AWK])dnl
  88. AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  89. AC_REQUIRE([AM_SET_LEADING_DOT])dnl
  90. _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
  91. [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
  92. [_AM_PROG_TAR([v7])])])
  93. _AM_IF_OPTION([no-dependencies],,
  94. [AC_PROVIDE_IFELSE([AC_PROG_CC],
  95. [_AM_DEPENDENCIES([CC])],
  96. [m4_define([AC_PROG_CC],
  97. m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
  98. AC_PROVIDE_IFELSE([AC_PROG_CXX],
  99. [_AM_DEPENDENCIES([CXX])],
  100. [m4_define([AC_PROG_CXX],
  101. m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
  102. AC_PROVIDE_IFELSE([AC_PROG_OBJC],
  103. [_AM_DEPENDENCIES([OBJC])],
  104. [m4_define([AC_PROG_OBJC],
  105. m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
  106. AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
  107. [_AM_DEPENDENCIES([OBJCXX])],
  108. [m4_define([AC_PROG_OBJCXX],
  109. m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
  110. ])
  111. AC_REQUIRE([AM_SILENT_RULES])dnl
  112. dnl The testsuite driver may need to know about EXEEXT, so add the
  113. dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
  114. dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
  115. AC_CONFIG_COMMANDS_PRE(dnl
  116. [m4_provide_if([_AM_COMPILER_EXEEXT],
  117. [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
  118. # POSIX will say in a future version that running "rm -f" with no argument
  119. # is OK; and we want to be able to make that assumption in our Makefile
  120. # recipes. So use an aggressive probe to check that the usage we want is
  121. # actually supported "in the wild" to an acceptable degree.
  122. # See automake bug#10828.
  123. # To make any issue more visible, cause the running configure to be aborted
  124. # by default if the 'rm' program in use doesn't match our expectations; the
  125. # user can still override this though.
  126. if rm -f && rm -fr && rm -rf; then : OK; else
  127. cat >&2 <<'END'
  128. Oops!
  129. Your 'rm' program seems unable to run without file operands specified
  130. on the command line, even when the '-f' option is present. This is contrary
  131. to the behaviour of most rm programs out there, and not conforming with
  132. the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
  133. Please tell bug-automake@gnu.org about your system, including the value
  134. of your $PATH and any error possibly output before this message. This
  135. can help us improve future automake versions.
  136. END
  137. if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
  138. echo 'Configuration will proceed anyway, since you have set the' >&2
  139. echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
  140. echo >&2
  141. else
  142. cat >&2 <<'END'
  143. Aborting the configuration process, to ensure you take notice of the issue.
  144. You can download and install GNU coreutils to get an 'rm' implementation
  145. that behaves properly: <http://www.gnu.org/software/coreutils/>.
  146. If you want to complete the configuration process using your problematic
  147. 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
  148. to "yes", and re-run configure.
  149. END
  150. AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
  151. fi
  152. fi
  153. dnl The trailing newline in this macro's definition is deliberate, for
  154. dnl backward compatibility and to allow trailing 'dnl'-style comments
  155. dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
  156. ])
  157. dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
  158. dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
  159. dnl mangled by Autoconf and run in a shell conditional statement.
  160. m4_define([_AC_COMPILER_EXEEXT],
  161. m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
  162. # When config.status generates a header, we must update the stamp-h file.
  163. # This file resides in the same directory as the config header
  164. # that is generated. The stamp files are numbered to have different names.
  165. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
  166. # loop where config.status creates the headers, so we can generate
  167. # our stamp files there.
  168. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
  169. [# Compute $1's index in $config_headers.
  170. _am_arg=$1
  171. _am_stamp_count=1
  172. for _am_header in $config_headers :; do
  173. case $_am_header in
  174. $_am_arg | $_am_arg:* )
  175. break ;;
  176. * )
  177. _am_stamp_count=`expr $_am_stamp_count + 1` ;;
  178. esac
  179. done
  180. echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])