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