+dnl automake 1.13 and later understand this, making -I m4 unnecessary.
+dnl With older versions this is a no-op.
+AC_CONFIG_MACRO_DIR(m4)
+
+xcsdkdir=
+AC_CHECK_PROGS(XCRUN, [xcrun])
+if test -n "$XCRUN"; then
+ if test -z "$MAKE"; then
+ dnl Call the variable MAKE_PROG, not MAKE, to avoid confusion with
+ dnl the usual MAKE variable that 'make' itself uses.
+ AC_CHECK_PROG([MAKE_PROG], [make], [yes])
+ if test -z "$MAKE_PROG"; then
+ MAKE="$XCRUN MAKE"
+ export MAKE
+ xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
+ fi
+ fi
+fi
+
+dnl GNU Make is required, so don't test for its individual features.
+am_cv_make_support_nested_variables=yes
+AC_DEFUN([AC_PROG_MAKE_SET],
+ [SET_MAKE=
+ AC_SUBST([SET_MAKE])])
+
+dnl Check for GNU Make and possibly set MAKE before running AM_INIT_AUTOMAKE.
+[emacs_check_gnu_make ()
+{
+ emacs_makeout=`($1 --version) 2>/dev/null` &&
+ case $emacs_makeout in
+ 'GNU Make '3.8[1-9]* | 'GNU Make '3.9[0-9]* | \
+ 'GNU Make '3.[1-9][0-9][0-9]* | 'GNU Make '[4-9]* | 'GNU Make '[1-9][0-9]* )
+ ac_path_MAKE_found=:;;
+ esac
+}]
+AC_CACHE_CHECK([for GNU Make], [ac_cv_path_MAKE],
+ [ac_path_MAKE_found=false
+ if test -n "$MAKE"; then
+ emacs_check_gnu_make "$MAKE"
+ ac_cv_path_MAKE=$MAKE
+ else
+ emacs_tried_make=false
+ emacs_tried_gmake=false
+ emacs_tried_gnumake=false
+ AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake gnumake],
+ [[emacs_check_gnu_make "$ac_path_MAKE"
+ if $ac_path_MAKE_found; then
+ # Use the fully-qualified program name only if the basename
+ # would not resolve to it.
+ if eval \$emacs_tried_$ac_prog; then
+ ac_cv_path_MAKE=$ac_path_MAKE
+ else
+ ac_cv_path_MAKE=$ac_prog
+ fi
+ fi
+ eval emacs_tried_$ac_prog=:]])
+ fi])
+$ac_path_MAKE_found || {
+AC_MSG_ERROR([[Building Emacs requires GNU Make, at least version 3.81.
+If you have it installed under another name, configure with 'MAKE=...'.
+For example, run '$0 MAKE=gnu-make'.]])
+}
+MAKE=$ac_cv_path_MAKE
+