@@ -30,12 +30,30 @@ AC_ARG_VAR([FCLDFLAGS],[Fortran compiler-specific flags at link time])
3030AC_ARG_VAR ( [ LT_CFLAGS] ,[ C compiler flags passed to libtool in compile mode] )
3131AC_ARG_VAR ( [ LT_LDFLAGS] ,[ Flags passed to libtool in link mode] )
3232
33+ dnl
34+ # Enable fortran interface
35+ AC_ARG_ENABLE ( fortran ,
36+ [ --enable-fortran enable fortran interface to mat library] ,
37+ [ if test "$enableval" = "no" ; then
38+ enable_fortran=no
39+ else
40+ enable_fortran=yes
41+ fi] ,
42+ enable_fortran=no )
43+
3344dnl
3445dnl Build programs, C compiler, F77 compiler, make, install, etc.
3546dnl
3647AC_PROG_CC ( [ pgcc icc gcc cc] )
3748AC_USE_SYSTEM_EXTENSIONS
3849
50+ if test "$enable_fortran" = "yes"
51+ then
52+ AC_PROG_FC ( [ pgf95 pgf90 ifort gfortran g95] )
53+ AC_FC_WRAPPERS
54+ AC_CONFIG_FILES ( [ src/fortran/matio_t.inc] )
55+ fi
56+
3957AC_ARG_ENABLE ( coverage ,
4058[ --enable-coverage Enable coverage testing] ,
4159[ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"] )
@@ -105,6 +123,10 @@ then
105123 FCFLAGS="$PROFILE_FCFLAGS $FCFLAGS"
106124fi
107125
126+ dnl
127+ dnl Try to avoid having libtool search for a fortran compiler
128+ dnl
129+ F77=$FC
108130AC_ENABLE_SHARED
109131AC_ENABLE_STATIC
110132LT_INIT
@@ -368,6 +390,18 @@ esac
368390AM_CONDITIONAL([ LINUX] , [ test "x$linux" = "xyes"] )
369391AM_CONDITIONAL([ WINNT] , [ test "x$winnt" = "xyes"] )
370392AM_CONDITIONAL([ SUN] , [ test "x$sun" = "xyes"] )
393+ AM_CONDITIONAL([ ENABLE_FORTRAN] , [ test "x$enable_fortran" = "xyes"] )
394+
395+ dnl
396+ dnl Without this, the linker line is incorrect on platforms without a fortran
397+ dnl compiler even if we are not using fortran sources
398+ dnl
399+ if test "x$enable_fortran" != "xyes"; then
400+ FCLINK='$(LINK)'
401+ else
402+ FCLINK='$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@'
403+ fi
404+ AC_SUBST ( FCLINK )
371405
372406winnt="no"
373407case "${host_os}" in
@@ -396,9 +430,13 @@ AC_MSG_RESULT([])
396430AC_MSG_RESULT ( [ MATIO Configuration Summary ] )
397431AC_MSG_RESULT ( [ ==============================================================] )
398432AC_MSG_RESULT ( [ C Compiler: $CC] )
433+ AC_MSG_RESULT ( [ Fortran Compiler: $FC] )
399434AC_MSG_RESULT ( [ CFLAGS: $CFLAGS] )
435+ AC_MSG_RESULT ( [ FCFLAGS: $FCFLAGS] )
436+ AC_MSG_RESULT ( [ FCLDFLAGS: $FCLDFLAGS] )
400437AC_MSG_RESULT ( [ Shared Libraries: $enable_shared] )
401438AC_MSG_RESULT ( [ Static Libraries: $enable_static] )
439+ AC_MSG_RESULT ( [ Fortran Interface: $enable_fortran] )
402440AC_MSG_RESULT ( [ default MAT version: $file_ver] )
403441AC_MSG_RESULT ( [ ] )
404442AC_MSG_RESULT ( [ Features --------------------------------------------] )
0 commit comments