In game ranking ordered by skill
[scorched3d/parasti.git] / acinclude.m4
blobedee3586b751ee2ed5629aac4e25a5bbb20e0390
1 # 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
8 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
9 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
10 dnl
11 AC_DEFUN([AM_PATH_SDL],
12 [dnl 
13 dnl Get the cflags and libraries from the sdl-config script
14 dnl
15 AC_ARG_WITH(sdl-static,[  --with-sdl-static       Link SDL staticaly (optional)],
16             sdl_static="$withval", sdl_static="")
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)
24   if test x$sdl_exec_prefix != x ; then
25      sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
26      if test x${SDL_CONFIG+set} != xset ; then
27         SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
28      fi
29   fi
30   if test x$sdl_prefix != x ; then
31      sdl_args="$sdl_args --prefix=$sdl_prefix"
32      if test x${SDL_CONFIG+set} != xset ; then
33         SDL_CONFIG=$sdl_prefix/bin/sdl-config
34      fi
35   fi
37   AC_REQUIRE([AC_CANONICAL_TARGET])
38   PATH="$prefix/bin:$prefix/usr/bin:$PATH"
39   AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
40   min_sdl_version=ifelse([$1], ,0.11.0,$1)
41   AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
42   no_sdl=""
43   if test "$SDL_CONFIG" = "no" ; then
44     no_sdl=yes
45   else
46     SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
48         if test x"$sdl_static" = x"yes"; then
49     SDL_LIBS=`$SDL_CONFIG $sdlconf_args --static-libs`
50         else
51     SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
52         fi
54     sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
55            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
56     sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
57            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
58     sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
59            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
60     if test "x$enable_sdltest" = "xyes" ; then
61       ac_save_CFLAGS="$CFLAGS"
62       ac_save_CXXFLAGS="$CXXFLAGS"
63       ac_save_LIBS="$LIBS"
64       CFLAGS="$CFLAGS $SDL_CFLAGS"
65       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
66       LIBS="$LIBS $SDL_LIBS"
67 dnl
68 dnl Now check if the installed SDL is sufficiently new. (Also sanity
69 dnl checks the results of sdl-config to some extent
70 dnl
71       rm -f conf.sdltest
72       AC_TRY_RUN([
73 #include <stdio.h>
74 #include <stdlib.h>
75 #include <string.h>
76 #include <SDL/SDL.h>
78 char*
79 my_strdup (char *str)
81   char *new_str;
82   
83   if (str)
84     {
85       new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
86       strcpy (new_str, str);
87     }
88   else
89     new_str = NULL;
90   
91   return new_str;
94 int main (int argc, char *argv[])
96   int major, minor, micro;
97   char *tmp_version;
99   /* This hangs on some systems (?)
100   system ("touch conf.sdltest");
101   */
102   { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
104   /* HP/UX 9 (%@#!) writes to sscanf strings */
105   tmp_version = my_strdup("$min_sdl_version");
106   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
107      printf("%s, bad version string\n", "$min_sdl_version");
108      exit(1);
109    }
111    if (($sdl_major_version > major) ||
112       (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
113       (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
114     {
115       return 0;
116     }
117   else
118     {
119       printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
120       printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
121       printf("*** best to upgrade to the required version.\n");
122       printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
123       printf("*** to point to the correct copy of sdl-config, and remove the file\n");
124       printf("*** config.cache before re-running configure\n");
125       return 1;
126     }
129 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
130        CFLAGS="$ac_save_CFLAGS"
131        CXXFLAGS="$ac_save_CXXFLAGS"
132        LIBS="$ac_save_LIBS"
133      fi
134   fi
135   if test "x$no_sdl" = x ; then
136      AC_MSG_RESULT(yes)
137      ifelse([$2], , :, [$2])     
138   else
139      AC_MSG_RESULT(no)
140      if test "$SDL_CONFIG" = "no" ; then
141        echo "*** The sdl-config script installed by SDL could not be found"
142        echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
143        echo "*** your path, or set the SDL_CONFIG environment variable to the"
144        echo "*** full path to sdl-config."
145      else
146        if test -f conf.sdltest ; then
147         :
148        else
149           echo "*** Could not run SDL test program, checking why..."
150           CFLAGS="$CFLAGS $SDL_CFLAGS"
151           CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
152           LIBS="$LIBS $SDL_LIBS"
153           AC_TRY_LINK([
154 #include <stdio.h>
155 #include <SDL/SDL.h>
157 int main(int argc, char *argv[])
158 { return 0; }
159 #undef  main
160 #define main K_and_R_C_main
161 ],      [ return 0; ],
162         [ echo "*** The test program compiled, but did not run. This usually means"
163           echo "*** that the run-time linker is not finding SDL or finding the wrong"
164           echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
165           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
166           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
167           echo "*** is required on your system"
168           echo "***"
169           echo "*** If you have an old version installed, it is best to remove it, although"
170           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
171         [ echo "*** The test program failed to compile or link. See the file config.log for the"
172           echo "*** exact error that occured. This usually means SDL was incorrectly installed"
173           echo "*** or that you have moved SDL since it was installed. In the latter case, you"
174           echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
175           CFLAGS="$ac_save_CFLAGS"
176           CXXFLAGS="$ac_save_CXXFLAGS"
177           LIBS="$ac_save_LIBS"
178        fi
179      fi
180      SDL_CFLAGS=""
181      SDL_LIBS=""
182      ifelse([$3], , :, [$3])
183   fi
184   AC_SUBST(SDL_CFLAGS)
185   AC_SUBST(SDL_LIBS)
186   rm -f conf.sdltest
188 dnl ---------------------------------------------------------------------------
189 dnl Macros for wxWindows detection. Typically used in configure.in as:
191 dnl     AC_ARG_ENABLE(...)
192 dnl     AC_ARG_WITH(...)
193 dnl     ...
194 dnl     AM_OPTIONS_WXCONFIG
195 dnl     ...
196 dnl     ...
197 dnl     AM_PATH_WXCONFIG(2.3.4, wxWin=1)
198 dnl     if test "$wxWin" != 1; then
199 dnl        AC_MSG_ERROR([
200 dnl                wxWindows must be installed on your system
201 dnl                but wx-config script couldn't be found.
202 dnl     
203 dnl                Please check that wx-config is in path, the directory
204 dnl                where wxWindows libraries are installed (returned by
205 dnl                'wx-config --libs' command) is in LD_LIBRARY_PATH or
206 dnl                equivalent variable and wxWindows version is 2.3.4 or above.
207 dnl        ])
208 dnl     fi
209 dnl     CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
210 dnl     CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
211 dnl     CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
212 dnl     
213 dnl     LDFLAGS="$LDFLAGS $WX_LIBS"
214 dnl ---------------------------------------------------------------------------
216 dnl ---------------------------------------------------------------------------
217 dnl AM_OPTIONS_WXCONFIG
219 dnl adds support for --wx-prefix, --wx-exec-prefix and --wx-config 
220 dnl command line options
221 dnl ---------------------------------------------------------------------------
223 AC_DEFUN([AM_OPTIONS_WXCONFIG],
225    AC_ARG_WITH(wx-prefix, [  --with-wx-prefix=PREFIX   Prefix where wxWindows is installed (optional)],
226                wx_config_prefix="$withval", wx_config_prefix="")
227    AC_ARG_WITH(wx-exec-prefix,[  --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional)],
228                wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
229    AC_ARG_WITH(wx-config,[  --with-wx-config=CONFIG   wx-config script to use (optional)],
230                wx_config_name="$withval", wx_config_name="")
233 dnl ---------------------------------------------------------------------------
234 dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
236 dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
237 dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME
238 dnl environment variable to override the default name of the wx-config script
239 dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
240 dnl case the macro won't even waste time on tests for its existence.
241 dnl ---------------------------------------------------------------------------
244 dnl Get the cflags and libraries from the wx-config script
246 AC_DEFUN([AM_PATH_WXCONFIG],
248   dnl do we have wx-config name: it can be wx-config or wxd-config or ...
249   if test x${WX_CONFIG_NAME+set} != xset ; then
250      WX_CONFIG_NAME=wx-config
251   fi
252   if test "x$wx_config_name" != x ; then
253      WX_CONFIG_NAME="$wx_config_name"
254   fi
256   dnl deal with optional prefixes
257   if test x$wx_config_exec_prefix != x ; then
258      wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
259      WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
260   fi
261   if test x$wx_config_prefix != x ; then
262      wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
263      WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
264   fi
266   dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
267   if test -x "$WX_CONFIG_NAME" ; then
268      AC_MSG_CHECKING(for wx-config)
269      WX_CONFIG_PATH="$WX_CONFIG_NAME"
270      AC_MSG_RESULT($WX_CONFIG_PATH)
271   else
272      AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
273   fi
275   if test "$WX_CONFIG_PATH" != "no" ; then
276     WX_VERSION=""
277     no_wx=""
279     min_wx_version=ifelse([$1], ,2.2.1,$1)
280     AC_MSG_CHECKING(for wxWindows version >= $min_wx_version)
282     WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args"
284     WX_VERSION=`$WX_CONFIG_WITH_ARGS --version`
285     wx_config_major_version=`echo $WX_VERSION | \
286            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
287     wx_config_minor_version=`echo $WX_VERSION | \
288            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
289     wx_config_micro_version=`echo $WX_VERSION | \
290            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
292     wx_requested_major_version=`echo $min_wx_version | \
293            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
294     wx_requested_minor_version=`echo $min_wx_version | \
295            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
296     wx_requested_micro_version=`echo $min_wx_version | \
297            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
299     wx_ver_ok=""
300     if test $wx_config_major_version -gt $wx_requested_major_version; then
301       wx_ver_ok=yes
302     else
303       if test $wx_config_major_version -eq $wx_requested_major_version; then
304          if test $wx_config_minor_version -gt $wx_requested_minor_version; then
305             wx_ver_ok=yes
306          else
307             if test $wx_config_minor_version -eq $wx_requested_minor_version; then
308                if test $wx_config_micro_version -ge $wx_requested_micro_version; then
309                   wx_ver_ok=yes
310                fi
311             fi
312          fi
313       fi
314     fi
316     if test "x$wx_ver_ok" = x ; then
317       no_wx=yes
318     else
319       WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
320       WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs`
322       dnl starting with version 2.2.6 wx-config has --cppflags argument
323       wx_has_cppflags=""
324       if test $wx_config_major_version -gt 2; then
325         wx_has_cppflags=yes
326       else
327         if test $wx_config_major_version -eq 2; then
328            if test $wx_config_minor_version -gt 2; then
329               wx_has_cppflags=yes
330            else
331               if test $wx_config_minor_version -eq 2; then
332                  if test $wx_config_micro_version -ge 6; then
333                     wx_has_cppflags=yes
334                  fi
335               fi
336            fi
337         fi
338       fi
340       if test "x$wx_has_cppflags" = x ; then
341          dnl no choice but to define all flags like CFLAGS
342          WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
343          WX_CPPFLAGS=$WX_CFLAGS
344          WX_CXXFLAGS=$WX_CFLAGS
346          WX_CFLAGS_ONLY=$WX_CFLAGS
347          WX_CXXFLAGS_ONLY=$WX_CFLAGS
348       else
349          dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
350          WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
351          WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
352          WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
354          WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
355          WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
356       fi
357     fi
359     if test "x$no_wx" = x ; then
360        AC_MSG_RESULT(yes (version $WX_VERSION))
361        ifelse([$2], , :, [$2])
362     else
363        if test "x$WX_VERSION" = x; then
364           dnl no wx-config at all
365           AC_MSG_RESULT(no)
366        else
367           AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
368        fi
370        WX_CFLAGS=""
371        WX_CPPFLAGS=""
372        WX_CXXFLAGS=""
373        WX_LIBS=""
374        WX_LIBS_STATIC=""
375        ifelse([$3], , :, [$3])
376     fi
377   fi
379   AC_SUBST(WX_CPPFLAGS)
380   AC_SUBST(WX_CFLAGS)
381   AC_SUBST(WX_CXXFLAGS)
382   AC_SUBST(WX_CFLAGS_ONLY)
383   AC_SUBST(WX_CXXFLAGS_ONLY)
384   AC_SUBST(WX_LIBS)
385   AC_SUBST(WX_LIBS_STATIC)
386   AC_SUBST(WX_VERSION)
388 # Configure paths for FreeType2
389 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
392 # AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
393 # Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
394 # MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is
395 # FreeType 2.0.4).
397 AC_DEFUN([AC_CHECK_FT2],
398   [# Get the cflags and libraries from the freetype-config script
399    #
400    AC_ARG_WITH([ft-prefix],
401      AC_HELP_STRING([--with-ft-prefix=PREFIX],
402                     [Prefix where FreeType is installed (optional)]),
403      [ft_config_prefix="$withval"],
404      [ft_config_prefix=""])
406    AC_ARG_WITH([ft-exec-prefix],
407      AC_HELP_STRING([--with-ft-exec-prefix=PREFIX],
408                     [Exec prefix where FreeType is installed (optional)]),
409      [ft_config_exec_prefix="$withval"],
410      [ft_config_exec_prefix=""])
412    AC_ARG_ENABLE([freetypetest],
413      AC_HELP_STRING([--disable-freetypetest],
414                     [Do not try to compile and run a test FreeType program]),
415      [],
416      [enable_fttest=yes])
418    if test x$ft_config_exec_prefix != x ; then
419      ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
420      if test x${FT2_CONFIG+set} != xset ; then
421        FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
422      fi
423    fi
425    if test x$ft_config_prefix != x ; then
426      ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
427      if test x${FT2_CONFIG+set} != xset ; then
428        FT2_CONFIG=$ft_config_prefix/bin/freetype-config
429      fi
430    fi
432    AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no])
434    min_ft_version=m4_if([$1], [], [7.0.1], [$1])
435    AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
436    no_ft=""
437    if test "$FT2_CONFIG" = "no" ; then
438      no_ft=yes
439    else
440      FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
441      FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
442      ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
443        sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
444      ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
445        sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
446      ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
447        sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
448      ft_min_major_version=`echo $min_ft_version | \
449        sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
450      ft_min_minor_version=`echo $min_ft_version | \
451        sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
452      ft_min_micro_version=`echo $min_ft_version | \
453        sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
454      if test x$enable_fttest = xyes ; then
455        ft_config_is_lt=""
456        if test $ft_config_major_version -lt $ft_min_major_version ; then
457          ft_config_is_lt=yes
458        else
459          if test $ft_config_major_version -eq $ft_min_major_version ; then
460            if test $ft_config_minor_version -lt $ft_min_minor_version ; then
461              ft_config_is_lt=yes
462            else
463              if test $ft_config_minor_version -eq $ft_min_minor_version ; then
464                if test $ft_config_micro_version -lt $ft_min_micro_version ; then
465                  ft_config_is_lt=yes
466                fi
467              fi
468            fi
469          fi
470        fi
471        if test x$ft_config_is_lt = xyes ; then
472          no_ft=yes
473        else
474          ac_save_CFLAGS="$CFLAGS"
475          ac_save_LIBS="$LIBS"
476          CFLAGS="$CFLAGS $FT2_CFLAGS"
477          LIBS="$FT2_LIBS $LIBS"
479          #
480          # Sanity checks for the results of freetype-config to some extent.
481          #
482          AC_RUN_IFELSE([
483              AC_LANG_SOURCE([[
485 #include <ft2build.h>
486 #include FT_FREETYPE_H
487 #include <stdio.h>
488 #include <stdlib.h>
491 main()
493   FT_Library library;
494   FT_Error  error;
496   error = FT_Init_FreeType(&library);
498   if (error)
499     return 1;
500   else
501   {
502     FT_Done_FreeType(library);
503     return 0;
504   }
507              ]])
508            ],
509            [],
510            [no_ft=yes],
511            [echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
513          CFLAGS="$ac_save_CFLAGS"
514          LIBS="$ac_save_LIBS"
515        fi             # test $ft_config_version -lt $ft_min_version
516      fi               # test x$enable_fttest = xyes
517    fi                 # test "$FT2_CONFIG" = "no"
519    if test x$no_ft = x ; then
520      AC_MSG_RESULT([yes])
521      m4_if([$2], [], [:], [$2])
522    else
523      AC_MSG_RESULT([no])
524      if test "$FT2_CONFIG" = "no" ; then
525        AC_MSG_WARN([
527   The freetype-config script installed by FreeType 2 could not be found.
528   If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
529   your path, or set the FT2_CONFIG environment variable to the
530   full path to freetype-config.
531        ])
532      else
533        if test x$ft_config_is_lt = xyes ; then
534          AC_MSG_WARN([
536   Your installed version of the FreeType 2 library is too old.
537   If you have different versions of FreeType 2, make sure that
538   correct values for --with-ft-prefix or --with-ft-exec-prefix
539   are used, or set the FT2_CONFIG environment variable to the
540   full path to freetype-config.
541          ])
542        else
543          AC_MSG_WARN([
545   The FreeType test program failed to run.  If your system uses
546   shared libraries and they are installed outside the normal
547   system library path, make sure the variable LD_LIBRARY_PATH
548   (or whatever is appropiate for your system) is correctly set.
549          ])
550        fi
551      fi
553      FT2_CFLAGS=""
554      FT2_LIBS=""
555      m4_if([$3], [], [:], [$3])
556    fi
558    AC_SUBST([FT2_CFLAGS])
559    AC_SUBST([FT2_LIBS])])
561 # end of freetype2.m4
562 # Configure paths for libogg
563 # Jack Moffitt <jack@icecast.org> 10-21-2000
564 # Shamelessly stolen from Owen Taylor and Manish Singh
566 dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
567 dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
569 AC_DEFUN([XIPH_PATH_OGG],
570 [dnl 
571 dnl Get the cflags and libraries
573 AC_ARG_WITH(ogg,[  --with-ogg=PFX   Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
574 AC_ARG_WITH(ogg-libraries,[  --with-ogg-libraries=DIR   Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
575 AC_ARG_WITH(ogg-includes,[  --with-ogg-includes=DIR   Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
576 AC_ARG_ENABLE(oggtest, [  --disable-oggtest       Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
578   if test "x$ogg_libraries" != "x" ; then
579     OGG_LIBS="-L$ogg_libraries"
580   elif test "x$ogg_prefix" != "x" ; then
581     OGG_LIBS="-L$ogg_prefix/lib"
582   elif test "x$prefix" != "xNONE" ; then
583     OGG_LIBS="-L$prefix/lib"
584   fi
586 if test `uname` == Darwin; then
587   OGG_LIBS="$OGG_LIBS -framework Ogg"
588 else
589   OGG_LIBS="$OGG_LIBS -logg"
592   if test "x$ogg_includes" != "x" ; then
593     OGG_CFLAGS="-I$ogg_includes"
594   elif test "x$ogg_prefix" != "x" ; then
595     OGG_CFLAGS="-I$ogg_prefix/include"
596   elif test "x$prefix" != "xNONE"; then
597     OGG_CFLAGS="-I$prefix/include"
598   fi
600   AC_MSG_CHECKING(for Ogg)
601   no_ogg=""
604   if test "x$enable_oggtest" = "xyes" ; then
605     ac_save_CFLAGS="$CFLAGS"
606     ac_save_LIBS="$LIBS"
607     CFLAGS="$CFLAGS $OGG_CFLAGS"
608     LIBS="$LIBS $OGG_LIBS"
610 dnl Now check if the installed Ogg is sufficiently new.
612       rm -f conf.oggtest
613       AC_TRY_RUN([
614 #include <stdio.h>
615 #include <stdlib.h>
616 #include <string.h>
617 #include <ogg/ogg.h>
619 int main ()
621   system("touch conf.oggtest");
622   return 0;
625 ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
626        CFLAGS="$ac_save_CFLAGS"
627        LIBS="$ac_save_LIBS"
628   fi
630   if test "x$no_ogg" = "x" ; then
631      AC_MSG_RESULT(yes)
632      ifelse([$1], , :, [$1])     
633   else
634      AC_MSG_RESULT(no)
635      if test -f conf.oggtest ; then
636        :
637      else
638        echo "*** Could not run Ogg test program, checking why..."
639        CFLAGS="$CFLAGS $OGG_CFLAGS"
640        LIBS="$LIBS $OGG_LIBS"
641        AC_TRY_LINK([
642 #include <stdio.h>
643 #include <ogg/ogg.h>
644 ],     [ return 0; ],
645        [ echo "*** The test program compiled, but did not run. This usually means"
646        echo "*** that the run-time linker is not finding Ogg or finding the wrong"
647        echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
648        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
649        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
650        echo "*** is required on your system"
651        echo "***"
652        echo "*** If you have an old version installed, it is best to remove it, although"
653        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
654        [ echo "*** The test program failed to compile or link. See the file config.log for the"
655        echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
656        echo "*** or that you have moved Ogg since it was installed." ])
657        CFLAGS="$ac_save_CFLAGS"
658        LIBS="$ac_save_LIBS"
659      fi
660      OGG_CFLAGS=""
661      OGG_LIBS=""
662      ifelse([$2], , :, [$2])
663   fi
664   AC_SUBST(OGG_CFLAGS)
665   AC_SUBST(OGG_LIBS)
666   rm -f conf.oggtest
668 # Configure paths for libvorbis
669 # Jack Moffitt <jack@icecast.org> 10-21-2000
670 # Shamelessly stolen from Owen Taylor and Manish Singh
671 # thomasvs added check for vorbis_bitrate_addblock which is new in rc3
673 dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
674 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
676 AC_DEFUN([XIPH_PATH_VORBIS],
677 [dnl 
678 dnl Get the cflags and libraries
680 AC_ARG_WITH(vorbis,[  --with-vorbis=PFX   Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
681 AC_ARG_WITH(vorbis-libraries,[  --with-vorbis-libraries=DIR   Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
682 AC_ARG_WITH(vorbis-includes,[  --with-vorbis-includes=DIR   Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
683 AC_ARG_ENABLE(vorbistest, [  --disable-vorbistest       Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
685   if test "x$vorbis_libraries" != "x" ; then
686     VORBIS_LIBS="-L$vorbis_libraries"
687   elif test "x$vorbis_prefix" != "x" ; then
688     VORBIS_LIBS="-L$vorbis_prefix/lib"
689   elif test "x$prefix" != "xNONE"; then
690     VORBIS_LIBS="-L$prefix/lib"
691   fi
693   if test `uname` == Darwin; then
694     VORBIS_LIBS="$VORBIS_LIBS -framework Vorbis -lm"
695     VORBISFILE_LIBS=""
696     VORBISENC_LIBS=""
697   else
698     VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
699     VORBISFILE_LIBS="-lvorbisfile"
700     VORBISENC_LIBS="-lvorbisenc"
701   fi
703   if test "x$vorbis_includes" != "x" ; then
704     VORBIS_CFLAGS="-I$vorbis_includes"
705   elif test "x$vorbis_prefix" != "x" ; then
706     VORBIS_CFLAGS="-I$vorbis_prefix/include"
707   elif test "x$prefix" != "xNONE"; then
708     VORBIS_CFLAGS="-I$prefix/include"
709   fi
712   AC_MSG_CHECKING(for Vorbis)
713   no_vorbis=""
716   if test "x$enable_vorbistest" = "xyes" ; then
717     ac_save_CFLAGS="$CFLAGS"
718     ac_save_LIBS="$LIBS"
719     CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
720     LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
722 dnl Now check if the installed Vorbis is sufficiently new.
724       rm -f conf.vorbistest
725       AC_TRY_RUN([
726 #include <stdio.h>
727 #include <stdlib.h>
728 #include <string.h>
729 #include <vorbis/codec.h>
730 #include <vorbis/vorbisenc.h>
732 int main ()
734     vorbis_block        vb;
735     vorbis_dsp_state    vd;
736     vorbis_info         vi;
738     vorbis_info_init (&vi);
739     vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
740     vorbis_analysis_init (&vd, &vi);
741     vorbis_block_init (&vd, &vb);
742     /* this function was added in 1.0rc3, so this is what we're testing for */
743     vorbis_bitrate_addblock (&vb);
745     system("touch conf.vorbistest");
746     return 0;
749 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
750        CFLAGS="$ac_save_CFLAGS"
751        LIBS="$ac_save_LIBS"
752   fi
754   if test "x$no_vorbis" = "x" ; then
755      AC_MSG_RESULT(yes)
756      ifelse([$1], , :, [$1])     
757   else
758      AC_MSG_RESULT(no)
759      if test -f conf.vorbistest ; then
760        :
761      else
762        echo "*** Could not run Vorbis test program, checking why..."
763        CFLAGS="$CFLAGS $VORBIS_CFLAGS"
764        LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
765        AC_TRY_LINK([
766 #include <stdio.h>
767 #include <vorbis/codec.h>
768 ],     [ return 0; ],
769        [ echo "*** The test program compiled, but did not run. This usually means"
770        echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
771        echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
772        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
773        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
774        echo "*** is required on your system"
775        echo "***"
776        echo "*** If you have an old version installed, it is best to remove it, although"
777        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
778        [ echo "*** The test program failed to compile or link. See the file config.log for the"
779        echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
780        echo "*** or that you have moved Vorbis since it was installed." ])
781        CFLAGS="$ac_save_CFLAGS"
782        LIBS="$ac_save_LIBS"
783      fi
784      VORBIS_CFLAGS=""
785      VORBIS_LIBS=""
786      VORBISFILE_LIBS=""
787      VORBISENC_LIBS=""
788      ifelse([$2], , :, [$2])
789   fi
790   AC_SUBST(VORBIS_CFLAGS)
791   AC_SUBST(VORBIS_LIBS)
792   AC_SUBST(VORBISFILE_LIBS)
793   AC_SUBST(VORBISENC_LIBS)
794   rm -f conf.vorbistest