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