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