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.
34 ## grab the first version number in --version output.
35 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 |
36 grep -E '(^| )[0-9][0-9]*\.[0-9]' |
39 sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/g' |
40 grep -E '(^| )[0-9][0-9]*\.[0-9]' |
43 if test -z "$_ver"; then
44 ## If empty, try date [fontforge]
45 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
47 | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
53 # Calculate simplistic numeric version from version string ($1)
54 # As yet, we have no need for something more elaborate.
55 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
58 if ([$]3) {three = [$]3}
61 {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
65 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
66 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
67 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
70 # Check if tested program ($2) was found ($1).
71 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
72 # We could abort here if a 'REQUIRED' program is not found
73 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
74 STEPMAKE_CHECK_SEARCH_RESULT($1)
75 if test $? -ne 0; then
76 STEPMAKE_ADD_ENTRY($3, $2)
77 if test "$3" = "REQUIRED"; then
78 command="echo ERROR: $2 not found"
79 # abort configure process here?
81 command="- echo $2 not found"
91 # Return if tested proram ($1) was found (true) or not (false).
92 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
93 r="`eval echo '$'"$1"`"
94 if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
97 ##STEPMAKE_WARN(cannot find $2. $3)
103 # Check version of program ($1)
104 # If version ($4: optional argument, supply if version cannot be
105 # parsed using --version or -V ) is smaller than requested ($3), add
106 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
107 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
108 r="`eval echo '$'"$1"`"
109 AC_MSG_CHECKING([$r version])
110 exe=`STEPMAKE_GET_EXECUTABLE($r)`
111 if test -n "$4"; then
114 ver=`STEPMAKE_GET_VERSION($exe)`
116 num=`STEPMAKE_NUMERIC_VERSION($ver)`
117 req=`STEPMAKE_NUMERIC_VERSION($3)`
118 AC_MSG_RESULT([$ver])
119 if test "$num" -lt "$req"; then
120 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
122 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
123 eval `echo $vervar=$num`
124 ## AC_SUBST(`eval echo $vervar`)
127 # Check version of program ($1)
128 # If version is greater than or equals unsupported ($3),
129 # add entry to unsupported list ($2, 'UNSUPPORTED')
130 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
131 r="`eval echo '$'"$1"`"
132 AC_MSG_CHECKING([$r version])
133 exe=`STEPMAKE_GET_EXECUTABLE($r)`
134 ver=`STEPMAKE_GET_VERSION($exe)`
135 num=`STEPMAKE_NUMERIC_VERSION($ver)`
136 sup=`STEPMAKE_NUMERIC_VERSION($3)`
137 AC_MSG_RESULT([$ver])
138 if test "$num" -ge "$sup"; then
139 STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
143 ### Macros to build configure.in
146 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
147 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
148 if test "$BIBTEX2HTML" = "bib2html"; then
149 BIBTEX2HTML_FLAGS='$< $(@)'
151 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
153 AC_SUBST(BIBTEX2HTML)
154 AC_SUBST(BIBTEX2HTML_FLAGS)
158 AC_DEFUN(STEPMAKE_BISON, [
159 # ugh, automake: we want (and check for) bison
162 STEPMAKE_PROGS(BISON, bison, $1)
164 # urg. should test functionality rather than version.
165 if test "$BISON" = "bison" -a -n "$2"; then
166 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
170 AC_DEFUN(STEPMAKE_COMPILE_BEFORE, [
171 # -O is necessary to get inlining
173 CXXFLAGS=${CXXFLAGS-$CFLAGS}
174 LDFLAGS=${LDFLAGS-""}
180 AC_ARG_ENABLE(debugging,
181 [AS_HELP_STRING([--enable-debugging],
182 [compile with debugging info. Default: on])],
183 [debug_b=$enableval])
185 AC_ARG_ENABLE(optimising,
186 [AS_HELP_STRING([--enable-optimising],
187 [compile with optimising. Default: on])],
188 [optimise_b=$enableval])
190 AC_ARG_ENABLE(profiling,
191 [AS_HELP_STRING([--enable-profiling],
192 [compile with gprof support. Default: off])],
193 [profile_b=$enableval])
196 [AS_HELP_STRING([--enable-pipe],
197 [compile with -pipe. Default: on])],
200 if test "$optimise_b" = yes; then
202 DEFINES="$DEFINES -DNDEBUG"
203 OPTIMIZE=" -O2 -finline-functions"
206 if test $profile_b = yes; then
208 OPTIMIZE="$OPTIMIZE -pg"
211 if test $debug_b = yes; then
212 OPTIMIZE="$OPTIMIZE -g"
216 AC_DEFUN(STEPMAKE_COMPILE, [
218 AC_REQUIRE([STEPMAKE_COMPILE_BEFORE])
219 AC_REQUIRE([AC_PROG_CC])
221 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
225 # If -pipe requested, test if it works and add to CFLAGS.
226 if test "$pipe_b" = yes; then
227 save_cflags="$CFLAGS"
228 CFLAGS=" -pipe $CFLAGS";
229 AC_CACHE_CHECK([whether compiler understands -pipe],
230 [stepmake_cv_cflags_pipe],
231 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
232 [stepmake_cv_cflags_pipe=yes],
233 [stepmake_cv_cflags_pipe=no]))
235 if test $stepmake_cv_cflags_pipe = yes; then
236 OPTIMIZE="$OPTIMIZE -pipe"
240 CFLAGS="$CFLAGS $OPTIMIZE"
241 CPPFLAGS=${CPPFLAGS-""}
243 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
244 save_cflags="$CFLAGS"
247 dnl should do compile test?
248 AC_MSG_RESULT(-mieee)
249 CFLAGS=" -mieee $CFLAGS"
252 AC_MSG_RESULT([none])
256 AC_SUBST(cross_compiling)
264 AC_DEFUN(STEPMAKE_CXX, [
266 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
268 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
277 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
278 AC_CACHE_CHECK([whether explicit instantiation is needed],
279 stepmake_cv_need_explicit_instantiation,
280 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
281 template <class T> struct foo { static int baz; };
282 template <class T> int foo<T>::baz = 1;
283 ]], [[ return foo<int>::baz; ]])],[stepmake_cv_need_explicit_instantiation=no],[stepmake_cv_need_explicit_instantiation=yes]))
284 if test x"$stepmake_cv_need_explicit_instantiation"x = x"yes"x; then
285 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
290 AC_DEFUN(STEPMAKE_DATADIR, [
291 if test "$datadir" = "\${prefix}/share"; then
292 datadir='${prefix}/share'
295 if test "$prefix" = "NONE"; then
296 presome=${ac_default_prefix}
299 build_package_datadir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/share/$package
301 DATADIR=`echo ${datadir} | sed "s!\\\${datarootdir}!${prefix}/share!"`
302 DATADIR=`echo ${DATADIR} | sed "s!\\\${prefix}!$presome!"`
303 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
306 AC_SUBST(datarootdir)
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/out$CONFIGSUFFIX/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_PREFIX_EXPAND_FIXUP, [
332 # undo expanding of explicit --infodir=/usr/share
333 # to ease install-time override with prefix=...
334 strip=`echo $includedir | eval sed s@^$prefix@@`
335 if test "$includedir" = "`eval echo $prefix$strip`"; then
336 includedir='${prefix}'$strip''
338 strip=`echo $libdir | eval sed s@^$exec_prefix@@`
339 if test "$libdir" = "`eval echo $exec_prefix$strip`"; then
340 libdir='${exec_prefix}'$strip''
342 strip=`echo $infodir | eval sed s@^$datarootdir@@`
343 if test "$infodir" = "`eval echo $datarootdir$strip`"; then
344 infodir='${datarootdir}'$strip''
346 strip=`echo $mandir | eval sed s@^$datarootdir@@`
347 if test "$mandir" = "`eval echo $datarootdir$strip`"; then
348 mandir='${datarootdir}'$strip''
353 AC_DEFUN(STEPMAKE_END, [
354 STEPMAKE_PREFIX_EXPAND_FIXUP
359 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
362 if test -n "$OPTIONAL"; then
364 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
367 if test -n "$REQUIRED"; then
369 echo "ERROR: Please install required programs: $REQUIRED"
372 if test -n "$UNSUPPORTED"; then
374 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
377 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
379 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
380 if test -f config.cache ; then
381 echo "Remove config.cache before rerunning ./configure"
385 if test -n "$REQUIRED$UNSUPPORTED"; then
386 rm -f $srcdir/GNUmakefile
390 # regular in-place build
391 # test for srcdir_build = yes ?
392 if test "$srcdir_build" = "yes"; then
393 rm -f $srcdir/GNUmakefile
394 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
395 chmod 444 $srcdir/GNUmakefile
397 if test -f $srcdir/GNUmakefile; then
399 Source directory already configured. Please clean the source directory
401 make -C $srcdir distclean
409 for mf in `cd $srcdir ; find . -maxdepth $d -mindepth $d -name GNUmakefile`; do
410 mkdir -p $(dirname $mf)
411 cat <<EOF | $PYTHON - > $mf
412 print 'depth=' + ('../' * ( $d-1 ) )
413 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
414 print 'include \$(configure-srcdir)/$mf'
415 print 'MODULE_INCLUDES += \$(src-dir)/\$(outbase)'
418 for mf in `cd $srcdir ; find . -maxdepth $d -mindepth $d -name '*.make' | grep -v config.make `; do
419 mkdir -p $(dirname $mf)
420 cat <<EOF | $PYTHON - > $mf
421 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
422 print 'include \$(configure-srcdir)/$mf'
428 cat <<EOF > GNUmakefile
430 include config\$(if \$(conf),-\$(conf),).make
431 include \$(configure-srcdir)/GNUmakefile.in
438 AC_DEFUN(STEPMAKE_FLEX, [
439 # ugh, automake: we want (and check for) flex
441 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
445 ac_cv_prog_lex_root=lex.yy
446 STEPMAKE_PROGS(FLEX, flex, $1)
450 AC_DEFUN(STEPMAKE_FLEXLEXER, [
451 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
452 if test $? -ne 0; then
453 warn='FlexLexer.h (flex package)'
454 STEPMAKE_ADD_ENTRY($1, $warn)
456 # check for yyFlexLexer.yy_current_buffer,
457 # in 2.5.4 <= flex < 2.5.29
458 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
459 [stepmake_cv_flexlexer_yy_current_buffer],
460 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
462 #include <FlexLexer.h>
463 class yy_flex_lexer: public yyFlexLexer
468 yy_current_buffer = 0;
472 [stepmake_cv_flexlexer_yy_current_buffer=yes],
473 [stepmake_cv_flexlexer_yy_current_buffer=no]))
474 if test $stepmake_cv_flexlexer_yy_current_buffer = yes; then
475 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
481 AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
482 AC_MSG_CHECKING([FlexLexer.h location])
485 cat <<EOF > conftest.cc
487 #include <FlexLexer.h>
489 FLEXLEXER_FILE=`eval $ac_cpp conftest.cc | \
490 sed 's!# 1 "\(.*FlexLexer.h\)"!@FLEXLEXER@\1@@!g' | grep '@@' | \
491 sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` 1> /dev/null 2> /dev/null
493 AC_SUBST(FLEXLEXER_FILE)
494 AC_MSG_RESULT($FLEXLEXER_FILE)
497 AC_DEFUN(STEPMAKE_GCC, [
498 if test "$GCC" = "yes"; then
499 STEPMAKE_CHECK_VERSION(CC, $1, $2)
501 warn="$CC (Please install *GNU* cc)"
502 STEPMAKE_ADD_ENTRY($1, $warn)
506 AC_DEFUN(STEPMAKE_GETTEXT, [
508 if test "$prefix" = "NONE"; then
509 presome=${ac_default_prefix}
511 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
514 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
515 AC_CHECK_LIB(intl, gettext)
516 AC_CHECK_FUNCS(gettext)
520 AC_DEFUN(STEPMAKE_GUILE, [
521 STEPMAKE_PATH_PROG(GUILE, guile, $1)
525 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
527 # This macro runs the guile-config script, installed with Guile,
528 # to find out where Guile's header files and libraries are
529 # installed. It sets two variables, marked for substitution, as
532 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
533 # code that uses Guile header files. This is almost
534 # always just a -I flag.
536 # GUILE_LDFLAGS --- flags to pass to the linker to link a
537 # program against Guile. This includes -lguile for
538 # the Guile library itself, any libraries that Guile
539 # itself requires (like -lqthreads), and so on. It may
540 # also include a -L flag to tell the compiler where to
541 # find the libraries.
543 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
544 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
545 if test -x $exe; then
546 AC_MSG_CHECKING([guile compile flags])
547 GUILE_CFLAGS="`$guile_config compile`"
548 AC_MSG_RESULT($GUILE_CFLAGS)
549 AC_MSG_CHECKING([guile link flags])
550 GUILE_LDFLAGS="`$guile_config link`"
551 AC_MSG_RESULT($GUILE_LDFLAGS)
553 AC_SUBST(GUILE_CFLAGS)
554 AC_SUBST(GUILE_LDFLAGS)
558 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
559 ## First, let's just see if we can find Guile at all.
560 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
561 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
562 AC_MSG_CHECKING([for guile-config])
563 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
564 AC_MSG_RESULT([$guile_config])
565 if ! $guile_config --version > /dev/null 2>&1 ; then
566 AC_MSG_WARN([cannot execute $guile_config])
567 AC_MSG_CHECKING([if we are cross compiling])
568 GUILE_CONFIG='echo no guile-config'
570 GUILE_CONFIG=$guile_config
574 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
575 if test $? -ne 0; then
576 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
579 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
580 # urg. should test functionality rather than version.
581 if test $? -eq 0 -a -n "$2"; then
582 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
585 AC_SUBST(GUILE_CONFIG)
588 changequote(<<, >>)#dnl
589 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
590 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
591 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
592 changequote([, ])#dnl
594 save_CPPFLAGS="$CPPFLAGS"
596 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
597 LIBS="$GUILE_LDFLAGS $LIBS"
598 AC_CHECK_HEADERS([libguile.h])
599 AC_CHECK_LIB(guile, scm_boot_guile)
600 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
601 if test "$libguile_b" = "no"; then
602 warn='libguile (libguile-dev, guile-devel or guile-dev
604 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
606 CPPFLAGS="$save_CPPFLAGS"
608 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
609 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
610 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
614 AC_DEFUN(STEPMAKE_DLOPEN, [
615 AC_CHECK_LIB(dl, dlopen)
616 AC_CHECK_FUNCS(dlopen)
619 AC_DEFUN(STEPMAKE_GXX, [
620 if test "$GXX" = "yes"; then
621 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
623 warn="$CXX (Please install *GNU* c++)"
624 STEPMAKE_ADD_ENTRY($1, $warn)
629 AC_DEFUN(STEPMAKE_INIT, [
632 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
633 MICRO_VERSION=$PATCH_LEVEL
634 TOPLEVEL_VERSION=$FULL_VERSION
635 if test x$MY_PATCH_LEVEL != x; then
636 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
638 VERSION=$FULL_VERSION
639 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
640 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
641 changequote(<<, >>)#dnl
642 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
643 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
644 changequote([, ])#dnl
646 # No versioning on directory names of sub-packages
648 stepmake=${datadir}/stepmake
650 if test "$prefix" = "NONE"; then
651 presome=${ac_default_prefix}
653 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
655 # urg, how is this supposed to work?
656 if test "$program_prefix" = "NONE"; then
659 if test "$program_suffix" = "NONE"; then
663 AC_MSG_CHECKING(Package)
664 if test "$PACKAGE" = "STEPMAKE"; then
665 AC_MSG_RESULT(Stepmake package!)
667 AC_MSG_CHECKING(builddir)
669 ugh_ugh_autoconf250_builddir="`pwd`"
671 if test "$srcdir" = "."; then
675 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
676 package_srcdir="`dirname $srcdir`"
678 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
680 (cd stepmake 2>/dev/null || mkdir stepmake)
681 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
684 AC_MSG_RESULT($PACKAGE)
686 AC_MSG_CHECKING(builddir)
687 ugh_ugh_autoconf250_builddir="`pwd`"
689 here_dir=$(cd . && pwd)
690 full_src_dir=$(cd $srcdir && pwd)
692 if test "$full_src_dir" = "$here_dir"; then
697 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
699 AC_MSG_CHECKING(for stepmake)
700 # Check for installed stepmake
701 if test -d $stepmake; then
702 AC_MSG_RESULT($stepmake)
704 stepmake="`cd $srcdir/stepmake; pwd`"
705 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
709 AC_SUBST(ugh_ugh_autoconf250_builddir)
711 # Use absolute directory for non-srcdir builds, so that build
713 if test "$srcdir_build" = "no" ; then
714 srcdir="`cd $srcdir; pwd`"
721 AC_SUBST(PACKAGE_NAME)
723 AC_SUBST(MAJOR_VERSION)
724 AC_SUBST(MINOR_VERSION)
725 AC_SUBST(MICRO_VERSION)
727 # stepmake nonstandard names
728 AC_SUBST(PATCH_LEVEL)
729 AC_SUBST(TOPLEVEL_VERSION)
731 # We don't need the upper case variant,
732 # so stick to macros are uppercase convention.
733 # AC_DEFINE_UNQUOTED(package, ["${package}"])
734 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
735 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
736 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
737 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
739 if test -z "$package_depth"; then
742 package_depth="../$package_depth"
745 AC_SUBST(package_depth)
747 AUTOGENERATE="This file was automatically generated by configure"
748 AC_SUBST(AUTOGENERATE)
751 AC_ARG_ENABLE(config,
752 [AS_HELP_STRING([--enable-config=CONF],
753 [put settings in config-CONF.make and config-CONF.h;
754 do `make conf=CONF' to get output in ./out-CONF])],
755 [CONFIGURATION=$enableval])
759 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
760 CONFIGFILE=config$CONFIGSUFFIX
761 AC_SUBST(CONFIGSUFFIX)
764 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
765 STEPMAKE_PROGS(FIND, find, REQUIRED)
767 STEPMAKE_PROGS(TAR, tar, REQUIRED)
769 if test "$(echo 2)" != "2" ||
770 test "x`uname`" = "xHP-UX"; then
771 AC_PATH_PROG(KSH, ksh, /bin/ksh)
772 AC_PATH_PROG(BASH, bash, $KSH)
773 STEPMAKE_WARN(avoiding buggy /bin/sh)
774 AC_PATH_PROG(SHELL, bash, $KSH)
777 AC_PATH_PROG(BASH, bash, $SHELL)
781 STEPMAKE_PYTHON(REQUIRED, 1.5)
783 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
784 $MAKE -v 2> /dev/null | grep GNU > /dev/null
785 if test "$?" = 1; then
786 warn='make (Please install *GNU* make)'
787 # STEPMAKE_WARN($warn)
788 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
799 AC_SUBST(program_prefix)
800 AC_SUBST(program_suffix)
804 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
805 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
815 AC_DEFUN(STEPMAKE_LIB, [
816 STEPMAKE_PROGS(AR, ar, $1)
818 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
822 AC_DEFUN(STEPMAKE_LIBTOOL, [
824 # **Never** try to set library version numbers so that they correspond
825 # to the release number of your package. This is an abuse that only
826 # fosters misunderstanding of the purpose of library versions.
828 REVISION=$PATCH_LEVEL
829 # CURRENT=$MINOR_VERSION
830 CURRENT=`expr $MINOR_VERSION + 1`
831 # AGE=`expr $MAJOR_VERSION + 1`
839 AC_DEFUN(STEPMAKE_LOCALE, [
844 AC_ARG_WITH(localedir,
845 [AS_HELP_STRING([--with-localedir=DIR],
846 [location of locales. Default: PREFIX/share/locale])],
847 localedir=$with_localedir,
848 localedir='${prefix}/share/locale')
851 [AS_HELP_STRING([--with-lang=LANG],
852 [use LANG as language to emit messages])],
856 AC_MSG_CHECKING(language)
858 En* | en* | Am* | am* | US* | us*)
860 NL | nl | Du* | du* | Ned* | ned*)
869 if test "$lang" = "unknown" ; then
870 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
876 AC_DEFUN(STEPMAKE_MAKEINFO, [
877 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
881 AC_DEFUN(STEPMAKE_MAN, [
882 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
884 STEPMAKE_PROGS(TROFF, troff, $1)
886 STEPMAKE_PROGS(TBL, tbl, $1)
891 AC_DEFUN(STEPMAKE_MSGFMT, [
892 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
896 # Check for program ($2), set full path result to ($1).
897 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
898 AC_DEFUN(STEPMAKE_PATH_PROG, [
899 AC_CHECK_PROGS($1, $2, no)
900 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
901 if test $? -eq 0; then
903 if test -n "$4"; then
904 STEPMAKE_CHECK_VERSION($1, $3, $4)
910 # Check for program in set of names ($2), set result to ($1) .
911 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
912 # If exists, and a minimal version ($4) is required
913 AC_DEFUN(STEPMAKE_PROGS, [
914 AC_CHECK_PROGS($1, $2, no)
915 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
916 if test $? -eq 0 -a -n "$4"; then
917 STEPMAKE_CHECK_VERSION($1, $3, $4)
922 AC_DEFUN(STEPMAKE_PERL, [
923 STEPMAKE_PATH_PROG(PERL, perl, $1)
927 AC_DEFUN(STEPMAKE_PYTHON, [
929 AC_MSG_CHECKING([for python])
930 for python in $PYTHON python python2 python2.4 python2.3 python2.2 python2.1 python2.0; do
931 AC_MSG_RESULT([$python])
932 if ! $python -V > /dev/null 2>&1 ; then
933 #AC_MSG_WARN([cannot execute $python])
934 PYTHON='echo no python'
937 STEPMAKE_CHECK_VERSION(python, pv, $2)
938 if test -z "$pv"; then
944 if test -n "$pv"; then
945 STEPMAKE_ADD_ENTRY($1, $pv)
947 # clear cached value since arg 2 might point us to a new binary
948 unset ac_cv_path_PYTHON
950 AC_PATH_PROG(PYTHON, $PYTHON)
954 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
955 AC_ARG_WITH(python-include,
956 [AS_HELP_STRING([--with-python-include=DIR],
957 [location of the python include dir])],[
958 if test "$withval" = "yes" -o "$withval" = "no"; then
959 AC_MSG_WARN(Usage: --with-python-include=includedir)
961 PYTHON_CFLAGS="-I${withval}"
965 AC_ARG_WITH(python-lib,
966 [AS_HELP_STRING([--with-python-lib=NAME],
967 [name of the python lib])],[
968 if test "$withval" = "yes" -o "$withval" = "no"; then
969 AC_MSG_WARN(Usage: --with-python-lib=name)
971 LDFLAGS="$LDFLAGS -l${withval}"
975 AC_CHECK_PROGS(PYTHON_CONFIG, python-config, no)
977 if test -z "$PYTHON_CFLAGS" -a "$PYTHON_CONFIG" != "no"; then
978 # Clean out junk: http://bugs.python.org/issue3290
979 # Python headers may need some -f* flags, leave them in.
980 # We want the sed commands to look like 's/-[WDOm][[:alnum:][:punct:]][[:alnum:][:punct:]]*//g' and 's/-arch [^[:space:]]*//g', but automake eats brackets.
981 PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags | sed -e 's/-[[WDOm]][[[:alnum:][:punct:]]][[[:alnum:][:punct:]]]*//g' | sed -e 's/-arch @<:@^@<:@:space:@:>@@:>@*//g'`
982 PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
985 if test -z "$PYTHON_CFLAGS" -a "$cross_compiling" = "no"; then
986 changequote(<<, >>)#dnl
987 # alternatively, for python >= 2.0
988 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
989 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
990 PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
991 changequote([, ])#dnl
994 if test -z "$PYTHON_HEADER"; then
995 CPPFLAGS="$PYTHON_CFLAGS $CPPFLAGS"
996 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
999 if test -z "$PYTHON_HEADER"; then
1000 warn="Python.h (python-devel, python-dev or libpython-dev package)"
1001 STEPMAKE_ADD_ENTRY($1, $warn)
1007 AC_DEFUN(STEPMAKE_STL_DATA_METHOD, [
1008 AC_CACHE_CHECK([for stl.data () method],
1009 [stepmake_cv_stl_data_method],
1010 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1012 using namespace std;
1014 void *p = v.data ();
1016 [stepmake_cv_stl_data_method=yes],
1017 [stepmake_cv_stl_data_method=no]))
1018 if test $stepmake_cv_stl_data_method = yes; then
1019 AC_DEFINE(HAVE_STL_DATA_METHOD, 1, [define if stl classes have data () method])
1024 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1026 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1029 AC_DEFUN(STEPMAKE_TEXMF, [
1030 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1031 STEPMAKE_PROGS(METAPOST, mpost, $1)
1033 AC_MSG_CHECKING(for working metafont mode)
1034 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1035 for MFMODE in $modelist; do
1036 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1037 if test -f mfput.tfm; then
1041 AC_MSG_RESULT($MFMODE)
1049 AC_DEFUN(STEPMAKE_WARN, [
1055 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1056 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1057 dnl also defines GSTUFF_PKG_ERRORS on error
1058 AC_DEFUN(PKG_CHECK_MODULES, [
1061 if test -z "$PKG_CONFIG"; then
1062 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1065 if test "$PKG_CONFIG" = "no" ; then
1066 echo "*** The pkg-config script could not be found. Make sure it is"
1067 echo "*** in your path, or set the PKG_CONFIG environment variable"
1068 echo "*** to the full path to pkg-config."
1069 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1071 PKG_CONFIG_MIN_VERSION=0.9.0
1072 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1073 AC_MSG_CHECKING(for $2)
1075 if $PKG_CONFIG --exists "$2" ; then
1079 AC_MSG_CHECKING($1_CFLAGS)
1080 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1081 AC_MSG_RESULT($$1_CFLAGS)
1083 AC_MSG_CHECKING($1_LIBS)
1084 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1085 AC_MSG_RESULT($$1_LIBS)
1089 ## If we have a custom action on failure, don't print errors, but
1090 ## do set a variable so people can do so.
1091 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1092 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1100 if test $succeeded = yes; then
1101 ifelse([$3], , :, [$3])
1103 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])
1107 AC_DEFUN(STEPMAKE_FREETYPE2, [
1108 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1109 if test "$have_freetype2" = yes; then
1110 AC_DEFINE(HAVE_FREETYPE2)
1111 save_CPPFLAGS="$CPPFLAGS"
1113 CPPFLAGS="$FREETYPE2_CFLAGS $CPPFLAGS"
1114 LIBS="$FREETYPE2_LIBS $LIBS"
1115 AC_SUBST(FREETYPE2_CFLAGS)
1116 AC_SUBST(FREETYPE2_LIBS)
1117 CPPFLAGS="$save_CPPFLAGS"
1121 #r="lib$1-dev or $1-devel"
1122 r="libfreetype6-dev or freetype?-devel"
1123 ver="`pkg-config --modversion $1`"
1124 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1128 AC_DEFUN(STEPMAKE_PANGO, [
1129 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1130 if test "$have_pango16" = yes ; then
1131 AC_DEFINE(HAVE_PANGO16)
1132 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1133 save_CPPFLAGS="$CPPFLAGS"
1135 CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1136 LIBS="$PANGO_LIBS $LIBS"
1137 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1138 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1139 AC_SUBST(PANGO_CFLAGS)
1140 AC_SUBST(PANGO_LIBS)
1141 CPPFLAGS="$save_CPPFLAGS"
1145 #r="lib$1-dev or $1-devel"
1146 r="libpango1.0-dev or pango1.0-devel"
1147 ver="`pkg-config --modversion $1`"
1148 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1152 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1153 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1154 if test "$have_pangoft2" = yes ; then
1155 AC_DEFINE(HAVE_PANGO16)
1156 AC_DEFINE(HAVE_PANGO_FT2)
1157 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1158 save_CPPFLAGS="$CPPFLAGS"
1160 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1161 LIBS="$PANGO_FT2_LIBS $LIBS"
1162 AC_CHECK_HEADERS([pango/pangoft2.h])
1163 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1164 AC_SUBST(PANGO_FT2_CFLAGS)
1165 AC_SUBST(PANGO_FT2_LIBS)
1166 CPPFLAGS="$save_CPPFLAGS"
1170 #r="lib$1-dev or $1-devel"e
1171 r="libpango1.0-dev or pango?-devel"
1172 ver="`pkg-config --modversion $1`"
1173 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1177 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1178 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1179 if test "$have_fontconfig" = yes ; then
1180 AC_DEFINE(HAVE_FONTCONFIG)
1181 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1182 save_CPPFLAGS="$CPPFLAGS"
1184 CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
1185 LIBS="$FONTCONFIG_LIBS $LIBS"
1186 AC_SUBST(FONTCONFIG_CFLAGS)
1187 AC_SUBST(FONTCONFIG_LIBS)
1188 CPPFLAGS="$save_CPPFLAGS"
1191 r="lib$1-dev or $1-devel"
1192 ver="`pkg-config --modversion $1`"
1193 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1197 AC_DEFUN(STEPMAKE_WINDOWS, [
1201 if test "$CYGWIN" = "yes"; then
1202 LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1204 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1205 elif test "$MINGW32" = "yes"; then
1209 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1215 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1216 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1219 AC_SUBST(program_suffix)
1221 AC_MSG_CHECKING([for some flavor of Windows])
1222 if test "$CYGWIN$MINGW32" = "nono"; then
1225 PLATFORM_WINDOWS=yes
1227 AC_MSG_RESULT([$PLATFORM_WINDOWS])
1228 AC_SUBST(PLATFORM_WINDOWS)
1229 STEPMAKE_PROGS(WINDRES, $target-windres windres, x)