libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 08/10] tests: migrate legacy tests/f77demo tests to Autotest.


From: Gary V. Vaughan
Subject: [PATCH 08/10] tests: migrate legacy tests/f77demo tests to Autotest.
Date: Fri, 25 Nov 2011 16:10:59 +0700

* tests/f77demo.at: New autotest groups, based on...
* tests/f77demo-conf.test, tests/f77demo-exec.test,
tests/f77demo-make.test, tests/f77demo-shared-exec.test,
tests/f77demo-shared-make.test, tests/f77demo-shared.test,
tests/f77demo-static-exec.test, tests/f77demo-static-make.test,
tests/f77demo-static.test: ...these legacy tests, now removed.
* tests/f77demo/Makefile.am, tests/f77demo/README,
tests/f77demo/configure.ac, tests/f77demo/cprogram.c,
tests/f77demo/foo.h, tests/f77demo/fooc.c, tests/f77demo/foof.f,
tests/f77demo/foof2.f, tests/f77demo/foof3.f,
tests/f77demo/fprogram.f: Remove.
* configure.ac (CONF_SUBDIRS): Remove tests/f77demo.

Signed-off-by: Gary V. Vaughan <address@hidden>
---
 Makefile.am                    |   41 +-----
 configure.ac                   |    2 +-
 tests/f77demo-conf.test        |   34 ----
 tests/f77demo-exec.test        |   35 -----
 tests/f77demo-make.test        |   36 -----
 tests/f77demo-shared-exec.test |    3 -
 tests/f77demo-shared-make.test |    3 -
 tests/f77demo-shared.test      |   34 ----
 tests/f77demo-static-exec.test |    3 -
 tests/f77demo-static-make.test |    3 -
 tests/f77demo-static.test      |   34 ----
 tests/f77demo.at               |  332 ++++++++++++++++++++++++++++++++++++++++
 tests/f77demo/.gitignore       |    2 -
 tests/f77demo/Makefile.am      |   65 --------
 tests/f77demo/README           |   12 --
 tests/f77demo/configure.ac     |   71 ---------
 tests/f77demo/cprogram.c       |   53 -------
 tests/f77demo/foo.h            |   53 -------
 tests/f77demo/fooc.c           |   41 -----
 tests/f77demo/foof.f           |   10 --
 tests/f77demo/foof2.f          |   12 --
 tests/f77demo/foof3.f          |   12 --
 tests/f77demo/fprogram.f       |   31 ----
 23 files changed, 339 insertions(+), 583 deletions(-)
 delete mode 100755 tests/f77demo-conf.test
 delete mode 100755 tests/f77demo-exec.test
 delete mode 100755 tests/f77demo-make.test
 delete mode 100755 tests/f77demo-shared-exec.test
 delete mode 100755 tests/f77demo-shared-make.test
 delete mode 100755 tests/f77demo-shared.test
 delete mode 100755 tests/f77demo-static-exec.test
 delete mode 100755 tests/f77demo-static-make.test
 delete mode 100755 tests/f77demo-static.test
 create mode 100644 tests/f77demo.at
 delete mode 100644 tests/f77demo/.gitignore
 delete mode 100644 tests/f77demo/Makefile.am
 delete mode 100644 tests/f77demo/README
 delete mode 100644 tests/f77demo/configure.ac
 delete mode 100644 tests/f77demo/cprogram.c
 delete mode 100644 tests/f77demo/foo.h
 delete mode 100644 tests/f77demo/fooc.c
 delete mode 100644 tests/f77demo/foof.f
 delete mode 100644 tests/f77demo/foof2.f
 delete mode 100644 tests/f77demo/foof3.f
 delete mode 100644 tests/f77demo/fprogram.f

diff --git a/Makefile.am b/Makefile.am
index 2f9b90b..670bbd4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -694,6 +694,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/stresstest.at \
                  tests/cmdline_wrap.at \
                  tests/pic_flag.at \
