tests: migrate legacy tests/fcdemo tests to Autotest.

Along with the demise of the last demo directory, so all the
cruft for re-autotooling and distributing the additional
directories is no longer necessary.
* tests/fcdemo.at: New autotest groups, based on...
* tests/fcdemo-conf.test, tests/fcdemo-exec.test,
tests/fcdemo-make.test, tests/fcdemo-shared-exec.test,
tests/fcdemo-shared-make.test, tests/fcdemo-shared.test,
tests/fcdemo-static-exec.test, tests/fcdemo-static-make.test,
tests/fcdemo-static.test: ...these legacy tests, now removed.
* tests/fcdemo/Makefile.am, tests/fcdemo/README,
tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c,
tests/fcdemo/foo.h, tests/fcdemo/fooc.c, tests/fcdemo/foof.f90,
tests/fcdemo/foof2.f90, tests/fcdemo/foof3.f90,
tests/fcdemo/fprogram.f90: Remove.
* configure.ac (CONF_SUBDIRS, DIST_MAKEFILE_LIST): Remove.
* Makefile.am (DIST_SUBDIRS, FC_TESTS, clean-local-legacy)
(configure-subdirs, distclean-recursive, distdir)
(fake-distclean-legacy, $(DIST_MAKEFILE_LIST)): Remove.
(COMMON_TESTS): Rename from this...
(TESTS): ...to this.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
This commit is contained in:
Gary V. Vaughan 2011-11-24 18:26:17 +07:00
parent a801a23e63
commit 215149492c
24 changed files with 345 additions and 662 deletions

1
.gitignore vendored
View File

@ -48,7 +48,6 @@
Makefile
Makefile.in
\#*#
_inst-*demo
_libs
acinclude.m4
aclocal.m4

View File

