changeset 4109:6e20cac828cd

[project @ 2002-10-17 03:11:30 by jwe]
author jwe
date Thu, 17 Oct 2002 03:11:30 +0000
parents 63a5613cca00
children b9238356dd07
files ChangeLog aclocal.m4
diffstat 2 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Oct 16 22:55:24 2002 +0000
+++ b/ChangeLog	Thu Oct 17 03:11:30 2002 +0000
@@ -1,3 +1,10 @@
+2002-10-16  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* aclocal.m4 (OCTAVE_LANG_PROG_NO_CONFDEFS): New macro.
+	(OCTAVE_CXX_PRAGMA_INTERFACE_IMPLEMENTATION): Use it along with
+	AC_LINK_IFELSE instead of AC_TRY_LINK.
+	Require both programs to compile for success.
+
 2002-10-16  Paul Kienzle <pkienzle@users.sf.net>
 
 	* aclocal.m4: Both Cygwin and MinGW don't prepend underscores.
--- a/aclocal.m4	Wed Oct 16 22:55:24 2002 +0000
+++ b/aclocal.m4	Thu Oct 17 03:11:30 2002 +0000
@@ -353,8 +353,18 @@
   fi
 ])
 dnl
+dnl
+dnl
+dnl OCTAVE_LANG_PROG_NO_CONFDEFS
+AC_DEFUN(OCTAVE_LANG_PROG_NO_CONFDEFS,
+[_AC_LANG_DISPATCH([AC_LANG_PROGRAM], _AC_LANG, [$@])])
+dnl
 dnl Check to see if GNU C++ barfs on #pragma interface/#pragma implementation.
 dnl
+dnl Note that we are using AC_LINK_IFELSE and OCTAVE_LANG_PROG_NO_CONFDEFS
+dnl to prevent autoconf from including confdefs.h ahead of the #pragma
+dnl interface/implementation line.
+dnl
 dnl OCTAVE_CXX_PRAGMA_INTERFACE_IMPLEMENTATION
 AC_DEFUN(OCTAVE_CXX_PRAGMA_INTERFACE_IMPLEMENTATION, [
   AC_REQUIRE([AC_PROG_CXX])
@@ -364,9 +374,7 @@
     rm -f conftest.h
     cat > conftest.h <<EOB
 #include <iostream>
-#if defined (__GNUG__)
 #pragma interface
-#endif
 template <class T> class A
 {
 public:
@@ -381,9 +389,10 @@
   B (void) : A<int> () { }
 };
 EOB
-    AC_TRY_LINK([#include "conftest.h"], [], [
-      rm -f conftest.h
-      cat > conftest.h <<EOB
+    AC_LINK_IFELSE([OCTAVE_LANG_PROG_NO_CONFDEFS([#include "conftest.h"])],
+      [octave_pii_test_1=yes], [octave_pii_test_1=no])
+    rm -f conftest.h
+    cat > conftest.h <<EOB
 #pragma interface
 class A
 {
@@ -391,13 +400,14 @@
   virtual ~A (void) {}
 };
 EOB
-      AC_TRY_COMPILE([#pragma implementation
-#include "confdefs.h"], [],
-	octave_cv_cxx_pragma_interface_implementation=yes,
-      	octave_cv_cxx_pragma_interface_implementation=no
-	)],
+    AC_LINK_IFELSE([OCTAVE_LANG_PROG_NO_CONFDEFS([#pragma implementation
+#include "conftest.h"])],
+      [octave_pii_test_2=yes], [octave_pii_test_2=no])
+    if test $octave_pii_test_1 = yes && test $octave_pii_test_1 = yes; then
+      octave_cv_cxx_pragma_interface_implementation=yes
+    else
       octave_cv_cxx_pragma_interface_implementation=no
-    )
+    fi
     AC_LANG_POP(C++)
   ])
   AC_MSG_RESULT($octave_cv_cxx_pragma_interface_implementation)