]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
tremolo fixes
[lilypond.git] / aclocal.m4
1 dnl aclocal.m4   -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
3
4
5 ### mostly interal macros
6
7 # Get full path of executable ($1)
8 AC_DEFUN(STEPMAKE_GET_EXECUTABLE, [
9     type -p "$1" 2>&1 | awk '{print $NF}'
10 ])
11
12
13 # Get version string from executable ($1)
14 AC_DEFUN(STEPMAKE_GET_VERSION, [
15     "$1" --version 2>&1 | grep -v '^$' | head -1 | awk '{print $NF}'
16 ])
17
18 # Calculate numeric version from version string ($1)
19 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
20     echo "$1" | awk -F. '
21     {
22       if ([$]3) {last = [$]3}
23       else {last =0}
24     }
25     {printf "%s%s%s\n",[$]1*100, [$]2*10,last}'
26 ])
27
28
29 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
30 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
31     eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
32 ])
33
34 # Check if tested program ($2) was found ($1).
35 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
36 # We could abort here if a 'REQUIRED' program is not found
37 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
38     STEPMAKE_CHECK_SEARCH_RESULT($1)
39     if test $? -ne 0; then
40         STEPMAKE_ADD_ENTRY($3, $2)
41         if test "$3" = "REQUIRED"; then
42             command="echo ERROR: $2 not found"
43             # abort configure process here?
44         else
45             command="- echo $2 not found"
46         fi
47         eval "$1"='$command'
48         false
49     else
50         true
51     fi
52 ])
53
54
55 # Return if tested proram ($1) was found (true) or not (false).
56 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
57     r="`eval echo '$'"$1"`"
58     if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
59         true
60     else
61         ##STEPMAKE_WARN(cannot find $2. $3)
62         false
63     fi
64 ])
65
66
67 # Check version of program ($1)
68 # If version is smaller than requested ($3),
69 # add entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
70 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
71     r="`eval echo '$'"$1"`"
72     AC_MSG_CHECKING("$r version")
73     exe=`STEPMAKE_GET_EXECUTABLE($r)`
74     ver=`STEPMAKE_GET_VERSION($exe)`
75     num=`STEPMAKE_NUMERIC_VERSION($ver)`
76     req=`STEPMAKE_NUMERIC_VERSION($3)`
77     AC_MSG_RESULT("$ver")
78     if test "$num" -lt "$req"; then
79         STEPMAKE_ADD_ENTRY($2, "$r $3 (installed: $ver)")
80     fi
81 ])
82
83 ### Macros to build configure.in
84
85
86 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
87     STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
88     if test "$BIBTEX2HTML" = "bib2html"; then
89         BIBTEX2HTML_FLAGS='$< $(@)'
90     else
91         BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
92     fi
93     AC_SUBST(BIBTEX2HTML)
94     AC_SUBST(BIBTEX2HTML_FLAGS)
95 ])
96
97
98 AC_DEFUN(STEPMAKE_BISON, [
99     # ugh, automake: we want (and check for) bison
100     AC_PROG_YACC
101     
102     STEPMAKE_PROGS(BISON, bison, $1)
103     
104     # urg.  should test functionality rather than version.
105     if test "$BISON" = "bison" -a -n "$2"; then
106         STEPMAKE_CHECK_VERSION(BISON, $1, $2)
107     fi
108 ])
109
110
111 AC_DEFUN(STEPMAKE_COMPILE, [
112     # -O is necessary to get inlining
113     CFLAGS=${CFLAGS-""}
114     CXXFLAGS=${CXXFLAGS-$CFLAGS}
115     LDFLAGS=${LDFLAGS-""}
116     checking_b=yes
117     optimise_b=yes
118     profile_b=no
119     debug_b=yes
120
121     AC_ARG_ENABLE(checking,
122     [  --enable-checking       set runtime checks (assert calls).  Default: on],
123     [checking_b=$enableval] )
124
125     AC_ARG_ENABLE(debugging,
126     [  --enable-debugging      compile with debugging info.  Default: on],
127     [debug_b=$enableval])
128
129     AC_ARG_ENABLE(optimising,
130     [  --enable-optimising      compile with optimising.  Default: on],
131     [optimise_b=$enableval])
132
133     AC_ARG_ENABLE(profiling, 
134     [  --enable-profiling      compile with gprof support.  Default: off],
135     [profile_b=$enableval])
136     
137
138     if test "$checking_b" = no; then
139         # ugh
140         AC_DEFINE(NDEBUG)
141         DEFINES="$DEFINES -DNDEBUG"
142     fi
143
144     if test "$optimise_b" = yes; then
145         OPTIMIZE="-O2 -finline-functions"
146     fi
147
148
149     if test $profile_b = yes; then
150         EXTRA_LIBES="-pg"
151         OPTIMIZE="$OPTIMIZE -pg"
152     fi
153
154     if test $debug_b = yes; then        
155         OPTIMIZE="$OPTIMIZE -g"
156     fi
157
158
159     AC_PROG_CC
160     STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
161     LD='$(CC)'
162     AC_SUBST(LD)
163
164     CFLAGS="$CFLAGS $OPTIMIZE"
165     CPPFLAGS=${CPPFLAGS-""}
166
167     AC_MSG_CHECKING([for IEEE-conformance compiler flags])
168     save_cflags="$CFLAGS"
169     case "$host" in
170         alpha*-*-*)
171             dnl should do compile test?
172             AC_MSG_RESULT(-mieee)
173             CFLAGS="-mieee $CFLAGS"
174             ;;
175         *)
176             AC_MSG_RESULT([none])
177             ;;
178     esac
179     AC_SUBST(cross_compiling)
180     AC_SUBST(CFLAGS)
181     AC_SUBST(CPPFLAGS)
182     AC_SUBST(LDFLAGS)
183     AC_SUBST(ICFLAGS)
184     AC_SUBST(ILDFLAGS)
185     AC_SUBST(DEFINES)
186     AC_SUBST(EXTRA_LIBES)
187 ])
188
189 AC_DEFUN(STEPMAKE_CXX, [
190     AC_LANG_CPLUSPLUS
191     AC_PROG_CXX
192     STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
193
194     CPPFLAGS="$CPPFLAGS $DEFINES"
195     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
196     LDFLAGS="$LDFLAGS $EXTRA_LIBES"
197
198     AC_SUBST(CXXFLAGS)
199     AC_SUBST(CXX)
200     LD='$(CXX)'
201     AC_SUBST(LD)
202 ])
203
204
205 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
206     AC_CACHE_CHECK([whether explicit instantiation is needed],
207         lily_cv_need_explicit_instantiation,
208         AC_TRY_LINK([
209     template <class T> struct foo { static int baz; };
210     template <class T> int foo<T>::baz = 1;
211     ], [ return foo<int>::baz; ],
212             lily_cv_need_explicit_instantiation=no,
213             lily_cv_need_explicit_instantiation=yes))
214     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
215         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
216     fi
217 ])
218
219
220 AC_DEFUN(STEPMAKE_DATADIR, [
221     if test "$datadir" = "\${prefix}/share"; then
222             datadir='${prefix}/share/'$package/$FULL_VERSION
223     fi
224     DIR_DATADIR=${datadir}
225     presome=${prefix}
226     if test "$prefix" = "NONE"; then
227             presome=${ac_default_prefix}
228     fi
229     DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
230
231     AC_SUBST(datadir)
232     AC_SUBST(DIR_DATADIR)
233
234     # we used to set DIR_SHAREDSTATEDIR here,
235     # but apparently that broke something
236     
237     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
238 ])
239
240
241 AC_DEFUN(STEPMAKE_END, [
242     AC_SUBST(OPTIONAL)
243     AC_SUBST(REQUIRED)
244     
245     AC_OUTPUT($CONFIGFILE.make:config.make.in)
246
247     
248     if test -n "$OPTIONAL"; then
249         echo
250         echo "WARNING: Please consider installing optional programs: $OPTIONAL"
251     fi
252
253     if test -n "$REQUIRED"; then
254         echo
255         echo "ERROR: Please install required programs: $REQUIRED"
256     fi
257     
258     if test -n "$OPTIONAL$REQUIRED"; then
259         echo
260         echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
261         echo "Remove config.cache before rerunning ./configure"
262     fi
263     
264     if test -n "$REQUIRED"; then
265         rm -f $srcdir/GNUmakefile
266         exit 1
267     fi
268
269     # regular in-place build
270     # test for srcdir_build = yes ?
271     if test "$builddir" = "."; then
272         rm -f $srcdir/GNUmakefile
273         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
274         chmod 444 $srcdir/GNUmakefile
275     else # --srcdir build
276         rm -f GNUmakefile
277         cp $srcdir/make/srcdir.make.in GNUmakefile
278         chmod 444 GNUmakefile
279     fi
280 ])
281
282
283 AC_DEFUN(STEPMAKE_FLEX, [
284     # ugh, automake: we want (and check for) flex
285     # AC_PROG_LEX
286     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
287
288     # AC_DECL_YYTEXT
289     # ugh, ugh
290     ac_cv_prog_lex_root=lex.yy
291     STEPMAKE_PROGS(FLEX, flex, $1)
292 ])
293
294
295 AC_DEFUN(STEPMAKE_FLEXLEXER, [
296     AC_HAVE_HEADERS(FlexLexer.h, true, false)
297     if test $? -ne 0; then
298         warn='FlexLexer.h (flex package)'
299         STEPMAKE_ADD_ENTRY($1, $warn)
300     fi
301 ])
302
303
304 AC_DEFUN(STEPMAKE_GCC, [
305     if test "$GCC" = "yes"; then
306         STEPMAKE_CHECK_VERSION(CC, $1, $2)
307     else
308         warn="$CC (Please install *GNU* cc)"
309         STEPMAKE_ADD_ENTRY($1, $warn)
310     fi
311 ])
312
313
314 AC_DEFUN(STEPMAKE_GETTEXT, [
315     DIR_LOCALEDIR=${localedir}
316     presome=${prefix}
317     if test "$prefix" = "NONE"; then
318             presome=${ac_default_prefix}
319     fi
320     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
321     AC_SUBST(localedir)
322     AC_SUBST(DIR_LOCALEDIR)
323     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
324
325     AC_CHECK_LIB(intl, gettext)
326     AC_CHECK_FUNCS(gettext)
327 ])
328
329
330 AC_DEFUN(STEPMAKE_GUILE, [
331     STEPMAKE_PATH_PROG(GUILE, guile, $1)
332 ])
333
334
335 #   STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
336 #
337 #   This macro runs the guile-config script, installed with Guile,
338 #   to find out where Guile's header files and libraries are
339 #   installed.  It sets two variables, marked for substitution, as
340 #   by AC_SUBST.
341 #   
342 #     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
343 #             code that uses Guile header files.  This is almost
344 #             always just a -I flag.
345 #   
346 #     GUILE_LDFLAGS --- flags to pass to the linker to link a
347 #             program against Guile.  This includes -lguile for
348 #             the Guile library itself, any libraries that Guile
349 #             itself requires (like -lqthreads), and so on.  It may
350 #             also include a -L flag to tell the compiler where to
351 #             find the libraries.
352
353 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
354     exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
355     if test -x $exe; then
356         AC_MSG_CHECKING("guile compile flags")
357         GUILE_CFLAGS="`$guile_config compile`"
358         AC_MSG_RESULT($GUILE_CFLAGS)
359         AC_MSG_CHECKING("guile link flags")
360         GUILE_LDFLAGS="`$guile_config link`"
361         AC_MSG_RESULT($GUILE_LDFLAGS)
362     fi
363     AC_SUBST(GUILE_CFLAGS)
364     AC_SUBST(GUILE_LDFLAGS)
365 ])
366
367
368 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
369     ## First, let's just see if we can find Guile at all.
370     AC_MSG_CHECKING("for guile-config")
371     for guile_config in guile-config $target-guile-config $build-guile-config; do
372         AC_MSG_RESULT("$guile_config")
373         if ! $guile_config --version > /dev/null 2>&1 ; then
374             AC_MSG_WARN("cannot execute $guile_config")
375             AC_MSG_CHECKING("if we are cross compiling")
376             GUILE_CONFIG='echo no guile-config'
377         else
378             GUILE_CONFIG=$guile_config
379             break
380         fi
381     done
382     STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
383     if test $? -ne 0; then
384         STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
385     fi 
386
387     STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
388     # urg.  should test functionality rather than version.
389     if test $? -eq 0 -a -n "$2"; then
390         STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
391     fi
392
393     AC_SUBST(GUILE_CONFIG)
394     
395     guile_version="$ver"
396     changequote(<<, >>)dnl
397     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
398     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
399     changequote([, ])dnl
400     STEPMAKE_GUILE_FLAGS
401     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
402     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
403 ])
404
405
406 AC_DEFUN(STEPMAKE_GXX, [
407     if test "$GXX" = "yes"; then
408         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
409     else
410         warn="$CXX (Please install *GNU* c++)"
411         STEPMAKE_ADD_ENTRY($1, $warn)
412     fi
413 ])
414
415
416 AC_DEFUN(STEPMAKE_INIT, [
417
418     . $srcdir/VERSION
419     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
420     if test x$MY_PATCH_LEVEL != x; then
421         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
422     fi
423
424     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
425     changequote(<<, >>)dnl
426     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
427     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
428     changequote([, ])dnl
429
430     # No versioning on directory names of sub-packages 
431     # urg, urg
432     stepmake=${datadir}/stepmake
433     presome=${prefix}
434     if test "$prefix" = "NONE"; then
435             presome=${ac_default_prefix}
436     fi
437     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
438
439     # urg, how is this supposed to work?
440     if test "$program_prefix" = "NONE"; then
441           program_prefix=
442     fi
443     if test "$program_suffix" = "NONE"; then
444           program_suffix=
445     fi
446
447     AC_MSG_CHECKING(Package)
448     if test "x$PACKAGE" = "xSTEPMAKE"; then
449         AC_MSG_RESULT(Stepmake package!)
450
451         AC_MSG_CHECKING(builddir)
452         if test "$srcdir" = "."; then
453             builddir=.
454         else
455             absolute_builddir="`pwd`"
456             package_absolute_builddir="`dirname $absolute_builddir`"
457             package_srcdir="`dirname  $srcdir`"
458             builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`"
459         fi
460         AC_MSG_RESULT($builddir)
461
462         (cd stepmake 2>/dev/null || mkdir stepmake)
463         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
464         AC_CONFIG_AUX_DIR(bin)
465         stepmake=stepmake
466     else
467         AC_MSG_RESULT($PACKAGE)
468
469         AC_MSG_CHECKING(builddir)
470         if test "$srcdir" = "."; then
471             builddir=.
472             srcdir_build=no
473         else
474             absolute_builddir="`pwd`"
475 #           builddir="`dirname  $srcdir`/`basename $absolute_builddir`"
476             builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`"
477             srcdir_build=yes
478         fi
479         AC_MSG_RESULT($builddir)
480         if expr "$srcdir" : '/' > /dev/null 2>&1; then
481             absolute_srcdir=yes
482             STEPMAKE_WARN(Absolute --srcdir specified: $srcdir)
483         fi
484
485         AC_MSG_CHECKING(for stepmake)
486         # Check for installed stepmake
487         if test -d $stepmake; then
488             AC_MSG_RESULT($stepmake)
489         else
490             if test "$absolute_srcdir" != "yes"; then
491                 stepmake='$(depth)'/$srcdir/stepmake
492             else
493                 stepmake=$srcdir/stepmake
494             fi
495             AC_MSG_RESULT($srcdir/stepmake  ($datadir/stepmake not found))
496         fi
497
498         AC_CONFIG_AUX_DIR(\
499           $HOME/usr/local/share/stepmake/bin\
500           $HOME/usr/local/lib/stepmake/bin\
501           $HOME/usr/share/stepmake/bin\
502           $HOME/usr/lib/stepmake/bin\
503           /usr/local/share/stepmake/bin\
504           /usr/local/lib/stepmake/bin\
505           /usr/share/stepmake/bin\
506           /usr/lib/stepmake/bin\
507           stepmake/bin\
508           $srcdir/stepmake/bin\
509         )
510     fi
511
512     AC_SUBST(builddir)
513     AC_SUBST(stepmake)
514     AC_SUBST(package)
515     AC_SUBST(PACKAGE)
516     AC_SUBST(PACKAGE_NAME)
517     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
518     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
519
520     if test "$package_depth" = "" ; then
521         package_depth="."
522     else
523         package_depth="../$package_depth"
524     fi
525     export package_depth
526     AC_SUBST(package_depth)
527
528     AUTOGENERATE="This file was automatically generated by configure"
529     AC_SUBST(AUTOGENERATE)
530
531     CONFIGSUFFIX=
532     AC_ARG_ENABLE(config,
533     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
534                             do \`make conf=CONF' to get output in ./out-CONF],
535     [CONFIGURATION=$enableval])
536
537     ##'
538
539     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
540     CONFIGFILE=config$CONFIGSUFFIX
541     AC_SUBST(CONFIGSUFFIX)
542      
543     AC_CANONICAL_HOST
544     STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
545     STEPMAKE_PROGS(FIND, find, REQUIRED)
546
547     STEPMAKE_PROGS(TAR, tar, REQUIRED)
548
549     if test "x`uname`" = "xHP-UX"; then
550         AC_PATH_PROG(BASH, bash, /bin/sh)
551         STEPMAKE_WARN(avoiding buggy /bin/sh)
552         AC_PATH_PROG(SHELL, bash, /bin/ksh)
553     else
554         AC_PATH_PROG(BASH, bash, /bin/sh)
555         SHELL=/bin/sh
556         AC_SUBST(SHELL)
557     fi
558
559     STEPMAKE_PATH_PROG(PYTHON, python, REQUIRED)
560
561     if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
562         $MAKE -v 2> /dev/null | grep GNU > /dev/null
563         if test "$?" = 1; then
564             warn='make (Please install *GNU* make)'
565             # STEPMAKE_WARN($warn)
566             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
567         fi
568     fi 
569
570     if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
571         LN=cp # hard link does not work under cygnus-nt
572         LN_S='cp -r' # symbolic link does not work for native nt
573         ZIP="zip -r -9" #
574         program_suffix=.exe
575         ROOTSEP=':'
576         DIRSEP='/'
577         PATHSEP=':'
578         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
579     else
580         ROOTSEP=':'
581         DIRSEP='/'
582         PATHSEP=':'
583         LN=ln
584         LN_S='ln -s'
585         ZIP="zip -r -9"
586         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
587     fi
588     AC_SUBST(program_prefix)
589     AC_SUBST(program_suffix)
590     AC_SUBST(ZIP)
591     AC_SUBST(LN)
592     AC_SUBST(LN_S)
593     AC_SUBST(INSTALL)
594     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
595     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
596     AC_SUBST(DIRSEP)
597     AC_SUBST(PATHSEP)
598     AC_SUBST(ROOTSEP)
599   
600     STEPMAKE_DATADIR
601 ])
602
603
604 AC_DEFUN(STEPMAKE_KPATHSEA, [
605
606     kpathsea_b=yes
607     #FIXME --with-xxx is meant for specifying a PATH too,
608     # so this should read: --enable-kpathsea,
609     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
610     AC_ARG_WITH(kpathsea,
611     [  --with-kpathsea         use kpathsea lib.  Default: on],
612     [kpathsea_b=$with_kpathsea])
613
614     if test "$kpathsea_b" != "no"; then 
615         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
616         AC_CHECK_LIB(kpathsea, kpse_find_file)
617         AC_CHECK_FUNCS(kpse_find_file,, AC_ERROR(Cannot find kpathsea functions.  You should install kpathsea; see INSTALL.txt.  Rerun ./configure --without-kpathsea only if kpathsea is not available for your platform.))
618     fi
619     AC_MSG_CHECKING(whether to use kpathsea)
620     if test "$kpathsea_b" != no; then
621         AC_MSG_RESULT(yes)
622         KPATHSEA=1
623     else
624         AC_MSG_RESULT(no)
625         KPATHSEA=0
626     fi
627
628     AC_SUBST(KPATHSEA)
629     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
630 ])
631
632
633 AC_DEFUN(STEPMAKE_LIB, [
634     STEPMAKE_PROGS(AR, ar, $1)
635     AC_PROG_RANLIB
636     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
637 ])
638
639
640 AC_DEFUN(STEPMAKE_LIBTOOL, [
641     # libtool.info ...
642     # **Never** try to set library version numbers so that they correspond
643     # to the release number of your package.  This is an abuse that only
644     # fosters misunderstanding of the purpose of library versions.
645
646     REVISION=$PATCH_LEVEL
647     # CURRENT=$MINOR_VERSION
648     CURRENT=`expr $MINOR_VERSION + 1`
649     # AGE=$(expr $MAJOR_VERSION + 1)
650     AGE=$MAJOR_VERSION
651     AC_SUBST(CURRENT)
652     AC_SUBST(REVISION)
653     AC_SUBST(AGE)
654 ])
655
656
657 AC_DEFUN(STEPMAKE_LOCALE, [
658     lang=English
659     ALL_LINGUAS="en nl"
660
661     # with/enable ??
662     AC_ARG_WITH(localedir,
663     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
664                             PREFIX/share/locale ],
665     localedir=$with_localedir,
666     localedir='${prefix}/share/locale')
667
668     AC_ARG_WITH(lang,
669     [  --with-lang=LANG        use LANG as language to emit messages],
670     language=$with_lang,
671     language=English)
672
673     AC_MSG_CHECKING(language)    
674     case "$language" in
675       En* | en* | Am* | am* | US* | us*)
676             lang=English;;
677       NL | nl | Du* | du* | Ned* | ned*)
678             lang=Dutch;;
679       "")
680             lang=English;;
681       *)
682             lang=unknown;;
683     esac
684     AC_MSG_RESULT($lang)
685
686     if test "$lang" = "unknown" ; then
687         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
688     fi
689
690 ])
691
692
693 AC_DEFUN(STEPMAKE_MAKEINFO, [
694     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
695     if test "$MAKEINFO" = "makeinfo"; then
696         AC_MSG_CHECKING(whether makeinfo can split html by @node)
697         mkdir -p out
698         makeinfo --html --output=out/split <<EOF
699 \input texinfo
700 \input texinfo @c -*-texinfo-*-
701 @setfilename split.info
702 @settitle split.info
703 @bye
704 EOF
705         if test -d out/split; then
706             SPLITTING_MAKEINFO=yes
707             AC_MSG_RESULT(yes)
708             rm -rf out/split
709         else
710             AC_MSG_RESULT(no)
711             STEPMAKE_WARN(your html documentation will be one large file)
712             rm -rf out/split
713         fi
714     fi
715     AC_SUBST(SPLITTING_MAKEINFO)
716 ])
717
718
719
720 AC_DEFUN(STEPMAKE_MAN, [
721     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
722     AC_SUBST(GROFF)
723     STEPMAKE_PROGS(TROFF, troff, $1)
724     AC_SUBST(TROFF)
725     STEPMAKE_PROGS(TBL, tbl, $1)
726     AC_SUBST(TBL)
727 ])
728
729
730 AC_DEFUN(STEPMAKE_MSGFMT, [
731     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
732 ])
733
734
735 # Check for program ($2), set full path result to ($1).
736 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
737 AC_DEFUN(STEPMAKE_PATH_PROG, [
738     AC_CHECK_PROGS($1, $2, no)
739     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
740     if test $? -eq 0; then
741         AC_PATH_PROG($1, $2)
742         if test -n "$4"; then
743             STEPMAKE_CHECK_VERSION($1, $3, $4)
744         fi
745     fi
746 ])
747
748
749 # Check for program in set of names ($2), set result to ($1) .
750 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
751 # If exists, and a minimal version ($4) is required
752 AC_DEFUN(STEPMAKE_PROGS, [
753     AC_CHECK_PROGS($1, $2, no)
754     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
755     if test $? -eq 0 -a -n "$4"; then
756         STEPMAKE_CHECK_VERSION($1, $3, $4)
757     fi
758 ])
759
760
761 AC_DEFUN(STEPMAKE_PERL, [
762     STEPMAKE_PATH_PROG(PERL, perl, $1)
763 ])
764
765
766 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
767     AC_HAVE_HEADERS(python2.2/Python.h python2.1/Python.h python2.0/Python.h python2/Python.h python/Python.h python1.5/Python.h Python.h, PYTHON_HEADER=yes)
768     if test -z "$PYTHON_HEADER"; then
769         warn='python.h (python-devel, python-dev or libpython-dev package)'
770         STEPMAKE_ADD_ENTRY($1, $warn)
771     fi
772 ])
773
774
775 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
776     AC_ARG_ENABLE(tfm-path,
777     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
778                             esp.: cmr10.tfm.  Default: use kpsewhich],
779     [tfm_path=$enableval],
780     [tfm_path=auto] )
781
782     # ugh
783     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
784     AC_MSG_CHECKING(for tfm path)
785
786     TFM_FONTS="cmr msam"
787
788     if test "x$tfm_path" = xauto ; then
789         if test "x$KPSEWHICH" != "xno" ; then
790             for i in $TFM_FONTS; do
791                 dir=`$KPSEWHICH tfm ${i}10.tfm`
792                 TFM_PATH="$TFM_PATH `dirname $dir`"
793             done
794         else
795             STEPMAKE_WARN(Please specify where cmr10.tfm lives:
796     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
797         fi
798     else
799          TFM_PATH=$tfm_path
800     fi
801
802     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
803     AC_MSG_RESULT($TFM_PATH)
804     AC_SUBST(TFM_PATH)
805 ])
806
807
808 AC_DEFUN(STEPMAKE_TEXMF, [
809     # urg, never know what names these teTeX guys will think up
810
811     STEPMAKE_PROGS(METAFONT, mf mfont, $1)
812     STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1)
813
814     AC_MSG_CHECKING(for working metafont mode)
815     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
816     for MFMODE in $modelist; do
817         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
818         if test -f mfput.tfm; then
819             break;
820         fi
821     done
822     AC_MSG_RESULT($MFMODE)
823
824     rm -f mfput.*
825
826     AC_SUBST(MFMODE)
827 ])
828
829
830 AC_DEFUN(STEPMAKE_WARN, [
831     AC_MSG_WARN($1)
832     warn_b=yes
833 ])
834
835