]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
patch::: 1.5.12.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     #FIXME --with-xxx is meant for specifying a PATH too,
439     # so this should read: --enable-kpathsea,
440     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
441     AC_ARG_WITH(kpathsea,
442     [  --with-kpathsea         use kpathsea lib.  Default: on],
443     [kpathsea_b=$with_kpathsea])
444
445     if test "$kpathsea_b" != "no"; then 
446         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
447         AC_CHECK_LIB(kpathsea, kpse_find_file)
448         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.))
449     fi
450     AC_MSG_CHECKING(whether to use kpathsea)
451     if test "$kpathsea_b" != no; then
452         AC_MSG_RESULT(yes)
453         KPATHSEA=1
454     else
455         AC_MSG_RESULT(no)
456         KPATHSEA=0
457     fi
458
459     AC_SUBST(KPATHSEA)
460     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
461 ])
462
463 AC_DEFUN(AC_STEPMAKE_LEXYACC, [
464     # ugh, automake: we want (and check for) bison
465     AC_PROG_YACC
466     # ugh, automake: we want (and check for) flex
467     # AC_PROG_LEX
468     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
469
470     # AC_DECL_YYTEXT
471     # ugh, ugh
472     ac_cv_prog_lex_root=lex.yy
473
474     AC_CHECK_PROGS(BISON, bison, error)
475     AC_CHECK_PROGS(FLEX, flex, error)
476     AC_CHECK_SEARCH_RESULT($BISON, bison,  Please install Bison, 1.25 or newer)
477     AC_CHECK_SEARCH_RESULT($FLEX,  flex, Please install Flex, 2.5 or newer)
478
479     if test $BISON != "error"; then
480         bison_version=`$BISON --version | sed 's/^.*version 1.//g'`
481         if test `echo $bison_version | sed 's/\..*$//g'` -lt 25; then
482             AC_STEPMAKE_WARN(Your bison is a bit old (1.$bison_version). You might have to install 1.25)
483         fi      
484     fi
485
486     AC_SUBST(BISON)
487     AC_SUBST(FLEX)
488 ])
489
490 AC_DEFUN(AC_STEPMAKE_LIB, [
491     AC_CHECK_PROGS(AR, ar, error)
492     AC_PROG_RANLIB
493
494     AC_SUBST(AR)
495     AC_SUBST(RANLIB)
496 ])
497
498 AC_DEFUN(AC_STEPMAKE_LIBTOOL, [
499     # libtool.info ...
500     # **Never** try to set library version numbers so that they correspond
501     # to the release number of your package.  This is an abuse that only
502     # fosters misunderstanding of the purpose of library versions.
503
504     REVISION=$PATCH_LEVEL
505     # CURRENT=$MINOR_VERSION
506     CURRENT=`expr $MINOR_VERSION + 1`
507     # AGE=$(expr $MAJOR_VERSION + 1)
508     AGE=$MAJOR_VERSION
509     AC_SUBST(CURRENT)
510     AC_SUBST(REVISION)
511     AC_SUBST(AGE)
512 ])
513
514 AC_DEFUN(AC_STEPMAKE_LOCALE, [
515     lang=English
516     ALL_LINGUAS="en nl"
517
518     # with/enable ??
519     AC_ARG_WITH(localedir,
520     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
521                             PREFIX/share/locale ],
522     localedir=$with_localedir,
523     localedir='${prefix}/share/locale')
524
525     AC_ARG_WITH(lang,
526     [  --with-lang=LANG        use LANG as language to emit messages],
527     language=$with_lang,
528     language=English)
529
530     AC_MSG_CHECKING(language)    
531     case "$language" in
532       En* | en* | Am* | am* | US* | us*)
533             lang=English;;
534       NL | nl | Du* | du* | Ned* | ned*)
535             lang=Dutch;;
536       "")
537             lang=English;;
538       *)
539             lang=unknown;;
540     esac
541     AC_MSG_RESULT($lang)
542
543     if test "$lang" = "unknown" ; then
544         AC_STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
545     fi
546
547 ])
548
549 AC_DEFUN(AC_STEPMAKE_GETTEXT, [
550     DIR_LOCALEDIR=${localedir}
551     presome=${prefix}
552     if test "$prefix" = "NONE"; then
553             presome=${ac_default_prefix}
554     fi
555     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
556     AC_SUBST(localedir)
557     AC_SUBST(DIR_LOCALEDIR)
558     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
559
560     AC_CHECK_LIB(intl, gettext)
561     AC_CHECK_FUNCS(gettext)
562 ])
563
564 AC_DEFUN(AC_STEPMAKE_MAKEINFO, [
565     AC_CHECK_PROGS(MAKEINFO, makeinfo, error)
566     if test "$MAKEINFO" != "error"; then
567         AC_MSG_CHECKING(whether makeinfo can split html by @node)
568         mkdir -p out
569         makeinfo --html --output=out/split <<EOF
570 \input texinfo
571 \input texinfo @c -*-texinfo-*-
572 @setfilename split.info
573 @settitle split.info
574 @bye
575 EOF
576         if test -d out/split; then
577             SPLITTING_MAKEINFO=yes
578             AC_MSG_RESULT(yes)
579             rm -rf out/split
580         else
581             AC_MSG_RESULT(no)
582             AC_STEPMAKE_WARN(your html documentation will be one large file)
583             rm -rf out/split
584         fi
585     fi
586     AC_SUBST(SPLITTING_MAKEINFO)
587 ])
588
589
590 AC_DEFUN(AC_STEPMAKE_MAN, [
591     AC_CHECK_PROGS(GROFF, groff ditroff, -echo no groff)
592     AC_CHECK_PROGS(TROFF, troff, -echo no troff)
593     AC_CHECK_PROGS(TBL, tbl, cat)
594 ])
595
596 AC_DEFUN(AC_STEPMAKE_MSGFMT, [
597     # AC_CHECK_PROGS(MSGFMT, msgfmt, -echo no msgfmt)
598     AC_CHECK_PROGS(MSGFMT, msgfmt, \$(SHELL) \$(step-bindir)/fake-msgfmt.sh )
599     AC_MSG_CHECKING(whether msgfmt accepts -o)
600     msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
601     if test "$msgfmt_output" = ""; then
602         AC_MSG_RESULT(yes)
603     else
604         # urg
605         MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh"
606         AC_MSG_RESULT(no)
607         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
608     fi
609     if test ! -n "$MSGFMT"; then
610         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
611     fi
612 ])
613
614 #why has this been dropped?
615 AC_DEFUN(XXAC_STEPMAKE_TEXMF_DIRS, [
616     AC_ARG_ENABLE(tex-prefix,
617     [  --enable-tex-prefix=DIR   set the tex-directory to find TeX
618                                subdirectories.  Default: PREFIX],
619     [TEXPREFIX=$enableval],
620     [TEXPREFIX=auto] )
621     
622     AC_ARG_ENABLE(tex-dir,
623     [  --enable-tex-dir=DIR      set the directory to put $PACKAGE_NAME TeX files in. ],
624     [TEXDIR=$enableval],
625     [TEXDIR=auto] )
626
627     AC_ARG_ENABLE(mf-dir,
628     [  --enable-mf-dir=DIR       set the directory to put $PACKAGE_NAME MetaFont files in. ],
629     [MFDIR=$enableval],
630     [MFDIR=auto])
631
632     if test "x$TEXPREFIX" = xauto ; then
633         AC_TEX_PREFIX(TEXPREFIX)
634     else
635      find_texprefix=$TEXPREFIX
636     fi
637
638     if test "x$MFDIR" = xauto; then
639         AC_MF_SUBDIR(MFDIR)
640     fi
641         
642     if test "x$TEXDIR" = xauto ; then
643         AC_TEX_SUBDIR(TEXDIR)
644     fi
645     AC_SUBST(TEXPREFIX)
646     AC_SUBST(TEXDIR)
647     AC_SUBST(MFDIR)
648 ])
649
650 AC_DEFUN(AC_STEPMAKE_TEXMF_DIRS, [
651     AC_ARG_ENABLE(tfm-path,
652     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
653                             esp.: cmr10.tfm.  Default: use kpsewhich],
654     [tfm_path=$enableval],
655     [tfm_path=auto] )
656
657     AC_CHECK_PROGS(KPSEWHICH, kpsewhich, no)
658     AC_MSG_CHECKING(for tfm path)
659
660     TFM_FONTS="cmr msam"
661
662     if test "x$tfm_path" = xauto ; then
663         if test "x$KPSEWHICH" != "xno" ; then
664             for i in $TFM_FONTS; do
665                 dir=`$KPSEWHICH tfm ${i}10.tfm`
666                 TFM_PATH="$TFM_PATH `dirname $dir`"
667             done
668         else
669             AC_STEPMAKE_WARN(Please specify where cmr10.tfm lives:
670     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
671         fi
672     else
673          TFM_PATH=$tfm_path
674     fi
675
676     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
677     AC_MSG_RESULT($TFM_PATH)
678     AC_SUBST(TFM_PATH)
679 ])
680
681 AC_DEFUN(AC_STEPMAKE_TEXMF, [
682     # urg, never know what names these teTeX guys will think up
683
684     AC_CHECK_PROGS(METAFONT, mf, no)
685     if test "x$METAFONT" = "xno"; then
686         AC_CHECK_PROGS(MFONT, mfont, -echo no mf or mfont)
687         METAFONT=$MFONT
688     fi
689
690     AC_CHECK_PROGS(METAPOST, mp, no)
691     if test "x$METAPOST" = "xno"; then
692         AC_CHECK_PROGS(MPOST, mpost, -echo no mp or mpost)
693
694         METAPOST=$MPOST
695     fi
696
697     AC_CHECK_PROGS(INIMETAFONT, inimf, no)
698     if test "x$INIMETAFONT" = "xno"; then
699         AC_CHECK_PROGS(INIMFONT, inimfont, -echo no inimf or inimfont)
700         INIMETAFONT=$INIMFONT
701     fi
702
703     AC_CHECK_PROGS(INIMETAPOST, inimp, no)
704     if test "x$INIMETAPOST" = "xno"; then
705         AC_CHECK_PROGS(INIMPOST, inimpost, -echo no inimp or inimpost)
706         INIMETAPOST=$INIMPOST
707     fi
708
709     AC_MSG_CHECKING(for working metafont mode)
710     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
711     for MFMODE in $modelist; do
712         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
713         if test -f mfput.tfm; then
714             break;
715         fi
716     done
717     AC_MSG_RESULT($MFMODE)
718
719     AC_MSG_CHECKING(for mfplain.mp)
720     #
721     # For now let people define these in their environments
722     #
723     : ${MFPLAIN_MP=`kpsewhich --format mp mfplain.mp`}
724     AC_MSG_RESULT($MFPLAIN_MP)
725
726     AC_MSG_CHECKING(for inimetapost flags)
727     if test  ${INIMETAPOST} = "inimp" ; then
728        : ${INIMETAPOST_FLAGS=''}
729     else
730        : ${INIMETAPOST_FLAGS='-interaction=nonstopmode'}
731     fi
732     AC_MSG_RESULT($INIMETAPOST_FLAGS)
733
734     rm -f mfput.*
735
736     AC_SUBST(METAFONT)
737     AC_SUBST(METAPOST)
738     AC_SUBST(MFMODE)
739     AC_SUBST(INIMETAFONT)
740     AC_SUBST(INIMETAPOST)
741     AC_SUBST(MFPLAIN_MP)
742     AC_SUBST(INIMETAPOST_FLAGS)
743 ])
744
745 AC_DEFUN(AC_STEPMAKE_WARN, [
746     AC_MSG_WARN($1)
747     warn_b=yes
748 ])
749
750 AC_DEFUN(AC_STEPMAKE_YODL, [
751     if test "x$YODL" = "x"; then 
752         AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
753         AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
754         AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
755         AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
756         AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
757         AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
758         AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
759         AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
760         YODL2LESS_DIR='$(bindir)/'
761     else
762         AC_SUBST(STRIPROFF)
763         AC_SUBST(YODL)
764         AC_SUBST(YODL2HTML)
765         AC_SUBST(YODL2LATEX)
766         AC_SUBST(YODL2LESS_DIR)
767         AC_SUBST(YODL2MAN)
768         AC_SUBST(YODL2MSLESS)
769         AC_SUBST(YODL2TEXINFO)
770         AC_SUBST(YODL2TXT)
771         export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
772     fi
773     if test "x$YODL" = "-echo no yodl"; then
774         AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
775     fi    
776 ])
777
778 dnl should cache result.
779 dnl should  look in $prefix first.
780 dnl should probably assume TDS
781
782 AC_DEFUN(AC_TEX_PREFIX, [
783     
784
785     AC_MSG_CHECKING(TeX/MF root dir directory)    
786
787     find_root_prefix="$prefix"
788     
789
790     test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
791     find_texpostfix="";
792     for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
793         find_texprefix="$find_root_prefix$postfix"
794         if test -d $find_texprefix; then
795             find_texpostfix=$postfix
796             break;
797         fi
798     done
799     
800     if test "x$find_texpostfix" = x; then
801         find_texpostfix='/lib/texmf/tex'
802         AC_STEPMAKE_WARN(Cannot determine the TeX-directory.  Please use --enable-tex-prefix)
803     fi
804
805     find_texprefix="$find_root_prefix/$find_texpostfix"
806
807     # only assign if variablename not empty
808     if test x != "x[$]$1"; then
809         $1='${prefix}'/"$find_texpostfix"
810     fi
811     AC_MSG_RESULT($find_texprefix)
812
813 ])
814  
815
816 # find a directory inside a prefix, 
817 # $1 the prefix (expanded version)
818 # $2 variable to assign
819 # $3 the directory name 
820 # $4 description
821 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
822     
823     AC_MSG_CHECKING($4 directory)    
824     find_dirdir=`(cd $1; 
825       $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
826     
827
828     if test "x$find_dirdir" = x; then
829        find_dirdir="/$3";
830        AC_STEPMAKE_WARN(Cannot determine $4 subdirectory.  Please set from command-line)
831         true
832     fi
833     $2=$find_dirdir
834     AC_MSG_RESULT($1/$find_dirdir)
835 ])
836
837 # ugh.  this is hopeless
838 AC_DEFUN(AC_KPSE_TEX_DIR, [
839         kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
840         kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
841         echo $kpse_paths
842         if test -w "$kpse_syspaths";
843         then
844                 dir=`echo $kpse_syspaths | head -1`
845         else
846                 dir=`echo $kpse_paths | grep -v '!'| head -1`
847         fi
848         if test "$prefix" = "NONE"; then
849                 local_prefix=$ac_default_prefix
850                 local_prefix_quote='${prefix}'
851
852         else
853                 local_prefix=$prefix
854                 local_prefix_quote=$prefix
855         fi
856         echo $local_prefix_quote = $local_prefix
857         echo $dir
858         echo $dir  | sed 's!'$local_prefix'!\$local_prefix_quote!g'
859 ])
860
861 AC_DEFUN(AC_TEX_SUBDIR, [
862 dnl    AC_REQUIRE([AC_TEX_PREFIX])
863     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
864     $1="$TEXPREFIX/$$1"
865 ])
866
867 AC_DEFUN(AC_MF_SUBDIR, [
868 dnl     AC_REQUIRE([AC_TEX_PREFIX])
869     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
870     $1="$TEXPREFIX/$$1"
871 ])
872
873 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
874         result="`echo \"$1\" | grep echo`"
875         if test "x$1" = "xerror" -o "x$result" != "x"; then
876                 AC_STEPMAKE_WARN(can\'t find $2. $3)
877         fi
878 ])
879
880 dnl   GUILE_FLAGS --- set flags for compiling and linking with Guile
881 dnl
882 dnl   This macro runs the `guile-config' script, installed with Guile,
883 dnl   to find out where Guile's header files and libraries are
884 dnl   installed.  It sets two variables, marked for substitution, as
885 dnl   by AC_SUBST.
886 dnl   
887 dnl     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
888 dnl             code that uses Guile header files.  This is almost
889 dnl             always just a -I flag.
890 dnl   
891 dnl     GUILE_LDFLAGS --- flags to pass to the linker to link a
892 dnl             program against Guile.  This includes `-lguile' for
893 dnl             the Guile library itself, any libraries that Guile
894 dnl             itself requires (like -lqthreads), and so on.  It may
895 dnl             also include a -L flag to tell the compiler where to
896 dnl             find the libraries.
897
898 AC_DEFUN([GUILE_FLAGS],[
899 ## The GUILE_FLAGS macro.
900   AC_MSG_CHECKING(for Guile)
901   if ! $guile_config link > /dev/null ; then
902       AC_MSG_RESULT("cannot execute $guile_config")
903       AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
904       exit 1
905   fi
906   GUILE_CFLAGS="`$guile_config compile`"
907   GUILE_LDFLAGS="`$guile_config link`"
908   AC_SUBST(GUILE_CFLAGS)
909   AC_SUBST(GUILE_LDFLAGS)
910   AC_MSG_RESULT(yes)
911 ])
912
913
914 # Configure paths for GTK+
915 # Owen Taylor     97-11-3
916
917 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
918 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
919 dnl
920 AC_DEFUN(AM_PATH_GTK,
921 [dnl 
922 dnl Get the cflags and libraries from the gtk-config script
923 dnl
924   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
925   min_gtk_version=ifelse([$1], ,1.1.1,$1)
926   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
927   no_gtk=""
928   if test "$GTK_CONFIG" != "no" ; then
929     GTK_CFLAGS=`$GTK_CONFIG --cflags`
930     GTK_LIBS=`$GTK_CONFIG --libs`
931     ac_save_CFLAGS="$CFLAGS"
932     ac_save_LIBS="$LIBS"
933     ac_save_CXXFLAGS="$CXXFLAGS"
934     CFLAGS="$CFLAGS $GTK_CFLAGS"
935     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
936     LIBS="$LIBS $GTK_LIBS"
937 dnl
938 dnl Now check if the installed GTK is sufficiently new. (Also sanity
939 dnl checks the results of gtk-config to some extent)
940 dnl
941     AC_TRY_RUN([
942 #include <gtk/gtk.h>
943 #include <stdio.h>
944
945 int 
946 main ()
947 {
948   int major, minor, micro;
949
950   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
951      printf("%s, bad version string\n", "$min_gtk_version");
952      exit(1);
953    }
954
955    return !((gtk_major_version > major) ||
956             ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
957             ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
958 }
959 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
960      CFLAGS="$ac_save_CFLAGS"
961      CXXFLAGS="$ac_save_CXXFLAGS"
962      LIBS="$ac_save_LIBS"
963   else
964      no_gtk=yes
965   fi
966   if test "x$no_gtk" = x ; then
967      AC_MSG_RESULT(yes)
968      ifelse([$2], , :, [$2])     
969   else
970      AC_MSG_RESULT(no)
971      GTK_CFLAGS=""
972      GTK_LIBS=""
973      ifelse([$3], , :, [$3])
974   fi
975   CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
976   AC_SUBST(CXXFLAGS)
977   AC_SUBST(GTK_CFLAGS)
978   AC_SUBST(GTK_LIBS)
979 ])
980
981
982 # Configure paths for GTK--
983 # Erik Andersen 30 May 1998
984 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
985
986 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
987 dnl   to be used as follows:
988 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
989 dnl
990
991 dnl Get the cflags and libraries from the gtkmm-config script
992 dnl
993 AC_ARG_WITH(gtkmm-prefix,[  --with-gtkmm-prefix=PREFIX
994                           Prefix where GTK-- is installed (optional)],
995             gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
996 AC_ARG_WITH(gtkmm-exec-prefix,[  --with-gtkmm-exec-prefix=PREFIX
997                           Exec prefix where GTK-- is installed (optional)],
998             gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
999 AC_ARG_ENABLE(gtkmmtest, [  --disable-gtkmmtest     Do not try to compile and run a test GTK-- program],
1000                     , enable_gtkmmtest=yes)
1001
1002   if test x$gtkmm_config_exec_prefix != x ; then
1003      gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
1004      if test x${GTKMM_CONFIG+set} != xset ; then
1005         GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
1006      fi
1007   fi
1008   if test x$gtkmm_config_prefix != x ; then
1009      gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
1010      if test x${GTKMM_CONFIG+set} != xset ; then
1011         GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
1012      fi
1013   fi
1014
1015
1016 AC_DEFUN(AM_PATH_GTKMM,
1017 [dnl 
1018
1019 dnl
1020 dnl Check if the installed GTK-- is sufficiently new.
1021 dnl
1022   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1023   min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
1024
1025   AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
1026   no_gtkmm=""
1027   if test "$GTKMM_CONFIG" = "no" ; then
1028     no_gtkmm=yes
1029   else
1030     AC_LANG_SAVE
1031     AC_LANG_CPLUSPLUS
1032
1033     GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
1034     GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
1035     gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1036            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1037     gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1038            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1039     gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1040            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1041     if test "x$enable_gtkmmtest" = "xyes" ; then
1042       ac_save_CXXFLAGS="$CXXFLAGS"
1043       ac_save_LIBS="$LIBS"
1044       CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1045       LIBS="$LIBS $GTK___LIBS"
1046 dnl
1047 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
1048 dnl checks the results of gtkmm-config to some extent
1049 dnl
1050       rm -f conf.gtkmmtest
1051       AC_TRY_RUN([
1052 #include <gtk--.h>
1053 #include <stdio.h>
1054 #include <stdlib.h>
1055
1056 int 
1057 main ()
1058 {
1059   int major, minor, micro;
1060   char *tmp_version;
1061
1062   system ("touch conf.gtkmmtest");
1063
1064   /* HP/UX 0 (%@#!) writes to sscanf strings */
1065   tmp_version = g_strdup("$min_gtkmm_version");
1066   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1067      printf("%s, bad version string\n", "$min_gtkmm_version");
1068      exit(1);
1069    }
1070
1071   if ((gtkmm_major_version != $gtkmm_config_major_version) ||
1072       (gtkmm_minor_version != $gtkmm_config_minor_version) ||
1073       (gtkmm_micro_version != $gtkmm_config_micro_version))
1074     {
1075       printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", 
1076              $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
1077              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1078       printf ("*** was found! If gtkmm-config was correct, then it is best\n");
1079       printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
1080       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1081       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1082       printf("*** required on your system.\n");
1083       printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
1084       printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
1085       printf("*** before re-running configure\n");
1086     } 
1087 /* GTK-- does not have the GTKMM_*_VERSION constants */
1088 /* 
1089   else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
1090            (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
1091            (gtkmm_micro_version != GTKMM_MICRO_VERSION))
1092     {
1093       printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
1094              GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
1095       printf("*** library (version %d.%d.%d)\n",
1096              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1097     }
1098 */
1099   else
1100     {
1101       if ((gtkmm_major_version > major) ||
1102         ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
1103         ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
1104       {
1105         return 0;
1106        }
1107      else
1108       {
1109         printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
1110                gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1111         printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
1112                major, minor, micro);
1113         printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
1114         printf("***\n");
1115         printf("*** If you have already installed a sufficiently new version, this error\n");
1116         printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
1117         printf("*** being found. The easiest way to fix this is to remove the old version\n");
1118         printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
1119         printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
1120         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1121         printf("*** so that the correct libraries are found at run-time))\n");
1122       }
1123     }
1124   return 1;
1125 }
1126 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1127        CXXFLAGS="$ac_save_CXXFLAGS"
1128        LIBS="$ac_save_LIBS"
1129      fi
1130   fi
1131   if test "x$no_gtkmm" = x ; then
1132      AC_MSG_RESULT(yes)
1133      ifelse([$2], , :, [$2])     
1134   else
1135      AC_MSG_RESULT(no)
1136      if test "$GTKMM_CONFIG" = "no" ; then
1137        echo "*** The gtkmm-config script installed by GTK-- could not be found"
1138        echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
1139        echo "*** your path, or set the GTK_CONFIG environment variable to the"
1140        echo "*** full path to gtk-config."
1141        echo "*** The gtkmm-config script was not available in GTK-- versions"
1142        echo "*** prior to 0.9.12. Perhaps you need to update your installed"
1143        echo "*** version to 0.9.12 or newer"
1144      else
1145        if test -f conf.gtkmmtest ; then
1146         :
1147        else
1148           echo "*** Could not run GTK-- test program, checking why..."
1149           CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
1150           LIBS="$LIBS $GTK___LIBS"
1151           AC_TRY_LINK([
1152 #include <gtk--.h>
1153 #include <stdio.h>
1154 ],      [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
1155         [ echo "*** The test program compiled, but did not run. This usually means"
1156           echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
1157           echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
1158           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1159           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1160           echo "*** is required on your system"
1161           echo "***"
1162           echo "*** If you have an old version installed, it is best to remove it, although"
1163           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1164         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1165           echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
1166           echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
1167           echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
1168           CXXFLAGS="$ac_save_CXXFLAGS"
1169           LIBS="$ac_save_LIBS"
1170        fi
1171      fi
1172      GTK___CFLAGS=""
1173      GTK__LIBS=""
1174      ifelse([$3], , :, [$3])
1175      AC_LANG_RESTORE
1176   fi
1177   AC_SUBST(GTK___CFLAGS)
1178   AC_SUBST(GTK___LIBS)
1179   rm -f conf.gtkmmtest
1180 ])
1181
1182 # Configure paths for GTK--DRAW
1183 # Derek Quinn Wyatt   98-08-21  (adapted from Jan Nieuwenhuizen's code)
1184
1185 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1186 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
1187 dnl
1188 AC_DEFUN(AM_PATH_GTK__DRAW,
1189 [dnl 
1190 dnl Get the cflags and libraries from the gtk__-config script
1191 dnl
1192   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1193   min_gtk___version=ifelse([$1], ,0.0.5,$1)
1194   AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
1195   no_gtk__=""
1196   if test "$GTKMM_CONFIG" != "no" ; then
1197     GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
1198     GTK___LIBS=`$GTKMM_CONFIG --libs`
1199     GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
1200     GTK___LIBS="$GTK___DLIBS"
1201     ac_save_CFLAGS="$CFLAGS"
1202     ac_save_LIBS="$LIBS"
1203     ac_save_CXXFLAGS="$CXXFLAGS"
1204     CFLAGS="$CFLAGS $GTK___CFLAGS"
1205     CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1206     LIBS="$LIBS $GTK___LIBS"
1207 dnl
1208 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
1209 dnl checks the results of gtk__-config to some extent)
1210 dnl
1211     AC_TRY_RUN([
1212 #include <gtk--.h>
1213 #include <stdio.h>
1214
1215 int 
1216 main ()
1217 {
1218   // urg
1219   return 0;
1220 }
1221 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1222      CFLAGS="$ac_save_CFLAGS"
1223      CXXFLAGS="$ac_save_CXXFLAGS"
1224      LIBS="$ac_save_LIBS"
1225   else
1226      no_gtk__=yes
1227   fi
1228   if test "x$no_gtk__" = x ; then
1229      AC_MSG_RESULT(yes)
1230      ifelse([$2], , :, [$2])     
1231   else
1232      AC_MSG_RESULT(no)
1233      GTK___CFLAGS=""
1234      GTK___LIBS=""
1235      ifelse([$3], , :, [$3])
1236   fi
1237   CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1238   AC_SUBST(CXXFLAGS)
1239   AC_SUBST(GTK___CFLAGS)
1240   AC_SUBST(GTK___LIBS)
1241 ])