+# Legacy wx-config helpers.
+# -------------------------
+
+# get_legacy_mask
+# Returns a mask in the format used by wx2.4.
+get_legacy_mask()
+{
+ [ $# -gt 0 ] || set m
+ eval [ "x\${$1_chartype}" != "xunicode" ] || _unicode_flag=u
+ eval [ "x\${$1_debugtype}" != "xdebug" ] || _debug_flag=d
+ eval echo "wx\${$1_toolkit}${_unicode_flag}${_debug_flag}-\${$1_version}\${$1_host}-config"
+}
+
+# find_legacy_configs
+# Returns a list of configs installed by wx2.4 releases.
+find_legacy_configs()
+{
+ cd "$prefix/bin" 2> /dev/null && \
+ ls wx*-2.4-config | grep -v ^wxbase; \
+ ls wx*-2.4-config | grep ^wxbase
+}
+
+# find_best_legacy_config
+# Returns the best legacy config for a given specification.
+# This assumes no matching new style config has been found.
+find_best_legacy_config()
+{
+ _legacy_configs=$(find_legacy_configs)
+ if [ -n "$_legacy_configs" ]; then
+ _legacy_mask=$(get_legacy_mask)
+ for d in $_legacy_configs; do
+ if echo $d | grep -E $_legacy_mask > /dev/null 2>&1 ; then
+ echo "$d"
+ return
+ fi
+ done
+ fi
+ false
+}
+
+
+