mingw-cross-env-list
[Top][All Lists]
Advanced

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

Re: [Mingw-cross-env-list] SDL_mixer in mingw-cross-env crashing


From: David Bruce
Subject: Re: [Mingw-cross-env-list] SDL_mixer in mingw-cross-env crashing
Date: Fri, 19 Mar 2010 13:26:07 -0500

Hi Volker,

Still having trouble getting SDL_net detected by my configure.ac

> SDL_net doesn't provide a *.pc script, so you'll have to check for
> it via AC_CHECK_LIB. Then, you'll only have to add "-lws2_32", for
> which you could check via AC_CHECK_LIB(ws2_32) before SDL_net.
>
> Alternatively, you could add "-lws2_32" unconditionally to LIBS
> since it should exist on any MinGW system as part of the w32api.
> But AC_CHECK_LIB(ws2_32) is more clean, I think.

So here's what I did. Note that I've also tried to follow your advice
on using PKG_CHECK_MODULES whenever possible, by first calling
PKG_CHECK_EXISTS followed by either PKG_CHECK_MODULES or AC_CHECK_LIB:


dnl Check for SDL_net: --------------------------------------------------------

dnl SDL_net is enabled by default.

AC_ARG_WITH([sdlnet],
            [AS_HELP_STRING([--without-sdlnet],
            [Do not use SDL_net even if available])],
            [],
            [with_sdlnet=yes]
)

if test "x$with_sdlnet" != xno; then
  dnl We will need this for socket programming on Win32
  AC_CHECK_LIB([ws2_32],
               [WSAStartup],
               ,
               [AC_MSG_NOTICE([Windows socket library ws2_32 not found -
(only needed on win32)])]
  )



  PKG_CHECK_EXISTS([SDL_net],
        dnl Use pkg-config if possible:
        [SDL_NET_CFLAGS=""
         SDL_NET_LIBS=""
         PKG_CHECK_MODULES([SDL_NET],
                           [SDL_net],
                           ,
                           [with_sdlnet=no;
                            AC_MSG_FAILURE([SDL_net test failed 
(--without-sdlnet to disable)])])
         CFLAGS="$CFLAGS $SDL_NET_CFLAGS"
         LIBS="$LIBS $SDL_NET_LIBS"
         AC_DEFINE([HAVE_LIBSDL_NET],[1],[Define to 1 if you have the
`SDL_net` library]
        )],
        dnl Fallback if we can't use pkg-config:
        [AC_CHECK_LIB([SDL_net],
                      [SDLNet_Init],
                      ,
                      [with_sdlnet=no;
                       AC_MSG_FAILURE([SDL_net test failed (--without-sdlnet to 
disable)])]
        )]
  )
fi

When building for Linux, everything works as expected.  But in the
cross-build, I get this:

(...)
checking for SDL... yes
checking for SDL_IMAGE... yes
checking for SDL_MIXER... yes
checking for WSAStartup in -lws2_32... no
configure: Windows socket library ws2_32 not found - (only needed on win32)
checking for SDLNet_Init in -lSDL_net... no
configure: error: in `/usr/local/src/git/tuxmath/buildw32':
configure: error: SDL_net test failed (--without-sdlnet to disable)
See `config.log' for more details.

So AC_CHECK_LIB doesn't detect ws2_32, and the check for SDL_net
subsequently fails.  I take it ws2_32 is part of the w32api package?

Thanks for any suggestions,

David Bruce




reply via email to

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