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.])
414 AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
415 AC_MSG_CHECKING([FlexLexer.h path])
418 FLEXLEXER_PATH=`echo '#include <FlexLexer.h>' | $CXX -E - | \
419 sed 's!# 1 "\(.*\)FlexLexer.h"!@FLEXLEXER@\1@@!g' | grep '@@' | \
420 sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` >& /dev/null
421 AC_SUBST(FLEXLEXER_PATH)
422 AC_MSG_RESULT($FLEXLEXER_PATH)
425 AC_DEFUN(STEPMAKE_GCC, [
426 if test "$GCC" = "yes"; then
427 STEPMAKE_CHECK_VERSION(CC, $1, $2)
429 warn="$CC (Please install *GNU* cc)"
430 STEPMAKE_ADD_ENTRY($1, $warn)
434 AC_DEFUN(STEPMAKE_GETTEXT, [
436 if test "$prefix" = "NONE"; then
437 presome=${ac_default_prefix}
439 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
442 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
443 # ouch. autoconf <= 2.57's gettext check fails for
444 # g++ >= 3.3 (with -std=gnu++98, the default).
445 # While the check is OK for g++ -std=c++98,
446 # LilyPond needs GNU g++, so who is to blame here?
447 # Use a workaround until this is resolved:
448 # for g++ >= 3.3, select C language.
450 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
451 if test -n "$GCC_UNSUPPORTED"; then
452 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
453 AC_MSG_WARN([Trying gcc, cross fingers.])
456 AC_CHECK_LIB(intl, gettext)
457 AC_CHECK_FUNCS(gettext)
458 if test -n "$GCC_UNSUPPORTED"; then
464 AC_DEFUN(STEPMAKE_GUILE, [
465 STEPMAKE_PATH_PROG(GUILE, guile, $1)
469 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
471 # This macro runs the guile-config script, installed with Guile,
472 # to find out where Guile's header files and libraries are
473 # installed. It sets two variables, marked for substitution, as
476 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
477 # code that uses Guile header files. This is almost
478 # always just a -I flag.
480 # GUILE_LDFLAGS --- flags to pass to the linker to link a
481 # program against Guile. This includes -lguile for
482 # the Guile library itself, any libraries that Guile
483 # itself requires (like -lqthreads), and so on. It may
484 # also include a -L flag to tell the compiler where to
485 # find the libraries.
487 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
488 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
489 if test -x $exe; then
490 AC_MSG_CHECKING([guile compile flags])
491 GUILE_CFLAGS="`$guile_config compile`"
492 AC_MSG_RESULT($GUILE_CFLAGS)
493 AC_MSG_CHECKING([guile link flags])
494 GUILE_LDFLAGS="`$guile_config link`"
495 AC_MSG_RESULT($GUILE_LDFLAGS)
497 AC_SUBST(GUILE_CFLAGS)
498 AC_SUBST(GUILE_LDFLAGS)
502 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
503 ## First, let's just see if we can find Guile at all.
504 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
505 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
506 AC_MSG_CHECKING([for guile-config])
507 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
508 AC_MSG_RESULT([$guile_config])
509 if ! $guile_config --version > /dev/null 2>&1 ; then
510 AC_MSG_WARN([cannot execute $guile_config])
511 AC_MSG_CHECKING([if we are cross compiling])
512 GUILE_CONFIG='echo no guile-config'
514 GUILE_CONFIG=$guile_config
518 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
519 if test $? -ne 0; then
520 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
523 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
524 # urg. should test functionality rather than version.
525 if test $? -eq 0 -a -n "$2"; then
526 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
529 AC_SUBST(GUILE_CONFIG)
532 changequote(<<, >>)#dnl
533 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
534 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
535 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
536 changequote([, ])#dnl
538 save_CPPFLAGS="$CPPFLAGS"
540 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
541 LIBS="$GUILE_LDFLAGS $LIBS"
542 AC_CHECK_HEADERS([libguile.h])
543 AC_CHECK_LIB(guile, scm_boot_guile)
544 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
545 if test "$libguile_b" = "no"; then
546 warn='libguile (libguile-dev, guile-devel or guile-dev
548 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
550 CPPFLAGS="$save_CPPFLAGS"
552 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
553 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
554 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
558 AC_DEFUN(STEPMAKE_DLOPEN, [
559 AC_CHECK_LIB(dl, dlopen)
560 AC_CHECK_FUNCS(dlopen)
563 AC_DEFUN(STEPMAKE_GXX, [
564 if test "$GXX" = "yes"; then
565 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
567 warn="$CXX (Please install *GNU* c++)"
568 STEPMAKE_ADD_ENTRY($1, $warn)
573 AC_DEFUN(STEPMAKE_INIT, [
577 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
578 if test x$MY_PATCH_LEVEL != x; then
579 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
581 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
582 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
583 changequote(<<, >>)#dnl
584 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
585 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
586 changequote([, ])#dnl
588 # No versioning on directory names of sub-packages
590 stepmake=${datadir}/stepmake
592 if test "$prefix" = "NONE"; then
593 presome=${ac_default_prefix}
595 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
597 # urg, how is this supposed to work?
598 if test "$program_prefix" = "NONE"; then
601 if test "$program_suffix" = "NONE"; then
605 AC_MSG_CHECKING(Package)
606 if test "$PACKAGE" = "STEPMAKE"; then
607 AC_MSG_RESULT(Stepmake package!)
609 AC_MSG_CHECKING(builddir)
611 ugh_ugh_autoconf250_builddir="`pwd`"
613 if test "$srcdir" = "."; then
617 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
618 package_srcdir="`dirname $srcdir`"
620 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
622 (cd stepmake 2>/dev/null || mkdir stepmake)
623 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
624 # only possible with autoconf < 2.50 -- hardcoded in configure.in
625 # AC_CONFIG_AUX_DIR(bin)
628 AC_MSG_RESULT($PACKAGE)
630 AC_MSG_CHECKING(builddir)
631 ugh_ugh_autoconf250_builddir="`pwd`"
632 if test "$srcdir" = "."; then
637 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
639 AC_MSG_CHECKING(for stepmake)
640 # Check for installed stepmake
641 if test -d $stepmake; then
642 AC_MSG_RESULT($stepmake)
644 stepmake="`cd $srcdir/stepmake; pwd`"
645 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
648 # only possible with autoconf < 2.50 -- hardcoded in configure.in
649 # AC_CONFIG_AUX_DIR(\
651 # $srcdir/stepmake/bin\
655 AC_SUBST(ugh_ugh_autoconf250_builddir)
659 AC_SUBST(PACKAGE_NAME)
660 AC_SUBST(MAJOR_VERSION)
661 AC_SUBST(MINOR_VERSION)
663 # We don't need the upper case variant,
664 # so stick to macros are uppercase convention.
665 # AC_DEFINE_UNQUOTED(package, ["${package}"])
666 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
667 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
668 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
669 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
671 if test -z "$package_depth"; then
674 package_depth="../$package_depth"
677 AC_SUBST(package_depth)
679 AUTOGENERATE="This file was automatically generated by configure"
680 AC_SUBST(AUTOGENERATE)
683 AC_ARG_ENABLE(config,
684 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
685 do \`make conf=CONF' to get output in ./out-CONF],
686 [CONFIGURATION=$enableval])
690 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
691 CONFIGFILE=config$CONFIGSUFFIX
692 AC_SUBST(CONFIGSUFFIX)
695 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
696 STEPMAKE_PROGS(FIND, find, REQUIRED)
698 STEPMAKE_PROGS(TAR, tar, REQUIRED)
700 if test "$(echo 2)" != "2" ||
701 test "x`uname`" = "xHP-UX"; then
702 AC_PATH_PROG(KSH, ksh, /bin/ksh)
703 AC_PATH_PROG(BASH, bash, $KSH)
704 STEPMAKE_WARN(avoiding buggy /bin/sh)
705 AC_PATH_PROG(SHELL, bash, $KSH)
708 AC_PATH_PROG(BASH, bash, $SHELL)
712 STEPMAKE_PYTHON(REQUIRED, 1.5)
714 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
715 $MAKE -v 2> /dev/null | grep GNU > /dev/null
716 if test "$?" = 1; then
717 warn='make (Please install *GNU* make)'
718 # STEPMAKE_WARN($warn)
719 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
729 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
731 AC_SUBST(program_prefix)
732 AC_SUBST(program_suffix)
737 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
738 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
748 AC_DEFUN(STEPMAKE_KPATHSEA, [
750 AC_ARG_WITH(kpathsea-include,
751 [ --with-kpathsea-include=DIR
752 location of the kpathsea include dir],[
753 if test "$withval" = "yes" -o "$withval" = "no"; then
754 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
756 CPPFLAGS="$CPPFLAGS -I${withval}"
760 AC_ARG_WITH(kpathsea-lib,
761 [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
762 if test "$withval" = "yes" -o "$withval" = "no"; then
763 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
765 LDFLAGS="$LDFLAGS -L${withval}"
770 #FIXME --with-xxx is meant for specifying a PATH too,
771 # so this should read: --enable-kpathsea,
772 # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
773 AC_ARG_WITH(kpathsea,
774 [ --with-kpathsea use kpathsea lib. Default: on],
775 [kpathsea_b=$with_kpathsea])
778 if test "$kpathsea_b" != "no"; then
779 AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
780 AC_CHECK_LIB(kpathsea, kpse_find_file)
781 AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
782 if test "$kpathsea_b" = "no"; then
783 warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel
785 Else, please specify the directories where kpathsea/kpathsea.h and
786 libkpathsea.a are installed using --with-kpathsea-include and
787 --with-kpathsea-lib options. You should install kpathsea; see
788 INSTALL.txt. Rerun ./configure --without-kpathsea only if kpathsea
789 is not available for your platform.'
790 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
794 save_CFLAGS="$CFLAGS"
795 CFLAGS=$(echo "-shared $CFLAGS" | sed -e 's/ -g//')
796 AC_MSG_CHECKING([for shared libkpathsea])
797 AC_TRY_LINK([#include <kpathsea/kpathsea.h>],
798 [kpse_var_expand ("\$TEXMF");],
799 [have_libkpathsea_so=maybe;
800 shared_size=`wc -c conftest$ac_exeext`;
801 shared_size=`echo $shared_size | sed -e 's/ .*//g'`],
802 [have_libkpathsea_so=no])
804 if test "$have_libkpathsea_so" = "maybe"; then
805 if test "$shared_size" -lt 40000 ; then
806 have_libkpathsea_so=yes
808 have_libkpathsea_so=no
812 AC_MSG_RESULT($have_libkpathsea_so)
813 if test "$have_libkpathsea_so" = "yes"; then
814 AC_DEFINE(HAVE_LIBKPATHSEA_SO)
816 CFLAGS="$save_CFLAGS"
818 KPATHSEA_LIBS="$LIBS"
820 AC_MSG_CHECKING(whether to use kpathsea)
821 if test "$kpathsea_b" != no; then
830 AC_SUBST(KPATHSEA_LIBS)
831 AC_SUBST(HAVE_LIBKPATHSEA_SO, $have_libkpathsea_so)
832 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
836 AC_DEFUN(STEPMAKE_LIB, [
837 STEPMAKE_PROGS(AR, ar, $1)
839 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
843 AC_DEFUN(STEPMAKE_LIBTOOL, [
845 # **Never** try to set library version numbers so that they correspond
846 # to the release number of your package. This is an abuse that only
847 # fosters misunderstanding of the purpose of library versions.
849 REVISION=$PATCH_LEVEL
850 # CURRENT=$MINOR_VERSION
851 CURRENT=`expr $MINOR_VERSION + 1`
852 # AGE=`expr $MAJOR_VERSION + 1`
860 AC_DEFUN(STEPMAKE_LOCALE, [
865 AC_ARG_WITH(localedir,
866 [ --with-localedir=LOCALE use LOCALE as locale dir. Default:
867 PREFIX/share/locale ],
868 localedir=$with_localedir,
869 localedir='${prefix}/share/locale')
872 [ --with-lang=LANG use LANG as language to emit messages],
876 AC_MSG_CHECKING(language)
878 En* | en* | Am* | am* | US* | us*)
880 NL | nl | Du* | du* | Ned* | ned*)
889 if test "$lang" = "unknown" ; then
890 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
896 AC_DEFUN(STEPMAKE_MAKEINFO, [
897 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
901 AC_DEFUN(STEPMAKE_MAN, [
902 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
904 STEPMAKE_PROGS(TROFF, troff, $1)
906 STEPMAKE_PROGS(TBL, tbl, $1)
911 AC_DEFUN(STEPMAKE_MSGFMT, [
912 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
916 # Check for program ($2), set full path result to ($1).
917 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
918 AC_DEFUN(STEPMAKE_PATH_PROG, [
919 AC_CHECK_PROGS($1, $2, no)
920 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
921 if test $? -eq 0; then
923 if test -n "$4"; then
924 STEPMAKE_CHECK_VERSION($1, $3, $4)
930 # Check for program in set of names ($2), set result to ($1) .
931 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
932 # If exists, and a minimal version ($4) is required
933 AC_DEFUN(STEPMAKE_PROGS, [
934 AC_CHECK_PROGS($1, $2, no)
935 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
936 if test $? -eq 0 -a -n "$4"; then
937 STEPMAKE_CHECK_VERSION($1, $3, $4)
942 AC_DEFUN(STEPMAKE_PERL, [
943 STEPMAKE_PATH_PROG(PERL, perl, $1)
947 AC_DEFUN(STEPMAKE_PYTHON, [
949 AC_MSG_CHECKING([for python])
950 for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
951 AC_MSG_RESULT([$python])
952 if ! $python -V > /dev/null 2>&1 ; then
953 #AC_MSG_WARN([cannot execute $python])
954 PYTHON='echo no python'
957 STEPMAKE_CHECK_VERSION(python, pv, $2)
958 if test -z "$pv"; then
964 if test -n "$pv"; then
965 STEPMAKE_ADD_ENTRY($1, $pv)
967 AC_PATH_PROG(PYTHON, $PYTHON)
971 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
972 unset PYTHON_HEADER PYTHON_INCLUDE
973 if test -n "$PYTHON"; then
974 changequote(<<, >>)#dnl
975 # alternatively, for python >= 2.0
976 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
977 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
978 changequote([, ])#dnl
981 ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
982 if test -z "$PYTHON_HEADER"; then
983 #URG -- how to extend include path?
984 ac_compile="$ac_compile -I$PYTHON_INCLUDE"
985 ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
986 CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
987 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
990 if test -z "$PYTHON_HEADER"; then
991 warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
992 STEPMAKE_ADD_ENTRY($1, $warn)
996 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
998 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1001 AC_DEFUN(STEPMAKE_TEXMF, [
1002 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1003 # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1005 AC_MSG_CHECKING(for working metafont mode)
1006 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1007 for MFMODE in $modelist; do
1008 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1009 if test -f mfput.tfm; then
1013 AC_MSG_RESULT($MFMODE)
1021 AC_DEFUN(STEPMAKE_WARN, [
1027 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1028 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1029 dnl also defines GSTUFF_PKG_ERRORS on error
1030 AC_DEFUN(PKG_CHECK_MODULES, [
1033 if test -z "$PKG_CONFIG"; then
1034 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1037 if test "$PKG_CONFIG" = "no" ; then
1038 echo "*** The pkg-config script could not be found. Make sure it is"
1039 echo "*** in your path, or set the PKG_CONFIG environment variable"
1040 echo "*** to the full path to pkg-config."
1041 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1043 PKG_CONFIG_MIN_VERSION=0.9.0
1044 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1045 AC_MSG_CHECKING(for $2)
1047 if $PKG_CONFIG --exists "$2" ; then
1051 AC_MSG_CHECKING($1_CFLAGS)
1052 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1053 AC_MSG_RESULT($$1_CFLAGS)
1055 AC_MSG_CHECKING($1_LIBS)
1056 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1057 AC_MSG_RESULT($$1_LIBS)
1061 ## If we have a custom action on failure, don't print errors, but
1062 ## do set a variable so people can do so.
1063 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1064 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1072 if test $succeeded = yes; then
1073 ifelse([$3], , :, [$3])
1075 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])
1079 AC_DEFUN(STEPMAKE_FREETYPE2, [
1080 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1081 if test "$have_freetype2" = yes; then
1082 AC_DEFINE(HAVE_FREETYPE2)
1083 AC_SUBST(FREETYPE2_CFLAGS)
1084 AC_SUBST(FREETYPE2_LIBS)
1087 #r="lib$1-dev or $1-devel"
1088 r="libfreetype6-dev or freetype?-devel"
1089 ver="$(pkg-config --modversion $1)"
1090 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1094 AC_DEFUN(STEPMAKE_GTK2, [
1095 PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1096 if test "$have_gtk2" = yes ; then
1097 AC_DEFINE(HAVE_GTK2)
1098 AC_SUBST(GTK2_CFLAGS)
1102 # r="lib$1-dev or $1-devel"
1103 r="libgtk2.0-dev or gtk2-devel"
1104 ver="$(pkg-config --modversion $1)"
1105 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1109 AC_DEFUN(STEPMAKE_PANGO, [
1110 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1111 if test "$have_pango16" = yes ; then
1112 AC_DEFINE(HAVE_PANGO16)
1113 PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
1114 PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
1115 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1116 save_CPPFLAGS="$CPPFLAGS"
1118 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1119 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1120 AC_SUBST(PANGO_CFLAGS)
1121 AC_SUBST(PANGO_LIBS)
1122 CPPFLAGS="$save_CPPFLAGS"
1126 #r="lib$1-dev or $1-devel"
1127 r="libpango1.0-dev or pango1.0-devel"
1128 ver="$(pkg-config --modversion $1)"
1129 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1133 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1134 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1135 if test "$have_pangoft2" = yes ; then
1136 AC_DEFINE(HAVE_PANGO16)
1137 AC_DEFINE(HAVE_PANGO_FT2)
1138 PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
1139 PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
1140 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1141 save_CPPFLAGS="$CPPFLAGS"
1143 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1144 LIBS="$PANGO_FT2_LIBS $LIBS"
1145 AC_CHECK_HEADERS([pango/pangoft2.h])
1146 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1147 AC_SUBST(PANGO_FT2_CFLAGS)
1148 AC_SUBST(PANGO_FT2_LIBS)
1149 CPPFLAGS="$save_CPPFLAGS"
1153 #r="lib$1-dev or $1-devel"e
1154 r="libpango1.0-dev or pango?-devel"
1155 ver="$(pkg-config --modversion $1)"
1156 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1160 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1161 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1162 if test "$have_fontconfig" = yes ; then
1163 AC_DEFINE(HAVE_FONTCONFIG)
1164 FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
1165 FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
1166 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1167 save_CPPFLAGS="$CPPFLAGS"
1169 CPPFLAGS="$CPPFLAGS $FONTCONFIG_CFLAGS"
1170 LIBS="$FONTCONFIG_LIBS $LIBS"
1171 AC_SUBST(FONTCONFIG_CFLAGS)
1172 AC_SUBST(FONTCONFIG_LIBS)
1173 CPPFLAGS="$save_CPPFLAGS"
1176 r="lib$1-dev or $1-devel"
1177 ver="$(pkg-config --modversion $1)"
1178 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1182 AC_DEFUN(STEPMAKE_WINDOWS, [
1186 if test "$CYGWIN" == "yes"; then
1187 LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1189 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1190 elif test "$MINGW32" == "yes"; then
1194 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1201 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1202 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1205 AC_SUBST(program_suffix)
1207 AC_MSG_CHECKING([for some flavor of Windows])
1208 if test "$CYGWIN$MINGW32" == "nono"; then
1211 PLATFORM_WINDOWS=yes
1213 AC_MSG_RESULT([$PLATFORM_WINDOWS])
1214 AC_SUBST(PLATFORM_WINDOWS)
1215 STEPMAKE_PROGS(WINDRES, $target-windres windres, x)