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