summaryrefslogtreecommitdiff
path: root/src/m4
diff options
context:
space:
mode:
authorjofret2008-04-11 11:36:50 +0000
committerjofret2008-04-11 11:36:50 +0000
commitc7b7a3d6ae4ad04f1f62791229fda99792dbd9ba (patch)
treeed6021609ad8714d7d42d85d142715584fcc865d /src/m4
parent2d04b90c46d4a1519b9b7170ae76ee91e38c6541 (diff)
downloadscilab2c-c7b7a3d6ae4ad04f1f62791229fda99792dbd9ba.tar.gz
scilab2c-c7b7a3d6ae4ad04f1f62791229fda99792dbd9ba.tar.bz2
scilab2c-c7b7a3d6ae4ad04f1f62791229fda99792dbd9ba.zip
update Fortran detection
Diffstat (limited to 'src/m4')
-rw-r--r--src/m4/fortran.m424
1 files changed, 15 insertions, 9 deletions
diff --git a/src/m4/fortran.m4 b/src/m4/fortran.m4
index 7b94bb9c..4ed4c7f7 100644
--- a/src/m4/fortran.m4
+++ b/src/m4/fortran.m4
@@ -11,7 +11,13 @@ dnl AC_CHECK_UNDERSCORE_FORTRAN
dnl Look for trailing or leading underscores
dnl
AC_DEFUN([AC_CHECK_UNDERSCORE_FORTRAN],[
-AC_MSG_CHECKING([for leading underscores with Fortran])
+
+AC_CHECK_PROGS(NM,nm,no)
+if test "x$NM" = "xno"; then
+ AC_MSG_ERROR([Unable to find nm in the path. nm is used to list all the symbol from a lib])
+fi
+AC_MSG_CHECKING([for leading underscores with Fortran (name-mangling scheme)])
+
cat << EOF > pipof.f
subroutine pipof
end
@@ -23,19 +29,19 @@ eval "$F77 -c pipof.f > /dev/null 2>&1"
FC_LEADING_UNDERSCORE=no
FC_TRAILING_UNDERSCORE=no
-output=`nm $NMOPT pipof.o|grep _pipof 2>&1`
+output=`$NM $NMOPT pipof.o|grep _pipof 2>&1`
if test ! -z "$output"; then
FC_LEADING_UNDERSCORE=yes
FC_TRAILING_UNDERSCORE=no
fi
-output=`nm $NMOPT pipof.o|grep pipof_ 2>&1`
+output=`$NM $NMOPT pipof.o|grep pipof_ 2>&1`
if test ! -z "$output"; then
FC_LEADING_UNDERSCORE=no
FC_TRAILING_UNDERSCORE=yes
fi
-output=`nm $NMOPT pipof.o|grep _pipof_ 2>&1`
+output=`$NM $NMOPT pipof.o|grep _pipof_ 2>&1`
if test ! -z "$output"; then
FC_LEADING_UNDERSCORE=yes
FC_TRAILING_UNDERSCORE=yes
@@ -48,10 +54,10 @@ if test "$FC_TRAILING_UNDERSCORE" = yes; then
AC_DEFINE([WTU],,[If trailing underscores])
fi
-$RM pipof.f pipof.o
+rm -f pipof.f pipof.o
AC_MSG_RESULT([$FC_LEADING_UNDERSCORE])
-AC_MSG_CHECKING([for trailing underscores with Fortran])
+AC_MSG_CHECKING([for trailing underscores with Fortran (name-mangling scheme)])
AC_MSG_RESULT([$FC_TRAILING_UNDERSCORE])
#####################
@@ -79,16 +85,16 @@ AC_COMPILE_IFELSE(
## Define C2F and F2C entry point conversion ##
if test "$FC_TRAILING_UNDERSCORE" = yes; then
if test "$USE_SHARP_SIGN" = yes; then
- echo "Define C2F with Trailing Underscore and Sharp Sign"
+ AC_MSG_RESULT([Define C2F with Trailing Underscore and Sharp Sign])
AC_DEFINE([C2F(name)], [name##_],[Define C2F with Trailing Underscore and Sharp Sign])
AC_DEFINE([F2C(name)], [name##_],[Define F2C with Trailing Underscore and Sharp Sign])
else
- echo "Define C2F with Trailing Underscore and without Sharp Sign"
+ AC_MSG_RESULT([Define C2F with Trailing Underscore and without Sharp Sign])
AC_DEFINE([C2F(name)], [name/**/_],[Define C2F with Trailing Underscore and without Sharp Sign])
AC_DEFINE([F2C(name)], [name/**/_],[Define F2C with Trailing Underscore and without Sharp Sign])
fi
else
- echo "Define C2F without Trailing Underscore"
+ AC_MSG_RESULT([Define C2F without Trailing Underscore])
AC_DEFINE([C2F(name)], [name],[Define C2F without Trailing Underscore])
AC_DEFINE([F2C(name)], [name],[Define C2F without Trailing Underscore])
fi