* lib/autoconf/fortran.m4 (AC_LANG_FUNC_LINK_TRY(Fortran): New.
* tests/c.at (AC_C_RESTRICT and C++, AC_OPENMP and C)
(AC_OPENMP and C++): New tests.
* tests/fortran.at (AC_OPENMP and Fortran 77)
(AC_OPENMP and Fortran): New tests.
* THANKS: Update.
Report by Bart Oldeman.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2009-10-31 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Fix AC_OPENMP for Fortran (F77 and FC).
+ * lib/autoconf/fortran.m4 (AC_LANG_FUNC_LINK_TRY(Fortran): New.
+ * tests/c.at (AC_C_RESTRICT and C++, AC_OPENMP and C)
+ (AC_OPENMP and C++): New tests.
+ * tests/fortran.at (AC_OPENMP and Fortran 77)
+ (AC_OPENMP and Fortran): New tests.
+ * THANKS: Update.
+ Report by Bart Oldeman.
+
Perl coverage convenience targets.
* Makefile.am (PERL_COVERAGE_DB, PERL_COVERAGE_FLAGS)
(PERL_COVER): New variables.
Artur Frysiak wiget@pld.org.pl
Assar Westerlund assar@sics.se
Axel Thimm Axel.Thimm@physik.fu-berlin.de
+Bart Oldeman bartoldeman@users.sourceforge.net
Ben Elliston bje@redhat.com
Ben Pfaff pfaffben@debian.org
Bill Moseley moseley@hank.org
[ call $2])])
+# AC_LANG_FUNC_LINK_TRY(Fortran 77)(FUNCTION)
+# -------------------------------------------
+m4_define([AC_LANG_FUNC_LINK_TRY(Fortran 77)],
+[AC_LANG_PROGRAM([],
+[ call $1])])
## ------------------------ ##
## 1b. Language selection. ##
AT_CHECK([${MAKE-make}], [], [ignore], [ignore])
AT_CLEANUP
+
+
+## ---------------- ##
+## AC_OPENMP and C. ##
+## ---------------- ##
+
+AT_SETUP([AC_OPENMP and C])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_PROG_CC
+AC_OPENMP
+if test "X$ac_cv_prog_c_openmp" = Xunsupported; then
+ AS_EXIT([77])
+fi
+CFLAGS="$CFLAGS $OPENMP_CFLAGS"
+CPPFLAGS="$CPPFLAGS $OPENMP_CFLAGS"
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[foo@EXEEXT@: foo.@OBJEXT@
+ @CC@ @CFLAGS@ @LDFLAGS@ -o $@ foo.@OBJEXT@
+
+foo.@OBJEXT@: foo.c
+ @CC@ @CPPFLAGS@ @CFLAGS@ -c foo.c
+]])
+
+AT_DATA([foo.c],
+[[#ifdef _OPENMP
+#include <omp.h>
+#endif
+#include <stdio.h>
+
+int main ()
+{
+#ifdef _OPENMP
+#pragma omp parallel
+ {
+ int id = omp_get_thread_num ();
+ printf ("hello omp world from %d\n", id);
+ }
+#endif
+ return 0;
+}
+]])
+
+: ${MAKE=make}
+AT_CHECK([autoreconf -vi], [], [ignore], [ignore])
+AT_CHECK([./configure $configure_options], [], [ignore], [ignore])
+AT_CHECK([$MAKE], [], [ignore], [ignore])
+
+AT_CLEANUP
+
+
+## ------------------ ##
+## AC_OPENMP anc C++. ##
+## ------------------ ##
+
+AT_SETUP([AC_OPENMP and C++])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_PROG_CXX
+AC_LANG([C++])
+AC_OPENMP
+if test "X$ac_cv_prog_cxx_openmp" = Xunsupported; then
+ AS_EXIT([77])
+fi
+CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
+CPPFLAGS="$CPPFLAGS $OPENMP_CXXFLAGS"
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[foo@EXEEXT@: foo.@OBJEXT@
+ @CXX@ @CXXFLAGS@ @LDFLAGS@ -o $@ foo.@OBJEXT@
+
+foo.@OBJEXT@: foo.cpp
+ @CXX@ @CPPFLAGS@ @CXXFLAGS@ -c foo.cpp
+]])
+
+AT_DATA([foo.cpp],
+[[int main ()
+{
+ return 0;
+}
+]])
+
+: ${MAKE=make}
+AT_CHECK([autoreconf -vi], [], [ignore], [ignore])
+AT_CHECK([./configure $configure_options], [], [ignore], [ignore])
+AT_CHECK([$MAKE], [], [ignore], [ignore])
+
+AT_CLEANUP
esac
fi
]])
+
+
+## ------------------------- ##
+## AC_OPENMP and Fortran 77. ##
+## ------------------------- ##
+
+AT_SETUP([AC_OPENMP and Fortran 77])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_PROG_F77
+AC_LANG([Fortran 77])
+AC_OPENMP
+if test "X$ac_cv_prog_f77_openmp" = Xunsupported; then
+ AS_EXIT([77])
+fi
+FFLAGS="$FFLAGS $OPENMP_FFLAGS"
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[foo@EXEEXT@: foo.@OBJEXT@
+ @F77@ @FFLAGS@ @LDFLAGS@ -o $@ foo.@OBJEXT@
+
+foo.@OBJEXT@: foo.f
+ @F77@ @FFLAGS@ -c foo.f
+]])
+
+AT_DATA([foo.f],
+[[ program main
+ end
+]])
+
+: ${MAKE=make}
+AT_CHECK([autoreconf -vi], [], [ignore], [ignore])
+AT_CHECK([./configure $configure_options], [], [ignore], [ignore])
+AT_CHECK([$MAKE], [], [ignore], [ignore])
+
+AT_CLEANUP
+
+
+## ---------------------- ##
+## AC_OPENMP and Fortran. ##
+## ---------------------- ##
+
+AT_SETUP([AC_OPENMP and Fortran])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_PROG_FC
+AC_LANG([Fortran])
+AC_OPENMP
+if test "X$ac_cv_prog_fc_openmp" = Xunsupported; then
+ AS_EXIT([77])
+fi
+FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[foo@EXEEXT@: foo.@OBJEXT@
+ @FC@ @FCFLAGS@ @LDFLAGS@ -o $@ foo.@OBJEXT@
+
+foo.@OBJEXT@: foo.f
+ @FC@ @FCFLAGS@ -c foo.f
+]])
+
+AT_DATA([foo.f],
+[[ program main
+ end
+]])
+
+: ${MAKE=make}
+AT_CHECK([autoreconf -vi], [], [ignore], [ignore])
+AT_CHECK([./configure $configure_options], [], [ignore], [ignore])
+AT_CHECK([$MAKE], [], [ignore], [ignore])
+
+AT_CLEANUP