changeset 10331:6a50aa2cdf00

never compile ranlib with 8-byte integers
author John W. Eaton <jwe@octave.org>
date Wed, 17 Feb 2010 14:46:51 -0500
parents e0767a0965f1
children 5f6298220ced
files ChangeLog acinclude.m4 common.mk configure.ac libcruft/ChangeLog libcruft/Makefile.am libcruft/ranlib/module.mk liboctave/ChangeLog liboctave/Makefile.am liboctave/oct-rand.cc src/ChangeLog src/Makefile.am src/oct-conf.h.in src/toplev.cc
diffstat 14 files changed, 109 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 17 13:31:20 2010 +0100
+++ b/ChangeLog	Wed Feb 17 14:46:51 2010 -0500
@@ -1,3 +1,14 @@
+2010-02-17  John W. Eaton  <jwe@octave.org>
+
+	* configure.ac: 
+
+	* acinclude.m4 (OCTAVE_CHECK_FORTRAN_INTEGER_SIZE): Save and
+	restore FFLAGS.  Temporarily add F77_INTEGER_8_FLAG to FFLAGS.
+	* common.mk (F77_INTEGER_8_FLAG): New variable.
+	(do_subst_config_vals): Substitute it.
+	* configeure.ac: Don't add -fdefault-integer-8 to FFLAGS. 
+	Substitute F77_INTEGER_8_FLAG.  Improve --enable-64 warning.
+
 2010-02-15  Jaroslav Hajek  <highegg@gmail.com>
 
 	* NEWS: Update.
--- a/acinclude.m4	Wed Feb 17 13:31:20 2010 +0100
+++ b/acinclude.m4	Wed Feb 17 14:46:51 2010 -0500
@@ -301,6 +301,8 @@
 dnl Check to see whether the default Fortran INTEGER is 64 bits wide.
 dnl
 AC_DEFUN([OCTAVE_CHECK_FORTRAN_INTEGER_SIZE], [
+  octave_fintsize_save_FFLAGS="$FFLAGS"
+  FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
   AC_LANG_PUSH(Fortran 77)
   AC_CACHE_CHECK([whether $F77 generates correct size integers],
                  [octave_cv_fortran_integer_size],
@@ -339,14 +341,14 @@
   [octave_cv_fortran_integer_size=yes],
   [octave_cv_fortran_integer_size=no])
   AC_LANG_POP(C)dnl
-
-LIBS="$octave_fintsize_save_LIBS"
+  LIBS="$octave_fintsize_save_LIBS"
 rm -f conftest.$ac_objext fintsize.$ac_objext
 ], [
   rm -f conftest.$ac_objext
   AC_MSG_FAILURE([cannot compile a simple Fortran program])
   octave_cv_fortran_integer_size=no])])
   AC_LANG_POP(Fortran 77)
+  FFLAGS="$octave_fintsize_save_FFLAGS"
 ])
 dnl
 dnl
--- a/common.mk	Wed Feb 17 13:31:20 2010 +0100
+++ b/common.mk	Wed Feb 17 14:46:51 2010 -0500
@@ -86,6 +86,7 @@
 FPICFLAG = @FPICFLAG@
 ALL_FFLAGS = $(FFLAGS)
 F77_FLOAT_STORE_FLAG = @F77_FLOAT_STORE_FLAG@
+F77_INTEGER_8_FLAG = @F77_INTEGER_8_FLAG@
 
 F77_TOLOWER=@F77_TOLOWER@
 F77_APPEND_UNDERSCORE=@F77_TOLOWER@
@@ -502,6 +503,7 @@
   -e "s|%OCTAVE_CONF_EXEEXT%|\"${EXEEXT}\"|" \
   -e "s|%OCTAVE_CONF_F77%|\"${F77}\"|" \
   -e "s|%OCTAVE_CONF_F77_FLOAT_STORE_FLAG%|\"${F77_FLOAT_STORE_FLAG}\"|" \
