From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 Received: by atuin.qyliss.net (Postfix, from userid 496) id 410738474; Fri, 19 Mar 2021 03:02:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 3F05C8451; Fri, 19 Mar 2021 03:02:44 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id D9D7E844D; Fri, 19 Mar 2021 03:02:42 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by atuin.qyliss.net (Postfix) with ESMTPS id 9E3388492 for ; Fri, 19 Mar 2021 03:02:40 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EB0EE5C00E5 for ; Thu, 18 Mar 2021 23:02:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Mar 2021 23:02:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=JtjYAKb2tXMN2 NASCV8Iyuxsk0Ngouyflm27i2KXo2A=; b=SzRyguZEAGmC0deCBOacqqkT0aX3H HU1YdPY1bKNYaZw9YGIaOW+XGBp9TGVP/Qs1VF4esnRHwyzj2UGN2Daxa6HK8EF/ ljGQXU3FGMeXnK+0w9KFFjPdQP28fE3Tei8zRfTbEgTaEMLbvQO1CGEneqpL5bff qQJECuPGxR4znq23oTmrS4vle64MHDa+Qyrz84BdNf9VVIfnXfUjbaS8cgtNLg5k 1boEuaDcOWiBFCzXDtYqOndltJgZ4FMchrzkFhl2JXetaDDxYRAVAA7xWo9sY9SU CFwITyIEPZ7vTM5Tu1347Tk/K+v25Wfp3a5yeoYjVbRom1ybLys3lU7Gw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=JtjYAKb2tXMN2NASCV8Iyuxsk0Ngouyflm27i2KXo2A=; b=st8R9r0H iu/lQ5d84S5+j03AI/fral54VqozlkUVQhiOneHTiKOt16m8frdFHwDkLLYYzf72 NZi+j9VXjdpeIiTpD9yzzdtfYjKOm2OLy8sjFb3wbY16dcnyTfpTff8UPq1H8MVN Pk4WkDA2yXuwYqPx5YZRzGuqCmamuzasxfLr1hK67H2XaWk1T+pDYvu2T+RS7rug QsAVMU/KbwvcB+orAqCnIc8n8c7DdGpFS16bsohTk8p2YVycKWOXRoU7ZQfpN1lM Qw1+J/IhiHtzuzNrW3cCmQ+03GgMQyZIbCYGJ31WLHIpYZdHVUYqo3nO75xALMVV 43uoNb9f7vNvSg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudefjedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhi sheqnecuggftrfgrthhtvghrnhepgfefudekvdelieelledufeevheeglefggedvudejvd dtffeuueevffehleejkedvnecukfhppeekgedrudekgedrvdefvddrudektdenucevlhhu shhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehqhihlihhsshesgi dvvddtrdhqhihlihhsshdrnhgvth X-ME-Proxy: Received: from x220.qyliss.net (p54b8e8b4.dip0.t-ipconnect.de [84.184.232.180]) by mail.messagingengine.com (Postfix) with ESMTPA id BEECC1080054 for ; Thu, 18 Mar 2021 23:02:39 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id DA8E91F0B; Fri, 19 Mar 2021 03:02:38 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH ucspi-vsock 4/7] configure: create, to generate config.h Date: Fri, 19 Mar 2021 02:56:49 +0000 Message-Id: <20210319025648.17925-4-hi@alyssa.is> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210319025349.8839-2-hi@alyssa.is> References: <20210319025349.8839-2-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 4WXA6ASEQ2NFZQ33OA5I4X6Q76QNWQKX X-Message-ID-Hash: 4WXA6ASEQ2NFZQ33OA5I4X6Q76QNWQKX X-MailFrom: qyliss@x220.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.3.1 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: This will allow programs to refer to BINDIR to find other ucspi-vsock programs, which allows programs to be implemented in terms of each other. --- This is how the new vsockserver program will know where to find vsockserver-socketbinder and vsockserverd. .gitignore | 5 ++++- Makefile => Makefile.in | 12 ++++++++-- configure | 49 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 3 deletions(-) rename Makefile => Makefile.in (78%) create mode 100755 configure diff --git a/.gitignore b/.gitignore index a63eff4..89a0408 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# SPDX-FileCopyrightText: 2020 Alyssa Ross +# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross *.o +*.tmp vsockclient vsockserver +config.h +Makefile diff --git a/Makefile b/Makefile.in similarity index 78% rename from Makefile rename to Makefile.in index e05e32f..3260e85 100644 --- a/Makefile +++ b/Makefile.in @@ -7,8 +7,8 @@ CFLAGS = -Wall -Wextra -O -g INSTALL = install INSTALL_PROGRAM = $(INSTALL) -prefix = /usr/local -bindir = $(prefix)/bin +prefix = @PREFIX@ +bindir = @BINDIR@ PROGRAMS = vsockclient vsockserver @@ -20,6 +20,10 @@ install: $(PROGRAMS) $(INSTALL_PROGRAM) $(PROGRAMS) $(DESTDIR)$(bindir) .PHONY: install +config.h: configure + @echo "Error: config.h is outdated. Please re-run ./configure." >&2 + @exit 1 + vsockclient: vsockclient.o env.o log.o num.o vsock.o $(CC) $(LDFLAGS) -o $@ $@.o env.o log.o num.o vsock.o $(LDLIBS) vsockserver: vsockserver.o env.o log.o num.o vsock.o @@ -31,3 +35,7 @@ vsockserver.o: env.h log.h num.h vsock.h clean: rm -f $(PROGRAMS) *.o .PHONY: clean + +distclean: clean + rm -f config.h Makefile *.tmp +.PHONY: distclean diff --git a/configure b/configure new file mode 100755 index 0000000..38c926c --- /dev/null +++ b/configure @@ -0,0 +1,49 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2021 Alyssa Ross + +set -ue + +prefix=/usr/local +bindir= + +unrecognized= + +for arg; do + if [ "$arg" = "--help" ]; then + cat < config.h.tmp +echo "#define PREFIX \"$prefix\"" >> config.h.tmp +echo "#define BINDIR \"$bindir\"" >> config.h.tmp +mv config.h.tmp config.h + +sed -e "s#@PREFIX@#$prefix#g" -e "s#@BINDIR@#$bindir#g" Makefile.in > Makefile.tmp +mv Makefile.tmp Makefile + +if [ -n "$unrecognized" ]; then + echo "Warning: unrecognized options:$unrecognized" >&2 +fi -- 2.30.0