diff configure.ac @ 15338:dc39c1d84c5b

build: Use caching on more intermediate results to speed up configure. * configure.ac (CURLOPT_DIRLISTONLY, Magick::ColorRGB, OpenGL in FLTK): Use AC_CACHE_CHECK in code to cache intermediate results. * acinclude.m4 (OCTAVE_CHECK_LIB_TERMLIB): Switch TERM_LIB search algorithm to use AC_SERCH_LIBS which caches results.
author Rik <rik@octave.org>
date Sun, 09 Sep 2012 12:31:19 -0700
parents 719ffb2f35a6
children 95504932d422
line wrap: on
line diff
--- a/configure.ac	Sun Sep 09 00:29:00 2012 -0600
+++ b/configure.ac	Sun Sep 09 12:31:19 2012 -0700
@@ -840,18 +840,21 @@
   [cURL library not found.  The ftp objects, urlread and urlwrite functions will be disabled.],
   [curl/curl.h], [curl_easy_escape])
 if test -z "$warn_curl"; then
-  AC_MSG_CHECKING([for CURLOPT_DIRLISTONLY in curl/curl.h])
-  AC_COMPILE_IFELSE(
-    [AC_LANG_PROGRAM([[
+  ## Additional check on cURL library that was found
+  AC_CACHE_CHECK([for CURLOPT_DIRLISTONLY in curl/curl.h],
+    [octave_cv_header_define_curlopt_dirlistonly],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
       #include <curl/curl.h>
       ]], [[
       curl_easy_setopt ((CURL*)NULL, CURLOPT_DIRLISTONLY, 0);
       ]])],
-    [AC_MSG_RESULT(yes)],
-    [AC_MSG_RESULT(no)
-     AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY,
-       [Define to the legacy option name if using an older version of cURL.])]
-  )
+      [octave_cv_header_define_curlopt_dirlistonly=no],
+      [octave_cv_header_define_curlopt_dirlistonly=yes])
+    ])
+  if test $octave_cv_header_define_curlopt_dirlistonly = "yes"; then
+    AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY,
+      [Define to the legacy option name if using an older version of cURL.])]
+  fi
 fi
 LIBS="$save_LIBS"
 CPPFLAGS="$save_CPPFLAGS"
@@ -886,19 +889,21 @@
   CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS"
   LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS"
   AC_LANG_PUSH(C++)
-    AC_CHECK_HEADER([Magick++.h], [
-      AC_MSG_CHECKING([for Magick::ColorRGB in Magick++.h])
-      AC_PREPROC_IFELSE(
-        [AC_LANG_SOURCE([[
-          #include <Magick++.h>
-          ]], [[
-          Magick::ColorRGB c;
-          ]])],
-        [AC_MSG_RESULT([yes])
-         warn_magick=],
-        [AC_MSG_RESULT([no])]
-      )
-    ])
+  AC_CHECK_HEADER([Magick++.h], [
+    AC_CACHE_CHECK([for Magick::ColorRGB in Magick++.h],
+      [octave_cv_func_magick_colorrgb],
+      [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
+        #include <Magick++.h>
+        ]], [[
+        Magick::ColorRGB c;
+        ]])],
+        octave_cv_func_magick_colorrgb=yes,
+        octave_cv_func_magick_colorrgb=no)
+      ])
+    if test $octave_cv_func_magick_colorrgb = yes; then
+      warn_magick=
+    fi
+  ])
   AC_LANG_POP(C++)
   CPPFLAGS="$save_CPPFLAGS"
   LIBS="$save_LIBS"
@@ -950,17 +955,17 @@
 
 ### Check for list of libraries needed for native graphics renderer.
 
+native_graphics=true
 warn_freetype=""
-native_graphics=true
 
 check_opengl=false
 AC_ARG_WITH([opengl],
   [AS_HELP_STRING([--without-opengl],
     [don't use OpenGL libraries, disable native graphics])],
   [if test "x$withval" = xno; then
+     native_graphics=false
      warn_opengl="--without-opengl specified.  Native graphics will be disabled."
      OCTAVE_CONFIGURE_WARNING([warn_opengl])
-     native_graphics=false
    else
      check_opengl=true
    fi],
@@ -976,9 +981,9 @@
 
 if test -z "$OPENGL_LIBS"; then
   if $check_opengl; then
+    native_graphics=false
     warn_fltk_opengl="OpenGL libs (GL and GLU) not found.  Native graphics will be disabled."
     OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
-    native_graphics=false
   fi
 fi
 
@@ -1011,8 +1016,8 @@
   fi
 
   if test -n "$warn_fontconfig"; then
+    native_graphics=false
     OCTAVE_CONFIGURE_WARNING([warn_fontconfig])
-    native_graphics=false
   fi
 
   ## Check for FLTK (www.fltk.org) library
@@ -1049,9 +1054,9 @@
   warn_fltk_opengl=""
 
   if test "$FLTK_CONFIG" = "no" ; then
+    native_graphics=false
     warn_fltk_config="FLTK config script not found.  Native graphics will be disabled."
     OCTAVE_CONFIGURE_WARNING([warn_fltk_config])
-    native_graphics=false
   else
     FLTK_CFLAGS="`$FLTK_CONFIG $fltkconf_args --use-gl --cflags`"
     FLTK_LDFLAGS="`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags`"
@@ -1062,24 +1067,32 @@
       ;;
     esac
 
-    AC_MSG_CHECKING([for OpenGL support in FLTK])
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $FLTK_CFLAGS"
-    AC_COMPILE_IFELSE(
-      [AC_LANG_PROGRAM([[#include <FL/gl.h>]], [[int nothing = 0;]])],
-      [AC_MSG_RESULT([no])
-       warn_fltk_opengl="FLTK does not have OpenGL support.  Native graphics will be disabled."],
-      [AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.])])
-         
+    AC_CACHE_CHECK([for OpenGL support in FLTK],
+      [octave_cv_fltk_opengl_support],
+      [save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS $FLTK_CFLAGS"
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+        #include <FL/gl.h>
+        ]], [[
+        int nothing = 0;
+        ]])],
+        octave_cv_fltk_opengl_support=no,
+        octave_cv_fltk_opengl_support=yes)
+      CFLAGS="$save_CFLAGS"
+      ])
+    if test $octave_cv_fltk_opengl_support = no; then
+      warn_fltk_opengl="FLTK does not have OpenGL support.  Native graphics will be disabled."
+    else
+      AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.])
+    fi 
+
     if test -z "$warn_fltk_opengl"; then
       GRAPHICS_CFLAGS="$FLTK_CFLAGS"
       GRAPHICS_LIBS="$FLTK_LDFLAGS"
     else
+      native_graphics=false
       OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
-      native_graphics=false
     fi
-    CFLAGS="$save_CFLAGS"
   fi
 fi