changeset 8635:bef8f001032f

Further improvements for OCTAVE_HAVE_FRAMEWORK and the test for the MacOSX Carbon framework.
author Thomas Treichl <Thomas.Treichl@gmx.net>
date Thu, 29 Jan 2009 22:01:49 +0100
parents cbd6545b0d85
children ee70d438a5b4
files ChangeLog aclocal.m4 configure.in
diffstat 3 files changed, 32 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jan 29 14:52:38 2009 -0500
+++ b/ChangeLog	Thu Jan 29 22:01:49 2009 +0100
@@ -1,3 +1,10 @@
+2009-01-29  Thomas Treichl  <Thomas.Treichl@gmx.net>
+
+	* aclocal.m4 (OCTAVE_HAVE_FRAMEWORK): Add support for 
+	--with-framework-<name> and replace "$ac_safe" by "$1".
+	* configure.in: Change "have_carbon" with 
+	"have_framework_carbon".
+
 2009-01-28  John W. Eaton  <jwe@octave.org>
 
 	* configure.in: Check to see that pcre library has pcre_compile
--- a/aclocal.m4	Thu Jan 29 14:52:38 2009 -0500
+++ b/aclocal.m4	Thu Jan 29 22:01:49 2009 +0100
@@ -1272,25 +1272,37 @@
 AC_LANG_POP(C++)])
 dnl
 dnl Check to see if the compiler and the linker can handle the flags
-dnl "-framework $1" for the given prologue $2 and the given body $3
-dnl of a source file.  Arguments 2 and 3 optionally can also be empty.
-dnl If this test is dnl successful then perform $4, otherwise do $5.
+dnl "-framework $1" for the given prologue $2 and the given body $3 of
+dnl a source file.  Arguments 2 and 3 optionally can also be empty.
+dnl Add options (lower case letters $1) "--with-framework-$1" and
+dnl "--without-framework-$1". If this test is successful then perform
+dnl $4, otherwise do $5.
 dnl
 dnl OCTAVE_HAVE_FRAMEWORK
 AC_DEFUN(OCTAVE_HAVE_FRAMEWORK, [
-  ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'`
   AC_MSG_CHECKING(whether ${LD-ld} accepts -framework $1)
-  AC_CACHE_VAL(octave_cv_framework_$ac_safe, [
+  AC_CACHE_VAL(octave_cv_framework_$1, [
     XLDFLAGS="$LDFLAGS"
     LDFLAGS="$LDFLAGS -framework $1"
+    AC_LANG_PUSH(C++)
     AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
-      eval "octave_cv_framework_$ac_safe=yes",
-      eval "octave_cv_framework_$ac_safe=no")
+      eval "octave_cv_framework_$1=yes",
+      eval "octave_cv_framework_$1=no")
+    AC_LANG_POP(C++)
     LDFLAGS="$XLDFLAGS"
   ])
-  if eval "test \"`echo '$octave_cv_framework_'$ac_safe`\" = yes"; then
+  if test "$octave_cv_framework_$1" = "yes"; then
     AC_MSG_RESULT(yes)
-    [$4]
+    AC_ARG_WITH(framework-m4_tolower($1),
+      [AS_HELP_STRING([--without-framework-m4_tolower($1)], 
+        [don't use framework $1])],
+         with_have_framework=$withval, with_have_framework="yes")
+    if test "$with_have_framework" = "yes"; then
+      [$4]
+    else
+      AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)])
+      [$5]
+    fi
   else
     AC_MSG_RESULT(no)
     [$5]
--- a/configure.in	Thu Jan 29 14:52:38 2009 -0500
+++ b/configure.in	Thu Jan 29 22:01:49 2009 +0100
@@ -272,11 +272,11 @@
 
 ### On MacOSX system the Carbon framework is used to determine ScreenSize
 OCTAVE_HAVE_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>], [CGMainDisplayID ()],
-  [have_carbon="yes"], [have_carbon="no"])
-if test $have_carbon = "yes"; then
+  [have_framework_carbon="yes"], [have_framework_carbon="no"])
+if test $have_framework_carbon = "yes"; then
   AC_DEFINE(HAVE_FRAMEWORK_CARBON, 1, [Define if framework CARBON is available.])
-  LDFLAGS="$LDFLAGS -Wl,-framework -Wl,Carbon"
-  AC_MSG_NOTICE([adding -Wl,-framework -Wl,Carbon to LDFLAGS])
+  LIBS="$LIBS -Wl,-framework -Wl,Carbon"
+  AC_MSG_NOTICE([adding -Wl,-framework -Wl,Carbon to LIBS])
 fi
 
 ### On Intel systems with gcc, we may need to compile with -mieee-fp