]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/aclocal.m4
release: 1.2.7
[lilypond.git] / stepmake / aclocal.m4
1 dnl aclocal.m4   -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
3
4 AC_DEFUN(AC_STEPMAKE_COMPILE, [
5     # -O is necessary to get inlining
6     OPTIMIZE=""
7     CXXFLAGS=${CXXFLAGS:-""}
8     CFLAGS=${CFLAGS:-""}
9     checking_b=yes
10     optimise_b=no
11     profile_b=no
12     debug_b=yes
13
14     AC_ARG_ENABLE(checking,
15     [  enable-checking         set runtime checks (assert calls). Default: on],
16     [checking_b=$enableval] )
17
18     # actually, the default is: tja='-O' to get inlining...
19     # off=''  --jcn
20
21     #actually, that sucks.
22     #  tja looks like a typo.  Default is optimisation off. --hwn
23     
24     AC_ARG_ENABLE(optimise,
25     [  enable-optimise         use maximal speed optimisations. Default: off],
26     [optimise_b=$enableval])
27     
28     AC_ARG_ENABLE(profiling, 
29     [  enable-profiling        compile with gprof support. Default: off],
30     [profile_b=$enableval])
31     
32     AC_ARG_ENABLE(debugging,
33     [  enable-debugging        set debug info. Default: on],
34     [debug_b=$enableval])
35
36     AC_ARG_ENABLE(mingw-prefix,
37     [  enable-mingw-prefix=DIR set the mingw32 directory (standalone windows32 exes)],
38     [MINGWPREFIX=$enableval],
39     [MINGWPREFIX=no])
40
41     if test "$printing_b" = no; then
42         # ugh
43         AC_DEFINE(NPRINT)
44         DEFINES="$DEFINES -DNPRINT"
45     fi
46         
47     if test "$checking_b" = no; then
48         # ugh
49         AC_DEFINE(NDEBUG)
50         DEFINES="$DEFINES -DNDEBUG"
51     fi
52
53     if test "$optimise_b" = yes; then
54         OPTIMIZE="-O2 -finline-functions"
55     fi
56
57     if test "$optimise_b" = no; then
58         OPTIMIZE=""
59     fi
60
61     if test $profile_b = yes; then
62         EXTRA_LIBES="-pg"
63         OPTIMIZE="$OPTIMIZE -pg"
64     fi
65
66     if test $debug_b = yes; then        
67         OPTIMIZE="$OPTIMIZE -g"
68     fi
69
70     # however, C++ support in mingw32 v 0.1.4 is still flaky
71     if test x$MINGWPREFIX != xno; then 
72         ICFLAGS="-I$MINGWPREFIX/include"
73         ILDFLAGS="-$MINGWPREFIX/lib"
74     fi
75
76     AC_PROG_CC
77     LD='$(CC)'
78     AC_SUBST(LD)
79
80     CFLAGS="$CFLAGS $OPTIMIZE"
81     CPPFLAGS=${CPPFLAGS:-""}
82     AC_SUBST(CFLAGS)
83     AC_SUBST(CPPFLAGS)
84     AC_SUBST(LDFLAGS)
85     AC_SUBST(ICFLAGS)
86     AC_SUBST(ILDFLAGS)
87     AC_SUBST(DEFINES)
88     AC_SUBST(EXTRA_LIBES)
89 ])
90
91 AC_DEFUN(AC_STEPMAKE_CXX, [
92     AC_LANG_CPLUSPLUS
93     AC_PROG_CXX
94
95     AC_CHECK_HEADER(FlexLexer.h, true,
96         AC_STEPMAKE_WARN(can"\'"t find flex header. Please install Flex headers correctly))
97
98     CPPFLAGS="$CPPFLAGS $DEFINES"
99     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
100     LDFLAGS=$EXTRA_LIBES
101
102     AC_SUBST(CXXFLAGS)
103     AC_SUBST(CXX)
104     LD='$(CXX)'
105     AC_SUBST(LD)
106 ])
107
108 AC_DEFUN(AC_STEPMAKE_CXXTEMPLATE, [
109     AC_CACHE_CHECK([whether explicit instantiation is needed],
110         lily_cv_need_explicit_instantiation,
111         AC_TRY_LINK([
112     template <class T> struct foo { static int baz; };
113     template <class T> int foo<T>::baz = 1;
114     ], [ return foo<int>::baz; ],
115             lily_cv_need_explicit_instantiation=no,
116             lily_cv_need_explicit_instantiation=yes))
117     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
118         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
119     fi
120 ])
121
122 AC_DEFUN(AC_STEPMAKE_DATADIR, [
123     if test "$datadir" = "\${prefix}/share"; then
124             datadir='${prefix}/share/'$package
125     fi
126     DIR_DATADIR=${datadir}
127     presome=${prefix}
128     if test "$prefix" = "NONE"; then
129             presome=${ac_default_prefix}
130     fi
131     DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
132     AC_SUBST(datadir)
133     AC_SUBST(DIR_DATADIR)
134     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
135 ])
136
137 AC_DEFUN(AC_STEPMAKE_END, [
138     AC_OUTPUT($CONFIGFILE.make:config.make.in)
139
140     rm -f GNUmakefile
141     cp make/toplevel.make.in ./GNUmakefile
142     chmod 444 GNUmakefile
143 ])
144
145 AC_DEFUN(AC_STEPMAKE_GXX, [
146     # ugh autoconf
147     # urg, egcs: how to check for egcs >= 1.1?
148     changequote(<<, >>)dnl
149     if $CXX --version | egrep '2\.[89]' > /dev/null ||
150         $CXX --version | grep 'egcs' > /dev/null
151     changequote([, ])dnl
152     then
153             true
154     else
155             AC_STEPMAKE_WARN(can\'t find g++ 2.8 or egcs 1.1)
156     fi
157 ])
158
159 AC_DEFUN(AC_STEPMAKE_GUILE, [
160     GUILE_FLAGS
161     if guile-config --version 2>&1 | grep -q 'version 1\.[012]'; then
162        AC_STEPMAKE_WARN(Guile version 1.3 or better needed)
163     fi
164 ])
165
166 AC_DEFUN(AC_STEPMAKE_INIT, [
167
168     . $srcdir/VERSION
169     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
170     if test x$MY_PATCH_LEVEL != x; then
171         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
172     fi
173
174     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
175     changequote(<<, >>)dnl
176     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
177     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
178     changequote([, ])dnl
179
180     # No versioning on directory names of sub-packages 
181     # urg, urg
182     stepmake=${datadir}/stepmake
183     presome=${prefix}
184     if test "$prefix" = "NONE"; then
185             presome=${ac_default_prefix}
186     fi
187     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
188
189     AC_MSG_CHECKING(Package)
190     if test "x$PACKAGE" = "xSTEPMAKE"; then
191         AC_MSG_RESULT(Stepmake package!)
192         (cd stepmake; rm -f stepmake; ln -s ../stepmake .)
193         (cd stepmake; rm -f bin; ln -s ../bin .)
194         AC_CONFIG_AUX_DIR(bin)
195         stepmake=stepmake
196     else
197         AC_MSG_RESULT($PACKAGE)
198         AC_MSG_CHECKING(for stepmake)
199         # Check for installed stepmake
200         if test -d $stepmake; then
201             AC_MSG_RESULT($stepmake)
202         else
203             stepmake='$(depth)'/stepmake
204             AC_MSG_RESULT(./stepmake  ($datadir/stepmake not found))
205         fi
206         AC_CONFIG_AUX_DIR(\
207           $HOME/usr/local/share/stepmake/bin\
208           $HOME/usr/local/lib/stepmake/bin\
209           $HOME/usr/share/stepmake/bin\
210           $HOME/usr/lib/stepmake/bin\
211           /usr/local/share/stepmake/bin\
212           /usr/local/lib/stepmake/bin\
213           /usr/share/stepmake/bin\
214           /usr/lib/stepmake/bin\
215           stepmake/bin\
216         )
217     fi
218
219     AC_SUBST(stepmake)
220     AC_SUBST(package)
221     AC_SUBST(PACKAGE)
222     AC_SUBST(PACKAGE_NAME)
223     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
224     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
225
226     if test "$package_depth" = "" ; then
227         package_depth="."
228     else
229         package_depth="../$package_depth"
230     fi
231     export package_depth
232     AC_SUBST(package_depth)
233
234     AUTOGENERATE="This file was automatically generated by configure"
235     AC_SUBST(AUTOGENERATE)
236     absolute_builddir="`pwd`"
237     AC_SUBST(absolute_builddir)
238
239     STATE_VECTOR=`ls make/STATE-VECTOR 2>/dev/null`
240     if test "x$STATE_VECTOR" != "x"; then
241         STATE_VECTOR="\$(depth)/$STATE_VECTOR"
242     fi
243     AC_SUBST(STATE_VECTOR)
244
245     CONFIGSUFFIX=
246     AC_ARG_ENABLE(config,
247     [  enable-config=FILE      put configure settings in config-FILE.make],
248     [CONFIGSUFFIX=$enableval])
249
250     if test "$CONFIGSUFFIX" != "" ; then
251         CONFIGFILE=config-$CONFIGSUFFIX
252     else
253         CONFIGFILE=config
254     fi
255     AC_SUBST(CONFIGSUFFIX)
256      
257     AC_CANONICAL_HOST
258     AC_CHECK_PROGS(MAKE, gmake make, error)
259     AC_CHECK_PROGS(FIND, find, error)
260
261 dnl system supplied INSTALL is unsafe; use our own install.
262 dnl    AC_PROG_INSTALL
263 dnl    if test "$INSTALL" = "bin/install-sh"; then
264 dnl     export INSTALL="\$\(depth\)/bin/install-sh"
265 dnl    fi
266
267     AC_CHECK_PROGS(TAR, tar, error)
268
269     if test "x`uname`" = "xHP-UX"; then
270         AC_PATH_PROG(BASH, bash, /bin/sh)
271         AC_STEPMAKE_WARN(avoiding buggy /bin/sh)
272         AC_PATH_PROG(SHELL, bash, /bin/ksh)
273     else
274         AC_PATH_PROG(BASH, bash, /bin/sh)
275         SHELL=/bin/sh
276         AC_SUBST(SHELL)
277     fi
278
279
280     AC_PATH_PROG(PYTHON, ${PYTHON:-python}, -echo no python)
281     AC_SUBST(PYTHON)
282
283     if test $MAKE != "error" ; then
284         $MAKE -v 2> /dev/null | grep GNU > /dev/null
285         if test "$?" = 1
286         then
287                 AC_STEPMAKE_WARN(Please install *GNU* make) 
288         fi
289     fi 
290
291     AC_CHECK_SEARCH_RESULT($PYTHON, python, You should install Python)
292
293     if test "x$OSTYPE" = "xcygwin32" || test "x$OSTYPE" = "xWindows_NT"; then
294         LN=cp # hard link does not work under cygnus-nt
295         LN_S='cp -r' # symbolic link does not work for native nt
296         ZIP="zip -r -9" #
297         DOTEXE=.exe
298         # urg
299         # DIRSEP='\\'
300         # PATHSEP=';'
301         #
302         # cygwin fixes all these things.  
303         # it seems these were used because of dos-style TEXINPUTS and
304         # MFINPUTS needed for miktex.
305         # but this breaks parsing of all other cygwin/unix style paths.
306         #
307         # if your (mik)tex breaks, make a:
308         #    /usr/local/bin/tex:
309         #    #!/bin/sh
310         #    TEXINPUTS=`cygpath -pw $TEXINPUTS` /texmf/miktex/bin/tex $*
311         #
312         # and
313         #
314         #    /usr/local/bin/mf:
315         #    #!/bin/sh
316         #    MFINPUTS=`cygpath -pw $MFINPUTS` /texmf/miktex/bin/mf $*
317         #
318         # this way, you may have buildscripts/out/lilypond-profile 
319         # 'automatically' sourced from /usr/etc/profile.d/ too.
320         #
321         DIRSEP='/'
322         PATHSEP=':'
323         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
324     else
325         DIRSEP='/'
326         PATHSEP=':'
327         LN=ln
328         LN_S='ln -s'
329         ZIP="zip -r -9"
330         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
331     fi
332     AC_SUBST(DOTEXE)
333     AC_SUBST(ZIP)
334     AC_SUBST(LN)
335     AC_SUBST(LN_S)
336     AC_SUBST(INSTALL)
337     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
338     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
339     AC_SUBST(PATHSEP)
340     AC_SUBST(DIRSEP)
341   
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     rm -f mfput.*
565     AC_MSG_RESULT($MFMODE)
566
567     AC_SUBST(METAFONT)
568     AC_SUBST(METAPOST)
569     AC_SUBST(MFMODE)
570     AC_SUBST(INIMETAFONT)
571     AC_SUBST(INIMETAPOST)
572 ])
573
574 AC_DEFUN(AC_STEPMAKE_WARN, [
575     AC_MSG_WARN($1)
576     warn_b=yes
577 ])
578
579 AC_DEFUN(AC_STEPMAKE_YODL, [
580     if test "x$YODL" = "x"; then 
581         AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
582         AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
583         AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
584         AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
585         AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
586         AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
587         AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
588         AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
589         YODL2LESS_DIR='$(bindir)/'
590     else
591         AC_SUBST(STRIPROFF)
592         AC_SUBST(YODL)
593         AC_SUBST(YODL2HTML)
594         AC_SUBST(YODL2LATEX)
595         AC_SUBST(YODL2LESS_DIR)
596         AC_SUBST(YODL2MAN)
597         AC_SUBST(YODL2MSLESS)
598         AC_SUBST(YODL2TEXINFO)
599         AC_SUBST(YODL2TXT)
600         export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
601     fi
602     if test "x$YODL" = "-echo no yodl"; then
603         AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
604     fi    
605 ])
606
607 dnl should cache result.
608 dnl should  look in $prefix first.
609 dnl should probably assume TDS
610
611 AC_DEFUN(AC_TEX_PREFIX, [
612     
613
614     AC_MSG_CHECKING(TeX/MF root dir directory)    
615
616     find_root_prefix="$prefix"
617     
618
619     test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
620     find_texpostfix="";
621     for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
622         find_texprefix="$find_root_prefix$postfix"
623         if test -d $find_texprefix; then
624             find_texpostfix=$postfix
625             break;
626         fi
627     done
628     
629     if test "x$find_texpostfix" = x; then
630         find_texpostfix='/lib/texmf/tex'
631         AC_STEPMAKE_WARN(Cannot determine the TeX-directory. Please use --enable-tex-prefix)
632     fi
633
634     find_texprefix="$find_root_prefix/$find_texpostfix"
635
636     # only assign if variablename not empty
637     if test x != "x[$]$1"; then
638         $1='${prefix}'/"$find_texpostfix"
639     fi
640     AC_MSG_RESULT($find_texprefix)
641
642 ])
643  
644
645 # find a directory inside a prefix, 
646 # $1 the prefix (expanded version)
647 # $2 variable to assign
648 # $3 the directory name 
649 # $4 description
650 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
651     
652     AC_MSG_CHECKING($4 directory)    
653     find_dirdir=`(cd $1; 
654       $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
655     
656
657     if test "x$find_dirdir" = x; then
658        find_dirdir="/$3";
659        AC_STEPMAKE_WARN(Cannot determine $4 subdirectory. Please set from command-line)
660         true
661     fi
662     $2=$find_dirdir
663     AC_MSG_RESULT($1/$find_dirdir)
664 ])
665
666 # ugh.  this is hopeless
667 AC_DEFUN(AC_KPSE_TEX_DIR, [
668         kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
669         kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
670         echo $kpse_paths
671         if test -w "$kpse_syspaths";
672         then
673                 dir=`echo $kpse_syspaths | head -1`
674         else
675                 dir=`echo $kpse_paths | grep -v '!'| head -1`
676         fi
677         if test "$prefix" = "NONE"; then
678                 local_prefix=$ac_default_prefix
679                 local_prefix_quote='${prefix}'
680
681         else
682                 local_prefix=$prefix
683                 local_prefix_quote=$prefix
684         fi
685         echo $local_prefix_quote = $local_prefix
686         echo $dir
687         echo $dir  | sed 's!'$local_prefix'!\$local_prefix_quote!g'
688 ])
689
690 AC_DEFUN(AC_TEX_SUBDIR, [
691 dnl    AC_REQUIRE([AC_TEX_PREFIX])
692     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
693     $1="$TEXPREFIX/$$1"
694 ])
695
696 AC_DEFUN(AC_MF_SUBDIR, [
697 dnl     AC_REQUIRE([AC_TEX_PREFIX])
698     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
699     $1="$TEXPREFIX/$$1"
700 ])
701
702 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
703         result="`echo \"$1\" | grep echo`"
704         if test "x$1" = "xerror" -o "x$result" != "x"; then
705                 AC_STEPMAKE_WARN(can\'t find $2. $3)
706         fi
707 ])
708
709 dnl   GUILE_FLAGS --- set flags for compiling and linking with Guile
710 dnl
711 dnl   This macro runs the `guile-config' script, installed with Guile,
712 dnl   to find out where Guile's header files and libraries are
713 dnl   installed.  It sets two variables, marked for substitution, as
714 dnl   by AC_SUBST.
715 dnl   
716 dnl     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
717 dnl             code that uses Guile header files.  This is almost
718 dnl             always just a -I flag.
719 dnl   
720 dnl     GUILE_LDFLAGS --- flags to pass to the linker to link a
721 dnl             program against Guile.  This includes `-lguile' for
722 dnl             the Guile library itself, any libraries that Guile
723 dnl             itself requires (like -lqthreads), and so on.  It may
724 dnl             also include a -L flag to tell the compiler where to
725 dnl             find the libraries.
726
727 AC_DEFUN([GUILE_FLAGS],[
728 ## The GUILE_FLAGS macro.
729   ## First, let's just see if we can find Guile at all.
730   AC_MSG_CHECKING(for Guile)
731   guile-config link > /dev/null || {
732     echo "configure: cannot find guile-config; is Guile installed?" 1>&2
733     exit 1
734   }
735   GUILE_CFLAGS="`guile-config compile`"
736   GUILE_LDFLAGS="`guile-config link`"
737   AC_SUBST(GUILE_CFLAGS)
738   AC_SUBST(GUILE_LDFLAGS)
739   AC_MSG_RESULT(yes)
740 ])
741
742
743 # Configure paths for GTK+
744 # Owen Taylor     97-11-3
745
746 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
747 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
748 dnl
749 AC_DEFUN(AM_PATH_GTK,
750 [dnl 
751 dnl Get the cflags and libraries from the gtk-config script
752 dnl
753   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
754   min_gtk_version=ifelse([$1], ,1.1.1,$1)
755   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
756   no_gtk=""
757   if test "$GTK_CONFIG" != "no" ; then
758     GTK_CFLAGS=`$GTK_CONFIG --cflags`
759     GTK_LIBS=`$GTK_CONFIG --libs`
760     ac_save_CFLAGS="$CFLAGS"
761     ac_save_LIBS="$LIBS"
762     ac_save_CXXFLAGS="$CXXFLAGS"
763     CFLAGS="$CFLAGS $GTK_CFLAGS"
764     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
765     LIBS="$LIBS $GTK_LIBS"
766 dnl
767 dnl Now check if the installed GTK is sufficiently new. (Also sanity
768 dnl checks the results of gtk-config to some extent)
769 dnl
770     AC_TRY_RUN([
771 #include <gtk/gtk.h>
772 #include <stdio.h>
773
774 int 
775 main ()
776 {
777   int major, minor, micro;
778
779   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
780      printf("%s, bad version string\n", "$min_gtk_version");
781      exit(1);
782    }
783
784    return !((gtk_major_version > major) ||
785             ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
786             ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
787 }
788 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
789      CFLAGS="$ac_save_CFLAGS"
790      CXXFLAGS="$ac_save_CXXFLAGS"
791      LIBS="$ac_save_LIBS"
792   else
793      no_gtk=yes
794   fi
795   if test "x$no_gtk" = x ; then
796      AC_MSG_RESULT(yes)
797      ifelse([$2], , :, [$2])     
798   else
799      AC_MSG_RESULT(no)
800      GTK_CFLAGS=""
801      GTK_LIBS=""
802      ifelse([$3], , :, [$3])
803   fi
804   CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
805   AC_SUBST(CXXFLAGS)
806   AC_SUBST(GTK_CFLAGS)
807   AC_SUBST(GTK_LIBS)
808 ])
809
810
811 # Configure paths for GTK--
812 # Erik Andersen 30 May 1998
813 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
814
815 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
816 dnl   to be used as follows:
817 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
818 dnl
819
820 dnl Get the cflags and libraries from the gtkmm-config script
821 dnl
822 AC_ARG_WITH(gtkmm-prefix,[  --with-gtkmm-prefix=PREFIX
823                           Prefix where GTK-- is installed (optional)],
824             gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
825 AC_ARG_WITH(gtkmm-exec-prefix,[  --with-gtkmm-exec-prefix=PREFIX
826                           Exec prefix where GTK-- is installed (optional)],
827             gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
828 AC_ARG_ENABLE(gtkmmtest, [  --disable-gtkmmtest     Do not try to compile and run a test GTK-- program],
829                     , enable_gtkmmtest=yes)
830
831   if test x$gtkmm_config_exec_prefix != x ; then
832      gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
833      if test x${GTKMM_CONFIG+set} != xset ; then
834         GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
835      fi
836   fi
837   if test x$gtkmm_config_prefix != x ; then
838      gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
839      if test x${GTKMM_CONFIG+set} != xset ; then
840         GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
841      fi
842   fi
843
844
845 AC_DEFUN(AM_PATH_GTKMM,
846 [dnl 
847
848 dnl
849 dnl Check if the installed GTK-- is sufficiently new.
850 dnl
851   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
852   min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
853
854   AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
855   no_gtkmm=""
856   if test "$GTKMM_CONFIG" = "no" ; then
857     no_gtkmm=yes
858   else
859     AC_LANG_SAVE
860     AC_LANG_CPLUSPLUS
861
862     GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
863     GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
864     gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
865            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
866     gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
867            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
868     gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
869            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
870     if test "x$enable_gtkmmtest" = "xyes" ; then
871       ac_save_CXXFLAGS="$CXXFLAGS"
872       ac_save_LIBS="$LIBS"
873       CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
874       LIBS="$LIBS $GTK___LIBS"
875 dnl
876 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
877 dnl checks the results of gtkmm-config to some extent
878 dnl
879       rm -f conf.gtkmmtest
880       AC_TRY_RUN([
881 #include <gtk--.h>
882 #include <stdio.h>
883 #include <stdlib.h>
884
885 int 
886 main ()
887 {
888   int major, minor, micro;
889   char *tmp_version;
890
891   system ("touch conf.gtkmmtest");
892
893   /* HP/UX 0 (%@#!) writes to sscanf strings */
894   tmp_version = g_strdup("$min_gtkmm_version");
895   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
896      printf("%s, bad version string\n", "$min_gtkmm_version");
897      exit(1);
898    }
899
900   if ((gtkmm_major_version != $gtkmm_config_major_version) ||
901       (gtkmm_minor_version != $gtkmm_config_minor_version) ||
902       (gtkmm_micro_version != $gtkmm_config_micro_version))
903     {
904       printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", 
905              $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
906              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
907       printf ("*** was found! If gtkmm-config was correct, then it is best\n");
908       printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
909       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
910       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
911       printf("*** required on your system.\n");
912       printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
913       printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
914       printf("*** before re-running configure\n");
915     } 
916 /* GTK-- does not have the GTKMM_*_VERSION constants */
917 /* 
918   else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
919            (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
920            (gtkmm_micro_version != GTKMM_MICRO_VERSION))
921     {
922       printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
923              GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
924       printf("*** library (version %d.%d.%d)\n",
925              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
926     }
927 */
928   else
929     {
930       if ((gtkmm_major_version > major) ||
931         ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
932         ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
933       {
934         return 0;
935        }
936      else
937       {
938         printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
939                gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
940         printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
941                major, minor, micro);
942         printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
943         printf("***\n");
944         printf("*** If you have already installed a sufficiently new version, this error\n");
945         printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
946         printf("*** being found. The easiest way to fix this is to remove the old version\n");
947         printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
948         printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
949         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
950         printf("*** so that the correct libraries are found at run-time))\n");
951       }
952     }
953   return 1;
954 }
955 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
956        CXXFLAGS="$ac_save_CXXFLAGS"
957        LIBS="$ac_save_LIBS"
958      fi
959   fi
960   if test "x$no_gtkmm" = x ; then
961      AC_MSG_RESULT(yes)
962      ifelse([$2], , :, [$2])     
963   else
964      AC_MSG_RESULT(no)
965      if test "$GTKMM_CONFIG" = "no" ; then
966        echo "*** The gtkmm-config script installed by GTK-- could not be found"
967        echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
968        echo "*** your path, or set the GTK_CONFIG environment variable to the"
969        echo "*** full path to gtk-config."
970        echo "*** The gtkmm-config script was not available in GTK-- versions"
971        echo "*** prior to 0.9.12. Perhaps you need to update your installed"
972        echo "*** version to 0.9.12 or newer"
973      else
974        if test -f conf.gtkmmtest ; then
975         :
976        else
977           echo "*** Could not run GTK-- test program, checking why..."
978           CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
979           LIBS="$LIBS $GTK___LIBS"
980           AC_TRY_LINK([
981 #include <gtk--.h>
982 #include <stdio.h>
983 ],      [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
984         [ echo "*** The test program compiled, but did not run. This usually means"
985           echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
986           echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
987           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
988           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
989           echo "*** is required on your system"
990           echo "***"
991           echo "*** If you have an old version installed, it is best to remove it, although"
992           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
993         [ echo "*** The test program failed to compile or link. See the file config.log for the"
994           echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
995           echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
996           echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
997           CXXFLAGS="$ac_save_CXXFLAGS"
998           LIBS="$ac_save_LIBS"
999        fi
1000      fi
1001      GTK___CFLAGS=""
1002      GTK__LIBS=""
1003      ifelse([$3], , :, [$3])
1004      AC_LANG_RESTORE
1005   fi
1006   AC_SUBST(GTK___CFLAGS)
1007   AC_SUBST(GTK___LIBS)
1008   rm -f conf.gtkmmtest
1009 ])
1010
1011 # Configure paths for GTK--DRAW
1012 # Derek Quinn Wyatt   98-08-21  (adapted from Jan Nieuwenhuizen's code)
1013
1014 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1015 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
1016 dnl
1017 AC_DEFUN(AM_PATH_GTK__DRAW,
1018 [dnl 
1019 dnl Get the cflags and libraries from the gtk__-config script
1020 dnl
1021   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1022   min_gtk___version=ifelse([$1], ,0.0.5,$1)
1023   AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
1024   no_gtk__=""
1025   if test "$GTKMM_CONFIG" != "no" ; then
1026     GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
1027     GTK___LIBS=`$GTKMM_CONFIG --libs`
1028     GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
1029     GTK___LIBS="$GTK___DLIBS"
1030     ac_save_CFLAGS="$CFLAGS"
1031     ac_save_LIBS="$LIBS"
1032     ac_save_CXXFLAGS="$CXXFLAGS"
1033     CFLAGS="$CFLAGS $GTK___CFLAGS"
1034     CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1035     LIBS="$LIBS $GTK___LIBS"
1036 dnl
1037 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
1038 dnl checks the results of gtk__-config to some extent)
1039 dnl
1040     AC_TRY_RUN([
1041 #include <gtk--.h>
1042 #include <stdio.h>
1043
1044 int 
1045 main ()
1046 {
1047   // urg
1048   return 0;
1049 }
1050 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1051      CFLAGS="$ac_save_CFLAGS"
1052      CXXFLAGS="$ac_save_CXXFLAGS"
1053      LIBS="$ac_save_LIBS"
1054   else
1055      no_gtk__=yes
1056   fi
1057   if test "x$no_gtk__" = x ; then
1058      AC_MSG_RESULT(yes)
1059      ifelse([$2], , :, [$2])     
1060   else
1061      AC_MSG_RESULT(no)
1062      GTK___CFLAGS=""
1063      GTK___LIBS=""
1064      ifelse([$3], , :, [$3])
1065   fi
1066   CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1067   AC_SUBST(CXXFLAGS)
1068   AC_SUBST(GTK___CFLAGS)
1069   AC_SUBST(GTK___LIBS)
1070 ])