autoconf
[Top][All Lists]
Advanced

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

Re: Having trouble using AC_CHECK_LIB


From: Harlan Stenn
Subject: Re: Having trouble using AC_CHECK_LIB
Date: Mon, 02 Mar 2015 06:10:23 +0000

Julian Marchant writes:
> I'm trying to replace the hand-made Makefile of Project: Starfighter
> with Autoconf and Automake files. This is my first time using Autoconf
> and Automake, so I'm kind of learning as I go along.
> 
> I'm stuck at one part. Project: Starfighter requires SDL_Image and
> SDL_Mixer from SDL2 in order to build, so I'm trying to check for them
> by using AC_CHECK_LIB with functions defined by SDL_Image and
> SDL_Mixer. These are my checks (you can see the attached file for the
> full configure.ac):
> 
>     AC_CHECK_LIB([SDL2], [SDL_Init], [], [echo "Error: SDL2 not
> found." ; exit 1])
>     AC_CHECK_LIB([SDL2], [IMG_Load], [], [echo "Error: SDL_Image not
> found." ; exit 1])
>     AC_CHECK_LIB([SDL2], [Mix_LoadWAV], [], [echo "Error: SDL_Mixer
> not found." ; exit 1])

AC_CHECK_LIB is OK, and AC_SEARCH_LIBS might be better.

Don't use echo like that.

Do the AC_CHECK_LIB and after it's done check ac_cv_lib_SDL_Init or
other values, and if those are missing call AC_MSG_ERROR to note your
error condition and exit.

Or if you use AC_SEARCH_LIBS use ac_cv_search_SDL_Init (or whatever) and
check that way.

http://www.gnu.org/software/autoconf/manual/autoconf.html#Libraries

H



reply via email to

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