]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
patch::: 1.5.1.jcn2
[lilypond.git] / aclocal.m4
1 dnl aclocal.m4   -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
3
4 AC_DEFUN(AC_STEPMAKE_BIBTEX2HTML, [
5     AC_CHECK_PROGS(BIBTEX2HTML, bibtex2html bib2html, error)
6     if test "$BIBTEX2HTML" = "bib2html"; then
7         BIBTEX2HTML_FLAGS='$< $(@)'
8     else
9         BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
10     fi
11     AC_SUBST(BIBTEX2HTML)
12     AC_SUBST(BIBTEX2HTML_FLAGS)
13 ])
14
15
16 AC_DEFUN(AC_STEPMAKE_COMPILE, [
17     # -O is necessary to get inlining
18     CFLAGS=${CFLAGS:-""}
19     CXXFLAGS=${CXXFLAGS:-$CFLAGS}
20     LDFLAGS=${LDFLAGS:-""}
21     checking_b=yes
22     optimise_b=yes
23     profile_b=no
24     debug_b=yes
25
26     AC_ARG_ENABLE(checking,
27     [  --enable-checking       set runtime checks (assert calls).  Default: on],
28     [checking_b=$enableval] )
29
30     AC_ARG_ENABLE(debugging,
31     [  --enable-debugging      compile with debugging info.  Default: on],
32     [debug_b=$enableval])
33
34     AC_ARG_ENABLE(profiling, 
35     [  --enable-profiling      compile with gprof support.  Default: off],
36     [profile_b=$enableval])
37     
38
39     if test "$checking_b" = no; then
40         # ugh
41         AC_DEFINE(NDEBUG)
42         DEFINES="$DEFINES -DNDEBUG"
43     fi
44
45     if test "$optimise_b" = yes; then
46         OPTIMIZE="-O2 -finline-functions"
47     fi
48
49
50     if test $profile_b = yes; then
51         EXTRA_LIBES="-pg"
52         OPTIMIZE="$OPTIMIZE -pg"
53     fi
54
55     if test $debug_b = yes; then        
56         OPTIMIZE="$OPTIMIZE -g"
57     fi
58
59
60     AC_PROG_CC
61     LD='$(CC)'
62     AC_SUBST(LD)
63
64     CFLAGS="$CFLAGS $OPTIMIZE"
65     CPPFLAGS=${CPPFLAGS:-""}
66
67     AC_MSG_CHECKING([for IEEE-conformance compiler flags])
68     save_cflags="$CFLAGS"
69     case "$host" in
70         alpha*-*-*)
71             dnl should do compile test?
72             AC_MSG_RESULT(-mieee)
73             CFLAGS="-mieee $CFLAGS"
74             ;;
75         *)
76             AC_MSG_RESULT([none])
77             ;;
78     esac
79     AC_SUBST(cross_compiling)
80     AC_SUBST(CFLAGS)
81     AC_SUBST(CPPFLAGS)
82     AC_SUBST(LDFLAGS)
83     AC_SUBST(ICFLAGS)
84     AC_SUBST(ILDFLAGS)
85     AC_SUBST(DEFINES)
86     AC_SUBST(EXTRA_LIBES)
87 ])
88
89 AC_DEFUN(AC_STEPMAKE_CXX, [
90     AC_LANG_CPLUSPLUS
91     AC_PROG_CXX
92
93     AC_CHECK_HEADER(FlexLexer.h, true,
94         AC_STEPMAKE_WARN(can"\'"t find flex header. Please install Flex headers correctly))
95
96     CPPFLAGS="$CPPFLAGS $DEFINES"
97     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
98     LDFLAGS="$LDFLAGS $EXTRA_LIBES"
99
100     AC_SUBST(CXXFLAGS)
101     AC_SUBST(CXX)
102     LD='$(CXX)'
103     AC_SUBST(LD)
104 ])
105
106 AC_DEFUN(AC_STEPMAKE_CXXTEMPLATE, [
107     AC_CACHE_CHECK([whether explicit instantiation is needed],
108         lily_cv_need_explicit_instantiation,
109         AC_TRY_LINK([
110     template <class T> struct foo { static int baz; };
111     template <class T> int foo<T>::baz = 1;
112     ], [ return foo<int>::baz; ],
113             lily_cv_need_explicit_instantiation=no,
114             lily_cv_need_explicit_instantiation=yes))
115     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
116         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
117     fi
118 ])
119
120 AC_DEFUN(AC_STEPMAKE_DATADIR, [
121     if test "$datadir" = "\${prefix}/share"; then
122             datadir='${prefix}/share/'$package
123     fi
124     DIR_DATADIR=${datadir}
125     presome=${prefix}
126     if test "$prefix" = "NONE"; then
127             presome=${ac_default_prefix}
128     fi
129     DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
130
131     AC_SUBST(datadir)
132     AC_SUBST(DIR_DATADIR)
133     
134     dnl yeah, so fuck me gently with a cactus: this doesnt belong here
135     dnl Please take the person responsible for inventing shell-scripts out
136     dnl and shoot him. On behalf of the sane world, thank you.
137     dnl DIR_SHAREDSTATEDIR="foobar"
138     dnl AC_SUBST(DIR_SHAREDSTATEDIR)
139     
140     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
141 ])
142
143 AC_DEFUN(AC_STEPMAKE_END, [
144     AC_OUTPUT($CONFIGFILE.make:config.make.in)
145
146     # regular in-place build
147     # test for srcdir_build = yes ?
148     if test "$builddir" = "."; then
149         rm -f $srcdir/GNUmakefile
150         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
151         chmod 444 $srcdir/GNUmakefile
152     else # --srcdir build
153         rm -f GNUmakefile
154         cp $srcdir/make/srcdir.make.in GNUmakefile
155         chmod 444 GNUmakefile
156     fi
157 ])
158
159 AC_DEFUN(AC_STEPMAKE_GXX, [
160     AC_MSG_CHECKING("g++ version")
161     cxx_version=`$CXX --version`
162     AC_MSG_RESULT("$cxx_version")
163     changequote(<<, >>)dnl
164     # urg, egcs: how to check for egcs >= 1.1?
165     if expr "$cxx_version" : '.*2\.[89]' > /dev/null ||
166         expr "$cxx_version" : '.*egcs' > /dev/null ||
167         expr "$cxx_version" : '3\.0' > /dev/null
168     changequote([, ])dnl
169     then
170             true
171     else
172             AC_STEPMAKE_WARN(can\'t find g++ 2.8, 2.9, 3.0 or egcs 1.1)
173     fi
174 ])
175
176 AC_DEFUN(AC_STEPMAKE_GUILE, [
177     ## First, let's just see if we can find Guile at all.
178     AC_MSG_CHECKING("for guile-config")
179     for guile_config in guile-config $target-guile-config $build-guile-config; do
180         AC_MSG_RESULT("$guile_config")
181         if ! $guile_config --version > /dev/null 2>&1 ; then
182             AC_MSG_WARN("cannot execute $guile_config")
183             AC_MSG_CHECKING("if we are cross compiling")
184             guile_config=error
185         else
186             break
187         fi
188     done
189     if test "$guile_config" = "error"; then
190         AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
191         exit 1
192     fi
193     AC_MSG_CHECKING("Guile version")
194     need_guile_version="1.3.4"
195     need_guile_version_numeric=100304
196     guile_version=`$guile_config --version 2>&1 | awk '{print $NF}'`
197     guile_version_numeric=`echo $guile_version | awk -F. '
198 {if ([$]3) {last = [$]3}
199 else {last =0}}
200 {printf "%s%s%s\n",[$]1*100, [$]2*10,last}'`
201     AC_MSG_RESULT("$guile_version")
202     if test $guile_version_numeric -lt $need_guile_version_numeric
203     then
204         AC_STEPMAKE_WARN("Guile version "$need_guile_version" or newer is needed")
205     fi
206     changequote(<<, >>)dnl
207     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
208     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
209     changequote([, ])dnl
210     GUILE_FLAGS
211     AC_PATH_PROG(GUILE, guile, error)
212     AC_SUBST(GUILE)
213     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
214     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
215 ])
216
217 AC_DEFUN(AC_STEPMAKE_INIT, [
218
219     . $srcdir/VERSION
220     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
221     if test x$MY_PATCH_LEVEL != x; then
222         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
223     fi
224
225     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
226     changequote(<<, >>)dnl
227     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
228     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
229     changequote([, ])dnl
230
231     # No versioning on directory names of sub-packages 
232     # urg, urg
233     stepmake=${datadir}/stepmake
234     presome=${prefix}
235     if test "$prefix" = "NONE"; then
236             presome=${ac_default_prefix}
237     fi
238     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
239
240     # urg, how is this supposed to work?
241     if test "$program_prefix" = "NONE"; then
242           program_prefix=
243     fi
244     if test "$program_suffix" = "NONE"; then
245           program_suffix=
246     fi
247
248     AC_MSG_CHECKING(Package)
249     if test "x$PACKAGE" = "xSTEPMAKE"; then
250         AC_MSG_RESULT(Stepmake package!)
251
252         AC_MSG_CHECKING(builddir)
253         if test "$srcdir" = "."; then
254             builddir=.
255         else
256             absolute_builddir="`pwd`"
257             package_absolute_builddir="`dirname $absolute_builddir`"
258             package_srcdir="`dirname  $srcdir`"
259             builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`"
260         fi
261         AC_MSG_RESULT($builddir)
262
263         (cd stepmake 2>/dev/null || mkdir stepmake)
264         (cd stepmake; rm -f stepmake; ln -s ../$srcdir/stepmake .)
265         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
266         AC_CONFIG_AUX_DIR(bin)
267         stepmake=stepmake
268     else
269         AC_MSG_RESULT($PACKAGE)
270
271         AC_MSG_CHECKING(builddir)
272         if test "$srcdir" = "."; then
273             builddir=.
274             srcdir_build=no
275         else
276             absolute_builddir="`pwd`"
277 #           builddir="`dirname  $srcdir`/`basename $absolute_builddir`"
278             builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`"
279             srcdir_build=yes
280         fi
281         AC_MSG_RESULT($builddir)
282         if expr "$srcdir" : '/' > /dev/null 2>&1; then
283             absolute_srcdir=yes
284             AC_STEPMAKE_WARN(Absolute --srcdir specified: $srcdir)
285         fi
286
287         AC_MSG_CHECKING(for stepmake)
288         # Check for installed stepmake
289         if test -d $stepmake; then
290             AC_MSG_RESULT($stepmake)
291         else
292             if test "$absolute_srcdir" != "yes"; then
293                 stepmake='$(depth)'/$srcdir/stepmake
294             else
295                 stepmake=$srcdir/stepmake
296             fi
297             AC_MSG_RESULT($srcdir/stepmake  ($datadir/stepmake not found))
298         fi
299
300         AC_CONFIG_AUX_DIR(\
301           $HOME/usr/local/share/stepmake/bin\
302           $HOME/usr/local/lib/stepmake/bin\
303           $HOME/usr/share/stepmake/bin\
304           $HOME/usr/lib/stepmake/bin\
305           /usr/local/share/stepmake/bin\
306           /usr/local/lib/stepmake/bin\
307           /usr/share/stepmake/bin\
308           /usr/lib/stepmake/bin\
309           stepmake/bin\
310           $srcdir/stepmake/bin\
311         )
312     fi
313
314     AC_SUBST(builddir)
315     AC_SUBST(stepmake)
316     AC_SUBST(package)
317     AC_SUBST(PACKAGE)
318     AC_SUBST(PACKAGE_NAME)
319     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
320     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
321
322     if test "$package_depth" = "" ; then
323         package_depth="."
324     else
325         package_depth="../$package_depth"
326     fi
327     export package_depth
328     AC_SUBST(package_depth)
329
330     AUTOGENERATE="This file was automatically generated by configure"
331     AC_SUBST(AUTOGENERATE)
332
333     CONFIGSUFFIX=
334     AC_ARG_ENABLE(config,
335     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
336                             do \`make conf=CONF' to get output in ./out-CONF],
337     [CONFIGURATION=$enableval])
338
339     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
340     CONFIGFILE=config$CONFIGSUFFIX
341     AC_SUBST(CONFIGSUFFIX)
342      
343     AC_CANONICAL_HOST
344     AC_CHECK_PROGS(MAKE, gmake make, error)
345     AC_CHECK_PROGS(FIND, find, error)
346
347 dnl system supplied INSTALL is unsafe; use our own install.
348 dnl    AC_PROG_INSTALL
349 dnl    if test "$INSTALL" = "bin/install-sh"; then
350 dnl     export INSTALL="\$\(depth\)/bin/install-sh"
351 dnl    fi
352
353     AC_CHECK_PROGS(TAR, tar, error)
354
355     if test "x`uname`" = "xHP-UX"; then
356         AC_PATH_PROG(BASH, bash, /bin/sh)
357         AC_STEPMAKE_WARN(avoiding buggy /bin/sh)
358         AC_PATH_PROG(SHELL, bash, /bin/ksh)
359     else
360         AC_PATH_PROG(BASH, bash, /bin/sh)
361         SHELL=/bin/sh
362         AC_SUBST(SHELL)
363     fi
364
365
366     AC_PATH_PROG(PYTHON, ${PYTHON:-python}, -echo no python)
367     AC_SUBST(PYTHON)
368
369     if test $MAKE != "error" ; then
370         $MAKE -v 2> /dev/null | grep GNU > /dev/null
371         if test "$?" = 1
372         then
373                 AC_STEPMAKE_WARN(Please install *GNU* make) 
374         fi
375     fi 
376
377     AC_CHECK_SEARCH_RESULT($PYTHON, python, You should install Python)
378
379     if test "x$OSTYPE" = "xcygwin32" || test "x$OSTYPE" = "xWindows_NT"; then
380         LN=cp # hard link does not work under cygnus-nt
381         LN_S='cp -r' # symbolic link does not work for native nt
382         ZIP="zip -r -9" #
383         program_suffix=.exe
384         # urg
385         # ROOTSEP=':'
386         # DIRSEP='\\'
387         # PATHSEP=';'
388         #
389         # cygwin fixes all these things.  
390         # it seems these were used because of dos-style TEXINPUTS and
391         # MFINPUTS needed for miktex.
392         # but this breaks parsing of all other cygwin/unix style paths.
393         #
394         # if your (mik)tex breaks, make a:
395         #    /usr/local/bin/tex:
396         #    #!/bin/sh
397         #    TEXINPUTS=`cygpath -pw $TEXINPUTS` /texmf/miktex/bin/tex $*
398         #
399         # and
400         #
401         #    /usr/local/bin/mf:
402         #    #!/bin/sh
403         #    MFINPUTS=`cygpath -pw $MFINPUTS` /texmf/miktex/bin/mf $*
404         #
405         # this way, you may have buildscripts/out/lilypond-profile 
406         # 'automatically' sourced from /usr/etc/profile.d/ too.
407         #
408         ROOTSEP=':'
409         DIRSEP='/'
410         PATHSEP=':'
411         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
412     else
413         ROOTSEP=':'
414         DIRSEP='/'
415         PATHSEP=':'
416         LN=ln
417         LN_S='ln -s'
418         ZIP="zip -r -9"
419         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
420     fi
421     AC_SUBST(program_prefix)
422     AC_SUBST(program_suffix)
423     AC_SUBST(ZIP)
424     AC_SUBST(LN)
425     AC_SUBST(LN_S)
426     AC_SUBST(INSTALL)
427     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
428     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
429     AC_SUBST(PATHSEP)
430     AC_SUBST(DIRSEP)
431   
432     AC_STEPMAKE_DATADIR
433 ])
434
435 AC_DEFUN(AC_STEPMAKE_KPATHSEA, [
436
437     kpathsea_b=yes
438     AC_ARG_WITH(kpathsea,
439     [  --with-kpathsea         use kpathsea lib.  Default: on],
440     [kpathsea_b=$enableval])
441
442     if test "$kpathsea_b" = "yes"; then 
443         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
444         AC_CHECK_LIB(kpathsea, kpse_find_file)
445         AC_CHECK_FUNCS(kpse_find_file,, AC_ERROR(Cannot find kpathsea functions.  You should install kpathsea; see INSTALL.txt.  Rerun ./configure --without-kpathsea only if kpathsea is not available for your platform.))
446     fi
447     AC_MSG_CHECKING(whether to use kpathsea)
448     if test "$kpathsea_b" = yes; then
449         AC_MSG_RESULT(yes)
450         KPATHSEA=1
451     else
452         AC_MSG_RESULT(no)
453         KPATHSEA=0
454     fi
455
456     AC_SUBST(KPATHSEA)
457     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
458 ])
459
460 AC_DEFUN(AC_STEPMAKE_LEXYACC, [
461     # ugh, automake: we want (and check for) bison
462     AC_PROG_YACC
463     # ugh, automake: we want (and check for) flex
464     # AC_PROG_LEX
465     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
466
467     # AC_DECL_YYTEXT
468     # ugh, ugh
469     ac_cv_prog_lex_root=lex.yy
470
471     AC_CHECK_PROGS(BISON, bison, error)
472     AC_CHECK_PROGS(FLEX, flex, error)
473     AC_CHECK_SEARCH_RESULT($BISON, bison,  Please install Bison, 1.25 or newer)
474     AC_CHECK_SEARCH_RESULT($FLEX,  flex, Please install Flex, 2.5 or newer)
475
476     if test $BISON != "error"; then
477         bison_version=`$BISON --version | sed 's/^.*version 1.//g'`
478         if test `echo $bison_version | sed 's/\..*$//g'` -lt 25; then
479             AC_STEPMAKE_WARN(Your bison is a bit old (1.$bison_version). You might have to install 1.25)
480         fi      
481     fi
482
483     AC_SUBST(BISON)
484     AC_SUBST(FLEX)
485 ])
486
487 AC_DEFUN(AC_STEPMAKE_LIB, [
488     AC_CHECK_PROGS(AR, ar, error)
489     AC_PROG_RANLIB
490
491     AC_SUBST(AR)
492     AC_SUBST(RANLIB)
493 ])
494
495 AC_DEFUN(AC_STEPMAKE_LIBTOOL, [
496     # libtool.info ...
497     # **Never** try to set library version numbers so that they correspond
498     # to the release number of your package.  This is an abuse that only
499     # fosters misunderstanding of the purpose of library versions.
500
501     REVISION=$PATCH_LEVEL
502     # CURRENT=$MINOR_VERSION
503     CURRENT=`expr $MINOR_VERSION + 1`
504     # AGE=$(expr $MAJOR_VERSION + 1)
505     AGE=$MAJOR_VERSION
506     AC_SUBST(CURRENT)
507     AC_SUBST(REVISION)
508     AC_SUBST(AGE)
509 ])
510
511 AC_DEFUN(AC_STEPMAKE_LOCALE, [
512     lang=English
513     ALL_LINGUAS="en nl"
514
515     # with/enable ??
516     AC_ARG_WITH(localedir,
517     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
518                             PREFIX/share/locale ],
519     localedir=$with_localedir,
520     localedir='${prefix}/share/locale')
521
522     AC_ARG_WITH(lang,
523     [  --with-lang=LANG        use LANG as language to emit messages],
524     language=$with_lang,
525     language=English)
526
527     AC_MSG_CHECKING(language)    
528     case "$language" in
529       En* | en* | Am* | am* | US* | us*)
530             lang=English;;
531       NL | nl | Du* | du* | Ned* | ned*)
532             lang=Dutch;;
533       "")
534             lang=English;;
535       *)
536             lang=unknown;;
537     esac
538     AC_MSG_RESULT($lang)
539
540     if test "$lang" = "unknown" ; then
541         AC_STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
542     fi
543
544 ])
545
546 AC_DEFUN(AC_STEPMAKE_GETTEXT, [
547     DIR_LOCALEDIR=${localedir}
548     presome=${prefix}
549     if test "$prefix" = "NONE"; then
550             presome=${ac_default_prefix}
551     fi
552     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
553     AC_SUBST(localedir)
554     AC_SUBST(DIR_LOCALEDIR)
555     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
556
557     AC_CHECK_LIB(intl, gettext)
558     AC_CHECK_FUNCS(gettext)
559 ])
560
561 AC_DEFUN(AC_STEPMAKE_MAKEINFO, [
562     AC_CHECK_PROGS(MAKEINFO, makeinfo, error)
563     if test "$MAKEINFO" != "error"; then
564         AC_MSG_CHECKING(whether makeinfo can split html by @node)
565         mkdir -p out
566         makeinfo --html --output=out/split <<EOF
567 \input texinfo
568 \input texinfo @c -*-texinfo-*-
569 @setfilename split.info
570 @settitle split.info
571 @bye
572 EOF
573         if test -d out/split; then
574             SPLITTING_MAKEINFO=yes
575             AC_MSG_RESULT(yes)
576             rm -rf out/split
577         else
578             AC_MSG_RESULT(no)
579             AC_STEPMAKE_WARN(your html documentation will be one large file)
580             rm -rf out/split
581         fi
582     fi
583     AC_SUBST(SPLITTING_MAKEINFO)
584 ])
585
586
587 AC_DEFUN(AC_STEPMAKE_MAN, [
588     AC_CHECK_PROGS(GROFF, groff ditroff, -echo no groff)
589     AC_CHECK_PROGS(TROFF, troff, -echo no troff)
590     AC_CHECK_PROGS(TBL, tbl, cat)
591 ])
592
593 AC_DEFUN(AC_STEPMAKE_MSGFMT, [
594     # AC_CHECK_PROGS(MSGFMT, msgfmt, -echo no msgfmt)
595     AC_CHECK_PROGS(MSGFMT, msgfmt, \$(SHELL) \$(step-bindir)/fake-msgfmt.sh )
596     AC_MSG_CHECKING(whether msgfmt accepts -o)
597     msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
598     if test "$msgfmt_output" = ""; then
599         AC_MSG_RESULT(yes)
600     else
601         # urg
602         MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh"
603         AC_MSG_RESULT(no)
604         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
605     fi
606     if test ! -n "$MSGFMT"; then
607         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
608     fi
609 ])
610
611 #why has this been dropped?
612 AC_DEFUN(XXAC_STEPMAKE_TEXMF_DIRS, [
613     AC_ARG_ENABLE(tex-prefix,
614     [  --enable-tex-prefix=DIR   set the tex-directory to find TeX
615                                subdirectories.  Default: PREFIX],
616     [TEXPREFIX=$enableval],
617     [TEXPREFIX=auto] )
618     
619     AC_ARG_ENABLE(tex-dir,
620     [  --enable-tex-dir=DIR      set the directory to put $PACKAGE_NAME TeX files in. ],
621     [TEXDIR=$enableval],
622     [TEXDIR=auto] )
623
624     AC_ARG_ENABLE(mf-dir,
625     [  --enable-mf-dir=DIR       set the directory to put $PACKAGE_NAME MetaFont files in. ],
626     [MFDIR=$enableval],
627     [MFDIR=auto])
628
629     if test "x$TEXPREFIX" = xauto ; then
630         AC_TEX_PREFIX(TEXPREFIX)
631     else
632      find_texprefix=$TEXPREFIX
633     fi
634
635     if test "x$MFDIR" = xauto; then
636         AC_MF_SUBDIR(MFDIR)
637     fi
638         
639     if test "x$TEXDIR" = xauto ; then
640         AC_TEX_SUBDIR(TEXDIR)
641     fi
642     AC_SUBST(TEXPREFIX)
643     AC_SUBST(TEXDIR)
644     AC_SUBST(MFDIR)
645 ])
646
647 AC_DEFUN(AC_STEPMAKE_TEXMF_DIRS, [
648     AC_ARG_ENABLE(tfm-path,
649     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
650                             esp.: cmr10.tfm.  Default: use kpsewhich],
651     [tfm_path=$enableval],
652     [tfm_path=auto] )
653
654     AC_CHECK_PROGS(KPSEWHICH, kpsewhich, no)
655     AC_MSG_CHECKING(for tfm path)
656
657     TFM_FONTS="cmr msam"
658
659     if test "x$tfm_path" = xauto ; then
660         if test "x$KPSEWHICH" != "xno" ; then
661             for i in $TFM_FONTS; do
662                 dir=`$KPSEWHICH tfm ${i}10.tfm`
663                 TFM_PATH="$TFM_PATH `dirname $dir`"
664             done
665         else
666             AC_STEPMAKE_WARN(Please specify where cmr10.tfm lives:
667     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
668         fi
669     else
670          TFM_PATH=$tfm_path
671     fi
672
673     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
674     AC_MSG_RESULT($TFM_PATH)
675     AC_SUBST(TFM_PATH)
676 ])
677
678 AC_DEFUN(AC_STEPMAKE_TEXMF, [
679     # urg, never know what names these teTeX guys will think up
680
681     AC_CHECK_PROGS(METAFONT, mf, no)
682     if test "x$METAFONT" = "xno"; then
683         AC_CHECK_PROGS(MFONT, mfont, -echo no mf or mfont)
684         METAFONT=$MFONT
685     fi
686
687     AC_CHECK_PROGS(METAPOST, mp, no)
688     if test "x$METAPOST" = "xno"; then
689         AC_CHECK_PROGS(MPOST, mpost, -echo no mp or mpost)
690
691         METAPOST=$MPOST
692     fi
693
694     AC_CHECK_PROGS(INIMETAFONT, inimf, no)
695     if test "x$INIMETAFONT" = "xno"; then
696         AC_CHECK_PROGS(INIMFONT, inimfont, -echo no inimf or inimfont)
697         INIMETAFONT=$INIMFONT
698     fi
699
700     AC_CHECK_PROGS(INIMETAPOST, inimp, no)
701     if test "x$INIMETAPOST" = "xno"; then
702         AC_CHECK_PROGS(INIMPOST, inimpost, -echo no inimp or inimpost)
703         INIMETAPOST=$INIMPOST
704     fi
705
706     AC_MSG_CHECKING(for working metafont mode)
707     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
708     for MFMODE in $modelist; do
709         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
710         if test -f mfput.tfm; then
711             break;
712         fi
713     done
714     AC_MSG_RESULT($MFMODE)
715
716     AC_MSG_CHECKING(for mfplain.mp)
717     #
718     # For now let people define these in their environments
719     #
720     : ${MFPLAIN_MP=`kpsewhich mp mfplain.mp`}
721     AC_MSG_RESULT($MFPLAIN_MP)
722
723     AC_MSG_CHECKING(for inimetapost flags)
724     if test  ${INIMETAPOST} = "inimp" ; then
725        : ${INIMETAPOST_FLAGS=''}
726     else
727        : ${INIMETAPOST_FLAGS='-interaction=nonstopmode'}
728     fi
729     AC_MSG_RESULT($INIMETAPOST_FLAGS)
730
731     rm -f mfput.*
732
733     AC_SUBST(METAFONT)
734     AC_SUBST(METAPOST)
735     AC_SUBST(MFMODE)
736     AC_SUBST(INIMETAFONT)
737     AC_SUBST(INIMETAPOST)
738     AC_SUBST(MFPLAIN_MP)
739     AC_SUBST(INIMETAPOST_FLAGS)
740 ])
741
742 AC_DEFUN(AC_STEPMAKE_WARN, [
743     AC_MSG_WARN($1)
744     warn_b=yes
745 ])
746
747 AC_DEFUN(AC_STEPMAKE_YODL, [
748     if test "x$YODL" = "x"; then 
749         AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
750         AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
751         AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
752         AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
753         AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
754         AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
755         AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
756         AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
757         YODL2LESS_DIR='$(bindir)/'
758     else
759         AC_SUBST(STRIPROFF)
760         AC_SUBST(YODL)
761         AC_SUBST(YODL2HTML)
762         AC_SUBST(YODL2LATEX)
763         AC_SUBST(YODL2LESS_DIR)
764         AC_SUBST(YODL2MAN)
765         AC_SUBST(YODL2MSLESS)
766         AC_SUBST(YODL2TEXINFO)
767         AC_SUBST(YODL2TXT)
768         export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
769     fi
770     if test "x$YODL" = "-echo no yodl"; then
771         AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
772     fi    
773 ])
774
775 dnl should cache result.
776 dnl should  look in $prefix first.
777 dnl should probably assume TDS
778
779 AC_DEFUN(AC_TEX_PREFIX, [
780     
781
782     AC_MSG_CHECKING(TeX/MF root dir directory)    
783
784     find_root_prefix="$prefix"
785     
786
787     test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
788     find_texpostfix="";
789     for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
790         find_texprefix="$find_root_prefix$postfix"
791         if test -d $find_texprefix; then
792             find_texpostfix=$postfix
793             break;
794         fi
795     done
796     
797     if test "x$find_texpostfix" = x; then
798         find_texpostfix='/lib/texmf/tex'
799         AC_STEPMAKE_WARN(Cannot determine the TeX-directory.  Please use --enable-tex-prefix)
800     fi
801
802     find_texprefix="$find_root_prefix/$find_texpostfix"
803
804     # only assign if variablename not empty
805     if test x != "x[$]$1"; then
806         $1='${prefix}'/"$find_texpostfix"
807     fi
808     AC_MSG_RESULT($find_texprefix)
809
810 ])
811  
812
813 # find a directory inside a prefix, 
814 # $1 the prefix (expanded version)
815 # $2 variable to assign
816 # $3 the directory name 
817 # $4 description
818 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
819     
820     AC_MSG_CHECKING($4 directory)    
821     find_dirdir=`(cd $1; 
822       $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
823     
824
825     if test "x$find_dirdir" = x; then
826        find_dirdir="/$3";
827        AC_STEPMAKE_WARN(Cannot determine $4 subdirectory.  Please set from command-line)
828         true
829     fi
830     $2=$find_dirdir
831     AC_MSG_RESULT($1/$find_dirdir)
832 ])
833
834 # ugh.  this is hopeless
835 AC_DEFUN(AC_KPSE_TEX_DIR, [
836         kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
837         kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
838         echo $kpse_paths
839         if test -w "$kpse_syspaths";
840         then
841                 dir=`echo $kpse_syspaths | head -1`
842         else
843                 dir=`echo $kpse_paths | grep -v '!'| head -1`
844         fi
845         if test "$prefix" = "NONE"; then
846                 local_prefix=$ac_default_prefix
847                 local_prefix_quote='${prefix}'
848
849         else
850                 local_prefix=$prefix
851                 local_prefix_quote=$prefix
852         fi
853         echo $local_prefix_quote = $local_prefix
854         echo $dir
855         echo $dir  | sed 's!'$local_prefix'!\$local_prefix_quote!g'
856 ])
857
858 AC_DEFUN(AC_TEX_SUBDIR, [
859 dnl    AC_REQUIRE([AC_TEX_PREFIX])
860     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
861     $1="$TEXPREFIX/$$1"
862 ])
863
864 AC_DEFUN(AC_MF_SUBDIR, [
865 dnl     AC_REQUIRE([AC_TEX_PREFIX])
866     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
867     $1="$TEXPREFIX/$$1"
868 ])
869
870 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
871         result="`echo \"$1\" | grep echo`"
872         if test "x$1" = "xerror" -o "x$result" != "x"; then
873                 AC_STEPMAKE_WARN(can\'t find $2. $3)
874         fi
875 ])
876
877 dnl   GUILE_FLAGS --- set flags for compiling and linking with Guile
878 dnl
879 dnl   This macro runs the `guile-config' script, installed with Guile,
880 dnl   to find out where Guile's header files and libraries are
881 dnl   installed.  It sets two variables, marked for substitution, as
882 dnl   by AC_SUBST.
883 dnl   
884 dnl     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
885 dnl             code that uses Guile header files.  This is almost
886 dnl             always just a -I flag.
887 dnl   
888 dnl     GUILE_LDFLAGS --- flags to pass to the linker to link a
889 dnl             program against Guile.  This includes `-lguile' for
890 dnl             the Guile library itself, any libraries that Guile
891 dnl             itself requires (like -lqthreads), and so on.  It may
892 dnl             also include a -L flag to tell the compiler where to
893 dnl             find the libraries.
894
895 AC_DEFUN([GUILE_FLAGS],[
896 ## The GUILE_FLAGS macro.
897   AC_MSG_CHECKING(for Guile)
898   if ! $guile_config link > /dev/null ; then
899       AC_MSG_RESULT("cannot execute $guile_config")
900       AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
901       exit 1
902   fi
903   GUILE_CFLAGS="`$guile_config compile`"
904   GUILE_LDFLAGS="`$guile_config link`"
905   AC_SUBST(GUILE_CFLAGS)
906   AC_SUBST(GUILE_LDFLAGS)
907   AC_MSG_RESULT(yes)
908 ])
909
910
911 # Configure paths for GTK+
912 # Owen Taylor     97-11-3
913
914 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
915 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
916 dnl
917 AC_DEFUN(AM_PATH_GTK,
918 [dnl 
919 dnl Get the cflags and libraries from the gtk-config script
920 dnl
921   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
922   min_gtk_version=ifelse([$1], ,1.1.1,$1)
923   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
924   no_gtk=""
925   if test "$GTK_CONFIG" != "no" ; then
926     GTK_CFLAGS=`$GTK_CONFIG --cflags`
927     GTK_LIBS=`$GTK_CONFIG --libs`
928     ac_save_CFLAGS="$CFLAGS"
929     ac_save_LIBS="$LIBS"
930     ac_save_CXXFLAGS="$CXXFLAGS"
931     CFLAGS="$CFLAGS $GTK_CFLAGS"
932     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
933     LIBS="$LIBS $GTK_LIBS"
934 dnl
935 dnl Now check if the installed GTK is sufficiently new. (Also sanity
936 dnl checks the results of gtk-config to some extent)
937 dnl
938     AC_TRY_RUN([
939 #include <gtk/gtk.h>
940 #include <stdio.h>
941
942 int 
943 main ()
944 {
945   int major, minor, micro;
946
947   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
948      printf("%s, bad version string\n", "$min_gtk_version");
949      exit(1);
950    }
951
952    return !((gtk_major_version > major) ||
953             ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
954             ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
955 }
956 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
957      CFLAGS="$ac_save_CFLAGS"
958      CXXFLAGS="$ac_save_CXXFLAGS"
959      LIBS="$ac_save_LIBS"
960   else
961      no_gtk=yes
962   fi
963   if test "x$no_gtk" = x ; then
964      AC_MSG_RESULT(yes)
965      ifelse([$2], , :, [$2])     
966   else
967      AC_MSG_RESULT(no)
968      GTK_CFLAGS=""
969      GTK_LIBS=""
970      ifelse([$3], , :, [$3])
971   fi
972   CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
973   AC_SUBST(CXXFLAGS)
974   AC_SUBST(GTK_CFLAGS)
975   AC_SUBST(GTK_LIBS)
976 ])
977
978
979 # Configure paths for GTK--
980 # Erik Andersen 30 May 1998
981 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
982
983 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
984 dnl   to be used as follows:
985 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
986 dnl
987
988 dnl Get the cflags and libraries from the gtkmm-config script
989 dnl
990 AC_ARG_WITH(gtkmm-prefix,[  --with-gtkmm-prefix=PREFIX
991                           Prefix where GTK-- is installed (optional)],
992             gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
993 AC_ARG_WITH(gtkmm-exec-prefix,[  --with-gtkmm-exec-prefix=PREFIX
994                           Exec prefix where GTK-- is installed (optional)],
995             gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
996 AC_ARG_ENABLE(gtkmmtest, [  --disable-gtkmmtest     Do not try to compile and run a test GTK-- program],
997                     , enable_gtkmmtest=yes)
998
999   if test x$gtkmm_config_exec_prefix != x ; then
1000      gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
1001      if test x${GTKMM_CONFIG+set} != xset ; then
1002         GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
1003      fi
1004   fi
1005   if test x$gtkmm_config_prefix != x ; then
1006      gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
1007      if test x${GTKMM_CONFIG+set} != xset ; then
1008         GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
1009      fi
1010   fi
1011
1012
1013 AC_DEFUN(AM_PATH_GTKMM,
1014 [dnl 
1015
1016 dnl
1017 dnl Check if the installed GTK-- is sufficiently new.
1018 dnl
1019   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1020   min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
1021
1022   AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
1023   no_gtkmm=""
1024   if test "$GTKMM_CONFIG" = "no" ; then
1025     no_gtkmm=yes
1026   else
1027     AC_LANG_SAVE
1028     AC_LANG_CPLUSPLUS
1029
1030     GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
1031     GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
1032     gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1033            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1034     gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1035            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1036     gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1037            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1038     if test "x$enable_gtkmmtest" = "xyes" ; then
1039       ac_save_CXXFLAGS="$CXXFLAGS"
1040       ac_save_LIBS="$LIBS"
1041       CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1042       LIBS="$LIBS $GTK___LIBS"
1043 dnl
1044 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
1045 dnl checks the results of gtkmm-config to some extent
1046 dnl
1047       rm -f conf.gtkmmtest
1048       AC_TRY_RUN([
1049 #include <gtk--.h>
1050 #include <stdio.h>
1051 #include <stdlib.h>
1052
1053 int 
1054 main ()
1055 {
1056   int major, minor, micro;
1057   char *tmp_version;
1058
1059   system ("touch conf.gtkmmtest");
1060
1061   /* HP/UX 0 (%@#!) writes to sscanf strings */
1062   tmp_version = g_strdup("$min_gtkmm_version");
1063   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1064      printf("%s, bad version string\n", "$min_gtkmm_version");
1065      exit(1);
1066    }
1067
1068   if ((gtkmm_major_version != $gtkmm_config_major_version) ||
1069       (gtkmm_minor_version != $gtkmm_config_minor_version) ||
1070       (gtkmm_micro_version != $gtkmm_config_micro_version))
1071     {
1072       printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", 
1073              $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
1074              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1075       printf ("*** was found! If gtkmm-config was correct, then it is best\n");
1076       printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
1077       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1078       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1079       printf("*** required on your system.\n");
1080       printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
1081       printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
1082       printf("*** before re-running configure\n");
1083     } 
1084 /* GTK-- does not have the GTKMM_*_VERSION constants */
1085 /* 
1086   else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
1087            (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
1088            (gtkmm_micro_version != GTKMM_MICRO_VERSION))
1089     {
1090       printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
1091              GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
1092       printf("*** library (version %d.%d.%d)\n",
1093              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1094     }
1095 */
1096   else
1097     {
1098       if ((gtkmm_major_version > major) ||
1099         ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
1100         ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
1101       {
1102         return 0;
1103        }
1104      else
1105       {
1106         printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
1107                gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1108         printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
1109                major, minor, micro);
1110         printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
1111         printf("***\n");
1112         printf("*** If you have already installed a sufficiently new version, this error\n");
1113         printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
1114         printf("*** being found. The easiest way to fix this is to remove the old version\n");
1115         printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
1116         printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
1117         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1118         printf("*** so that the correct libraries are found at run-time))\n");
1119       }
1120     }
1121   return 1;
1122 }
1123 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1124        CXXFLAGS="$ac_save_CXXFLAGS"
1125        LIBS="$ac_save_LIBS"
1126      fi
1127   fi
1128   if test "x$no_gtkmm" = x ; then
1129      AC_MSG_RESULT(yes)
1130      ifelse([$2], , :, [$2])     
1131   else
1132      AC_MSG_RESULT(no)
1133      if test "$GTKMM_CONFIG" = "no" ; then
1134        echo "*** The gtkmm-config script installed by GTK-- could not be found"
1135        echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
1136        echo "*** your path, or set the GTK_CONFIG environment variable to the"
1137        echo "*** full path to gtk-config."
1138        echo "*** The gtkmm-config script was not available in GTK-- versions"
1139        echo "*** prior to 0.9.12. Perhaps you need to update your installed"
1140        echo "*** version to 0.9.12 or newer"
1141      else
1142        if test -f conf.gtkmmtest ; then
1143         :
1144        else
1145           echo "*** Could not run GTK-- test program, checking why..."
1146           CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
1147           LIBS="$LIBS $GTK___LIBS"
1148           AC_TRY_LINK([
1149 #include <gtk--.h>
1150 #include <stdio.h>
1151 ],      [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
1152         [ echo "*** The test program compiled, but did not run. This usually means"
1153           echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
1154           echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
1155           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1156           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1157           echo "*** is required on your system"
1158           echo "***"
1159           echo "*** If you have an old version installed, it is best to remove it, although"
1160           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1161         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1162           echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
1163           echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
1164           echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
1165           CXXFLAGS="$ac_save_CXXFLAGS"
1166           LIBS="$ac_save_LIBS"
1167        fi
1168      fi
1169      GTK___CFLAGS=""
1170      GTK__LIBS=""
1171      ifelse([$3], , :, [$3])
1172      AC_LANG_RESTORE
1173   fi
1174   AC_SUBST(GTK___CFLAGS)
1175   AC_SUBST(GTK___LIBS)
1176   rm -f conf.gtkmmtest
1177 ])
1178
1179 # Configure paths for GTK--DRAW
1180 # Derek Quinn Wyatt   98-08-21  (adapted from Jan Nieuwenhuizen's code)
1181
1182 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1183 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
1184 dnl
1185 AC_DEFUN(AM_PATH_GTK__DRAW,
1186 [dnl 
1187 dnl Get the cflags and libraries from the gtk__-config script
1188 dnl
1189   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1190   min_gtk___version=ifelse([$1], ,0.0.5,$1)
1191   AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
1192   no_gtk__=""
1193   if test "$GTKMM_CONFIG" != "no" ; then
1194     GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
1195     GTK___LIBS=`$GTKMM_CONFIG --libs`
1196     GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
1197     GTK___LIBS="$GTK___DLIBS"
1198     ac_save_CFLAGS="$CFLAGS"
1199     ac_save_LIBS="$LIBS"
1200     ac_save_CXXFLAGS="$CXXFLAGS"
1201     CFLAGS="$CFLAGS $GTK___CFLAGS"
1202     CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1203     LIBS="$LIBS $GTK___LIBS"
1204 dnl
1205 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
1206 dnl checks the results of gtk__-config to some extent)
1207 dnl
1208     AC_TRY_RUN([
1209 #include <gtk--.h>
1210 #include <stdio.h>
1211
1212 int 
1213 main ()
1214 {
1215   // urg
1216   return 0;
1217 }
1218 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1219      CFLAGS="$ac_save_CFLAGS"
1220      CXXFLAGS="$ac_save_CXXFLAGS"
1221      LIBS="$ac_save_LIBS"
1222   else
1223      no_gtk__=yes
1224   fi
1225   if test "x$no_gtk__" = x ; then
1226      AC_MSG_RESULT(yes)
1227      ifelse([$2], , :, [$2])     
1228   else
1229      AC_MSG_RESULT(no)
1230      GTK___CFLAGS=""
1231      GTK___LIBS=""
1232      ifelse([$3], , :, [$3])
1233   fi
1234   CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1235   AC_SUBST(CXXFLAGS)
1236   AC_SUBST(GTK___CFLAGS)
1237   AC_SUBST(GTK___LIBS)
1238 ])