+                 tests/f77demo.at \
                  tests/darwin.at \
                  tests/dumpbin-symbols.at \
                  tests/deplibs-mingw.at \
@@ -768,9 +769,7 @@ installcheck-local: $(testsuite_deps)
          AUTOTEST_PATH='$(exec_prefix)/bin'
 
 check-noninteractive-old:
-       $(AM_V_at)'$(MAKE)' $(AM_MAKEFLAGS) check-TESTS 
TESTS='$(NONINTERACTIVE_TESTS)'
-check-interactive-old:
-       $(AM_V_at)'$(MAKE)' $(AM_MAKEFLAGS) check-TESTS 
TESTS='$(INTERACTIVE_TESTS)'
+       $(AM_V_at)'$(MAKE)' $(AM_MAKEFLAGS) check-TESTS TESTS='$(TESTS)'
 
 # Run only noninteractive parts of the new testsuite.
 check-noninteractive-new: $(testsuite_deps_uninstalled)
@@ -781,14 +780,13 @@ check-noninteractive-new: $(testsuite_deps_uninstalled)
          $(TESTSUITEFLAGS)
 
 # Run only interactive parts of the new testsuite.
-check-interactive-new: $(testsuite_deps_uninstalled)
+check-interactive: $(testsuite_deps_uninstalled)
        $(AM_V_at)$(CD_TESTDIR); \
        CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \
          $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) \
          -k interactive -k recursive INNER_TESTSUITEFLAGS=',interactive' \
          $(TESTSUITEFLAGS)
 
-check-interactive: check-interactive-old check-interactive-new
 check-noninteractive: check-noninteractive-old check-noninteractive-new
 
 # We need to remove any file droppings left behind by testsuite
@@ -807,26 +805,6 @@ clean-local: clean-local-legacy
 #           using the new framework above.  When the migration is
 #           complete this section should be removed.
 
-F77_TESTS = \
-       tests/f77demo-static.test \
-       tests/f77demo-static-make.test \
-       tests/f77demo-static-exec.test \
-       tests/f77demo-conf.test \
-       tests/f77demo-make.test \
-       tests/f77demo-exec.test \
-       tests/f77demo-shared.test \
-       tests/f77demo-shared-make.test \
-       tests/f77demo-shared-exec.test
-
-tests/f77demo-shared-exec.log: tests/f77demo-shared-make.log
-tests/f77demo-shared-make.log: tests/f77demo-shared.log
-tests/f77demo-shared.log:      tests/f77demo-exec.log
-tests/f77demo-exec.log:                tests/f77demo-make.log
-tests/f77demo-make.log:                tests/f77demo-conf.log
-tests/f77demo-conf.log:                tests/f77demo-static-exec.log
-tests/f77demo-static-exec.log: tests/f77demo-static-make.log
-tests/f77demo-static-make.log: tests/f77demo-static.log
-
 FC_TESTS = \
        tests/fcdemo-static.test \
        tests/fcdemo-static-make.test \
@@ -856,23 +834,16 @@ COMMON_TESTS = \
        tests/suffix.test \
        tests/tagtrace.test
 
-INTERACTIVE_TESTS =
-NONINTERACTIVE_TESTS = $(COMMON_TESTS)
-if HAVE_F77
-# f77demo-static-exec.test might be interactive on MSYS.
-INTERACTIVE_TESTS += $(F77_TESTS)
-endif
+TESTS = $(COMMON_TESTS)
 if HAVE_FC
-NONINTERACTIVE_TESTS += $(FC_TESTS)
+TESTS += $(FC_TESTS)
 endif
-TESTS = $(NONINTERACTIVE_TESTS) $(INTERACTIVE_TESTS)
 
 defs           = tests/defs
 defs_in                = $(tests_dir)/defs.in
 
 EXTRA_DIST     += $(defs_in) $(defs_m4sh) \
