This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: A target_os conditionally applied -lfoo switch
- From: Earnie Boyd <earnie_boyd at yahoo dot com>
- To: Ralf Corsepius <corsepiu at faw dot uni-ulm dot de>
- Cc: Automake List <automake at gnu dot org>
- Date: Wed, 13 Nov 2002 14:49:18 -0500
- Subject: Re: A target_os conditionally applied -lfoo switch
- References: <3DD29524.3010000@yahoo.com> <1037212543.12886.6718.camel@mccallum>
Ralf Corsepius wrote:
Am Mit, 2002-11-13 um 19.08 schrieb Earnie Boyd:
I need to add a library specific to a target_os. I've tried several
possible techniques and can't get cooperation from the tools.
What I want is something similar to:
target_os := @target_os@
ifeq ($(target_os),mingw32)
LDADD += -lws2_32
endif
Unfortunately automake thinks the conditional belongs to it instead of make.
Help?
1. Ugly "You-don't-really-want to-apply-it"; brute-force approach:
Add this to your configure.ac:
AC_SUBST(ENDIF,endif)
and use @ENDIF@ instead of endif inside of you Makefile.am
I may try this but
2. Check $host_* inside of your configure.ac and setup a conditional,
eg. something along this example
AM_CONDITIONAL(MINGW,test x"$host_os" == "mingw32")
And apply @MINGW@ inside of your Makefile.am
this I had tried already. However I had forgotten the last step.
Trying again I have:
configure.in with
AM_CONDITIONAL(WINDOWS, test x$target_os == xmingw32)
Makefile.am with
WINDOWS = @WINDOWS@
if WINDOWS
LDADD += -lws2_32
endif
But I can't tell if Makefile.in is correct totally. It doesn't contain
the `if WINDOWS' condition at all. It does contain various WINDOWS
generated parts based on what should happen with AM_CONDITIONAL.
3. Apply an autoconf-lib checks to determine when adding this lib is
necessary.
I'm researching this.
4. Tell your users to use ./configure LIBS=-lws2_32 or similar
That I want to avoid.
Earnie.
P.S.: I'm using 1.7.1 of Automake and version 2.54 of Autoconf.