+
+# --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
+}
+
+# lib_flags_for _liblist
+# This function returns a list of flags suitable to return with the
+# output of --libs for all of the libraries in _liblist. You can
+# add support for a new library by adding an entry for it in the
+# psuedo-hashes above if it requires additional linker options.
+lib_flags_for()
+{
+ [ -z "$WXDEBUG" ] || decho " fetching lib flags for: '$*'"
+
+ _all_ldflags=''
+ _all_libs=''
+ _wxlibs=''
+
+ is_cross && _target="-${target}"
+
+ for lib do
+
+ # We evidently can't trust people not to duplicate things in
+ # configure, or to keep them in any sort of sane order overall,
+ # so only add unique new fields here even if it takes us a while.
+ # In the case of libs, we bubble any duplicates to the end,
+ # because if multiple libs require it, static linking at least
+ # will require it to come after all of them. So long as local
+ # order is ok in configure then we should always be able to
+ # massage a correct result here like this.
+ #
+ # FIXME: ldlibs_core is totally bogus. Fix the duplication
+ # there independently of this. This covers for it, but we
+ # want to do this anyway because some libs may share common
+ # deps without a common ancestor in wx. This is not a licence
+ # for sloppy work elsewhere though and @GUI_TK_LIBRARY should
+ # be fixed.
+
+ for f in `eval echo \"\\\$ldflags_$lib\"`; do
+ match_field "$f" $_all_ldflags || _all_ldflags="$_all_ldflags $f"
+ done
+
+ if match_field "$lib" @STD_BASE_LIBS@ ; then
+ _libname="@WX_LIBRARY_BASENAME_NOGUI@"
+ else
+ _libname="@WX_LIBRARY_BASENAME_GUI@"
+ fi
+ [ $lib = base ] || _libname="${_libname}_$lib"
+ _libname="${_libname}-@WX_RELEASE@$_target"
+
+ if is_static; then
+ _wxlibs="$_wxlibs ${libdir}/lib${_libname}.a"
+ for f in `eval echo \"\\\$ldlibs_$lib\"`; do
+
+ # Only propagate duplicate -libraries to their latest
+ # possible position. Do not eliminate any other
+ # duplicates that might occur. They should be fixed
+ # in configure long before they get here.
+ # This started as a workaround for Mac -framework,
+ # but it seems like a better policy in general, which
+ # will let the more heinous bugs in configure shake out.
+ # We should maybe filter *.a here too, but not unless
+ # we have to.
+ case "$f" in
+ -l*) _all_libs="`remove_field $f $_all_libs` $f" ;;
+ *) _all_libs="$_all_libs $f" ;;
+ esac
+
+ done
+ else
+ _wxlibs="$_wxlibs -l${_libname}"
+ fi
+
+ done
+
+ if [ -n "$WXDEBUG" ]; then
+ decho " retrieved: ldflags = $_all_ldflags"
+ decho " wxlibs = $_wxlibs"
+ decho " alllibs = $_all_libs"
+ fi
+
+ echo $_all_ldflags $_wxlibs $_all_libs
+}
+
+# this is the strict subset of the above function which returns only the
+# (static) libraries themselves: this is used for linkdeps output which should
+# output the list of libraries the main program should depend on
+#
+# of course, this duplication is bad but I'll leave to somebody else the care
+# of refactoring this as I don't see any way to do it - VZ.
+
+# This (and the other cruft to support it) should be removed with
+# reference to the FIXME above when configure stops piping us a slurry
+# of options that need to be decomposed again for most practical uses - RL.
+link_deps_for()
+{
+ _wxlibs=''
+
+ is_cross && _target="-${target}"
+
+ for lib do
+ if match_field "$lib" @STD_BASE_LIBS@ ; then
+ _libname="@WX_LIBRARY_BASENAME_NOGUI@"
+ else
+ _libname="@WX_LIBRARY_BASENAME_GUI@"
+ fi
+ [ $lib = base ] || _libname="${_libname}_$lib"
+ _libname="${_libname}-@WX_RELEASE@$_target"
+
+ _wxlibs="$_wxlibs ${libdir}/lib${_libname}.a"
+ done
+
+ echo $_wxlibs
+}
+
+# Sanity check the list of libs the user provided us, if any.
+# --------------------------------------------------------------
+
+wx_libs=`echo "$libs_parameters" | tr ',' ' '`
+wx_optional_libs=`echo "$optional_libs_parameters" | tr ',' ' '`
+
+# Add the --optional-libs, if they've been compiled and aren't already added
+for i in $wx_optional_libs; do
+ if match_field $i @BUILT_WX_LIBS@; then
+ if not match_field $i $wx_libs; then
+ wx_libs="${wx_libs:+$wx_libs }$i"
+ fi
+ fi
+done
+
+[ -z "$WXDEBUG" ] || decho " user supplied libs: '$wx_libs'"
+
+# Assume we are using the GUI, unless --libs was specified with no GUI libs
+using_gui=yes
+
+if is_monolithic; then
+
+ # Only add additional info if --libs was specified and not just --optional-libs
+ if [ -n "$output_option_libs" ]; then
+ # Core libs are already built into the blob.
+ for i in std @STD_GUI_LIBS@ @STD_BASE_LIBS@; do
+ wx_libs=`remove_field $i $wx_libs`
+ done
+
+ wx_libs=`order_libs $wx_libs`
+ wx_libs="@WXCONFIG_LDFLAGS_GUI@ `lib_flags_for $wx_libs`"
+
+ # We still need the core lib deps for a static build though
+ if is_static; then
+ link_deps="${libdir}/libwx_@TOOLCHAIN_NAME@.a"
+ wx_libs="$wx_libs $link_deps $ldlibs_core $ldlibs_base"
+ else
+ wx_libs="$wx_libs -lwx_@TOOLCHAIN_NAME@"
+ fi
+ fi
+else # MONOLITHIC = 0
+
+ # Import core libs by default, expand std if specified, or add base if omitted.
+ if [ -n "$output_option_libs" ] && [ -z "$libs_parameters" ]; then
+ wx_libs="@STD_GUI_LIBS@ @STD_BASE_LIBS@"
+ elif match_field all $wx_libs; then
+ wx_libs="@BUILT_WX_LIBS@"
+ elif match_field std $wx_libs; then
+ # Bubble any libs that were already specified to the end
+ # of the list and ensure static linking order is retained.
+ wx_libs=`remove_field std $wx_libs`
+ for i in @STD_GUI_LIBS@ @STD_BASE_LIBS@; do
+ wx_libs="`remove_field $i $wx_libs` $i"
+ done
+ elif not match_field base $wx_libs ; then
+ # Only add base if --libs was specified and not just --optional-libs
+ if [ -n "$output_option_libs" ]; then
+ wx_libs="$wx_libs base"
+ fi
+ fi
+
+ if [ -n "$output_option_libs" ]; then
+ using_gui=no
+ for i in $wx_libs ; do
+ if match_field "$i" @STD_GUI_LIBS@; then
+ _guildflags="@WXCONFIG_LDFLAGS_GUI@"
+ using_gui=yes
+ break
+ fi
+ match_field "$i" @STD_BASE_LIBS@ || using_gui=yes
+ done
+ fi
+
+ if is_static; then
+ link_deps=`link_deps_for $wx_libs`
+ fi
+ wx_libs=`order_libs $wx_libs`
+ wx_libs="$_guildflags `lib_flags_for $wx_libs`"
+fi
+
+
+# If they explicitly set "--cxx(pp)flags base" then they don't want the GUI
+if [ "$cxx_parameters" = "base" ]; then
+ using_gui=no
+fi
+
+
+if [ -n "$WXDEBUG" ]; then
+ decho
+ decho " using libs: '$wx_libs'"
+ decho " using_gui = $using_gui"
+ decho
+fi
+
+
+# Endgame. Nothing left to discover now.
+# --------------------------------------------------------------
+
+[ "$using_gui" = "yes" ] || _gui_cppflags="-DwxUSE_GUI=0"
+
+if is_installed; then
+ _include_cppflags="-I${includedir}/wx-@WX_RELEASE@@WX_FLAVOUR@"