This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Problem to configure binutils in bfd/configure -fpic and -fPIC flags...
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Binutils <binutils at sources dot redhat dot com>
- Date: Mon, 4 Mar 2002 11:46:09 +1030
- Subject: Re: Problem to configure binutils in bfd/configure -fpic and -fPIC flags...
- References: <20020303103628.GA27618@j-son.org>
On Sun, Mar 03, 2002 at 11:36:29AM +0100, Christian Jönsson wrote:
>
> checking for win32_pstatus_t in sys/procfs.h... no
> ../../bfd/configure: command substitution: line 1: syntax error near unexpected token `case'${LIBCFLAGS}${LIBCXXFLAGS}'in*-fpic*)e'
> ../../bfd/configure: command substitution: line 1: `case'${LIBCFLAGS}${LIBCXXFLAGS}'in*-fpic*)echo-fpic;;*)echo-fPIC;;esac'
> checking for gcc version with buggy 64-bit support... no
>
> Is this a problem with binutils you think or with something else?
binutils, 2001-10-21 change to bfd/configure.in
sparc64 host, right?
config/mh-sparcpic looks like:
PICFLAG=`case '${LIBCFLAGS} ${LIBCXXFLAGS}' in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
This little host makefile fragment gets added to each Makefile, in
particular libiberty/Makefile. Then, inside bfd/configure we have:
PICFLAG=
eval `grep "^[ ]*PICFLAG[ ]*=" ../libiberty/Makefile | sed -e "s/[ ]*//g"`
if test -n "$PICFLAG"; then
WIN32LIBADD="-L../libiberty/pic -liberty"
fi
Note how the sed command merrily strips all spaces, instead of just around
the '='. That explains why sh is complaining. I tried to fix this by
using:
PICFLAG=
eval `sed -n -e 's/^[ ]*\(PICFLAG\)[ ]*=[ ]*/\1=/p' < ../libiberty/Makefile`
This leads to:
/src/binutils-current/bfd/configure: command substitution: line 1: syntax error near unexpected token `bfd-in3.h'
/src/binutils-current/bfd/configure: command substitution: line 1: `case '${LIBCFLAGS} ${LIBCXXFLAGS}' in *-fpic* ) echo -fpic ;; Makefile bfd-in3.h confdefs.h config.h config.log config.status doc libtool po stamp-h ) echo -fPIC ;; esac'
as the wretched "*" in " * )" gets expanded! Arrgh!!
So, what to do? As far as I can tell, the "eval" is there just to pick off
the last assignment to PICFLAG in the Makefile. We don't actually care
about the value of PICFLAG in the configure script. (In any case, the
single quotes in mh-sparcpic will prevent expansion of $LIBCFLAGS so it
wouldn't work as intended). Furthermore, none of config/mh-* set PICFLAG
in complicated ways that could result in an expression evaluating empty.
I'm committing the following.
bfd/ChangeLog
* configure.in (WIN32LIBADD): Don't eval PICFLAG assignment.
* configure: Regenerate.
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.86
diff -u -p -r1.86 configure.in
--- configure.in 2002/02/18 12:16:55 1.86
+++ configure.in 2002/03/04 00:59:36
@@ -424,11 +424,10 @@ case "${host}" in
fi
;;
*)
- PICFLAG=
- changequote(,)dnl
- eval `grep "^[ ]*PICFLAG[ ]*=" ../libiberty/Makefile | sed -e "s/[ ]*//g"`
- changequote([,])dnl
- if test -n "$PICFLAG"; then
+changequote(,)dnl
+ x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | tail -1`
+changequote([,])dnl
+ if test -n "$x"; then
WIN32LIBADD="-L../libiberty/pic -liberty"
fi
;;
--
Alan Modra
IBM OzLabs - Linux Technology Centre