octave-maintainers
[Top][All Lists]
Advanced

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

Re: f2c obsolete?


From: John W. Eaton
Subject: Re: f2c obsolete?
Date: Wed, 24 Oct 2007 16:29:22 -0400

On 24-Oct-2007, Thomas Treichl wrote:

| the patch helps very much - the test succeeds now (and I expect that the 
| compilation of Octave then also does succeed again).

OK, I checked in the following change to eliminate the special
handling of f2c.  Can you try this patch (or update from CVS) and see
if it works correctly for you?

Thanks,

jwe


ChangeLog:

2007-10-24  John W. Eaton  <address@hidden>

        * octMakefile.in (maintainer-clean distclean): No need to delete
        Makefrag.f77 and Makerules.f77.
        * Makeconf.in: Include rules for making .o files from .f files
        instead of substituting @address@hidden  
        * configure.in): Delete handling of --with-f2c and --with-f77
        options.  No need to call OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS.
        Delete all special cases for f2c.
        * aclocal.m4 (OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS): Delete macro.

Index: Makeconf.in
===================================================================
RCS file: /cvs/octave/Makeconf.in,v
retrieving revision 1.199
diff -u -u -r1.199 Makeconf.in
--- Makeconf.in 12 Oct 2007 21:27:12 -0000      1.199
+++ Makeconf.in 24 Oct 2007 20:26:48 -0000
@@ -370,27 +370,20 @@
 # The following pattern rules and the substitution functions require
 # GNU make.  If you don't have it, get it!
 
-# Rules for making object files from Fortran source.
-#
-# If we are using f2c there will be a command for the `%.c : %.f'
-# pattern and no command for the `%.o : %.f' pattern, so that make
-# will not invoke the fortran compiler by mistake.
-#
-# If we are not using f2c, it should be ok to have an empty rule for
-# the pattern `%.c : %.f', but we don't want to replace make's default
-# rule for making object from Fortran source files, so there should be
-# no pattern or command for that.
-
address@hidden@
-
 # How to make .o files:
 
+%.o : %.f
+       $(FC) -c $(ALL_FFLAGS) -o $@ $<
+
 %.o : %.c
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -o $@
 
 %.o : %.cc
        $(CXX) -c $(CPPFLAGS) $(ALL_CXXFLAGS) $< -o $@
 
+pic/%.o : %.f
+       $(FC) -c $(FPICFLAG) $(ALL_FFLAGS) $< -o $@
+
 pic/%.o : %.c
        $(CC) -c $(CPPFLAGS) $(CPICFLAG) $(ALL_CFLAGS) $< -o $@
 
Index: aclocal.m4
===================================================================
RCS file: /cvs/octave/aclocal.m4,v
retrieving revision 1.115
diff -u -u -r1.115 aclocal.m4
--- aclocal.m4  24 Oct 2007 19:00:12 -0000      1.115
+++ aclocal.m4  24 Oct 2007 20:26:48 -0000
@@ -45,19 +45,6 @@
 AC_MSG_RESULT([defining $1 to be $$1])
 AC_SUBST($1)])
 dnl
