changeset 14605:28e53daab1f8

Cleanup on autoconf warnings * acinclude.m4 (OCTAVE_CONFIGURE_WARNING, OCTAVE_CONFIGURE_WARNING_SUMMARY): New macros * configure.ac: Use these new macros. Remove copy-pasted code.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 07 May 2012 08:52:17 -0400
parents de72463862c4
children 34f067bcac12
files configure.ac m4/acinclude.m4
diffstat 2 files changed, 48 insertions(+), 187 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sun May 06 21:14:55 2012 -0400
+++ b/configure.ac	Mon May 07 08:52:17 2012 -0400
@@ -193,7 +193,7 @@
   [if test "$enableval" = no; then
      DOCDIR=
      warn_docs="building documentation disabled; make dist will fail"
-     AC_MSG_WARN([$warn_docs])
+     OCTAVE_CONFIGURE_WARNING([warn_docs])
    fi], [])
 AC_SUBST(DOCDIR)
 
@@ -217,12 +217,12 @@
       AC_DEFINE(IDX_TYPE_LONG, 1, [Define to 1 if octave index type is long])
     else
       warn_64_bit="no suitable type found for octave_idx_type so disabling 64-bit features"
-      AC_MSG_WARN([$warn_64_bit])
+      OCTAVE_CONFIGURE_WARNING([warn_64_bit])
       USE_64_BIT_IDX_T=false
     fi
   else
     warn_64_bit="pointers are not 64-bits wide so disabling 64-bit features"
-    AC_MSG_WARN([$warn_64_bit])
+    OCTAVE_CONFIGURE_WARNING([warn_64_bit])
     USE_64_BIT_IDX_T=false
   fi
 fi
@@ -286,7 +286,7 @@
 case "$gcc_version" in
   [12].*)
     warn_gcc_version="gcc version $gcc_version is likely to cause problems"
-    AC_MSG_WARN([$warn_gcc_version])
+    OCTAVE_CONFIGURE_WARNING([warn_gcc_version])
   ;;
 esac
 
@@ -834,13 +834,15 @@
 ## libraries needed for native graphics renderer
 
 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
      warn_opengl="--without-opengl specified.  Native graphics will be disabled."
-     AC_MSG_WARN([$warn_opengl])
+     OCTAVE_CONFIGURE_WARNING([warn_opengl])
+     native_graphics=false
    else
      check_opengl=true
    fi],
@@ -856,6 +858,8 @@
 if test -z "$OPENGL_LIBS"; then
   if $check_opengl; then
     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
 
@@ -868,6 +872,11 @@
     XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FT2_CFLAGS"],
     [warn_freetype="FreeType library not found.  Native graphics will be disabled."])
 
+  if test -n "$warn_freetype"; then
+    OCTAVE_CONFIGURE_WARNING([warn_freetype])
+    native_graphics=false
+  fi
+
   ## fontconfig library
 
   warn_fontconfig=""
@@ -881,6 +890,11 @@
       warn_fontconfig="Fontconfig library not found.  Native graphics will be disabled."])
   fi
 
