From patchwork Wed Mar 22 16:17:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 66748 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14DC93858436 for ; Wed, 22 Mar 2023 16:17:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14DC93858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679501877; bh=5cJvOXXoMfWSQNSmaN8+msB4GpksMBLNzFbedBwugEw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jpK70SPpb+YhJL4Tg8kv9IGU/Dg3UGv1Ux/CvoaKgtTksQ+oA6v7azXIYWKJ7ZRc6 buBYewphTEhVNDJwNuithRKQfJ02RrOmXPl87uRjVsYWP3THSDPLU3Rn2nY2rV0OKn wijw6OqG3NYSysmkwIf3R5pmr9YdGdIO1WPvScUU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by sourceware.org (Postfix) with ESMTPS id 8E3E23858C52 for ; Wed, 22 Mar 2023 16:17:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E3E23858C52 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 66EDE5C01DB for ; Wed, 22 Mar 2023 12:17:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 22 Mar 2023 12:17:35 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegvddgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfvhffutgfgsehtjeertd dtfeejnecuhfhrohhmpegkrggtkhcuhggvihhnsggvrhhguceoiigrtghksehofihlfhho lhhiohdrohhrgheqnecuggftrfgrthhtvghrnhepfefghedtleegkeeukeffteekgeethf evteetgeekfedtgefhueevleefffeuhfelnecuffhomhgrihhnpehsohhurhgtvgifrghr vgdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpeiirggtkhesohiflhhfohhlihhordhorhhg X-ME-Proxy: Feedback-ID: i876146a2:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 22 Mar 2023 12:17:35 -0400 (EDT) Message-ID: <13f29dc9-4069-6ca5-d7bd-79246defe2bd@owlfolio.org> Date: Wed, 22 Mar 2023 12:17:34 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US To: libc-alpha Subject: [PATCH] configure: error out as early as possible on build = source directory X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Zack Weinberg via Libc-alpha From: Zack Weinberg Reply-To: Zack Weinberg Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Related to the discussion at , 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 diff --git a/configure.ac b/configure.ac index 011844a3d4..afaedfb056 100644 --- a/configure.ac +++ b/configure.ac @@ -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