Add the configure parameters
{AS,LD,AR,OBJDUMP,OBJCOPY,GPROF}=path to optionally force the
path for these programs without having to tweak the output of
$CC -print-prog-name in some way.
In addition, when {AS,LD}=... is used the corresponding program
version is not check. The user gets to keep all the pieces if it
blows.
In practice, according to a build log on x86-64, $AS and $LD are never
used directly. $AR, $OBJDUMP and $OBJCOPY are though, and the llvm
variants don't seem to have any issue.
v2: Use variable assignments instead of --with-xxx
v3: Denitsify
Signed-off-by: Olivier Galibert <galibert@pobox.com>
---
aclocal.m4 | 41 +++++++++++++++++++++------
configure | 80 +++++++++++++++++++++++++++++++++++++++-------------
configure.ac | 38 ++++++++++++++-----------
3 files changed, 113 insertions(+), 46 deletions(-)
@@ -110,19 +110,42 @@ rm -fr contest*])
AC_DEFUN([LIBC_PROG_BINUTILS],
[# Was a --with-binutils option given?
if test -n "$path_binutils"; then
- # Make absolute; ensure a single trailing slash.
- path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
- CC="$CC -B$path_binutils"
+ # Make absolute; ensure a single trailing slash.
+ path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
+ CC="$CC -B$path_binutils"
fi
-AS=`$CC -print-prog-name=as`
-LD=`$CC -print-prog-name=ld`
-AR=`$CC -print-prog-name=ar`
+check_as_version=0
+AC_ARG_VAR([AS], [as program to use])
+if test -z "$AS"; then
+ AS=`$CC -print-prog-name=as`
+ check_as_version=1
+fi
+check_ld_version=0
+AC_ARG_VAR([LD], [ld program to use])
+if test -z "$LD"; then
+ LD=`$CC -print-prog-name=ld`
+ check_ld_version=1
+fi
+AC_ARG_VAR([AR], [ar program to use])
+if test -z "$AR"; then
+ AR=`$CC -print-prog-name=ar`
+fi
+AC_ARG_VAR([OBJDUMP], [objdump program to use])
+if test -z "$OBJDUMP"; then
+ OBJDUMP=`$CC -print-prog-name=objdump`
+fi
+AC_ARG_VAR([OBJCOPY], [objcopy program to use])
+if test -z "$OBJCOPY"; then
+ OBJCOPY=`$CC -print-prog-name=objcopy`
+fi
+AC_ARG_VAR([GPROF], [gprof program to use])
+if test -z "$GPROF"; then
+ GPROF=`$CC -print-prog-name=gprof`
+fi
+
AC_SUBST(AR)
-OBJDUMP=`$CC -print-prog-name=objdump`
AC_SUBST(OBJDUMP)
-OBJCOPY=`$CC -print-prog-name=objcopy`
AC_SUBST(OBJCOPY)
-GPROF=`$CC -print-prog-name=gprof`
AC_SUBST(GPROF)
# Determine whether we are using GNU binutils.
@@ -651,12 +651,12 @@ SED
MAKEINFO
MSGFMT
MAKE
-LD
-AS
GPROF
OBJCOPY
OBJDUMP
AR
+LD
+AS
LN_S
INSTALL_DATA
INSTALL_SCRIPT
@@ -805,7 +805,13 @@ CPPFLAGS
CPP
CXX
CXXFLAGS
-CCC'
+CCC
+AS
+LD
+AR
+OBJDUMP
+OBJCOPY
+GPROF'
ac_subdirs_all=''
# Initialize some variables set by options.
@@ -1495,6 +1501,12 @@ Some influential environment variables:
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
+ AS as program to use
+ LD ld program to use
+ AR ar program to use
+ OBJDUMP objdump program to use
+ OBJCOPY objcopy program to use
+ GPROF gprof program to use
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -4545,19 +4557,42 @@ fi
# Was a --with-binutils option given?
if test -n "$path_binutils"; then
- # Make absolute; ensure a single trailing slash.
- path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
- CC="$CC -B$path_binutils"
+ # Make absolute; ensure a single trailing slash.
+ path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
+ CC="$CC -B$path_binutils"
fi
-AS=`$CC -print-prog-name=as`
-LD=`$CC -print-prog-name=ld`
-AR=`$CC -print-prog-name=ar`
+check_as_version=0
+
+if test -z "$AS"; then
+ AS=`$CC -print-prog-name=as`
+ check_as_version=1
+fi
+check_ld_version=0
+
+if test -z "$LD"; then
+ LD=`$CC -print-prog-name=ld`
+ check_ld_version=1
+fi
+
+if test -z "$AR"; then
+ AR=`$CC -print-prog-name=ar`
+fi
+
+if test -z "$OBJDUMP"; then
+ OBJDUMP=`$CC -print-prog-name=objdump`
+fi
+
+if test -z "$OBJCOPY"; then
+ OBJCOPY=`$CC -print-prog-name=objcopy`
+fi
+
+if test -z "$GPROF"; then
+ GPROF=`$CC -print-prog-name=gprof`
+fi
+
-OBJDUMP=`$CC -print-prog-name=objdump`
-OBJCOPY=`$CC -print-prog-name=objcopy`
-GPROF=`$CC -print-prog-name=gprof`
# Determine whether we are using GNU binutils.
@@ -4599,8 +4634,8 @@ $as_echo "$libc_cv_prog_ld_gnu" >&6; }
gnu_ld=$libc_cv_prog_ld_gnu
-# Accept binutils 2.25 or newer.
-for ac_prog in $AS
+if test $check_as_version = 1; then :
+ for ac_prog in $AS
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -4660,13 +4695,16 @@ $as_echo_n "checking version of $AS... " >&6; }
$as_echo "$ac_prog_version" >&6; }
fi
if test $ac_verc_fail = yes; then
- AS=: critic_missing="$critic_missing as"
+ AS=: critic_missing="$critic_missing GNU as"
fi
-if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
- # Accept gold 1.14 or higher
- for ac_prog in $LD
+fi
+
+if test $check_ld_version = 1; then :
+ if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
+ # Accept gold 1.14 or higher
+ for ac_prog in $LD
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -4729,8 +4767,8 @@ if test $ac_verc_fail = yes; then
LD=: critic_missing="$critic_missing GNU gold"
fi
-else
- for ac_prog in $LD
+ else
+ for ac_prog in $LD
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -4793,6 +4831,8 @@ if test $ac_verc_fail = yes; then
LD=: critic_missing="$critic_missing GNU ld"
fi
+ fi
+
fi
# These programs are version sensitive.
@@ -989,24 +989,28 @@ AC_PROG_LN_S
LIBC_PROG_BINUTILS
-# Accept binutils 2.25 or newer.
-AC_CHECK_PROG_VER(AS, $AS, --version,
- [GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
- AS=: critic_missing="$critic_missing as")
-
-if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
- # Accept gold 1.14 or higher
- AC_CHECK_PROG_VER(LD, $LD, --version,
- [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
- [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
- LD=: critic_missing="$critic_missing GNU gold")
-else
- AC_CHECK_PROG_VER(LD, $LD, --version,
- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
+dnl Accept binutils 2.25 or newer. Don't check version if the path is forced.
+AS_IF([test $check_as_version = 1],
+ [AC_CHECK_PROG_VER(AS, $AS, --version,
+ [GNU assembler.* \([0-9]*\.[0-9.]*\)],
[2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
- LD=: critic_missing="$critic_missing GNU ld")
-fi
+ AS=: critic_missing="$critic_missing GNU as")
+])
+
+AS_IF([test $check_ld_version = 1],
+ [if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
+ # Accept gold 1.14 or higher
+ AC_CHECK_PROG_VER(LD, $LD, --version,
+ [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
+ [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
+ LD=: critic_missing="$critic_missing GNU gold")
+ else
+ AC_CHECK_PROG_VER(LD, $LD, --version,
+ [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
+ [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
+ LD=: critic_missing="$critic_missing GNU ld")
+ fi
+])
# These programs are version sensitive.
AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,