From: Eric Lindahl Date: Wed, 31 Jul 2002 20:15:28 +0000 (+0000) Subject: * libtool.m4 (AC_PROG_LIBTOOL): Added support for the new F77 X-Git-Tag: release-1-5~96 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c466be90b3e14e25603d52c202c3e6fe3603989c;p=thirdparty%2Flibtool.git * libtool.m4 (AC_PROG_LIBTOOL): Added support for the new F77 Fortran support tag. (AC_LIBTOOL_PROG_CC_C_O, _LT_AC_TAGCONFIG): Support F77 tag. (AC_LIBTOOL_F77, _LT_AC_LANG_F77, AC_LIBTOOL_LANG_F77_CONFIG): New macros for F77 tag Fortran support. * configure.ac: Add support for creating the new F77 tag. * bootstrap: Add f77demo directory to the list to be processed. * Makefile.am: Add support for FFLAGS and FLIBS. * tests/Makefile.am: Add new Fortran tests. * tests/f77demo-*.test: New files. * f77demo/configure.ac, f77demo/cprogram.c, f77demo/fooc.c * f77demo/foof.f, f77demo/foo.h, f77demo/fprogram.f * f77demo/Makefile.am, f77demo/README: New files. --- diff --git a/ChangeLog b/ChangeLog index 3521b6a9e..4c7d02118 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2002-07-31 Eric Lindahl + + * libtool.m4 (AC_PROG_LIBTOOL): Added support for the new F77 + Fortran support tag. + (AC_LIBTOOL_PROG_CC_C_O, _LT_AC_TAGCONFIG): Support F77 tag. + (AC_LIBTOOL_F77, _LT_AC_LANG_F77, AC_LIBTOOL_LANG_F77_CONFIG): + New macros for F77 tag Fortran support. + * configure.ac: Add support for creating the new F77 tag. + * bootstrap: Add f77demo directory to the list to be processed. + * Makefile.am: Add support for FFLAGS and FLIBS. + * tests/Makefile.am: Add new Fortran tests. + * tests/f77demo-*.test: New files. + * f77demo/configure.ac, f77demo/cprogram.c, f77demo/fooc.c + * f77demo/foof.f, f77demo/foo.h, f77demo/fprogram.f + * f77demo/Makefile.am, f77demo/README: New files. + 2002-07-16 Gary V. Vaughan * libltdl/ltdl.c (tryall_dlopen): We need to catch missing file diff --git a/Makefile.am b/Makefile.am index 27be8a0da..ac7569d14 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,6 +11,8 @@ CFLAGS = @CFLAGS@ CPPLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS= @LIBS@ +FFLAGS = @FFLAGS@ +FLIBS = @FLIBS@ aclocal_macros = libtool.m4 ltdl.m4 diff --git a/bootstrap b/bootstrap index 7304e8f92..18f675f1f 100755 --- a/bootstrap +++ b/bootstrap @@ -14,7 +14,7 @@ find . \( -name autom4te.cache -o -name libtool \) -exec rm -r {} \; touch ltmain.sh touch libtoolize -for sub in . libltdl cdemo demo depdemo mdemo pdemo tagdemo; do +for sub in . libltdl cdemo demo depdemo mdemo pdemo tagdemo f77demo; do case $sub in .) top_srcdir=. diff --git a/configure.ac b/configure.ac index 607a75085..bc4b24773 100644 --- a/configure.ac +++ b/configure.ac @@ -75,7 +75,7 @@ AC_CONFIG_SUBDIRS([libltdl]) # all subdirectories that are configured on demand, but that must be # included in the distribution -CONF_SUBDIRS="cdemo pdemo demo depdemo mdemo tagdemo" +CONF_SUBDIRS="cdemo pdemo demo depdemo mdemo tagdemo f77demo" AC_SUBST([CONF_SUBDIRS]) ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4" @@ -107,6 +107,11 @@ AC_PROG_CXX popdef([AC_MSG_ERROR]) AM_CONDITIONAL(HAVE_CXX, [test "x$CXX" != xno]) +pushdef([AC_MSG_ERROR], [F77=no]) +AC_PROG_F77 +popdef([AC_MSG_ERROR]) +AM_CONDITIONAL(HAVE_F77, [test "x$F77" != xno]) + LT_AC_PROG_GCJ AM_CONDITIONAL(HAVE_GCJ, [test "x$GCJ" != xno]) diff --git a/f77demo/Makefile.am b/f77demo/Makefile.am new file mode 100644 index 000000000..9f391e235 --- /dev/null +++ b/f77demo/Makefile.am @@ -0,0 +1,31 @@ +## Process this file with automake to produce Makefile.in +## +## $Id$ + +AUTOMAKE_OPTIONS = no-dependencies foreign + +EXTRA_DIST = acinclude.m4 + +noinst_LTLIBRARIES = libfoo.la libmix.la + +libfoo_la_SOURCES = foof.f +libmix_la_SOURCES = foof.f fooc.c + +noinst_HEADERS = foo.h + +bin_PROGRAMS = fprogram cprogram + +fprogram_SOURCES = fprogram.f +fprogram_LDADD = libfoo.la + +cprogram_SOURCES = cprogram.c +cprogram_LDADD = libmix.la + +$(OBJECTS): libtool +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck + + + + + diff --git a/f77demo/README b/f77demo/README new file mode 100644 index 000000000..11df06c77 --- /dev/null +++ b/f77demo/README @@ -0,0 +1,16 @@ +This is a short demo of the fortran support in libtool. + +fprogram is a pure-fortran program which is linked +against the fortran-only library libfoo.la + +cprogram is a C program, which is linked against the +mixed C and fortran library libmix.la. The program +calls a C function, which in turn calls a fortran +function. + +This demo requires GNU autoconf, automake, +libtool with the F77 tag and quite obvious Fortran 77. + + + + diff --git a/f77demo/configure.ac b/f77demo/configure.ac new file mode 100644 index 000000000..219f76258 --- /dev/null +++ b/f77demo/configure.ac @@ -0,0 +1,69 @@ +## Process this file with autoconf to create configure. -*- autoconf -*- +# Copyright 2001 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA + +AC_PREREQ(2.50) + +## ------------------------ ## +## Autoconf initialisation. ## +## ------------------------ ## +AC_INIT([f77demo], [0.1], [bug-libtool@gnu.org]) +AC_CONFIG_SRCDIR([foof.f])dnl + +## ------------------------ ## +## Automake Initialisation. ## +## ------------------------ ## +AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION) + + +## ------------------ ## +## C compiler checks. ## +## ------------------ ## +AC_PROG_CC + +## ------------------------ ## +## Fortran compiler checks. ## +## ------------------------ ## +AC_PROG_F77 +dnl Check the flags needed to link f77 programs with ld (i.e. cc) +AC_F77_LIBRARY_LDFLAGS +dnl Check for underscoring of external names +AC_F77_WRAPPERS + +# As of the writing of this demo, GNU Autoconf's AC_OBJEXT and +# AC_EXEEXT macros only works for C compilers! +# Libtool's setup macro calls AC_OBJEXT and AC_EXEEXT without setting +# the test language to C. We do it before any libtool setup macros are +# called so that the proper values are cached beforehand. We also do +# it before any linker flags (LDFLAGS) are set so that fortran specific +# ones don't break the tests. +AC_LANG_PUSH([C]) +AC_OBJEXT +AC_EXEEXT +AC_LANG_POP + +## ----------------------- ## +## Libtool initialisation. ## +## ----------------------- ## +AM_PROG_LIBTOOL +AC_SUBST([LIBTOOL_DEPS]) + +## -------- ## +## Outputs. ## +## -------- ## +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/f77demo/cprogram.c b/f77demo/cprogram.c new file mode 100644 index 000000000..64edc84d9 --- /dev/null +++ b/f77demo/cprogram.c @@ -0,0 +1,46 @@ +/* +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA. */ + +#include "foo.h" + +int +main(int argc, char **argv) +{ + int arg,cres,fres; + + printf ("Welcome to GNU libtool mixed C/Fortran demo!\n"); + + arg=2; + + cres=csub(arg); + + printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres); + + if(cres==2*arg) + printf ("The C subroutine is ok!\n"); + + printf("\nCalling the C wrapper routine...\n"); + fres=fwrapper(arg); + + printf ("The C wrapper to the fortran subroutine returned,\n" + "claiming that 2*%d = %d\n",arg,fres); + + if(fres==2*arg) + printf ("The Fortran 77 subroutine is ok!\n"); + + return 0; +} + diff --git a/f77demo/foo.h b/f77demo/foo.h new file mode 100644 index 000000000..4fd21eab6 --- /dev/null +++ b/f77demo/foo.h @@ -0,0 +1,47 @@ +/* foo.h -- interface to fortran and C libraries + Copyright (C) 1998-1999 Free Software Foundation, Inc. + This file is part of GNU Libtool. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA. */ + +#ifndef _FOO_H_ +#define _FOO_H_ 1 + +/* config.h is necessary for the fortran name mangling */ +#ifdef HAVE_CONFIG_H +#include +#endif + +/* csub is an extremely useful subroutine that + * returns the argument multiplied by two :-) + */ +extern int csub(int); + +/* This routine performs the same action, but + * calls the fortran subroutine fsub to do the + * real work. + */ +extern int fwrapper(int); + +/* fsub does the same thing as csub, i.e. res=arg*2. + * Use autoconf macro for fortran function names. + * Note that fortran passes args by reference, so + * you need to provide pointers to your ints. + */ +extern void F77_FUNC(fsub,FSUB)(int *arg, int *res); + + +#endif diff --git a/f77demo/fooc.c b/f77demo/fooc.c new file mode 100644 index 000000000..eac944d4d --- /dev/null +++ b/f77demo/fooc.c @@ -0,0 +1,17 @@ +#include "foo.h" + + +int csub(int arg) +{ + return (2*arg); +} + + +int fwrapper(int arg) +{ + int res; + printf("Calling the Fortran 77 subroutine from the C wrapper...\n"); + F77_FUNC(fsub,FSUB)(&arg,&res); + printf("Returned from the Fortran 77 subroutine...\n"); + return res; +} diff --git a/f77demo/foof.f b/f77demo/foof.f new file mode 100644 index 000000000..6e631fbff --- /dev/null +++ b/f77demo/foof.f @@ -0,0 +1,13 @@ +C +C This program is free software; you can redistribute it and/or +C modify it under the terms of the GNU General Public License +C as published by the Free Software Foundation; either version 2 +C of the License, or (at your option) any later version. +C + + subroutine fsub(arg,res) + implicit none + integer*4 arg,res + res=arg*2 + return + end diff --git a/f77demo/fprogram.f b/f77demo/fprogram.f new file mode 100644 index 000000000..bf882f6e1 --- /dev/null +++ b/f77demo/fprogram.f @@ -0,0 +1,27 @@ +C +C This program is free software; you can redistribute it and/or +C modify it under the terms of the GNU General Public License +C as published by the Free Software Foundation; either version 2 +C of the License, or (at your option) any later version. +C + + program fprogram + implicit none + integer*4 arg,res + + write(*,*) 'Welcome to GNU libtool Fortran demo!' + write(*,*) 'Real programmers write in FORTRAN.' + arg=2 + + call fsub(arg,res) + + write(*,*) 'fsub returned, saying that 2 *',arg,' =',res + + if (res.eq.4) then + write(*,*) 'fsub is ok!' + endif + + stop + end + + diff --git a/libtool.m4 b/libtool.m4 index ed45cf0a6..61ba9e8a0 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -45,6 +45,11 @@ dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run @@ -70,6 +75,7 @@ dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed @@ -531,7 +537,7 @@ AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $3" - echo "$lt_simple_compile_test_code" > conftest.$ac_ext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext if (eval $ac_compile 2>conftest.err) && test -s $ac_outfile; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -563,7 +569,7 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext + printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -850,6 +856,8 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"], [$1],[CXX],[save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -o out/conftest2.$ac_objext"], + [$1],[F77],[save_FFLAGS="$FFLAGS" + FFLAGS="$FFLAGS -o out/conftest2.$ac_objext"], [$1],[GCJ],[save_GCJFLAGS="$CFLAGS" CFLAGS="$GCJFLAGS -o out/conftest2.$ac_objext"]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -874,6 +882,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], fi ifelse([$1],[],[CFLAGS="$save_CFLAGS"], [$1],[CXX],[CXXFLAGS="$save_CXXFLAGS"], + [$1],[F77],[FFLAGS="$save_FFLAGS"], [$1],[GCJ],[CFLAGS="$save_CFLAGS"]) chmod u+w . $rm conftest* out/* @@ -1505,6 +1514,10 @@ if test -f "$ltmain" && test -n "$tagnames"; then AC_LIBTOOL_LANG_CXX_CONFIG ;; + F77) + AC_LIBTOOL_LANG_F77_CONFIG + ;; + GCJ) AC_LIBTOOL_LANG_GCJ_CONFIG ;; @@ -2202,6 +2215,22 @@ _LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) ])# _LT_AC_LANG_CXX +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) +])# _LT_AC_LANG_F77 + + # AC_LIBTOOL_GCJ # -------------- # enable support for GCJ libraries @@ -2250,10 +2279,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" +lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests -lt_simple_link_test_code='main(){return(0);}' +lt_simple_link_test_code='main(){return(0);}\n' _LT_AC_SYS_COMPILER @@ -2380,10 +2409,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" +lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int char *[]) { return(0); }' +lt_simple_link_test_code='int main(int char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -3198,6 +3227,101 @@ CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_CXX_CONFIG +# AC_LIBTOOL_LANG_F77_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) +AC_DEFUN([_LT_AC_LANG_F77_CONFIG], +[AC_REQUIRE([AC_PROG_F77]) +AC_LANG_PUSH(Fortran 77) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$G77" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + # AC_LIBTOOL_LANG_GCJ_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are @@ -3271,7 +3395,7 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" diff --git a/tests/Makefile.am b/tests/Makefile.am index 743530c08..20761b3d4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,11 @@ CXX_TESTS = \ tagdemo-conf.test tagdemo-make.test tagdemo-exec.test \ tagdemo-shared.test tagdemo-make.test tagdemo-exec.test +F77_TESTS = \ + f77demo-static.test f77demo-make.test f77demo-exec.test \ + f77demo-conf.test f77demo-make.test f77demo-exec.test \ + f77demo-shared.test f77demo-make.test f77demo-exec.test + COMMON_TESTS = \ cdemo-static.test cdemo-make.test cdemo-exec.test \ demo-static.test demo-make.test demo-exec.test \ @@ -41,10 +46,18 @@ COMMON_TESTS = \ pdemo-make.test pdemo-exec.test pdemo-inst.test if HAVE_CXX +if HAVE_F77 +TESTS = $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS) +else TESTS = $(COMMON_TESTS) $(CXX_TESTS) +endif +else +if HAVE_F77 +TESTS = $(COMMON_TESTS) $(F77_TESTS) else TESTS = $(COMMON_TESTS) endif +endif demo-conf.test: $(top_builddir)/libtool @@ -56,14 +69,17 @@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ +if HAVE_F77 + FFLAGS = @FFLAGS@ +endif # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ - OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" + OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" FFLAGS="$(FFLAGS)" -EXTRA_DIST = defs $(COMMON_TESTS) $(CXX_TESTS) +EXTRA_DIST = defs $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS) # We need to remove any files that the above tests created. clean-local: @@ -73,4 +89,5 @@ clean-local: -test -f ../depdemo/Makefile && cd ../depdemo && $(MAKE) distclean -test -f ../mdemo/Makefile && cd ../mdemo && $(MAKE) distclean -test -f ../tagdemo/Makefile && cd ../tagdemo && $(MAKE) distclean + -test -f ../f77demo/Makefile && cd ../f77demo && $(MAKE) distclean rm -rf _inst diff --git a/tests/f77demo-conf.test b/tests/f77demo-conf.test new file mode 100755 index 000000000..a5c08a6d9 --- /dev/null +++ b/tests/f77demo-conf.test @@ -0,0 +1,35 @@ +#! /bin/sh +# f77demo-conf.test - try configuring the ../f77demo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../f77demo || mkdir ../f77demo + +# Change to our build directory. +cd ../f77demo || exit 1 + +# Possibly clean up the distribution. +if test -f Makefile; then + echo "= Running $make distclean in ../f77demo" + $make distclean +fi +rm -f config.cache + +# Configure the demonstration. +echo "= Configuring in ../f77demo (prefix=$prefix)" +CONFIG_SITE=/dev/null/config/site ${CONFIG_SHELL-/bin/sh} $srcdir/../f77demo/configure --srcdir=$srcdir/../f77demo --prefix=$prefix || exit 1 + +if egrep '^build_old_libs=yes' libtool > /dev/null && + egrep '^build_libtool_libs=yes' libtool > /dev/null; then : +else rm -f Makefile && exit 77 +fi + +exit 0 diff --git a/tests/f77demo-exec.test b/tests/f77demo-exec.test new file mode 100755 index 000000000..55b70d308 --- /dev/null +++ b/tests/f77demo-exec.test @@ -0,0 +1,34 @@ +#! /bin/sh +# f77demo-exec.test - check that programs in the ../f77demo subdirectory are viable + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +if test -f ../f77demo/fprogram -a -f ../f77demo/cprogram; then : +else + echo "You must run f77demo-make.test before running $0" 1>&2 + exit 77 +fi + +# Check to see if the programs really run. +echo "Executing uninstalled programs in ../f77demo" + +if ../f77demo/fprogram ; then : +else + echo "$0: cannot execute ../f77demo/fprogram" 1>&2 + status=1 +fi + +if ../f77demo/cprogram ; then : +else + echo "$0: cannot execute ../f77demo/cprogram" 1>&2 + status=1 +fi + +exit $status diff --git a/tests/f77demo-make.test b/tests/f77demo-make.test new file mode 100755 index 000000000..5191d77ee --- /dev/null +++ b/tests/f77demo-make.test @@ -0,0 +1,25 @@ +#! /bin/sh +# f77demo-make.test - try building in the ../f77demo subdirectory + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +if test -f ../f77demo/Makefile; then : +else + echo "You must run f77demo-conf.test before running $0" 1>&2 + exit 77 +fi + +# Change to our build directory. +cd ../f77demo || exit 1 + +# Do the actual build. +echo "Making in ../f77demo" +$make || exit 1 +exit 0 diff --git a/tests/f77demo-shared.test b/tests/f77demo-shared.test new file mode 100755 index 000000000..ed50e0a3a --- /dev/null +++ b/tests/f77demo-shared.test @@ -0,0 +1,35 @@ +#! /bin/sh +# f77demo-conf.test - try configuring the ../f77demo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../f77demo || mkdir ../f77demo + +# Change to our build directory. +cd ../f77demo || exit 1 + +# Possibly clean up the distribution. +if test -f Makefile; then + echo "= Running $make distclean in ../f77demo" + $make distclean +fi +rm -f config.cache + +# Configure the demonstration. +echo "= Configuring in ../f77demo (prefix=$prefix) with --disable-static" +CONFIG_SITE=/dev/null/config/site ${CONFIG_SHELL-/bin/sh} $srcdir/../f77demo/configure --srcdir=$srcdir/../f77demo --prefix=$prefix --disable-static || exit 1 + +if egrep '^build_old_libs=no' libtool > /dev/null && + egrep '^build_libtool_libs=yes' libtool > /dev/null; then : +else rm -f Makefile && exit 77 +fi + +exit 0 diff --git a/tests/f77demo-static.test b/tests/f77demo-static.test new file mode 100755 index 000000000..1000c370d --- /dev/null +++ b/tests/f77demo-static.test @@ -0,0 +1,44 @@ +#! /bin/sh +# f77demo-conf.test - try configuring the ../f77demo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../f77demo || mkdir ../f77demo + +# Change to our build directory. +cd ../f77demo || exit 1 + +# Possibly clean up the distribution. +if test -f Makefile; then + echo "= Running $make distclean in ../f77demo" + $make distclean +fi +rm -f config.cache + +# Configure the demonstration. +echo "= Configuring in ../f77demo (prefix=$prefix) with --disable-shared" +CONFIG_SITE=/dev/null/config/site ${CONFIG_SHELL-/bin/sh} $srcdir/../f77demo/configure --srcdir=$srcdir/../f77demo --prefix=$prefix --disable-shared || exit 1 + +if egrep '^build_old_libs=yes' libtool > /dev/null && + egrep '^build_libtool_libs=no' libtool > /dev/null; then : +else rm -f Makefile && exit 77 +fi + +exit 0 + + + + + + + + +