-                 $(COMMON_TESTS) $(F77_TESTS) $(FC_TESTS) \
-                 $(INTERACTIVE_TESTS)
+                 $(COMMON_TESTS) $(FC_TESTS)
 DIST_SUBDIRS   += $(CONF_SUBDIRS)
 
 # The defs script shouldn't be recreated whenever the Makefile is
diff --git a/configure.ac b/configure.ac
index fe76f2d..a731663 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,7 +126,7 @@ AC_SUBST([pkgaux_scripts])
 
 # All subdirectories that are configured on demand, but that must be
 # included in the distribution.
-CONF_SUBDIRS="tests/f77demo tests/fcdemo"
+CONF_SUBDIRS="tests/fcdemo"
 AC_SUBST([CONF_SUBDIRS])
 
 DIST_MAKEFILE_LIST=
diff --git a/tests/f77demo-conf.test b/tests/f77demo-conf.test
deleted file mode 100755
index feb3a85..0000000
--- a/tests/f77demo-conf.test
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# f77demo-conf.test - try configuring the f77demo subdirectory
-#
-#   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2003
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-####
-
-. tests/defs || exit 1
-
-func_mkprefixdir
-func_cd "tests/f77demo"
-func_make_distclean
-func_configure
-func_check_static_shared "yes" "yes"
-
-exit 0
diff --git a/tests/f77demo-exec.test b/tests/f77demo-exec.test
deleted file mode 100755
index 40539fd..0000000
--- a/tests/f77demo-exec.test
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/sh
-# f77demo-exec.test - check that programs in the f77demo subdirectory are 
viable
-#
-#   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2003
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-####
-
-. tests/defs || exit 1
-
-func_require "f77demo-make" "tests/f77demo/fprogram$EXEEXT" 
"tests/f77demo/cprogram$EXEEXT"
-
-func_rmprefixdir
-func_exec_init "uninstalled"
-func_exec "tests/f77demo/fprogram$EXEEXT"
-func_exec "tests/f77demo/cprogram$EXEEXT"
-
-exit $exec_status
diff --git a/tests/f77demo-make.test b/tests/f77demo-make.test
deleted file mode 100755
index 19a153d..0000000
--- a/tests/f77demo-make.test
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# f77demo-make.test - try building in the f77demo subdirectory
-#
-#   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2003
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-####
-
-. tests/defs || exit 1
-
-func_require "f77demo-conf" "tests/f77demo/Makefile"
-
-func_rmprefixdir
-func_cd "tests/f77demo"
-# May fail make on some platforms, simply "skip" in that case
-#func_make
-eval $MAKE || func_skip "The improved fortran tests catch a known failure mode"
-
-exit 0
diff --git a/tests/f77demo-shared-exec.test b/tests/f77demo-shared-exec.test
deleted file mode 100755
index b9fdb03..0000000
--- a/tests/f77demo-shared-exec.test
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-. tests/defs || exit 1
-. $abs_srcdir/tests/f77demo-exec.test
diff --git a/tests/f77demo-shared-make.test b/tests/f77demo-shared-make.test
deleted file mode 100755
index bee5491..0000000
--- a/tests/f77demo-shared-make.test
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-. tests/defs || exit 1
-. $abs_srcdir/tests/f77demo-make.test
diff --git a/tests/f77demo-shared.test b/tests/f77demo-shared.test
deleted file mode 100755
index 26cca0b..0000000
--- a/tests/f77demo-shared.test
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# f77demo-shared.test - try configuring the f77demo subdirectory for shared 
libs
-#
-#   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2003
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-####
-
-. tests/defs || exit 1
-
-func_mkprefixdir
-func_cd "tests/f77demo"
-func_make_distclean
-func_configure "--disable-static"
-func_check_static_shared "no" "yes"
-
-exit 0
diff --git a/tests/f77demo-static-exec.test b/tests/f77demo-static-exec.test
deleted file mode 100755
index b9fdb03..0000000
--- a/tests/f77demo-static-exec.test
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-. tests/defs || exit 1
-. $abs_srcdir/tests/f77demo-exec.test
diff --git a/tests/f77demo-static-make.test b/tests/f77demo-static-make.test
deleted file mode 100755
index bee5491..0000000
--- a/tests/f77demo-static-make.test
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-. tests/defs || exit 1
-. $abs_srcdir/tests/f77demo-make.test
diff --git a/tests/f77demo-static.test b/tests/f77demo-static.test
deleted file mode 100755
index 395b63d..0000000
--- a/tests/f77demo-static.test
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# f77demo-static.test - try configuring the f77demo subdirectory for static 
libs
-#
-#   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2003
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-####
-
-. tests/defs || exit 1
-
-func_mkprefixdir
-func_cd "tests/f77demo"
-func_make_distclean
-func_configure "--disable-shared"
-func_check_static_shared "yes" "no"
-
-exit 0
diff --git a/tests/f77demo.at b/tests/f77demo.at
new file mode 100644
index 0000000..c8178ce
--- /dev/null
+++ b/tests/f77demo.at
@@ -0,0 +1,332 @@
+# cdemo.at -- Using Automake to build a program and library -*- Autotest -*-
+#
+#   Copyright (C) 2003, 2005, 2006, 2011 Free Software Foundation, Inc.
+#   Written by Eric Lindahl, 2002
+#   Written by Gary V. Vaughan, 2003
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+
+AT_BANNER([F77 language support.])
+
+
+# _LT_SETUP
+# ---------
+m4_define([_LT_SETUP],
+[LT_AT_TAG([F77])
+AT_KEYWORDS([libtool])
+
+AT_DATA([configure.ac],
+[[AC_INIT([f77demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_HEADERS([config.h:config-h.in])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+
+AC_PROG_F77
+dnl When configuring for `make dist' purposes, skip checks that may yield fatal
+dnl errors when there is no working F77 compiler.
+if test -z "$with_dist"; then
+  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
+fi
+LT_INIT
+AC_SUBST([LIBTOOL_DEPS])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.am],
+[[AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS = -I m4
+
+lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la
+
+libfoo_la_SOURCES = foof.f
+libfoo_la_LDFLAGS = -no-undefined
+libfoo_la_LIBADD = libfoo2.la
+
+libfoo2_la_SOURCES = foof2.f
+libfoo2_la_LDFLAGS = -no-undefined
+
+libfoo3_la_SOURCES = foof3.f
+libfoo3_la_LDFLAGS = -no-undefined
+
+libmix_la_SOURCES = foof.f foof2.f fooc.c
+libmix_la_LDFLAGS = -no-undefined
+
+noinst_HEADERS = foo.h
+
+bin_PROGRAMS = fprogram cprogram
+
+fprogram_SOURCES = fprogram.f
+fprogram_LDADD = libfoo.la libfoo3.la
+
+cprogram_SOURCES = cprogram.c
+cprogram_LDADD = libmix.la $(FLIBS)
+
+libtool: $(LIBTOOL_DEPS)
+       $(SHELL) ./config.status --recheck
+]])
+
+AT_DATA([fprogram.f],
+[[      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
+
+      call fsub3(arg,res)
+
+      write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res
+
+      if (res.eq.8) then
+         write(*,*) 'fsub3 is ok!'
+      endif
+
+      stop
+      end
+]])
+
+AT_DATA([cprogram.c],
+[[#include "foo.h"
+#include <stdio.h>
+
+int
+main ()
+{
+  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;
+}
+]])
+
+AT_DATA([foo.h],
+[[#ifndef _FOO_H_
+#define _FOO_H_ 1
+
+/* config.h is necessary for the fortran name mangling */
+#include <config.h>
+
+/* 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
+#ifdef __cplusplus
+"C"
+#endif
+void F77_FUNC(fsub,FSUB)(int *arg, int *res);
+
+#endif
+]])
+
+AT_DATA([fooc.c],
+[[#include "foo.h"
+#include <stdio.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;
+}
+]])
+
+AT_DATA([foof.f],
+[[      subroutine fsub(arg,res)
+      write(*,*) 'fsub called'
+      call fsubf(arg,res)
+      return
+      end
+]])
+
+AT_DATA([foof2.f],
+[[      subroutine fsubf(arg,res)
+      implicit none
+      integer*4 arg,res
+      write(*,*) 'fsubf called'
+      res=arg*2
+      return
+      end
+]])
+
+AT_DATA([foof3.f],
+[[      subroutine fsub3(arg,res)
+      implicit none
+      integer*4 arg,res
+      write(*,*) 'fsub3 called'
+      res=arg*4
+      return
+      end
+]])
+]) # _LT_SETUP
+
+
+# _LT_CHECK_CONFIG (CONFIGURE-ARGS, [GREP-EXPRESSION], ...)
+# ---------------------------------------------------------
+# Bootstrap and configure the project, and check each GREP-EXPRESSION
+# works on the resulting libtool script.
+m4_define([_LT_CHECK_CONFIG],
+[LT_AT_BOOTSTRAP([], [-I m4], [], [--add-missing], [], [$1], [ignore])
+m4_if([$#], 0, [],
+      [$#], 1, [], [$0_(m4_shift($@))])
+])
+m4_define([_LT_CHECK_CONFIG_],
+[AT_CHECK([$EGREP '$1' libtool], 0, [ignore])
+ m4_if([$#], 1, [], [$0(m4_shift($@))])
+])
+
+
+# _LT_CHECK_EXECUTE([TARGETS])
+# ----------------------------
+# Run the listed make rules, and check that the built binaries work.
+m4_define([_LT_CHECK_EXECUTE],
+[LT_AT_MAKE([$1])
+
+AT_DATA([expout],
+[[ Welcome to GNU libtool Fortran demo!
+ Real programmers write in FORTRAN.
+ fsub called
+ fsubf called
+ fsub returned, saying that 2 *           2  =           4
+ fsub is ok!
+ fsub3 called
+ fsub3 returned, saying that 4 *           2  =           8
+ fsub3 is ok!
+]])
+LT_AT_EXEC_CHECK([./fprogram], 0, [expout])
+
+AT_DATA([expout],
+[[Welcome to GNU libtool mixed C/Fortran demo!
+The C subroutine returned, claiming that 2*2 = 4
+The C subroutine is ok!
+
+Calling the C wrapper routine...
+Calling the Fortran 77 subroutine from the C wrapper...
+ fsub called
+ fsubf called
+Returned from the Fortran 77 subroutine...
+The C wrapper to the fortran subroutine returned,
+claiming that 2*2 = 4
+The Fortran 77 subroutine is ok!
+]])
+LT_AT_EXEC_CHECK([./cprogram], 0, [expout])
+])
+
+
+## --------------- ##
+## F77demo static. ##
+## --------------- ##
+
+AT_SETUP([static library])
+
+# Executing the static fprogram might be interactive on MSYS.
+AT_KEYWORDS([interactive])
+
+_LT_SETUP
+
+_LT_CHECK_CONFIG([--disable-shared],
+                 [^build_old_libs=yes], [^build_libtool_libs=no])
+_LT_CHECK_EXECUTE
+
+AT_CLEANUP
+
+
+## --------------- ##
+## F77demo shared. ##
+## --------------- ##
+
+AT_SETUP([shared library])
+
+_LT_SETUP
+
+_LT_CHECK_CONFIG([--disable-static],
+                 [^build_old_libs=no], [^build_libtool_libs=yes])
+_LT_CHECK_EXECUTE
+
+AT_CLEANUP
+
+
+## ------------- ##
+## F77demo conf. ##
+## ------------- ##
+
+AT_SETUP([shared and static together])
+
+_LT_SETUP
+
+_LT_CHECK_CONFIG([],
+                 [^build_old_libs=yes], [^build_libtool_libs=yes])
+_LT_CHECK_EXECUTE
+
+AT_CLEANUP
diff --git a/tests/f77demo/.gitignore b/tests/f77demo/.gitignore
deleted file mode 100644
index 05d41fa..0000000
--- a/tests/f77demo/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/cprogram
-/fprogram
diff --git a/tests/f77demo/Makefile.am b/tests/f77demo/Makefile.am
deleted file mode 100644
index 83e5db6..0000000
--- a/tests/f77demo/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-## Makefile.am -- Process this file with automake to produce Makefile.in
-##
-##   Copyright (C) 2003, 2004, 2005 Free Software Foundation
-##   Written by Gary V. Vaughan, 2003
-##
-##   This file is part of GNU Libtool.
-##
-## GNU Libtool 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.
-##
-## GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-## can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-## or obtained by writing to the Free Software Foundation, Inc.,
-## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#####
-
-AUTOMAKE_OPTIONS = no-dependencies foreign
-ACLOCAL_AMFLAGS  = -I ../../m4
-AM_CPPFLAGS     = -I$(top_srcdir)/../..
-
-lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la
-
-libfoo_la_SOURCES = foof.f
-libfoo_la_LDFLAGS = -no-undefined
-libfoo_la_LIBADD = libfoo2.la
-
-libfoo2_la_SOURCES = foof2.f
-libfoo2_la_LDFLAGS = -no-undefined
-
-libfoo3_la_SOURCES = foof3.f
-libfoo3_la_LDFLAGS = -no-undefined
-
-libmix_la_SOURCES = foof.f foof2.f fooc.c
-libmix_la_LDFLAGS = -no-undefined
-
-noinst_HEADERS = foo.h
-
-bin_PROGRAMS = fprogram cprogram
-
-fprogram_SOURCES = fprogram.f
-fprogram_LDADD = libfoo.la libfoo3.la
-
-cprogram_SOURCES = cprogram.c
-cprogram_LDADD = libmix.la $(FLIBS)
-
-libtool: $(LIBTOOL_DEPS)
-       $(SHELL) ./config.status --recheck
-
-# Workaround a bug in Autoconf-2.61 and earlier that don't clean up
-# file droppings left by many compilers:
-distclean-local:
-       ac_files="a.out.* a.exe.* a_out.exe.* b.out.* conftest.*"; \
-       for ac_file in $$ac_files; do \
-         case $$ac_file in \
-           *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | 
*.inf | *.dSYM ) rm -rf $$ac_file ;; \
-         esac; \
-       done
diff --git a/tests/f77demo/README b/tests/f77demo/README
deleted file mode 100644
index e23e69b..0000000
--- a/tests/f77demo/README
+++ /dev/null
@@ -1,12 +0,0 @@
-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/tests/f77demo/configure.ac b/tests/f77demo/configure.ac
deleted file mode 100644
index 9ff3858..0000000
--- a/tests/f77demo/configure.ac
+++ /dev/null
@@ -1,71 +0,0 @@
-# Process this file with autoconf to create configure. -*- autoconf -*-
-#
-#   Copyright (C) 2001, 2003, 2005, 2007 Free Software Foundation, Inc.
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-####
-
-AC_PREREQ(2.54)
-
-## ------------------------ ##
-## Autoconf initialisation. ##
-## ------------------------ ##
-AC_INIT([f77demo], [1.0], address@hidden)
-AC_CONFIG_HEADERS([config.h:config-h.in])
-AC_CONFIG_SRCDIR([foof.f])
-AC_CONFIG_AUX_DIR([../../build-aux])
-
-AC_ARG_WITH([dist], AS_HELP_STRING([--with-dist],
-                                  [ignore errors not affecting `make dist']))
-
-## ------------------------ ##
-## Automake Initialisation. ##
-## ------------------------ ##
-AM_INIT_AUTOMAKE
-
-
-## ------------------ ##
-## C compiler checks. ##
-## ------------------ ##
-AC_PROG_CC
-
-## ------------------------ ##
-## Fortran compiler checks. ##
-## ------------------------ ##
-AC_PROG_F77
-dnl When configuring for `make dist' purposes, skip checks that may yield fatal
-dnl errors when there is no working F77 compiler.
-if test -z "$with_dist"; then
-  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
-fi
-
-## ----------------------- ##
-## Libtool initialisation. ##
-## ----------------------- ##
-LT_INIT
-AC_SUBST([LIBTOOL_DEPS])
-
-## -------- ##
-## Outputs. ##
-## -------- ##
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
diff --git a/tests/f77demo/cprogram.c b/tests/f77demo/cprogram.c
deleted file mode 100644
index 1089e8c..0000000
--- a/tests/f77demo/cprogram.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* cprogram.c
-
-   Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
-
-   This file is part of GNU Libtool.
-
-GNU Libtool 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.
-
-GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-or obtained by writing to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#include "foo.h"
-#include <stdio.h>
-
-int
-main ()
-{
-  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/tests/f77demo/foo.h b/tests/f77demo/foo.h
deleted file mode 100644
index 88934fc..0000000
--- a/tests/f77demo/foo.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* foo.h -- interface to fortran and C libraries
-
-   Copyright (C) 1998-1999, 2006 Free Software Foundation, Inc.
-   Written by Eric Lindahl, 2002
-
-   This file is part of GNU Libtool.
-
-GNU Libtool 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.
-
-GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-or obtained by writing to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#ifndef _FOO_H_
-#define _FOO_H_ 1
-
-/* config.h is necessary for the fortran name mangling */
-#include <config.h>
-
-/* 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
-#ifdef __cplusplus
-"C"
-#endif
-void F77_FUNC(fsub,FSUB)(int *arg, int *res);
-
-#endif
diff --git a/tests/f77demo/fooc.c b/tests/f77demo/fooc.c
deleted file mode 100644
index 3dca0ed..0000000
--- a/tests/f77demo/fooc.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* fooc.c
-
-   Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
-   Written by Eric Lindahl, 2002
-
-   This file is part of GNU Libtool.
-
-GNU Libtool 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.
-
-GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
-can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-or obtained by writing to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#include "foo.h"
-#include <stdio.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/tests/f77demo/foof.f b/tests/f77demo/foof.f
deleted file mode 100644
index 6f6c6f6..0000000
--- a/tests/f77demo/foof.f
+++ /dev/null
@@ -1,10 +0,0 @@
-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.
-
-      subroutine fsub(arg,res)
-      write(*,*) 'fsub called'
-      call fsubf(arg,res)
-      return
-      end
diff --git a/tests/f77demo/foof2.f b/tests/f77demo/foof2.f
deleted file mode 100644
index f7e2fe4..0000000
--- a/tests/f77demo/foof2.f
+++ /dev/null
@@ -1,12 +0,0 @@
-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.
-
-      subroutine fsubf(arg,res)
-      implicit none
-      integer*4 arg,res
-      write(*,*) 'fsubf called'
-      res=arg*2
-      return
-      end
diff --git a/tests/f77demo/foof3.f b/tests/f77demo/foof3.f
deleted file mode 100644
index 8b7307f..0000000
--- a/tests/f77demo/foof3.f
+++ /dev/null
@@ -1,12 +0,0 @@
-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.
-
-      subroutine fsub3(arg,res)
-      implicit none
-      integer*4 arg,res
-      write(*,*) 'fsub3 called'
-      res=arg*4
-      return
-      end
diff --git a/tests/f77demo/fprogram.f b/tests/f77demo/fprogram.f
deleted file mode 100644
index 6fcdb75..0000000
--- a/tests/f77demo/fprogram.f
+++ /dev/null
@@ -1,31 +0,0 @@
-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.
-
-      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
-
-      call fsub3(arg,res)
-
-      write(*,*) 'fsub3 returned, saying that 4 *',arg,' =',res
-
-      if (res.eq.8) then
-         write(*,*) 'fsub3 is ok!'
-      endif
-
-      stop
-      end
-- 
1.7.7.4

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]