Commit dedc4a53 by Juergen Pfeifer Committed by Toon Moene

Make libf2c a shared library (gcc/f directory).

2001-09-29  Juergen Pfeifer  <juergen.pfeifer@gmx.net>

	Make libf2c a shared library (gcc/f directory).

	* Make-lang.in: Pass define of frtbegin.o to compilation of g77spec.c.
	* g77spec.c (lang_specific_driver): Treat linking in of frtbegin.o.

2001-09-29  Juergen Pfeifer  <juergen.pfeifer@gmx.net>
            Toon Moene  <toon@moene.indiv.nluug.nl>

	Make libf2c a shared library (libf2c directory).

	* aclocal.m4: Get definition of libtool.
	* Makefile.in: Use libtool.
	* configure.in: Use libtool.
	* configure: Regenerated.
	* libF77/Makefile.in: Use libtool; treat main program contained in
	libF77/main.c specially.
	* libF77/configure.in: Use libtool.
	* libF77/configure: Regenerated.
	* libI77/Makefile.in: Use libtool.
	* libI77/configure.in: Use libtool.
	* libI77/configure: Regenerated.
	* libU77/Makefile.in: Use libtool.
	* libU77/configure.in: Use libtool.
	* libU77/configure: Regenerated.
	* libU77/date_.c: Adapt for -fPIC compiling.
	* libU77/vxtidate_.c: Ditto.

