]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/aclocal.m4
* autogen.sh: Generate.
[lilypond.git] / stepmake / 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         ##STEPMAKE_WARN(cannot find $2. $3)
60         false
61     else
62         true
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
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     dnl yeah, so fuck me gently with a cactus: this doesnt belong here
235     dnl Please take the person responsible for inventing shell-scripts out
236     dnl and shoot him. On behalf of the sane world, thank you.
237     dnl DIR_SHAREDSTATEDIR="foobar"
238     dnl AC_SUBST(DIR_SHAREDSTATEDIR)
239     
240     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
241 ])
242
243
244 AC_DEFUN(STEPMAKE_END, [
245     AC_SUBST(OPTIONAL)
246     AC_SUBST(REQUIRED)
247     
248     AC_OUTPUT($CONFIGFILE.make:config.make.in)
249
250     
251     if test -n "$OPTIONAL"; then
252         echo
253         echo "WARNING: Please consider installing optional programs: $OPTIONAL"
254     fi
255
256     if test -n "$REQUIRED"; then
257         echo
258         echo "ERROR: Please install required programs: $REQUIRED"
259     fi
260     
261     if test -n "$OPTIONAL$REQUIRED"; then
262         echo
263         echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
264         echo "Remove config.cache before rerunning ./configure"
265     fi
266     
267     if test -n "$REQUIRED"; then
268         rm -f $srcdir/GNUmakefile
269         exit 1
270     fi
271
272     # regular in-place build
273     # test for srcdir_build = yes ?
274     if test "$builddir" = "."; then
275         rm -f $srcdir/GNUmakefile
276         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
277         chmod 444 $srcdir/GNUmakefile
278     else # --srcdir build
279         rm -f GNUmakefile
280         cp $srcdir/make/srcdir.make.in GNUmakefile
281         chmod 444 GNUmakefile
282     fi
283 ])
284
285
286 AC_DEFUN(STEPMAKE_FLEX, [
287     # ugh, automake: we want (and check for) flex
288     # AC_PROG_LEX
289     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
290
291     # AC_DECL_YYTEXT
292     # ugh, ugh
293     ac_cv_prog_lex_root=lex.yy
294     STEPMAKE_PROGS(FLEX, flex, $1)
295 ])
296
297
298 AC_DEFUN(STEPMAKE_FLEXLEXER, [
299     AC_HAVE_HEADERS(FlexLexer.h, true, false)
300     if test $? -ne 0; then
301         warn='FlexLexer.h (flex package)'
302         STEPMAKE_ADD_ENTRY($1, $warn)
303     fi
304 ])
305
306
307 AC_DEFUN(STEPMAKE_GCC, [
308     if test "$GCC" = "yes"; then
309         STEPMAKE_CHECK_VERSION(CC, $1, $2)
310     else
311         warn="$CC (Please install *GNU* cc)"
312         STEPMAKE_ADD_ENTRY($1, $warn)
313     fi
314 ])
315
316
317 AC_DEFUN(STEPMAKE_GETTEXT, [
318     DIR_LOCALEDIR=${localedir}
319     presome=${prefix}
320     if test "$prefix" = "NONE"; then
321             presome=${ac_default_prefix}
322     fi
323     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
324     AC_SUBST(localedir)
325     AC_SUBST(DIR_LOCALEDIR)
326     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
327
328     AC_CHECK_LIB(intl, gettext)
329     AC_CHECK_FUNCS(gettext)
330 ])
331
332
333 AC_DEFUN(STEPMAKE_GUILE, [
334     STEPMAKE_PATH_PROG(GUILE, guile, $1)
335 ])
336
337
338 #   STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
339 #
340 #   This macro runs the guile-config script, installed with Guile,
341 #   to find out where Guile's header files and libraries are
342 #   installed.  It sets two variables, marked for substitution, as
343 #   by AC_SUBST.
344 #   
345 #     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
346 #             code that uses Guile header files.  This is almost
347 #             always just a -I flag.
348 #   
349 #     GUILE_LDFLAGS --- flags to pass to the linker to link a
350 #             program against Guile.  This includes -lguile for
351 #             the Guile library itself, any libraries that Guile
352 #             itself requires (like -lqthreads), and so on.  It may
353 #             also include a -L flag to tell the compiler where to
354 #             find the libraries.
355
356 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
357     exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
358     if test -x $exe; then
359         AC_MSG_CHECKING("guile compile flags")
360         GUILE_CFLAGS="`$guile_config compile`"
361         AC_MSG_RESULT($GUILE_CFLAGS)
362         AC_MSG_CHECKING("guile link flags")
363         GUILE_LDFLAGS="`$guile_config link`"
364         AC_MSG_RESULT($GUILE_LDFLAGS)
365     fi
366     AC_SUBST(GUILE_CFLAGS)
367     AC_SUBST(GUILE_LDFLAGS)
368 ])
369
370
371 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
372     ## First, let's just see if we can find Guile at all.
373     AC_MSG_CHECKING("for guile-config")
374     for guile_config in guile-config $target-guile-config $build-guile-config; do
375         AC_MSG_RESULT("$guile_config")
376         if ! $guile_config --version > /dev/null 2>&1 ; then
377             AC_MSG_WARN("cannot execute $guile_config")
378             AC_MSG_CHECKING("if we are cross compiling")
379             GUILE_CONFIG='echo no guile-config'
380         else
381             GUILE_CONFIG=$guile_config
382             break
383         fi
384     done
385     STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
386     if test $? -ne 0; then
387         STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
388     fi 
389
390     STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
391     # urg.  should test functionality rather than version.
392     if test $? -eq 0 -a -n "$2"; then
393         STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
394     fi
395
396     AC_SUBST(GUILE_CONFIG)
397     
398     guile_version="$ver"
399     changequote(<<, >>)dnl
400     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
401     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
402     changequote([, ])dnl
403     STEPMAKE_GUILE_FLAGS
404     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
405     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
406 ])
407
408
409 AC_DEFUN(STEPMAKE_GXX, [
410     if test "$GXX" = "yes"; then
411         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
412     else
413         warn="$CXX (Please install *GNU* c++)"
414         STEPMAKE_ADD_ENTRY($1, $warn)
415     fi
416 ])
417
418
419 AC_DEFUN(STEPMAKE_INIT, [
420
421     . $srcdir/VERSION
422     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
423     if test x$MY_PATCH_LEVEL != x; then
424         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
425     fi
426
427     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
428     changequote(<<, >>)dnl
429     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
430     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
431     changequote([, ])dnl
432
433     # No versioning on directory names of sub-packages 
434     # urg, urg
435     stepmake=${datadir}/stepmake
436     presome=${prefix}
437     if test "$prefix" = "NONE"; then
438             presome=${ac_default_prefix}
439     fi
440     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
441
442     # urg, how is this supposed to work?
443     if test "$program_prefix" = "NONE"; then
444           program_prefix=
445     fi
446     if test "$program_suffix" = "NONE"; then
447           program_suffix=
448     fi
449
450     AC_MSG_CHECKING(Package)
451     if test "x$PACKAGE" = "xSTEPMAKE"; then
452         AC_MSG_RESULT(Stepmake package!)
453
454         AC_MSG_CHECKING(builddir)
455         if test "$srcdir" = "."; then
456             builddir=.
457         else
458             absolute_builddir="`pwd`"
459             package_absolute_builddir="`dirname $absolute_builddir`"
460             package_srcdir="`dirname  $srcdir`"
461             builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`"
462         fi
463         AC_MSG_RESULT($builddir)
464
465         (cd stepmake 2>/dev/null || mkdir stepmake)
466         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
467         AC_CONFIG_AUX_DIR(bin)
468         stepmake=stepmake
469     else
470         AC_MSG_RESULT($PACKAGE)
471
472         AC_MSG_CHECKING(builddir)
473         if test "$srcdir" = "."; then
474             builddir=.
475             srcdir_build=no
476         else
477             absolute_builddir="`pwd`"
478 #           builddir="`dirname  $srcdir`/`basename $absolute_builddir`"
479             builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`"
480             srcdir_build=yes
481         fi
482         AC_MSG_RESULT($builddir)
483         if expr "$srcdir" : '/' > /dev/null 2>&1; then
484             absolute_srcdir=yes
485             STEPMAKE_WARN(Absolute --srcdir specified: $srcdir)
486         fi
487
488         AC_MSG_CHECKING(for stepmake)
489         # Check for installed stepmake
490         if test -d $stepmake; then
491             AC_MSG_RESULT($stepmake)
492         else
493             if test "$absolute_srcdir" != "yes"; then
494                 stepmake='$(depth)'/$srcdir/stepmake
495             else
496                 stepmake=$srcdir/stepmake
497             fi
498             AC_MSG_RESULT($srcdir/stepmake  ($datadir/stepmake not found))
499         fi
500
501         AC_CONFIG_AUX_DIR(\
502           $HOME/usr/local/share/stepmake/bin\
503           $HOME/usr/local/lib/stepmake/bin\
504           $HOME/usr/share/stepmake/bin\
505           $HOME/usr/lib/stepmake/bin\
506           /usr/local/share/stepmake/bin\
507           /usr/local/lib/stepmake/bin\
508           /usr/share/stepmake/bin\
509           /usr/lib/stepmake/bin\
510           stepmake/bin\
511           $srcdir/stepmake/bin\
512         )
513     fi
514
515     AC_SUBST(builddir)
516     AC_SUBST(stepmake)
517     AC_SUBST(package)
518     AC_SUBST(PACKAGE)
519     AC_SUBST(PACKAGE_NAME)
520     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
521     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
522
523     if test "$package_depth" = "" ; then
524         package_depth="."
525     else
526         package_depth="../$package_depth"
527     fi
528     export package_depth
529     AC_SUBST(package_depth)
530
531     AUTOGENERATE="This file was automatically generated by configure"
532     AC_SUBST(AUTOGENERATE)
533
534     CONFIGSUFFIX=
535     AC_ARG_ENABLE(config,
536     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
537                             do \`make conf=CONF' to get output in ./out-CONF],
538     [CONFIGURATION=$enableval])
539
540     ##'
541
542     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
543     CONFIGFILE=config$CONFIGSUFFIX
544     AC_SUBST(CONFIGSUFFIX)
545      
546     AC_CANONICAL_HOST
547     STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
548     STEPMAKE_PROGS(FIND, find, REQUIRED)
549
550     STEPMAKE_PROGS(TAR, tar, REQUIRED)
551
552     if test "x`uname`" = "xHP-UX"; then
553         AC_PATH_PROG(BASH, bash, /bin/sh)
554         STEPMAKE_WARN(avoiding buggy /bin/sh)
555         AC_PATH_PROG(SHELL, bash, /bin/ksh)
556     else
557         AC_PATH_PROG(BASH, bash, /bin/sh)
558         SHELL=/bin/sh
559         AC_SUBST(SHELL)
560     fi
561
562     STEPMAKE_PATH_PROG(PYTHON, python, REQUIRED)
563
564     if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
565         $MAKE -v 2> /dev/null | grep GNU > /dev/null
566         if test "$?" = 1; then
567             warn='make (Please install *GNU* make)'
568             # STEPMAKE_WARN($warn)
569             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
570         fi
571     fi 
572
573     if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
574         LN=cp # hard link does not work under cygnus-nt
575         LN_S='cp -r' # symbolic link does not work for native nt
576         ZIP="zip -r -9" #
577         program_suffix=.exe
578         ROOTSEP=':'
579         DIRSEP='/'
580         PATHSEP=':'
581         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
582     else
583         ROOTSEP=':'
584         DIRSEP='/'
585         PATHSEP=':'
586         LN=ln
587         LN_S='ln -s'
588         ZIP="zip -r -9"
589         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
590     fi
591     AC_SUBST(program_prefix)
592     AC_SUBST(program_suffix)
593     AC_SUBST(ZIP)
594     AC_SUBST(LN)
595     AC_SUBST(LN_S)
596     AC_SUBST(INSTALL)
597     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
598     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
599     AC_SUBST(PATHSEP)
600     AC_SUBST(DIRSEP)
601   
602     STEPMAKE_DATADIR
603 ])
604
605
606 AC_DEFUN(STEPMAKE_KPATHSEA, [
607
608     kpathsea_b=yes
609     #FIXME --with-xxx is meant for specifying a PATH too,
610     # so this should read: --enable-kpathsea,
611     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
612     AC_ARG_WITH(kpathsea,
613     [  --with-kpathsea         use kpathsea lib.  Default: on],
614     [kpathsea_b=$with_kpathsea])
615
616     if test "$kpathsea_b" != "no"; then 
617         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
618         AC_CHECK_LIB(kpathsea, kpse_find_file)
619         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.))
620     fi
621     AC_MSG_CHECKING(whether to use kpathsea)
622     if test "$kpathsea_b" != no; then
623         AC_MSG_RESULT(yes)
624         KPATHSEA=1
625     else
626         AC_MSG_RESULT(no)
627         KPATHSEA=0
628     fi
629
630     AC_SUBST(KPATHSEA)
631     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
632 ])
633
634
635 AC_DEFUN(STEPMAKE_LIB, [
636     STEPMAKE_PROGS(AR, ar, $1)
637     AC_PROG_RANLIB
638     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
639 ])
640
641
642 AC_DEFUN(STEPMAKE_LIBTOOL, [
643     # libtool.info ...
644     # **Never** try to set library version numbers so that they correspond
645     # to the release number of your package.  This is an abuse that only
646     # fosters misunderstanding of the purpose of library versions.
647
648     REVISION=$PATCH_LEVEL
649     # CURRENT=$MINOR_VERSION
650     CURRENT=`expr $MINOR_VERSION + 1`
651     # AGE=$(expr $MAJOR_VERSION + 1)
652     AGE=$MAJOR_VERSION
653     AC_SUBST(CURRENT)
654     AC_SUBST(REVISION)
655     AC_SUBST(AGE)
656 ])
657
658
659 AC_DEFUN(STEPMAKE_LOCALE, [
660     lang=English
661     ALL_LINGUAS="en nl"
662
663     # with/enable ??
664     AC_ARG_WITH(localedir,
665     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
666                             PREFIX/share/locale ],
667     localedir=$with_localedir,
668     localedir='${prefix}/share/locale')
669
670     AC_ARG_WITH(lang,
671     [  --with-lang=LANG        use LANG as language to emit messages],
672     language=$with_lang,
673     language=English)
674
675     AC_MSG_CHECKING(language)    
676     case "$language" in
677       En* | en* | Am* | am* | US* | us*)
678             lang=English;;
679       NL | nl | Du* | du* | Ned* | ned*)
680             lang=Dutch;;
681       "")
682             lang=English;;
683       *)
684             lang=unknown;;
685     esac
686     AC_MSG_RESULT($lang)
687
688     if test "$lang" = "unknown" ; then
689         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
690     fi
691
692 ])
693
694
695 AC_DEFUN(STEPMAKE_MAKEINFO, [
696     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
697     if test "$MAKEINFO" = "makeinfo"; then
698         AC_MSG_CHECKING(whether makeinfo can split html by @node)
699         mkdir -p out
700         makeinfo --html --output=out/split <<EOF
701 \input texinfo
702 \input texinfo @c -*-texinfo-*-
703 @setfilename split.info
704 @settitle split.info
705 @bye
706 EOF
707         if test -d out/split; then
708             SPLITTING_MAKEINFO=yes
709             AC_MSG_RESULT(yes)
710             rm -rf out/split
711         else
712             AC_MSG_RESULT(no)
713             STEPMAKE_WARN(your html documentation will be one large file)
714             rm -rf out/split
715         fi
716     fi
717     AC_SUBST(SPLITTING_MAKEINFO)
718 ])
719
720
721
722 AC_DEFUN(STEPMAKE_MAN, [
723     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
724     AC_SUBST(GROFF)
725     STEPMAKE_PROGS(TROFF, troff, $1)
726     AC_SUBST(TROFF)
727     STEPMAKE_PROGS(TBL, tbl, $1)
728     AC_SUBST(TBL)
729 ])
730
731
732 AC_DEFUN(STEPMAKE_MSGFMT, [
733     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
734 ])
735
736
737 # Check for program ($2), set full path result to ($1).
738 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
739 AC_DEFUN(STEPMAKE_PATH_PROG, [
740     AC_CHECK_PROGS($1, $2, no)
741     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
742     if test $? -eq 0; then
743         AC_PATH_PROG($1, $2)
744         if test -n "$4"; then
745             STEPMAKE_CHECK_VERSION($1, $3, $4)
746         fi
747     fi
748 ])
749
750
751 # Check for program in set of names ($2), set result to ($1) .
752 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
753 # If exists, and a minimal version ($4) is required
754 AC_DEFUN(STEPMAKE_PROGS, [
755     AC_CHECK_PROGS($1, $2, no)
756     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
757     if test $? -eq 0 -a -n "$4"; then
758         STEPMAKE_CHECK_VERSION($1, $3, $4)
759     fi
760 ])
761
762
763 AC_DEFUN(STEPMAKE_PERL, [
764     STEPMAKE_PATH_PROG(PERL, perl, $1)
765 ])
766
767
768 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
769     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)
770     if test -z "$PYTHON_HEADER"; then
771         warn='python.h (python-devel, python-dev or libpython-dev package)'
772         STEPMAKE_ADD_ENTRY($1, $warn)
773     fi
774 ])
775
776
777 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
778     AC_ARG_ENABLE(tfm-path,
779     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
780                             esp.: cmr10.tfm.  Default: use kpsewhich],
781     [tfm_path=$enableval],
782     [tfm_path=auto] )
783
784     # ugh
785     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
786     AC_MSG_CHECKING(for tfm path)
787
788     TFM_FONTS="cmr msam"
789
790     if test "x$tfm_path" = xauto ; then
791         if test "x$KPSEWHICH" != "xno" ; then
792             for i in $TFM_FONTS; do
793                 dir=`$KPSEWHICH tfm ${i}10.tfm`
794                 TFM_PATH="$TFM_PATH `dirname $dir`"
795             done
796         else
797             STEPMAKE_WARN(Please specify where cmr10.tfm lives:
798     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
799         fi
800     else
801          TFM_PATH=$tfm_path
802     fi
803
804     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
805     AC_MSG_RESULT($TFM_PATH)
806     AC_SUBST(TFM_PATH)
807 ])
808
809
810 AC_DEFUN(STEPMAKE_TEXMF, [
811     # urg, never know what names these teTeX guys will think up
812
813     STEPMAKE_PROGS(METAFONT, mf mfont, $1)
814     STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1)
815
816     AC_MSG_CHECKING(for working metafont mode)
817     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
818     for MFMODE in $modelist; do
819         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
820         if test -f mfput.tfm; then
821             break;
822         fi
823     done
824     AC_MSG_RESULT($MFMODE)
825
826     rm -f mfput.*
827
828     AC_SUBST(MFMODE)
829 ])
830
831
832 AC_DEFUN(STEPMAKE_WARN, [
833     AC_MSG_WARN($1)
834     warn_b=yes
835 ])
836
837