1 # Do all the work for Automake. -*- Autoconf -*-
3 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This macro actually does too much. Some checks are only needed if
10 # your package does certain things. But this isn't really a big deal.
12 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
13 # AM_INIT_AUTOMAKE([OPTIONS])
14 # -----------------------------------------------
15 # The call with PACKAGE and VERSION arguments is the old style
16 # call (pre autoconf-2.50), which is being phased out. PACKAGE
17 # and VERSION should now be passed to AC_INIT and removed from
18 # the call to AM_INIT_AUTOMAKE.
19 # We support both call styles for the transition. After
20 # the next Automake release, Autoconf can make the AC_INIT
21 # arguments mandatory, and then we can depend on a new Autoconf
22 # release and drop the old call support.
23 AC_DEFUN([AM_INIT_AUTOMAKE],
25 dnl Autoconf wants to disallow AM_ names. We explicitly allow
26 dnl the ones we care about.
27 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
28 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
29 AC_REQUIRE([AC_PROG_INSTALL])dnl
30 if test "`cd $srcdir && pwd`" != "`pwd`"; then
31 # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
32 # is not polluted with repeated "-I."
33 AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
34 # test to see if srcdir already configured
35 if test -f $srcdir/config.status; then
36 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
40 # test whether we have cygpath
41 if test -z "$CYGPATH_W"; then
42 if (cygpath --version) >/dev/null 2>/dev/null; then
43 CYGPATH_W='cygpath -w'
50 # Define the identity of the package.
51 dnl Distinguish between old-style and new-style calls.
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.
61 m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [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
67 _AM_IF_OPTION([no-define],,
68 [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
69 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
71 # Some tools Automake needs.
72 AC_REQUIRE([AM_SANITY_CHECK])dnl
73 AC_REQUIRE([AC_ARG_PROGRAM])dnl
74 AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
75 AM_MISSING_PROG([AUTOCONF], [autoconf])
76 AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
77 AM_MISSING_PROG([AUTOHEADER], [autoheader])
78 AM_MISSING_PROG([MAKEINFO], [makeinfo])
79 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
80 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
81 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
82 # For better backward compatibility. To be removed once Automake 1.9.x
83 # dies out for good. For more background, see:
84 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
85 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
86 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
87 # We need awk for the "check" target. The system "awk" is bad on
89 AC_REQUIRE([AC_PROG_AWK])dnl
90 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
91 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
92 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
93 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
94 [_AM_PROG_TAR([v7])])])
95 _AM_IF_OPTION([no-dependencies],,
96 [AC_PROVIDE_IFELSE([AC_PROG_CC],
97 [_AM_DEPENDENCIES([CC])],
98 [m4_define([AC_PROG_CC],
99 m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
100 AC_PROVIDE_IFELSE([AC_PROG_CXX],
101 [_AM_DEPENDENCIES([CXX])],
102 [m4_define([AC_PROG_CXX],
103 m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
104 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
105 [_AM_DEPENDENCIES([OBJC])],
106 [m4_define([AC_PROG_OBJC],
107 m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
108 AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
109 [_AM_DEPENDENCIES([OBJCXX])],
110 [m4_define([AC_PROG_OBJCXX],
111 m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
113 AC_REQUIRE([AM_SILENT_RULES])dnl
114 dnl The testsuite driver may need to know about EXEEXT, so add the
115 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
116 dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
117 AC_CONFIG_COMMANDS_PRE(dnl
118 [m4_provide_if([_AM_COMPILER_EXEEXT],
119 [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
121 # POSIX will say in a future version that running "rm -f" with no argument
122 # is OK; and we want to be able to make that assumption in our Makefile
123 # recipes. So use an aggressive probe to check that the usage we want is
124 # actually supported "in the wild" to an acceptable degree.
125 # See automake bug#10828.
126 # To make any issue more visible, cause the running configure to be aborted
127 # by default if the 'rm' program in use doesn't match our expectations; the
128 # user can still override this though.
129 if rm -f && rm -fr && rm -rf; then : OK; else
133 Your 'rm' program seems unable to run without file operands specified
134 on the command line, even when the '-f' option is present. This is contrary
135 to the behaviour of most rm programs out there, and not conforming with
136 the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
138 Please tell bug-automake@gnu.org about your system, including the value
139 of your $PATH and any error possibly output before this message. This
140 can help us improve future automake versions.
143 if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
144 echo 'Configuration will proceed anyway, since you have set the' >&2
145 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
149 Aborting the configuration process, to ensure you take notice of the issue.
151 You can download and install GNU coreutils to get an 'rm' implementation
152 that behaves properly: <http://www.gnu.org/software/coreutils/>.
154 If you want to complete the configuration process using your problematic
155 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
156 to "yes", and re-run configure.
159 AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
163 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
164 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
165 dnl mangled by Autoconf and run in a shell conditional statement.
166 m4_define([_AC_COMPILER_EXEEXT],
167 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
169 dnl We have to redefine AC_PROG_CC to allow our compile rules to use
170 dnl "-c -o" together also with losing compilers.
171 dnl FIXME: Add references to the original discussion and bug report.
172 dnl FIXME: Shameless copy & paste from Autoconf internals, since trying to
173 dnl play smart among tangles of AC_REQUIRE, m4_defn, m4_provide and
174 dnl other tricks was proving too difficult, and in the end, likely
175 dnl more brittle too. And this should anyway be just a temporary
176 dnl band-aid, until Autoconf provides the semantics and/or hooks we
177 dnl need (hint hint, nudge nudge) ...
178 AC_DEFUN([AC_PROG_CC],
179 m4_defn([AC_PROG_CC])
180 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
181 AC_REQUIRE_AUX_FILE([compile])dnl
182 dnl FIXME The following abomination is expected to disappear in
184 AC_MSG_CHECKING([whether $CC understands -c and -o together])
185 set dummy $CC; am__cc=`AS_ECHO(["$[2]"]) | \
186 sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
187 AC_CACHE_VAL([am_cv_prog_cc_${am__cc}_c_o],
188 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
189 # Make sure it works both with $CC and with simple cc.
190 # We do the test twice because some compilers refuse to overwrite an
191 # existing .o file with -o, though they will create one.
192 ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
194 if _AC_DO_VAR(ac_try) && test -f conftest2.$ac_objext
196 eval am_cv_prog_cc_${am__cc}_c_o=yes
198 eval am_cv_prog_cc_${am__cc}_c_o=no
202 if eval test \"\$am_cv_prog_cc_${am__cc}_c_o\" = yes; then
206 # Losing compiler, so wrap it with the 'compile' script.
207 # FIXME: It is wrong to rewrite CC.
208 # But if we don't then we get into trouble of one sort or another.
209 # A longer-term fix would be to have automake use am__CC in this case,
210 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
211 CC="$am_aux_dir/compile $CC"
215 # When config.status generates a header, we must update the stamp-h file.
216 # This file resides in the same directory as the config header
217 # that is generated. The stamp files are numbered to have different names.
219 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
220 # loop where config.status creates the headers, so we can generate
221 # our stamp files there.
222 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
223 [# Compute $1's index in $config_headers.
226 for _am_header in $config_headers :; do
228 $_am_arg | $_am_arg:* )
231 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
234 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])