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