@ -317,14 +317,6 @@ libtool: $(ltmain_sh) $(config_status) $(dotversion)
cd '$(top_builddir)' && '$(SHELL)' ./config.status '$@'; \
fi
.PHONY: configure-subdirs
configure-subdirs distdir: $(DIST_MAKEFILE_LIST)
$(DIST_MAKEFILE_LIST):
$(AM_V_at)dir=`echo '$@' |'$(SED)' 's|^[^/]*$$|.|;s|/[^/]*$$||'`; \
test -d "$$dir" || mkdir "$$dir" || exit 1; \
abs_srcdir=`$(lt__cd) '$(srcdir)' && pwd`; \
(cd "$$dir" && "$$abs_srcdir/$$dir/configure" --with-dist) || exit 1
## -------- ##
## Libltdl. ##
@ -691,6 +683,7 @@ TESTSUITE_AT = tests/testsuite.at \
tests/cmdline_wrap.at \
tests/pic_flag.at \
tests/f77demo.at \
tests/fcdemo.at \
tests/darwin.at \
tests/dumpbin-symbols.at \
tests/deplibs-mingw.at \
@ -786,7 +779,7 @@ check-interactive: $(testsuite_deps_uninstalled)
check-noninteractive: check-noninteractive-old check-noninteractive-new
# We need to remove any file droppings left behind by testsuite
clean-local: clean-local-legacy
clean-local:
-$(CD_TESTDIR); \
test -f "$$abs_srcdir/$(TESTSUITE)" && \
'$(SHELL)' "$$abs_srcdir/$(TESTSUITE)" --clean
@ -801,27 +794,7 @@ clean-local: clean-local-legacy
# using the new framework above. When the migration is
# complete this section should be removed.
FC_TESTS = \
tests/fcdemo-static.test \
tests/fcdemo-static-make.test \
tests/fcdemo-static-exec.test \
tests/fcdemo-conf.test \
tests/fcdemo-make.test \
tests/fcdemo-exec.test \
tests/fcdemo-shared.test \
tests/fcdemo-shared-make.test \
tests/fcdemo-shared-exec.test
tests/fcdemo-shared-exec.log: tests/fcdemo-shared-make.log
tests/fcdemo-shared-make.log: tests/fcdemo-shared.log
tests/fcdemo-shared.log: tests/fcdemo-exec.log
tests/fcdemo-exec.log: tests/fcdemo-make.log
tests/fcdemo-make.log: tests/fcdemo-conf.log
tests/fcdemo-conf.log: tests/fcdemo-static-exec.log
tests/fcdemo-static-exec.log: tests/fcdemo-static-make.log
tests/fcdemo-static-make.log: tests/fcdemo-static.log
COMMON_TESTS = \
TESTS = \
tests/link.test \
tests/link-2.test \
tests/nomode.test \
@ -830,17 +803,11 @@ COMMON_TESTS = \
tests/suffix.test \
tests/tagtrace.test
TESTS = $(COMMON_TESTS)
if HAVE_FC
TESTS += $(FC_TESTS)
endif
defs = tests/defs
defs_in = $(tests_dir)/defs.in
EXTRA_DIST += $(defs_in) $(defs_m4sh) \
$(COMMON_TESTS) $(FC_TESTS)
DIST_SUBDIRS += $(CONF_SUBDIRS)
$(TESTS)
# The defs script shouldn't be recreated whenever the Makefile is
# regenerated since the source tree can be read-only.
@ -853,29 +820,6 @@ $(defs_in): $(defs_m4sh) $(general_m4sh) Makefile.am
$(AM_V_at)rm -f '$@'
$(AM_V_GEN)$(LT_M4SH) '$(defs_m4sh)' > '$@'
# We need to remove any files that the above tests created.
clean-local-legacy:
-for dir in $(CONF_SUBDIRS); do \
if test -f "$$dir/Makefile"; then \
(cd "$$dir" && '$(MAKE)' $(AM_MAKEFLAGS) distclean); \
else :; fi; \
done
rm -rf _inst _inst-*
# For distclean, we may have to fake Makefiles in the test directories
# so that descending in DIST_SUBDIRS works.
# Hide the additional dependency from automake so it still outputs the rule.
distclean_recursive = distclean-recursive
$(distclean_recursive): fake-distclean-legacy
.PHONY: fake-distclean-legacy
fake-distclean-legacy:
-for dir in $(CONF_SUBDIRS); do \
if test ! -f "$$dir/Makefile"; then \
$(mkinstalldirs) "$$dir"; \
echo 'distclean: ; rm -f Makefile' > "$$dir/Makefile"; \
else :; fi; \
done
$(TESTS): $(defs)
DISTCLEANFILES += $(defs)

View File

@ -124,17 +124,6 @@ fi
pkgaux_scripts="compile config.guess config.sub depcomp install-sh missing"
AC_SUBST([pkgaux_scripts])
# All subdirectories that are configured on demand, but that must be
# included in the distribution.
CONF_SUBDIRS="tests/fcdemo"
AC_SUBST([CONF_SUBDIRS])
DIST_MAKEFILE_LIST=
for dir in $CONF_SUBDIRS; do
DIST_MAKEFILE_LIST="$DIST_MAKEFILE_LIST$dir/Makefile "
done
AC_SUBST([DIST_MAKEFILE_LIST])
## ---------------- ##
## compiler checks. ##

View File

@ -1,42 +0,0 @@
#! /bin/sh
# fcdemo-conf.test - try configuring the fcdemo subdirectory
#
# Copyright (C) 2003, 2004, 2005 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/fcdemo"
func_make_distclean
# We do not want to fail if all we got was a Fortran 77 compiler.
func_configure_nofail
if test "$conf_status" -eq "$EXIT_FAILURE"; then
case `echo $FC | $SED "$basename"` in
g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
*) exit $EXIT_FAILURE
esac
fi
func_check_static_shared "yes" "yes"
exit 0

View File

@ -1,35 +0,0 @@
#! /bin/sh
# fcdemo-exec.test - check that programs in the fcdemo subdirectory are viable
#
# Copyright (C) 2003, 2004, 2005 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 "fcdemo-make" "tests/fcdemo/fprogram$EXEEXT" "tests/fcdemo/cprogram$EXEEXT"
func_rmprefixdir
func_exec_init "uninstalled"
func_exec "tests/fcdemo/fprogram$EXEEXT"
func_exec "tests/fcdemo/cprogram$EXEEXT"
exit $exec_status

View File

@ -1,36 +0,0 @@
#! /bin/sh
# fcdemo-make.test - try building in the fcdemo subdirectory
#
# Copyright (C) 2003, 2004, 2005 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 "fcdemo-conf" "tests/fcdemo/Makefile"
func_rmprefixdir
func_cd "tests/fcdemo"
# 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/fcdemo-exec.test

View File

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

View File

@ -1,42 +0,0 @@
#! /bin/sh
# fcdemo-shared.test - try configuring the fcdemo subdirectory for shared libs
#
# Copyright (C) 2003, 2004, 2005 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/fcdemo"
func_make_distclean
# We do not want to fail if all we got was a Fortran 77 compiler.
func_configure_nofail "--disable-static"
if test "$conf_status" -eq "$EXIT_FAILURE"; then
case `echo $FC | $SED "$basename"` in
g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
*) exit $EXIT_FAILURE
esac
fi
func_check_static_shared "no" "yes"
exit 0

View File

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

View File

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

View File

@ -1,42 +0,0 @@
#! /bin/sh
# fcdemo-static.test - try configuring the fcdemo subdirectory for static libs
#
# Copyright (C) 2003, 2004, 2005 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/fcdemo"
func_make_distclean
# We do not want to fail if all we got was a Fortran 77 compiler.
func_configure_nofail "--disable-shared"
if test "$conf_status" -eq "$EXIT_FAILURE"; then
case `echo $FC | $SED "$basename"` in
g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
*) exit $EXIT_FAILURE
esac
fi
func_check_static_shared "yes" "no"
exit 0

341
tests/fcdemo.at Normal file
View File

@ -0,0 +1,341 @@
# fcdemo.at -- Fortran 90/95 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([Fortran language support.])
# _LT_SETUP
# ---------
m4_define([_LT_SETUP],
[LT_AT_TAG([FC])
AT_KEYWORDS([libtool])
AT_DATA([configure.ac],
[[AC_INIT([fcdemo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_LANG_PUSH([Fortran])
AC_PROG_FC
dnl Check the flags needed to link fc programs with ld (i.e. cc)
AC_FC_LIBRARY_LDFLAGS
dnl Check for underscoring of external names
AC_FC_WRAPPERS
dnl We need to use .f90 and not .f to enable Automake FC support
dnl Some Intel ifc/ifort do not understand .f95. :-/
AC_FC_SRCEXT([f90])
dnl Yes, we want free-form Fortran!
AC_FC_FREEFORM
AC_LANG_POP
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.f90
libfoo_la_LDFLAGS = -no-undefined
libfoo_la_LIBADD = libfoo2.la
libfoo2_la_SOURCES = foof2.f90
libfoo2_la_LDFLAGS = -no-undefined
libfoo3_la_SOURCES = foof3.f90
libfoo3_la_LDFLAGS = -no-undefined
libmix_la_SOURCES = foof.f90 foof2.f90 fooc.c
libmix_la_LDFLAGS = -no-undefined
noinst_HEADERS = foo.h
bin_PROGRAMS = fprogram cprogram
fprogram_SOURCES = fprogram.f90
fprogram_LDADD = libfoo.la libfoo3.la
cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FCLIBS)
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
# Work around Automake bug, where FCFLAGS_f90 is not provided:
.f90.o:
$(FCCOMPILE) -c -o @S|@@ $(FCFLAGS_f90) $<
.f90.obj:
$(FCCOMPILE) -c -o @S|@@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
.f90.lo:
$(LTFCCOMPILE) -c -o @S|@@ $(FCFLAGS_f90) $<
]])
AT_DATA([fprogram.f90],
[[program fprogram
implicit none
integer 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 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 FC_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 subroutine from the C wrapper...\n");
FC_FUNC(fsub,FSUB)(&arg,&res);
printf("Returned from the Fortran subroutine...\n");
return res;
}
]])
AT_DATA([foof.f90],
[[subroutine fsub(arg,res)
write(*,*) 'fsub called'
call fsubf(arg,res)
return
end
]])
AT_DATA([foof2.f90],
[[subroutine fsubf(arg,res)
implicit none
integer arg,res
write(*,*) 'fsubf called'
res=arg*2
return
end
]])
AT_DATA([foof3.f90],
[[subroutine fsub3(arg,res)
implicit none
integer 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 subroutine from the C wrapper...
fsub called
fsubf called
Returned from the Fortran subroutine...
The C wrapper to the fortran subroutine returned,
claiming that 2*2 = 4
The Fortran subroutine is ok!
]])
LT_AT_EXEC_CHECK([./cprogram], 0, [expout])
])
## -------------- ##
## Fcdemo 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])
_LT_CHECK_EXECUTE
AT_CLEANUP
## -------------- ##
## Fcdemo 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
## ------------ ##
## Fcdemo 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,75 +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.f90
libfoo_la_LDFLAGS = -no-undefined
libfoo_la_LIBADD = libfoo2.la
libfoo2_la_SOURCES = foof2.f90
libfoo2_la_LDFLAGS = -no-undefined
libfoo3_la_SOURCES = foof3.f90
libfoo3_la_LDFLAGS = -no-undefined
libmix_la_SOURCES = foof.f90 foof2.f90 fooc.c
libmix_la_LDFLAGS = -no-undefined
noinst_HEADERS = foo.h
bin_PROGRAMS = fprogram cprogram
fprogram_SOURCES = fprogram.f90
fprogram_LDADD = libfoo.la libfoo3.la
cprogram_SOURCES = cprogram.c
cprogram_LDADD = libmix.la $(FCLIBS)
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
# work around Automake bug not providing FCFLAGS_f90:
.f90.o:
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
.f90.obj:
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
.f90.lo:
$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
# 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 FC tag and quite obvious Fortran.

