1 dnl aclocal.m4 -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
4 AC_DEFUN(AC_STEPMAKE_COMPILE, [
5 # -O is necessary to get inlining
7 CXXFLAGS=${CXXFLAGS:-""}
14 AC_ARG_ENABLE(checking,
15 [ enable-checking set runtime checks (assert calls). Default: on],
16 [checking_b=$enableval] )
18 # actually, the default is: tja='-O' to get inlining...
21 #actually, that sucks.
22 # tja looks like a typo. Default is optimisation off. --hwn
24 AC_ARG_ENABLE(optimise,
25 [ enable-optimise use maximal speed optimisations. Default: off],
26 [optimise_b=$enableval])
28 AC_ARG_ENABLE(profiling,
29 [ enable-profiling compile with gprof support. Default: off],
30 [profile_b=$enableval])
32 AC_ARG_ENABLE(debugging,
33 [ enable-debugging set debug info. Default: on],
36 AC_ARG_ENABLE(mingw-prefix,
37 [ enable-mingw-prefix=DIR set the mingw32 directory (standalone windows32 exes)],
38 [MINGWPREFIX=$enableval],
41 if test "$printing_b" = no; then
44 DEFINES="$DEFINES -DNPRINT"
47 if test "$checking_b" = no; then
50 DEFINES="$DEFINES -DNDEBUG"
53 if test "$optimise_b" = yes; then
54 OPTIMIZE="-O2 -finline-functions"
57 if test "$optimise_b" = no; then
61 if test $profile_b = yes; then
63 OPTIMIZE="$OPTIMIZE -pg"
66 if test $debug_b = yes; then
67 OPTIMIZE="$OPTIMIZE -g"
70 # however, C++ support in mingw32 v 0.1.4 is still flaky
71 if test x$MINGWPREFIX != xno; then
72 ICFLAGS="-I$MINGWPREFIX/include"
73 ILDFLAGS="-$MINGWPREFIX/lib"
80 CFLAGS="$CFLAGS $OPTIMIZE"
81 CPPFLAGS=${CPPFLAGS:-""}
91 AC_DEFUN(AC_STEPMAKE_CXX, [
95 AC_CHECK_HEADER(FlexLexer.h, true,
96 AC_STEPMAKE_WARN(can"\'"t find flex header. Please install Flex headers correctly))
98 CPPFLAGS="$CPPFLAGS $DEFINES"
99 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
108 AC_DEFUN(AC_STEPMAKE_CXXTEMPLATE, [
109 AC_CACHE_CHECK([whether explicit instantiation is needed],
110 lily_cv_need_explicit_instantiation,
112 template <class T> struct foo { static int baz; };
113 template <class T> int foo<T>::baz = 1;
114 ], [ return foo<int>::baz; ],
115 lily_cv_need_explicit_instantiation=no,
116 lily_cv_need_explicit_instantiation=yes))
117 if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
118 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
122 AC_DEFUN(AC_STEPMAKE_DATADIR, [
123 if test "$datadir" = "\${prefix}/share"; then
124 datadir='${prefix}/share/'$package
126 DIR_DATADIR=${datadir}
128 if test "$prefix" = "NONE"; then
129 presome=${ac_default_prefix}
131 DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
133 AC_SUBST(DIR_DATADIR)
134 AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
137 AC_DEFUN(AC_STEPMAKE_END, [
138 AC_OUTPUT($CONFIGFILE.make:config.make.in)
141 cp make/toplevel.make.in ./GNUmakefile
142 chmod 444 GNUmakefile
145 AC_DEFUN(AC_STEPMAKE_GXX, [
147 # urg, egcs: how to check for egcs >= 1.1?
148 changequote(<<, >>)dnl
149 if $CXX --version | egrep '2\.[89]' > /dev/null ||
150 $CXX --version | grep 'egcs' > /dev/null
155 AC_STEPMAKE_WARN(can\'t find g++ 2.8 or egcs 1.1)
159 AC_DEFUN(AC_STEPMAKE_GUILE, [
161 if guile-config --version 2>&1 | grep -q 'version 1\.[012]'; then
162 AC_STEPMAKE_WARN(Guile version 1.3 or better needed)
166 AC_DEFUN(AC_STEPMAKE_INIT, [
169 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
170 if test x$MY_PATCH_LEVEL != x; then
171 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
174 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
175 changequote(<<, >>)dnl
176 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
177 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
180 # No versioning on directory names of sub-packages
182 stepmake=${datadir}/stepmake
184 if test "$prefix" = "NONE"; then
185 presome=${ac_default_prefix}
187 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
189 AC_MSG_CHECKING(Package)
190 if test "x$PACKAGE" = "xSTEPMAKE"; then
191 AC_MSG_RESULT(Stepmake package!)
192 (cd stepmake; rm -f stepmake; ln -s ../stepmake .)
193 (cd stepmake; rm -f bin; ln -s ../bin .)
194 AC_CONFIG_AUX_DIR(bin)
197 AC_MSG_RESULT($PACKAGE)
198 AC_MSG_CHECKING(for stepmake)
199 # Check for installed stepmake
200 if test -d $stepmake; then
201 AC_MSG_RESULT($stepmake)
203 stepmake='$(depth)'/stepmake
204 AC_MSG_RESULT(./stepmake ($datadir/stepmake not found))
207 $HOME/usr/local/share/stepmake/bin\
208 $HOME/usr/local/lib/stepmake/bin\
209 $HOME/usr/share/stepmake/bin\
210 $HOME/usr/lib/stepmake/bin\
211 /usr/local/share/stepmake/bin\
212 /usr/local/lib/stepmake/bin\
213 /usr/share/stepmake/bin\
214 /usr/lib/stepmake/bin\
222 AC_SUBST(PACKAGE_NAME)
223 AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
224 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
226 if test "$package_depth" = "" ; then
229 package_depth="../$package_depth"
232 AC_SUBST(package_depth)
234 AUTOGENERATE="This file was automatically generated by configure"
235 AC_SUBST(AUTOGENERATE)
236 absolute_builddir="`pwd`"
237 AC_SUBST(absolute_builddir)
239 STATE_VECTOR=`ls make/STATE-VECTOR 2>/dev/null`
240 if test "x$STATE_VECTOR" != "x"; then
241 STATE_VECTOR="\$(depth)/$STATE_VECTOR"
243 AC_SUBST(STATE_VECTOR)
246 AC_ARG_ENABLE(config,
247 [ enable-config=FILE put configure settings in config-FILE.make],
248 [CONFIGSUFFIX=$enableval])
250 if test "$CONFIGSUFFIX" != "" ; then
251 CONFIGFILE=config-$CONFIGSUFFIX
255 AC_SUBST(CONFIGSUFFIX)
258 AC_CHECK_PROGS(MAKE, gmake make, error)
259 AC_CHECK_PROGS(FIND, find, error)
261 dnl system supplied INSTALL is unsafe; use our own install.
263 dnl if test "$INSTALL" = "bin/install-sh"; then
264 dnl export INSTALL="\$\(depth\)/bin/install-sh"
267 AC_CHECK_PROGS(TAR, tar, error)
269 if test "x`uname`" = "xHP-UX"; then
270 AC_PATH_PROG(BASH, bash, /bin/sh)
271 AC_STEPMAKE_WARN(avoiding buggy /bin/sh)
272 AC_PATH_PROG(SHELL, bash, /bin/ksh)
274 AC_PATH_PROG(BASH, bash, /bin/sh)
280 AC_PATH_PROG(PYTHON, ${PYTHON:-python}, -echo no python)
283 if test $MAKE != "error" ; then
284 $MAKE -v 2> /dev/null | grep GNU > /dev/null
287 AC_STEPMAKE_WARN(Please install *GNU* make)
291 AC_CHECK_SEARCH_RESULT($PYTHON, python, You should install Python)
293 if test "x$OSTYPE" = "xcygwin32" || test "x$OSTYPE" = "xWindows_NT"; then
294 LN=cp # hard link does not work under cygnus-nt
295 LN_S='cp -r' # symbolic link does not work for native nt
302 # cygwin fixes all these things.
303 # it seems these were used because of dos-style TEXINPUTS and
304 # MFINPUTS needed for miktex.
305 # but this breaks parsing of all other cygwin/unix style paths.
307 # if your (mik)tex breaks, make a:
308 # /usr/local/bin/tex:
310 # TEXINPUTS=`cygpath -pw $TEXINPUTS` /texmf/miktex/bin/tex $*
316 # MFINPUTS=`cygpath -pw $MFINPUTS` /texmf/miktex/bin/mf $*
318 # this way, you may have buildscripts/out/lilypond-profile
319 # 'automatically' sourced from /usr/etc/profile.d/ too.
323 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
330 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
337 AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
338 AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
346 AC_DEFUN(AC_STEPMAKE_LEXYACC, [
347 # ugh, automake: we want (and check for) bison
349 # ugh, automake: we want (and check for) flex
351 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
355 ac_cv_prog_lex_root=lex.yy
357 AC_CHECK_PROGS(BISON, bison, error)
358 AC_CHECK_PROGS(FLEX, flex, error)
359 AC_CHECK_SEARCH_RESULT($BISON, bison, Please install Bison, 1.25 or newer)
360 AC_CHECK_SEARCH_RESULT($FLEX, flex, Please install Flex, 2.5 or newer)
362 if test $BISON != "error"; then
363 bison_version=`$BISON --version | sed 's/^.*version 1.//g'`
364 if test `echo $bison_version | sed 's/\..*$//g'` -lt 25; then
365 AC_STEPMAKE_WARN(Your bison is a bit old (1.$bison_version). You might have to install 1.25)
373 AC_DEFUN(AC_STEPMAKE_LIB, [
374 AC_CHECK_PROGS(AR, ar, error)
381 AC_DEFUN(AC_STEPMAKE_LIBTOOL, [
383 # **Never** try to set library version numbers so that they correspond
384 # to the release number of your package. This is an abuse that only
385 # fosters misunderstanding of the purpose of library versions.
387 REVISION=$PATCH_LEVEL
388 # CURRENT=$MINOR_VERSION
389 CURRENT=`expr $MINOR_VERSION + 1`
390 # AGE=$(expr $MAJOR_VERSION + 1)
397 AC_DEFUN(AC_STEPMAKE_LOCALE, [
402 AC_ARG_WITH(localedir,
403 [ with-localedir=LOCALE use LOCALE as locale dir. Default: PREFIX/share/locale ],
404 localedir=$with_localedir,
405 localedir='${prefix}/share/locale')
408 [ with-lang=LANG use LANG as language to emit messages],
412 AC_MSG_CHECKING(language)
414 En* | en* | Am* | am* | US* | us*)
416 NL | nl | Du* | du* | Ned* | ned*)
425 if test "$lang" = "unknown" ; then
426 AC_STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
431 AC_DEFUN(AC_STEPMAKE_GETTEXT, [
432 DIR_LOCALEDIR=${localedir}
434 if test "$prefix" = "NONE"; then
435 presome=${ac_default_prefix}
437 DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
439 AC_SUBST(DIR_LOCALEDIR)
440 AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
442 AC_CHECK_LIB(intl, gettext)
443 AC_CHECK_FUNCS(gettext)
446 AC_DEFUN(AC_STEPMAKE_MAN, [
447 AC_CHECK_PROGS(GROFF, groff ditroff, -echo no groff)
448 AC_CHECK_PROGS(TROFF, troff, -echo no troff)
449 AC_CHECK_PROGS(TBL, tbl, cat)
452 AC_DEFUN(AC_STEPMAKE_MSGFMT, [
453 # AC_CHECK_PROGS(MSGFMT, msgfmt, -echo no msgfmt)
454 AC_CHECK_PROGS(MSGFMT, msgfmt, \$(SHELL) \$(step-bindir)/fake-msgfmt.sh )
455 AC_MSG_CHECKING(whether msgfmt accepts -o)
456 msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
457 if test "$msgfmt_output" = ""; then
461 MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh"
463 AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
465 if test ! -n "$MSGFMT"; then
466 AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
470 #why has this been dropped?
471 AC_DEFUN(XXAC_STEPMAKE_TEXMF_DIRS, [
472 AC_ARG_ENABLE(tex-prefix,
473 [ enable-tex-prefix=DIR set the tex-directory to find TeX subdirectories. (default: PREFIX)],
474 [TEXPREFIX=$enableval],
477 AC_ARG_ENABLE(tex-dir,
478 [ enable-tex-dir=DIR set the directory to put $PACKAGE_NAME TeX files in. ],
482 AC_ARG_ENABLE(mf-dir,
483 [ enable-mf-dir=DIR set the directory to put $PACKAGE_NAME MetaFont files in. ],
487 if test "x$TEXPREFIX" = xauto ; then
488 AC_TEX_PREFIX(TEXPREFIX)
490 find_texprefix=$TEXPREFIX
493 if test "x$MFDIR" = xauto; then
497 if test "x$TEXDIR" = xauto ; then
498 AC_TEX_SUBDIR(TEXDIR)
505 AC_DEFUN(AC_STEPMAKE_TEXMF_DIRS, [
506 AC_ARG_ENABLE(tex-tfmdir,
507 [ enable-tex-tfmdir=DIR set the tex-directory where cmr10.tfm lives (default: use kpsewhich)],
511 AC_CHECK_PROGS(KPSEWHICH, kpsewhich, no)
512 AC_MSG_CHECKING(for TeX TFM directory)
513 if test "x$TFMDIR" = xauto ; then
514 if test "x$TEX_TFMDIR" = "x" ; then
515 if test "x$KPSEWHICH" != "xno" ; then
516 CMR10=`kpsewhich tfm cmr10.tfm`
517 TEX_TFMDIR=`dirname $CMR10`
519 AC_STEPMAKE_WARN(Please set TEX_TFMDIR (to where cmr10.tfm lives):
520 TEX_TFMDIR=/usr/local/TeX/lib/tex/fonts ./configure)
524 AC_MSG_RESULT($TEX_TFMDIR)
528 AC_DEFUN(AC_STEPMAKE_TEXMF, [
529 # urg, never know what names these teTeX guys will think up
531 AC_CHECK_PROGS(METAFONT, mf, no)
532 if test "x$METAFONT" = "xno"; then
533 AC_CHECK_PROGS(MFONT, mfont, -echo no mf or mfont)
537 AC_CHECK_PROGS(METAPOST, mp, no)
538 if test "x$METAPOST" = "xno"; then
539 AC_CHECK_PROGS(MPOST, mpost, -echo no mp or mpost)
544 AC_CHECK_PROGS(INIMETAFONT, inimf, no)
545 if test "x$INIMETAFONT" = "xno"; then
546 AC_CHECK_PROGS(INIMFONT, inimfont, -echo no inimf or inimfont)
547 INIMETAFONT=$INIMFONT
550 AC_CHECK_PROGS(INIMETAPOST, inimp, no)
551 if test "x$INIMETAPOST" = "xno"; then
552 AC_CHECK_PROGS(INIMPOST, inimpost, -echo no inimp or inimpost)
553 INIMETAPOST=$INIMPOST
556 AC_MSG_CHECKING(for working metafont mode)
557 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
558 for MFMODE in $modelist; do
559 $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
560 if test -f mfput.tfm; then
565 AC_MSG_RESULT($MFMODE)
570 AC_SUBST(INIMETAFONT)
571 AC_SUBST(INIMETAPOST)
574 AC_DEFUN(AC_STEPMAKE_WARN, [
579 AC_DEFUN(AC_STEPMAKE_YODL, [
580 if test "x$YODL" = "x"; then
581 AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
582 AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
583 AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
584 AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
585 AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
586 AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
587 AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
588 AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
589 YODL2LESS_DIR='$(bindir)/'
595 AC_SUBST(YODL2LESS_DIR)
597 AC_SUBST(YODL2MSLESS)
598 AC_SUBST(YODL2TEXINFO)
600 export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
602 if test "x$YODL" = "-echo no yodl"; then
603 AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
607 dnl should cache result.
608 dnl should look in $prefix first.
609 dnl should probably assume TDS
611 AC_DEFUN(AC_TEX_PREFIX, [
614 AC_MSG_CHECKING(TeX/MF root dir directory)
616 find_root_prefix="$prefix"
619 test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
621 for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
622 find_texprefix="$find_root_prefix$postfix"
623 if test -d $find_texprefix; then
624 find_texpostfix=$postfix
629 if test "x$find_texpostfix" = x; then
630 find_texpostfix='/lib/texmf/tex'
631 AC_STEPMAKE_WARN(Cannot determine the TeX-directory. Please use --enable-tex-prefix)
634 find_texprefix="$find_root_prefix/$find_texpostfix"
636 # only assign if variablename not empty
637 if test x != "x[$]$1"; then
638 $1='${prefix}'/"$find_texpostfix"
640 AC_MSG_RESULT($find_texprefix)
645 # find a directory inside a prefix,
646 # $1 the prefix (expanded version)
647 # $2 variable to assign
648 # $3 the directory name
650 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
652 AC_MSG_CHECKING($4 directory)
654 $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
657 if test "x$find_dirdir" = x; then
659 AC_STEPMAKE_WARN(Cannot determine $4 subdirectory. Please set from command-line)
663 AC_MSG_RESULT($1/$find_dirdir)
666 # ugh. this is hopeless
667 AC_DEFUN(AC_KPSE_TEX_DIR, [
668 kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
669 kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
671 if test -w "$kpse_syspaths";
673 dir=`echo $kpse_syspaths | head -1`
675 dir=`echo $kpse_paths | grep -v '!'| head -1`
677 if test "$prefix" = "NONE"; then
678 local_prefix=$ac_default_prefix
679 local_prefix_quote='${prefix}'
683 local_prefix_quote=$prefix
685 echo $local_prefix_quote = $local_prefix
687 echo $dir | sed 's!'$local_prefix'!\$local_prefix_quote!g'
690 AC_DEFUN(AC_TEX_SUBDIR, [
691 dnl AC_REQUIRE([AC_TEX_PREFIX])
692 AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
696 AC_DEFUN(AC_MF_SUBDIR, [
697 dnl AC_REQUIRE([AC_TEX_PREFIX])
698 AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
702 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
703 result="`echo \"$1\" | grep echo`"
704 if test "x$1" = "xerror" -o "x$result" != "x"; then
705 AC_STEPMAKE_WARN(can\'t find $2. $3)
709 dnl GUILE_FLAGS --- set flags for compiling and linking with Guile
711 dnl This macro runs the `guile-config' script, installed with Guile,
712 dnl to find out where Guile's header files and libraries are
713 dnl installed. It sets two variables, marked for substitution, as
716 dnl GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
717 dnl code that uses Guile header files. This is almost
718 dnl always just a -I flag.
720 dnl GUILE_LDFLAGS --- flags to pass to the linker to link a
721 dnl program against Guile. This includes `-lguile' for
722 dnl the Guile library itself, any libraries that Guile
723 dnl itself requires (like -lqthreads), and so on. It may
724 dnl also include a -L flag to tell the compiler where to
725 dnl find the libraries.
727 AC_DEFUN([GUILE_FLAGS],[
728 ## The GUILE_FLAGS macro.
729 ## First, let's just see if we can find Guile at all.
730 AC_MSG_CHECKING(for Guile)
731 guile-config link > /dev/null || {
732 echo "configure: cannot find guile-config; is Guile installed?" 1>&2
735 GUILE_CFLAGS="`guile-config compile`"
736 GUILE_LDFLAGS="`guile-config link`"
737 AC_SUBST(GUILE_CFLAGS)
738 AC_SUBST(GUILE_LDFLAGS)
743 # Configure paths for GTK+
744 # Owen Taylor 97-11-3
746 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
747 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
749 AC_DEFUN(AM_PATH_GTK,
751 dnl Get the cflags and libraries from the gtk-config script
753 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
754 min_gtk_version=ifelse([$1], ,1.1.1,$1)
755 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
757 if test "$GTK_CONFIG" != "no" ; then
758 GTK_CFLAGS=`$GTK_CONFIG --cflags`
759 GTK_LIBS=`$GTK_CONFIG --libs`
760 ac_save_CFLAGS="$CFLAGS"
762 ac_save_CXXFLAGS="$CXXFLAGS"
763 CFLAGS="$CFLAGS $GTK_CFLAGS"
764 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
765 LIBS="$LIBS $GTK_LIBS"
767 dnl Now check if the installed GTK is sufficiently new. (Also sanity
768 dnl checks the results of gtk-config to some extent)
777 int major, minor, micro;
779 if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) {
780 printf("%s, bad version string\n", "$min_gtk_version");
784 return !((gtk_major_version > major) ||
785 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
786 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
788 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
789 CFLAGS="$ac_save_CFLAGS"
790 CXXFLAGS="$ac_save_CXXFLAGS"
795 if test "x$no_gtk" = x ; then
797 ifelse([$2], , :, [$2])
802 ifelse([$3], , :, [$3])
804 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
811 # Configure paths for GTK--
812 # Erik Andersen 30 May 1998
813 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
815 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
816 dnl to be used as follows:
817 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
820 dnl Get the cflags and libraries from the gtkmm-config script
822 AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX
823 Prefix where GTK-- is installed (optional)],
824 gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
825 AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX
826 Exec prefix where GTK-- is installed (optional)],
827 gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
828 AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program],
829 , enable_gtkmmtest=yes)
831 if test x$gtkmm_config_exec_prefix != x ; then
832 gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
833 if test x${GTKMM_CONFIG+set} != xset ; then
834 GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
837 if test x$gtkmm_config_prefix != x ; then
838 gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
839 if test x${GTKMM_CONFIG+set} != xset ; then
840 GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
845 AC_DEFUN(AM_PATH_GTKMM,
849 dnl Check if the installed GTK-- is sufficiently new.
851 AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
852 min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
854 AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
856 if test "$GTKMM_CONFIG" = "no" ; then
862 GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
863 GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
864 gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
865 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
866 gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
867 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
868 gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
869 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
870 if test "x$enable_gtkmmtest" = "xyes" ; then
871 ac_save_CXXFLAGS="$CXXFLAGS"
873 CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
874 LIBS="$LIBS $GTK___LIBS"
876 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
877 dnl checks the results of gtkmm-config to some extent
888 int major, minor, micro;
891 system ("touch conf.gtkmmtest");
893 /* HP/UX 0 (%@#!) writes to sscanf strings */
894 tmp_version = g_strdup("$min_gtkmm_version");
895 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
896 printf("%s, bad version string\n", "$min_gtkmm_version");
900 if ((gtkmm_major_version != $gtkmm_config_major_version) ||
901 (gtkmm_minor_version != $gtkmm_config_minor_version) ||
902 (gtkmm_micro_version != $gtkmm_config_micro_version))
904 printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n",
905 $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
906 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
907 printf ("*** was found! If gtkmm-config was correct, then it is best\n");
908 printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
909 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
910 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
911 printf("*** required on your system.\n");
912 printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
913 printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
914 printf("*** before re-running configure\n");
916 /* GTK-- does not have the GTKMM_*_VERSION constants */
918 else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
919 (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
920 (gtkmm_micro_version != GTKMM_MICRO_VERSION))
922 printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
923 GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
924 printf("*** library (version %d.%d.%d)\n",
925 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
930 if ((gtkmm_major_version > major) ||
931 ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
932 ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
938 printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
939 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
940 printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
941 major, minor, micro);
942 printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
944 printf("*** If you have already installed a sufficiently new version, this error\n");
945 printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
946 printf("*** being found. The easiest way to fix this is to remove the old version\n");
947 printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
948 printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
949 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
950 printf("*** so that the correct libraries are found at run-time))\n");
955 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
956 CXXFLAGS="$ac_save_CXXFLAGS"
960 if test "x$no_gtkmm" = x ; then
962 ifelse([$2], , :, [$2])
965 if test "$GTKMM_CONFIG" = "no" ; then
966 echo "*** The gtkmm-config script installed by GTK-- could not be found"
967 echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
968 echo "*** your path, or set the GTK_CONFIG environment variable to the"
969 echo "*** full path to gtk-config."
970 echo "*** The gtkmm-config script was not available in GTK-- versions"
971 echo "*** prior to 0.9.12. Perhaps you need to update your installed"
972 echo "*** version to 0.9.12 or newer"
974 if test -f conf.gtkmmtest ; then
977 echo "*** Could not run GTK-- test program, checking why..."
978 CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
979 LIBS="$LIBS $GTK___LIBS"
983 ], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
984 [ echo "*** The test program compiled, but did not run. This usually means"
985 echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
986 echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
987 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
988 echo "*** to the installed location Also, make sure you have run ldconfig if that"
989 echo "*** is required on your system"
991 echo "*** If you have an old version installed, it is best to remove it, although"
992 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
993 [ echo "*** The test program failed to compile or link. See the file config.log for the"
994 echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
995 echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
996 echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
997 CXXFLAGS="$ac_save_CXXFLAGS"
1003 ifelse([$3], , :, [$3])
1006 AC_SUBST(GTK___CFLAGS)
1007 AC_SUBST(GTK___LIBS)
1008 rm -f conf.gtkmmtest
1011 # Configure paths for GTK--DRAW
1012 # Derek Quinn Wyatt 98-08-21 (adapted from Jan Nieuwenhuizen's code)
1014 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1015 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
1017 AC_DEFUN(AM_PATH_GTK__DRAW,
1019 dnl Get the cflags and libraries from the gtk__-config script
1021 AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1022 min_gtk___version=ifelse([$1], ,0.0.5,$1)
1023 AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
1025 if test "$GTKMM_CONFIG" != "no" ; then
1026 GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
1027 GTK___LIBS=`$GTKMM_CONFIG --libs`
1028 GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
1029 GTK___LIBS="$GTK___DLIBS"
1030 ac_save_CFLAGS="$CFLAGS"
1031 ac_save_LIBS="$LIBS"
1032 ac_save_CXXFLAGS="$CXXFLAGS"
1033 CFLAGS="$CFLAGS $GTK___CFLAGS"
1034 CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1035 LIBS="$LIBS $GTK___LIBS"
1037 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
1038 dnl checks the results of gtk__-config to some extent)
1050 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1051 CFLAGS="$ac_save_CFLAGS"
1052 CXXFLAGS="$ac_save_CXXFLAGS"
1053 LIBS="$ac_save_LIBS"
1057 if test "x$no_gtk__" = x ; then
1059 ifelse([$2], , :, [$2])
1064 ifelse([$3], , :, [$3])
1066 CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1068 AC_SUBST(GTK___CFLAGS)
1069 AC_SUBST(GTK___LIBS)