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