X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89b1afb48f662a4231d5727ff06a3a278e979a43..b02dd12239c8a59b9a545d9fcb04974f8ad02c6b:/wx-config.in diff --git a/wx-config.in b/wx-config.in index 748c8856fb..261e024e9b 100755 --- a/wx-config.in +++ b/wx-config.in @@ -46,7 +46,7 @@ usage() wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--release] [--version-full] [--list] [--selected-config] [--host=HOST] [--toolkit=TOOLKIT] [--universal[=yes|no]] [--unicode[=yes|no]] [--static[=yes|no]] - [--version[=VERSION]] [--basename] [--cc] [--cxx] + [--debug[=yes|no]] [--version[=VERSION]] [--basename] [--cc] [--cxx] [--cppflags [base]] [--cxxflags [base]] [--cflags] [--rescomp] [--linkdeps] [--ld] [--utility=UTIL] [--libs [LIBS...]] [--optional-libs [LIBS...]] @@ -55,7 +55,11 @@ usage() your system. It may be used to retrieve the information required to build applications using these libraries using --cppflags, --cxxflags, --cflags, and --libs options. And you may query the properties of this configuration - using --query-{host,toolkit,widgetset,chartype,version,linkage}. + using --query-{host,toolkit,widgetset,chartype,debugtype,version,linkage}. + + NOTE: Usage of --debug and --query-debugtype are only relevant if you + have any versions prior to 2.9 installed and use the --version option to + select an earlier version. If multiple builds of wxWidgets are available, you can use the options --prefix, --host, --toolkit, --unicode, --static, --universal or --version @@ -114,7 +118,7 @@ EGREP="@EGREP@" # configs to this one. Options earlier in the list should be more crucial # to match well than those that follow. Options specified by the user will # always take precedence and are not subject to any partial ordering here. -wxconfig_schema="host toolkit widgetset chartype flavour version linkage" +wxconfig_schema="host toolkit widgetset chartype debugtype flavour version linkage" # Options that are expected to generate some output. wxconfig_output_options="prefix exec_prefix @@ -241,13 +245,16 @@ check_yesno_option() } +MAC_FRAMEWORK= +MAC_FRAMEWORK_PREFIX= + # Now we are ready to find out what the user wants from us. # -------------------------------------------------------------- # With just a little more complexity here we could have shortest # unique string matching for options, but that is probably overkill -# today, so lets just get the job done. +# today, so let's just get the job done. # # The important thing now then is that we simply read all input from # the user and don't try to act prematurely on partial information. @@ -322,6 +329,7 @@ done check_yesno_option universal widgetset univ check_yesno_option unicode chartype unicode ansi check_yesno_option static linkage static +check_yesno_option debug debugtype debug release # Dump everything we just read in debug mode. if [ -n "$WXDEBUG" ]; then @@ -352,7 +360,7 @@ fi -# Everything came in as a legal argument then, lets put some of +# Everything came in as a legal argument then, let's put some of # the pieces together with a little self knowledge to see what # we should do next. # -------------------------------------------------------------- @@ -364,7 +372,28 @@ fi get_mask() { [ $# -gt 0 ] || set m - eval echo "\${$1_host:+\$$1_host-}\${$1_toolkit}\${$1_widgetset}-\${$1_chartype}\${$1_linkage:+-\$$1_linkage}-\${$1_version}\${$1_flavour}" + + case "$m_ourversion" in + 2.9) + is29orlater=1 + ;; + 2.*) + # there is no 2.10 so currently everything else is <= 2.8 + is29orlater=0 + ;; + *) + # 3.x and later "is29orlater" too + is29orlater=1 + ;; + esac + + # use 2.8 or 2.9 version of the mask: the difference is the presence of + # debug type in pre-2.9 + if [ $is29orlater = 1 ]; then + eval echo "\${$1_host:+\$$1_host-}\${$1_toolkit}\${$1_widgetset}-\${$1_chartype}\${$1_linkage:+-\$$1_linkage}-\${$1_version}\${$1_flavour}" + else + eval echo "\${$1_host:+\$$1_host-}\${$1_toolkit}\${$1_widgetset}-\${$1_chartype}-\${$1_debugtype}\${$1_linkage:+-\$$1_linkage}-\${$1_version}\${$1_flavour}" + fi } # Returns true if this script is for a cross compiled config. @@ -386,12 +415,11 @@ this_host="${target:+${target}}" this_toolkit="@TOOLKIT_DIR@@TOOLKIT_VERSION@" this_widgetset="@WIDGET_SET@" this_chartype="@WX_CHARTYPE@" +this_debugtype="release" this_flavour="@WX_FLAVOUR@" this_version="@WX_RELEASE@" this_linkage=`[ "x@SHARED@" = "x1" ] || echo 'static'` -this_config=`get_mask this` - # Extract the user specification from the options parsed. m_host=${input_option_host:+"${input_option_host}-?"} @@ -399,11 +427,25 @@ m_host=${m_host:-$this_host} m_toolkit=${input_option_toolkit:-'[^-]+'} m_widgetset=${input_option_widgetset-'(univ)?'} m_chartype=${input_option_chartype:-'(unicode|ansi)'} +m_debugtype=${input_option_debugtype:-'(debug|release)'} m_flavour=${input_option_flavour:+-$input_option_flavour} m_flavour=${m_flavour:-${input_option_flavour-'(-[^-]+)?'}} m_version=${input_option_version:-'[0-9]+\.[0-9]+'} m_linkage=${input_option_linkage-'?(static)?'} +# Test whether or not --version has been specified +# +# This must be done after getting the input options so get_mask works correctly +# since it is version-dependent + +if [ -z "$input_option_version" ]; then + m_ourversion="2.9" +else + m_ourversion=$m_version +fi + +this_config=`get_mask this` + configmask="^`get_mask`$" @@ -419,6 +461,7 @@ if [ -n "$WXDEBUG" ]; then decho " m_toolkit = '$m_toolkit'" decho " m_widgetset = '$m_widgetset'" decho " m_chartype = '$m_chartype'" + decho " m_debugtype = '$m_debugtype'" decho " m_flavour = '$m_flavour'" decho " m_version = '$m_version'" decho " m_linkage = '$m_linkage'" @@ -520,7 +563,7 @@ not() { if "$@"; then false; else true; fi; } # and its downhill fast from here if we have to ride that boat. # Early pruning still gets that down to under half a second (up from about # .25), so we have some breathing space yet before a different search method -# will be called for, but lets not squander it. +# will be called for, but let's not squander it. do_find_best_delegate() { ( @@ -756,7 +799,7 @@ fi if not user_mask_fits "$this_config" ; then - # No? Then lets see if it knows anybody who can. + # 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. @@ -992,6 +1035,41 @@ 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 @@ -1131,6 +1209,7 @@ if is_monolithic; then 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 @@ -1177,6 +1256,7 @@ else # MONOLITHIC = 0 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 @@ -1223,9 +1303,18 @@ if [ -n "$output_option_libs" ]; then [ "x$libdir" = "x/usr/lib" ] || _ldflags="-L$libdir" + if [ -n "$MAC_FRAMEWORK" ]; then + wx_libs="-framework $MAC_FRAMEWORK" + if [ -n "$MAC_FRAMEWORK_PREFIX" ]; then + _ldflags="-F$MAC_FRAMEWORK_PREFIX" + else + _ldflags="" + fi + fi + is_installed || [ -n "$flag_option_no_rpath" ] || _rpath="@WXCONFIG_RPATH@" - echo $_ldflags "@LDFLAGS@" $_rpath $wx_libs "@DMALLOC_LIBS@" + echo $_ldflags "@WXCONFIG_LDFLAGS@" $_rpath $wx_libs "@DMALLOC_LIBS@" elif [ -n "$output_option_optional_libs" ]; then # if only --optional-libs then output just the libs