From patchwork Wed Sep 25 16:33:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1167548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46dmt44kGDz9sP7 for ; Thu, 26 Sep 2019 04:34:03 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id F1F42D8E; Wed, 25 Sep 2019 18:33:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 58F3EC77 for ; Wed, 25 Sep 2019 18:33:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B5120B0 for ; Wed, 25 Sep 2019 18:33:49 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from localhost.localdomain (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 634191BF205; Wed, 25 Sep 2019 18:33:47 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Wed, 25 Sep 2019 09:33:57 -0700 Message-Id: <20190925163400.1171-1-blp@ovn.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 1/4] configure: Improve checks for OVS source and build directories. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Until now, "configure" was willing to accept anything as the OVS source and build directory, but obviously only an actual OVS source or build directory will actually work. This commit adds some basic checking. In addition, this changes relative paths so that they are relative to the current working directory when "configure" is invoked, instead of relative to the location of the "configure" script. This is less surprising. Finally, this moves the `eval echo "$dir"` lines up higher so that they do their intended job of expanding ~ in the right place. That has to happen early, otherwise, ~/foo will effectively end up as $PWD/\~/foo. Signed-off-by: Ben Pfaff Acked-by: Numan Siddique --- acinclude.m4 | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 31e4f0b5413f..9dfed9034910 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1220,32 +1220,37 @@ AC_DEFUN([OVN_CHECK_OVS], [ AC_MSG_CHECKING([for OVS source directory]) if test X"$with_ovs_source" != X; then - OVSDIR=$with_ovs_source + OVSDIR=`eval echo "$with_ovs_source"` case $OVSDIR in /*) ;; - *) OVSDIR=$ac_abs_confdir/$OVSDIR ;; + *) OVSDIR=`pwd`/$OVSDIR ;; esac + if test ! -f "$OVSDIR/vswitchd/bridge.c"; then + AC_ERROR([$OVSDIR is not an OVS source directory]) + fi else - AC_ERROR([OVS source dir path needs to be specified]) + AC_ERROR([OVS source dir path needs to be specified (use --with-ovs-source)]) fi - OVSDIR=`eval echo "$OVSDIR"` AC_MSG_RESULT([$OVSDIR]) AC_SUBST(OVSDIR) AC_MSG_CHECKING([for OVS build directory]) if test X"$with_ovs_build" != X; then - OVSBUILDDIR=$with_ovs_build + OVSBUILDDIR=`eval echo "$with_ovs_build"` case $OVSBUILDDIR in /*) ;; - *) OVSBUILDDIR=$ac_abs_confdir/$OVSBUILDDIR ;; + *) OVSBUILDDIR=`pwd`/$OVSBUILDDIR ;; esac - else + if test ! -f "$OVSBUILDDIR/config.h"; then + AC_ERROR([$OVSBUILDDIR is not a configured OVS build directory]) + fi + elif test -f "$OVSDIR/config.h"; then # If separate build dir is not specified, use src dir. OVSBUILDDIR=$OVSDIR + else + AC_ERROR([OVS source dir $OVSDIR is not configured as a build directory (either run configure there or use --with-ovs-build to point to the build directory)]) fi - - OVSBUILDDIR=`eval echo "$OVSBUILDDIR"` AC_MSG_RESULT([$OVSBUILDDIR]) AC_SUBST(OVSBUILDDIR) ])