Commit dd1b98b2 authored by ulrich_y's avatar ulrich_y

C detection

parent 08b3965d
......@@ -144,8 +144,82 @@ case "$1,$2,$3" in
;;
esac
if $CONF_MCC ; then
findprog
echo -n "extracting the Fortran libraries... " 1>&3
rm -fr $test*
tee $test.f90 << _EOF_ 1>&2
program test
integer i
common /uscore/ i
stop i
end
_EOF_
while read line ; do
set -- ${line//[:,()]/ }
[[ "$1" =~ (/collect2|/ld|^ld)$ ]] && while test $# -gt 1 ; do
shift
case "$1" in
*.o | -lc*)
;;
-l* | -L* | *.a)
FLDFLAGS+=" $1" ;;
-Bstatic | -Bdynamic | *.ld)
FLDFLAGS+=" -Wl,$1" ;;
/*)
FLDFLAGS+=" -L$1" ;;
-rpath*)
FLDFLAGS+=" -Wl,$1,$2"
shift ;;
-dynamic-linker)
shift ;;
esac
done
done < <(eval $CONF_FC $CONF_FFLAGS -v -o $test $test.f90 2>&1)
echo "ok" 1>&3
eval addflag LFLAGS "$LDFLAGS $CONF_LDFLAGS $FLDFLAGS"
if ( $HAVE_GINAC || $HAVE_MCC ); then
findprog gcc CC clang gcc || exit 1
findprog g++ CXX clang++ g++ || exit 1
eval addflag CFLAGS "-std=c99"
## does Fortran append underscores to symbols?
echo -n "does $CONF_FC append underscores... " 1>&3
tee $test-c.c << _EOF_ 1>&2
int uscore_ = 95;
int uscore = 59;
_EOF_
for CONF_BITS in ${CONF_BITS:--m64 -m32} ; do
eval $CONF_CC $CONF_CFLAGS $CONF_BITS -c $test-c.c 1>&2 || continue
eval $CONF_FC $CONF_FFLAGS -o $test $test.f90 $test-c.o 1>&2 && break
done
./$test
case $? in
95)
echo "yes" 1>&3
CONF_NOUNDERSCORE=0 ;;
59)
echo "no" 1>&3
CONF_NOUNDERSCORE=1 ;;
*)
echo "error linking Fortran and C" 1>&3
exit 1 ;;
esac
else
$CONF_CC=
$CONF_CXX=
$CONF_CFLAGS=
$CONF_NOUNDERSCORE=
fi
#if ( $CONF_GINA || $CONF_MCC ); then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment