sdl.m4
changeset 3340 3d75acd08339
parent 2301 ebcebb426771
child 3379 3dd59e993979
equal deleted inserted replaced
3339:62d208fd5f49 3340:3d75acd08339
    17 AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
    17 AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
    18             sdl_exec_prefix="$withval", sdl_exec_prefix="")
    18             sdl_exec_prefix="$withval", sdl_exec_prefix="")
    19 AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
    19 AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
    20 		    , enable_sdltest=yes)
    20 		    , enable_sdltest=yes)
    21 
    21 
    22   if test x$sdl_exec_prefix != x ; then
    22   min_sdl_version=ifelse([$1], ,1.2.0,$1)
    23     sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
    23 
    24     if test x${SDL_CONFIG+set} != xset ; then
    24   if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
    25       SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
    25     PKG_CHECK_MODULES(SDL, [sdl >= $min_sdl_version],
       
    26            [sdl_pc=yes],
       
    27            [dnl
       
    28              AC_MSG_RESULT(no)
       
    29              sdl_pc=no
       
    30            ])
       
    31   else
       
    32     sdl_pc=no
       
    33     if test x$sdl_exec_prefix != x ; then
       
    34       sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
       
    35       if test x${SDL_CONFIG+set} != xset ; then
       
    36         SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
       
    37       fi
       
    38     fi
       
    39     if test x$sdl_prefix != x ; then
       
    40       sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
       
    41       if test x${SDL_CONFIG+set} != xset ; then
       
    42         SDL_CONFIG=$sdl_prefix/bin/sdl-config
       
    43       fi
    26     fi
    44     fi
    27   fi
    45   fi
    28   if test x$sdl_prefix != x ; then
    46 
    29     sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
    47   if test "x$sdl_pc" = xyes ; then
    30     if test x${SDL_CONFIG+set} != xset ; then
    48     no_sdl=""
    31       SDL_CONFIG=$sdl_prefix/bin/sdl-config
    49   else
    32     fi
    50     as_save_PATH="$PATH"
    33   fi
    51     if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
    34 
    52       PATH="$prefix/bin:$prefix/usr/bin:$PATH"
    35   as_save_PATH="$PATH"
    53     fi
    36   if test "x$prefix" != xNONE; then
    54     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
    37     PATH="$prefix/bin:$prefix/usr/bin:$PATH"
    55     PATH="$as_save_PATH"
    38   fi
    56     AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
    39   AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
    57     no_sdl=""
    40   PATH="$as_save_PATH"
    58 
    41   min_sdl_version=ifelse([$1], ,0.11.0,$1)
    59     if test "$SDL_CONFIG" = "no" ; then
    42   AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
    60       no_sdl=yes
    43   no_sdl=""
    61     else
    44   if test "$SDL_CONFIG" = "no" ; then
    62       SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
    45     no_sdl=yes
    63       SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
    46   else
    64 
    47     SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
    65       sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
    48     SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
    66              sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
    49 
    67       sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
    50     sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
    68              sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
    51            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
    69       sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
    52     sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
    70              sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
    53            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
    71       if test "x$enable_sdltest" = "xyes" ; then
    54     sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
    72         ac_save_CFLAGS="$CFLAGS"
    55            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
    73         ac_save_CXXFLAGS="$CXXFLAGS"
    56     if test "x$enable_sdltest" = "xyes" ; then
    74         ac_save_LIBS="$LIBS"
    57       ac_save_CFLAGS="$CFLAGS"
    75         CFLAGS="$CFLAGS $SDL_CFLAGS"
    58       ac_save_CXXFLAGS="$CXXFLAGS"
    76         CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
    59       ac_save_LIBS="$LIBS"
    77         LIBS="$LIBS $SDL_LIBS"
    60       CFLAGS="$CFLAGS $SDL_CFLAGS"
       
    61       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
       
    62       LIBS="$LIBS $SDL_LIBS"
       
    63 dnl
    78 dnl
    64 dnl Now check if the installed SDL is sufficiently new. (Also sanity
    79 dnl Now check if the installed SDL is sufficiently new. (Also sanity
    65 dnl checks the results of sdl-config to some extent
    80 dnl checks the results of sdl-config to some extent
    66 dnl
    81 dnl
    67       rm -f conf.sdltest
    82       rm -f conf.sdltest
   121       return 1;
   136       return 1;
   122     }
   137     }
   123 }
   138 }
   124 
   139 
   125 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
   140 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
   126        CFLAGS="$ac_save_CFLAGS"
   141         CFLAGS="$ac_save_CFLAGS"
   127        CXXFLAGS="$ac_save_CXXFLAGS"
   142         CXXFLAGS="$ac_save_CXXFLAGS"
   128        LIBS="$ac_save_LIBS"
   143         LIBS="$ac_save_LIBS"
   129      fi
   144       fi
       
   145     fi
       
   146     if test "x$no_sdl" = x ; then
       
   147       AC_MSG_RESULT(yes)
       
   148     else
       
   149       AC_MSG_RESULT(no)
       
   150     fi
   130   fi
   151   fi
   131   if test "x$no_sdl" = x ; then
   152   if test "x$no_sdl" = x ; then
   132      AC_MSG_RESULT(yes)
   153      ifelse([$2], , :, [$2])
   133      ifelse([$2], , :, [$2])     
   154   else
   134   else
       
   135      AC_MSG_RESULT(no)
       
   136      if test "$SDL_CONFIG" = "no" ; then
   155      if test "$SDL_CONFIG" = "no" ; then
   137        echo "*** The sdl-config script installed by SDL could not be found"
   156        echo "*** The sdl-config script installed by SDL could not be found"
   138        echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
   157        echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
   139        echo "*** your path, or set the SDL_CONFIG environment variable to the"
   158        echo "*** your path, or set the SDL_CONFIG environment variable to the"
   140        echo "*** full path to sdl-config."
   159        echo "*** full path to sdl-config."