diff --git a/Makefile.am b/Makefile.am index aebab9a..66fd2c7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,7 +34,11 @@ ACLOCAL_AMFLAGS = -I m4 CLEANFILES = trexio.mod +if HAVE_FORTRAN BUILT_SOURCES = trexio.mod +else +BUILT_SOURCES = +endif EXTRA_DIST = .git_hash PACKAGE_VERSION = @PACKAGE_VERSION@ @@ -48,7 +52,10 @@ pkgconfig_DATA = pkgconfig/trexio.pc trexio_h = $(srcdir)/include/trexio.h trexio_f = $(srcdir)/include/trexio_f.f90 -include_HEADERS = $(trexio_h) $(trexio_f) +include_HEADERS = $(trexio_h) +if HAVE_FORTRAN +include_HEADERS += $(trexio_f) +endif AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include @@ -136,15 +143,19 @@ TESTS_C += \ tests/overwrite_all_hdf5 endif +TESTS = $(TESTS_C) +if HAVE_FORTRAN TESTS_F = \ tests/test_f +TESTS += $(TESTS_F) +endif -TESTS = $(TESTS_C) $(TESTS_F) check_PROGRAMS = $(TESTS) # specify common LDADD options for all tests LDADD = src/libtrexio.la +if HAVE_FORTRAN test_trexio_f = $(srcdir)/tests/trexio_f.f90 $(test_trexio_f): $(trexio_f) @@ -153,6 +164,7 @@ $(test_trexio_f): $(trexio_f) trexio.mod: tests/trexio_f.o tests_test_f_SOURCES = $(test_trexio_f) tests/test_f.f90 +endif clean-local: -rm -rf -- *.dir/ *.h5 __pycache__/ diff --git a/configure.ac b/configure.ac index d4d1418..606e129 100644 --- a/configure.ac +++ b/configure.ac @@ -50,12 +50,18 @@ AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])]) AC_PROG_CC_C_O -# Fortran -AC_PROG_FC -AC_FC_FREEFORM -AC_FC_SRCEXT([f90]) -AC_PROG_FC_C_O -AC_FC_LIBRARY_LDFLAGS + +# Fortran API [default: --with-fortran], do not disable in the dev mode +AC_ARG_WITH(fortran, [AS_HELP_STRING([--without-fortran],[do not test and install the Fortran API])], ok=$withval, ok=yes) +if test "$ok" = "yes"; then + AC_PROG_FC + AC_FC_FREEFORM + AC_FC_SRCEXT([f90]) + AC_PROG_FC_C_O + AC_FC_LIBRARY_LDFLAGS +fi + +AM_CONDITIONAL([HAVE_FORTRAN],[test "$ok" = "yes"]) # pkg-config PKG_PROG_PKG_CONFIG()