automake
[Top][All Lists]
Advanced

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

Re: Conditional sources


From: Benoit SIGOURE
Subject: Re: Conditional sources
Date: Sun, 4 Nov 2007 19:52:44 +0100

On Nov 4, 2007, at 7:47 PM, NightStrike wrote:

I am trying to figure out how to do conditional sources.  Basically,
here is the setup:

lib/uuid.c
lib32/uuid.c

If I pass --with-m32 to configure, I want to use the second source.
If I don't, then I want to use the first.  I put this in configure.ac:

AC_ARG_WITH(m32,
[  --with-m32   Compile lib32 stuff.. testing only],
[  WITH_32=yes ],
[  WITH_32= ])

You might want to use AS_HELP_STRING here.
http://www.gnu.org/software/autoconf/manual/html_node/Pretty-Help- Strings.html

AM_CONDITIONAL(WITH32, test x$WITH_32 != x)

And I put this in Makefile.am:

if WITH32
  crtdir=$(prefix)/lib32
  uuidsrc = lib32/uuid.c
else
  crtdir=$(prefix)/$(target)/lib
  uuidsrc = lib/uuid.c
endif

crtlibs_LIBRARIES += libuuid.a
libuuid_a_SOURCES = $(uuidsrc)


When I run autoreconf, I get this:

Makefile.am: object `uuid.$(OBJEXT)' created by `lib32/uuid.c' and `lib/uuid.c'
make: *** [../crttest/Makefile.in] Error 1

How about this (untested):
crtlibs_LIBRARIES += libuuid.a
libuuid_a_SOURCES =

if WITH32
  crtdir=$(prefix)/lib32
  libuuid_a_SOURCES += lib32/uuid.c
else
  crtdir=$(prefix)/$(target)/lib
  libuuid_a_SOURCES += lib/uuid.c
endif

?

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory


Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

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