From 9c75afd9d322a42573a69e9a45347eb2e3fa4b7c Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sat, 14 Jul 2012 18:25:47 +0200 Subject: [PATCH] configure: check for GNU awk, not any awk Building glibc requires GNU awk, not any other. Reported-by: Han Sooloo Signed-off-by: "Yann E. MORIN" --- Makefile.in | 4 ++++ configure.ac | 20 +++++++++++++++++--- kconfig/kconfig.mk | 24 ++++++++++++------------ 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Makefile.in b/Makefile.in index b74a9291..3772058b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -53,6 +53,7 @@ export mandir := @mandir@ export datarootdir := @datarootdir@ export install := @INSTALL@ export bash := @_BASH@ +export awk := @_AWK@ export grep := @GREP@ export make := @MAKE@ export sed := @SED@ @@ -177,6 +178,7 @@ define sed_it -e 's,@@CT_DATE@@,$(DATE),g;' \ -e 's,@@CT_make@@,$(make),g;' \ -e 's,@@CT_bash@@,$(bash),g;' \ + -e 's,@@CT_awk@@,$(awk),g;' \ $< >$@ endef @@ -195,6 +197,7 @@ paths.mk: FORCE @echo " GEN '$@'" @(echo 'export install=$(install)'; \ echo 'export bash=$(bash)'; \ + echo 'export awk=$(awk)'; \ echo 'export grep=$(grep)'; \ echo 'export make=$(make)'; \ echo 'export sed=$(sed)'; \ @@ -210,6 +213,7 @@ paths.sh: FORCE @echo " GEN '$@'" @(echo 'export install="$(install)"'; \ echo 'export bash="$(bash)"'; \ + echo 'export awk="$(awk)"'; \ echo 'export grep="$(grep)"'; \ echo 'export make="$(make)"'; \ echo 'export sed="$(sed)"'; \ diff --git a/configure.ac b/configure.ac index 9c4fa983..e9950c64 100644 --- a/configure.ac +++ b/configure.ac @@ -99,7 +99,7 @@ AS_IF( AC_CACHE_VAL([ac_cv_path_SED], [AC_ARG_WITH([sed], AS_HELP_STRING([--with-sed=PATH], - [Specify the full PATH to sed]), + [Specify the full PATH to GNU sed]), [ac_cv_path_SED=$withval])]) AC_PROG_SED AC_MSG_CHECKING([whether sed understands -r -i -e]) @@ -129,7 +129,6 @@ ACX_PATH_TOOL_REQ([READELF], [readelf]) ACX_CHECK_PROGS_REQ([bison], [bison]) ACX_CHECK_PROGS_REQ([flex], [flex]) ACX_CHECK_PROGS_REQ([gperf], [gperf]) -ACX_CHECK_PROGS_REQ([awk], [gawk mawk nawk awk]) ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo]) ACX_CHECK_PROGS_REQ([cut], [cut]) ACX_CHECK_PROGS_REQ([stat], [stat]) @@ -151,7 +150,7 @@ ACX_PATH_PROGS_REQ([PATCH], [patch]) AC_CACHE_VAL([ac_cv_path__BASH], [AC_ARG_WITH([bash], AS_HELP_STRING([--with-bash=PATH], - [Specify the full PATH to bash >= 3.1]), + [Specify the full PATH to GNU bash >= 3.1]), [ac_cv_path__BASH=$withval])]) AC_CACHE_CHECK([for bash >= 3.1], [ac_cv_path__BASH], [AC_PATH_PROGS_FEATURE_CHECK([_BASH], [bash], @@ -162,6 +161,21 @@ AC_CACHE_CHECK([for bash >= 3.1], [ac_cv_path__BASH], AC_MSG_ERROR([could not find bash >= 3.1])])]) AC_SUBST([_BASH], [$ac_cv_path__BASH]) +# We need a awk that *is* GNU awk +AC_CACHE_VAL([ac_cv_path__AWK], + [AC_ARG_WITH([awk], + AS_HELP_STRING([--with-awk=PATH], + [Specify the full PATH to GNU awk]), + [ac_cv_path__AWK=$withval])]) +AC_CACHE_CHECK([for GNU awk], [ac_cv_path__AWK], + [AC_PATH_PROGS_FEATURE_CHECK([_AWK], [awk gawk], + [[_AWK_ver=$($ac_path__AWK --version 2>&1 \ + |$EGREP '^GNU Awk ') + test -n "$_AWK_ver" && ac_cv_path__AWK=$ac_path__AWK ac_path__AWK_found=:]], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([could not find GNU awk])])]) +AC_SUBST([_AWK], [$ac_cv_path__AWK]) + #---------------------------------------- # Check for GNU make 3.80 or above AC_CACHE_VAL([ac_cv_path_MAKE], diff --git a/kconfig/kconfig.mk b/kconfig/kconfig.mk index cc6aa46f..8748287c 100644 --- a/kconfig/kconfig.mk +++ b/kconfig/kconfig.mk @@ -29,18 +29,18 @@ oldconfig: .config # Always be silent, the stdout an be >.config extractconfig: - @awk 'BEGIN { dump=0; } \ - dump==1 && $$0~/^\[.....\][[:space:]]+(# |)CT_/ { \ - $$1=""; \ - gsub("^[[:space:]]",""); \ - print; \ - } \ - $$0~/Dumping user-supplied crosstool-NG configuration: done in/ { \ - dump=0; \ - } \ - $$0~/Dumping user-supplied crosstool-NG configuration$$/ { \ - dump=1; \ - }' + @$(awk) 'BEGIN { dump=0; } \ + dump==1 && $$0~/^\[.....\][[:space:]]+(# |)CT_/ { \ + $$1=""; \ + gsub("^[[:space:]]",""); \ + print; \ + } \ + $$0~/Dumping user-supplied crosstool-NG configuration: done in/ { \ + dump=0; \ + } \ + $$0~/Dumping user-supplied crosstool-NG configuration$$/ { \ + dump=1; \ + }' #----------------------------------------------------------- # Help text used by make help