/[pcsx2_0.9.7]/trunk/3rdparty/SDL-1.3.0-5387/sdl.m4
ViewVC logotype

Annotation of /trunk/3rdparty/SDL-1.3.0-5387/sdl.m4

Parent Directory Parent Directory | Revision Log Revision Log


Revision 401 - (hide annotations) (download)
Fri Feb 25 17:31:09 2011 UTC (9 years, 9 months ago) by william
File size: 7008 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4358 local: v0.9.7.313-latest) in ./trunk
1 william 401 # Configure paths for SDL
2     # Sam Lantinga 9/21/99
3     # stolen from Manish Singh
4     # stolen back from Frank Belew
5     # stolen from Manish Singh
6     # Shamelessly stolen from Owen Taylor
7    
8     # serial 1
9    
10     dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
11     dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
12     dnl
13     AC_DEFUN([AM_PATH_SDL],
14     [dnl
15     dnl Get the cflags and libraries from the sdl-config script
16     dnl
17     AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
18     sdl_prefix="$withval", sdl_prefix="")
19     AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
20     sdl_exec_prefix="$withval", sdl_exec_prefix="")
21     AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
22     , enable_sdltest=yes)
23    
24     min_sdl_version=ifelse([$1], ,1.2.0,$1)
25    
26     if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
27     PKG_CHECK_MODULES(SDL, [sdl >= $min_sdl_version],
28     [sdl_pc=yes],
29     [dnl
30     AC_MSG_RESULT(no)
31     sdl_pc=no
32     ])
33     else
34     sdl_pc=no
35     if test x$sdl_exec_prefix != x ; then
36     sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
37     if test x${SDL_CONFIG+set} != xset ; then
38     SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
39     fi
40     fi
41     if test x$sdl_prefix != x ; then
42     sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
43     if test x${SDL_CONFIG+set} != xset ; then
44     SDL_CONFIG=$sdl_prefix/bin/sdl-config
45     fi
46     fi
47     fi
48    
49     if test "x$sdl_pc" = xyes ; then
50     no_sdl=""
51     SDL_CONFIG="pkg-config sdl"
52     else
53     as_save_PATH="$PATH"
54     if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
55     PATH="$prefix/bin:$prefix/usr/bin:$PATH"
56     fi
57     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
58     PATH="$as_save_PATH"
59     AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
60     no_sdl=""
61    
62     if test "$SDL_CONFIG" = "no" ; then
63     no_sdl=yes
64     else
65     SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
66     SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
67    
68     sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
69     sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
70     sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
71     sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
72     sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
73     sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
74     if test "x$enable_sdltest" = "xyes" ; then
75     ac_save_CFLAGS="$CFLAGS"
76     ac_save_CXXFLAGS="$CXXFLAGS"
77     ac_save_LIBS="$LIBS"
78     CFLAGS="$CFLAGS $SDL_CFLAGS"
79     CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
80     LIBS="$LIBS $SDL_LIBS"
81     dnl
82     dnl Now check if the installed SDL is sufficiently new. (Also sanity
83     dnl checks the results of sdl-config to some extent
84     dnl
85     rm -f conf.sdltest
86     AC_TRY_RUN([
87     #include <stdio.h>
88     #include <stdlib.h>
89     #include <string.h>
90     #include "SDL.h"
91    
92     char*
93     my_strdup (char *str)
94     {
95     char *new_str;
96    
97     if (str)
98     {
99     new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
100     strcpy (new_str, str);
101     }
102     else
103     new_str = NULL;
104    
105     return new_str;
106     }
107    
108     int main (int argc, char *argv[])
109     {
110     int major, minor, micro;
111     char *tmp_version;
112    
113     /* This hangs on some systems (?)
114     system ("touch conf.sdltest");
115     */
116     { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
117    
118     /* HP/UX 9 (%@#!) writes to sscanf strings */
119     tmp_version = my_strdup("$min_sdl_version");
120     if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
121     printf("%s, bad version string\n", "$min_sdl_version");
122     exit(1);
123     }
124    
125     if (($sdl_major_version > major) ||
126     (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
127     (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
128     {
129     return 0;
130     }
131     else
132     {
133     printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
134     printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
135     printf("*** best to upgrade to the required version.\n");
136     printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
137     printf("*** to point to the correct copy of sdl-config, and remove the file\n");
138     printf("*** config.cache before re-running configure\n");
139     return 1;
140     }
141     }
142    
143     ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
144     CFLAGS="$ac_save_CFLAGS"
145     CXXFLAGS="$ac_save_CXXFLAGS"
146     LIBS="$ac_save_LIBS"
147     fi
148     fi
149     if test "x$no_sdl" = x ; then
150     AC_MSG_RESULT(yes)
151     else
152     AC_MSG_RESULT(no)
153     fi
154     fi
155     if test "x$no_sdl" = x ; then
156     ifelse([$2], , :, [$2])
157     else
158     if test "$SDL_CONFIG" = "no" ; then
159     echo "*** The sdl-config script installed by SDL could not be found"
160     echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
161     echo "*** your path, or set the SDL_CONFIG environment variable to the"
162     echo "*** full path to sdl-config."
163     else
164     if test -f conf.sdltest ; then
165     :
166     else
167     echo "*** Could not run SDL test program, checking why..."
168     CFLAGS="$CFLAGS $SDL_CFLAGS"
169     CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
170     LIBS="$LIBS $SDL_LIBS"
171     AC_TRY_LINK([
172     #include <stdio.h>
173     #include "SDL.h"
174    
175     int main(int argc, char *argv[])
176     { return 0; }
177     #undef main
178     #define main K_and_R_C_main
179     ], [ return 0; ],
180     [ echo "*** The test program compiled, but did not run. This usually means"
181     echo "*** that the run-time linker is not finding SDL or finding the wrong"
182     echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
183     echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
184     echo "*** to the installed location Also, make sure you have run ldconfig if that"
185     echo "*** is required on your system"
186     echo "***"
187     echo "*** If you have an old version installed, it is best to remove it, although"
188     echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
189     [ echo "*** The test program failed to compile or link. See the file config.log for the"
190     echo "*** exact error that occured. This usually means SDL was incorrectly installed"
191     echo "*** or that you have moved SDL since it was installed. In the latter case, you"
192     echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
193     CFLAGS="$ac_save_CFLAGS"
194     CXXFLAGS="$ac_save_CXXFLAGS"
195     LIBS="$ac_save_LIBS"
196     fi
197     fi
198     SDL_CFLAGS=""
199     SDL_LIBS=""
200     ifelse([$3], , :, [$3])
201     fi
202     AC_SUBST(SDL_CFLAGS)
203     AC_SUBST(SDL_LIBS)
204     rm -f conf.sdltest
205     ])

  ViewVC Help
Powered by ViewVC 1.1.22