changeset 3222:dae85431bade

[project @ 1998-11-19 22:14:06 by jwe]
author jwe
date Thu, 19 Nov 1998 22:14:09 +0000
parents eba59b8c64dc
children 3ee04ff37b3e
files ChangeLog acconfig.h aclocal.m4 configure.in src/ChangeLog src/dynamic-ld.cc
diffstat 6 files changed, 65 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Nov 19 16:07:57 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* aclocal.m4 (OCTAVE_CXX_PREPENDS_UNDERSCORE): New macro.
+	* configure.in: Use it.
+	* acconfig.h: Add #undef for it.
+
 Thu Nov 12 10:42:25 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* emacs/otags: New script from Mario Storti
--- a/acconfig.h
+++ b/acconfig.h
@@ -17,6 +17,9 @@
 /* Define if your compiler supports `<>' stuff for template friends. */
 #undef CXX_NEW_FRIEND_TEMPLATE_DECL
 
+/* Define if your compiler prepends underscores to external names. */
+#undef CXX_PREPENDS_UNDERSCORE
+
 /* Define if your math.h declares struct exception for matherr() */
 #undef EXCEPTION_IN_MATH
 
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -710,7 +710,7 @@
 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_MSG_CHECKING(whether ${CXX-g++} accepts $1)
   AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [
     AC_LANG_SAVE
     AC_LANG_CPLUSPLUS
@@ -807,6 +807,7 @@
 dnl
 dnl Is DejaGNU installed?
 dnl
+dnl OCTAVE_PROG_RUNTEST
 AC_DEFUN(OCTAVE_PROG_RUNTEST,
 [if test "$cross_compiling" = yes; then
   RUNTEST=runtest
@@ -821,3 +822,45 @@
   AC_SUBST(RUNTEST)
 fi
 ])
+dnl
+dnl Find nm.
+dnl
+dnl OCTAVE_PROG_NM
+AC_DEFUN(OCTAVE_PROG_NM,
+[if test "$cross_compiling" = yes; then
+  NM=nm
+  AC_MSG_RESULT(assuming $NM exists on $canonical_host_type host)
+  AC_SUBST(NM)
+else
+  AC_CHECK_PROG(NM, nm, nm, [])
+  AC_SUBST(NM)
+fi
+])
+dnl
+dnl See if the C++ compiler prepends an underscore to external names.
+dnl
+dnl OCTAVE_CXX_PREPENDS_UNDERSCORE
+AC_DEFUN(OCTAVE_CXX_PREPENDS_UNDERSCORE,
+[AC_MSG_CHECKING([whether ${CXX-g++} prepends an underscore to external names])
+  AC_CACHE_VAL(octave_cv_cxx_prepends_underscore,
+    [octave_cv_cxx_prepends_underscore=no
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    cat > conftest.$ac_ext <<EOF
+bool FSmy_dld_fcn (void) { }
+EOF
+    if AC_TRY_EVAL(ac_compile); then
+      if test "`${NM-nm} conftest.o | grep _FSmy_dld_fcn`" != ""; then
+        octave_cv_cxx_prepends_underscore=yes
+      fi
+    else
+      echo "configure: failed program was:" >&AC_FD_CC
+      cat conftest.$ac_ext >&AC_FD_CC
+    fi
+    AC_LANG_RESTORE
+  ])
+  AC_MSG_RESULT($octave_cv_cxx_prepends_underscore)
+  if test $octave_cv_cxx_prepends_underscore = yes; then
+    AC_DEFINE(CXX_PREPENDS_UNDERSCORE)
+  fi
+])
--- a/configure.in
+++ b/configure.in
@@ -21,7 +21,7 @@
 ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 ### 02111-1307, USA. 
 
-AC_REVISION($Revision: 1.311 $)
+AC_REVISION($Revision: 1.312 $)
 AC_PREREQ(2.9)
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h)
@@ -296,6 +296,8 @@
 fi
 AC_SUBST(LD_STATIC_FLAG)
 
+OCTAVE_CXX_PREPENDS_UNDERSCORE
+
 ### We need these before trying to find libf2c.
 
 OCTAVE_PROG_AR
@@ -1067,6 +1069,7 @@
 
 AC_PROG_LN_S
 
+OCTAVE_PROG_NM
 OCTAVE_PROG_RUNTEST
 
 AC_PROG_INSTALL
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
 Thu Nov 19 14:30:25 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* dynamic-ld.cc (octave_dynamic_loader::mangle_name):
+	Prepend underscore here.
+	(octave_dynamic_loader::load_fcn_from_dot_oct_file): Not here.
+
 	* ov-re-mat.h (octave_matrix_value): Delete experimental code for
 	handling structure references for things like .rows, .cols, etc.
 
--- a/src/dynamic-ld.cc
+++ b/src/dynamic-ld.cc
@@ -240,24 +240,6 @@
       builtin_fcn_installer f
 	= instance->resolve_reference (mangled_name, oct_file);
 
-
-      // XXX FIXME XXX -- this should probably be handled correctly by
-      // mangle_octave_oct_file_name using a configure test.
-
-      // Perhaps we should always check for both forms of the name and
-      // issue a warning if they both exist?  (I still think it would
-      // be best to use some configure test to determine exactly what
-      // form of the symbol name we should be looking for...)
-
-      if (! f)
-	{
-	  string t = "_";
-
-	  mangled_name = t.append (mangled_name);
-
-	  f = instance->resolve_reference (mangled_name, oct_file);
-	}
-
       if (f)
 	retval = f ();
     }
@@ -274,7 +256,11 @@
 string
 octave_dynamic_loader::mangle_name (const string& name)
 {
+#if defined (CXX_PREPENDS_UNDERSCORE)
+  string retval ("_FS");
+#else
   string retval ("FS");
+#endif
   retval.append (name);
   retval.append ("__Fv");
   return retval;