changeset 3126:0f6ec7b761a6

[project @ 1998-01-16 05:15:43 by jwe]
author jwe
date Fri, 16 Jan 1998 05:15:44 +0000
parents dcc6c985d72d
children d6ebd123170a
files ChangeLog Makeconf.in aclocal.m4 configure.in
diffstat 4 files changed, 111 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 16 05:11:09 1998 +0000
+++ b/ChangeLog	Fri Jan 16 05:15:44 1998 +0000
@@ -1,7 +1,19 @@
+Thu Jan 15 23:12:27 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* aclocal.m4 (OCTAVE_CC_FLAG, OCTAVE_CXX_FLAG): New macros.
+	* configure.in: Use them to find out if the C and C++ compilers
+	support -mieee-fp, -mieee, -fno-implicit-templates, and
+	-fno-exceptions instead of relying on version information.  Add
+	found flags to XTRA_CFLAGS and XTRA_CXXFLAGS instead of using
+	GCC_IEEE_FP_FLAG and NO_IMPLICIT_TEMPLATES.
+	Delete unused variable HOST_CXXFLAGS.
+	* Makeconf.in: Use XTRA_CFLAGS and XTRA_CXXFLAGS instead of
+	GCC_IEEE_FP_FLAG and NO_IMPLICIT_TEMPLATES.
+	Delete unused variable HOST_CXXFLAGS.
+
 Thu Dec 11 09:43:56 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
-	* config.h.bot: Define DYNAMIC_CAST and REINTERPRET_CAST using new
-	style for casts.  Define CONST_CAST and STATIC_CAST too.
+	* config.h.bot: Define CONST_CAST and STATIC_CAST too.
 
 	* configure.in (SH_LD): Set default to $CXX, not $CC.
 
--- a/Makeconf.in	Fri Jan 16 05:11:09 1998 +0000
+++ b/Makeconf.in	Fri Jan 16 05:15:44 1998 +0000
@@ -102,29 +102,25 @@
 CC_VERSION = @CC_VERSION@
 CFLAGS = @CFLAGS@
 CPICFLAG = @CPICFLAG@
-GCC_IEEE_FP_FLAG = @GCC_IEEE_FP_FLAG@
-ALL_CFLAGS = $(INCFLAGS) $(DEFS) $(GCC_IEEE_FP_FLAG) $(CFLAGS)
-BUG_CFLAGS = $(DEFS) $(GCC_IEEE_FP_FLAG) $(CFLAGS)
+XTRA_CFLAGS = @XTRA_CFLAGS@
+ALL_CFLAGS = $(INCFLAGS) $(DEFS) $(XTRA_CFLAGS) $(CFLAGS)
+BUG_CFLAGS = $(DEFS) $(XTRA_CFLAGS) $(CFLAGS)
 
 CXX = @CXX@
 CXX_VERSION = @CXX_VERSION@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CXXPICFLAG = @CXXPICFLAG@
-NO_IMPLICIT_TEMPLATES = @NO_IMPLICIT_TEMPLATES@
-HOST_CXXFLAGS = @HOST_CXXFLAGS@
-ALL_CXXFLAGS = $(INCFLAGS) $(DEFS) $(HOST_CXXFLAGS) \
-	$(NO_IMPLICIT_TEMPLATES) $(GCC_IEEE_FP_FLAG) $(CXXFLAGS)
-UGLY_ALL_CXXFLAGS = $(INCFLAGS) $(UGLY_DEFS) $(HOST_CXXFLAGS) \
-	$(NO_IMPLICIT_TEMPLATES) $(GCC_IEEE_FP_FLAG) $(CXXFLAGS)
-BUG_CXXFLAGS = $(DEFS) $(HOST_CXXFLAGS) $(NO_IMPLICIT_TEMPLATES) \
-	$(GCC_IEEE_FP_FLAG) $(CXXFLAGS)
+XTRA_CXXFLAGS = @XTRA_CXXFLAGS@
+ALL_CXXFLAGS = $(INCFLAGS) $(DEFS) $(XTRA_CXXFLAGS) $(CXXFLAGS)
+UGLY_ALL_CXXFLAGS = $(INCFLAGS) $(UGLY_DEFS) $(XTRA_CXXFLAGS) $(CXXFLAGS)
+BUG_CXXFLAGS = $(DEFS) $(XTRA_CXXFLAGS) $(CXXFLAGS)
 
 CPPFLAGS = @CPPFLAGS@
 
 LDFLAGS = @LDFLAGS@
 LD_STATIC_FLAG = @LD_STATIC_FLAG@
-ALL_LDFLAGS = $(LIBFLAGS) $(FORTRAN_MAIN_FLAG) $(GCC_IEEE_FP_FLAG) \
+ALL_LDFLAGS = $(LIBFLAGS) $(FORTRAN_MAIN_FLAG) \
 	$(LD_STATIC_FLAG) $(CPICFLAG) $(LDFLAGS)
 
 SH_LD = @SH_LD@
@@ -326,8 +322,6 @@
   -e "s;%FFLAGS%;\"${FFLAGS}\";" \
   -e "s;%FLIBS%;\"${FLIBS}\";" \
   -e "s;%FPICFLAG%;\"${FPICFLAG}\";" \
-  -e "s;%GCC_IEEE_FP_FLAG%;\"${GCC_IEEE_FP_FLAG}\";" \
-  -e "s;%HOST_CXXFLAGS%;\"${HOST_CXXFLAGS}\";" \
   -e "s;%INCFLAGS%;\"-I${octincludedir} -I${includedir}\";" \
   -e "s;%LDFLAGS%;\"${LDFLAGS}\";" \
   -e "s;%LEXLIB%;\"${LEXLIB}\";" \
@@ -335,7 +329,6 @@
   -e "s;%LIBFLAGS%;\"-L${libdir}\";" \
   -e "s;%LIBPLPLOT%;\"${LIBPLPLOT}\";" \
   -e "s;%LIBS%;\"${LIBS}\";" \
-  -e "s;%NO_IMPLICIT_TEMPLATES%;\"${NO_IMPLICIT_TEMPLATES}\";" \
   -e "s;%RLD_FLAG%;\"${RLD_FLAG}\";" \
   -e "s;%SH_LD%;\"${SH_LD}\";" \
   -e "s;%SH_LDFLAGS%;\"${SH_LDFLAGS}\";" \
--- a/aclocal.m4	Fri Jan 16 05:11:09 1998 +0000
+++ b/aclocal.m4	Fri Jan 16 05:15:44 1998 +0000
@@ -604,3 +604,57 @@
     AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL)
   fi
 ])
+dnl
+dnl Check to see if C compiler handles FLAG command line option and
+dnl add it to CFLAGS if it does.
+dnl
+dnl OCTAVE_CC_FLAG
+AC_DEFUN(OCTAVE_CC_FLAG, [
+  ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
+  AC_MSG_CHECKING(whether ${CC-cc} accepts $1)
+  AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [
+    AC_LANG_SAVE
+    AC_LANG_C
+    XCFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $1"
+    AC_TRY_LINK([], [],
+      eval "octave_cv_cc_flag_$ac_safe=yes",
+      eval "octave_cv_cc_flag_$ac_safe=no")
+    CFLAGS="$XCFLAGS"
+    AC_LANG_RESTORE
+  ])
+  if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then
+    AC_MSG_RESULT(yes)
+    ifelse([$2], , [CFLAGS="$CFLAGS $1"], [$2])
+  else
+    AC_MSG_RESULT(no)
+    ifelse([$3], , , [$3])
+  fi
+])
+dnl
+dnl Check to see if C++ compiler handles FLAG command line option and
+dnl add it to CXXFLAGS if it does.
+dnl
+dnl OCTAVE_CXX_FLAG
+AC_DEFUN(OCTAVE_CXX_FLAG, [
+  ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
+  AC_MSG_CHECKING(whether ${CXX-c++} accepts $1)
+  AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    XCXXFLAGS="$CXXFLAGS"
+    CXXFLAGS="$CXXFLAGS $1"
+    AC_TRY_LINK([], [],
+      eval "octave_cv_cxx_flag_$ac_safe=yes",
+      eval "octave_cv_cxx_flag_$ac_safe=no")
+    CXXFLAGS="$XCXXFLAGS"
+    AC_LANG_RESTORE
+  ])
+  if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then
+    AC_MSG_RESULT(yes)
+    ifelse([$2], , [CXXFLAGS="$CXXFLAGS $1"], [$2])
+  else
+    AC_MSG_RESULT(no)
+    ifelse([$3], , , [$3])
+  fi
+])
--- a/configure.in	Fri Jan 16 05:11:09 1998 +0000
+++ b/configure.in	Fri Jan 16 05:15:44 1998 +0000
@@ -21,7 +21,7 @@
 ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 ### 02111-1307, USA. 
 
-AC_REVISION($Revision: 1.291 $)
+AC_REVISION($Revision: 1.292 $)
 AC_PREREQ(2.9)
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h)
@@ -182,7 +182,6 @@
 ### Do special things for g++.
 
 ADD_CXX_WALL=false
-NO_IMPLICIT_TEMPLATES=
 
 gxx_version=`$CXX -v 2>&1 | grep "^.*g.. version" | \
   sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//'`
@@ -199,8 +198,6 @@
     if test -z "$EXTERN_CXXFLAGS"; then
       ADD_CXX_WALL=true
     fi
-    NO_IMPLICIT_TEMPLATES="-fno-implicit-templates"
-    AC_MSG_RESULT([defining NO_IMPLICIT_TEMPLATES to be $NO_IMPLICIT_TEMPLATES])
   ;;
 changequote(,)dnl
   2.[89].* | 2.[123456789][0123456789].*)
@@ -208,8 +205,6 @@
     if test -z "$EXTERN_CXXFLAGS"; then
       ADD_CXX_WALL=true
     fi
-    NO_IMPLICIT_TEMPLATES="-fno-implicit-templates"
-    AC_MSG_RESULT([defining NO_IMPLICIT_TEMPLATES to be $NO_IMPLICIT_TEMPLATES])
   ;;
   *)
     warn_gxx_only="Octave has only been tested with g++, and I can't find it"
@@ -223,9 +218,6 @@
 fi
 AC_SUBST(CXX_VERSION)
 
-AC_SUBST(HOST_CXXFLAGS)
-AC_SUBST(NO_IMPLICIT_TEMPLATES)
-
 OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
 
 ### See which C compiler to use (we expect to find gcc).
@@ -270,35 +262,44 @@
 ### On Intel systems with gcc, we may need to compile with -mieee-fp to
 ### get full support for IEEE floating point.
 ###
-### On Alpha/OSF systems, wee need -mieee, but that also
-### requires gcc 2.8.x or later.
+### On Alpha/OSF systems, we need -mieee.
 
-GCC_IEEE_FP_FLAG=
+ieee_fp_flag=
 case "$canonical_host_type" in
 changequote(,)dnl
   i[3456789]86-*-*)
 changequote([,])dnl
