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
This commit is contained in:
parent
3fcfb40e22
commit
b8e0d8078e
1 changed files with 64 additions and 45 deletions
107
sdl.m4
107
sdl.m4
|
@ -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
|
|
||||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test x$sdl_prefix != x ; then
|
|
||||||
sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
|
|
||||||
if test x${SDL_CONFIG+set} != xset ; then
|
|
||||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
as_save_PATH="$PATH"
|
if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
|
||||||
if test "x$prefix" != xNONE; then
|
PKG_CHECK_MODULES(SDL, [sdl >= $min_sdl_version],
|
||||||
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
[sdl_pc=yes],
|
||||||
fi
|
[dnl
|
||||||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
|
AC_MSG_RESULT(no)
|
||||||
PATH="$as_save_PATH"
|
sdl_pc=no
|
||||||
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`
|
sdl_pc=no
|
||||||
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
|
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
|
||||||
|
if test x$sdl_prefix != x ; then
|
||||||
|
sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
|
||||||
|
if test x${SDL_CONFIG+set} != xset ; then
|
||||||
|
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
|
if test "x$sdl_pc" = xyes ; then
|
||||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
no_sdl=""
|
||||||
sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
|
else
|
||||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
as_save_PATH="$PATH"
|
||||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
|
||||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
||||||
if test "x$enable_sdltest" = "xyes" ; then
|
fi
|
||||||
ac_save_CFLAGS="$CFLAGS"
|
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
|
||||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
PATH="$as_save_PATH"
|
||||||
ac_save_LIBS="$LIBS"
|
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
|
||||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
no_sdl=""
|
||||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
|
||||||
LIBS="$LIBS $SDL_LIBS"
|
if test "$SDL_CONFIG" = "no" ; then
|
||||||
|
no_sdl=yes
|
||||||
|
else
|
||||||
|
SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
|
||||||
|
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
|
||||||
|
|
||||||
|
sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||||
|
sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||||
|
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||||
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||||
|
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[])
|
||||||
}
|
}
|
||||||
|
|
||||||
],, 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"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue