cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: gethostbyname & MinGW build problem

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 22 Dec 2003 11:49:53 +0100 (CET)

On Sun, 21 Dec 2003, Gour wrote:

> On MinGW/MSYS list I got suggestion that curl's configure scripte should
> include search for gethostbyname() in ws2_32 libs and the code should
> include #include <winsock2.h>

> Since I'm not really familiar with autoconf mechanism, can you give me some
> suggestion how to modify configure.ac to include required items? (I have
> tried with AC_SEARCH_LIBS(gethostbyname, ws2_32), but it is not enough- it
> probably requires winsock2.h where gethostname is declared.)

Well, generally you don't need any include files to check for a function's
presence in a lib. The basic autoconf macros thus don't allow any particular
include files to be set for a specific function-in-lib check. We need to write
our own.

Perhaps something similar to this (should only be made if gethostbyname
wasn't already found, but let's ignore that for now):

AC_MSG_CHECKING([for gethostbyname in ws2_32])
AC_TRY_LINK([#include <winsock2.h>],
            [gethostbyname();],
            AC_MSG_RESULT(yes)
            AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
            LIBS="$LIBS -lws2_32"
            ,
            AC_MSG_RESULT(no)
           )

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-22