diff options
author | yash1112 | 2017-07-07 21:20:49 +0530 |
---|---|---|
committer | yash1112 | 2017-07-07 21:20:49 +0530 |
commit | 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 (patch) | |
tree | f50d6e06d8fe6bc1a9053ef10d4b4d857800ab51 /2.3-1/m4/fortran.m4 | |
download | Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.gz Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.bz2 Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.zip |
sci2c arduino updated
Diffstat (limited to '2.3-1/m4/fortran.m4')
-rw-r--r-- | 2.3-1/m4/fortran.m4 | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/2.3-1/m4/fortran.m4 b/2.3-1/m4/fortran.m4 new file mode 100644 index 00000000..4ed4c7f7 --- /dev/null +++ b/2.3-1/m4/fortran.m4 @@ -0,0 +1,103 @@ +dnl Macros which process ./configure arguments + + +dnl Fortran Macros +dnl ------------------------------------------------------ +dnl Copyright INRIA +dnl Sylvestre Ledru - June 2006 +dnl +dnl ------------------------------------------------------ +dnl AC_CHECK_UNDERSCORE_FORTRAN +dnl Look for trailing or leading underscores +dnl +AC_DEFUN([AC_CHECK_UNDERSCORE_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 +EOF + +dnl expand possible $SCIDIR in $FC (wizard command...) +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` +if test ! -z "$output"; then + FC_LEADING_UNDERSCORE=yes + FC_TRAILING_UNDERSCORE=no +fi + +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` +if test ! -z "$output"; then + FC_LEADING_UNDERSCORE=yes + FC_TRAILING_UNDERSCORE=yes +fi + +if test "$FC_LEADING_UNDERSCORE" = yes; then + AC_DEFINE([WLU],,[If leading underscores]) +fi +if test "$FC_TRAILING_UNDERSCORE" = yes; then + AC_DEFINE([WTU],,[If trailing underscores]) +fi + +rm -f pipof.f pipof.o + +AC_MSG_RESULT([$FC_LEADING_UNDERSCORE]) +AC_MSG_CHECKING([for trailing underscores with Fortran (name-mangling scheme)]) +AC_MSG_RESULT([$FC_TRAILING_UNDERSCORE]) + +##################### +## test for sharpsign +##################### + +AC_MSG_CHECKING([use of the sharpsign in CPP]) + +AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM( + [[#define C2F(name) name##_]], + [[C2F(toto)()]] + ) + ], + [AC_MSG_RESULT(yes) + AC_DEFINE([CNAME(name1,name2)], [name1##name2],[Cname]) + USE_SHARP_SIGN=yes] + , + [AC_MSG_RESULT(no) + AC_DEFINE([CNAME(name1,name2)], [name1/**/name2],[Cname]) + USE_SHARP_SIGN=no] +) + +## Define C2F and F2C entry point conversion ## +if test "$FC_TRAILING_UNDERSCORE" = yes; then + if test "$USE_SHARP_SIGN" = yes; then + 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 + 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 + 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 + +])dnl AC_CHECK_UNDERSCORE_FORTRAN + |