-    XCFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -mieee-fp"
-    AC_TRY_LINK([], [], [GCC_IEEE_FP_FLAG="-mieee-fp"], [])
-    CFLAGS="$XCFLAGS"
+    OCTAVE_CC_FLAG(-mieee-fp, [
+      ieee_fp_flag=-mieee-fp
+      XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp"])
+
+    OCTAVE_CXX_FLAG(-mieee-fp, [
+      ieee_fp_flag=-mieee-fp
+      XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp"])
   ;;
-  alpha-dec-osf*)
-    case "$gcc_version" in
-changequote(,)dnl
-      1.* | 2.[01234567].*)
-changequote([,])dnl
-      ;;
-      *)
-        GCC_IEEE_FP_FLAG="-mieee"
-      ;;
-    esac
+  alpha-*-*)
+    OCTAVE_CC_FLAG(-mieee, [
+      ieee_fp_flag=-mieee
+      XTRA_CFLAGS="$XTRA_CFLAGS -mieee"])
+    OCTAVE_CXX_FLAG(-mieee, [
+      ieee_fp_flag=-mieee
+      XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee"])
   ;;
 esac
-if test -n "$GCC_IEEE_FP_FLAG"; then
-  AC_MSG_RESULT([defining GCC_IEEE_FP_FLAG to be $GCC_IEEE_FP_FLAG])
-fi
-AC_SUBST(GCC_IEEE_FP_FLAG)
+
+### Octave doesn't use exceptions yet, so disable them for somewhat
+### faster and smaller code.
+
+OCTAVE_CXX_FLAG(-fno-exceptions,
+  [XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-exceptions"])
+
+### We do our own template instantiation.
+
+OCTAVE_CXX_FLAG(-fno-implicit-templates,
+  [XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-implicit-templates"])
+
+AC_SUBST(XTRA_CFLAGS)
+AC_SUBST(XTRA_CXXFLAGS)
 
 ### Use -static if compiling on Alpha OSF/1 1.3 systems.
 
@@ -402,8 +403,8 @@
         FFLAGS="-O"
       fi
       case "$canonical_host_type" in
-        alpha-dec-osf*)
-          if $f77_is_g77 || test -z "$GCC_IEEE_FP_FLAG"; then
+        alpha-*-*)
+          if $f77_is_g77 || test -z "$ieee_fp_flag" ; then
             true
 	  else
 	    FFLAGS="-fpe1 $FFLAGS"
@@ -857,9 +858,6 @@
 
 ### Check to see if we have IEEE math functions, and if so, which ones.
 ###
-### For Linux: add -mieee-fp flag to CFLAGS when checking for IEEE FP
-### functions, otherwise we may not find them.
-###
 ### Also check for some additional trig functions that aren't ANSI but
 ### are often available.  If they are missing, we try to replace them
 ### with functions from the BSD/NET2 math library.
@@ -877,9 +875,6 @@
   ;;
 esac
 
-XCFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $GCC_IEEE_FP_FLAG"
-
 ### I am told that Inf and NaN don't work on m68k HP sytems, and that
 ### on SCO systems, isnan and isinf don't work, but they can be
 ### replaced by something that does.
@@ -904,8 +899,6 @@
 
 AC_CHECK_FUNCS(acosh asinh atanh erf erfc gamma lgamma)
 
-CFLAGS="$XCFLAGS"
-
 ### Checks for OS specific cruft.
 
 AC_STRUCT_ST_BLKSIZE
@@ -1209,8 +1202,6 @@
 
 ### Print a summary so that important information isn't missed.
 
-CXX_EXTRAS="$HOST_CXXFLAGS $NO_IMPLICIT_TEMPLATES $GCC_IEEE_FP_FLAG"
-
 if test -z "$F77"; then
   FORT="$F2C $F2CFLAGS"
 else
@@ -1223,8 +1214,8 @@
 
   Source directory:     $srcdir
   Installation prefix:  $prefix
-  C compiler:           $CC $GCC_IEEE_FP_FLAG $CFLAGS
-  C++ compiler:         $CXX $CXX_EXTRAS $CXXFLAGS
+  C compiler:           $CC $XTRA_CFLAGS $CFLAGS
+  C++ compiler:         $CXX $XTRA_CXXFLAGS $CXXFLAGS
   Fortran compiler:     $FORT
   Fortran libraries:    $FLIBS
   Use GNU readline:     $USE_READLINE