+  -e "s|%OCTAVE_CONF_F77_INTEGER_8_FLAG%|\"${F77_INTEGER_8_FLAG}\"|" \
   -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \
   -e "s|%OCTAVE_CONF_FFLAGS%|\"${FFLAGS}\"|" \
   -e "s|%OCTAVE_CONF_FFTW3_CPPFLAGS%|\"${FFTW3_CPPFLAGS}\"|" \
--- a/configure.ac	Wed Feb 17 13:31:20 2010 +0100
+++ b/configure.ac	Wed Feb 17 14:46:51 2010 -0500
@@ -557,15 +557,24 @@
 if test "x$octave_cv_fortran_integer_size" = xno; then
   if $USE_64_BIT_IDX_T; then
     case "$F77" in
-      gfortran)
-        case "$FFLAGS" in
+      *gfortran*)
+        case "$F77_INTEGER_8_FLAG" in
           *-fdefault-integer-8*)
           ;;
           *)
-            AC_MSG_NOTICE([adding -fdefault-integer-8 to FFLAGS])
-            FFLAGS="-fdefault-integer-8 $FFLAGS"
-	    ## Invalidate the cache and try again.
-            $as_unset octave_cv_fortran_integer_size
+            case "$FFLAGS" in
+              *-fdefault-integer-8*)
+                AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS])
+                FFLAGS=`echo $FFLAGS | sed 's/-fdefault-integer-8//g'`
+                F77_INTEGER_8_FLAG="-fdefault-integer-8"
+              ;;
+              *)
+                AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG])
+                F77_INTEGER_8_FLAG="-fdefault-integer-8"
+	        ## Invalidate the cache and try again.
+                $as_unset octave_cv_fortran_integer_size
+              ;;
+            esac
           ;;
         esac
       ;;
@@ -574,12 +583,13 @@
       OCTAVE_CHECK_FORTRAN_INTEGER_SIZE
     fi
     if test "x$octave_cv_fortran_integer_size" = xno; then
-      AC_MSG_ERROR([in order to build octave with 64-bit indexing support your Fortran compiler must have a default integer size of 8 bytes.  See the file INSTALL for more information.])
+      AC_MSG_ERROR([in order to build octave with 64-bit indexing support your Fortran compiler must have an option for setting the default integer size to 8 bytes.  See the file INSTALL for more information.])
     fi
   else
-    AC_MSG_ERROR([your Fortran compiler must have default integers that are the same size as octave_idx_type ($OCTAVE_IDX_TYPE).  See the file INSTALL for more information.])
+    AC_MSG_ERROR([your Fortran compiler must have an option to make integers the same size as octave_idx_type ($OCTAVE_IDX_TYPE).  See the file INSTALL for more information.])
   fi
 fi
+AC_SUBST(F77_INTEGER_8_FLAG)
 
 FC=$F77
 AC_SUBST(FC)
@@ -2280,10 +2290,14 @@
   AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.])
   AC_MSG_WARN([Are you sure that is what you want to do?])
   AC_MSG_WARN([])
-  AC_MSG_WARN([You must ensure that the Fortran compiler generates])
-  AC_MSG_WARN([code with 8 byte signed INTEGER values, and that your])
-  AC_MSG_WARN([BLAS and LAPACK libraries are compiled to use 8 byte])
-  AC_MSG_WARN([signed integers for array indexing.])
+  AC_MSG_WARN([Your Fortran compiler must have an option to generate])
+  AC_MSG_WARN([code with 8 byte signed INTEGER values.  This option])
+  AC_MSG_WARN([should be specified in the F77_INTEGER_8_FLAG variable])
+  AC_MSG_WARN([Make.  This should work automatically for gfortran.  If])
+  AC_MSG_WARN([you use another compiler, you will need to set this])
+  AC_MSG_WARN([variable on the configure command line.  You must also])
+  AC_MSG_WARN([compile the ARPACK, BLAS, LAPACK, QRUPDATE, and SuiteSparse])
+  AC_MSG_WARN([libraries to use 8 byte signed integers for array indexing.])
   AC_MSG_WARN([])
   warn_msg_printed=true
 fi
