Commit b8e0d807 authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug #522

 Mike Frysinger      2007-12-10 16:47:36 PST

it's much easier to manage .pc files for cross-compiling setups than it is for
random *-config scripts ... the cross-compiled pkg-config files can all be
easily/tightly controlled and separate from the host pkg-config files.  the
*-config files however are to be found in $PATH and can easily pick the wrong
one.

can we get the sdl.m4 macro updated so that it checks for libsdl.pc first via
the standard PKG_CHECK_MODULES() m4 macro, and if that fails, fall back to the
normal sdl-config voodoo.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403965
parent 3fcfb40e
...@@ -19,47 +19,62 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL ...@@ -19,47 +19,62 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
, enable_sdltest=yes) , enable_sdltest=yes)
if test x$sdl_exec_prefix != x ; then min_sdl_version=ifelse([$1], ,1.2.0,$1)
sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config PKG_CHECK_MODULES(SDL, [sdl >= $min_sdl_version],
[sdl_pc=yes],
[dnl
AC_MSG_RESULT(no)
sdl_pc=no
])
else
sdl_pc=no
if test x$sdl_exec_prefix != x ; then
sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
fi
fi fi
fi if test x$sdl_prefix != x ; then
if test x$sdl_prefix != x ; then sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then
if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config
SDL_CONFIG=$sdl_prefix/bin/sdl-config fi
fi fi
fi fi
as_save_PATH="$PATH" if test "x$sdl_pc" = xyes ; then
if test "x$prefix" != xNONE; then no_sdl=""
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
fi
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
PATH="$as_save_PATH"
min_sdl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl=""
if test "$SDL_CONFIG" = "no" ; then
no_sdl=yes
else else
SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags` as_save_PATH="$PATH"
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs` if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
fi
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
PATH="$as_save_PATH"
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl=""
sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \ if test "$SDL_CONFIG" = "no" ; then
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` no_sdl=yes
sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \ else
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
ac_save_CFLAGS="$CFLAGS" sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ac_save_CXXFLAGS="$CXXFLAGS" sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
ac_save_LIBS="$LIBS" sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
CFLAGS="$CFLAGS $SDL_CFLAGS" sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
LIBS="$LIBS $SDL_LIBS" if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent dnl checks the results of sdl-config to some extent
...@@ -123,16 +138,20 @@ int main (int argc, char *argv[]) ...@@ -123,16 +138,20 @@ int main (int argc, char *argv[])
} }
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS" CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS" LIBS="$ac_save_LIBS"
fi fi
fi
if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi fi
if test "x$no_sdl" = x ; then if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes) ifelse([$2], , :, [$2])
ifelse([$2], , :, [$2])
else else
AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then if test "$SDL_CONFIG" = "no" ; then
echo "*** The sdl-config script installed by SDL could not be found" echo "*** The sdl-config script installed by SDL could not be found"
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment