[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
m4/*_h.m4: improve idioms
From: |
Bruno Haible |
Subject: |
m4/*_h.m4: improve idioms |
Date: |
Sat, 27 Sep 2008 19:15:31 +0200 |
User-agent: |
KMail/1.5.4 |
Hi Simon, Eric,
I find it a bit hard to maintain the autoconf macros when a variable initialized
by one .m4 file is assigned in another .m4 file. It's easier if every variable
is only touched in a single .m4 file.
I'm applying this for iconv_h.m4 and m4/wchar.m4. Actually, for iconv_h.m4
this fixes a bug: if gl_REPLACE_ICONV_OPEN happened to expand before
gl_ICONV_H, the final value of ICONV_H was wrong.
Simon, is the part for m4/arpa_inet_h.m4 fine with you? (Not yet committed.)
Bruno
2008-09-27 Bruno Haible <address@hidden>
* m4/arpa_inet_h.m4 (gl_REPLACE_ARPA_INET_H): New macro.
* m4/inet_ntop.m4 (gl_INET_NTOP): Invoke it instead of assigning
ARPA_INET_H directly.
* m4/inet_pton.m4 (gl_INET_PTON): Likewise.
* m4/iconv_h.m4 (gl_REPLACE_ICONV_H): New macro.
(gl_ICONV_H_DEFAULTS): Initialize ICONV_H here...
(gl_ICONV_H): Not here.
* m4/iconv_open.m4 (gl_REPLACE_ICONV_OPEN): Invoke gl_REPLACE_ICONV_H
instead of assigning ICONV_H directly.
* m4/wchar.m4 (gl_REPLACE_WCHAR_H): New macro.
* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Invoke it instead of assigning
WCHAR_H directly.
--- m4/arpa_inet_h.m4.orig 2008-09-27 18:54:43.000000000 +0200
+++ m4/arpa_inet_h.m4 2008-09-27 18:45:38.000000000 +0200
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 4
+# arpa_inet_h.m4 serial 5
dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,13 @@
gl_CHECK_NEXT_HEADERS([arpa/inet.h])
])
+dnl Unconditionally enables the replacement of <arpa/inet.h>.
+AC_DEFUN([gl_REPLACE_ARPA_INET_H],
+[
+ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+ ARPA_INET_H='arpa/inet.h'
+)
+
AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- m4/inet_ntop.m4.orig 2008-09-27 18:54:43.000000000 +0200
+++ m4/inet_ntop.m4 2008-09-27 18:45:23.000000000 +0200
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 6
+# inet_ntop.m4 serial 7
dnl Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,7 @@
dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
- ARPA_INET_H='arpa/inet.h'
+ gl_REPLACE_ARPA_INET_H
AC_REPLACE_FUNCS(inet_ntop)
gl_PREREQ_INET_NTOP
--- m4/inet_pton.m4.orig 2008-09-27 18:54:43.000000000 +0200
+++ m4/inet_pton.m4 2008-09-27 18:45:28.000000000 +0200
@@ -1,4 +1,4 @@
-# inet_pton.m4 serial 5
+# inet_pton.m4 serial 6
dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,7 @@
dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
- ARPA_INET_H='arpa/inet.h'
+ gl_REPLACE_ARPA_INET_H
AC_REPLACE_FUNCS(inet_pton)
gl_PREREQ_INET_PTON
--- m4/iconv_h.m4.orig 2008-09-27 18:54:43.000000000 +0200
+++ m4/iconv_h.m4 2008-09-27 18:49:05.000000000 +0200
@@ -1,5 +1,5 @@
-# iconv_h.m4 serial 3
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# iconv_h.m4 serial 4
+dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -8,8 +8,13 @@
[
AC_REQUIRE([gl_ICONV_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([iconv.h])
- ICONV_H=
- AC_SUBST([ICONV_H])
+])
+
+dnl Unconditionally enables the replacement of <iconv.h>.
+AC_DEFUN([gl_REPLACE_ICONV_H],
+[
+ AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+ ICONV_H='iconv.h'
])
AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
@@ -25,4 +30,5 @@
REPLACE_ICONV=0; AC_SUBST([REPLACE_ICONV])
REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
REPLACE_ICONV_UTF=0; AC_SUBST([REPLACE_ICONV_UTF])
+ ICONV_H=''; AC_SUBST([ICONV_H])
])
--- m4/iconv_open.m4.orig 2008-09-27 18:54:43.000000000 +0200
+++ m4/iconv_open.m4 2008-09-27 18:47:46.000000000 +0200
@@ -1,5 +1,5 @@
-# iconv_open.m4 serial 3
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# iconv_open.m4 serial 4
+dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -38,9 +38,9 @@
AC_DEFUN([gl_REPLACE_ICONV_OPEN],
[
+ gl_REPLACE_ICONV_H
REPLACE_ICONV_OPEN=1
AC_LIBOBJ([iconv_open])
- ICONV_H='iconv.h'
])
AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF],
--- m4/wchar.m4.orig 2008-09-27 18:54:43.000000000 +0200
+++ m4/wchar.m4 2008-09-27 18:51:01.000000000 +0200
@@ -7,7 +7,7 @@
dnl Written by Eric Blake.
-# wchar.m4 serial 5
+# wchar.m4 serial 6
AC_DEFUN([gl_WCHAR_H],
[
@@ -45,6 +45,13 @@
gl_CHECK_NEXT_HEADERS([wchar.h])
])
+dnl Unconditionally enables the replacement of <wchar.h>.
+AC_DEFUN([gl_REPLACE_WCHAR_H],
+[
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+ WCHAR_H=wchar.h
+])
+
AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -58,6 +65,5 @@
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
- WCHAR_H=
- AC_SUBST([WCHAR_H])
+ WCHAR_H=''; AC_SUBST([WCHAR_H])
])
--- m4/wcwidth.m4.orig 2008-09-27 18:54:43.000000000 +0200
+++ m4/wcwidth.m4 2008-09-27 18:50:53.000000000 +0200
@@ -1,5 +1,5 @@
-# wcwidth.m4 serial 13
-dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+# wcwidth.m4 serial 14
+dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -80,6 +80,6 @@
fi
if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then
- WCHAR_H=wchar.h
+ gl_REPLACE_WCHAR_H
fi
])
- m4/*_h.m4: improve idioms,
Bruno Haible <=