--- a/libcruft/ChangeLog	Wed Feb 17 13:31:20 2010 +0100
+++ b/libcruft/ChangeLog	Wed Feb 17 14:46:51 2010 -0500
@@ -1,3 +1,13 @@
+2010-02-17  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am (libcruft_la_LIBADD): Include libranlib.la in the list.
+	(noinst_LTLIBRARIES, libranlib_la_SOURCES, libranlib_la_DEPENDENCIES,
+	libcruft_la_FFLAGS): New variables.
+	(ranlib.def): New target.
+	(DISTCLEANFILES): Also remove ranlib.def.
+	* ranlib/module.mk (libranlib_la_SOURCES): Rename from
+	libcruft_la_SOURCES.
+
 2010-01-20  John W. Eaton  <jwe@octave.org>
 
 	* misc/quit.cc: Untabify.
--- a/libcruft/Makefile.am	Wed Feb 17 13:31:20 2010 +0100
+++ b/libcruft/Makefile.am	Wed Feb 17 14:46:51 2010 -0500
@@ -29,15 +29,23 @@
 
 libcruft_la_SOURCES =
 
+libcruft_la_FFLAGS = $(F77_INTEGER_8_FLAG)
+
 libcruft_la_CPPFLAGS = @CRUFT_DLL_DEFS@
 
 libcruft_la_LDFLAGS = \
   -release $(version) $(NO_UNDEFINED_LDFLAG) @XTRA_CRUFT_SH_LDFLAGS@
 
-libcruft_la_LIBADD = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
+libcruft_la_LIBADD = libranlib.la $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
 
 libcruft_la_DEPENDENCIES = cruft.def
 
+noinst_LTLIBRARIES = libranlib.la
+
+libranlib_la_SOURCES =
+
+libranlib_la_DEPENDENCIES = ranlib.def
+
 octinclude_HEADERS =
 
 EXTRA_DIST =
@@ -63,7 +71,12 @@
 	./mkf77def $(srcdir) $(libcruft_la_SOURCES) > $@-t
 	mv $@-t $@
 
+ranlib.def: $(libranlib_la_SOURCES) mkf77def
+	chmod a+rx mkf77def
+	./mkf77def $(srcdir) $(libranlib_la_SOURCES) > $@-t
+	mv $@-t $@
+
 EXTRA_DIST += ChangeLog mkf77def.in
 
-DISTCLEANFILES = cruft.def
+DISTCLEANFILES = cruft.def ranlib.def
 
--- a/libcruft/ranlib/module.mk	Wed Feb 17 13:31:20 2010 +0100
+++ b/libcruft/ranlib/module.mk	Wed Feb 17 14:46:51 2010 -0500
@@ -9,7 +9,7 @@
   ranlib/tstgmn.for \
   ranlib/tstmid.for
 
-libcruft_la_SOURCES += \
+libranlib_la_SOURCES += \
   ranlib/advnst.f \
   ranlib/genbet.f \
   ranlib/genchi.f \
--- a/liboctave/ChangeLog	Wed Feb 17 13:31:20 2010 +0100
+++ b/liboctave/ChangeLog	Wed Feb 17 14:46:51 2010 -0500
@@ -1,3 +1,13 @@
+2010-02-17  John W. Eaton  <jwe@octave.org>
+
+	* oct-rand.cc: Include <sdint.h>.  Change declarations of ranlib
+	functions to take int32_t instead of octave_idx_type values.
+	Change all uses.
+	(octave_rand::do_seed): Use int32_t in union, not octave_idx_type.
+	(force_to_fit_range): Args are now int32_t, not octave_idx_type.
+	(octave_rand::initialize_ranlib_generators): Use int32_t in seed
+	calculation.
+
 2010-02-17  Jaroslav Hajek  <highegg@gmail.com>
 
 	* mx-op-defs.h (MINMAX_FCNS): Generalize.
