tests: migrate legacy tests/f77demo tests to Autotest.

* 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 <gary@gnu.org>
This commit is contained in:
Gary V. Vaughan 2011-11-24 17:51:08 +07:00
parent 233829c0b5
commit a801a23e63
23 changed files with 346 additions and 583 deletions

View File

@ -690,6 +690,7 @@ TESTSUITE_AT = tests/testsuite.at \
tests/stresstest.at \ tests/stresstest.at \
tests/cmdline_wrap.at \ tests/cmdline_wrap.at \
tests/pic_flag.at \ tests/pic_flag.at \
tests/f77demo.at \
tests/darwin.at \ tests/darwin.at \
tests/dumpbin-symbols.at \ tests/dumpbin-symbols.at \
tests/deplibs-mingw.at \ tests/deplibs-mingw.at \
@ -764,9 +765,7 @@ installcheck-local: $(testsuite_deps)
AUTOTEST_PATH='$(exec_prefix)/bin' AUTOTEST_PATH='$(exec_prefix)/bin'
check-noninteractive-old: check-noninteractive-old:
$(AM_V_at)'$(MAKE)' $(AM_MAKEFLAGS) check-TESTS TESTS='$(NONINTERACTIVE_TESTS)' $(AM_V_at)'$(MAKE)' $(AM_MAKEFLAGS) check-TESTS TESTS='$(TESTS)'
check-interactive-old:
$(AM_V_at)'$(MAKE)' $(AM_MAKEFLAGS) check-TESTS TESTS='$(INTERACTIVE_TESTS)'
# Run only noninteractive parts of the new testsuite. # Run only noninteractive parts of the new testsuite.
check-noninteractive-new: $(testsuite_deps_uninstalled) check-noninteractive-new: $(testsuite_deps_uninstalled)
@ -777,14 +776,13 @@ check-noninteractive-new: $(testsuite_deps_uninstalled)
$(TESTSUITEFLAGS) $(TESTSUITEFLAGS)
# Run only interactive parts of the new testsuite. # Run only interactive parts of the new testsuite.
check-interactive-new: $(testsuite_deps_uninstalled) check-interactive: $(testsuite_deps_uninstalled)
$(AM_V_at)$(CD_TESTDIR); \ $(AM_V_at)$(CD_TESTDIR); \
CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \ CONFIG_SHELL='$(SHELL)' '$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" \
$(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) \ $(TESTS_ENVIRONMENT) $(BUILDCHECK_ENVIRONMENT) \
-k interactive -k recursive INNER_TESTSUITEFLAGS=',interactive' \ -k interactive -k recursive INNER_TESTSUITEFLAGS=',interactive' \
$(TESTSUITEFLAGS) $(TESTSUITEFLAGS)
check-interactive: check-interactive-old check-interactive-new
check-noninteractive: check-noninteractive-old check-noninteractive-new check-noninteractive: check-noninteractive-old check-noninteractive-new
# We need to remove any file droppings left behind by testsuite # We need to remove any file droppings left behind by testsuite
@ -803,26 +801,6 @@ clean-local: clean-local-legacy
# using the new framework above. When the migration is # using the new framework above. When the migration is
# complete this section should be removed. # 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 = \ FC_TESTS = \
tests/fcdemo-static.test \ tests/fcdemo-static.test \
tests/fcdemo-static-make.test \ tests/fcdemo-static-make.test \
@ -852,23 +830,16 @@ COMMON_TESTS = \
tests/suffix.test \ tests/suffix.test \
tests/tagtrace.test tests/tagtrace.test
INTERACTIVE_TESTS = TESTS = $(COMMON_TESTS)
NONINTERACTIVE_TESTS = $(COMMON_TESTS)
if HAVE_F77
# f77demo-static-exec.test might be interactive on MSYS.
INTERACTIVE_TESTS += $(F77_TESTS)
endif
if HAVE_FC if HAVE_FC
NONINTERACTIVE_TESTS += $(FC_TESTS) TESTS += $(FC_TESTS)
endif endif
TESTS = $(NONINTERACTIVE_TESTS) $(INTERACTIVE_TESTS)
defs = tests/defs defs = tests/defs
defs_in = $(tests_dir)/defs.in defs_in = $(tests_dir)/defs.in
EXTRA_DIST += $(defs_in) $(defs_m4sh) \ EXTRA_DIST += $(defs_in) $(defs_m4sh) \
$(COMMON_TESTS) $(F77_TESTS) $(FC_TESTS) \ $(COMMON_TESTS) $(FC_TESTS)
$(INTERACTIVE_TESTS)
DIST_SUBDIRS += $(CONF_SUBDIRS) DIST_SUBDIRS += $(CONF_SUBDIRS)
# The defs script shouldn't be recreated whenever the Makefile is # The defs script shouldn't be recreated whenever the Makefile is

View File

@ -126,7 +126,7 @@ AC_SUBST([pkgaux_scripts])
# All subdirectories that are configured on demand, but that must be # All subdirectories that are configured on demand, but that must be
# included in the distribution. # included in the distribution.
CONF_SUBDIRS="tests/f77demo tests/fcdemo" CONF_SUBDIRS="tests/fcdemo"
AC_SUBST([CONF_SUBDIRS]) AC_SUBST([CONF_SUBDIRS])
DIST_MAKEFILE_LIST= DIST_MAKEFILE_LIST=

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,3 +0,0 @@
#! /bin/sh
. tests/defs || exit 1
. $abs_srcdir/tests/f77demo-exec.test

View File

@ -1,3 +0,0 @@
#! /bin/sh
. tests/defs || exit 1
. $abs_srcdir/tests/f77demo-make.test

View File

@ -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

View File

@ -1,3 +0,0 @@
#! /bin/sh
. tests/defs || exit 1
. $abs_srcdir/tests/f77demo-exec.test

View File

@ -1,3 +0,0 @@
#! /bin/sh
. tests/defs || exit 1
. $abs_srcdir/tests/f77demo-make.test

View File

@ -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

339
tests/f77demo.at Normal file
View File

@ -0,0 +1,339 @@
# f77demo.at -- Fortran 77 language support. -*- 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_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_CONFIG_HEADERS([config.h:config.in.h])
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 <config.h>
#include <stdio.h>
#include "foo.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 <config.h>
#include <stdio.h>
#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;
}
]])
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_AT_AUTOHEADER
]) # _LT_SETUP
# _LT_CHECK_EXECUTE
# -----------------
# Run the default make rule, and check that the built binaries work.
m4_define([_LT_CHECK_EXECUTE],
[LT_AT_MAKE
# Oddly, the output of dynamically linked fprogram differs depending
# on whether it is redirected to a file or sent to stdout, so we
# just check return status, and ignore output.
# Advice on this weirdness from a Fortran user much appreciated!
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, [ignore])
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_AT_CHECK_CONFIG([--disable-shared],
[^build_old_libs=yes], [^build_libtool_libs=no])
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_CHECK_EXECUTE
AT_CLEANUP
## --------------- ##
## F77demo shared. ##
## --------------- ##
AT_SETUP([shared library])
_LT_SETUP
LT_AT_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_AT_CHECK_CONFIG([],
[^build_old_libs=yes], [^build_libtool_libs=yes])
_LT_CHECK_EXECUTE
AT_CLEANUP

View File

@ -1,2 +0,0 @@
/cprogram
/fprogram

View File

@ -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

View File

@ -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.

View File

@ -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], [bug-libtool@gnu.org])
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

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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