2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 AC_DEFUN([GNASH_PATH_SDL], [
21 dnl Lool for the header
22 AC_ARG_WITH(sdl-incl, AC_HELP_STRING([--with-sdl-incl], [directory where sdl header is]), with_sdl_incl=${withval})
23 AC_CACHE_VAL(ac_cv_path_sdl_incl, [
24 if test x"${with_sdl_incl}" != x ; then
25 if test -f ${with_sdl_incl}/SDL.h ; then
26 ac_cv_path_sdl_incl="-I`(cd ${with_sdl_incl}; pwd)`"
28 AC_MSG_ERROR([${with_sdl_incl} directory doesn't contain SDL.h])
32 if test x${cross_compiling} = xno; then
33 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_sdl_incl}" = x; then
34 $PKG_CONFIG --exists sdl && ac_cv_path_sdl_incl=`$PKG_CONFIG --cflags sdl`
38 dnl Attempt to find the top level directory, which unfortunately has a
39 dnl version number attached. At least on Debain based systems, this
40 dnl doesn't seem to get a directory that is unversioned.
42 if test x${cross_compiling} = xno; then
43 if test x"$PKG_CONFIG" != x; then
44 dnl What's the point of checking for SDL version here if we wipe out that info below ?? .. dropping the check
45 dnl AC_MSG_CHECKING([for the SDL Version])
46 dnl $PKG_CONFIG --exists sdl && gnash_sdl_version=`$PKG_CONFIG --modversion sdl`
47 $PKG_CONFIG --exists sdl && ac_cv_path_sdl_incl=`$PKG_CONFIG --cflags sdl`
48 dnl AC_MSG_RESULT(${gnash_sdl_version})
52 AC_PATH_PROG(SDL_CONFIG, sdl-config, , ,[${pathlist}])
53 if test "x$SDL_CONFIG" != "x" ; then
54 if test "x$SDL_CFLAGS" = "x" ; then
55 SDL_CFLAGS=`$SDL_CONFIG --cflags`
56 if test x${cross_compiling} = xno; then
57 ac_cv_path_sdl_incl=$SDL_CFLAGS
60 if test "x$SDL_LIBS" = "x" ; then
61 SDL_LIBS=`$SDL_CONFIG --libs | sed -e 's:-L/usr/lib/.* ::'`
62 if test x${cross_compiling} = xno; then
63 ac_cv_path_sdl_lib=$SDL_LIBS
70 if test x"${ac_cv_path_sdl_incl}" = x; then
71 AC_MSG_CHECKING([for SDL header])
72 for i in ${incllist}; do
73 for j in `ls -dr $i/SDL* 2>/dev/null`; do
74 if test -f $j/SDL.h; then
75 gnash_sdl_topdir=`basename $j`
76 gnash_sdl_version=`echo ${gnash_sdl_topdir} | sed -e 's:SDL::' -e 's:-::'`
77 ac_cv_path_sdl_incl="-I$j"
81 if test x"${ac_cv_path_sdl_incl}" != x; then
85 if test x"${ac_cv_path_sdl_incl}" != x; then
86 AC_MSG_RESULT(${ac_cv_path_sdl_incl})
88 AC_MSG_RESULT([not found in incllist])
92 dnl This is sorta bogus atm.
94 if test x"${ac_cv_path_sdl_incl}" = x ; then
95 AC_CHECK_HEADERS(SDL.h, [ac_cv_path_sdl_incl=""])
97 if test x"${ac_cv_path_sdl_incl}" != x"/usr/include"; then
98 ac_cv_path_sdl_incl="${ac_cv_path_sdl_incl}"
100 ac_cv_path_sdl_incl=""
104 dnl Look for the library
105 AC_ARG_WITH(sdl_lib, AC_HELP_STRING([--with-sdl-lib], [directory where sdl library is]), with_sdl_lib=${withval})
106 dnl AC_MSG_CHECKING([for sdl library])
107 AC_CACHE_VAL(ac_cv_path_sdl_lib, [
108 if test x"${with_sdl_lib}" != x ; then
109 if test -f ${with_sdl_lib}/libSDL.a -o -f ${with_sdl_lib}/libSDL.${shlibext}; then
110 ac_cv_path_sdl_lib="-L`(cd ${with_sdl_lib}; pwd)` -lSDL"
112 if test -f ${with_sdl_lib}/libSDL-1.1.a -o -f ${with_sdl_lib}/libSDL-1.1.${shlibext}; then
113 ac_cv_path_sdl_lib="-L`(cd ${with_sdl_lib}; pwd)` -lSDL"
115 AC_MSG_ERROR([${with_sdl_lib} directory doesn't contain libSDL])
122 if test x${cross_compiling} = xno; then
123 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_sdl_lib}" = x; then
124 $PKG_CONFIG --exists sdl && ac_cv_path_sdl_lib=`$PKG_CONFIG --libs sdl`
125 if test x"$ac_cv_path_sdl_lib" != x; then
131 if test x"${ac_cv_path_sdl_lib}" = x ; then
132 for i in $libslist; do
133 if test -f $i/libSDL.a -o -f $i/libSDL.${shlibext}; then
134 if test ! x"$i" = x"/usr/lib" -o x"$i" = x"/usr/lib64"; then
135 ac_cv_path_sdl_lib="-L$i -lSDL"
136 dnl AC_MSG_RESULT(${ac_cv_path_sdl_lib})
139 ac_cv_path_sdl_lib="-lSDL"
140 dnl AC_MSG_RESULT([yes])
145 if test -f $i/libSDL-1.1.a -o -f $i/libSDL-1.1.${shlibext}; then
146 if test ! x"$i" = x"/usr/lib" -o x"$i" = x"/usr/lib64"; then
147 ac_cv_path_sdl_lib="-L$i -lSDL-1.1"
148 dnl AC_MSG_RESULT(${ac_cv_path_sdl_lib})
151 ac_cv_path_sdl_lib="-lSDL-1.1"
152 dnl AC_MSG_RESULT([yes])
160 if test x"${ac_cv_path_sdl_lib}" = x ; then
161 AC_CHECK_LIB(SDL, SDL_Init, [ac_cv_path_sdl_lib="-lSDL"])
163 dnl AC_MSG_CHECKING([for SDL library])
164 dnl AC_MSG_RESULT(${ac_cv_path_sdl_lib})
165 if test x"${ac_cv_path_sdl_incl}" != x ; then
166 SDL_CFLAGS="${ac_cv_path_sdl_incl}"
168 if test x"${ac_cv_path_sdl_lib}" != x ; then
169 SDL_LIBS="${ac_cv_path_sdl_lib}"
171 AC_DEFINE(HAVE_SDL_H, [1], [We have SDL support])
182 # indent-tabs-mode: nil