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
29 ## Assume and hunt for dotted version multiplet.
30 ## use eval trickery, because we cannot use multi-level $() instead of ``
31 ## for compatibility reasons.
32 ## FIXME: what systems still do not have $() in /bin/sh?
33 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \
35 | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
36 -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
37 if test -z "$_ver"; then
38 ## If empty, try date [fontforge]
39 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
41 | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
47 # Calculate simplistic numeric version from version string ($1)
48 # As yet, we have no need for something more elaborate.
49 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
52 if ([$]3) {three = [$]3}
55 {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
59 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
60 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
61 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
64 # Check if tested program ($2) was found ($1).
65 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
66 # We could abort here if a 'REQUIRED' program is not found
67 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
68 STEPMAKE_CHECK_SEARCH_RESULT($1)
69 if test $? -ne 0; then
70 STEPMAKE_ADD_ENTRY($3, $2)
71 if test "$3" = "REQUIRED"; then
72 command="echo ERROR: $2 not found"
73 # abort configure process here?
75 command="- echo $2 not found"
85 # Return if tested proram ($1) was found (true) or not (false).
86 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
87 r="`eval echo '$'"$1"`"
88 if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
91 ##STEPMAKE_WARN(cannot find $2. $3)
97 # Check version of program ($1)
98 # If version ($4: optional argument, supply if version cannot be
99 # parsed using --version or -V ) is smaller than requested ($3), add
100 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
101 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
102 r="`eval echo '$'"$1"`"
103 AC_MSG_CHECKING([$r version])
104 exe=`STEPMAKE_GET_EXECUTABLE($r)`
105 if test -n "$4"; then
108 ver=`STEPMAKE_GET_VERSION($exe)`
110 num=`STEPMAKE_NUMERIC_VERSION($ver)`
111 req=`STEPMAKE_NUMERIC_VERSION($3)`
112 AC_MSG_RESULT([$ver])
113 if test "$num" -lt "$req"; then
114 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
116 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
117 eval `echo $vervar=$num`
118 ## AC_SUBST(`eval echo $vervar`)
121 # Check version of program ($1)
122 # If version is greater than or equals unsupported ($3),
123 # add entry to unsupported list ($2, 'UNSUPPORTED')
124 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
125 r="`eval echo '$'"$1"`"
126 AC_MSG_CHECKING([$r version])
127 exe=`STEPMAKE_GET_EXECUTABLE($r)`
128 ver=`STEPMAKE_GET_VERSION($exe)`
129 num=`STEPMAKE_NUMERIC_VERSION($ver)`
130 sup=`STEPMAKE_NUMERIC_VERSION($3)`
131 AC_MSG_RESULT([$ver])
132 if test "$num" -ge "$sup"; then
133 STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
137 ### Macros to build configure.in
140 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
141 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
142 if test "$BIBTEX2HTML" = "bib2html"; then
143 BIBTEX2HTML_FLAGS='$< $(@)'
145 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
147 AC_SUBST(BIBTEX2HTML)
148 AC_SUBST(BIBTEX2HTML_FLAGS)
152 AC_DEFUN(STEPMAKE_BISON, [
153 # ugh, automake: we want (and check for) bison
156 STEPMAKE_PROGS(BISON, bison, $1)
158 # urg. should test functionality rather than version.
159 if test "$BISON" = "bison" -a -n "$2"; then
160 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
165 AC_DEFUN(STEPMAKE_COMPILE, [
166 # -O is necessary to get inlining
168 CXXFLAGS=${CXXFLAGS-$CFLAGS}
169 LDFLAGS=${LDFLAGS-""}
175 AC_ARG_ENABLE(debugging,
176 [ --enable-debugging compile with debugging info. Default: on],
177 [debug_b=$enableval])
179 AC_ARG_ENABLE(optimising,
180 [ --enable-optimising compile with optimising. Default: on],
181 [optimise_b=$enableval])
183 AC_ARG_ENABLE(profiling,
184 [ --enable-profiling compile with gprof support. Default: off],
185 [profile_b=$enableval])
188 [ --enable-pipe compile with -pipe. Default: on],
191 if test "$optimise_b" = yes; then
193 DEFINES="$DEFINES -DNDEBUG"
194 OPTIMIZE="-O2 -finline-functions"
197 if test $profile_b = yes; then
199 OPTIMIZE="$OPTIMIZE -pg"
202 if test $debug_b = yes; then
203 OPTIMIZE="$OPTIMIZE -g"
207 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
211 # If -pipe requested, test if it works and add to CFLAGS.
212 if test "$pipe_b" = yes; then
213 save_cflags="$CFLAGS"
214 CFLAGS="-pipe $CFLAGS";
215 AC_CACHE_CHECK([whether compiler understands -pipe],
216 [stepmake_cflags_pipe],
217 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
218 [stepmake_cflags_pipe=yes],
219 [stepmake_cflags_pipe=no]))
221 if test $stepmake_cflags_pipe = yes; then
222 OPTIMIZE="$OPTIMIZE -pipe"
226 CFLAGS="$CFLAGS $OPTIMIZE"
227 CPPFLAGS=${CPPFLAGS-""}
229 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
230 save_cflags="$CFLAGS"
233 dnl should do compile test?
234 AC_MSG_RESULT(-mieee)
235 CFLAGS="-mieee $CFLAGS"
238 AC_MSG_RESULT([none])
242 AC_SUBST(cross_compiling)
249 AC_SUBST(EXTRA_LIBES)
252 AC_DEFUN(STEPMAKE_CXX, [
255 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
257 CPPFLAGS="$CPPFLAGS $DEFINES"
258 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
259 LDFLAGS="$LDFLAGS $EXTRA_LIBES"
268 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
269 AC_CACHE_CHECK([whether explicit instantiation is needed],
270 lily_cv_need_explicit_instantiation,
271 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
272 template <class T> struct foo { static int baz; };
273 template <class T> int foo<T>::baz = 1;
274 ]], [[ return foo<int>::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes]))
275 if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
276 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
281 AC_DEFUN(STEPMAKE_DATADIR, [
282 if test "$datadir" = "\${prefix}/share"; then
283 datadir='${prefix}/share'
286 if test "$prefix" = "NONE"; then
287 presome=${ac_default_prefix}
290 build_package_datadir=$ugh_ugh_autoconf250_builddir/share/$package
292 DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"`
293 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
296 AC_SUBST(build_package_datadir)
297 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
298 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
301 ## ugh: cut & paste programming from datadir.
302 AC_DEFUN(STEPMAKE_LIBDIR, [
304 if test "$libdir" = "\${exec_prefix}/lib"; then
305 libdir='${exec_prefix}/lib'
308 build_package_libdir=$ugh_ugh_autoconf250_builddir/lib/$package
310 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
311 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
314 AC_SUBST(build_package_libdir)
315 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
316 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
320 AC_DEFUN(STEPMAKE_END, [
324 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
327 if test -n "$OPTIONAL"; then
329 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
332 if test -n "$REQUIRED"; then
334 echo "ERROR: Please install required programs: $REQUIRED"
337 if test -n "$UNSUPPORTED"; then
339 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
342 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
344 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
345 if test -f config.cache ; then
346 echo "Remove config.cache before rerunning ./configure"
350 if test -n "$REQUIRED$UNSUPPORTED"; then
351 rm -f $srcdir/GNUmakefile
355 # regular in-place build
356 # test for srcdir_build = yes ?
357 if test "$srcdir_build" = "yes"; then
358 rm -f $srcdir/GNUmakefile
359 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
360 chmod 444 $srcdir/GNUmakefile
361 else # --srcdir build
363 cp $srcdir/make/srcdir.make.in GNUmakefile
364 chmod 444 GNUmakefile
369 AC_DEFUN(STEPMAKE_FLEX, [
370 # ugh, automake: we want (and check for) flex
372 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
376 ac_cv_prog_lex_root=lex.yy
377 STEPMAKE_PROGS(FLEX, flex, $1)
381 AC_DEFUN(STEPMAKE_FLEXLEXER, [
382 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
383 if test $? -ne 0; then
384 warn='FlexLexer.h (flex package)'
385 STEPMAKE_ADD_ENTRY($1, $warn)
387 # check for yyFlexLexer.yy_current_buffer,
388 # in 2.5.4 <= flex < 2.5.29
390 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
391 [stepmake_flexlexer_yy_current_buffer],
392 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
394 #include <FlexLexer.h>
395 class yy_flex_lexer: public yyFlexLexer
400 yy_current_buffer = 0;
404 [stepmake_flexlexer_yy_current_buffer=yes],
405 [stepmake_flexlexer_yy_current_buffer=no]))
406 if test $stepmake_flexlexer_yy_current_buffer = yes; then
407 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
413 AC_DEFUN(STEPMAKE_GCC, [
414 if test "$GCC" = "yes"; then
415 STEPMAKE_CHECK_VERSION(CC, $1, $2)
417 warn="$CC (Please install *GNU* cc)"
418 STEPMAKE_ADD_ENTRY($1, $warn)
422 AC_DEFUN(STEPMAKE_GETTEXT, [
424 if test "$prefix" = "NONE"; then
425 presome=${ac_default_prefix}
427 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
430 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
431 # ouch. autoconf <= 2.57's gettext check fails for
432 # g++ >= 3.3 (with -std=gnu++98, the default).
433 # While the check is OK for g++ -std=c++98,
434 # LilyPond needs GNU g++, so who is to blame here?
435 # Use a workaround until this is resolved:
436 # for g++ >= 3.3, select C language.
438 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
439 if test -n "$GCC_UNSUPPORTED"; then
440 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
441 AC_MSG_WARN([Trying gcc, cross fingers.])
444 AC_CHECK_LIB(intl, gettext)
445 AC_CHECK_FUNCS(gettext)
446 if test -n "$GCC_UNSUPPORTED"; then
452 AC_DEFUN(STEPMAKE_GUILE, [
453 STEPMAKE_PATH_PROG(GUILE, guile, $1)
457 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
459 # This macro runs the guile-config script, installed with Guile,
460 # to find out where Guile's header files and libraries are
461 # installed. It sets two variables, marked for substitution, as
464 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
465 # code that uses Guile header files. This is almost
466 # always just a -I flag.
468 # GUILE_LDFLAGS --- flags to pass to the linker to link a
469 # program against Guile. This includes -lguile for
470 # the Guile library itself, any libraries that Guile
471 # itself requires (like -lqthreads), and so on. It may
472 # also include a -L flag to tell the compiler where to
473 # find the libraries.
475 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
476 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
477 if test -x $exe; then
478 AC_MSG_CHECKING([guile compile flags])
479 GUILE_CFLAGS="`$guile_config compile`"
480 AC_MSG_RESULT($GUILE_CFLAGS)
481 AC_MSG_CHECKING([guile link flags])
482 GUILE_LDFLAGS="`$guile_config link`"
483 AC_MSG_RESULT($GUILE_LDFLAGS)
485 AC_SUBST(GUILE_CFLAGS)
486 AC_SUBST(GUILE_LDFLAGS)
490 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
491 ## First, let's just see if we can find Guile at all.
492 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
493 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
494 AC_MSG_CHECKING([for guile-config])
495 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
496 AC_MSG_RESULT([$guile_config])
497 if ! $guile_config --version > /dev/null 2>&1 ; then
498 AC_MSG_WARN([cannot execute $guile_config])
499 AC_MSG_CHECKING([if we are cross compiling])
500 GUILE_CONFIG='echo no guile-config'
502 GUILE_CONFIG=$guile_config
506 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
507 if test $? -ne 0; then
508 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
511 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
512 # urg. should test functionality rather than version.
513 if test $? -eq 0 -a -n "$2"; then
514 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
517 AC_SUBST(GUILE_CONFIG)
520 changequote(<<, >>)#dnl
521 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
522 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
523 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
524 changequote([, ])#dnl
526 save_CPPFLAGS="$CPPFLAGS"
528 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
529 LIBS="$GUILE_LDFLAGS $LIBS"
530 AC_CHECK_HEADERS([libguile.h])
531 AC_CHECK_LIB(guile, scm_boot_guile)
532 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
533 if test "$libguile_b" = "no"; then
534 warn='libguile (libguile-dev, guile-devel or guile-dev
536 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
538 CPPFLAGS="$save_CPPFLAGS"
540 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
541 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
542 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
546 AC_DEFUN(STEPMAKE_DLOPEN, [
547 AC_CHECK_LIB(dl, dlopen)
548 AC_CHECK_FUNCS(dlopen)
551 AC_DEFUN(STEPMAKE_GXX, [
552 if test "$GXX" = "yes"; then
553 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
555 warn="$CXX (Please install *GNU* c++)"
556 STEPMAKE_ADD_ENTRY($1, $warn)
561 AC_DEFUN(STEPMAKE_INIT, [
565 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
566 if test x$MY_PATCH_LEVEL != x; then
567 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
569 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
570 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
571 changequote(<<, >>)#dnl
572 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
573 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
574 changequote([, ])#dnl
576 # No versioning on directory names of sub-packages
578 stepmake=${datadir}/stepmake
580 if test "$prefix" = "NONE"; then
581 presome=${ac_default_prefix}
583 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
585 # urg, how is this supposed to work?
586 if test "$program_prefix" = "NONE"; then
589 if test "$program_suffix" = "NONE"; then
593 AC_MSG_CHECKING(Package)
594 if test "$PACKAGE" = "STEPMAKE"; then
595 AC_MSG_RESULT(Stepmake package!)
597 AC_MSG_CHECKING(builddir)
599 ugh_ugh_autoconf250_builddir="`pwd`"
601 if test "$srcdir" = "."; then
605 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
606 package_srcdir="`dirname $srcdir`"
608 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
610 (cd stepmake 2>/dev/null || mkdir stepmake)
611 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
612 # only possible with autoconf < 2.50 -- hardcoded in configure.in
613 # AC_CONFIG_AUX_DIR(bin)
616 AC_MSG_RESULT($PACKAGE)
618 AC_MSG_CHECKING(builddir)
619 ugh_ugh_autoconf250_builddir="`pwd`"
620 if test "$srcdir" = "."; then
625 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
627 AC_MSG_CHECKING(for stepmake)
628 # Check for installed stepmake
629 if test -d $stepmake; then
630 AC_MSG_RESULT($stepmake)
632 stepmake="`cd $srcdir/stepmake; pwd`"
633 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
636 # only possible with autoconf < 2.50 -- hardcoded in configure.in
637 # AC_CONFIG_AUX_DIR(\
639 # $srcdir/stepmake/bin\
643 AC_SUBST(ugh_ugh_autoconf250_builddir)
647 AC_SUBST(PACKAGE_NAME)
648 AC_SUBST(MAJOR_VERSION)
649 AC_SUBST(MINOR_VERSION)
651 # We don't need the upper case variant,
652 # so stick to macros are uppercase convention.
653 # AC_DEFINE_UNQUOTED(package, ["${package}"])
654 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
655 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
656 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
657 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
659 if test -z "$package_depth"; then
662 package_depth="../$package_depth"
665 AC_SUBST(package_depth)
667 AUTOGENERATE="This file was automatically generated by configure"
668 AC_SUBST(AUTOGENERATE)
671 AC_ARG_ENABLE(config,
672 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
673 do \`make conf=CONF' to get output in ./out-CONF],
674 [CONFIGURATION=$enableval])
678 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
679 CONFIGFILE=config$CONFIGSUFFIX
680 AC_SUBST(CONFIGSUFFIX)
683 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
684 STEPMAKE_PROGS(FIND, find, REQUIRED)
686 STEPMAKE_PROGS(TAR, tar, REQUIRED)
688 if test "$(echo 2)" != "2" ||
689 test "x`uname`" = "xHP-UX"; then
690 AC_PATH_PROG(KSH, ksh, /bin/ksh)
691 AC_PATH_PROG(BASH, bash, $KSH)
692 STEPMAKE_WARN(avoiding buggy /bin/sh)
693 AC_PATH_PROG(SHELL, bash, $KSH)
696 AC_PATH_PROG(BASH, bash, $SHELL)
700 STEPMAKE_PYTHON(REQUIRED, 1.5)
702 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
703 $MAKE -v 2> /dev/null | grep GNU > /dev/null
704 if test "$?" = 1; then
705 warn='make (Please install *GNU* make)'
706 # STEPMAKE_WARN($warn)
707 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
717 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
719 AC_SUBST(program_prefix)
720 AC_SUBST(program_suffix)
725 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
726 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
736 AC_DEFUN(STEPMAKE_KPATHSEA, [
738 AC_ARG_WITH(kpathsea-include,
739 [ --with-kpathsea-include=DIR
740 location of the kpathsea include dir],[
741 if test "$withval" = "yes" -o "$withval" = "no"; then
742 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
744 CPPFLAGS="$CPPFLAGS -I${withval}"
748 AC_ARG_WITH(kpathsea-lib,
749 [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
750 if test "$withval" = "yes" -o "$withval" = "no"; then
751 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
753 LDFLAGS="$LDFLAGS -L${withval}"
758 #FIXME --with-xxx is meant for specifying a PATH too,
759 # so this should read: --enable-kpathsea,
760 # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
761 AC_ARG_WITH(kpathsea,
762 [ --with-kpathsea use kpathsea lib. Default: on],
763 [kpathsea_b=$with_kpathsea])
766 if test "$kpathsea_b" != "no"; then
767 AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
768 AC_CHECK_LIB(kpathsea, kpse_find_file)
769 AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
770 if test "$kpathsea_b" = "no"; then
771 warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel
773 Else, please specify the directories where kpathsea/kpathsea.h and
774 libkpathsea.a are installed using --with-kpathsea-include and
775 --with-kpathsea-lib options. You should install kpathsea; see
776 INSTALL.txt. Rerun ./configure --without-kpathsea only if kpathsea
777 is not available for your platform.'
778 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
782 save_CFLAGS="$CFLAGS"
783 CFLAGS=$(echo "-shared $CFLAGS" | sed -e 's/ -g//')
784 AC_MSG_CHECKING([for shared libkpathsea])
785 AC_TRY_LINK([#include <kpathsea/kpathsea.h>],
786 [kpse_var_expand ("\$TEXMF");],
787 [have_libkpathsea_so=maybe;
788 shared_size=`wc -c conftest$ac_exeext`;
789 shared_size=`echo $shared_size | sed -e 's/ .*//g'`],
790 [have_libkpathsea_so=no])
792 if test "$have_libkpathsea_so" = "maybe"; then
793 if test "$shared_size" -lt 40000 ; then
794 have_libkpathsea_so=yes
796 have_libkpathsea_so=no
800 AC_MSG_RESULT($have_libkpathsea_so)
801 if test "$have_libkpathsea_so" = "yes"; then
802 AC_DEFINE(HAVE_LIBKPATHSEA_SO)
804 CFLAGS="$save_CFLAGS"
806 KPATHSEA_LIBS="$LIBS"
808 AC_MSG_CHECKING(whether to use kpathsea)
809 if test "$kpathsea_b" != no; then
818 AC_SUBST(KPATHSEA_LIBS)
819 AC_SUBST(HAVE_LIBKPATHSEA_SO, $have_libkpathsea_so)
820 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
824 AC_DEFUN(STEPMAKE_LIB, [
825 STEPMAKE_PROGS(AR, ar, $1)
827 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
831 AC_DEFUN(STEPMAKE_LIBTOOL, [
833 # **Never** try to set library version numbers so that they correspond
834 # to the release number of your package. This is an abuse that only
835 # fosters misunderstanding of the purpose of library versions.
837 REVISION=$PATCH_LEVEL
838 # CURRENT=$MINOR_VERSION
839 CURRENT=`expr $MINOR_VERSION + 1`
840 # AGE=`expr $MAJOR_VERSION + 1`
848 AC_DEFUN(STEPMAKE_LOCALE, [
853 AC_ARG_WITH(localedir,
854 [ --with-localedir=LOCALE use LOCALE as locale dir. Default:
855 PREFIX/share/locale ],
856 localedir=$with_localedir,
857 localedir='${prefix}/share/locale')
860 [ --with-lang=LANG use LANG as language to emit messages],
864 AC_MSG_CHECKING(language)
866 En* | en* | Am* | am* | US* | us*)
868 NL | nl | Du* | du* | Ned* | ned*)
877 if test "$lang" = "unknown" ; then
878 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
884 AC_DEFUN(STEPMAKE_MAKEINFO, [
885 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
889 AC_DEFUN(STEPMAKE_MAN, [
890 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
892 STEPMAKE_PROGS(TROFF, troff, $1)
894 STEPMAKE_PROGS(TBL, tbl, $1)
899 AC_DEFUN(STEPMAKE_MSGFMT, [
900 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
904 # Check for program ($2), set full path result to ($1).
905 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
906 AC_DEFUN(STEPMAKE_PATH_PROG, [
907 AC_CHECK_PROGS($1, $2, no)
908 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
909 if test $? -eq 0; then
911 if test -n "$4"; then
912 STEPMAKE_CHECK_VERSION($1, $3, $4)
918 # Check for program in set of names ($2), set result to ($1) .
919 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
920 # If exists, and a minimal version ($4) is required
921 AC_DEFUN(STEPMAKE_PROGS, [
922 AC_CHECK_PROGS($1, $2, no)
923 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
924 if test $? -eq 0 -a -n "$4"; then
925 STEPMAKE_CHECK_VERSION($1, $3, $4)
930 AC_DEFUN(STEPMAKE_PERL, [
931 STEPMAKE_PATH_PROG(PERL, perl, $1)
935 AC_DEFUN(STEPMAKE_PYTHON, [
937 AC_MSG_CHECKING([for python])
938 for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
939 AC_MSG_RESULT([$python])
940 if ! $python -V > /dev/null 2>&1 ; then
941 #AC_MSG_WARN([cannot execute $python])
942 PYTHON='echo no python'
945 STEPMAKE_CHECK_VERSION(python, pv, $2)
946 if test -z "$pv"; then
952 if test -n "$pv"; then
953 STEPMAKE_ADD_ENTRY($1, $pv)
955 AC_PATH_PROG(PYTHON, $PYTHON)
959 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
960 unset PYTHON_HEADER PYTHON_INCLUDE
961 if test -n "$PYTHON"; then
962 changequote(<<, >>)#dnl
963 # alternatively, for python >= 2.0
964 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
965 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
966 changequote([, ])#dnl
969 ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
970 if test -z "$PYTHON_HEADER"; then
971 #URG -- how to extend include path?
972 ac_compile="$ac_compile -I$PYTHON_INCLUDE"
973 ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
974 CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
975 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
978 if test -z "$PYTHON_HEADER"; then
979 warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
980 STEPMAKE_ADD_ENTRY($1, $warn)
984 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
986 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
989 AC_DEFUN(STEPMAKE_TEXMF, [
990 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
991 # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
993 AC_MSG_CHECKING(for working metafont mode)
994 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
995 for MFMODE in $modelist; do
996 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
997 if test -f mfput.tfm; then
1001 AC_MSG_RESULT($MFMODE)
1009 AC_DEFUN(STEPMAKE_WARN, [
1015 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1016 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1017 dnl also defines GSTUFF_PKG_ERRORS on error
1018 AC_DEFUN(PKG_CHECK_MODULES, [
1021 if test -z "$PKG_CONFIG"; then
1022 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1025 if test "$PKG_CONFIG" = "no" ; then
1026 echo "*** The pkg-config script could not be found. Make sure it is"
1027 echo "*** in your path, or set the PKG_CONFIG environment variable"
1028 echo "*** to the full path to pkg-config."
1029 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1031 PKG_CONFIG_MIN_VERSION=0.9.0
1032 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1033 AC_MSG_CHECKING(for $2)
1035 if $PKG_CONFIG --exists "$2" ; then
1039 AC_MSG_CHECKING($1_CFLAGS)
1040 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1041 AC_MSG_RESULT($$1_CFLAGS)
1043 AC_MSG_CHECKING($1_LIBS)
1044 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1045 AC_MSG_RESULT($$1_LIBS)
1049 ## If we have a custom action on failure, don't print errors, but
1050 ## do set a variable so people can do so.
1051 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1052 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1060 if test $succeeded = yes; then
1061 ifelse([$3], , :, [$3])
1063 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])
1067 AC_DEFUN(STEPMAKE_FREETYPE2, [
1068 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1069 if test "$have_freetype2" = yes; then
1070 AC_DEFINE(HAVE_FREETYPE2)
1071 AC_SUBST(FREETYPE2_CFLAGS)
1072 AC_SUBST(FREETYPE2_LIBS)
1075 #r="lib$1-dev or $1-devel"
1076 r="libfreetype6-dev or freetype?-devel"
1077 ver="$(pkg-config --modversion $1)"
1078 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1082 AC_DEFUN(STEPMAKE_GTK2, [
1083 PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1084 if test "$have_gtk2" = yes ; then
1085 AC_DEFINE(HAVE_GTK2)
1086 AC_SUBST(GTK2_CFLAGS)
1090 # r="lib$1-dev or $1-devel"
1091 r="libgtk2.0-dev or gtk2-devel"
1092 ver="$(pkg-config --modversion $1)"
1093 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1097 AC_DEFUN(STEPMAKE_PANGO, [
1098 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1099 if test "$have_pango16" = yes ; then
1100 AC_DEFINE(HAVE_PANGO16)
1101 PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
1102 PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
1103 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1104 save_CPPFLAGS="$CPPFLAGS"
1106 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1107 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1108 AC_SUBST(PANGO_CFLAGS)
1109 AC_SUBST(PANGO_LIBS)
1110 CPPFLAGS="$save_CPPFLAGS"
1114 #r="lib$1-dev or $1-devel"
1115 r="libpango1.0-dev or pango1.0-devel"
1116 ver="$(pkg-config --modversion $1)"
1117 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1121 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1122 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1123 if test "$have_pangoft2" = yes ; then
1124 AC_DEFINE(HAVE_PANGO16)
1125 AC_DEFINE(HAVE_PANGO_FT2)
1126 PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
1127 PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
1128 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1129 save_CPPFLAGS="$CPPFLAGS"
1131 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1132 LIBS="$PANGO_FT2_LIBS $LIBS"
1133 AC_CHECK_HEADERS([pango/pangoft2.h])
1134 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1135 AC_SUBST(PANGO_FT2_CFLAGS)
1136 AC_SUBST(PANGO_FT2_LIBS)
1137 CPPFLAGS="$save_CPPFLAGS"
1141 #r="lib$1-dev or $1-devel"e
1142 r="libpango1.0-dev or pango?-devel"
1143 ver="$(pkg-config --modversion $1)"
1144 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1148 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1149 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1150 if test "$have_fontconfig" = yes ; then
1151 AC_DEFINE(HAVE_FONTCONFIG)
1152 FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
1153 FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
1154 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1155 save_CPPFLAGS="$CPPFLAGS"
1157 CPPFLAGS="$CPPFLAGS $FONTCONFIG_CFLAGS"
1158 LIBS="$FONTCONFIG_LIBS $LIBS"
1159 AC_SUBST(FONTCONFIG_CFLAGS)
1160 AC_SUBST(FONTCONFIG_LIBS)
1161 CPPFLAGS="$save_CPPFLAGS"
1164 r="lib$1-dev or $1-devel"
1165 ver="$(pkg-config --modversion $1)"
1166 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1170 AC_DEFUN(STEPMAKE_WINDOWS, [
1174 if test "$CYGWIN" == "yes"; then
1175 LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1177 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1178 elif test "$MINGW32" == "yes"; then
1182 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1189 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1190 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1193 AC_SUBST(program_suffix)
1195 AC_MSG_CHECKING([for some flavor of Windows])
1196 if test "$CYGWIN$MINGW32" == "nono"; then
1199 PLATFORM_WINDOWS=yes
1201 AC_MSG_RESULT([$PLATFORM_WINDOWS])
1202 AC_SUBST(PLATFORM_WINDOWS)
1203 STEPMAKE_PROGS(WINDRES, $target-windres windres, x)