From 85404fbe79621df1fa877da8b9772ddd8525be29 Mon Sep 17 00:00:00 2001 From: Jonas Maebe <jonas@freepascal.org> Date: Fri, 1 Dec 2006 18:54:06 +0000 Subject: [PATCH] + support multiple gcc dirs depending on the target architecture for Darwin (ppc, ppc64, i386, x86_64) git-svn-id: trunk@5518 - --- compiler/utils/samplecfg | 69 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/compiler/utils/samplecfg b/compiler/utils/samplecfg index 33433cacb4..51f81ce0dd 100644 --- a/compiler/utils/samplecfg +++ b/compiler/utils/samplecfg @@ -5,6 +5,53 @@ # Generate Sample Free Pascal configuration file # +function setgccdir() { +# Find path to libgcc.a +GCCSPEC=`(gcc -v $@ 2>&1)| head -n 1| awk '{ print $4 } '` +if [ -z "$GCCSPEC" ] ; then + GCCSPEC=`gcc -print-libgcc-file-name $@ 2>/dev/null` +fi +GCCDIR=`dirname $GCCSPEC` +} + + +function setgccdirarch() { +# Find path to libgcc.a +GCCSPEC=`(gcc -v -arch $1 2>&1)| head -n 1| awk '{ print $4 } '` +if [ -z "$GCCSPEC" ] ; then + GCCSPEC=`gcc -print-libgcc-file-name -arch $1` +fi + +GCCDIR=`dirname $GCCSPEC` + +if [ -z "$GCCDIR" ] ; then + return +fi + +case $1 in + ppc) + GCCDIR="#ifdef cpupowerpc +-Fl$GCCDIR +#endif" + ;; + ppc64) + GCCDIR="#ifdef cpupowerpc64 +-Fl$GCCDIR +#endif" + ;; + i386) + GCCDIR="#ifdef cpui386 +-Fl$GCCDIR +#endif" + ;; + x86_64) + GCCDIR="#ifdef cpux86_64 +-Fl$GCCDIR +#endif" + ;; +esac +} + HOSTOS=`uname -s | tr A-Z a-z` echo Running on $HOSTOS @@ -41,12 +88,10 @@ if [ -f $thefile ] ; then fi fi -# Find path to libgcc.a -GCCSPEC=`(gcc -v 2>&1)| head -n 1| awk '{ print $4 } '` -if [ -z "$GCCSPEC" ] ; then - GCCSPEC=`gcc -print-libgcc-file-name` -fi -GCCDIR=`dirname $GCCSPEC` +setgccdir +GCCDIR2="" +GCCDIR3="" +GCCDIR4="" # include ports tree dir for FreeBSDers. case $HOSTOS in @@ -59,6 +104,15 @@ case $HOSTOS in netbsd) GCCDIR=-Fl/usr/pkg/lib ;; + darwin) + setgccdirarch ppc + GCCDIR2=$GCCDIR + setgccdirarch ppc64 + GCCDIR3=$GCCDIR + setgccdirarch i386 + GCCDIR4=$GCCDIR + setgccdirarch x86_64 + ;; *) if [ -d $GCCDIR ]; then echo Found libgcc.a in $GCCDIR @@ -215,6 +269,9 @@ cat <<EOFCFG > $thefile # searchpath for libraries $GCCDIR +$GCCDIR2 +$GCCDIR3 +$GCCDIR4 #-Fl/pp/lib #-Fl/lib;/usr/lib