1 dnl Copied from Audacity 1.3.10 which itself is licensed under the GPL v2 or
4 dnl Function to configure a sub-library now, because we need to know the result
5 dnl of the configuration now in order to take decisions.
6 dnl We don't worry about whether the configuration worked or not - it is
7 dnl assumed that the next thing after this will be a package-specific check to
8 dnl see if the package is actually available. (Hint: use pkg-config and
9 dnl -uninstalled.pc files if available).
10 dnl code based on a simplification of _AC_OUTPUT_SUBDIRS in
11 dnl /usr/share/autoconf/autoconf/status.m4 which implements part of
14 AC_DEFUN([AX_CONFIG_DIR],
15 [AC_REQUIRE([AC_DISABLE_OPTION_CHECKING])]
16 [m4_append([_AC_LIST_SUBDIRS], [$1], [])]
18 # Remove --cache-file and --srcdir arguments so they do not pile up.
19 ax_sub_configure_args=
21 eval "set x $ac_configure_args"
25 if test -n "$ax_prev"; then
30 -cache-file | --cache-file | --cache-fil | --cache-fi \
31 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
33 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
34 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
39 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
41 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
43 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
45 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
49 *\'*) ax_arg=`echo "$ax_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
51 ax_sub_configure_args="$ax_sub_configure_args '$ax_arg'" ;;
55 # Always prepend --prefix to ensure using the same prefix
56 # in subdir configurations.
57 ax_arg="--prefix=$prefix"
59 *\'*) ax_arg=`echo "$ax_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
61 ax_sub_configure_args="'$ax_arg' $ax_sub_configure_args"
64 if test "$silent" = yes; then
65 ax_sub_configure_args="--silent $ax_sub_configure_args"
69 AC_MSG_NOTICE([Configuring sources in $1])
70 dnl for out-of-place builds srcdir and builddir will be different, and
71 dnl builddir may not exist, so we must create it
73 dnl and also set the variables. As this isn't autoconf, the following may be
78 # Check for guested configure; otherwise get Cygnus style configure.
79 if test -f "configure.gnu"; then
80 ax_sub_configure=$ac_srcdir/configure.gnu
81 elif test -f "$ac_srcdir/configure"; then
82 ax_sub_configure=$ac_srcdir/configure
83 elif test -f "$ac_srcdir/configure.in"; then
84 # This should be Cygnus configure.
85 ax_sub_configure=$ac_aux_dir/configure
87 AC_MSG_WARN([no configuration information is in $1])
91 # The recursion is here.
92 if test -n "$ax_sub_configure"; then
93 # Make the cache file name correct relative to the subdirectory.
95 [[\\/]]* | ?:[[\\/]]* ) ax_sub_cache_file=$cache_file ;;
97 ax_sub_cache_file=$ac_top_build_prefix$cache_file ;;
100 AC_MSG_NOTICE([running $SHELL $ax_sub_configure $ax_sub_configure_args --cache-file=$ax_sub_cache_file --srcdir=$ac_srcdir])
101 # The eval makes quoting arguments work.
102 eval "\$SHELL \"\$ax_sub_configure\" $ax_sub_configure_args \
103 --cache-file=\"\$ax_sub_cache_file\" --srcdir=\"\$ax_srcdir\""
107 AC_MSG_NOTICE([Done configuring in $1])