+  if test -n "$warn_fontconfig"; then
+    OCTAVE_CONFIGURE_WARNING([warn_fontconfig])
+    native_graphics=false
+  fi
+
   ## fltk (www.fltk.org)
 
   AC_ARG_WITH([fltk-prefix], [
@@ -916,6 +930,8 @@
 
   if test "$FLTK_CONFIG" = "no" ; then
     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`"
@@ -942,6 +958,9 @@
     if test -z "$warn_fltk_opengl"; then
       GRAPHICS_CFLAGS="$FLTK_CFLAGS"
       GRAPHICS_LIBS="$FLTK_LDFLAGS"
+    else
+      OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
+      native_graphics=false
     fi
     CFLAGS="$save_CFLAGS"
   fi
@@ -1906,7 +1925,7 @@
 if test -n "$DOCDIR" && test -n "$warn_gnuplot"; then
   DOCDIR=
   warn_docs="building documentation disabled because gnuplot was not found; make dist will fail"
-  AC_MSG_WARN([$warn_docs])
+  OCTAVE_CONFIGURE_WARNING([warn_docs])
 fi
 AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test -n "$DOCDIR"])
 
@@ -2257,6 +2276,8 @@
 
 warn_msg_printed=false
 
+OCTAVE_CONFIGURE_WARNING_SUMMARY
+
 if $ENABLE_DYNAMIC_LINKING; then
   if $SHARED_LIBS; then
     true
@@ -2267,156 +2288,6 @@
   fi
 fi
 
-if test -n "$gxx_only"; then
-  AC_MSG_WARN([$gxx_only])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_gcc_version"; then
-  AC_MSG_WARN([$warn_gcc_version])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_gcc_only"; then
-  AC_MSG_WARN([$warn_gcc_only])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_readline"; then
-  AC_MSG_WARN([$warn_readline])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_termlibs"; then
-  AC_MSG_WARN([$warn_termlibs])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_gperf"; then
-  AC_MSG_WARN([$warn_gperf])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_flex"; then
-  AC_MSG_WARN([$warn_flex])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_bison"; then
-  AC_MSG_WARN([$warn_bison])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_less"; then
-  AC_MSG_WARN([$warn_less])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_umfpack"; then
-  AC_MSG_WARN([$warn_umfpack])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_qrupdate"; then
-  AC_MSG_WARN([$warn_qrupdate])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_amd"; then
-  AC_MSG_WARN([$warn_amd])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_colamd"; then
-  AC_MSG_WARN([$warn_colamd])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_ccolamd"; then
-  AC_MSG_WARN([$warn_ccolamd])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_cholmod"; then
-  AC_MSG_WARN([$warn_cholmod])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_cxsparse"; then
-  AC_MSG_WARN([$warn_cxsparse])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_curl"; then
-  AC_MSG_WARN([$warn_curl])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_fftw"; then
-  AC_MSG_WARN([$warn_fftw])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_glpk"; then
-  AC_MSG_WARN([$warn_glpk])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_magick"; then
-  AC_MSG_WARN([$warn_magick])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_hdf5"; then
-  AC_MSG_WARN([$warn_hdf5])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_regex"; then
-  AC_MSG_WARN([$warn_regex])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_pcre"; then
-  AC_MSG_WARN([$warn_pcre])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_qhull"; then
-  AC_MSG_WARN([$warn_qhull])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_zlib"; then
-  AC_MSG_WARN([$warn_zlib])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_ghostscript"; then
-  AC_MSG_WARN([$warn_ghostscript])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_texi2dvi"; then
-  AC_MSG_WARN([$warn_texi2dvi])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_texi2pdf"; then
-  AC_MSG_WARN([$warn_texi2pdf])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_docs"; then
-  AC_MSG_WARN([$warn_docs])
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_64_bit"; then
-  AC_MSG_WARN([$warn_64_bit])
-  warn_msg_printed=true
-fi
-
 if $USE_64_BIT_IDX_T; then
   AC_MSG_WARN([])
   AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.])
@@ -2447,37 +2318,6 @@
   warn_msg_printed=true
 fi
 
-native_graphics=true
-if test -n "$warn_opengl"; then
-  AC_MSG_WARN([$warn_opengl])
-  native_graphics=false
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_freetype"; then
-  AC_MSG_WARN([$warn_freetype])
-  native_graphics=false
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_fontconfig"; then
-  AC_MSG_WARN([$warn_fontconfig])
-  native_graphics=false
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_fltk_config"; then
-  AC_MSG_WARN([$warn_fltk_config])
-  native_graphics=false
-  warn_msg_printed=true
-fi
-
-if test -n "$warn_fltk_opengl"; then
-  AC_MSG_WARN([$warn_fltk_opengl])
-  native_graphics=false
-  warn_msg_printed=true
-fi
-
 if $native_graphics; then
   true;
 else
--- a/m4/acinclude.m4	Sun May 06 21:14:55 2012 -0400
+++ b/m4/acinclude.m4	Mon May 07 08:52:17 2012 -0400
@@ -406,6 +406,25 @@
 ])
 dnl
 dnl
+dnl Adds warnings to final summary
+dnl
+AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [
+  AC_MSG_WARN([$][$1])
+  m4_set_add([summary_warning_list], [$1])
+])
+dnl
+dnl
+dnl Prints final summary
+dnl
+AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [
+  m4_set_foreach([summary_warning_list], [elt], [
+    if test -n "[$]elt"; then
+      AC_MSG_WARN([$]elt)
+      warn_msg_printed=true
+    fi])
+])
+dnl
+dnl
 dnl
 dnl OCTAVE_CHECK_LIBRARY(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC,
 dnl                      LANG, DOC-STRING, EXTRA-CHECK)
@@ -446,6 +465,8 @@
 
   [TEXINFO_]m4_toupper([$1])=
   warn_$1="$3"
+  m4_set_add([summary_warning_list], [warn_$1])
+
   if test -n "$m4_toupper([$1])_LIBS"; then
     octave_check_library_save_CPPFLAGS="$CPPFLAGS"
     CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"