-dnl 
-dnl OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS
-AC_DEFUN(OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS,
-[if test "${with_$1+set}" = set; then
-  if test "${with_$2+set}" = set; then
-    if test "$with_$2" = no; then
-      true
-    else
-      $3
-    fi
-  fi
-fi])
-dnl
 dnl Check for ar.
 dnl
 AC_DEFUN(OCTAVE_PROG_AR,
Index: configure.in
===================================================================
RCS file: /cvs/octave/configure.in,v
retrieving revision 1.586
diff -u -u -r1.586 configure.in
--- configure.in        24 Oct 2007 19:00:12 -0000      1.586
+++ configure.in        24 Oct 2007 20:26:48 -0000
@@ -119,29 +119,6 @@
 config_opts=$ac_configure_args
 AC_SUBST(config_opts)
 
-### Allow the user to force us to use f2c.
-
-AC_ARG_WITH(f2c,
-  [AS_HELP_STRING([--with-f2c],
-     [use f2c even if Fortran compiler is available])],
-  [if test "$withval" = no; then use_f2c=false; else use_f2c=true; fi],
-  use_f2c=false)
-
-### Allow the user to force us to use f77.
-
-AC_ARG_WITH(f77,
-  [AS_HELP_STRING([--with-f77], [use f77 to compile Fortran subroutines])],
-  [if test "$withval" = no; then use_f77=false; else use_f77=true; fi],
-  use_f77=false)
-
-### Make sure only one of the above options for Fortran compilers was
-### specified (multiple "no" or --without-FOO options are ok).
-
-OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS(f77, f2c,
-  [warn_f2c_and_f77="--with-f2c and --with-f77 both specified!  Using f77..."
-  AC_MSG_WARN($warn_f2c_and_f77)
-  use_f2c=false])
-
 ### Make it possible to have Octave's array and matrix classes do bounds
 ### checking on element references.  This slows some operations down a
 ### bit, so it is turned off by default.
@@ -661,170 +638,67 @@
 
 # ----------------------------------------------------------------------
 
-### We need these before trying to find libf2c.
-
 OCTAVE_PROG_AR
 
 AC_PROG_RANLIB
 
-### If we haven't been forced to use a particular Fortran compiler,
-### try to find one using any one of several common Un*x Fortran
-### compiler names using the AC_PROG_F77 macro.
-###
-### The configure options --with-f77 or --with-f2c
-### force f77 or f2c to be used.  It is also possible to use
-### these options to specify the name of the compiler.  For example,
-### `--with-f77=g77' says that we are using g77 as the Fortran compiler.
-
-if $use_f77; then
-  if test "$with_f77" = yes; then
-    F77=f77
-  else
-    F77="$with_f77"
-  fi
-  AC_MSG_NOTICE([defining F77 to be $F77])
-elif $use_f2c; then
-  F77=
-  if test "$with_f2c" = yes; then
-    F2C=f2c
-  else
-    F2C="$with_f2c"
-  fi
-  AC_MSG_NOTICE([defining F2C to be $F2C])
-fi
-
+## Default FFLAGS is -O.
 if test "x$FFLAGS" = x; then
-  FFLAGS="-O" # override -g -O default by AC_PROG_F77
+  FFLAGS="-O"
 fi
 
-# the F77 variable, if set, overrides AC_PROG_F77 automatically
+## the F77 variable, if set, overrides AC_PROG_F77 automatically
 AC_PROG_F77
-
-have_fortran_compiler=false
-have_f2c=false
+AC_F77_LIBRARY_LDFLAGS
+AC_F77_DUMMY_MAIN
+AC_F77_WRAPPERS
 
 F77_TOLOWER=true
 F77_APPEND_UNDERSCORE=true
 F77_APPEND_EXTRA_UNDERSCORE=true
-if $use_f2c; then
-  have_f2c=true
-else
-  if test -n "$F77"; then
-    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
-         OCTAVE_F77_FLAG(-mieee-fp)
-###          OCTAVE_F77_FLAG(-ffloat-store)
-       fi
-      ;;
-      alpha*-*-*)
-        if test "$ac_cv_f77_compiler_gnu" = yes; then
-         OCTAVE_F77_FLAG(-mieee)
-       else
-         OCTAVE_F77_FLAG(-ieee)
-         OCTAVE_F77_FLAG(-fpe1)
-       fi
-      ;;
-      powerpc-apple-machten*)
-       FFLAGS=
-      ;;
-    esac
-    if test -n "$FFLAGS"; then
-      AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
+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
+      OCTAVE_F77_FLAG(-mieee-fp)
+###      OCTAVE_F77_FLAG(-ffloat-store)
     fi
-    have_fortran_compiler=true
-  else
-    AC_CHECK_PROG(F2C, f2c, f2c, [])
-    AC_ARG_VAR(F2C, [Fortran to C translator command])
-    AC_ARG_VAR(F2CFLAGS, [Fortran to C translator flags])
-    if test -n "$F2C"; then
-      have_f2c=true
+  ;;
+  alpha*-*-*)
+    if test "$ac_cv_f77_compiler_gnu" = yes; then
+      OCTAVE_F77_FLAG(-mieee)
+    else
+      OCTAVE_F77_FLAG(-ieee)
+      OCTAVE_F77_FLAG(-fpe1)
     fi
-  fi
+  ;;
+  powerpc-apple-machten*)
+    FFLAGS=
+  ;;
+esac
+
+if test -n "$FFLAGS"; then
+  AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
 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
