Mercurial > hg > octave-lyh
changeset 9596:f26229391ea1
configure.in, aclocal.m4: check fortran integer size
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 01 Sep 2009 14:36:16 -0400 |
parents | dbd0c0f82480 |
children | a32f70d8d146 |
files | ChangeLog aclocal.m4 configure.in |
diffstat | 3 files changed, 155 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-09-01 John W. Eaton <jwe@octave.org> + + * aclocal.m4 (OCTAVE_REQUIRE_64_BIT_FORTRAN_INTEGERS): New macro. + * configure.in: Use it, if building with --enable-64. + Move checks for Fortran compiler ahead of checks for libraries. + 2009-09-01 Jaroslav Hajek <highegg@gmail.com> * NEWS: Update.
--- a/aclocal.m4 +++ b/aclocal.m4 @@ -428,6 +428,57 @@ fi ]) dnl +dnl Check to see whether the default Fortran INTEGER is 64 bits wide. +dnl +AC_DEFUN(OCTAVE_CHECK_FORTRAN_INTEGER_SIZE, [ + AC_LANG_PUSH(Fortran 77) + AC_CACHE_CHECK([whether $F77 generates correct size integers], + [octave_cv_fortran_integer_size], +[AC_COMPILE_IFELSE( +[ subroutine foo(n, in, out) + integer n, in(n), out(n) + integer i + do 10 i = 1, n + out(i) = in(i) + 10 continue + return + end], +[mv conftest.$ac_objext fintsize.$ac_objext + + octave_fintsize_save_LIBS="$LIBS" + LIBS="fintsize.$ac_objext $[]_AC_LANG_PREFIX[]LIBS" + AC_LANG_PUSH(C)dnl + AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <assert.h>]], [[ +#ifdef USE_64_BIT_IDX_T +#if IDX_TYPE_LONG + typedef long octave_idx_type; +#else + typedef int octave_idx_type; +#endif +#else + typedef int octave_idx_type; +#endif + octave_idx_type n = 2; + octave_idx_type in[2]; + octave_idx_type out[2]; + in[0] = 13; + in[0] = 42; + F77_FUNC(foo,FOO) (&n, &in, &out); + assert (in[0] == out[0] && in[1] == out[1]); +]])], + [octave_cv_fortran_integer_size=yes], + [octave_cv_fortran_integer_size=no]) + AC_LANG_POP(C)dnl + +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) +]) +dnl dnl dnl dnl OCTAVE_CHECK_LIBRARY(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC,
--- a/configure.in +++ b/configure.in @@ -412,6 +412,8 @@ AC_ARG_VAR(BUILD_EXEEXT, [build system executable extension (used if cross compiling)]) dnl This is bogus. We shouldn't have to explicitly add libc too! +dnl Keep this check before the check for the Fortran compiler, +dnl in case -lm is needed to compile Fortran programs. ### Look for math library. If found, this will add -lm to LIBS. @@ -426,6 +428,102 @@ ;; esac +## Default FFLAGS is -O. +if test "x$FFLAGS" = x; then + FFLAGS="-O" +fi + +## the F77 variable, if set, overrides AC_PROG_F77 automatically +AC_PROG_F77 +AC_F77_LIBRARY_LDFLAGS +AC_F77_DUMMY_MAIN +AC_F77_WRAPPERS + +F77_TOLOWER=true +F77_APPEND_UNDERSCORE=true +F77_APPEND_EXTRA_UNDERSCORE=true + +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]) +fi + +AC_SUBST(F77_TOLOWER) +AC_SUBST(F77_APPEND_UNDERSCORE) +AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE) + +if test -z "$F77"; then + AC_MSG_ERROR([in order to build octave, you must have a compatible Fortran compiler or wrapper script for f2c that functions as a Fortran compiler installed and in your path. See the file INSTALL for more information.]) +fi + +OCTAVE_CHECK_FORTRAN_INTEGER_SIZE +if test "x$octave_cv_fortran_integer_size" = xno; then + if $USE_64_BIT_IDX_T; then + case "$F77" in + gfortran) + case "$FFLAGS" 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 + ;; + esac + ;; + esac + if test -z "$octave_cv_fortran_integer_size"; then + 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.]) + 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.]) + fi +fi + +FC=$F77 +AC_SUBST(FC) + +OCTAVE_F77_FLAG(-ffloat-store, [ +AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store]) +F77_FLOAT_STORE_FLAG=-ffloat-store +AC_SUBST(F77_FLOAT_STORE_FLAG) +]) + +OCTAVE_IEEE754_DATA_FORMAT + ### Check for the QHull library OCTAVE_CHECK_LIBRARY(qhull, QHull, @@ -753,74 +851,12 @@ AC_SUBST(GRAPHICS_CFLAGS) AC_SUBST(GRAPHICS_LIBS) -OCTAVE_IEEE754_DATA_FORMAT - # ---------------------------------------------------------------------- OCTAVE_PROG_AR AC_PROG_RANLIB -## Default FFLAGS is -O. -if test "x$FFLAGS" = x; then - FFLAGS="-O" -fi - -## the F77 variable, if set, overrides AC_PROG_F77 automatically -AC_PROG_F77 -AC_F77_LIBRARY_LDFLAGS -AC_F77_DUMMY_MAIN -AC_F77_WRAPPERS - -F77_TOLOWER=true -F77_APPEND_UNDERSCORE=true -F77_APPEND_EXTRA_UNDERSCORE=true - -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]) -fi - -AC_SUBST(F77_TOLOWER) -AC_SUBST(F77_APPEND_UNDERSCORE) -AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE) - -if test -z "$F77"; then - AC_MSG_WARN([in order to build octave, you must have a compatible]) - 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 - XTRA_CRUFT_SH_LDFLAGS= case "$canonical_host_type" in *-*-msdosmsvc) @@ -830,15 +866,6 @@ esac AC_SUBST(XTRA_CRUFT_SH_LDFLAGS) -FC=$F77 -AC_SUBST(FC) - -OCTAVE_F77_FLAG(-ffloat-store, [ -AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store]) -F77_FLOAT_STORE_FLAG=-ffloat-store -AC_SUBST(F77_FLOAT_STORE_FLAG) -]) - ### Checks for BLAS and LAPACK libraries: # (Build subdirectories of libcruft if they aren't found on the system.) sinclude(acx_blas.m4)