[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help with M4 and autoconf
From: |
John W. Eaton |
Subject: |
Help with M4 and autoconf |
Date: |
Sun, 6 May 2012 15:58:52 -0400 |
On 6-May-2012, Jordi Gutiérrez Hermoso wrote:
| I'm revision at 14598:0d37fda09415, and I think the amount of repeated
| code starting in configure.ac:2269 is kinda silly. I want to fix this.
| So I wrote something like this:
|
| dnl
| dnl
| dnl OCTAVE_WARN_ABOUT_PROBLEMS(LIST-OF-PROBLEMS)
| dnl
| AC_DEFUN([OCTAVE_WARN_ABOUT_PROBLEMS], [
| m4_foreach([problem_found], [m4_set_list([$1])], [
| if test -n "$problem_found"; then
| AC_MSG_WARN([$problem_found])
| warn_msg_printed=true
| fi])
| ])
|
| So now it's just a matter of populating the list, using m4_set_add, if
| I am reading the autoconf manual correctly, which can be done with
| something like
|
| m4_set_add([list_of_problems], [warn_$1])
|
| Now, a lot of those warn_foo variables (macros?) are set in
| m4/acinclude.m4:448, in the OCTAVE_CHECK_LIBRARY function (macro?),
| some are set in various parts of configure.ac, and some I have no idea
| where they are set (e.g. warn_fftw). Is this a bug? Is warn_fftw just
| never set?
|
| I'm floundering here. I don't really understand how to use M4. Can
| someone give me some hints?
|
| The reason I started doing all this is that I noticed that ARPACK
| doesn't produce a clear warning at the end of ./configure if it's
| missing, so I'm trying to fix this the "right" way, by eliminating
| duplicate code and automating warnings about missing libraries a bit
| more.
I think something similar to the attached change should work.
The DEFUNs should probably go in acinclude.m4 instead of directly in
configure.ac.
jwe
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,19 @@
OCTAVE_HOST_TYPE
AC_DEFINE(OCTAVE_SOURCE, 1, [Define if this is Octave.])
+
+AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [
+ AC_MSG_WARN([$][$1])
+ m4_set_add([summary_warning_list], [$1])
+])
+
+AC_DEFINE([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 FIXME -- we should probably only generate this file if it is missing.
### Produce unistd.h for MSVC target, this simplifies changes in
@@ -193,7 +206,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 +230,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
@@ -2257,6 +2270,8 @@
warn_msg_printed=false
+OCTAVE_CONFIGURE_WARNING_SUMMARY
+
if $ENABLE_DYNAMIC_LINKING; then
if $SHARED_LIBS; then
true