autoconf
[Top][All Lists]
Advanced

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

Re: Problem with AC_CHECK_FUNC and order of gcc command-line parameters


From: Horst Wagner
Subject: Re: Problem with AC_CHECK_FUNC and order of gcc command-line parameters
Date: Thu, 11 Aug 2005 08:36:10 -0400

Thanks to Ralf Wildenhues and Stepan Kasal for providing a prompt answer.
The correct approach is to use  $LIBS instead of $LDFLAGS for library
includes and this fixed the problem.
 I knew I must had done something wrong but could not figure out what.

Thanks for your patience,
Horst


----- Original Message ----- 
From: "Horst Wagner" <address@hidden>
To: <address@hidden>
Sent: Wednesday, August 10, 2005 10:10 PM
Subject: Problem with AC_CHECK_FUNC and order of gcc command-line parameters


> Hi,
>
> I am having trouble with AC_CHECK_FUNC. It turns out that the order of
> parameters on the gcc commandline configure uses to compile code to check
> for the existence of the function is not proper in my case.
> I could not find any mention of such a problem in newsgroups, so I am
> assuming I am doing something stupid.
> The root problem is that in the compile command the source file name
> (conftest.c) is placed behind the $LDFLAGS. Latter library contains the
> function I am checking for.
> If I reorder the commandline such that -lgd comes after conftest.c (the
way
> it ought to be according to the gcc documentation) then the code compiles
> fine. I observe this problem with both autoconf-2.1.3 and 2.5.9 and am
> running on cygwin using gcc3.4.4
> I appreciate any tips on how to resolve this.
>
> Thanks,
> Horst
>
>
> Here is the appropriate excerpt from configure.in
>
> =============
> LDFLAGS="$LDFLAGS -lgd"
> AC_CHECK_FUNC(gdImagePng, DO_GD=' ';AC_DEFINE(DO_GD))
> =============
>
> Here is the appropriate excerpt from config.log:
> =============
> configure:2242: checking for gdImagePng
> configure:2270: gcc -o
>
ftest -g -O2  -I/usr/X11R6/include -I/usr/local/include    -L/usr/X11R6/l
> ib -L/usr/local/lib -lm -lX11 -lgd conftest.c 1>&5
> /D/tmp/ccQFB8tX.o: In function `main':
> /cygdrive/d/horst/C/g2/g2/configure:2264: undefined reference to
> `_gdImagePng'
> collect2: ld returned 1 exit status
> =============
>
>
>
>
> _______________________________________________
> Autoconf mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/autoconf
>





reply via email to

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