Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug #522
Browse files Browse the repository at this point in the history
 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.
  • Loading branch information
slouken committed Oct 4, 2009
1 parent a25ac72 commit b8fb426
Showing 1 changed file with 61 additions and 42 deletions.
103 changes: 61 additions & 42 deletions sdl.m4
Expand Up @@ -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],
, enable_sdltest=yes)
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
min_sdl_version=ifelse([$1], ,1.2.0,$1)
if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
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
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
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
as_save_PATH="$PATH"
if test "x$prefix" != xNONE; then
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
if test "x$sdl_pc" = xyes ; then
no_sdl=""
else
SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
as_save_PATH="$PATH"
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 | \
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"
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 Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
Expand Down Expand Up @@ -123,16 +138,20 @@ int main (int argc, char *argv[])
}
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then
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"
Expand Down

0 comments on commit b8fb426

Please sign in to comment.