From-SVN: r45913
parent e9449401
2001-09-29 Juergen Pfeifer <juergen.pfeifer@gmx.net>
Make libf2c a shared library.
* Make-lang.in: Pass define of frtbegin.o to compilation of g77spec.c.
* g77spec.c (lang_specific_driver): Treat linking in of frtbegin.o.
2001-09-28 Robert Anderson <rwa@alumni.princeton.edu>
* expr.c (ffeexpr_sym_rhs_dimlist_): Allow array elements
......
......@@ -73,6 +73,7 @@ g77spec.o: $(srcdir)/f/g77spec.c $(srcdir)/f/version.h $(SYSTEM_H) $(GCC_H) \
esac
if [ -f lang-f77 ]; then \
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DFORTRAN_INIT=\"$(libsubdir)/frtbegin.o\" \
$(srcdir)/f/g77spec.c $(OUTPUT_OPTION); \
else true; fi
......
......@@ -286,6 +286,9 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
2 => last two args were -l<library> -lm. */
int saw_library = 0;
/* 0 => initial/reset state
1 => FORTRAN_INIT linked in */
int use_init = 0;
/* By default, we throw on the math library if we have one. */
int need_math = (MATH_LIBRARY[0] != '\0');
......@@ -518,7 +521,14 @@ For bug reporting instructions, please see:\n\
if (saw_library == 1)
saw_library = 2; /* -l<library> -lm. */
else
append_arg (FORTRAN_LIBRARY);
{
if (0 == use_init)
{
append_arg (FORTRAN_INIT);
use_init = 1;
}
append_arg (FORTRAN_LIBRARY);
}
}
else if (strcmp (argv[i], FORTRAN_LIBRARY) == 0)
saw_library = 1; /* -l<library>. */
......@@ -542,6 +552,11 @@ For bug reporting instructions, please see:\n\
switch (saw_library)
{
case 0:
if (0 == use_init)
{
append_arg (FORTRAN_INIT);
use_init = 1;
}
append_arg (library);
case 1:
if (need_math)
......
......@@ -31,8 +31,16 @@ target_alias = @target_alias@
gcc_version = @gcc_version@
gcc_version_trigger = @gcc_version_trigger@
top_builddir = .
libdir = $(exec_prefix)/lib
libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
#
VERSION_MAJOR=0
VERSION_MINOR=5
# We'd rather had 27 here - to indicate the version at which
# a shared libf2c was created; however, libtool doesn't accept this.
VERSION_SUB=0
# Multilib support variables.
MULTISRCTOP =
......@@ -49,11 +57,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
AR = @AR@
AR_FLAGS = rc
RANLIB = @RANLIB@
LIBTOOL = @LIBTOOL@
CC = @CC@
CFLAGS = @CFLAGS@
......@@ -61,9 +65,9 @@ CFLAGS = @CFLAGS@
# Quote this way so that it can be used to set shell variables too.
FLAGS_TO_PASS= \
CC='$(CC)' \
LIBTOOL='$(LIBTOOL)' \
CFLAGS='$(CFLAGS)' \
CPPFLAGS='$(CPPFLAGS)' \
AR='$(AR)' \
RANLIB='$(RANLIB)' \
prefix='$(prefix)' \
exec_prefix='$(exec_prefix)' \
......@@ -71,7 +75,8 @@ FLAGS_TO_PASS= \
libsubdir='$(libsubdir)' \
tooldir='$(tooldir)'
LIBG2C = libg2c.a
LIBG2C_BASE = libg2c
LIBG2C = $(LIBG2C_BASE).la
SUBDIRS = libI77 libF77 libU77
......@@ -132,14 +137,20 @@ i77 f77 u77: g2c.h
# always have been created by a successful `all-unilib'.
$(LIBG2C): s-libi77 s-libf77 s-libu77 s-libe77
rm -f $(LIBG2C)
rm -f $@ ;\
set -e; \
for i in $(SUBDIRS); \
do (cd $$i && $(MAKE) $(FLAGS_TO_PASS) LIBG2C=../$(LIBG2C) archive); \
done
objs=""; for i in $(F2CEXT); do objs="$$objs libE77/L$$i.o"; done; \
$(AR) $(AR_FLAGS) $(LIBG2C) $$objs
$(RANLIB) $(LIBG2C)
rm -f objlist ;\
touch objlist ;\
for i in $(SUBDIRS) ;\
do \
(cd $$i && $(MAKE) $(FLAGS_TO_PASS) objlist) ;\
done ;\
objs="`cat objlist`" ;\
for i in $(F2CEXT); do objs="$$objs libE77/L$$i.lo"; done ;\
echo -n $$objs > objlist
$(LIBTOOL) --mode=link $(CC) -o $@ \
-version-info $(VERSION_MAJOR):$(VERSION_MINOR):$(VERSION_SUB) \
-rpath $(prefix)/lib `cat objlist` -lc -lm
i77:
cd libI77; $(MAKE) $(FLAGS_TO_PASS) all
......@@ -151,13 +162,13 @@ u77:
cd libU77; $(MAKE) $(FLAGS_TO_PASS) all
s-libe77: f2cext.c
if [ -d libE77 ]; then rm -f libE77/*.o; else mkdir libE77; fi
if [ -d libE77 ]; then rm -f libE77/*.o libE77/*.lo; else mkdir libE77; fi
for name in $(F2CEXT); \
do \
echo $${name}; \
$(CC) -c -I. -I$(srcdir) -I../../include $(CPPFLAGS) $(CFLAGS) \
-DL$${name} $(srcdir)/f2cext.c \
-o libE77/L$${name}.o; \
$(LIBTOOL) --mode=compile $(CC) -c -I. -I$(srcdir) -I../../include \
$(CPPFLAGS) $(CFLAGS) -DL$${name} $(srcdir)/f2cext.c \
-o libE77/L$${name}.o ; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
done
echo timestamp >s-libe77
......@@ -194,9 +205,12 @@ check:
cd libU77; $(MAKE) G77DIR=../../../gcc/ check
install: all
$(INSTALL_DATA) $(LIBG2C) $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n
( cd $(libsubdir)/$(MULTISUBDIR) ; $(RANLIB) $(LIBG2C).n )
mv -f $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C)
$(LIBTOOL) --mode=install $(INSTALL_DATA) $(LIBG2C) $(libsubdir)/$(MULTISUBDIR)
(cd $(libsubdir)/$(MULTISUBDIR) ; \
if [ -f $(LIBG2C_BASE).so ]; then \
mv $(LIBG2C_BASE).so* $(prefix)/lib ;\
fi)
$(INSTALL_DATA) frtbegin.o $(libsubdir)
$(INSTALL_DATA) g2c.h $(libsubdir)/include/g2c.h
@if [ -f f2c-install-ok -o -f $(srcdir)/f2c-install-ok ]; then \
echo ''; \
......@@ -208,16 +222,18 @@ install: all
echo ''; \
else true; fi
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
@-$(LIBTOOL) --mode=finish $(prefix)/lib
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(libsubdir)/$(MULTISUBDIR)/include/g2c.h $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C)
rm -f $(libsubdir)/$(MULTISUBDIR)/include/g2c.h $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C_BASE).*
rm -f $(prefix)/lib/$(LIBG2C_BASE).so*
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
mostlyclean:
rm -f $(LIBG2C)
rm -f $(LIBG2C) objlist
$(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
$(MULTICLEAN) multi-clean DO=$@
rm -fr libE77 s-libe77
......@@ -226,6 +242,7 @@ clean: mostlyclean
rm -f config.log
$(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
$(MULTICLEAN) multi-clean DO=$@
rm -rf .libs
distclean: clean
rm -f g2c.h s-libe77
......
sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring an installed
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
dnl add a definition of LIBTOOL to Makefile.in.
ifelse(,,,[AC_SUBST(LIBTOOL)
AC_DEFUN([AM_PROG_LIBTOOL])
])
......@@ -73,6 +73,7 @@ define([AC_PROG_CC_WORKS],[])
# the makefiles
AC_PROG_CC
AM_PROG_LIBTOOL
dnl These should be inherited in the recursive make, but ensure they are
dnl defined:
......
......@@ -31,15 +31,11 @@ VPATH = @srcdir@
# configuration.
DEFS = @DEFS@
LIBG2C = ../libg2c.a
F2C_H_DIR = @srcdir@/..
G2C_H_DIR = ..
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
AR = @AR@
ARFLAGS = rc
@SET_MAKE@
SHELL = /bin/sh
......@@ -52,9 +48,9 @@ ALL_CFLAGS = -I. -I$(srcdir) -I$(G2C_H_DIR) -I$(F2C_H_DIR) $(CPPFLAGS) $(DEFS) $
.SUFFIXES: .c .o
.c.o:
$(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $<
@LIBTOOL@ --mode=compile $(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $<
MISC = F77_aloc.o VersionF.o main.o s_rnge.o abort_.o getarg_.o iargc_.o\
MISC = F77_aloc.o VersionF.o s_rnge.o abort_.o getarg_.o iargc_.o\
getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o\
derf_.o derfc_.o erf_.o erfc_.o sig_die.o exit_.o setarg.o setsig.o
POW = pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o \
......@@ -80,20 +76,24 @@ F90BIT = lbitbits.o lbitshft.o qbitbits.o qbitshft.o
OBJS = $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \
$(HALF) $(CMP) $(EFL) $(CHAR) $(F90BIT)
all: ../s-libf77
all: ../s-libf77 ../frtbegin.o
../s-libf77: $(OBJS)
echo timestamp > ../s-libf77
archive:
$(AR) $(ARFLAGS) $(LIBG2C) $(OBJS)
objlist:
objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
x=`echo $$i | sed -e "s/\.o$$/.lo/g"` ;\
objs="$$objs libF77/$$x" ;\
done ; \
echo -n $$objs > ../objlist
Makefile: Makefile.in config.status
$(SHELL) config.status
config.status: configure
rm -f config.cache
CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
CONFIG_SITE=no-such-file CC='$(CC)' CFLAGS='$(CFLAGS)' \
CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
${srcdir}/configure: configure.in
......@@ -101,10 +101,12 @@ ${srcdir}/configure: configure.in
cd ${srcdir} && autoconf
VersionF.o: Version.c
$(CC) -c $(ALL_CFLAGS) -o $@ $(srcdir)/Version.c
@LIBTOOL@ --mode=compile $(CC) -c $(ALL_CFLAGS) $(srcdir)/Version.c -o $@
../frtbegin.o : main.c
$(CC) -c $(ALL_CFLAGS) $(srcdir)/main.c -o $@
F77_aloc.o: F77_aloc.c
main.o: main.c
s_rnge.o: s_rnge.c
abort_.o: abort_.c
getarg_.o: getarg_.c
......@@ -232,7 +234,8 @@ $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) $(HALF) $(CMP) $(EFL) \
check install uninstall install-strip dist installcheck installdirs:
mostlyclean:
rm -f *.o
rm -f *.o *.lo ../frtbegin.o
rm -rf .libs
clean: mostlyclean
rm -f config.log
......
......@@ -32,6 +32,9 @@ define([AC_PROG_CC_WORKS],[])
# the makefiles
AC_PROG_CC
LIBTOOL='$(SHELL) ../libtool'
AC_SUBST(LIBTOOL)
test "$AR" || AR=ar
AC_SUBST(AR)
AC_PROG_MAKE_SET
......
......@@ -31,15 +31,11 @@ VPATH = @srcdir@
# configuration.
DEFS = @DEFS@
LIBG2C = ../libg2c.a
F2C_H_DIR = @srcdir@/..
G2C_H_DIR = ..
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
AR = @AR@
ARFLAGS = rc
@SET_MAKE@
SHELL = /bin/sh
......@@ -53,9 +49,9 @@ ALL_CFLAGS = -I. -I$(srcdir) -I$(G2C_H_DIR) -I$(F2C_H_DIR) $(CPPFLAGS) \
.SUFFIXES: .c .o
.c.o:
$(CC) -c -DSkip_f2c_Undefs -DAllow_TYQUAD $(ALL_CFLAGS) $<
@LIBTOOL@ --mode=compile $(CC) -c -DSkip_f2c_Undefs -DAllow_TYQUAD $(ALL_CFLAGS) $<
OBJ = VersionI.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o \
OBJS = VersionI.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o \
fmt.o fmtlib.o iio.o ilnw.o inquire.o lread.o lwrite.o open.o \
rdfmt.o rewind.o rsfe.o rsli.o rsne.o sfe.o sue.o typesize.o uio.o \
util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o \
......@@ -63,18 +59,22 @@ OBJ = VersionI.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o \
all: ../s-libi77
../s-libi77: $(OBJ)
../s-libi77: $(OBJS)
echo timestamp > ../s-libi77
archive:
$(AR) $(ARFLAGS) $(LIBG2C) $(OBJ)
objlist:
objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
x=`echo $$i | sed -e "s/\.o$$/.lo/g"` ;\
objs="$$objs libI77/$$x" ;\
done ; \
echo -n $$objs > ../objlist
Makefile: Makefile.in config.status
$(SHELL) config.status
config.status: configure
rm -f config.cache
CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
CONFIG_SITE=no-such-file CC='$(CC)' CFLAGS='$(CFLAGS)' \
CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
${srcdir}/configure: configure.in
......@@ -94,7 +94,7 @@ stamp-h: config.h.in config.status
echo timestamp > stamp-h
VersionI.o: Version.c
$(CC) -c $(ALL_CFLAGS) -o $@ $(srcdir)/Version.c
@LIBTOOL@ --mode=compile $(CC) -c $(ALL_CFLAGS) $(srcdir)/Version.c -o $@
backspace.o: backspace.c fio.h config.h
close.o: close.c fio.h config.h
......@@ -153,12 +153,13 @@ xwsne.o: lio.h
xwsne.o: xwsne.c fmt.h
# May be pessimistic:
$(OBJ): $(F2C_H_DIR)/f2c.h $(G2C_H_DIR)/g2c.h
$(OBJS): $(F2C_H_DIR)/f2c.h $(G2C_H_DIR)/g2c.h
check install uninstall install-strip dist installcheck installdirs:
mostlyclean:
rm -f *.o
rm -f *.o *.lo
rm -rf .libs
clean: mostlyclean
rm -f config.log ../s-libi77
......
......@@ -42,6 +42,9 @@ define([AC_PROG_CC_WORKS],[])
# the makefiles
AC_PROG_CC
LIBTOOL='$(SHELL) ../libtool'
AC_SUBST(LIBTOOL)
test "$AR" || AR=ar
AC_SUBST(AR)
AC_PROG_MAKE_SET
......
......@@ -30,15 +30,11 @@ VPATH = @srcdir@
DEFS = @DEFS@
LIBS = @LIBS@
LIBG2C = ../libg2c.a
F2C_H_DIR = @srcdir@/..
G2C_H_DIR = ..
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
AR = @AR@
ARFLAGS = rc
@SET_MAKE@
SHELL = /bin/sh
......@@ -57,7 +53,7 @@ G77DIR = ../../../gcc/
.SUFFIXES: .c .o
.c.o:
$(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $<
@LIBTOOL@ --mode=compile $(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $<
OBJS = VersionU.o gerror_.o perror_.o ierrno_.o itime_.o time_.o \
unlink_.o fnum_.o getpid_.o getuid_.o getgid_.o kill_.o rand_.o \
......@@ -85,15 +81,19 @@ all: ../s-libu77
../s-libu77: $(OBJS)
echo timestamp > ../s-libu77
archive:
$(AR) $(ARFLAGS) $(LIBG2C) $(OBJS)
objlist:
objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
x=`echo $$i | sed -e "s/\.o$$/.lo/g"` ;\
objs="$$objs libU77/$$x" ;\
done ; \
echo -n $$objs > ../objlist
Makefile: Makefile.in config.status
$(SHELL) config.status
config.status: configure
rm -f config.cache
CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
CONFIG_SITE=no-such-file CC='$(CC)' CFLAGS='$(CFLAGS)' \
CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
${srcdir}/configure: configure.in
......@@ -110,7 +110,7 @@ stamp-h: config.hin config.status
echo timestamp > stamp-h
VersionU.o: Version.c
$(CC) -c $(ALL_CFLAGS) -o $@ $(srcdir)/Version.c
@LIBTOOL@ --mode=compile $(CC) -c $(ALL_CFLAGS) $(srcdir)/Version.c -o $@
$(OBJS): $(F2C_H_DIR)/f2c.h $(G2C_H_DIR)/g2c.h config.h
access_.o: access_.c
......@@ -179,7 +179,8 @@ check:
install uninstall install-strip dist installcheck installdirs:
mostlyclean:
rm -f *.o a.out
rm -f *.o *.lo a.out
rm -rf .libs
clean: mostlyclean
rm -f config.log ../s-libu77
......
......@@ -41,6 +41,10 @@ define([AC_PROG_CC_WORKS],[])
# For g77 we'll set CC to point at the built gcc, but this will get it into
# the makefiles
AC_PROG_CC
LIBTOOL='$(SHELL) ../libtool'
AC_SUBST(LIBTOOL)
dnl AC_C_CROSS
dnl Gives misleading `(cached)' message from the check.
if test "$CROSS";then
......
......@@ -38,3 +38,18 @@ static integer c__5 = 5;
return 0;
} /* date_ */
#ifdef PIC
# include <stdio.h>
const char *G77_Non_Y2K_Compliance_Message =
"Call to non Y2K compliant subroutine detected.";
int G77_date_y2kbuggy_0 (char *buf, ftnlen buf_len)
{
extern int G77_abort_0();
fprintf (stderr, "%s\n", G77_Non_Y2K_Compliance_Message);
G77_abort_0();
}
#endif
......@@ -54,3 +54,18 @@ int G77_vxtidate_y2kbug_0 (integer *m, integer *d, integer *y)
*d = lt->tm_mday;
return 0;
}
#ifdef PIC
extern const char *G77_Non_Y2K_Compliance_Message;
# ifdef KR_headers
int G77_vxtidate_y2kbuggy_0 (m, d, y)
integer *y, *m, *d;
# else
int G77_vxtidate_y2kbuggy_0 (integer *m, integer *d, integer *y)
# endif
{
extern int G77_abort_0();
fprintf (stderr, "%s\n", G77_Non_Y2K_Compliance_Message);
G77_abort_0();
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment