Mercurial > hg > octave-terminal
changeset 6102:ef9569e10d8b
[project @ 2006-10-26 20:50:04 by jwe]
author | jwe |
---|---|
date | Thu, 26 Oct 2006 20:50:04 +0000 |
parents | 9e70afeb2ebf |
children | a2fdc87184cf |
files | ChangeLog Makeconf.in configure.in libcruft/ChangeLog libcruft/Makefile.in libcruft/Makerules.in libcruft/mkf77def.in |
diffstat | 7 files changed, 145 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,16 @@ 2006-10-26 Michael Goffioul <michael.goffioul@swing.be> * configure.in (*-*-msdosmsvc): Set library_path_var. + (XTRA_CRUFT_LINK_DEPS): New variable. Substitute it. 2006-10-26 John W. Eaton <jwe@octave.org> + * configure.in (F77_TOLOWER, F77_APPEND_UNDERSCORE, + F77_APPEND_EXTRA_UNDERSCORE): New variables. Substitute them. + * Makeconf.in (F77_TOLOWER, F77_APPEND_UNDERSCORE, + F77_APPEND_EXTRA_UNDERSCORE): Substitute here. + (do-subst-f77-mangling): New macro. + * emacs/octave-inf.el (inferior-octave-has-built-in-variables): New defvar. (inferior-octave-resync-dirs): Check to see whether Octave has
--- a/Makeconf.in +++ b/Makeconf.in @@ -97,6 +97,10 @@ ALL_FFLAGS = $(FFLAGS) F77_FLOAT_STORE_FLAG = @F77_FLOAT_STORE_FLAG@ +F77_TOLOWER=@F77_TOLOWER@ +F77_APPEND_UNDERSCORE=@F77_TOLOWER@ +F77_APPEND_EXTRA_UNDERSCORE=@F77_TOLOWER@ + # cc and associated flags. DLFCN_INCFLAGS = @DLFCN_INCFLAGS@ @@ -572,6 +576,15 @@ $(top_srcdir)/move-if-change $@-t $@ endef +define do-subst-f77-mangling +echo "making $@ from $<" +$(SED) < $< \ + -e "s|%F77_TOLOWER%|${F77_TOLOWER}|g" \ + -e "s|%F77_APPEND_UNDERSCORE%|${F77_APPEND_UNDERSCORE}|" \ + -e "s|%F77_APPEND_EXTRA_UNDERSCORE%|${F77_APPEND_EXTRA_UNDERSCORE}|" > $@-t +$(top_srcdir)/move-if-change $@-t $@ +endef + define do-mkpkgadd $(top_srcdir)/mkpkgadd $(srcdir) > PKG_ADD.t if [ -n "`cat PKG_ADD.t`" ]; then \
--- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.536 $) +AC_REVISION($Revision: 1.537 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -292,6 +292,12 @@ ieee_fp_flag= case "$canonical_host_type" in + ## Keep this pattern first, so that it is preferred over the + ## following pattern for x86. + *-*-msdosmsvc) + CXXFLAGS="$CXXFLAGS -EHs -MD" + CFLAGS="$CFLAGS -MD" + ;; i[[3456789]]86-*-*) if test "$GCC" = yes; then OCTAVE_CC_FLAG(-mieee-fp, [ @@ -347,10 +353,6 @@ OCTAVE_CXX_FLAG(-mminimal-toc, [ XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"]) ;; - *-*-msdosmsvc) - CXXFLAGS="$CXXFLAGS -EHs -MD" - CFLAGS="$CFLAGS -MD" - ;; esac AC_SUBST(XTRA_CFLAGS) @@ -638,6 +640,9 @@ have_fortran_compiler=false have_f2c=false +F77_TOLOWER=true +F77_APPEND_UNDERSCORE=true +F77_APPEND_EXTRA_UNDERSCORE=true if $use_f2c; then have_f2c=true else @@ -645,6 +650,16 @@ AC_F77_LIBRARY_LDFLAGS AC_F77_DUMMY_MAIN AC_F77_WRAPPERS + case "$ac_cv_f77_mangling" in + "upper case") F77_TOLOWER=false ;; + esac + case "$ac_cv_f77_mangling" in + "no underscore") F77_APPEND_UNDERSCORE=false ;; + esac + case "$ac_cv_f77_mangling" in + "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=false ;; + esac + case "$canonical_host_type" in i[[3456789]]86-*-*) if test "$ac_cv_f77_compiler_gnu" = yes; then @@ -677,6 +692,9 @@ fi fi fi +AC_SUBST(F77_TOLOWER) +AC_SUBST(F77_APPEND_UNDERSCORE) +AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE) f77_rules_frag=/dev/null if $have_fortran_compiler; then @@ -743,6 +761,15 @@ AC_MSG_ERROR([See the file INSTALL for more information.]) fi +XTRA_CRUFT_LINK_DEPS= +case "$canonical_host_type" in + *-*-msdosmsvc) + FLIBS="$FLIBS -lkernel32" + XTRA_CRUFT_LINK_DEPS="-Wl,-def:cruft.def" + ;; +esac +AC_SUBST(XTRA_CRUFT_LINK_DEPS) + FC=$F77 AC_SUBST(FC) AC_SUBST_FILE(f77_rules_frag)
--- a/libcruft/ChangeLog +++ b/libcruft/ChangeLog @@ -1,3 +1,34 @@ +2006-10-26 Michael Goffioul <michael.goffioul@swing.be> + + * Makefile.in (XTRA_CRUFT_LINK_DEPS): Substitute. + (CRUFT_DEFS): New variable. + (LINK_DEPS): Include $(XTRA_CRUFT_LINK_DEPS) in the list. + (clean, mostlyclean, distclean): Delete cruft.def. + (cruft.def): New target. + (libraries): Depend on cruft.def. + +2006-10-26 John W. Eaton <jwe@octave.org> + + * Makefile.in ($(CRUFT_DEFS)): Depend on $(SUBDIRS). + (cruft.def): Depend on $(CRUFT_DEFS). + (libraries): Depend on cruft.def only. + + * mk77def.in: New script template + * Makefile.in (DISTFILES): Include mk77def.in in the list. + ($(SUBDIRS)): Depend on mk77def. + (mk77def): New target. + (CRUFT_DEFS): New variable. + * Makerules.in (CRUFT_FSRC, CRUFT_CSRC, CRUFT_CXXSRC): New variables. + (CRUFT_SRC): Define using $(CRUFT_FSRC), $(CRUFT_CSRC), and + $(CRUFT_CXXSRC). + (CRUFT_DEFS): New variable. + ($(CRUFT_DEFS)): Depend on $(TOPDIR)/libcruft/mkf77def. + (%.def : %.f): New pattern rule. Use mkf77def script to do + Fortran name mangling. + (clean, mostlyclean, distclean): Delete $(CRUFT_DEFS). + (all): Depend on $(CRUFT_DEFS) + Partially from Michael Goffioul <michael.goffioul@swing.be>. + 2006-10-25 John W. Eaton <jwe@octave.org> * Makerules.in (XTRA_CDEFS, XTRA_CXXDEFS): Substitute here.
--- a/libcruft/Makefile.in +++ b/libcruft/Makefile.in @@ -39,15 +39,21 @@ CLEAN_SUBDIRS = $(DISTSUBDIRS) -DISTFILES = Makefile.in ChangeLog Makerules.in $(SOURCES) STOP.patch +DISTFILES = Makefile.in ChangeLog Makerules.in $(SOURCES) \ + STOP.patch mkf77def.in -# include BLAS and FFTW just in case some of libcruft depends on them -LINK_DEPS = $(BLAS_LIBS) $(FFTW_LIBS) $(FLIBS) +# Include BLAS and FFTW just in case some of libcruft depends on them +XTRA_CRUFT_LINK_DEPS = @XTRA_CRUFT_LINK_DEPS@ +LINK_DEPS = $(BLAS_LIBS) $(FFTW_LIBS) $(FLIBS) $(XTRA_CRUFT_LINK_DEPS) all: libraries .PHONY: all -$(SUBDIRS): +mkf77def: mkf77def.in $(TOPDIR)/Makeconf + @$(do-subst-f77-mangling) + chmod a+rx $@ + +$(SUBDIRS): mkf77def $(MAKE) -C $@ all .PHONY: $(SUBDIRS) @@ -61,6 +67,7 @@ CRUFT_OBJ2 := $(patsubst $(srcdir)/%, %, $(CRUFT_FSRC)) CRUFT_OBJ1 := $(patsubst %.f, %.o, $(CRUFT_OBJ2)) CRUFT_OBJ := $(CRUFT_OBJ1) $(MISC_OBJ) +CRUFT_DEFS := $(patsubst %.f, %.def, $(CRUFT_OBJ2)) ifeq ($(SHARED_LIBS), true) ifdef FPICFLAG @@ -87,7 +94,13 @@ endif endif -libraries: $(SUBDIRS) +$(CRUFT_DEFS): $(SUBDIRS) + +cruft.def: $(CRUFT_DEFS) + echo "EXPORTS" > $@ + cat $(CRUFT_DEFS) >> $@ + +libraries: cruft.def $(MAKE) $(LIBRARIES) .PHONY: libraries @@ -161,7 +174,7 @@ clean mostlyclean distclean:: rm -f $(LIBPRE)cruft.$(LIBEXT) $(CRUFT_OBJ) rm -f $(LIBPRE)cruft.$(SHLEXT_VER) $(LIBPRE)cruft.$(SHLEXT) - rm -f cruft.def + rm -f $(CRUFT_DEFS) cruft.def distclean maintainer-clean:: rm -f Makefile Makerules so_locations
--- a/libcruft/Makerules.in +++ b/libcruft/Makerules.in @@ -17,11 +17,13 @@ DISTFILES = Makefile.in $(SOURCES) $(SPECIAL) -CRUFT_SRC = $(wildcard $(srcdir)/*.f) \ - $(wildcard $(srcdir)/*.c) \ - $(wildcard $(srcdir)/*.cc) +CRUFT_FSRC = $(wildcard $(srcdir)/*.f) +CRUFT_CSRC = $(wildcard $(srcdir)/*.c) +CRUFT_CXXSRC = $(wildcard $(srcdir)/*.cc) +CRUFT_SRC = $(CRUFT_FSRC) $(CRUFT_CSRC) $(CRUFT_CXXSRC) CRUFT_BASE = $(basename $(notdir $(CRUFT_SRC)) ) CRUFT_OBJ = $(addsuffix .o, $(CRUFT_BASE) ) +CRUFT_DEFS = $(patsubst %.f, %.def, $(notdir $(CRUFT_FSRC))) ifeq ($(SHARED_LIBS), true) ifdef FPICFLAG @@ -40,7 +42,7 @@ LIBCRUFT_DEPEND := $(LIBCRUFT_OBJS) endif -all: pic $(LIBCRUFT_DEPEND) $(CRUFT_PICOBJ) $(SPECIAL_PICDEPEND) +all: pic $(CRUFT_DEFS) $(LIBCRUFT_DEPEND) $(CRUFT_PICOBJ) $(SPECIAL_PICDEPEND) @echo "warning: run make in parent directory to update libraries" .PHONY: all @@ -64,6 +66,13 @@ $(CRUFT_PICOBJ): stmp-pic +$(CRUFT_DEFS): $(TOPDIR)/libcruft/mkf77def + +%.def : %.f + @echo "making $@ from $<" + @$(TOPDIR)/libcruft/mkf77def < $< > $@.t + $(top_srcdir)/move-if-change $@.t $@ + install:: all .PHONY: install @@ -80,7 +89,7 @@ etags $(SOURCES) clean mostlyclean distclean maintainer-clean:: - rm -f $(MAKEDEPS) $(CRUFT_OBJ) $(CRUFT_PICOBJ) + rm -f $(MAKEDEPS) $(CRUFT_OBJ) $(CRUFT_PICOBJ) $(CRUFT_DEFS) -rmdir pic rm -f stmp-pic .PHONY: clean mostlyclean
new file mode 100644 --- /dev/null +++ b/libcruft/mkf77def.in @@ -0,0 +1,29 @@ +#! /bin/sh + +SED=${SED:-'sed'} +AWK=${AWK:-'awk'} + +F77_TOLOWER=%F77_APPEND_UNDERSCORE% +F77_APPEND_UNDERSCORE=%F77_APPEND_UNDERSCORE% +F77_APPEND_EXTRA_UNDERSCORE=%F77_APPEND_EXTRA_UNDERSCORE% + +if $F77_TOLOWER; then + case_cmd="tolower"; +else + case_cmd="toupper"; +fi + +if $F77_APPEND_UNDERSCORE; then + uscore="_"; +else + uscore=""; +fi + +if $F77_APPEND_EXTRA_UNDERSCORE; then + awkcmd="$AWK '{ if (\$0 ~ /_/) extra = \"_\"; else extra = \"\"; printf (\"%s%s%s\n\", $case_cmd (\$0), \"$uscore\", extra); }'" +else + awkcmd="$AWK '{ printf (\"%s%s\n\", tolower (\$0), \"$uscore\"); }'" +fi + +$SED -n -e 's/^[ \t]*\([Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\|[Ss][Uu][Bb][Rr][Oo][Uu][Tt][Ii][Nn][Ee]\|[Ee][Nn][Tt][Rr][Yy]\)[ \t]*\([^ \t(]*\).*$/\2/p' | \ + eval $awkcmd