1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 dnl MY_DEFINE(VARIABLE)
15 [cat >> confdefs.h <<EOF
20 dnl CONFIG_INTERFACE(package,macro_name,interface_id,help
22 dnl action-if-yes-or-dynamic,
24 dnl action-if-yes,action-if-dynamic,action-if-no)
26 AC_DEFUN(CONFIG_INTERFACE,
27 [AC_ARG_ENABLE($1,[$4],
28 [case "x$enable_$1" in xyes|xdynamic) $5 ;; esac])
32 AM_CONDITIONAL(ENABLE_$2, true)
36 dynamic_targets="$dynamic_targets interface_$3.\$(so)"
47 dnl alsa.m4 starts form here
48 dnl Configure Paths for Alsa
49 dnl Christopher Lansdown (lansdoct@cs.alfred.edu)
51 dnl modified for TiMidity++ by Isaku Yamahata(yamahata@kusm.kyoto-u.ac.jp)
53 dnl AM_PATH_ALSA_LOCAL(MINIMUM-VERSION)
54 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
55 dnl if there exit ALSA, define have_alsa=yes, otherwise no.
56 dnl enables arguments --with-alsa-prefix= --with-alsa-enc-prefix= --disable-alsatest
58 AC_DEFUN(AM_PATH_ALSA_LOCAL,
60 dnl Get the clfags and libraries for alsa
63 AC_ARG_WITH(alsa-prefix,[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
64 [alsa_prefix="$withval"], [alsa_prefix=""])
65 AC_ARG_WITH(alsa-inc-prefix, [ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
66 [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
67 AC_ARG_ENABLE(alsatest, [ --disable-alsatest Do not try to compile and run a test Alsa program], [enable_alsatest=no], [enable_alsatest=yes])
69 dnl Add any special include directories
70 AC_MSG_CHECKING(for ALSA CFLAGS)
71 if test "$alsa_inc_prefix" != "" ; then
72 ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
73 CFLAGS="$CFLAGS -I$alsa_inc_prefix"
75 AC_MSG_RESULT($ALSA_CFLAGS)
77 dnl add any special lib dirs
78 AC_MSG_CHECKING(for ALSA LDFLAGS)
79 if test "$alsa_prefix" != "" ; then
80 ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
84 dnl add the alsa library
85 ALSA_LIBS="$ALSA_LIBS -lasound"
86 AC_MSG_RESULT($ALSA_LIBS)
88 dnl Check for the presence of the library
89 dnl if test $enable_alsatest = yes; then
90 dnl AC_MSG_CHECKING(for working libasound)
91 dnl KEEP_LDFLAGS="$LDFLAGS"
92 dnl LDFLAGS="$LDFLAGS $ALSA_LIBS"
94 dnl #include <sys/asoundlib.h>
101 dnl [AC_MSG_RESULT("present")],
102 dnl [AC_MSG_RESULT("not found. ")
103 dnl AC_MSG_ERROR(Fatal error: Install alsa-lib package or use --with-alsa-prefix option...)],
104 dnl [AC_MSG_RESULT(unsopported)
105 dnl AC_MSG_ERROR(Cross-compiling isn't supported...)]
107 dnl LDFLAGS="$KEEP_LDFLAGS"
110 dnl Check for a working version of libasound that is of the right version.
111 min_alsa_version=ifelse([$1], ,0.1.1,$1)
112 AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
114 alsa_min_major_version=`echo $min_alsa_version | \
115 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
116 alsa_min_minor_version=`echo $min_alsa_version | \
117 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
118 alsa_min_micro_version=`echo $min_alsa_version | \
119 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
122 #include <sys/asoundlib.h>
124 /* ensure backward compatibility */
125 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
126 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
128 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
129 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
131 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
132 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
135 # if(SND_LIB_MAJOR > $alsa_min_major_version)
138 # if(SND_LIB_MAJOR < $alsa_min_major_version)
142 # if(SND_LIB_MINOR > $alsa_min_minor_version)
145 # if(SND_LIB_MINOR < $alsa_min_minor_version)
149 # if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
156 [AC_MSG_RESULT(found.)
158 [AC_MSG_RESULT(not present.)]
161 dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
162 AC_CHECK_LIB([asound], [snd_cards],,
163 [AC_MSG_RESULT(No linkable libasound was found.)]
166 dnl That should be it. Now just export out symbols:
167 AC_SUBST(ALSA_CFLAGS)
170 dnl alsa.m4 ends here
172 # Configure paths for ESD
173 # Manish Singh 98-9-30
174 # stolen back from Frank Belew
175 # stolen from Manish Singh
176 # Shamelessly stolen from Owen Taylor
178 dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
179 dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
181 AC_DEFUN(AM_PATH_ESD,
183 dnl Get the cflags and libraries from the esd-config script
185 AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)],
186 esd_prefix="$withval", esd_prefix="")
187 AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
188 esd_exec_prefix="$withval", esd_exec_prefix="")
189 AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program],
190 , enable_esdtest=yes)
192 if test x$esd_exec_prefix != x ; then
193 esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
194 if test x${ESD_CONFIG+set} != xset ; then
195 ESD_CONFIG=$esd_exec_prefix/bin/esd-config
198 if test x$esd_prefix != x ; then
199 esd_args="$esd_args --prefix=$esd_prefix"
200 if test x${ESD_CONFIG+set} != xset ; then
201 ESD_CONFIG=$esd_prefix/bin/esd-config
205 AC_PATH_PROG(ESD_CONFIG, esd-config, no)
206 min_esd_version=ifelse([$1], ,0.2.7,$1)
207 AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
209 if test "$ESD_CONFIG" = "no" ; then
212 ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
213 ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
215 esd_major_version=`$ESD_CONFIG $esd_args --version | \
216 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
217 esd_minor_version=`$ESD_CONFIG $esd_args --version | \
218 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
219 esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
220 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
221 if test "x$enable_esdtest" = "xyes" ; then
222 ac_save_CFLAGS="$CFLAGS"
224 CFLAGS="$CFLAGS $ESD_CFLAGS"
225 LIBS="$LIBS $ESD_LIBS"
227 dnl Now check if the installed ESD is sufficiently new. (Also sanity
228 dnl checks the results of esd-config to some extent
238 my_strdup (char *str)
244 new_str = malloc ((strlen (str) + 1) * sizeof(char));
245 strcpy (new_str, str);
255 int major, minor, micro;
258 system ("touch conf.esdtest");
260 /* HP/UX 9 (%@#!) writes to sscanf strings */
261 tmp_version = my_strdup("$min_esd_version");
262 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
263 printf("%s, bad version string\n", "$min_esd_version");
267 if (($esd_major_version > major) ||
268 (($esd_major_version == major) && ($esd_minor_version > minor)) ||
269 (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
275 printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
276 printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
277 printf("*** best to upgrade to the required version.\n");
278 printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
279 printf("*** to point to the correct copy of esd-config, and remove the file\n");
280 printf("*** config.cache before re-running configure\n");
285 ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
286 CFLAGS="$ac_save_CFLAGS"
290 if test "x$no_esd" = x ; then
292 ifelse([$2], , :, [$2])
295 if test "$ESD_CONFIG" = "no" ; then
296 echo "*** The esd-config script installed by ESD could not be found"
297 echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
298 echo "*** your path, or set the ESD_CONFIG environment variable to the"
299 echo "*** full path to esd-config."
301 if test -f conf.esdtest ; then
304 echo "*** Could not run ESD test program, checking why..."
305 CFLAGS="$CFLAGS $ESD_CFLAGS"
306 LIBS="$LIBS $ESD_LIBS"
311 [ echo "*** The test program compiled, but did not run. This usually means"
312 echo "*** that the run-time linker is not finding ESD or finding the wrong"
313 echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
314 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
315 echo "*** to the installed location Also, make sure you have run ldconfig if that"
316 echo "*** is required on your system"
318 echo "*** If you have an old version installed, it is best to remove it, although"
319 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
320 [ echo "*** The test program failed to compile or link. See the file config.log for the"
321 echo "*** exact error that occured. This usually means ESD was incorrectly installed"
322 echo "*** or that you have moved ESD since it was installed. In the latter case, you"
323 echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
324 CFLAGS="$ac_save_CFLAGS"
330 ifelse([$3], , :, [$3])
337 dnl CHECK_DLSYM_UNDERSCORE([ACTION-IF-NEED [, ACTION IF-NOT-NEED]])
339 dnl CC CFLAGS CPPFLAGS LDFLAGS LIBS SHCFLAGS SHLD SHLDFLAGS
340 dnl ac_cv_header_dlfcn_h lib_dl_opt so
341 AC_DEFUN(CHECK_DLSYM_UNDERSCORE,
342 [dnl Check if dlsym need a leading underscore
343 AC_MSG_CHECKING(whether your dlsym() needs a leading underscore)
344 AC_CACHE_VAL(timidity_cv_func_dlsym_underscore,
345 [case "$ac_cv_header_dlfcn_h" in
346 yes) i_dlfcn=define;;
357 #include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
359 #include <sys/types.h>
373 int mode = RTLD_LAZY ;
375 handle = dlopen("./dyna.$so", mode) ;
376 if (handle == NULL) {
381 symbol = dlsym(handle, "fred") ;
382 if (symbol == NULL) {
383 /* try putting a leading underscore */
384 symbol = dlsym(handle, "_fred") ;
385 if (symbol == NULL) {
398 : Call the object file tmp-dyna.o in case dlext=o.
399 if ${CC-cc} $CFLAGS $SHCFLAGS $CPPFLAGS -c dyna.c > /dev/null 2>&1 &&
400 mv dyna.o tmp-dyna.o > /dev/null 2>&1 &&
401 $SHLD $SHLDFLAGS -o dyna.$so tmp-dyna.o > /dev/null 2>&1 &&
402 ${CC-cc} -o fred $CFLAGS $CPPFLAGS $LDFLAGS fred.c $LIBS $lib_dl_opt > /dev/null 2>&1; then
405 1) AC_MSG_WARN(Test program failed using dlopen. Perhaps you should not use dynamic loading.)
407 2) AC_MSG_WARN(Test program failed using dlsym. Perhaps you should not use dynamic loading.)
409 3) timidity_cv_func_dlsym_underscore=yes
411 4) timidity_cv_func_dlsym_underscore=no
415 AC_MSG_WARN(I can't compile and run the test program.)
417 rm -f dyna.c dyna.o dyna.$so tmp-dyna.o fred.c fred.o fred
419 case "x$timidity_cv_func_dlsym_underscore" in
430 dnl contains program from perl5
432 AC_DEFUN(CONTAINS_INIT,
433 [dnl Some greps do not return status, grrr.
434 AC_MSG_CHECKING(whether grep returns status)
435 echo "grimblepritz" >grimble
436 if grep blurfldyick grimble >/dev/null 2>&1 ; then
437 contains="./contains"
438 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
441 contains="./contains"
444 dnl the following should work in any shell
446 grep) AC_MSG_RESULT(yes)
449 AC_MSG_RESULT(AGH! Grep doesn't return a status. Attempting remedial action.)
450 cat >./contains <<'EOSS'
451 grep "[$]1" "[$]2" >.greptmp && cat .greptmp && test -s .greptmp
453 chmod +x "./contains"
459 dnl CONTAINS(word,filename,action-if-found,action-if-not-found)
461 [if $contains "^[$1]"'[$]' $2 >/dev/null 2>&1; then
469 dnl SET_UNIQ_WORDS(shell-variable,words...)
470 AC_DEFUN(SET_UNIQ_WORDS,
471 [rm -f wordtmp >/dev/null 2>&1
474 CONTAINS([$f],wordtmp,:,[echo $f >>wordtmp; val="$val $f"])
477 rm -f wordtmp >/dev/null 2>&1
481 dnl WAPI_CHECK_FUNC(FUNCTION, INCLUDES, TEST-BODY,
482 [ACTION-FI-FOUND [, ACTION-IF-NOT-FOUND]])
483 AC_DEFUN(WAPI_CHECK_FUNC,
484 [AC_MSG_CHECKING(for $1)
485 AC_CACHE_VAL(wapi_cv_func_$1,
486 [AC_TRY_LINK([#include <windows.h>
489 wapi_cv_func_$1=yes, wapi_cv_func_$1=no)])
490 if eval "test \"`echo '$wapi_cv_func_'$1`\" = yes"; then
492 ifelse([$4], , :, [$4])
501 dnl WAPI_CHECK_LIB(LIBRARY, FUNCTION,
502 dnl INCLUDES, TEST-BODY
503 dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
504 dnl [, OTHER-LIBRARIES]]])
505 AC_DEFUN(WAPI_CHECK_LIB,
506 [AC_MSG_CHECKING([for $2 in -l$1])
507 ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
508 AC_CACHE_VAL(wapi_cv_lib_$ac_lib_var,
509 [ac_save_LIBS="$LIBS"
511 AC_TRY_LINK([#include <windows.h>
514 eval "wapi_cv_lib_$ac_lib_var=yes",
515 eval "wapi_cv_lib_$ac_lib_var=no")
518 if eval "test \"`echo '$wapi_cv_lib_'$ac_lib_var`\" = yes"; then
520 ifelse([$5], ,LIBS="-l$1 $LIBS", [$5])
529 dnl EXTRACT_CPPFLAGS(CPPFLAGS-to-append,others-to-append,FLAGS)
530 AC_DEFUN(EXTRACT_CPPFLAGS,
533 .-I?*|.-D?*) $1="[$]$1 $f" ;;
540 dnl CHECK_COMPILER_OPTION(OPTIONS [, ACTION-IF-SUCCESS [, ACTION-IF-FAILED]])
541 AC_DEFUN(CHECK_COMPILER_OPTION,
542 [AC_MSG_CHECKING([whether -$1 option is recognized])
543 ac_ccoption=`echo $1 | sed 'y%./+-%__p_%'`
544 AC_CACHE_VAL(timidity_cv_ccoption_$ac_ccoption,
545 [cat > conftest.$ac_ext <<EOF
546 int main() {return 0;}
548 if ${CC-cc} $LDFLAGS $CFLAGS -o conftest${ac_exeext} -$1 conftest.$ac_ext > conftest.out 2>&1; then
549 if test -s conftest.out; then
550 eval "timidity_cv_ccoption_$ac_ccoption=no"
552 eval "timidity_cv_ccoption_$ac_ccoption=yes"
555 eval "timidity_cv_ccoption_$ac_ccoption=no"
558 if eval "test \"`echo '$timidity_cv_ccoption_'$ac_ccoption`\" = yes"; then
569 # Define a conditional.
571 AC_DEFUN(AM_CONDITIONAL,
582 # Do all the work for Automake. This macro actually does too much --
583 # some checks are only needed if your package does certain things.
584 # But this isn't really a big deal.
589 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
591 AC_DEFUN(AM_INIT_AUTOMAKE,
592 [AC_REQUIRE([AC_PROG_INSTALL])
597 dnl test to see if srcdir already configured
598 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
599 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
602 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
603 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
604 AC_REQUIRE([AM_SANITY_CHECK])
605 AC_REQUIRE([AC_ARG_PROGRAM])
606 dnl FIXME This is truly gross.
607 missing_dir=`cd $ac_aux_dir && pwd`
608 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
609 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
610 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
611 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
612 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
613 AC_REQUIRE([AC_PROG_MAKE_SET])])
616 # Check to make sure that the build environment is sane.
619 AC_DEFUN(AM_SANITY_CHECK,
620 [AC_MSG_CHECKING([whether build environment is sane])
623 echo timestamp > conftestfile
624 # Do `set' in a subshell so we don't clobber the current shell's
625 # arguments. Must try -L first in case configure is actually a
626 # symlink; some systems play weird games with the mod time of symlinks
627 # (eg FreeBSD returns the mod time of the symlink's containing
630 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
631 if test "[$]*" = "X"; then
633 set X `ls -t $srcdir/configure conftestfile`
635 if test "[$]*" != "X $srcdir/configure conftestfile" \
636 && test "[$]*" != "X conftestfile $srcdir/configure"; then
638 # If neither matched, then we have a broken ls. This can happen
639 # if, for instance, CONFIG_SHELL is bash and it inherits a
640 # broken ls alias from the environment. This has actually
641 # happened. Such a system could not be considered "sane".
642 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
643 alias in your environment])
646 test "[$]2" = conftestfile
652 AC_MSG_ERROR([newly created file is older than distributed files!
653 Check your system clock])
658 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
659 dnl The program must properly implement --version.
660 AC_DEFUN(AM_MISSING_PROG,
661 [AC_MSG_CHECKING(for working $2)
662 # Run test in a subshell; some versions of sh will print an error if
663 # an executable is not found, even if stderr is redirected.
664 # Redirect stdin to placate older versions of autoconf. Sigh.
665 if ($2 --version) < /dev/null > /dev/null 2>&1; then
670 AC_MSG_RESULT(missing)
674 # Like AC_CONFIG_HEADER, but automatically create stamp file.
676 AC_DEFUN(AM_CONFIG_HEADER,
678 AC_CONFIG_HEADER([$1])
679 dnl When config.status generates a header, we must update the stamp-h file.
680 dnl This file resides in the same directory as the config header
681 dnl that is generated. We must strip everything past the first ":",
682 dnl and everything past the last "/".
683 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
684 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
685 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
687 for am_file in <<$1>>; do
688 case " <<$>>CONFIG_HEADERS " in
689 *" <<$>>am_file "*<<)>>
690 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
693 am_indx=`expr "<<$>>am_indx" + 1`
700 AC_DEFUN(AM_PATH_LISPDIR,
701 [# If set to t, that means we are running in a shell under Emacs.
702 # If you have an Emacs named "t", then use the full path.
703 test "$EMACS" = t && EMACS=
704 AC_PATH_PROGS(EMACS, emacs xemacs, no)
705 if test $EMACS != "no"; then
706 AC_MSG_CHECKING([where .elc files should go])
707 dnl Set default value
708 lispdir="\$(datadir)/emacs/site-lisp"
709 emacs_flavor=`echo "$EMACS" | sed -e 's,^.*/,,'`
710 if test "x$prefix" = "xNONE"; then
711 if test -d $ac_default_prefix/share/$emacs_flavor/site-lisp; then
712 lispdir="\$(prefix)/share/$emacs_flavor/site-lisp"
714 if test -d $ac_default_prefix/lib/$emacs_flavor/site-lisp; then
715 lispdir="\$(prefix)/lib/$emacs_flavor/site-lisp"
719 if test -d $prefix/share/$emacs_flavor/site-lisp; then
720 lispdir="\$(prefix)/share/$emacs_flavor/site-lisp"
722 if test -d $prefix/lib/$emacs_flavor/site-lisp; then
723 lispdir="\$(prefix)/lib/$emacs_flavor/site-lisp"
727 AC_MSG_RESULT($lispdir)
731 # Configure paths for GTK+
732 # Owen Taylor 97-11-3
734 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
735 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
737 AC_DEFUN(AM_PATH_GTK,
739 dnl Get the cflags and libraries from the gtk-config script
741 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
742 gtk_config_prefix="$withval", gtk_config_prefix="")
743 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
744 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
745 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
746 , enable_gtktest=yes)
748 if test x$gtk_config_exec_prefix != x ; then
749 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
750 if test x${GTK_CONFIG+set} != xset ; then
751 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
754 if test x$gtk_config_prefix != x ; then
755 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
756 if test x${GTK_CONFIG+set} != xset ; then
757 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
761 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
762 min_gtk_version=ifelse([$1], ,0.99.7,$1)
763 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
765 if test "$GTK_CONFIG" = "no" ; then
768 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
769 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
770 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
771 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
772 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
773 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
774 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
775 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
776 if test "x$enable_gtktest" = "xyes" ; then
777 ac_save_CFLAGS="$CFLAGS"
779 CFLAGS="$CFLAGS $GTK_CFLAGS"
780 LIBS="$LIBS $GTK_LIBS"
782 dnl Now check if the installed GTK is sufficiently new. (Also sanity
783 dnl checks the results of gtk-config to some extent
793 int major, minor, micro;
796 system ("touch conf.gtktest");
798 /* HP/UX 9 (%@#!) writes to sscanf strings */
799 tmp_version = g_strdup("$min_gtk_version");
800 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
801 printf("%s, bad version string\n", "$min_gtk_version");
805 if ((gtk_major_version != $gtk_config_major_version) ||
806 (gtk_minor_version != $gtk_config_minor_version) ||
807 (gtk_micro_version != $gtk_config_micro_version))
809 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
810 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
811 gtk_major_version, gtk_minor_version, gtk_micro_version);
812 printf ("*** was found! If gtk-config was correct, then it is best\n");
813 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
814 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
815 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
816 printf("*** required on your system.\n");
817 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
818 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
819 printf("*** before re-running configure\n");
823 if ((gtk_major_version > major) ||
824 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
825 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
831 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
832 gtk_major_version, gtk_minor_version, gtk_micro_version);
833 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
834 major, minor, micro);
835 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
837 printf("*** If you have already installed a sufficiently new version, this error\n");
838 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
839 printf("*** being found. The easiest way to fix this is to remove the old version\n");
840 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
841 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
842 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
843 printf("*** so that the correct libraries are found at run-time))\n");
848 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
849 CFLAGS="$ac_save_CFLAGS"
853 if test "x$no_gtk" = x ; then
855 ifelse([$2], , :, [$2])
858 if test "$GTK_CONFIG" = "no" ; then
859 echo "*** The gtk-config script installed by GTK could not be found"
860 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
861 echo "*** your path, or set the GTK_CONFIG environment variable to the"
862 echo "*** full path to gtk-config."
864 if test -f conf.gtktest ; then
867 echo "*** Could not run GTK test program, checking why..."
868 CFLAGS="$CFLAGS $GTK_CFLAGS"
869 LIBS="$LIBS $GTK_LIBS"
873 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
874 [ echo "*** The test program compiled, but did not run. This usually means"
875 echo "*** that the run-time linker is not finding GTK or finding the wrong"
876 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
877 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
878 echo "*** to the installed location Also, make sure you have run ldconfig if that"
879 echo "*** is required on your system"
881 echo "*** If you have an old version installed, it is best to remove it, although"
882 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
884 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
885 echo "*** came with the system with the command"
887 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
888 [ echo "*** The test program failed to compile or link. See the file config.log for the"
889 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
890 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
891 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
892 CFLAGS="$ac_save_CFLAGS"
898 ifelse([$3], , :, [$3])