Ilya Zakharevich on Mon, 4 Oct 1999 19:53:36 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Another Configure improvement for gnuplot


In the unlikely event that gnuplot library was build with gcc, but
PARI with cc, one needs to put a -lgcc on the link line, and find the
directory where this library lives.

Below is the patch to autorecognize this situation.

Enjoy,
Ilya

P.S.  Still, on our system PARI will not compile without manual
      intervention.  I have

RLINCLUDE = -I/opt/local/include
RLLIBS    = -L/opt/local/lib -lreadline -lncurses

      but apparently the include file is not matching the library
      file, so I need to put -L/opt/gnu/lib in RLLIBS.  I do not know
      how widespread is this situation.


--- ./Configure~	Sat Sep 25 15:13:49 1999
+++ ./Configure	Mon Oct  4 19:46:48 1999
@@ -437,6 +437,7 @@ if test "$optimization" != profiling; th
   pth="$TOP/gnuplot-$osname-$arch $TOP/gnuplot $TOP/../gnuplot-$osname-$arch $TOP/../gnuplot $TOP/../../gnuplot-$osname-$arch $TOP/../../gnuplot $pth"
   gpth="$pth"
   lib=gnuplot; . ./locatelib
+  gnuplot_fullpath="$try"
   pth="$opth"
   gnuplot_libs=
   case $gnuplot in
@@ -738,6 +739,32 @@ if test -z "$CC"; then
   # Choosing the compiler
   if test -n "$__gnuc__"; then CC=$gcc; else CC=$cc; fi
 fi
+
+if test "$which_graphic_lib" = gnuplot -a -z "$gcc"; then
+    if nm $gnuplot_fullpath | grep -c _eprintf 2>&1 > /dev/null ; then
+	echo "...Looks like gcc-compiled gnuplot.  I add -lgcc to graphic libraries"
+	_ogcc="$gcc"
+	opth="$pth"
+	pth="$pth /opt/local/gnu/lib /usr/local/gnu/lib"
+	gcclibspec="`gcc -v 2>&1 | grep specs | sed 's/.*specs from //'`"
+	if test -n "$gcclibspec"; then
+	    pth="`dirname $gcclibspec` $pth"
+	fi
+	lib=gcc; . ./locatelib
+	if test -n "$gcc"; then
+	    gnuplot_libs="$gnuplot_libs -L$gcc"
+	else
+	    echo "...### I did not find -lgcc library in $pth."
+	    echo "...### You may need to manually add something like -L/opt/gnu/lib to the "
+	    echo "...###   PLOTLIBS = ..."
+	    echo "...### line in your architecture-Makefile."
+	fi
+	pth="$opth"
+	gcc="$_ogcc"
+	gnuplot_libs="$gnuplot_libs -lgcc"
+    fi
+fi
+
 
 if test "$fastread" != yes; then
   cat << EOT