]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
patch::: 1.5.30.uu1
[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
486 ## Urg. We should fix this configure test. -- so clumsy
487     if test $BISON != "error"; then
488         bison_version=`$BISON --version | head -1 | sed 's/^.* 1\.//g'`
489         if test $bison_version -lt 25; then
490             AC_STEPMAKE_WARN(The bison installed might be too old (1.$bison_version). You might have to install 1.25)
491         fi      
492     fi
493
494     AC_SUBST(BISON)
495     AC_SUBST(FLEX)
496 ])
497
498 AC_DEFUN(AC_STEPMAKE_LIB, [
499     AC_CHECK_PROGS(AR, ar, error)
500     AC_PROG_RANLIB
501
502     AC_SUBST(AR)
503     AC_SUBST(RANLIB)
504 ])
505
506 AC_DEFUN(AC_STEPMAKE_LIBTOOL, [
507     # libtool.info ...
508     # **Never** try to set library version numbers so that they correspond
509     # to the release number of your package.  This is an abuse that only
510     # fosters misunderstanding of the purpose of library versions.
511
512     REVISION=$PATCH_LEVEL
513     # CURRENT=$MINOR_VERSION
514     CURRENT=`expr $MINOR_VERSION + 1`
515     # AGE=$(expr $MAJOR_VERSION + 1)
516     AGE=$MAJOR_VERSION
517     AC_SUBST(CURRENT)
518     AC_SUBST(REVISION)
519     AC_SUBST(AGE)
520 ])
521
522 AC_DEFUN(AC_STEPMAKE_LOCALE, [
523     lang=English
524     ALL_LINGUAS="en nl"
525
526     # with/enable ??
527     AC_ARG_WITH(localedir,
528     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
529                             PREFIX/share/locale ],
530     localedir=$with_localedir,
531     localedir='${prefix}/share/locale')
532
533     AC_ARG_WITH(lang,
534     [  --with-lang=LANG        use LANG as language to emit messages],
535     language=$with_lang,
536     language=English)
537
538     AC_MSG_CHECKING(language)    
539     case "$language" in
540       En* | en* | Am* | am* | US* | us*)
541             lang=English;;
542       NL | nl | Du* | du* | Ned* | ned*)
543             lang=Dutch;;
544       "")
545             lang=English;;
546       *)
547             lang=unknown;;
548     esac
549     AC_MSG_RESULT($lang)
550
551     if test "$lang" = "unknown" ; then
552         AC_STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
553     fi
554
555 ])
556
557 AC_DEFUN(AC_STEPMAKE_GETTEXT, [
558     DIR_LOCALEDIR=${localedir}
559     presome=${prefix}
560     if test "$prefix" = "NONE"; then
561             presome=${ac_default_prefix}
562     fi
563     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
564     AC_SUBST(localedir)
565     AC_SUBST(DIR_LOCALEDIR)
566     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
567
568     AC_CHECK_LIB(intl, gettext)
569     AC_CHECK_FUNCS(gettext)
570 ])
571
572 AC_DEFUN(AC_STEPMAKE_MAKEINFO, [
573     AC_CHECK_PROGS(MAKEINFO, makeinfo, error)
574     if test "$MAKEINFO" != "error"; then
575         AC_MSG_CHECKING(whether makeinfo can split html by @node)
576         mkdir -p out
577         makeinfo --html --output=out/split <<EOF
578 \input texinfo
579 \input texinfo @c -*-texinfo-*-
580 @setfilename split.info
581 @settitle split.info
582 @bye
583 EOF
584         if test -d out/split; then
585             SPLITTING_MAKEINFO=yes
586             AC_MSG_RESULT(yes)
587             rm -rf out/split
588         else
589             AC_MSG_RESULT(no)
590             AC_STEPMAKE_WARN(your html documentation will be one large file)
591             rm -rf out/split
592         fi
593     fi
594     AC_SUBST(SPLITTING_MAKEINFO)
595 ])
596
597
598 AC_DEFUN(AC_STEPMAKE_MAN, [
599     AC_CHECK_PROGS(GROFF, groff ditroff, -echo no groff)
600     AC_CHECK_PROGS(TROFF, troff, -echo no troff)
601     AC_CHECK_PROGS(TBL, tbl, cat)
602 ])
603
604 AC_DEFUN(AC_STEPMAKE_MSGFMT, [
605     # AC_CHECK_PROGS(MSGFMT, msgfmt, -echo no msgfmt)
606     AC_CHECK_PROGS(MSGFMT, msgfmt, \$(SHELL) \$(step-bindir)/fake-msgfmt.sh )
607     AC_MSG_CHECKING(whether msgfmt accepts -o)
608     msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
609     if test "$msgfmt_output" = ""; then
610         AC_MSG_RESULT(yes)
611     else
612         # urg
613         MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh"
614         AC_MSG_RESULT(no)
615         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
616     fi
617     if test ! -n "$MSGFMT"; then
618         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
619     fi
620 ])
621
622 #why has this been dropped?
623 AC_DEFUN(XXAC_STEPMAKE_TEXMF_DIRS, [
624     AC_ARG_ENABLE(tex-prefix,
625     [  --enable-tex-prefix=DIR   set the tex-directory to find TeX
626                                subdirectories.  Default: PREFIX],
627     [TEXPREFIX=$enableval],
628     [TEXPREFIX=auto] )
629     
630     AC_ARG_ENABLE(tex-dir,
631     [  --enable-tex-dir=DIR      set the directory to put $PACKAGE_NAME TeX files in. ],
632     [TEXDIR=$enableval],
633     [TEXDIR=auto] )
634
635     AC_ARG_ENABLE(mf-dir,
636     [  --enable-mf-dir=DIR       set the directory to put $PACKAGE_NAME MetaFont files in. ],
637     [MFDIR=$enableval],
638     [MFDIR=auto])
639
640     if test "x$TEXPREFIX" = xauto ; then
641         AC_TEX_PREFIX(TEXPREFIX)
642     else
643      find_texprefix=$TEXPREFIX
644     fi
645
646     if test "x$MFDIR" = xauto; then
647         AC_MF_SUBDIR(MFDIR)
648     fi
649         
650     if test "x$TEXDIR" = xauto ; then
651         AC_TEX_SUBDIR(TEXDIR)
652     fi
653     AC_SUBST(TEXPREFIX)
654     AC_SUBST(TEXDIR)
655     AC_SUBST(MFDIR)
656 ])
657
658 AC_DEFUN(AC_STEPMAKE_TEXMF_DIRS, [
659     AC_ARG_ENABLE(tfm-path,
660     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
661                             esp.: cmr10.tfm.  Default: use kpsewhich],
662     [tfm_path=$enableval],
663     [tfm_path=auto] )
664
665     AC_CHECK_PROGS(KPSEWHICH, kpsewhich, no)
666     AC_MSG_CHECKING(for tfm path)
667
668     TFM_FONTS="cmr msam"
669
670     if test "x$tfm_path" = xauto ; then
671         if test "x$KPSEWHICH" != "xno" ; then
672             for i in $TFM_FONTS; do
673                 dir=`$KPSEWHICH tfm ${i}10.tfm`
674                 TFM_PATH="$TFM_PATH `dirname $dir`"
675             done
676         else
677             AC_STEPMAKE_WARN(Please specify where cmr10.tfm lives:
678     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
679         fi
680     else
681          TFM_PATH=$tfm_path
682     fi
683
684     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
685     AC_MSG_RESULT($TFM_PATH)
686     AC_SUBST(TFM_PATH)
687 ])
688
689 AC_DEFUN(AC_STEPMAKE_TEXMF, [
690     # urg, never know what names these teTeX guys will think up
691
692     AC_CHECK_PROGS(METAFONT, mf, no)
693     if test "x$METAFONT" = "xno"; then
694         AC_CHECK_PROGS(MFONT, mfont, -echo no mf or mfont)
695         METAFONT=$MFONT
696     fi
697
698     AC_CHECK_PROGS(METAPOST, mp, no)
699     if test "x$METAPOST" = "xno"; then
700         AC_CHECK_PROGS(MPOST, mpost, -echo no mp or mpost)
701
702         METAPOST=$MPOST
703     fi
704
705     AC_CHECK_PROGS(INIMETAFONT, inimf, no)
706     if test "x$INIMETAFONT" = "xno"; then
707         AC_CHECK_PROGS(INIMFONT, inimfont, -echo no inimf or inimfont)
708         INIMETAFONT=$INIMFONT
709     fi
710
711     AC_CHECK_PROGS(INIMETAPOST, inimp, no)
712     if test "x$INIMETAPOST" = "xno"; then
713         AC_CHECK_PROGS(INIMPOST, inimpost, -echo no inimp or inimpost)
714         INIMETAPOST=$INIMPOST
715     fi
716
717     AC_MSG_CHECKING(for working metafont mode)
718     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
719     for MFMODE in $modelist; do
720         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
721         if test -f mfput.tfm; then
722             break;
723         fi
724     done
725     AC_MSG_RESULT($MFMODE)
726
727     AC_MSG_CHECKING(for mfplain.mp)
728     #
729     # For now let people define these in their environments
730     #
731     : ${MFPLAIN_MP=`kpsewhich --format mp mfplain.mp`}
732     AC_MSG_RESULT($MFPLAIN_MP)
733
734     AC_MSG_CHECKING(for inimetapost flags)
735     if test  ${INIMETAPOST} = "inimp" ; then
736        : ${INIMETAPOST_FLAGS=''}
737     else
738        : ${INIMETAPOST_FLAGS='-interaction=nonstopmode'}
739     fi
740     AC_MSG_RESULT($INIMETAPOST_FLAGS)
741
742     rm -f mfput.*
743
744     AC_SUBST(METAFONT)
745     AC_SUBST(METAPOST)
746     AC_SUBST(MFMODE)
747     AC_SUBST(INIMETAFONT)
748     AC_SUBST(INIMETAPOST)
749     AC_SUBST(MFPLAIN_MP)
750     AC_SUBST(INIMETAPOST_FLAGS)
751 ])
752
753 AC_DEFUN(AC_STEPMAKE_WARN, [
754     AC_MSG_WARN($1)
755     warn_b=yes
756 ])
757
758 AC_DEFUN(AC_STEPMAKE_YODL, [
759     if test "x$YODL" = "x"; then 
760         AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
761         AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
762         AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
763         AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
764         AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
765         AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
766         AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
767         AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
768         YODL2LESS_DIR='$(bindir)/'
769     else
770         AC_SUBST(STRIPROFF)
771         AC_SUBST(YODL)
772         AC_SUBST(YODL2HTML)
773         AC_SUBST(YODL2LATEX)
774         AC_SUBST(YODL2LESS_DIR)
775         AC_SUBST(YODL2MAN)
776         AC_SUBST(YODL2MSLESS)
777         AC_SUBST(YODL2TEXINFO)
778         AC_SUBST(YODL2TXT)
779         export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
780     fi
781     if test "x$YODL" = "-echo no yodl"; then
782         AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
783     fi    
784 ])
785
786 dnl should cache result.
787 dnl should  look in $prefix first.
788 dnl should probably assume TDS
789
790 AC_DEFUN(AC_TEX_PREFIX, [
791     
792
793     AC_MSG_CHECKING(TeX/MF root dir directory)    
794
795     find_root_prefix="$prefix"
796     
797
798     test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
799     find_texpostfix="";
800     for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
801         find_texprefix="$find_root_prefix$postfix"
802         if test -d $find_texprefix; then
803             find_texpostfix=$postfix
804             break;
805         fi
806     done
807     
808     if test "x$find_texpostfix" = x; then
809         find_texpostfix='/lib/texmf/tex'
810         AC_STEPMAKE_WARN(Cannot determine the TeX-directory.  Please use --enable-tex-prefix)
811     fi
812
813     find_texprefix="$find_root_prefix/$find_texpostfix"
814
815     # only assign if variablename not empty
816     if test x != "x[$]$1"; then
817         $1='${prefix}'/"$find_texpostfix"
818     fi
819     AC_MSG_RESULT($find_texprefix)
820
821 ])
822  
823
824 # find a directory inside a prefix, 
825 # $1 the prefix (expanded version)
826 # $2 variable to assign
827 # $3 the directory name 
828 # $4 description
829 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
830     
831     AC_MSG_CHECKING($4 directory)    
832     find_dirdir=`(cd $1; 
833       $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
834     
835
836     if test "x$find_dirdir" = x; then
837        find_dirdir="/$3";
838        AC_STEPMAKE_WARN(Cannot determine $4 subdirectory.  Please set from command-line)
839         true
840     fi
841     $2=$find_dirdir
842     AC_MSG_RESULT($1/$find_dirdir)
843 ])
844
845 # ugh.  this is hopeless
846 AC_DEFUN(AC_KPSE_TEX_DIR, [
847         kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
848         kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
849         echo $kpse_paths
850         if test -w "$kpse_syspaths";
851         then
852                 dir=`echo $kpse_syspaths | head -1`
853         else
854                 dir=`echo $kpse_paths | grep -v '!'| head -1`
855         fi
856         if test "$prefix" = "NONE"; then
857                 local_prefix=$ac_default_prefix
858                 local_prefix_quote='${prefix}'
859
860         else
861                 local_prefix=$prefix
862                 local_prefix_quote=$prefix
863         fi
864         echo $local_prefix_quote = $local_prefix
865         echo $dir
866         echo $dir  | sed 's!'$local_prefix'!\$local_prefix_quote!g'
867 ])
868
869 AC_DEFUN(AC_TEX_SUBDIR, [
870 dnl    AC_REQUIRE([AC_TEX_PREFIX])
871     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
872     $1="$TEXPREFIX/$$1"
873 ])
874
875 AC_DEFUN(AC_MF_SUBDIR, [
876 dnl     AC_REQUIRE([AC_TEX_PREFIX])
877     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
878     $1="$TEXPREFIX/$$1"
879 ])
880
881 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
882         result="`echo \"$1\" | grep echo`"
883         if test "x$1" = "xerror" -o "x$result" != "x"; then
884                 AC_STEPMAKE_WARN(can\'t find $2. $3)
885         fi
886 ])
887
888 dnl   GUILE_FLAGS --- set flags for compiling and linking with Guile
889 dnl
890 dnl   This macro runs the `guile-config' script, installed with Guile,
891 dnl   to find out where Guile's header files and libraries are
892 dnl   installed.  It sets two variables, marked for substitution, as
893 dnl   by AC_SUBST.
894 dnl   
895 dnl     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
896 dnl             code that uses Guile header files.  This is almost
897 dnl             always just a -I flag.
898 dnl   
899 dnl     GUILE_LDFLAGS --- flags to pass to the linker to link a
900 dnl             program against Guile.  This includes `-lguile' for
901 dnl             the Guile library itself, any libraries that Guile
902 dnl             itself requires (like -lqthreads), and so on.  It may
903 dnl             also include a -L flag to tell the compiler where to
904 dnl             find the libraries.
905
906 AC_DEFUN([GUILE_FLAGS],[
907 ## The GUILE_FLAGS macro.
908   AC_MSG_CHECKING(for Guile)
909   if ! $guile_config link > /dev/null ; then
910       AC_MSG_RESULT("cannot execute $guile_config")
911       AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
912       exit 1
913   fi
914   GUILE_CFLAGS="`$guile_config compile`"
915   GUILE_LDFLAGS="`$guile_config link`"
916   AC_SUBST(GUILE_CFLAGS)
917   AC_SUBST(GUILE_LDFLAGS)
918   AC_MSG_RESULT(yes)
919 ])
920
921
922 # Configure paths for GTK+
923 # Owen Taylor     97-11-3
924
925 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
926 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
927 dnl
928 AC_DEFUN(AM_PATH_GTK,
929 [dnl 
930 dnl Get the cflags and libraries from the gtk-config script
931 dnl
932   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
933   min_gtk_version=ifelse([$1], ,1.1.1,$1)
934   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
935   no_gtk=""
936   if test "$GTK_CONFIG" != "no" ; then
937     GTK_CFLAGS=`$GTK_CONFIG --cflags`
938     GTK_LIBS=`$GTK_CONFIG --libs`
939     ac_save_CFLAGS="$CFLAGS"
940     ac_save_LIBS="$LIBS"
941     ac_save_CXXFLAGS="$CXXFLAGS"
942     CFLAGS="$CFLAGS $GTK_CFLAGS"
943     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
944     LIBS="$LIBS $GTK_LIBS"
945 dnl
946 dnl Now check if the installed GTK is sufficiently new. (Also sanity
947 dnl checks the results of gtk-config to some extent)
948 dnl
949     AC_TRY_RUN([
950 #include <gtk/gtk.h>
951 #include <stdio.h>
952
953 int 
954 main ()
955 {
956   int major, minor, micro;
957
958   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
959      printf("%s, bad version string\n", "$min_gtk_version");
960      exit(1);
961    }
962
963    return !((gtk_major_version > major) ||
964             ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
965             ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
966 }
967 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
968      CFLAGS="$ac_save_CFLAGS"
969      CXXFLAGS="$ac_save_CXXFLAGS"
970      LIBS="$ac_save_LIBS"
971   else
972      no_gtk=yes
973   fi
974   if test "x$no_gtk" = x ; then
975      AC_MSG_RESULT(yes)
976      ifelse([$2], , :, [$2])     
977   else
978      AC_MSG_RESULT(no)
979      GTK_CFLAGS=""
980      GTK_LIBS=""
981      ifelse([$3], , :, [$3])
982   fi
983   CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
984   AC_SUBST(CXXFLAGS)
985   AC_SUBST(GTK_CFLAGS)
986   AC_SUBST(GTK_LIBS)
987 ])
988
989
990 # Configure paths for GTK--
991 # Erik Andersen 30 May 1998
992 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
993
994 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
995 dnl   to be used as follows:
996 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
997 dnl
998
999 dnl Get the cflags and libraries from the gtkmm-config script
1000 dnl
1001 AC_ARG_WITH(gtkmm-prefix,[  --with-gtkmm-prefix=PREFIX
1002                           Prefix where GTK-- is installed (optional)],
1003             gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
1004 AC_ARG_WITH(gtkmm-exec-prefix,[  --with-gtkmm-exec-prefix=PREFIX
1005                           Exec prefix where GTK-- is installed (optional)],
1006             gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
1007 AC_ARG_ENABLE(gtkmmtest, [  --disable-gtkmmtest     Do not try to compile and run a test GTK-- program],
1008                     , enable_gtkmmtest=yes)
1009
1010   if test x$gtkmm_config_exec_prefix != x ; then
1011      gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
1012      if test x${GTKMM_CONFIG+set} != xset ; then
1013         GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
1014      fi
1015   fi
1016   if test x$gtkmm_config_prefix != x ; then
1017      gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
1018      if test x${GTKMM_CONFIG+set} != xset ; then
1019         GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
1020      fi
1021   fi
1022
1023
1024 AC_DEFUN(AM_PATH_GTKMM,
1025 [dnl 
1026
1027 dnl
1028 dnl Check if the installed GTK-- is sufficiently new.
1029 dnl
1030   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1031   min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
1032
1033   AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
1034   no_gtkmm=""
1035   if test "$GTKMM_CONFIG" = "no" ; then
1036     no_gtkmm=yes
1037   else
1038     AC_LANG_SAVE
1039     AC_LANG_CPLUSPLUS
1040
1041     GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
1042     GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
1043     gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1044            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1045     gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1046            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1047     gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1048            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1049     if test "x$enable_gtkmmtest" = "xyes" ; then
1050       ac_save_CXXFLAGS="$CXXFLAGS"
1051       ac_save_LIBS="$LIBS"
1052       CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1053       LIBS="$LIBS $GTK___LIBS"
1054 dnl
1055 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
1056 dnl checks the results of gtkmm-config to some extent
1057 dnl
1058       rm -f conf.gtkmmtest
1059       AC_TRY_RUN([
1060 #include <gtk--.h>
1061 #include <stdio.h>
1062 #include <stdlib.h>
1063
1064 int 
1065 main ()
1066 {
1067   int major, minor, micro;
1068   char *tmp_version;
1069
1070   system ("touch conf.gtkmmtest");
1071
1072   /* HP/UX 0 (%@#!) writes to sscanf strings */
1073   tmp_version = g_strdup("$min_gtkmm_version");
1074   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1075      printf("%s, bad version string\n", "$min_gtkmm_version");
1076      exit(1);
1077    }
1078
1079   if ((gtkmm_major_version != $gtkmm_config_major_version) ||
1080       (gtkmm_minor_version != $gtkmm_config_minor_version) ||
1081       (gtkmm_micro_version != $gtkmm_config_micro_version))
1082     {
1083       printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", 
1084              $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
1085              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1086       printf ("*** was found! If gtkmm-config was correct, then it is best\n");
1087       printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
1088       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1089       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1090       printf("*** required on your system.\n");
1091       printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
1092       printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
1093       printf("*** before re-running configure\n");
1094     } 
1095 /* GTK-- does not have the GTKMM_*_VERSION constants */
1096 /* 
1097   else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
1098            (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
1099            (gtkmm_micro_version != GTKMM_MICRO_VERSION))
1100     {
1101       printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
1102              GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
1103       printf("*** library (version %d.%d.%d)\n",
1104              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1105     }
1106 */
1107   else
1108     {
1109       if ((gtkmm_major_version > major) ||
1110         ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
1111         ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
1112       {
1113         return 0;
1114        }
1115      else
1116       {
1117         printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
1118                gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1119         printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
1120                major, minor, micro);
1121         printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
1122         printf("***\n");
1123         printf("*** If you have already installed a sufficiently new version, this error\n");
1124         printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
1125         printf("*** being found. The easiest way to fix this is to remove the old version\n");
1126         printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
1127         printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
1128         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1129         printf("*** so that the correct libraries are found at run-time))\n");
1130       }
1131     }
1132   return 1;
1133 }
1134 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1135        CXXFLAGS="$ac_save_CXXFLAGS"
1136        LIBS="$ac_save_LIBS"
1137      fi
1138   fi
1139   if test "x$no_gtkmm" = x ; then
1140      AC_MSG_RESULT(yes)
1141      ifelse([$2], , :, [$2])     
1142   else
1143      AC_MSG_RESULT(no)
1144      if test "$GTKMM_CONFIG" = "no" ; then
1145        echo "*** The gtkmm-config script installed by GTK-- could not be found"
1146        echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
1147        echo "*** your path, or set the GTK_CONFIG environment variable to the"
1148        echo "*** full path to gtk-config."
1149        echo "*** The gtkmm-config script was not available in GTK-- versions"
1150        echo "*** prior to 0.9.12. Perhaps you need to update your installed"
1151        echo "*** version to 0.9.12 or newer"
1152      else
1153        if test -f conf.gtkmmtest ; then
1154         :
1155        else
1156           echo "*** Could not run GTK-- test program, checking why..."
1157           CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
1158           LIBS="$LIBS $GTK___LIBS"
1159           AC_TRY_LINK([
1160 #include <gtk--.h>
1161 #include <stdio.h>
1162 ],      [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
1163         [ echo "*** The test program compiled, but did not run. This usually means"
1164           echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
1165           echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
1166           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1167           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1168           echo "*** is required on your system"
1169           echo "***"
1170           echo "*** If you have an old version installed, it is best to remove it, although"
1171           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1172         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1173           echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
1174           echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
1175           echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
1176           CXXFLAGS="$ac_save_CXXFLAGS"
1177           LIBS="$ac_save_LIBS"
1178        fi
1179      fi
1180      GTK___CFLAGS=""
1181      GTK__LIBS=""
1182      ifelse([$3], , :, [$3])
1183      AC_LANG_RESTORE
1184   fi
1185   AC_SUBST(GTK___CFLAGS)
1186   AC_SUBST(GTK___LIBS)
1187   rm -f conf.gtkmmtest
1188 ])
1189
1190 # Configure paths for GTK--DRAW
1191 # Derek Quinn Wyatt   98-08-21  (adapted from Jan Nieuwenhuizen's code)
1192
1193 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1194 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
1195 dnl
1196 AC_DEFUN(AM_PATH_GTK__DRAW,
1197 [dnl 
1198 dnl Get the cflags and libraries from the gtk__-config script
1199 dnl
1200   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1201   min_gtk___version=ifelse([$1], ,0.0.5,$1)
1202   AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
1203   no_gtk__=""
1204   if test "$GTKMM_CONFIG" != "no" ; then
1205     GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
1206     GTK___LIBS=`$GTKMM_CONFIG --libs`
1207     GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
1208     GTK___LIBS="$GTK___DLIBS"
1209     ac_save_CFLAGS="$CFLAGS"
1210     ac_save_LIBS="$LIBS"
1211     ac_save_CXXFLAGS="$CXXFLAGS"
1212     CFLAGS="$CFLAGS $GTK___CFLAGS"
1213     CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1214     LIBS="$LIBS $GTK___LIBS"
1215 dnl
1216 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
1217 dnl checks the results of gtk__-config to some extent)
1218 dnl
1219     AC_TRY_RUN([
1220 #include <gtk--.h>
1221 #include <stdio.h>
1222
1223 int 
1224 main ()
1225 {
1226   // urg
1227   return 0;
1228 }
1229 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1230      CFLAGS="$ac_save_CFLAGS"
1231      CXXFLAGS="$ac_save_CXXFLAGS"
1232      LIBS="$ac_save_LIBS"
1233   else
1234      no_gtk__=yes
1235   fi
1236   if test "x$no_gtk__" = x ; then
1237      AC_MSG_RESULT(yes)
1238      ifelse([$2], , :, [$2])     
1239   else
1240      AC_MSG_RESULT(no)
1241      GTK___CFLAGS=""
1242      GTK___LIBS=""
1243      ifelse([$3], , :, [$3])
1244   fi
1245   CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1246   AC_SUBST(CXXFLAGS)
1247   AC_SUBST(GTK___CFLAGS)
1248   AC_SUBST(GTK___LIBS)
1249 ])