]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix AC_OPENMP for Fortran (F77 and FC).
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 31 Oct 2009 01:24:09 +0000 (02:24 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 31 Oct 2009 01:24:09 +0000 (02:24 +0100)
* 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>
ChangeLog
THANKS
lib/autoconf/fortran.m4
tests/c.at
tests/fortran.at

index a152b253aacab0e40383ac0e6808647feaefc102..296b307e2f7f2fac0f83820791616747bc634b0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 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.
diff --git a/THANKS b/THANKS
index b8c89362ba6f39b6650b30306c369064a45eb8c5..eb643a735cd0ff164babd3e0e687cee808f95068 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -42,6 +42,7 @@ Arto C. Nirkko              ?
 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
index d55981b3f05524994cd829a3fe87ee5bb4928ee4..6cbcfa211250b443d2f28c29da4296d3f4177a4b 100644 (file)
@@ -207,6 +207,11 @@ m4_define([AC_LANG_CALL(Fortran 77)],
 [      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.  ##
index 8235be2cb4dd9ab01620b8297b1dbb72d6125429..78edf453d5b0f40fe34b02adbdca424ae9a2b998 100644 (file)
@@ -320,3 +320,100 @@ AT_CHECK([${MAKE-make} cpp-works || exit 77], [], [ignore], [ignore])
 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
index ed58ee7831fa88962cbac966fbcf4f21784a1dfb..151b13f6313eb15820929ab66b75edaf235b85de 100644 (file)
@@ -73,3 +73,83 @@ if test "$ac_compiler_gnu" = yes; then
   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