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