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