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