From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=owlfolio.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=owlfolio.org 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owlfolio.org; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm1; t=1679501855; x=1679588255; bh=5c JvOXXoMfWSQNSmaN8+msB4GpksMBLNzFbedBwugEw=; b=pJRFtAhnjLnNN6vJMr oxSjuyoN1FMNeSgQMRLW2xmqg0L4DvcF8N3QKUTUxSn2Pot4tvg7Mb5dBAqgBR9+ DNNWBmKPyNnlgfUM/qao+D//Pq7CIqP2yT08whlNmBctyy8lkqYJY+jkLiyMqi6P QoHMpd4OMPR94sFYWzzsF98mBt4nO713aVOLUj7ulQGinY367ruOP1KKm7gEh7ob o7F09U5Jo1zwZguhKXqU9ACdmexUX4SgAgLRX7Ja2EeA/PWt5D+jUew/lD9Wci7E BogP2j74NhkidZ8iacI2F89xrh/PLy8Zhh7Y34xDGFJjsuN8km9qRGSx/s/qu9P6 d//w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1679501855; x=1679588255; bh=5cJvOXXoMfWSQ NSmaN8+msB4GpksMBLNzFbedBwugEw=; b=dM7BmRX2B0RIxrjymonCjY5AKviE1 bJNrDXrVeliPjR9E6lc3cbKAkWCFNpEzjpGig48P2f6uXNOg0v/5tMiwzDAMEtGI rQe17OiBENge0kPOtiohRSOREroWxoBPheTDxL3t7uJZMaJVC02XxKT9/s1oKXj1 1tk29LnsBxHf5hQ+U4HdYxU3hjDxohSAoOBqFLd+p3trfXKIlaCZyd+/MFKBwSzh WwfFHoBc9TmVEr55pdeq1nyz0q6ffaVAeFS1hhaGwY+aKhQINoEqHukDjNqehaw1 lVwv9KdDNvKHQL3GoLSy/kxYmFM2qSuqPbVOeVtWPNCU9/f7i85ClP0LA== 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 From: Zack Weinberg Subject: [PATCH] configure: error out as early as possible on build = source directory Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 List-Id: 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 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 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