View File

@ -1,78 +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([fcdemo], [1.0], [bug-libtool@gnu.org])
AC_CONFIG_HEADERS([config.h:config-h.in])
AC_CONFIG_SRCDIR([foof.f90])
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_LANG_PUSH([Fortran])
AC_PROG_FC
dnl When configuring for `make dist' purposes, skip checks that may yield fatal
dnl errors when there is no working F90 compiler.
if test -z "$with_dist"; then
dnl Check the flags needed to link fc programs with ld (i.e. cc)
AC_FC_LIBRARY_LDFLAGS
dnl Check for underscoring of external names
AC_FC_WRAPPERS
dnl We need to use .f90 and not .f to enable Automake FC support
dnl Some Intel ifc/ifort do not understand .f95. :-/
AC_FC_SRCEXT([f90])
dnl Yes, we want free form Fortran!
AC_FC_FREEFORM
fi
AC_LANG_POP
## ----------------------- ##
## Libtool initialisation. ##
## ----------------------- ##
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
## -------- ##
## Outputs. ##
## -------- ##
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -1,54 +0,0 @@
/* cprogram.c
Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
Written by Ralf Wildenhues, 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
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 subroutine is ok!\n");
return 0;
}

View File

@ -1,54 +0,0 @@
/* foo.h -- interface to fortran and C libraries
Copyright (C) 1998-1999, 2005 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 FC_FUNC(fsub,FSUB)(int *arg, int *res);
#endif

View File

@ -1,41 +0,0 @@
/* fooc.c
Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ralf Wildenhues, 2005
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 subroutine from the C wrapper...\n");
FC_FUNC(fsub,FSUB)(&arg,&res);
printf("Returned from the Fortran subroutine...\n");
return res;
}

View File

@ -1,10 +0,0 @@
! 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.
subroutine fsub(arg,res)
write(*,*) 'fsub called'
call fsubf(arg,res)
return
end

View File

@ -1,12 +0,0 @@
! 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.
subroutine fsubf(arg,res)
implicit none
integer arg,res
write(*,*) 'fsubf called'
res=arg*2
return
end

View File

@ -1,12 +0,0 @@
! 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.
subroutine fsub3(arg,res)
implicit none
integer arg,res
write(*,*) 'fsub3 called'
res=arg*4
return
end

View File

@ -1,31 +0,0 @@
! 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.
program fprogram
implicit none
integer 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