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.



Reply via email to