automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automake conditionals in autoconf


From: NightStrike
Subject: Automake conditionals in autoconf
Date: Wed, 24 Feb 2010 12:29:04 -0500

I'm sending this to both lists because I don't know which one is
right.  I'm trying to conditionally configure and build subdirectories
using Automake conditionals.  I'm flipping back and forth between both
manuals, so I'm guessing both apply.

I have a top level configure/makefile that I'm building to configure
and build the various trees in the mingw-w64.sf.net project.  Here's
the relevant directory layout:

trunk/
trunk/mingw-w64-libraries
trunk/mingw-w64-libraries/libmangle
trunk/mingw-w64-libraries/pseh

trunk contains the top level configure.ac/makefile.am
mingw-w64-libraries contains just sub directories
libmangle and pseh both contain their own self-contained fully
autotool'd build system

This same thing is replicated across a lot of directories inside
trunk, but I'm guessing once I get one right, I'll get them all.

So I have a top level configure, and I put this in it:

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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]