[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automake conditionals in autoconf
From: |
Ralf Wildenhues |
Subject: |
Re: Automake conditionals in autoconf |
Date: |
Wed, 24 Feb 2010 20:23:25 +0100 |
User-agent: |
Mutt/1.5.20 (2009-10-28) |
Hello,
* NightStrike wrote on Wed, Feb 24, 2010 at 06:29:04PM CET:
> AC_MSG_CHECKING([whether to build the optional libraries])
> AC_ARG_WITH([libraries],
> [AS_HELP_STRING([--with-libraries=ARG],
> [Build the extra mingw-w64 libs, where ARG is one of libmangle,
> pseh, or all])],
> [],
> [with_libraries=no])
> AS_CASE([$with_libraries],
> [yes|all],[
> with_libraries="libmangle,pseh"
> with_libraries_mangle=yes
> with_libraries_pseh=yes],
> [libmangle],[
> with_libraries="libmangle"
> with_libraries_mangle=yes
> with_libraries_pseh=no],
> [pseh],[
> with_libraries="pseh"
> with_libraries_mangle=no
> with_libraries_pseh=yes],
> [no],[
> with_libraries_mangle=no
> with_libraries_pseh=no],
> [AC_MSG_ERROR([Invalid argument to --with-libraries: $with_libraries])])
> AM_CONDITIONAL([LIBRARIES_MANGLE],[test "x$with_libraries_mangle" = xyes])
> AM_CONDITIONAL([LIBRARIES_PSEH],[test "x$with_libraries_pseh" = xyes])
> AM_COND_IF([LIBRARIES_MANGLE],[AC_CONFIG_SUBDIRS([mingw-w64-libraries/libmangle])])
> AM_COND_IF([LIBRARIES_PSEH],[AC_CONFIG_SUBDIRS([mingw-w64-libraries/pseh])])
> AC_MSG_RESULT([$with_libraries])
>
>
> Those two AM_COND_IF lines at the bottom didn't use to be there.
> Instead, I had the AC_CONFIG_SUBDIRS lines in each appropriate branch
> of the case statement. However, autoreconf complained that hte macro
> was expanded more than once. Is the way I'm doing this kosher? Is it
> "The Right Way", or is there a better approach? (for the whole thing,
> not just the AM_COND_IF part)
The above looks ok to me. Since I cannot, from your description,
exactly reproduce the code that caused the warning for you, I cannot say
whether that was a problem.
The code as above does not yet take care of adjusting SUBDIRS (and maybe
DIST_SUBDIRS) in the toplevel Makefile. There is one decision for you
to make here: should 'make dist' tar up all subpackages, even those that
aren't build (which is the default, because that's what's right to
ensure downstream has the same choices as you) in which case you can
just
if LIBRARIES_MANGLE
SUBDIRS += mingw-w64-libraries/libmangle
endif
...
In the other case you should use something like
AC_SUBST([libmangle_subdir], [mingw-w64-libraries/libmangle])
and
SUBDIRS = ... $(libmangle_subdir) ...
Hope that helps.
Cheers,
Ralf