From b3cd7d13fe630ba1847326242525298e361018c1 Mon Sep 17 00:00:00 2001 From: Shiz Date: Sun, 28 Jun 2015 23:08:19 +0200 Subject: build: overhaul wrapper script system for multiple wrapper support this overhauls part of the build system in order to support multiple toolchain wrapper scripts, as opposed to solely the musl-gcc wrapper as before. it thereby replaces --enable-gcc-wrapper with --enable-wrapper=..., which has the options 'auto' (the default, detect whether to use wrappers), 'all' (build and install all wrappers), 'no' (don't build any) and finally the options named after the individual compiler scripts (currently only 'gcc' is available) to build and install only that wrapper. the old --enable-gcc-wrapper is removed from --help, but still available. it also modifies the wrappers to use the C compiler specified to the build system as 'inner' compiler, when applicable. as wrapper detection works by probing this compiler, it may not work with any other. --- configure | 56 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 7b29ae40..b6b6f894 100755 --- a/configure +++ b/configure @@ -28,7 +28,7 @@ Optional features: --enable-debug build with debugging information [disabled] --enable-warnings build with recommended warnings flags [disabled] --enable-visibility use global visibility options to optimize PIC [auto] - --enable-gcc-wrapper build musl-gcc toolchain wrapper [auto] + --enable-wrapper=... build given musl toolchain wrapper [auto] --disable-shared inhibit building shared library [enabled] --disable-static inhibit building static library [enabled] @@ -123,6 +123,8 @@ bindir='$(exec_prefix)/bin' libdir='$(prefix)/lib' includedir='$(prefix)/include' syslibdir='/lib' +tools= +tool_libs= target= optimize=auto debug=no @@ -131,6 +133,7 @@ visibility=auto shared=auto static=yes wrapper=auto +gcc_wrapper=no for arg ; do case "$arg" in @@ -154,7 +157,11 @@ case "$arg" in --disable-warnings|--enable-warnings=no) warnings=no ;; --enable-visibility|--enable-visibility=yes) visibility=yes ;; --disable-visibility|--enable-visibility=no) visibility=no ;; ---enable-gcc-wrapper|--enable-gcc-wrapper=yes) wrapper=yes ;; +--enable-wrapper|--enable-wrapper=yes) wrapper=detect ;; +--enable-wrapper=all) wrapper=yes ; gcc_wrapper=yes ;; +--enable-wrapper=gcc) wrapper=yes ; gcc_wrapper=yes ;; +--disable-wrapper|--enable-wrapper=no) wrapper=no ;; +--enable-gcc-wrapper|--enable-gcc-wrapper=yes) wrapper=yes ; gcc_wrapper=yes ;; --disable-gcc-wrapper|--enable-gcc-wrapper=no) wrapper=no ;; --enable-*|--disable-*|--with-*|--without-*|--*dir=*|--build=*) ;; --host=*|--target=*) target=${arg#*=} ;; @@ -215,36 +222,44 @@ tryldflag LDFLAGS_TRY -Werror=unknown-warning-option tryldflag LDFLAGS_TRY -Werror=unused-command-line-argument # -# Need to know if the compiler is gcc to decide whether to build the -# musl-gcc wrapper, and for critical bug detection in some gcc versions. +# Need to know if the compiler is gcc or clang to decide which toolchain +# wrappers to build. # -printf "checking whether compiler is gcc... " -if fnmatch '*gcc\ version*' "$(LC_ALL=C $CC -v 2>&1)" ; then -cc_is_gcc=yes -else -cc_is_gcc=no +printf "checking for C compiler family... " +cc_ver="$(LC_ALL=C $CC -v 2>&1)" +cc_family=unknown +if fnmatch '*gcc\ version*' "$cc_ver" ; then +cc_family=gcc fi -echo "$cc_is_gcc" +echo "$cc_family" # -# Only build musl-gcc wrapper if toolchain does not already target musl +# Figure out toolchain wrapper to build # +if test "$wrapper" = auto -o "$wrapper" = detect ; then +printf "checking for toolchain wrapper to build... " +if test "$cc_family" = gcc ; then +gcc_wrapper=yes if test "$wrapper" = auto ; then -printf "checking whether to build musl-gcc wrapper... " -if test "$cc_is_gcc" = yes ; then -wrapper=yes while read line ; do -case "$line" in */ld-musl-*) wrapper=no ;; esac +case "$line" in */ld-musl-*) gcc_wrapper=no ;; esac done <&3 3>&- printf "done\n" -- cgit v1.2.1