automake
[Top][All Lists]
Advanced

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

Re: conditionally linking to mingw32 library


From: Mark Brand
Subject: Re: conditionally linking to mingw32 library
Date: Wed, 01 Jun 2005 16:44:39 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

>>to my situation, but I'm getting stuck. I have:
>>
>><configure.ac>
>> if test x$target_os == xmingw32; then
>>    
>
>Don't use the test operator `==' , it's unportable and completely
>superfluous, as `=' does string comparison just fine.
>
>  
>>    WINSOCK=-lws2_32
>> fi
>> AC_SUBST(WINSOCK)
>></configure.ac>
>>
>><Makefile.am>
>> myprogram_LDADD := @LTLIBINTL@ @WINSOCK@
>>    
>
>Use
>  myprogram_LDADD = $(LTLIBINTL) $(WINSOCK)
>
>as `:=' assignment is not portable, and, as you already learned,
>automake will set the WINSOCK make variable for you in the generated
>Makefile.in.  (The recommendation to use the make variables over the
>substituted values is rather one of style.)
>
>  

Would you please elaborate on the difference between "make variables"
and "substituted values" here?  I'm still very new to this.

>></Makefile.am>
>>
>>My generated Makefile contains:
>>
>>    WINSOCK = @WINSOCK@
>>
>>When I build (for either target) I get this error:
>>
>>    g++  -g -O2   -o myprogram  main.o  @WINSOCK@
>>    g++: @WINSOCK@: No such file or directory
>>    make[2]: *** [myprogram Error 1
>>
>>
>>    
I've made the changes you suggest. Now I have in configure.ac:

    if test x$target_os = xmingw32; then
        WINSOCK=-lws2_32
    fi
    AC_SUBST([WINSOCK])


and in Makefile.am:

    myprogram_LDADD = $(LTLIBINTL) $(WINSOCK)


The generated Makefile still contains:

    WINSOCK = @WINSOCK@
    myprogram_LDADD = $(LTLIBINTL) $(WINSOCK)


(I have to admit I don't really know what the @ signs mean in
Makefile.)  Anyway, I still see this when I run make:

    g++  -g -O2   -o myprogram  main.o @WINSOCK@
    g++: @WINSOCK@: No such file or directory
    make[2]: *** [myprogram] Error 1


>Let me guess: You did rerun automake but forgot rerunning either
>autoconf or configure (in that order)?
>  

No, actually I've been running all of the following each time:

    autoheader
    touch NEWS README AUTHORS ChangeLog
    touch stamp-h
    aclocal
    autoconf
    automake -a
    /.configure
    make



Mark




reply via email to

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