+ _delegates=`remove_field "$_best_delegate" $_delegates`
+
+ if [ -n "$_delegates" ]; then
+ echo
+ echo " Alternate matches:"
+ for d in $_delegates; do
+ echo " $d"
+ done
+ fi
+ if [ -n "$_remains_in_prefix" ]; then
+ echo
+ echo " Also available in $prefix:"
+ for d in $_remains_in_prefix; do
+ echo " $d"
+ done
+ fi
+
+ _legacy_configs=`find_legacy_configs`
+ if [ -n "$_legacy_configs" ]; then
+ echo
+ echo " Legacy configs available in $prefix:"
+ for d in $_legacy_configs; do
+ echo " $d" | sed 's/-config$//'
+ done
+ fi
+
+ echo
+ exit
+fi
+
+
+
+# ... so if that wasn't what they wanted, then we need to know for
+# certain, can this config satisfy the user specification?
+# --------------------------------------------------------------
+
+if not user_mask_fits "$this_config" ; then
+
+ # No? Then let's see if it knows anybody who can.
+ # But first, just be sure someone hasn't typo'd us into a loop.
+ # In present day wx, correct delegation should never need more
+ # than one hop so this is trivial to detect.
+
+ if [ -n "$WXCONFIG_DELEGATED" ]; then
+ decho
+ decho " *** Error: Bad config delegation"
+ decho
+ decho " to: $0"
+ decho " ($this_config) cannot satisfy:"
+ decho " $config_spec"
+ decho " Someone has been terribly careless."
+ decho
+ exit 1
+ fi
+
+ count_delegates "$configmask"
+ _numdelegates=$?
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " must delegate to an alternate config"
+ decho " potential delegates ($_numdelegates):"
+ for i in `find_eligible_delegates "$configmask"`; do
+ decho " $i"
+ done
+ fi
+
+ if [ $_numdelegates -eq 0 ]; then
+
+ _last_chance=`find_best_legacy_config`
+ if [ -n "$_last_chance" ]; then
+
+ for arg do
+ case "$arg" in
+ --prefix*|--exec-prefix*| \
+ --version|--release|--basename| \
+ --static|--libs|--gl_libs| \
+ --cppflags|--cflags|--cxxflags| \
+ --cc|--cxx|--ld| \
+ --rezflags|--inplace)
+ _legacy_args="$_legacy_args $arg"
+ ;;
+
+ --static|--static=y*|--static=Y*)
+ _legacy_args="$_legacy_args --static"
+ ;;
+ esac
+ done
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " found a suitable legacy delegate: $_last_chance"
+ decho "--> $prefix/bin/$_last_chance $_legacy_args"
+ fi
+
+ WXCONFIG_DELEGATED=yes
+ export WXCONFIG_DELEGATED
+ $prefix/bin/$_last_chance $_legacy_args
+ exit
+
+ else
+
+ cat 1>&2 <<-EOF
+
+ Warning: No config found to match: $config_spec
+ in $wxconfdir
+ If you require this configuration, please install the desired
+ library build. If this is part of an automated configuration
+ test and no other errors occur, you may safely ignore it.
+ You may use wx-config --list to see all configs available in
+ the default prefix.
+
+EOF
+
+ # PIPEDREAM: from here we are actually just a teensy step
+ # from simply building the missing config for the user
+ # on the fly if this is an in tree wx-config.
+
+ exit 1
+ fi
+ fi
+
+ if [ $_numdelegates -gt 1 ]; then
+
+ [ -z "$WXDEBUG" ] || decho " must prune the list of eligible delegates"
+
+ best_delegate=`find_best_delegate`
+
+ if [ -n "$best_delegate" ]; then
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " found a suitable delegate: $best_delegate"
+ decho "--> $wxconfdir/$best_delegate $*"
+ fi
+
+ WXCONFIG_DELEGATED=yes
+ export WXCONFIG_DELEGATED
+ $wxconfdir/$best_delegate $*
+ exit
+ fi
+
+ decho
+ decho " *** Error: Specification is ambiguous"
+ decho " as $config_spec"
+ decho " Use additional feature options to choose between:"
+ for i in `find_eligible_delegates "$configmask"`; do
+ decho " $i"
+ done
+ decho
+
+ exit 1
+ fi
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " using the only suitable delegate"
+ decho "--> $wxconfdir/`find_eligible_delegates $configmask` $*"
+ fi
+
+ WXCONFIG_DELEGATED=yes
+ export WXCONFIG_DELEGATED
+ $wxconfdir/`find_eligible_delegates $configmask` $*
+ exit
+fi
+
+
+
+# If we are still here, then from now on we are responsible for
+# all the user's needs. Time to rustle up some output for them.
+# --------------------------------------------------------------
+
+[ -z "$WXDEBUG" ] || decho " using this config"
+
+# If the user supplied a prefix, and the in tree config did not
+# delegate out to anything in that prefix, then reset the build
+# tree prefix to provide the correct output for using this
+# uninstalled wx build. Or put more simply:
+prefix=${this_prefix-$prefix}
+exec_prefix=${this_exec_prefix-$exec_prefix}
+
+includedir="@includedir@"
+libdir="@libdir@"
+bindir="@bindir@"
+
+# Trivial queries we can answer now.
+[ -z "$output_option_prefix" ] || echo $prefix
+[ -z "$output_option_exec_prefix" ] || echo $exec_prefix
+[ -z "$output_option_release" ] || echo "@WX_RELEASE@"
+[ -z "$output_option_version" ] || echo "@WX_VERSION@"
+[ -z "$output_option_version_full" ] || echo "@WX_SUBVERSION@"
+[ -z "$output_option_basename" ] || echo "@WX_LIBRARY_BASENAME_GUI@"
+[ -z "$output_option_cc" ] || echo "@CC@"
+[ -z "$output_option_cxx" ] || echo "@CXX@"
+[ -z "$output_option_ld" ] || echo "@CXX@ -o"
+[ -z "$flag_option_selected_config" ] || echo "$this_config"
+
+for q in $query_options; do
+ eval echo "\$this_$q"
+done
+
+# --rezflags is deprecated and disabled (2005/11/29)
+if [ -n "$output_option_rezflags" ]; then
+ echo "@true"
+ decho "Warning: --rezflags, along with Mac OS classic resource building" \
+ "is deprecated. You should remove this from your Makefile and" \
+ "build .app bundles instead."
+fi
+
+
+# The rest are going to need a little more work.
+# --------------------------------------------------------------
+
+is_monolithic() { [ "x@MONOLITHIC@" = "x1" ]; }
+is_static() { [ -n "$this_linkage" ]; }
+is_installed() { [ -z "$this_prefix" ]; }
+
+
+# Is the user after a support utility?
+# If this is a cross build, we need to find and return a suitable
+# native utility for the job, so we search:
+#
+# 1. local build dir (for native uninstalled builds only).
+# 2. (optional) user supplied prefix.
+# 3. configured install prefix.
+# 4. environment $PATH.
+#
+# and if such a thing still cannot be found, exit signalling an error.
+if [ -n "$input_option_utility" ]; then
+
+ # This is dumb, in tree binaries should be in a standard location
+ # like the libs, but work with what we've got for now.
+ is_cross || _util="$exec_prefix/utils/$input_option_utility/$input_option_utility"
+
+ if not is_installed && [ -x "$_util" ]; then
+ is_static || _preload="eval LD_LIBRARY_PATH=$exec_prefix/lib"
+ echo $_preload $_util
+ exit
+ fi
+
+ IFS=':'
+ _user_prefix=${input_option_exec_prefix:-$input_option_prefix}
+
+ for _util in "${input_option_utility}-@WX_RELEASE@@WX_FLAVOUR@" \
+ "${input_option_utility}-@WX_RELEASE@" \
+ "${input_option_utility}"
+ do
+ for p in ${_user_prefix:+$_user_prefix/bin} $bindir $PATH; do
+
+ [ -z "$WXDEBUG" ] || decho " checking for: '$p/$_util'"
+
+ if [ -x "$p/$_util" ]; then
+ echo "$p/$_util"
+ exit
+ fi
+
+ done
+ done
+ exit 1
+
+fi
+
+
+# Still here? Then get the options together for building an app.
+# ----------------------------------------------------------------
+
+# Additional configuration for individual library components.
+ldflags_gl="@LDFLAGS_GL@"
+
+ldlibs_base="@WXCONFIG_LIBS@"
+ldlibs_core="@EXTRALIBS_GUI@"
+ldlibs_gl="@OPENGL_LIBS@"
+ldlibs_html="@EXTRALIBS_HTML@"
+ldlibs_xml="@EXTRALIBS_XML@"
+ldlibs_adv="@EXTRALIBS_SDL@"
+ldlibs_stc="@EXTRALIBS_STC@"
+
+
+# Order the libraries passed to us correctly for static linking.
+#
+# While the libraries order doesn't matter when linking dynamically, we must
+# put the libraries depending on other libraries in front of their dependencies
+# when linking statically or the dependencies wouldn't be resolved by the
+# standard UNIX linkers.
+order_libs()
+{
+ if is_static; then
+ for lib do
+ # Distinguish between the libraries that may need to be moved to
+ # the end of the list (because other ones may depend on them) and
+ # those that can be output immediately because no other libraries
+ # depend on them.
+ case "$lib" in
+ base|core|html|xml|adv) eval "use_$lib=1" ;;
+ *) libs="$libs $lib" ;;
+ esac
+ done
+
+ # Add the libraries that we postponed adding above.
+ # Order of the checks here is important.
+ [ -z "$use_html" ] || libs="$libs html"
+ [ -z "$use_adv" ] || libs="$libs adv"
+ [ -z "$use_core" ] || libs="$libs core"
+ [ -z "$use_xml" ] || libs="$libs xml"
+ [ -z "$use_base" ] || libs="$libs base"
+ else
+ # No need to order them.
+ libs="$@"
+ fi
+
+ echo $libs