1 AC_DEFUN(CY_AC_PATH_TCLCONFIG, [
3 # Ok, lets find the tcl configuration
4 # First, look for one uninstalled.
5 # the alternative search directory is invoked by --with-tclconfig
8 if test x"${no_tcl}" = x ; then
9 # we reset no_tcl in case something fails here
11 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR Directory containing tcl configuration (tclConfig.sh)],
12 with_tclconfig=${withval})
13 AC_MSG_CHECKING([for Tcl configuration])
14 AC_CACHE_VAL(ac_cv_c_tclconfig,[
16 # First check to see if --with-tclconfig was specified.
17 if test x"${with_tclconfig}" != x ; then
18 if test -f "${with_tclconfig}/tclConfig.sh" ; then
19 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
21 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
25 # then check for a private Tcl installation
26 if test x"${ac_cv_c_tclconfig}" = x ; then
30 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
32 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
34 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
35 if test -f "$i/${configdir}/tclConfig.sh" ; then
36 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
41 # check in a few common install locations
42 if test x"${ac_cv_c_tclconfig}" = x ; then
43 tcl_probe_dirs="${prefix}/lib /usr/lib /usr/local/lib /mingw/lib"
44 for i in `ls -d ${tcl_probe_dirs} 2>/dev/null` ; do
45 if test -f "$i/tclConfig.sh" ; then
46 ac_cv_c_tclconfig=`(cd $i; pwd)`
51 # check in some other known public install locations
52 # NOTE: This could possibly pick up wrong version if more than one
53 # Tcl/Tk version is installed in this form.
54 if test x"${ac_cv_c_tclconfig}" = x ; then
56 `ls -d ${prefix}/lib/tcl[[7-9]]* /usr/lib/tcl[[7-9]]* 2>/dev/null` ; do
57 if test -f "$i/tclConfig.sh" ; then
58 ac_cv_c_tclconfig=`(cd $i; pwd)`
63 # check in a few other private locations
64 if test x"${ac_cv_c_tclconfig}" = x ; then
67 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
68 if test -f "$i/${configdir}/tclConfig.sh" ; then
69 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
75 if test x"${ac_cv_c_tclconfig}" = x ; then
76 TCLCONFIG="# no Tcl configs found"
77 AC_MSG_WARN(Can't find Tcl configuration definitions)
80 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
81 AC_MSG_RESULT(found $TCLCONFIG)
86 AC_DEFUN(CY_AC_LOAD_TCLCONFIG, [
90 AC_SUBST(TCL_MAJOR_VERSION)
91 AC_SUBST(TCL_MINOR_VERSION)
94 AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
95 AC_SUBST(TCL_EXTRA_CFLAGS)
98 dnl ## On some versions of Cygwin, the 'TCL_INCLUDE_SPEC' is incorrectly
99 dnl ## indicated to be '/nonexistent/include'. We must be on the look out
100 dnl ## for this, and doubt it if we see it.
101 if test "x${TCL_INCLUDE_SPEC}" = "x-I/nonexistent/include" \
102 -a ! -d /nonexistent/include ;
106 dnl ## If TCL_INCLUDE_SPEC is not defined, then we might be on a Debian
107 dnl ## system, and should try to synthesize it.
108 if test "x${TCL_INCLUDE_SPEC}" = "x" ;
110 if test "x${TCL_INC_DIR}" != "x" ;
112 if test -d ${TCL_INC_DIR} ;
114 TCL_INCLUDE_SPEC="-I${TCL_INC_DIR}"
118 dnl ## If neither TCL_INCLUDE_SPEC nor TCL_INC_DIR are defined, we still
119 dnl ## might be on a Debian system. Try another synthesis.
120 if test "x${TCL_INCLUDE_SPEC}" = "x" ;
122 if test "x${TCL_VERSION}" != "x" -a "x${TCL_PREFIX}" != "x" ;
124 if test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION} ;
126 TCL_INCLUDE_SPEC="-I${TCL_PREFIX}/include/tcl${TCL_VERSION}"
130 dnl ## Filter out common include paths to prevent <> vs. "" conflicts.
131 TCL_INCLUDE_SPEC=`echo ${TCL_INCLUDE_SPEC} | grep -v '/usr/include$'`
132 AC_SUBST(TCL_INCLUDE_SPEC)
134 if test "x${TCL_LDFLAGS}" = "x" ; then
135 TCL_LDFLAGS=${TCL_LIB_SPEC}
137 dnl ## Fairly crude hack to find the lib under certain conditions.
138 if test "x${TCL_LDFLAGS}" = "x" ; then
139 tcl_libs=`ls ./tcl[[7-9]]*.lib ./libtcl[[7-9]]*.a 2>/dev/null`
140 if test "x${tcl_libs}" != "x" ; then
141 TCL_LDFLAGS="../${tcl_libs}"
144 if test "x${TCL_LDFLAGS}" = "x" ; then
145 tcl_libs=`ls tcltk/tcl[[7-9]]*.lib tcltk/libtcl[[7-9]]*.a 2>/dev/null`
146 if test "x${tcl_libs}" != "x" ; then
147 TCL_LDFLAGS="../${tcl_libs}"
150 if test "x${TCL_LDFLAGS}" = "x" ; then
151 tcl_libs=`ls tcl/tcl[[7-9]]*.lib tcl/libtcl[[7-9]]*.a 2>/dev/null`
152 if test "x${tcl_libs}" != "x" ; then
153 TCL_LDFLAGS="../${tcl_libs}"
156 dnl ## Another attempt to salvage a usable lib.
157 if test "x${TCL_LDFLAGS}" = "x" ; then
158 if test "x${TCL_LIB_FILE}" != "x" ; then
159 TCL_LDFLAGS="`dirname ${TCLCONFIG}`/${TCL_LIB_FILE}"
162 dnl Tack on extra goodies that may be needed.
163 dnl Let the TK_LIBS do the talking. At worst, TCL_LIBS is a redundant
164 dnl subset of TK_LIBS; at best, it is nothing.
165 dnl if test "x${TCL_LIBS}" != "x" ; then
166 dnl TCL_LDFLAGS="${TCL_LDFLAGS} ${TCL_LIBS}"
169 dnl not used, don't export to save symbols
170 dnl AC_SUBST(TCL_LIB_FILE)
172 dnl don't export, not used outside of configure
173 dnl AC_SUBST(TCL_LIBS)
174 dnl not used, don't export to save symbols
175 dnl AC_SUBST(TCL_PREFIX)
177 dnl not used, don't export to save symbols
178 dnl AC_SUBST(TCL_EXEC_PREFIX)
180 AC_SUBST(TCL_SHLIB_CFLAGS)
181 AC_SUBST(TCL_SHLIB_LD)
182 dnl don't export, not used outside of configure
183 AC_SUBST(TCL_SHLIB_LD_LIBS)
184 AC_SUBST(TCL_SHLIB_SUFFIX)
185 dnl not used, don't export to save symbols
186 AC_SUBST(TCL_DL_LIBS)
187 AC_SUBST(TCL_LD_FLAGS)
188 dnl don't export, not used outside of configure
189 AC_SUBST(TCL_LD_SEARCH_FLAGS)
190 AC_SUBST(TCL_COMPAT_OBJS)
192 AC_SUBST(TCL_BUILD_LIB_SPEC)
193 AC_SUBST(TCL_LIB_SPEC)
194 AC_SUBST(TCL_LIB_VERSIONS_OK)
196 dnl not used, don't export to save symbols
197 dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
199 dnl not used, don't export to save symbols
200 dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
202 AC_SUBST(TCL_LDFLAGS)
205 AC_DEFUN(CY_AC_PATH_TKCONFIG, [
207 # Ok, lets find the tk configuration
208 # First, look for one uninstalled.
209 # the alternative search directory is invoked by --with-tkconfig
212 if test x"${no_tk}" = x ; then
213 # we reset no_tk in case something fails here
215 AC_ARG_WITH(tkconfig, [ --with-tkconfig=DIR Directory containing tk configuration (tkConfig.sh)],
216 with_tkconfig=${withval})
217 AC_MSG_CHECKING([for Tk configuration])
218 AC_CACHE_VAL(ac_cv_c_tkconfig,[
220 # First check to see if --with-tkconfig was specified.
221 if test x"${with_tkconfig}" != x ; then
222 if test -f "${with_tkconfig}/tkConfig.sh" ; then
223 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
225 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
229 # then check for a private Tk library
230 if test x"${ac_cv_c_tkconfig}" = x ; then
234 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
236 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
238 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
239 if test -f "$i/${configdir}/tkConfig.sh" ; then
240 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
245 # check in a few common install locations
246 if test x"${ac_cv_c_tkconfig}" = x ; then
247 tk_probe_dirs="${prefix}/lib /usr/lib /usr/local/lib /mingw/lib"
248 for i in `ls -d ${tk_probe_dirs} 2>/dev/null` ; do
249 if test -f "$i/tkConfig.sh" ; then
250 ac_cv_c_tkconfig=`(cd $i; pwd)`
255 # check in some other known public install locations
256 # NOTE: This could possibly pick up wrong version if more than one
257 # Tcl/Tk version is installed in this form.
258 if test x"${ac_cv_c_tkconfig}" = x ; then
260 `ls -d ${prefix}/lib/tk[[7-9]]* /usr/lib/tk[[7-9]]* 2>/dev/null` ; do
261 if test -f "$i/tkConfig.sh" ; then
262 ac_cv_c_tkconfig=`(cd $i; pwd)`
267 # check in a few other private locations
268 if test x"${ac_cv_c_tkconfig}" = x ; then
271 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
272 if test -f "$i/${configdir}/tkConfig.sh" ; then
273 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
279 if test x"${ac_cv_c_tkconfig}" = x ; then
280 TKCONFIG="# no Tk configs found"
281 AC_MSG_WARN(Can't find Tk configuration definitions)
284 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
285 AC_MSG_RESULT(found $TKCONFIG)
291 AC_DEFUN(CY_AC_LOAD_TKCONFIG, [
292 if test -f "$TKCONFIG" ; then
296 dnl ## If TK_INCLUDE_SPEC is not defined, then we might be on a Debian
297 dnl ## system and have need of it, and should try to synthesize it.
298 dnl ## On most other systems the TCL_INCLUDE_SPEC is enough to pick up
300 if test "x${TK_INCLUDE_SPEC}" = "x" ;
302 if test "x${TK_INC_DIR}" != "x" ;
304 if test -d ${TK_INC_DIR} ;
306 TK_INCLUDE_SPEC="-I${TK_INC_DIR}"
310 dnl ## If neither TK_INCLUDE_SPEC nor TK_INC_DIR are defined, we still
311 dnl ## might be on a Debian system. Try another synthesis.
312 if test "x${TK_INCLUDE_SPEC}" = "x" ;
314 if test "x${TK_VERSION}" != "x" -a "x${TK_PREFIX}" != "x" ;
316 if test -d ${TK_PREFIX}/include/tk${TK_VERSION} ;
318 TK_INCLUDE_SPEC="-I${TK_PREFIX}/include/tk${TK_VERSION}"
322 dnl ## Filter out common include paths to prevent <> vs. "" conflicts.
323 TK_INCLUDE_SPEC=`echo ${TK_INCLUDE_SPEC} | grep -v '/usr/include$'`
324 AC_SUBST(TK_INCLUDE_SPEC)
326 if test "x${TK_LDFLAGS}" = "x" ; then
327 TK_LDFLAGS=${TK_LIB_SPEC}
329 dnl ## Fairly crude hack to find the lib under certain conditions.
330 if test "x${TK_LDFLAGS}" = "x" ; then
331 tk_libs=`ls ./tk[[7-9]]*.lib ./libtk[[7-9]]*.a 2>/dev/null`
332 if test "x${tk_libs}" != "x" ; then
333 TK_LDFLAGS="../${tk_libs}"
336 if test "x${TK_LDFLAGS}" = "x" ; then
337 tk_libs=`ls tcltk/tk[[7-9]]*.lib tcltk/libtk[[7-9]]*.a 2>/dev/null`
338 if test "x${tk_libs}" != "x" ; then
339 TK_LDFLAGS="../${tk_libs}"
342 if test "x${TK_LDFLAGS}" = "x" ; then
343 tk_libs=`ls tk/tk[[7-9]]*.lib tk/libtk[[7-9]]*.a 2>/dev/null`
344 if test "x${tk_libs}" != "x" ; then
345 TK_LDFLAGS="../${tk_libs}"
348 dnl ## Another attempt to salvage a usable lib.
349 if test "x${TK_LDFLAGS}" = "x" ; then
350 if test "x${TK_LIB_FILE}" != "x" ; then
351 TK_LDFLAGS="`dirname ${TKCONFIG}`/${TK_LIB_FILE}"
354 dnl ## Tack on extra goodies that may be needed.
355 dnl ## But filter off any directly named static libs.
356 if test "x${TK_LIBS}" != "x" ; then
358 for libitem in ${TK_LIBS} ; do
359 tmplibitem=`echo "$libitem" | grep -v '\.lib$' | grep -v '\.a$'`
360 liblist="$liblist $tmplibitem"
362 TK_LDFLAGS="${TK_LDFLAGS} $liblist"
366 dnl not actually used, don't export to save symbols
367 dnl AC_SUBST(TK_MAJOR_VERSION)
368 dnl AC_SUBST(TK_MINOR_VERSION)
371 dnl not used, don't export to save symbols
372 dnl AC_SUBST(TK_LIB_FILE)
374 dnl not used outside of configure
375 dnl AC_SUBST(TK_LIBS)
376 dnl not used, don't export to save symbols
377 dnl AC_SUBST(TK_PREFIX)
379 dnl not used, don't export to save symbols
380 dnl AC_SUBST(TK_EXEC_PREFIX)
382 AC_SUBST(TK_BUILD_INCLUDES)
383 AC_SUBST(TK_XINCLUDES)
385 AC_SUBST(TK_BUILD_LIB_SPEC)
386 AC_SUBST(TK_LIB_SPEC)
391 # Configure paths for SDL
392 # Sam Lantinga 9/21/99
393 # stolen from Manish Singh
394 # stolen back from Frank Belew
395 # stolen from Manish Singh
396 # Shamelessly stolen from Owen Taylor
398 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
399 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
401 AC_DEFUN(AM_PATH_SDL,
403 dnl Get the cflags and libraries from the sdl-config script
405 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
406 sdl_prefix="$withval", sdl_prefix="")
407 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
408 sdl_exec_prefix="$withval", sdl_exec_prefix="")
409 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
410 , enable_sdltest=yes)
412 if test x$sdl_exec_prefix != x ; then
413 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
414 if test x${SDL_CONFIG+set} != xset ; then
415 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
418 if test x$sdl_prefix != x ; then
419 sdl_args="$sdl_args --prefix=$sdl_prefix"
420 if test x${SDL_CONFIG+set} != xset ; then
421 SDL_CONFIG=$sdl_prefix/bin/sdl-config
425 AC_REQUIRE([AC_CANONICAL_TARGET])
426 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
427 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
428 min_sdl_version=ifelse([$1], ,0.11.0,$1)
429 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
431 if test "$SDL_CONFIG" = "no" ; then
434 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
435 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
437 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
438 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
439 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
440 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
441 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
442 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
443 if test "x$enable_sdltest" = "xyes" ; then
444 ac_save_CFLAGS="$CFLAGS"
445 ac_save_CXXFLAGS="$CXXFLAGS"
447 CFLAGS="$CFLAGS $SDL_CFLAGS"
448 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
449 LIBS="$LIBS $SDL_LIBS"
451 dnl Now check if the installed SDL is sufficiently new. (Also sanity
452 dnl checks the results of sdl-config to some extent
462 my_strdup (char *str)
468 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
469 strcpy (new_str, str);
477 int main (int argc, char *argv[])
479 int major, minor, micro;
482 /* This hangs on some systems (?)
483 system ("touch conf.sdltest");
485 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
487 /* HP/UX 9 (%@#!) writes to sscanf strings */
488 tmp_version = my_strdup("$min_sdl_version");
489 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
490 printf("%s, bad version string\n", "$min_sdl_version");
494 if (($sdl_major_version > major) ||
495 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
496 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
502 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
503 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
504 printf("*** best to upgrade to the required version.\n");
505 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
506 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
507 printf("*** config.cache before re-running configure\n");
512 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
513 CFLAGS="$ac_save_CFLAGS"
514 CXXFLAGS="$ac_save_CXXFLAGS"
518 if test "x$no_sdl" = x ; then
520 ifelse([$2], , :, [$2])
523 if test "$SDL_CONFIG" = "no" ; then
524 echo "*** The sdl-config script installed by SDL could not be found"
525 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
526 echo "*** your path, or set the SDL_CONFIG environment variable to the"
527 echo "*** full path to sdl-config."
529 if test -f conf.sdltest ; then
532 echo "*** Could not run SDL test program, checking why..."
533 CFLAGS="$CFLAGS $SDL_CFLAGS"
534 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
535 LIBS="$LIBS $SDL_LIBS"
540 int main(int argc, char *argv[])
543 #define main K_and_R_C_main
545 [ echo "*** The test program compiled, but did not run. This usually means"
546 echo "*** that the run-time linker is not finding SDL or finding the wrong"
547 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
548 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
549 echo "*** to the installed location Also, make sure you have run ldconfig if that"
550 echo "*** is required on your system"
552 echo "*** If you have an old version installed, it is best to remove it, although"
553 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
554 [ echo "*** The test program failed to compile or link. See the file config.log for the"
555 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
556 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
557 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
558 CFLAGS="$ac_save_CFLAGS"
559 CXXFLAGS="$ac_save_CXXFLAGS"
565 ifelse([$3], , :, [$3])
572 # Configure paths for FreeType2
573 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
575 dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
576 dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
578 AC_DEFUN(AC_CHECK_FT2,
580 dnl Get the cflags and libraries from the freetype-config script
582 AC_ARG_WITH(ft-prefix,
583 [ --with-ft-prefix=PREFIX
584 Prefix where FreeType is installed (optional)],
585 ft_config_prefix="$withval", ft_config_prefix="")
586 AC_ARG_WITH(ft-exec-prefix,
587 [ --with-ft-exec-prefix=PREFIX
588 Exec prefix where FreeType is installed (optional)],
589 ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
590 AC_ARG_ENABLE(freetypetest,
591 [ --disable-freetypetest Do not try to compile and run
592 a test FreeType program],
593 [case "${enableval}" in
594 yes) enable_fttest=yes ;;
595 no) enable_fttest=no ;;
596 *) AC_MSG_ERROR(bad value ${enableval} for freetypetest option) ;;
597 esac], enable_fttest=yes)
599 if test x$ft_config_exec_prefix != x ; then
600 ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
601 if test x${FT2_CONFIG+set} != xset ; then
602 FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
605 if test x$ft_config_prefix != x ; then
606 ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
607 if test x${FT2_CONFIG+set} != xset ; then
608 FT2_CONFIG=$ft_config_prefix/bin/freetype-config
611 AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
613 min_ft_version=ifelse([$1], ,6.1.0,$1)
614 AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
616 if test "$FT2_CONFIG" = "no" ; then
619 FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
620 FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
621 ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
622 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
623 ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
624 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
625 ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
626 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
627 ft_min_major_version=`echo $min_ft_version | \
628 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
629 ft_min_minor_version=`echo $min_ft_version | \
630 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
631 ft_min_micro_version=`echo $min_ft_version | \
632 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
633 if test x$enable_fttest = xyes ; then
635 if test $ft_config_major_version -lt $ft_min_major_version ; then
638 if test $ft_config_major_version -eq $ft_min_major_version ; then
639 if test $ft_config_minor_version -lt $ft_min_minor_version ; then
642 if test $ft_config_minor_version -eq $ft_min_minor_version ; then
643 if test $ft_config_micro_version -lt $ft_min_micro_version ; then
650 if test x$ft_config_is_lt = xyes ; then
653 ac_save_CFLAGS="$CFLAGS"
655 CFLAGS="$CFLAGS $FT2_CFLAGS"
656 LIBS="$FT2_LIBS $LIBS"
658 dnl Sanity checks for the results of freetype-config to some extent
661 #include <ft2build.h>
662 #include FT_FREETYPE_H
672 error = FT_Init_FreeType(&library);
678 FT_Done_FreeType(library);
682 ],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
683 CFLAGS="$ac_save_CFLAGS"
685 fi # test $ft_config_version -lt $ft_min_version
686 fi # test x$enable_fttest = xyes
687 fi # test "$FT2_CONFIG" = "no"
688 if test x$no_ft = x ; then
690 ifelse([$2], , :, [$2])
693 if test "$FT2_CONFIG" = "no" ; then
694 echo "*** The freetype-config script installed by FreeType 2 could not be found."
695 echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
696 echo "*** your path, or set the FT2_CONFIG environment variable to the"
697 echo "*** full path to freetype-config."
699 if test x$ft_config_is_lt = xyes ; then
700 echo "*** Your installed version of the FreeType 2 library is too old."
701 echo "*** If you have different versions of FreeType 2, make sure that"
702 echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix"
703 echo "*** are used, or set the FT2_CONFIG environment variable to the"
704 echo "*** full path to freetype-config."
706 echo "*** The FreeType test program failed to run. If your system uses"
707 echo "*** shared libraries and they are installed outside the normal"
708 echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
709 echo "*** (or whatever is appropiate for your system) is correctly set."
714 ifelse([$3], , :, [$3])
720 # Configure paths for ParaGUI
721 # Alexander Pipelka 17.05.2000
722 # stolen from Sam Lantinga
723 # stolen from Manish Singh
724 # stolen back from Frank Belew
725 # stolen from Manish Singh
726 # Shamelessly stolen from Owen Taylor
728 dnl AM_PATH_PARAGUI([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
729 dnl Test for PARAGUI, and define PARAGUI_CFLAGS and PARAGUI_LIBS
731 AC_DEFUN(AM_PATH_PARAGUI,
733 dnl Get the cflags and libraries from the paragui-config script
735 AC_ARG_WITH(paragui-prefix,[ --with-paragui-prefix=PFX Prefix where PARAGUI is installed (optional)],
736 paragui_prefix="$withval", paragui_prefix="")
737 AC_ARG_WITH(paragui-exec-prefix,[ --with-paragui-exec-prefix=PFX Exec prefix where PARAGUI is installed (optional)],
738 paragui_exec_prefix="$withval", paragui_exec_prefix="")
739 AC_ARG_ENABLE(paraguitest, [ --disable-paraguitest Do not try to compile and run a test PARAGUI program],
740 [case "${enableval}" in
741 yes) enable_paraguitest=yes ;;
742 no) enable_paraguitest=no ;;
743 *) AC_MSG_ERROR(bad value ${enableval} for paraguitest option) ;;
744 esac], enable_paraguitest=yes)
746 if test x$paragui_exec_prefix != x ; then
747 paragui_args="$paragui_args --exec-prefix=$paragui_exec_prefix"
748 if test x${PARAGUI_CONFIG+set} != xset ; then
749 PARAGUI_CONFIG=$paragui_exec_prefix/bin/paragui-config
752 if test x$paragui_prefix != x ; then
753 paragui_args="$paragui_args --prefix=$paragui_prefix"
754 if test x${PARAGUI_CONFIG+set} != xset ; then
755 PARAGUI_CONFIG=$paragui_prefix/bin/paragui-config
759 AC_PATH_PROG(PARAGUI_CONFIG, paragui-config, no, [$prefix/usr/bin:$prefix/bin:$PATH])
760 min_paragui_version=ifelse([$1], ,0.11.0,$1)
761 AC_MSG_CHECKING(for PARAGUI - version >= $min_paragui_version)
763 if test "$PARAGUI_CONFIG" = "no" ; then
766 PARAGUI_CFLAGS=`$PARAGUI_CONFIG $paraguiconf_args --cflags`
767 PARAGUI_LIBS=`$PARAGUI_CONFIG $paraguiconf_args --libs`
769 paragui_major_version=`$PARAGUI_CONFIG $paragui_args --version | \
770 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
771 paragui_minor_version=`$PARAGUI_CONFIG $paragui_args --version | \
772 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
773 paragui_micro_version=`$PARAGUI_CONFIG $paragui_config_args --version | \
774 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
775 if test "x$enable_paraguitest" = "xyes" ; then
776 ac_save_CXXFLAGS="$CXXFLAGS"
778 CXXFLAGS="$CXXFLAGS $PARAGUI_CFLAGS"
779 LIBS="$LIBS $PARAGUI_LIBS"
781 dnl Now check if the installed PARAGUI is sufficiently new. (Also sanity
782 dnl checks the results of paragui-config to some extent
784 rm -f conf.paraguitest
788 #include "pgapplication.h"
794 my_strdup (char *str)
800 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
801 strcpy (new_str, str);
809 int main (int argc, char *argv[])
811 int major, minor, micro;
816 /* This hangs on some systems (?)
817 system ("touch conf.paraguitest");
819 { FILE *fp = fopen("conf.paraguitest", "a"); if ( fp ) fclose(fp); }
821 /* HP/UX 9 (%@#!) writes to sscanf strings */
822 tmp_version = my_strdup("$min_paragui_version");
823 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
824 printf("%s, bad version string\n", "$min_paragui_version");
828 if (($paragui_major_version > major) ||
829 (($paragui_major_version == major) && ($paragui_minor_version > minor)) ||
830 (($paragui_major_version == major) && ($paragui_minor_version == minor) && ($paragui_micro_version >= micro)))
836 printf("\n*** 'paragui-config --version' returned %d.%d.%d, but the minimum version\n", $paragui_major_version, $paragui_minor_version, $paragui_micro_version);
837 printf("*** of PARAGUI required is %d.%d.%d. If paragui-config is correct, then it is\n", major, minor, micro);
838 printf("*** best to upgrade to the required version.\n");
839 printf("*** If paragui-config was wrong, set the environment variable PARAGUI_CONFIG\n");
840 printf("*** to point to the correct copy of paragui-config, and remove the file\n");
841 printf("*** config.cache before re-running configure\n");
846 ],, no_paragui=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
847 CXXFLAGS="$ac_save_CXXFLAGS"
851 if test "x$no_paragui" = x ; then
853 ifelse([$2], , :, [$2])
856 if test "$PARAGUI_CONFIG" = "no" ; then
857 echo "*** The paragui-config script installed by PARAGUI could not be found"
858 echo "*** If PARAGUI was installed in PREFIX, make sure PREFIX/bin is in"
859 echo "*** your path, or set the PARAGUI_CONFIG environment variable to the"
860 echo "*** full path to paragui-config."
862 if test -f conf.paraguitest ; then
865 echo "*** Could not run PARAGUI test program, checking why..."
866 CXXFLAGS="$CXXFLAGS $PARAGUI_CFLAGS"
867 LIBS="$LIBS $PARAGUI_LIBS"
872 [ echo "*** The test program compiled, but did not run. This usually means"
873 echo "*** that the run-time linker is not finding PARAGUI or finding the wrong"
874 echo "*** version of PARAGUI. If it is not finding PARAGUI, you'll need to set your"
875 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
876 echo "*** to the installed location Also, make sure you have run ldconfig if that"
877 echo "*** is required on your system"
879 echo "*** If you have an old version installed, it is best to remove it, although"
880 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
881 [ echo "*** The test program failed to compile or link. See the file config.log for the"
882 echo "*** exact error that occured. This usually means PARAGUI was incorrectly installed"
883 echo "*** or that you have moved PARAGUI since it was installed. In the latter case, you"
884 echo "*** may want to edit the paragui-config script: $PARAGUI_CONFIG" ])
885 CXXFLAGS="$ac_save_CXXFLAGS"
891 ifelse([$3], , :, [$3])
893 AC_SUBST(PARAGUI_CFLAGS)
894 AC_SUBST(PARAGUI_LIBS)
895 rm -f conf.paraguitest