1 dnl aclocal.m4 -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
5 ### mostly interal macros
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 -n 1 | awk '{print $NF}'
18 # Get version string from executable ($1)
19 AC_DEFUN(STEPMAKE_GET_VERSION, [
20 ## "$1" --version 2>&1 | grep -v '^$' | head -n 1 | awk '{print $NF}'
23 ## Workaround for broken Debian gcc version string:
24 ## gcc (GCC) 3.1.1 20020606 (Debian prerelease)
26 ## -V: Workaround for python
28 changequote(<<, >>)dnl
30 ## Assume and hunt for dotted version multiplet.
31 ## use eval trickery, because we cannot use multi-level $() instead of ``
32 ## for compatibility reasons.
33 ## FIXME: what systems still do not have $() in /bin/sh?
34 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \
36 | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
37 -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
38 if test -z "$_ver"; then
39 ## If empty, try date [fontforge]
40 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
42 | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
49 # Calculate simplistic numeric version from version string ($1)
50 # As yet, we have no need for something more elaborate.
51 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
54 if ([$]3) {three = [$]3}
57 {printf "%d\n", [$]1*1000000 + [$]2*1000 + three}'
61 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
62 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
63 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
66 # Check if tested program ($2) was found ($1).
67 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
68 # We could abort here if a 'REQUIRED' program is not found
69 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
70 STEPMAKE_CHECK_SEARCH_RESULT($1)
71 if test $? -ne 0; then
72 STEPMAKE_ADD_ENTRY($3, $2)
73 if test "$3" = "REQUIRED"; then
74 command="echo ERROR: $2 not found"
75 # abort configure process here?
77 command="- echo $2 not found"
87 # Return if tested proram ($1) was found (true) or not (false).
88 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
89 r="`eval echo '$'"$1"`"
90 if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
93 ##STEPMAKE_WARN(cannot find $2. $3)
99 # Check version of program ($1)
100 # If version ($4: optional argument, supply if version cannot be
101 # parsed using --version or -V ) is smaller than requested ($3), add
102 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
103 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
104 r="`eval echo '$'"$1"`"
105 AC_MSG_CHECKING([$r version])
106 exe=`STEPMAKE_GET_EXECUTABLE($r)`
107 if test -n "$4"; then
110 ver=`STEPMAKE_GET_VERSION($exe)`
112 num=`STEPMAKE_NUMERIC_VERSION($ver)`
113 req=`STEPMAKE_NUMERIC_VERSION($3)`
114 AC_MSG_RESULT([$ver])
115 if test "$num" -lt "$req"; then
116 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
118 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
119 eval `echo $vervar=$num`
120 ## AC_SUBST(`eval echo $vervar`)
123 # Check version of program ($1)
124 # If version is greater than or equals unsupported ($3),
125 # add entry to unsupported list ($2, 'UNSUPPORTED')
126 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
127 r="`eval echo '$'"$1"`"
128 AC_MSG_CHECKING([$r version])
129 exe=`STEPMAKE_GET_EXECUTABLE($r)`
130 ver=`STEPMAKE_GET_VERSION($exe)`
131 num=`STEPMAKE_NUMERIC_VERSION($ver)`
132 sup=`STEPMAKE_NUMERIC_VERSION($3)`
133 AC_MSG_RESULT([$ver])
134 if test "$num" -ge "$sup"; then
135 STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
139 ### Macros to build configure.in
142 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
143 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
144 if test "$BIBTEX2HTML" = "bib2html"; then
145 BIBTEX2HTML_FLAGS='$< $(@)'
147 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
149 AC_SUBST(BIBTEX2HTML)
150 AC_SUBST(BIBTEX2HTML_FLAGS)
154 AC_DEFUN(STEPMAKE_BISON, [
155 # ugh, automake: we want (and check for) bison
158 STEPMAKE_PROGS(BISON, bison, $1)
160 # urg. should test functionality rather than version.
161 if test "$BISON" = "bison" -a -n "$2"; then
162 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
167 AC_DEFUN(STEPMAKE_COMPILE, [
168 # -O is necessary to get inlining
170 CXXFLAGS=${CXXFLAGS-$CFLAGS}
171 LDFLAGS=${LDFLAGS-""}
178 AC_ARG_ENABLE(checking,
179 [ --enable-checking set runtime checks (assert calls). Default: on],
180 [checking_b=$enableval] )
182 AC_ARG_ENABLE(debugging,
183 [ --enable-debugging compile with debugging info. Default: on],
184 [debug_b=$enableval])
186 AC_ARG_ENABLE(optimising,
187 [ --enable-optimising compile with optimising. Default: on],
188 [optimise_b=$enableval])
190 AC_ARG_ENABLE(profiling,
191 [ --enable-profiling compile with gprof support. Default: off],
192 [profile_b=$enableval])
195 [ --enable-pipe compile with -pipe. Default: on],
198 if test "$checking_b" = no; then
201 DEFINES="$DEFINES -DNDEBUG"
204 if test "$optimise_b" = yes; then
205 OPTIMIZE="-O2 -finline-functions"
208 if test $profile_b = yes; then
210 OPTIMIZE="$OPTIMIZE -pg"
213 if test $debug_b = yes; then
214 OPTIMIZE="$OPTIMIZE -g"
218 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
222 # If -pipe requested, test if it works and add to CFLAGS.
223 if test "$pipe_b" = yes; then
224 save_cflags="$CFLAGS"
225 CFLAGS="-pipe $CFLAGS";
226 AC_CACHE_CHECK([whether compiler understands -pipe],
227 [stepmake_cflags_pipe],
228 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
229 [stepmake_cflags_pipe=yes],
230 [stepmake_cflags_pipe=no]))
232 if test $stepmake_cflags_pipe = yes; then
233 OPTIMIZE="$OPTIMIZE -pipe"
237 CFLAGS="$CFLAGS $OPTIMIZE"
238 CPPFLAGS=${CPPFLAGS-""}
240 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
241 save_cflags="$CFLAGS"
244 dnl should do compile test?
245 AC_MSG_RESULT(-mieee)
246 CFLAGS="-mieee $CFLAGS"
249 AC_MSG_RESULT([none])
253 AC_SUBST(cross_compiling)
260 AC_SUBST(EXTRA_LIBES)
263 AC_DEFUN(STEPMAKE_CXX, [
266 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
268 CPPFLAGS="$CPPFLAGS $DEFINES"
269 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
270 LDFLAGS="$LDFLAGS $EXTRA_LIBES"
279 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
280 AC_CACHE_CHECK([whether explicit instantiation is needed],
281 lily_cv_need_explicit_instantiation,
282 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
283 template <class T> struct foo { static int baz; };
284 template <class T> int foo<T>::baz = 1;
285 ]], [[ return foo<int>::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes]))
286 if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
287 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
292 AC_DEFUN(STEPMAKE_DATADIR, [
293 if test "$datadir" = "\${prefix}/share"; then
294 datadir='${prefix}/share'
297 if test "$prefix" = "NONE"; then
298 presome=${ac_default_prefix}
301 build_package_datadir=$ugh_ugh_autoconf250_builddir/share/$package
303 DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"`
304 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
307 AC_SUBST(build_package_datadir)
308 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
309 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
312 ## ugh: cut & paste programming from datadir.
313 AC_DEFUN(STEPMAKE_LIBDIR, [
315 if test "$libdir" = "\${exec_prefix}/lib"; then
316 libdir='${exec_prefix}/lib'
319 build_package_libdir=$ugh_ugh_autoconf250_builddir/lib/$package
321 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
322 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
325 AC_SUBST(build_package_libdir)
326 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
327 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
331 AC_DEFUN(STEPMAKE_END, [
335 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
338 if test -n "$OPTIONAL"; then
340 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
343 if test -n "$REQUIRED"; then
345 echo "ERROR: Please install required programs: $REQUIRED"
348 if test -n "$UNSUPPORTED"; then
350 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
353 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
355 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
356 if test -f config.cache ; then
357 echo "Remove config.cache before rerunning ./configure"
361 if test -n "$REQUIRED$UNSUPPORTED"; then
362 rm -f $srcdir/GNUmakefile
366 # regular in-place build
367 # test for srcdir_build = yes ?
368 if test "$srcdir_build" = "yes"; then
369 rm -f $srcdir/GNUmakefile
370 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
371 chmod 444 $srcdir/GNUmakefile
372 else # --srcdir build
374 cp $srcdir/make/srcdir.make.in GNUmakefile
375 chmod 444 GNUmakefile
380 AC_DEFUN(STEPMAKE_FLEX, [
381 # ugh, automake: we want (and check for) flex
383 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
387 ac_cv_prog_lex_root=lex.yy
388 STEPMAKE_PROGS(FLEX, flex, $1)
392 AC_DEFUN(STEPMAKE_FLEXLEXER, [
393 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
394 if test $? -ne 0; then
395 warn='FlexLexer.h (flex package)'
396 STEPMAKE_ADD_ENTRY($1, $warn)
398 # check for yyFlexLexer.yy_current_buffer,
399 # in 2.5.4 <= flex < 2.5.29
401 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
402 [stepmake_flexlexer_yy_current_buffer],
403 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
405 #include <FlexLexer.h>
406 class yy_flex_lexer: public yyFlexLexer
411 yy_current_buffer = 0;
415 [stepmake_flexlexer_yy_current_buffer=yes],
416 [stepmake_flexlexer_yy_current_buffer=no]))
417 if test $stepmake_flexlexer_yy_current_buffer = yes; then
418 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
424 AC_DEFUN(STEPMAKE_GCC, [
425 if test "$GCC" = "yes"; then
426 STEPMAKE_CHECK_VERSION(CC, $1, $2)
428 warn="$CC (Please install *GNU* cc)"
429 STEPMAKE_ADD_ENTRY($1, $warn)
433 AC_DEFUN(STEPMAKE_GETTEXT, [
435 if test "$prefix" = "NONE"; then
436 presome=${ac_default_prefix}
438 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
441 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
442 # ouch. autoconf <= 2.57's gettext check fails for
443 # g++ >= 3.3 (with -std=gnu++98, the default).
444 # While the check is OK for g++ -std=c++98,
445 # LilyPond needs GNU g++, so who is to blame here?
446 # Use a workaround until this is resolved:
447 # for g++ >= 3.3, select C language.
449 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
450 if test -n "$GCC_UNSUPPORTED"; then
451 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
452 AC_MSG_WARN([Trying gcc, cross fingers.])
455 AC_CHECK_LIB(intl, gettext)
456 AC_CHECK_FUNCS(gettext)
457 if test -n "$GCC_UNSUPPORTED"; then
463 AC_DEFUN(STEPMAKE_GUILE, [
464 STEPMAKE_PATH_PROG(GUILE, guile, $1)
468 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
470 # This macro runs the guile-config script, installed with Guile,
471 # to find out where Guile's header files and libraries are
472 # installed. It sets two variables, marked for substitution, as
475 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
476 # code that uses Guile header files. This is almost
477 # always just a -I flag.
479 # GUILE_LDFLAGS --- flags to pass to the linker to link a
480 # program against Guile. This includes -lguile for
481 # the Guile library itself, any libraries that Guile
482 # itself requires (like -lqthreads), and so on. It may
483 # also include a -L flag to tell the compiler where to
484 # find the libraries.
486 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
487 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
488 if test -x $exe; then
489 AC_MSG_CHECKING([guile compile flags])
490 GUILE_CFLAGS="`$guile_config compile`"
491 AC_MSG_RESULT($GUILE_CFLAGS)
492 AC_MSG_CHECKING([guile link flags])
493 GUILE_LDFLAGS="`$guile_config link`"
494 AC_MSG_RESULT($GUILE_LDFLAGS)
496 AC_SUBST(GUILE_CFLAGS)
497 AC_SUBST(GUILE_LDFLAGS)
501 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
502 ## First, let's just see if we can find Guile at all.
503 AC_MSG_CHECKING([for guile-config])
504 for guile_config in $GUILE_CONFIG guile-config $target-guile-config $build-guile-config; do
505 AC_MSG_RESULT([$guile_config])
506 if ! $guile_config --version > /dev/null 2>&1 ; then
507 AC_MSG_WARN([cannot execute $guile_config])
508 AC_MSG_CHECKING([if we are cross compiling])
509 GUILE_CONFIG='echo no guile-config'
511 GUILE_CONFIG=$guile_config
515 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
516 if test $? -ne 0; then
517 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
520 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
521 # urg. should test functionality rather than version.
522 if test $? -eq 0 -a -n "$2"; then
523 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
526 AC_SUBST(GUILE_CONFIG)
529 changequote(<<, >>)dnl
530 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
531 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
532 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
535 save_CPPFLAGS="$CPPFLAGS"
537 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
538 LIBS="$GUILE_LDFLAGS $LIBS"
539 AC_CHECK_HEADERS([libguile.h])
540 AC_CHECK_LIB(guile, scm_boot_guile)
541 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
542 if test "$libguile_b" = "no"; then
543 warn='libguile (libguile-dev, guile-devel or guile-dev
545 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
547 CPPFLAGS="$save_CPPFLAGS"
549 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
550 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
551 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
555 AC_DEFUN(STEPMAKE_GXX, [
556 if test "$GXX" = "yes"; then
557 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
559 warn="$CXX (Please install *GNU* c++)"
560 STEPMAKE_ADD_ENTRY($1, $warn)
565 AC_DEFUN(STEPMAKE_INIT, [
569 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
570 if test x$MY_PATCH_LEVEL != x; then
571 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
574 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
575 changequote(<<, >>)dnl
576 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
577 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
580 # No versioning on directory names of sub-packages
582 stepmake=${datadir}/stepmake
584 if test "$prefix" = "NONE"; then
585 presome=${ac_default_prefix}
587 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
589 # urg, how is this supposed to work?
590 if test "$program_prefix" = "NONE"; then
593 if test "$program_suffix" = "NONE"; then
597 AC_MSG_CHECKING(Package)
598 if test "$PACKAGE" = "STEPMAKE"; then
599 AC_MSG_RESULT(Stepmake package!)
601 AC_MSG_CHECKING(builddir)
603 ugh_ugh_autoconf250_builddir="`pwd`"
605 if test "$srcdir" = "."; then
609 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
610 package_srcdir="`dirname $srcdir`"
612 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
614 (cd stepmake 2>/dev/null || mkdir stepmake)
615 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
616 # only possible with autoconf < 2.50 -- hardcoded in configure.in
617 # AC_CONFIG_AUX_DIR(bin)
620 AC_MSG_RESULT($PACKAGE)
622 AC_MSG_CHECKING(builddir)
623 ugh_ugh_autoconf250_builddir="`pwd`"
624 if test "$srcdir" = "."; then
629 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
631 AC_MSG_CHECKING(for stepmake)
632 # Check for installed stepmake
633 if test -d $stepmake; then
634 AC_MSG_RESULT($stepmake)
636 stepmake="`cd $srcdir/stepmake; pwd`"
637 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
640 # only possible with autoconf < 2.50 -- hardcoded in configure.in
641 # AC_CONFIG_AUX_DIR(\
643 # $srcdir/stepmake/bin\
647 AC_SUBST(ugh_ugh_autoconf250_builddir)
651 AC_SUBST(PACKAGE_NAME)
652 # We don't need the upper case variant,
653 # so stick to macros are uppercase convention.
654 # AC_DEFINE_UNQUOTED(package, ["${package}"])
655 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
656 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
657 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
658 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
660 if test -z "$package_depth"; then
663 package_depth="../$package_depth"
666 AC_SUBST(package_depth)
668 AUTOGENERATE="This file was automatically generated by configure"
669 AC_SUBST(AUTOGENERATE)
672 AC_ARG_ENABLE(config,
673 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
674 do \`make conf=CONF' to get output in ./out-CONF],
675 [CONFIGURATION=$enableval])
679 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
680 CONFIGFILE=config$CONFIGSUFFIX
681 AC_SUBST(CONFIGSUFFIX)
684 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
685 STEPMAKE_PROGS(FIND, find, REQUIRED)
687 STEPMAKE_PROGS(TAR, tar, REQUIRED)
689 if test "$(echo 2)" != "2" ||
690 test "x`uname`" = "xHP-UX"; then
691 AC_PATH_PROG(KSH, ksh, /bin/ksh)
692 AC_PATH_PROG(BASH, bash, $KSH)
693 STEPMAKE_WARN(avoiding buggy /bin/sh)
694 AC_PATH_PROG(SHELL, bash, $KSH)
697 AC_PATH_PROG(BASH, bash, $SHELL)
701 STEPMAKE_PYTHON(REQUIRED, 1.5)
703 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
704 $MAKE -v 2> /dev/null | grep GNU > /dev/null
705 if test "$?" = 1; then
706 warn='make (Please install *GNU* make)'
707 # STEPMAKE_WARN($warn)
708 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
712 if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
713 LN=cp # hard link does not work under cygnus-nt
714 LN_S='cp -r' # symbolic link does not work for native nt
720 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
728 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
730 AC_SUBST(program_prefix)
731 AC_SUBST(program_suffix)
736 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
737 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
747 AC_DEFUN(STEPMAKE_KPATHSEA, [
749 AC_ARG_WITH(kpathsea-include,
750 [ --with-kpathsea-include=DIR
751 location of the kpathsea include dir],[
752 if test "$withval" = "yes" -o "$withval" = "no"; then
753 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
755 CPPFLAGS="$CPPFLAGS -I${withval}"
759 AC_ARG_WITH(kpathsea-lib,
760 [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
761 if test "$withval" = "yes" -o "$withval" = "no"; then
762 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
764 LDFLAGS="$LDFLAGS -L${withval}"
769 #FIXME --with-xxx is meant for specifying a PATH too,
770 # so this should read: --enable-kpathsea,
771 # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
772 AC_ARG_WITH(kpathsea,
773 [ --with-kpathsea use kpathsea lib. Default: on],
774 [kpathsea_b=$with_kpathsea])
776 if test "$kpathsea_b" != "no"; then
777 AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
778 AC_CHECK_LIB(kpathsea, kpse_find_file)
779 AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
780 if test "$kpathsea_b" = "no"; then
781 warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel
783 Else, please specify the directories where kpathsea/kpathsea.h and
784 libkpathsea.a are installed using --with-kpathsea-include and
785 --with-kpathsea-lib options. You should install kpathsea; see
786 INSTALL.txt. Rerun ./configure --without-kpathsea only if kpathsea
787 is not available for your platform.'
788 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
791 AC_MSG_CHECKING(whether to use kpathsea)
792 if test "$kpathsea_b" != no; then
801 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
805 AC_DEFUN(STEPMAKE_LIB, [
806 STEPMAKE_PROGS(AR, ar, $1)
808 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
812 AC_DEFUN(STEPMAKE_LIBTOOL, [
814 # **Never** try to set library version numbers so that they correspond
815 # to the release number of your package. This is an abuse that only
816 # fosters misunderstanding of the purpose of library versions.
818 REVISION=$PATCH_LEVEL
819 # CURRENT=$MINOR_VERSION
820 CURRENT=`expr $MINOR_VERSION + 1`
821 # AGE=`expr $MAJOR_VERSION + 1`
829 AC_DEFUN(STEPMAKE_LOCALE, [
834 AC_ARG_WITH(localedir,
835 [ --with-localedir=LOCALE use LOCALE as locale dir. Default:
836 PREFIX/share/locale ],
837 localedir=$with_localedir,
838 localedir='${prefix}/share/locale')
841 [ --with-lang=LANG use LANG as language to emit messages],
845 AC_MSG_CHECKING(language)
847 En* | en* | Am* | am* | US* | us*)
849 NL | nl | Du* | du* | Ned* | ned*)
858 if test "$lang" = "unknown" ; then
859 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
865 AC_DEFUN(STEPMAKE_MAKEINFO, [
866 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
867 if test "$MAKEINFO" = "makeinfo"; then
868 AC_MSG_CHECKING(whether makeinfo can split html by @node)
870 makeinfo --html --output=out/split <<EOF
872 \input texinfo @c -*-texinfo-*-
873 @setfilename split.info
877 if test -d out/split; then
878 SPLITTING_MAKEINFO=yes
883 STEPMAKE_WARN(your html documentation will be one large file)
887 AC_SUBST(SPLITTING_MAKEINFO)
892 AC_DEFUN(STEPMAKE_MAN, [
893 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
895 STEPMAKE_PROGS(TROFF, troff, $1)
897 STEPMAKE_PROGS(TBL, tbl, $1)
902 AC_DEFUN(STEPMAKE_MSGFMT, [
903 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
907 # Check for program ($2), set full path result to ($1).
908 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
909 AC_DEFUN(STEPMAKE_PATH_PROG, [
910 AC_CHECK_PROGS($1, $2, no)
911 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
912 if test $? -eq 0; then
914 if test -n "$4"; then
915 STEPMAKE_CHECK_VERSION($1, $3, $4)
921 # Check for program in set of names ($2), set result to ($1) .
922 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
923 # If exists, and a minimal version ($4) is required
924 AC_DEFUN(STEPMAKE_PROGS, [
925 AC_CHECK_PROGS($1, $2, no)
926 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
927 if test $? -eq 0 -a -n "$4"; then
928 STEPMAKE_CHECK_VERSION($1, $3, $4)
933 AC_DEFUN(STEPMAKE_PERL, [
934 STEPMAKE_PATH_PROG(PERL, perl, $1)
938 AC_DEFUN(STEPMAKE_PYTHON, [
940 AC_MSG_CHECKING([for python])
941 for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
942 AC_MSG_RESULT([$python])
943 if ! $python -V > /dev/null 2>&1 ; then
944 #AC_MSG_WARN([cannot execute $python])
945 PYTHON='echo no python'
948 STEPMAKE_CHECK_VERSION(python, pv, $2)
949 if test -z "$pv"; then
955 if test -n "$pv"; then
956 STEPMAKE_ADD_ENTRY($1, $pv)
958 AC_PATH_PROG(PYTHON, $PYTHON)
962 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
963 unset PYTHON_HEADER PYTHON_INCLUDE
964 if test -n "$PYTHON"; then
965 changequote(<<, >>)dnl
966 # alternatively, for python >= 2.0
967 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
968 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
972 ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
973 if test -z "$PYTHON_HEADER"; then
974 #URG -- how to extend include path?
975 ac_compile="$ac_compile -I$PYTHON_INCLUDE"
976 ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
977 CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
978 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
981 if test -z "$PYTHON_HEADER"; then
982 warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
983 STEPMAKE_ADD_ENTRY($1, $warn)
988 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
989 AC_ARG_ENABLE(tfm-path,
990 [ --enable-tfm-path=PATH set path of tex directories where tfm files live,
991 esp.: cmr10.tfm. Default: use kpsewhich],
992 [tfm_path=$enableval],
996 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
997 AC_MSG_CHECKING(for tfm path)
1001 if test "x$tfm_path" = xauto ; then
1002 if test "x$KPSEWHICH" != "xno" ; then
1003 for i in $TFM_FONTS; do
1004 dir=`$KPSEWHICH tfm ${i}10.tfm`
1005 TFM_PATH="$TFM_PATH `dirname $dir`"
1008 STEPMAKE_WARN(Please specify where cmr10.tfm lives:
1009 ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
1015 TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
1016 AC_MSG_RESULT($TFM_PATH)
1021 AC_DEFUN(STEPMAKE_TEXMF, [
1022 # urg, never know what names these teTeX guys will think up
1024 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1025 STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1)
1027 AC_MSG_CHECKING(for working metafont mode)
1028 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1029 for MFMODE in $modelist; do
1030 $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1031 if test -f mfput.tfm; then
1035 AC_MSG_RESULT($MFMODE)
1043 AC_DEFUN(STEPMAKE_WARN, [
1049 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1050 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1051 dnl also defines GSTUFF_PKG_ERRORS on error
1052 AC_DEFUN(PKG_CHECK_MODULES, [
1055 if test -z "$PKG_CONFIG"; then
1056 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1059 if test "$PKG_CONFIG" = "no" ; then
1060 echo "*** The pkg-config script could not be found. Make sure it is"
1061 echo "*** in your path, or set the PKG_CONFIG environment variable"
1062 echo "*** to the full path to pkg-config."
1063 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1065 PKG_CONFIG_MIN_VERSION=0.9.0
1066 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1067 AC_MSG_CHECKING(for $2)
1069 if $PKG_CONFIG --exists "$2" ; then
1073 AC_MSG_CHECKING($1_CFLAGS)
1074 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1075 AC_MSG_RESULT($$1_CFLAGS)
1077 AC_MSG_CHECKING($1_LIBS)
1078 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1079 AC_MSG_RESULT($$1_LIBS)
1083 ## If we have a custom action on failure, don't print errors, but
1084 ## do set a variable so people can do so.
1085 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1086 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1092 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1093 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1097 if test $succeeded = yes; then
1098 ifelse([$3], , :, [$3])
1100 ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
1105 AC_DEFUN(STEPMAKE_FREETYPE2, [
1106 PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true)
1107 if $have_freetype2 ; then
1108 AC_DEFINE(HAVE_FREETYPE2)
1109 AC_SUBST(FREETYPE2_CFLAGS)
1110 AC_SUBST(FREETYPE2_LIBS)
1114 AC_DEFUN(STEPMAKE_GTK2, [
1115 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true)
1116 if $have_gtk2 ; then
1117 AC_DEFINE(HAVE_GTK2)
1118 AC_SUBST(GTK2_CFLAGS)
1123 AC_DEFUN(STEPMAKE_PANGO, [
1124 PKG_CHECK_MODULES(PANGO, pango >= 1.6.0, have_pango16=true, true)
1125 if $have_pango16 ; then
1126 AC_DEFINE(HAVE_PANGO16)
1127 PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
1128 PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
1129 CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1130 LIBS="$PANGO_LIBS $LIBS"
1131 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1132 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1133 AC_SUBST(PANGO_CFLAGS)
1134 AC_SUBST(PANGO_LIBS)
1139 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1140 PKG_CHECK_MODULES(PANGO_FT2, pangoft2 >= 1.6.0, have_pangoft2=true, true)
1141 if $have_pangoft2 ; then
1142 AC_DEFINE(HAVE_PANGO_FT2)
1143 PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
1144 PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
1145 CPPFLAGS="$PANGO_FT2_CFLAGS $CPPFLAGS"
1146 LIBS="$PANGO_FT2_LIBS $LIBS"
1147 AC_CHECK_HEADERS([pango/pangoft2.h])
1148 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1149 AC_SUBST(PANGO_FT2_CFLAGS)
1150 AC_SUBST(PANGO_FT2_LIBS)