--- a/liboctave/Makefile.am	Wed Feb 17 13:31:20 2010 +0100
+++ b/liboctave/Makefile.am	Wed Feb 17 14:46:51 2010 -0500
@@ -479,6 +479,7 @@
 LINK_DEPS = \
   $(RLD_FLAG) \
   ../libcruft/libcruft.la \
+  ../libcruft/libranlib.la \
   ../libgnu/libgnu.la \
   $(SPARSE_XLIBS) \
   $(ARPACK_LIBS) \
--- a/liboctave/oct-rand.cc	Wed Feb 17 13:31:20 2010 +0100
+++ b/liboctave/oct-rand.cc	Wed Feb 17 14:46:51 2010 -0500
@@ -27,6 +27,8 @@
 #include <map>
 #include <vector>
 
+#include <stdint.h>
+
 #include "f77-fcn.h"
 #include "lo-ieee.h"
 #include "lo-error.h"
@@ -58,16 +60,16 @@
   F77_FUNC (dgengam, DGENGAM) (const double&, const double&, double&);
 
   F77_RET_T
-  F77_FUNC (setall, SETALL) (const octave_idx_type&, const octave_idx_type&);
+  F77_FUNC (setall, SETALL) (const int32_t&, const int32_t&);
 
   F77_RET_T
-  F77_FUNC (getsd, GETSD) (octave_idx_type&, octave_idx_type&);
+  F77_FUNC (getsd, GETSD) (int32_t&, int32_t&);
 
   F77_RET_T
-  F77_FUNC (setsd, SETSD) (const octave_idx_type&, const octave_idx_type&);
+  F77_FUNC (setsd, SETSD) (const int32_t&, const int32_t&);
 
   F77_RET_T
-  F77_FUNC (setcgn, SETCGN) (const octave_idx_type&);
+  F77_FUNC (setcgn, SETCGN) (const int32_t&);
 }
 
 octave_rand *octave_rand::instance = 0;
@@ -103,7 +105,7 @@
 double
 octave_rand::do_seed (void)
 {
-  union d2i { double d; octave_idx_type i[2]; };
+  union d2i { double d; int32_t i[2]; };
   union d2i u;
     
   oct_mach_info::float_format ff = oct_mach_info::native_float_format ();
@@ -121,8 +123,8 @@
   return u.d;
 }
 
-static octave_idx_type
-force_to_fit_range (octave_idx_type i, octave_idx_type lo, octave_idx_type hi)
+static int32_t
+force_to_fit_range (int32_t i, int32_t lo, int32_t hi)
 {
   assert (hi > lo && lo >= 0 && hi > lo);
 
@@ -142,7 +144,7 @@
   use_old_generators = true;
 
   int i0, i1;
-  union d2i { double d; octave_idx_type i[2]; };
+  union d2i { double d; int32_t i[2]; };
   union d2i u;
   u.d = s;
 
@@ -449,8 +451,8 @@
   int minute = tm.min() + 1;
   int second = tm.sec() + 1;
 
-  octave_idx_type s0 = tm.mday() * hour * minute * second;
-  octave_idx_type s1 = hour * minute * second;
+  int32_t s0 = tm.mday() * hour * minute * second;
+  int32_t s1 = hour * minute * second;
 
   s0 = force_to_fit_range (s0, 1, 2147483563);
   s1 = force_to_fit_range (s1, 1, 2147483399);
--- a/src/ChangeLog	Wed Feb 17 13:31:20 2010 +0100
+++ b/src/ChangeLog	Wed Feb 17 14:46:51 2010 -0500
@@ -1,3 +1,11 @@
+2010-02-17  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am (OCTAVE_LIBS, OCTINTERP_LINK_DEPS):
+	Include ../libcruft/libranlib.la in the list.
+	* oct-conf.h.in (OCTAVE_CONF_F77_INTEGER_8_FLAG): New macro.
+	* toplev.cc (octave_config_info): Include F77_INTEGER_8_FLAG in
+	the struct.
+
 2010-02-17  Jaroslav Hajek  <highegg@gmail.com>
 
 	* DLD-FUNCTIONS/lookup.cc (do_numeric_lookup): Return an idx_vector
--- a/src/Makefile.am	Wed Feb 17 13:31:20 2010 +0100
+++ b/src/Makefile.am	Wed Feb 17 14:46:51 2010 -0500
@@ -488,6 +488,7 @@
     ./liboctinterp.la \
     ../liboctave/liboctave.la \
     ../libcruft/libcruft.la \
+    ../libcruft/libranlib.la \
     ../libgnu/libgnu.la \
     $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS) \
     $(ARPACK_LDFLAGS) $(ARPACK_LIBS) \