-  f77_rules_frag=Makefrag.f77
-  cat << \EOF > $f77_rules_frag
-
-%.c : %.f
-
-%.o : %.f
-       $(FC) -c $(ALL_FFLAGS) -o $@ $<
-
-pic/%.o : %.f
-       $(FC) -c $(FPICFLAG) $(ALL_FFLAGS) $< -o $@
-
-EOF
-elif $have_f2c; then
-  AC_DEFINE(HAVE_F2C, 1, [Define if we are using f2c.])
-
-### FIXME -- these shouldn't be fixed names, eh?
-
-  oct_conflib=libconflib.a
-  oct_obj_ext=o
-
-  CONFLIB_ARG=
-  if (eval "$ac_compile") 2>&AS_MESSAGE_LOG_FD; then
-    $AR $ARFLAGS $oct_conflib conftest.$oct_obj_ext 1>&AS_MESSAGE_LOG_FD()
-    if test -n "$RANLIB"; then
-      $RANLIB $oct_conflib 1>&AS_MESSAGE_LOG_FD()
-    fi
-    CONFLIB_ARG="-L. -lconflib"
-  fi
-  rm -f conftest*
-  case "$canonical_host_type" in
-    *-*-msdosmsvc)
-      CONFLIB_ARG="-MD"
-      ;;
-  esac
-  XLIBS="$LIBS"
-  LIBS="-lf2c $LIBS $CONFLIB_ARG"
-  AC_LINK_IFELSE([AC_LANG_CALL([int MAIN__ () { return 1; }], [f_open])],
-                 [F2CLIBS=-lf2c], [F2CLIBS=])
-  LIBS="$XLIBS"
-  rm -f $oct_conflib
-
-  if test -z "$F2CLIBS"; then
-    AC_CHECK_LIB(F77, d_sin, F2CLIBS=-lF77, FLIBS=)
-    if test -n "$F2CLIBS"; then
-      AC_CHECK_LIB(I77, f_rew, F2CLIBS="$F2CLIBS -lI77", F2CLIBS=, -lF77)
-    fi
-  fi
-
-  if test -z "$F2CLIBS"; then
-    warn_f2c_no_lib="I found f2c but not libf2c.a, or libF77.a and libI77.a"
-    AC_MSG_WARN($warn_f2c_no_lib)
-  fi
-  f77_rules_frag=Makefrag.f77
-  cat << \EOF > $f77_rules_frag
-
-%.c : %.f
-       $(F2C) $(F2CFLAGS) < $< > $(@F)
-
-%.o : %.f
-
-EOF
-else
+if test -z "$F77"; then
   AC_MSG_WARN([in order to build octave, you must have a compatible])
-  AC_MSG_WARN([Fortran compiler or f2c installed and in your path.])
+  AC_MSG_WARN([Fortran compiler or wrapper script for f2c that functions])
+  AC_MSG_WARN([as a Fortran compiler installed and in your path.])
   AC_MSG_ERROR([See the file INSTALL for more information.])
 fi
 
@@ -882,19 +756,10 @@
       end
 EOF
 XLIBS="$LIBS"
-if $have_fortran_compiler; then
-  LIBS="$BLAS_LIBS $FLIBS $LIBS"
-  AC_LANG_PUSH(Fortran 77)
-  (eval "$ac_compile"; eval "$ac_link") 2>&AS_MESSAGE_LOG_FD
-  AC_LANG_POP(Fortran 77)
-elif $have_f2c; then
-  LIBS="$BLAS_LIBS $F2CLIBS $LIBS"
-  AC_LANG_PUSH(C)
-  octave_xlate="$F2C $F2CFLAGS < conftest.f > conftest.c"
-  (eval "$octave_xlate")
-  (eval "$ac_compile"; eval "$ac_link") 2>&AS_MESSAGE_LOG_FD
-  AC_LANG_POP(C)
-fi
+LIBS="$BLAS_LIBS $FLIBS $LIBS"
+AC_LANG_PUSH(Fortran 77)
+(eval "$ac_compile"; eval "$ac_link") 2>&AS_MESSAGE_LOG_FD
+AC_LANG_POP(Fortran 77)
 LIBS="$XLIBS"
 case "`./conftest$ac_exeext`" in
   *succeeded*)
@@ -2057,12 +1922,6 @@
   FORT="$F77 $FFLAGS"
 fi
 
-if $have_fortran_compiler; then
-  true
-elif $have_f2c; then
-  FLIBS="$F2CLIBS"
-fi
-
 AC_MSG_NOTICE([
 
 Octave is now configured for $canonical_host_type
@@ -2111,11 +1970,6 @@
   fi
 fi
 
-if test -n "$warn_f2c_and_f77"; then
-  AC_MSG_WARN($warn_f2c_and_f77)
-  warn_msg_printed=true
-fi
-
 if test -n "$gxx_only"; then
   AC_MSG_WARN($gxx_only)
   warn_msg_printed=true
@@ -2131,11 +1985,6 @@
   warn_msg_printed=true
 fi
 
-if test -n "$warn_f2c_no_lib"; then
-  AC_MSG_WARN($warn_f2c_no_lib)
-  warn_msg_printed=true
-fi
-
 if test -n "$warn_readline"; then
   AC_MSG_WARN($warn_readline)
   warn_msg_printed=true
Index: octMakefile.in
===================================================================
RCS file: /cvs/octave/octMakefile.in,v
retrieving revision 1.227
diff -u -u -r1.227 octMakefile.in
--- octMakefile.in      24 Oct 2007 19:57:57 -0000      1.227
+++ octMakefile.in      24 Oct 2007 20:26:48 -0000
@@ -162,7 +162,7 @@
 .PHONY: clean mostlyclean distclean maintainer-clean
 
 maintainer-clean distclean::
-       rm -f octMakefile Makefile Makeconf Makefrag.f77 Makerules.f77
+       rm -f octMakefile Makefile Makeconf
        rm -f config.cache config.h config.log config.status
        rm -rf autom4te.cache
        rm -f $(SHELL_SCRIPTS)

reply via email to

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