From 73e6d7f0ade7747110dab5afa61f52d9e49af613 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sun, 24 Apr 2016 21:49:13 +0200 Subject: build: run configure before building dependencies We need some basic configuration before building dependencies. For example useful CFLAGS have to be in place to prevent linker errors. The configure script is run again later with some extra parameters. --- GNUmakefile | 2 ++ configure | 55 +++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 6dcdfd3..b2f6156 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -169,6 +169,7 @@ dependencies-local: $(MAKE) dependency/build/local local: clean + ./configure --environment-only $(MAKE) dependencies-local ./configure CFLAGS="-I$(DEPS_INC)" LDFLAGS="-L$(DEPS_LIB)" LD_LIBRARY_PATH="$(DEPS_LIB)" $(MAKE) @@ -176,6 +177,7 @@ local: clean standalone: clean [ ! -e dependency/build/local ] || $(MAKE) dependencies-clean + ./configure --environment-only $(MAKE) dependency/build/libmusl-install PATH=$(DEPS_BIN):$$PATH PKG_CONFIG_PATH= PKG_CONFIG_LIBDIR= $(MAKE) \ CC=musl-gcc dependency/build/standalone diff --git a/configure b/configure index 639248c..718d432 100755 --- a/configure +++ b/configure @@ -12,6 +12,7 @@ Defaults for the options are specified in brackets. Configuration: --srcdir=DIR source directory [detected] + --environment-only check environment only, no system libraries Installation directories: --prefix=PREFIX main installation prefix [/usr/local] @@ -125,6 +126,7 @@ case "$arg" in --bindir=*) BINDIR=${arg#*=} ;; --sharedir=*) SHAREDIR=${arg#*=} ;; --mandir=*) MANDIR=${arg#*=} ;; +--environment-only) environmentonly=yes ;; --enable-lua|--enable-lua=yes) lua=yes ;; --disable-lua|--enable-lua=no) lua=no ;; --enable-selinux|--enable-selinux=yes) selinux=yes ;; @@ -225,6 +227,39 @@ tryldflag LDFLAGS_AUTO -Wl,-z,now tryldflag LDFLAGS_AUTO -Wl,-z,relro #tryldflag LDFLAGS_AUTO -pie +printf "creating config.mk... " + +cmdline=$(quote "$0") +for i ; do cmdline="$cmdline $(quote "$i")" ; done + +exec 3>&1 1>config.mk + +cat << EOF +# This version of config.mk was generated by: +# $cmdline +# Any changes made here will be lost if configure is re-run +SRCDIR = $SRCDIR +PREFIX = $PREFIX +EXEC_PREFIX = $EXEC_PREFIX +BINDIR = $BINDIR +MANPREFIX = $MANDIR +SHAREPREFIX = $SHAREDIR +CC = $CC +CFLAGS = $CFLAGS +LDFLAGS = $LDFLAGS +CFLAGS_STD = $CFLAGS_STD +LDFLAGS_STD = $LDFLAGS_STD +CFLAGS_AUTO = $CFLAGS_AUTO +LDFLAGS_AUTO = $LDFLAGS_AUTO +EOF +exec 1>&3 3>&- + +printf "done\n" + +if test "$environmentonly" = "yes"; then + exit 0 +fi + have_pkgconfig=no printf "checking for pkg-config... " cmdexists pkg-config && have_pkgconfig=yes @@ -430,30 +465,14 @@ EOF fi fi -printf "creating config.mk... " +printf "completing config.mk... " cmdline=$(quote "$0") for i ; do cmdline="$cmdline $(quote "$i")" ; done -exec 3>&1 1>config.mk +exec 3>&1 1>>config.mk cat << EOF -# This version of config.mk was generated by: -# $cmdline -# Any changes made here will be lost if configure is re-run -SRCDIR = $SRCDIR -PREFIX = $PREFIX -EXEC_PREFIX = $EXEC_PREFIX -BINDIR = $BINDIR -MANPREFIX = $MANDIR -SHAREPREFIX = $SHAREDIR -CC = $CC -CFLAGS = $CFLAGS -LDFLAGS = $LDFLAGS -CFLAGS_STD = $CFLAGS_STD -LDFLAGS_STD = $LDFLAGS_STD -CFLAGS_AUTO = $CFLAGS_AUTO -LDFLAGS_AUTO = $LDFLAGS_AUTO CFLAGS_CURSES = $CFLAGS_CURSES LDFLAGS_CURSES = $LDFLAGS_CURSES CFLAGS_TERMKEY = $CFLAGS_TERMKEY -- cgit v1.2.3