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