annotate acinclude.m4 @ 68:0b53ace8b875

Initial add.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 25 Sep 2001 15:46:48 +0000
parents
children 72b51548aeca
rev   line source
68
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 # Configure paths for SDL
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 # Sam Lantinga 9/21/99
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
3 # stolen from Manish Singh
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4 # stolen back from Frank Belew
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5 # stolen from Manish Singh
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
6 # Shamelessly stolen from Owen Taylor
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
8 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 AC_DEFUN(AM_PATH_SDL,
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 [dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
13 dnl Get the cflags and libraries from the sdl-config script
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
15 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
16 sdl_prefix="$withval", sdl_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
17 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18 sdl_exec_prefix="$withval", sdl_exec_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 , enable_sdltest=yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
22 if test x$sdl_exec_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
24 if test x${SDL_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
28 if test x$sdl_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29 sdl_args="$sdl_args --prefix=$sdl_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 if test x${SDL_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31 SDL_CONFIG=$sdl_prefix/bin/sdl-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
34
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
35 AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
36 min_sdl_version=ifelse([$1], ,0.11.0,$1)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
37 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
38 no_sdl=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
39 if test "$SDL_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
40 no_sdl=yes
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
41 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
42 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
43 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
44
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
45 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
46 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
47 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
49 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
51 if test "x$enable_sdltest" = "xyes" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
52 ac_save_CFLAGS="$CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
53 ac_save_LIBS="$LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
54 CFLAGS="$CFLAGS $SDL_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
55 LIBS="$LIBS $SDL_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
56 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
57 dnl Now check if the installed SDL is sufficiently new. (Also sanity
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
58 dnl checks the results of sdl-config to some extent
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
59 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
60 rm -f conf.sdltest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
61 AC_TRY_RUN([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
62 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
63 #include <stdlib.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
64 #include <string.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
65 #include "SDL.h"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
66
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
67 char*
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
68 my_strdup (char *str)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
69 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
70 char *new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
71
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
72 if (str)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
73 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
74 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
75 strcpy (new_str, str);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
76 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
77 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
78 new_str = NULL;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
79
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
80 return new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
81 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
82
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
83 int main (int argc, char *argv[])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
84 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
85 int major, minor, micro;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
86 char *tmp_version;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
87
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
88 /* This hangs on some systems (?)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
89 system ("touch conf.sdltest");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
90 */
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
91 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
92
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
93 /* HP/UX 9 (%@#!) writes to sscanf strings */
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
94 tmp_version = my_strdup("$min_sdl_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
95 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
96 printf("%s, bad version string\n", "$min_sdl_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
97 exit(1);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
98 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
99
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
100 if (($sdl_major_version > major) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
101 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
102 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
103 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
104 return 0;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
105 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
106 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
107 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
108 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
109 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
110 printf("*** best to upgrade to the required version.\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
111 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
112 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
113 printf("*** config.cache before re-running configure\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
114 return 1;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
115 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
116 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
117
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
118 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
119 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
120 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
121 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
122 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
123 if test "x$no_sdl" = x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
124 AC_MSG_RESULT(yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
125 ifelse([$2], , :, [$2])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
126 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
127 AC_MSG_RESULT(no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
128 if test "$SDL_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
129 echo "*** The sdl-config script installed by SDL could not be found"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
130 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
131 echo "*** your path, or set the SDL_CONFIG environment variable to the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
132 echo "*** full path to sdl-config."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
133 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
134 if test -f conf.sdltest ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
135 :
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
136 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
137 echo "*** Could not run SDL test program, checking why..."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
138 CFLAGS="$CFLAGS $SDL_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
139 LIBS="$LIBS $SDL_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
140 AC_TRY_LINK([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
141 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
142 #include "SDL.h"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
143
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
144 int main(int argc, char *argv[])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
145 { return 0; }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
146 #undef main
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
147 #define main K_and_R_C_main
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
148 ], [ return 0; ],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
149 [ echo "*** The test program compiled, but did not run. This usually means"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
150 echo "*** that the run-time linker is not finding SDL or finding the wrong"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
151 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
152 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
153 echo "*** to the installed location Also, make sure you have run ldconfig if that"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
154 echo "*** is required on your system"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
155 echo "***"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
156 echo "*** If you have an old version installed, it is best to remove it, although"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
157 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
158 [ echo "*** The test program failed to compile or link. See the file config.log for the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
159 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
160 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
161 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
162 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
163 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
164 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
165 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
166 SDL_CFLAGS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
167 SDL_LIBS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
168 ifelse([$3], , :, [$3])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
169 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
170 AC_SUBST(SDL_CFLAGS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
171 AC_SUBST(SDL_LIBS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
172 rm -f conf.sdltest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
173 ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
174 # Configure paths for libmikmod
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
175 #
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
176 # Derived from glib.m4 (Owen Taylor 97-11-3)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
177 # Improved by Chris Butler
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
178 #
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
179
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
180 dnl AM_PATH_LIBMIKMOD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
181 dnl Test for libmikmod, and define LIBMIKMOD_CFLAGS, LIBMIKMOD_LIBS and
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
182 dnl LIBMIKMOD_LDADD
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
183 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
184 AC_DEFUN(AM_PATH_LIBMIKMOD,
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
185 [dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
186 dnl Get the cflags and libraries from the libmikmod-config script
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
187 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
188 AC_ARG_WITH(libmikmod-prefix,[ --with-libmikmod-prefix=PFX Prefix where libmikmod is installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
189 libmikmod_config_prefix="$withval", libmikmod_config_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
190 AC_ARG_WITH(libmikmod-exec-prefix,[ --with-libmikmod-exec-prefix=PFX Exec prefix where libmikmod is installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
191 libmikmod_config_exec_prefix="$withval", libmikmod_config_exec_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
192 AC_ARG_ENABLE(libmikmodtest, [ --disable-libmikmodtest Do not try to compile and run a test libmikmod program],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
193 , enable_libmikmodtest=yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
194
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
195 if test x$libmikmod_config_exec_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
196 libmikmod_config_args="$libmikmod_config_args --exec-prefix=$libmikmod_config_exec_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
197 if test x${LIBMIKMOD_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
198 LIBMIKMOD_CONFIG=$libmikmod_config_exec_prefix/bin/libmikmod-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
199 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
200 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
201 if test x$libmikmod_config_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
202 libmikmod_config_args="$libmikmod_config_args --prefix=$libmikmod_config_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
203 if test x${LIBMIKMOD_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
204 LIBMIKMOD_CONFIG=$libmikmod_config_prefix/bin/libmikmod-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
205 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
206 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
207
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
208 AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
209 min_libmikmod_version=ifelse([$1], ,3.1.5,$1)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
210 AC_MSG_CHECKING(for libmikmod - version >= $min_libmikmod_version)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
211 no_libmikmod=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
212 if test "$LIBMIKMOD_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
213 no_libmikmod=yes
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
214 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
215 LIBMIKMOD_CFLAGS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --cflags`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
216 LIBMIKMOD_LIBS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --libs`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
217 LIBMIKMOD_LDADD=`$LIBMIKMOD_CONFIG $libmikmod_config_args --ldadd`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
218 libmikmod_config_major_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
219 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
220 libmikmod_config_minor_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
221 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
222 libmikmod_config_micro_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
223 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
224 if test "x$enable_libmikmodtest" = "xyes" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
225 ac_save_CFLAGS="$CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
226 ac_save_LIBS="$LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
227 AC_LANG_SAVE
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
228 AC_LANG_C
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
229 CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS $LIBMIKMOD_LDADD"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
230 LIBS="$LIBMIKMOD_LIBS $LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
231 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
232 dnl Now check if the installed libmikmod is sufficiently new. (Also sanity
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
233 dnl checks the results of libmikmod-config to some extent
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
234 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
235 rm -f conf.mikmodtest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
236 AC_TRY_RUN([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
237 #include <mikmod.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
238 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
239 #include <stdlib.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
240
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
241 char* my_strdup (char *str)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
242 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
243 char *new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
244
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
245 if (str) {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
246 new_str = malloc ((strlen (str) + 1) * sizeof(char));
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
247 strcpy (new_str, str);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
248 } else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
249 new_str = NULL;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
250
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
251 return new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
252 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
253
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
254 int main()
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
255 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
256 int major,minor,micro;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
257 int libmikmod_major_version,libmikmod_minor_version,libmikmod_micro_version;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
258 char *tmp_version;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
259
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
260 system("touch conf.mikmodtest");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
261
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
262 /* HP/UX 9 (%@#!) writes to sscanf strings */
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
263 tmp_version = my_strdup("$min_libmikmod_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
264 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
265 printf("%s, bad version string\n", "$min_libmikmod_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
266 exit(1);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
267 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
268
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
269 libmikmod_major_version=(MikMod_GetVersion() >> 16) & 255;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
270 libmikmod_minor_version=(MikMod_GetVersion() >> 8) & 255;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
271 libmikmod_micro_version=(MikMod_GetVersion() ) & 255;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
272
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
273 if ((libmikmod_major_version != $libmikmod_config_major_version) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
274 (libmikmod_minor_version != $libmikmod_config_minor_version) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
275 (libmikmod_micro_version != $libmikmod_config_micro_version))
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
276 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
277 printf("\n*** 'libmikmod-config --version' returned %d.%d.%d, but libmikmod (%d.%d.%d)\n",
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
278 $libmikmod_config_major_version, $libmikmod_config_minor_version, $libmikmod_config_micro_version,
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
279 libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
280 printf ("*** was found! If libmikmod-config was correct, then it is best\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
281 printf ("*** to remove the old version of libmikmod. You may also be able to fix the error\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
282 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
283 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
284 printf("*** required on your system.\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
285 printf("*** If libmikmod-config was wrong, set the environment variable LIBMIKMOD_CONFIG\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
286 printf("*** to point to the correct copy of libmikmod-config, and remove the file config.cache\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
287 printf("*** before re-running configure\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
288 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
289 else if ((libmikmod_major_version != LIBMIKMOD_VERSION_MAJOR) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
290 (libmikmod_minor_version != LIBMIKMOD_VERSION_MINOR) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
291 (libmikmod_micro_version != LIBMIKMOD_REVISION))
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
292 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
293 printf("*** libmikmod header files (version %d.%d.%d) do not match\n",
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
294 LIBMIKMOD_VERSION_MAJOR, LIBMIKMOD_VERSION_MINOR, LIBMIKMOD_REVISION);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
295 printf("*** library (version %d.%d.%d)\n",
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
296 libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
297 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
298 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
299 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
300 if ((libmikmod_major_version > major) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
301 ((libmikmod_major_version == major) && (libmikmod_minor_version > minor)) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
302 ((libmikmod_major_version == major) && (libmikmod_minor_version == minor) && (libmikmod_micro_version >= micro)))
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
303 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
304 return 0;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
305 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
306 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
307 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
308 printf("\n*** An old version of libmikmod (%d.%d.%d) was found.\n",
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
309 libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
310 printf("*** You need a version of libmikmod newer than %d.%d.%d.\n",
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
311 major, minor, micro);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
312 printf("***\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
313 printf("*** If you have already installed a sufficiently new version, this error\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
314 printf("*** probably means that the wrong copy of the libmikmod-config shell script is\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
315 printf("*** being found. The easiest way to fix this is to remove the old version\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
316 printf("*** of libmikmod, but you can also set the LIBMIKMOD_CONFIG environment to point to the\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
317 printf("*** correct copy of libmikmod-config. (In this case, you will have to\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
318 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
319 printf("*** so that the correct libraries are found at run-time))\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
320 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
321 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
322 return 1;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
323 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
324 ],, no_libmikmod=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
325 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
326 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
327 AC_LANG_RESTORE
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
328 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
329 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
330 if test "x$no_libmikmod" = x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
331 AC_MSG_RESULT([yes, `$LIBMIKMOD_CONFIG --version`])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
332 ifelse([$2], , :, [$2])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
333 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
334 AC_MSG_RESULT(no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
335 if test "$LIBMIKMOD_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
336 echo "*** The libmikmod-config script installed by libmikmod could not be found"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
337 echo "*** If libmikmod was installed in PREFIX, make sure PREFIX/bin is in"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
338 echo "*** your path, or set the LIBMIKMOD_CONFIG environment variable to the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
339 echo "*** full path to libmikmod-config."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
340 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
341 if test -f conf.mikmodtest ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
342 :
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
343 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
344 echo "*** Could not run libmikmod test program, checking why..."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
345 CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
346 LIBS="$LIBS $LIBMIKMOD_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
347 AC_LANG_SAVE
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
348 AC_LANG_C
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
349 AC_TRY_LINK([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
350 #include <mikmod.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
351 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
352 ], [ return (MikMod_GetVersion()!=0); ],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
353 [ echo "*** The test program compiled, but did not run. This usually means"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
354 echo "*** that the run-time linker is not finding libmikmod or finding the wrong"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
355 echo "*** version of libmikmod. If it is not finding libmikmod, you'll need to set your"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
356 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
357 echo "*** to the installed location. Also, make sure you have run ldconfig if that"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
358 echo "*** is required on your system."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
359 echo "***"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
360 echo "*** If you have an old version installed, it is best to remove it, although"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
361 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
362 [ echo "*** The test program failed to compile or link. See the file config.log for the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
363 echo "*** exact error that occured. This usually means libmikmod was incorrectly installed"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
364 echo "*** or that you have moved libmikmod since it was installed. In the latter case, you"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
365 echo "*** may want to edit the libmikmod-config script: $LIBMIKMOD_CONFIG" ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
366 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
367 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
368 AC_LANG_RESTORE
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
369 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
370 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
371 LIBMIKMOD_CFLAGS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
372 LIBMIKMOD_LIBS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
373 LIBMIKMOD_LDADD=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
374 ifelse([$3], , :, [$3])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
375 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
376 AC_SUBST(LIBMIKMOD_CFLAGS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
377 AC_SUBST(LIBMIKMOD_LIBS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
378 AC_SUBST(LIBMIKMOD_LDADD)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
379 rm -f conf.mikmodtest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
380 ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
381 # Configure paths for libvorbis
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
382 # Jack Moffitt <jack@icecast.org> 10-21-2000
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
383 # Shamelessly stolen from Owen Taylor and Manish Singh
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
384
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
385 dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
386 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
387 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
388 AC_DEFUN(AM_PATH_VORBIS,
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
389 [dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
390 dnl Get the cflags and libraries
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
391 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
392 AC_ARG_WITH(vorbis-prefix,[ --with-vorbis-prefix=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
393 AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
394
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
395 if test x$vorbis_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
396 vorbis_args="$vorbis_args --prefix=$vorbis_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
397 VORBIS_CFLAGS="-I$vorbis_prefix/include"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
398 VORBIS_LIBDIR="-L$vorbis_prefix/lib"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
399 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
400
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
401 VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
402 VORBISFILE_LIBS="-lvorbisfile"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
403 VORBISENC_LIBS="-lvorbisenc"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
404
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
405 AC_MSG_CHECKING(for Vorbis)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
406 no_vorbis=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
407
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
408
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
409 if test "x$enable_vorbistest" = "xyes" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
410 ac_save_CFLAGS="$CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
411 ac_save_LIBS="$LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
412 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
413 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
414 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
415 dnl Now check if the installed Vorbis is sufficiently new.
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
416 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
417 rm -f conf.vorbistest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
418 AC_TRY_RUN([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
419 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
420 #include <stdlib.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
421 #include <string.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
422 #include <vorbis/codec.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
423
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
424 int main ()
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
425 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
426 system("touch conf.vorbistest");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
427 return 0;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
428 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
429
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
430 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
431 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
432 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
433 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
434
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
435 if test "x$no_vorbis" = x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
436 AC_MSG_RESULT(yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
437 ifelse([$1], , :, [$1])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
438 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
439 AC_MSG_RESULT(no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
440 if test -f conf.vorbistest ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
441 :
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
442 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
443 echo "*** Could not run Vorbis test program, checking why..."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
444 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
445 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
446 AC_TRY_LINK([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
447 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
448 #include <vorbis/codec.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
449 ], [ return 0; ],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
450 [ echo "*** The test program compiled, but did not run. This usually means"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
451 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
452 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
453 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
454 echo "*** to the installed location Also, make sure you have run ldconfig if that"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
455 echo "*** is required on your system"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
456 echo "***"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
457 echo "*** If you have an old version installed, it is best to remove it, although"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
458 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
459 [ echo "*** The test program failed to compile or link. See the file config.log for the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
460 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
461 echo "*** or that you have moved Vorbis since it was installed." ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
462 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
463 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
464 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
465 VORBIS_CFLAGS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
466 VORBIS_LIBS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
467 VORBISFILE_LIBS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
468 VORBISENC_LIBS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
469 ifelse([$2], , :, [$2])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
470 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
471 AC_SUBST(VORBIS_CFLAGS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
472 AC_SUBST(VORBIS_LIBS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
473 AC_SUBST(VORBISFILE_LIBS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
474 AC_SUBST(VORBISENC_LIBS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
475 rm -f conf.vorbistest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
476 ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
477 # Configure paths for SMPEG
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
478 # Nicolas Vignal 11/19/2000
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
479 # stolen from Sam Lantinga
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
480 # stolen from Manish Singh
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
481 # stolen back from Frank Belew
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
482 # stolen from Manish Singh
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
483 # Shamelessly stolen from Owen Taylor
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
484
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
485 dnl AM_PATH_SMPEG([MINIMUM-VERSION, [ACTION-IF-FOUND [,
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
486 ACTION-IF-NOT-FOUND]]])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
487 dnl Test for SMPEG, and define SMPEG_CFLAGS and SMPEG_LIBS
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
488 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
489 AC_DEFUN(AM_PATH_SMPEG,
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
490 [dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
491 dnl Get the cflags and libraries from the smpeg-config script
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
492 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
493 AC_ARG_WITH(smpeg-prefix,[ --with-smpeg-prefix=PFX Prefix where SMPEG is
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
494 installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
495 smpeg_prefix="$withval", smpeg_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
496 AC_ARG_WITH(smpeg-exec-prefix,[ --with-smpeg-exec-prefix=PFX Exec prefix
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
497 where SMPEG is installed (optional)],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
498 smpeg_exec_prefix="$withval", smpeg_exec_prefix="")
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
499 AC_ARG_ENABLE(smpegtest, [ --disable-smpegtest Do not try to compile
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
500 and run a test SMPEG program],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
501 , enable_smpegtest=yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
502
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
503 if test x$smpeg_exec_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
504 smpeg_args="$smpeg_args --exec-prefix=$smpeg_exec_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
505 if test x${SMPEG_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
506 SMPEG_CONFIG=$smpeg_exec_prefix/bin/smpeg-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
507 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
508 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
509 if test x$smpeg_prefix != x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
510 smpeg_args="$smpeg_args --prefix=$smpeg_prefix"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
511 if test x${SMPEG_CONFIG+set} != xset ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
512 SMPEG_CONFIG=$smpeg_prefix/bin/smpeg-config
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
513 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
514 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
515
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
516 AC_PATH_PROG(SMPEG_CONFIG, smpeg-config, no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
517 min_smpeg_version=ifelse([$1], ,0.2.7,$1)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
518 AC_MSG_CHECKING(for SMPEG - version >= $min_smpeg_version)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
519 no_smpeg=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
520 if test "$SMPEG_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
521 no_smpeg=yes
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
522 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
523 SMPEG_CFLAGS=`$SMPEG_CONFIG $smpegconf_args --cflags`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
524 SMPEG_LIBS=`$SMPEG_CONFIG $smpegconf_args --libs`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
525
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
526 smpeg_major_version=`$SMPEG_CONFIG $smpeg_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
527 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
528 smpeg_minor_version=`$SMPEG_CONFIG $smpeg_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
529 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
530 smpeg_micro_version=`$SMPEG_CONFIG $smpeg_config_args --version | \
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
531 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
532 if test "x$enable_smpegtest" = "xyes" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
533 ac_save_CFLAGS="$CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
534 ac_save_LIBS="$LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
535 CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
536 LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
537 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
538 dnl Now check if the installed SMPEG is sufficiently new. (Also sanity
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
539 dnl checks the results of smpeg-config to some extent
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
540 dnl
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
541 rm -f conf.smpegtest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
542 AC_TRY_RUN([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
543 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
544 #include <stdlib.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
545 #include <string.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
546 #include "smpeg.h"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
547
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
548 char*
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
549 my_strdup (char *str)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
550 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
551 char *new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
552
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
553 if (str)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
554 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
555 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
556 strcpy (new_str, str);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
557 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
558 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
559 new_str = NULL;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
560
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
561 return new_str;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
562 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
563
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
564 int main (int argc, char *argv[])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
565 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
566 int major, minor, micro;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
567 char *tmp_version;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
568
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
569 /* This hangs on some systems (?)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
570 system ("touch conf.smpegtest");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
571 */
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
572 { FILE *fp = fopen("conf.smpegtest", "a"); if ( fp ) fclose(fp); }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
573
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
574 /* HP/UX 9 (%@#!) writes to sscanf strings */
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
575 tmp_version = my_strdup("$min_smpeg_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
576 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
577 printf("%s, bad version string\n", "$min_smpeg_version");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
578 exit(1);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
579 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
580
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
581 if (($smpeg_major_version > major) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
582 (($smpeg_major_version == major) && ($smpeg_minor_version > minor)) ||
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
583 (($smpeg_major_version == major) && ($smpeg_minor_version == minor)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
584 && ($smpeg_micro_version >= micro)))
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
585 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
586 return 0;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
587 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
588 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
589 {
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
590 printf("\n*** 'smpeg-config --version' returned %d.%d.%d, but the
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
591 minimum version\n", $smpeg_major_version, $smpeg_minor_version,
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
592 $smpeg_micro_version);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
593 printf("*** of SMPEG required is %d.%d.%d. If smpeg-config is
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
594 correct, then it is\n", major, minor, micro);
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
595 printf("*** best to upgrade to the required version.\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
596 printf("*** If smpeg-config was wrong, set the environment variable
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
597 SMPEG_CONFIG\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
598 printf("*** to point to the correct copy of smpeg-config, and remove
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
599 the file\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
600 printf("*** config.cache before re-running configure\n");
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
601 return 1;
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
602 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
603 }
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
604
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
605 ],, no_smpeg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
606 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
607 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
608 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
609 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
610 if test "x$no_smpeg" = x ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
611 AC_MSG_RESULT(yes)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
612 ifelse([$2], , :, [$2])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
613 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
614 AC_MSG_RESULT(no)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
615 if test "$SMPEG_CONFIG" = "no" ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
616 echo "*** The smpeg-config script installed by SMPEG could not be
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
617 found"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
618 echo "*** If SMPEG was installed in PREFIX, make sure PREFIX/bin is
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
619 in"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
620 echo "*** your path, or set the SMPEG_CONFIG environment variable to
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
621 the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
622 echo "*** full path to smpeg-config."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
623 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
624 if test -f conf.smpegtest ; then
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
625 :
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
626 else
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
627 echo "*** Could not run SMPEG test program, checking why..."
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
628 CFLAGS="$CFLAGS $SMPEG_CFLAGS $SDL_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
629 LIBS="$LIBS $SMPEG_LIBS $SDL_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
630 AC_TRY_LINK([
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
631 #include <stdio.h>
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
632 #include "smpeg.h"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
633 ], [ return 0; ],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
634 [ echo "*** The test program compiled, but did not run. This
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
635 usually means"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
636 echo "*** that the run-time linker is not finding SMPEG or
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
637 finding the wrong"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
638 echo "*** version of SMPEG. If it is not finding SMPEG, you'll
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
639 need to set your"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
640 echo "*** LD_LIBRARY_PATH environment variable, or edit
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
641 /etc/ld.so.conf to point"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
642 echo "*** to the installed location Also, make sure you have run
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
643 ldconfig if that"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
644 echo "*** is required on your system"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
645 echo "***"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
646 echo "*** If you have an old version installed, it is best to
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
647 remove it, although"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
648 echo "*** you may also be able to get things to work by modifying
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
649 LD_LIBRARY_PATH"],
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
650 [ echo "*** The test program failed to compile or link. See the
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
651 file config.log for the"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
652 echo "*** exact error that occured. This usually means SMPEG was
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
653 incorrectly installed"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
654 echo "*** or that you have moved SMPEG since it was installed. In
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
655 the latter case, you"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
656 echo "*** may want to edit the smpeg-config script:
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
657 $SMPEG_CONFIG" ])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
658 CFLAGS="$ac_save_CFLAGS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
659 LIBS="$ac_save_LIBS"
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
660 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
661 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
662 SMPEG_CFLAGS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
663 SMPEG_LIBS=""
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
664 ifelse([$3], , :, [$3])
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
665 fi
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
666 AC_SUBST(SMPEG_CFLAGS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
667 AC_SUBST(SMPEG_LIBS)
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
668 rm -f conf.smpegtest
0b53ace8b875 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
669 ])