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