AM_PATH_SDL broken?

Hello, SDLers. I’m having trouble setting up a configure.ac that works with
SDL on my machine. I have added the necessary test as described on the
website:

Check for SDL

SDL_VERSION=1.2.5
AM_PATH_SDL($SDL_VERSION, :,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not
found!]))
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"

aclocal, autoconf, automake all run fine with this (except a warning from
autoconf about AC_CANONICAL_TARGET).
But when it comes time to run ./configure, the test fails. I know for a fact
that SDL is installed correctly, headers in /usr/include/SDL, etc.
Looking in config.log, I see this:

configure:3218: checking for sdl-config
configure:3236: found /usr/bin/sdl-config
configure:3249: result: /usr/bin/sdl-config
configure:3257: checking for SDL - version >= 1.2.5
configure:3348: g++ -o conftest -g -O2 conftest.cc -L/usr/lib
-Wl,-rpath,/usr/lib -lSDL -lpthread >&5
configure:3298:17: SDL.h: No such file or directory
configure:3351: $? = 1
configure: program exited with status 1
configure: failed program was:
| #line 3281 “configure”
| /* confdefs.h. /
[Snip test program source]

configure:3378: result: no
configure:3417: g++ -o conftest -g -O2 conftest.cc -L/usr/lib
-Wl,-rpath,/usr/lib -lSDL -lpthread >&5
configure:3407:17: SDL.h: No such file or directory
configure:3420: $? = 1
configure: failed program was:
| #line 3392 “configure”
| /
confdefs.h. */
[snip]

It seems to my admittedly inexperienced eyes that AM_PATH_SDL isn’t properly
catching the output of sdl-config in CFLAGS. Notice how the lines above read
"configure:3348: g++ -o conftest -g -O2 conftest.cc -L/usr/lib
-Wl,-rpath,/usr/lib -lSDL -lpthread >&5" – shouldn’t there be a
-I/usr/include/SDL -D_REENTRANT in there somewhere? I mean, since there
isn’t, is it any wonder at all that #include “SDL.h” fails?

Here is the output of running sdl-conig --cflags from the shell:
-I/usr/include/SDL -D_REENTRANT

If it matters I’m using SDL 1.2.5 as it comes in slackware 9.0. Anybody have
any ideas what’s wrong here? Have I missed some silly thing in my
configure.ac? Thanks.–
Max Bane
A day for firm decisions!!! Or is it?

[ETC.]

Just in case anybody cares, I’ve found the problem on my own. It seems that
AM_PATH_SDL does not like it when you put AC_LANG_CPLUSPLUS before it in
configure.ac. If you do, when sdl.m4 runs the sdl test program with
AC_TRY_RUN, configure compiles it with g++, which will disregard CFLAGS and
look at CXXFLAGS instead. Unfortunately AM_PATH_SDL only sets CFLAGS, not
CXXFLAGS. The solution is a simple matter of placing AC_LANG_CPLUSPLUS after
the call to AM_PATH_SDL. The longer-term solution would be to patch sdl.m4
to work with either compiler.On Friday 04 April 2003 05:30 pm, Max Bane wrote:

Hello, SDLers. I’m having trouble setting up a configure.ac that works
with SDL on my machine. I have added the necessary test as described on
the website:

Check for SDL

SDL_VERSION=1.2.5
AM_PATH_SDL($SDL_VERSION, :,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not
found!]))
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"

aclocal, autoconf, automake all run fine with this (except a warning from
autoconf about AC_CANONICAL_TARGET).
But when it comes time to run ./configure, the test fails. I know for a
fact that SDL is installed correctly, headers in /usr/include/SDL, etc.
Looking in config.log, I see this:

Max Bane
Cabbage, n.:
A familiar kitchen-garden vegetable about as large and wise as
a man’s head.
– Ambrose Bierce, “The Devil’s Dictionary”