From: Ralf Wildenhues Date: Sat, 31 Oct 2009 01:24:09 +0000 (+0100) Subject: Fix AC_OPENMP for Fortran (F77 and FC). X-Git-Tag: v2.65~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59f2fea80a181fb80c0f3e61641080a09e349f45;p=thirdparty%2Fautoconf.git 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. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index a152b253..296b307e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2009-10-31 Ralf Wildenhues + 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 b8c89362..eb643a73 100644 --- 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 diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index d55981b3..6cbcfa21 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -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. ## diff --git a/tests/c.at b/tests/c.at index 8235be2c..78edf453 100644 --- a/tests/c.at +++ b/tests/c.at @@ -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 +#endif +#include + +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 diff --git a/tests/fortran.at b/tests/fortran.at index ed58ee78..151b13f6 100644 --- a/tests/fortran.at +++ b/tests/fortran.at @@ -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