@@ -513,6 +514,7 @@
     ./liboctinterp.la \
     ../liboctave/liboctave.la \
     ../libcruft/libcruft.la \
+    ../libcruft/libranlib.la \
     ../libgnu/libgnu.la \
     $(FFTW_XLDFLAGS) $(FFTW_XLIBS)
     $(QHULL_LDFLAGS) $(QHULL_LIBS) \
@@ -539,6 +541,7 @@
   $(RLD_FLAG) \
   ../liboctave/liboctave.la \
   ../libcruft/libcruft.la \
+  ../libcruft/libranlib.la \
   ../libgnu/libgnu.la \
   $(FFTW_XLDFLAGS) $(FFTW_XLIBS) \
   $(FT2_LDFLAGS) $(FT2_LIBS) \
@@ -557,6 +560,7 @@
   ./liboctinterp.la \
   ../liboctave/liboctave.la \
   ../libcruft/libcruft.la \
+  ../libcruft/libranlib.la \
   ../libgnu/libgnu.la
 
 bin_PROGRAMS = octave
--- a/src/oct-conf.h.in	Wed Feb 17 13:31:20 2010 +0100
+++ b/src/oct-conf.h.in	Wed Feb 17 14:46:51 2010 -0500
@@ -225,6 +225,10 @@
 #define OCTAVE_CONF_F77_FLOAT_STORE_FLAG %OCTAVE_CONF_F77_FLOAT_STORE_FLAG%
 #endif
 
+#ifndef OCTAVE_CONF_F77_INTEGER_8_FLAG
+#define OCTAVE_CONF_F77_INTEGER_8_FLAG %OCTAVE_CONF_F77_INTEGER_8_FLAG%
+#endif
+
 #ifndef OCTAVE_CONF_FC
 #define OCTAVE_CONF_FC %OCTAVE_CONF_FC%
 #endif
--- a/src/toplev.cc	Wed Feb 17 13:31:20 2010 +0100
+++ b/src/toplev.cc	Wed Feb 17 14:46:51 2010 -0500
@@ -1229,6 +1229,7 @@
       { false, "EXEEXT", OCTAVE_CONF_EXEEXT },
       { false, "F77", OCTAVE_CONF_F77 },
       { false, "F77_FLOAT_STORE_FLAG", OCTAVE_CONF_F77_FLOAT_STORE_FLAG },
+      { false, "F77_INTEGER_8_FLAG", OCTAVE_CONF_F77_INTEGER_8_FLAG },
       { false, "FC", OCTAVE_CONF_FC },
       { false, "FFLAGS", OCTAVE_CONF_FFLAGS },
       { false, "FFTW3_CPPFLAGS", OCTAVE_CONF_FFTW3_CPPFLAGS },