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