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