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