configure: error out as early as possible on build = source directory
Checks
Commit Message
Related to the discussion at
<https://sourceware.org/pipermail/libc-alpha/2023-March/146542.html>, if
someone makes the mistake of running configure in the source directory
(i.e. attempting to set up to build within the source tree, which we
don't support) configure should error out as quickly as possible, rather
than making this hypothetical someone sit through a bunch of compiler
checks first.
(Ideally we would validate _everything_ about the way configure has been
invoked before doing any other work, but the other places where we have
an AC_MSG_ERROR as a response to something about the invocation look
significantly harder to change.)
Completely untested as I don't have convenient access to a machine with
autoconf 2.69 at the moment.
zw
AC_PROG_CC
@@ -80,10 +88,6 @@ LDFLAGS="$old_LDFLAGS"
AC_LANG_POP([C++])])
AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
-if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
- AC_MSG_ERROR([you must configure in a separate build directory])
-fi
-
# This will get text that should go into config.make.
config_vars=
--
2.34.1
@@ -43,6 +43,14 @@ AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
dnl This is here so we can set $subdirs directly based on configure
fragments.
AC_CONFIG_SUBDIRS()
+# Validate the build directory as early as possible, so that someone
+# who's made the mistake of casually typing "./configure" in the source
+# directory doesn't have to wait for autoconf to probe a bunch of stuff
+# before it gets around to telling them they made a mistake.
+AS_IF(["`cd $srcdir && pwd -P`" = "`pwd -P`"],
+ [AC_MSG_ERROR([you must configure in a separate build directory])
+])
+
AC_CANONICAL_HOST