Re: [RFC][patch 1/9] initial Python support

Thiago Jung Bauermann
2008-05-05T04:55:09Z

On Tue, 2008-04-29 at 12:52 -0300, Thiago Jung Bauermann wrote:
> There are two caveats with the configure.ac changes: one is that they
> trigger a bug in autoconf 2.59 when library names contain a dot
> (e.g., libpython2.5). I regenerated the configure script using
> autoconf 2.61, but the proper way to fix this at the moment (since we
> must use version 2.59) is to backport the fix using the
> config/override.m4 mechanism. I didn't look into that yet.

With the patch below I was able to work around the bug. It adds a
version of autoconf 2.59's AC_ARG_WITH to config/override.m4, with the
following fix:

# Check whether --with-$1 or --without-$1 was given.
-if test "[${with_]m4_bpatsubst([$1], -, _)+set}" = set; then
- withval="[$with_]m4_bpatsubst([$1], -, _)"
+if test "[${with_]m4_translit([$1], [.-], [__])+set}" = set; then
+ withval="[$with_]m4_translit([$1], [.-], [__])"

The problem affects only the --with-libpython2.5-prefix configure
option. Without the fix, configure won't even run to completion because
it contains a syntax error (variable name with dot in it). With the fix,
configure works, but said configure option doesn't:

% ../configure --with-libpython2.5-prefix=/blah
configure: error: invalid package name: libpython2.5-prefix

I looked into fixing that problem, but this would require overriding
_AC_INIT_PARSE_ARGS which is a very big macro in autoconf 2.59. Is it
worth doing that?

Note that --with-python and --without-python work as expected.

> The other caveat is that I had trouble with gnulib configure script
> when using this patch. I didn't investigate the issue yet, and to test
> this code I removed gnulib from the compilation. Maybe I didn't
> regenerate the configure scripts properly.

The fix to that is running aclocal with -I gnulib/m4, as Daniel noted on
the IRC channel.
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center

diff --git a/config/override.m4 b/config/override.m4
index 592f641..38fc101 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -189,3 +189,23 @@ if $ac_cache_corrupted; then
fi
])# _AC_ARG_VAR_VALIDATE
])])
+
+ifelse(m4_PACKAGE_VERSION, [2.59], [
+
+# AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE, [ACTION-IF-FALSE])
+# --------------------------------------------------------------------
+AC_DEFUN([AC_ARG_WITH],
+[m4_divert_once([HELP_WITH], [[
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)]])
+m4_divert_once([HELP_WITH], [$2])dnl
+# Check whether --with-$1 or --without-$1 was given.
+if test "[${with_]m4_translit([$1], [.-], [__])+set}" = set; then
+ withval="[$with_]m4_translit([$1], [.-], [__])"
+ $3
+m4_ifvaln([$4], [else
+ $4])dnl
+fi; dnl
+])# AC_ARG_WITH
+])