]> git.saurik.com Git - wxWidgets.git/blame - wx-config.in
Fix branch name.
[wxWidgets.git] / wx-config.in
CommitLineData
9a98a854 1#!/bin/sh
ceec2216
RL
2#
3# Name: wx-config{.in,}
4# Purpose: wx configuration search and query tool {template,}
5# Author: Ron <ron@debian.org>
6# Modified by:
7# Created: 8/9/2004
8# RCS-ID: $Id$
9# Copyright: (c) 2004 Ron <ron@debian.org>
10# Essentially a fresh start this time around, but for maximum
11# compatibility basic code was taken from, and heavy reference
12# made to, the previously unattributed wx-config from cvs.
13# All the usual suspects contributed to the dicussion that led
14# to this new work and likewise to the ideas and content in the
15# original (which was probably influenced by gtk), among them:
16# Robert Roebling, Vadim Zeitlin, Vaclav Slavik, Robin Dunn
17# Licence: wxWindows licence
18############################################################################
19
6758d3d3 20# Extra^2 debug mode, for if things ever get really weird.
8ec45325
RL
21[ -z "$WXDEBUG_X" ] || set -x
22
68ca6f52
RL
23
24# On with some basic stuff, like the ability to die gracefully,
ceec2216
RL
25# and to tell people what we are about.
26# ------------------------------------------------------------------
27
28# decho _message
29# Output a message to stderr.
30decho() { echo "$*" 1>&2; }
31
32# usage _exitcode
33# Outputs a usage message to stderr and exits with _exitcode.
63f018eb
RL
34# Try to keep this to a single page (ie. < 25 lines). We can add
35# alternate or interactive help targets if people want more detail.
36#
37# Exit codes are now subject to a more strict interpretation.
38# wx-config should return 0 upon successful operation, 1 if the
39# reqested operation could not be completed successfully, and 2
40# if the requested operation is not supported by this version of
41# wx-config.
ceec2216
RL
42usage()
43{
44 cat 1>&2 <<EOF
45
46 wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--release] [--version-full]
16837dc3 47 [--list] [--selected-config] [--host=HOST] [--toolkit=TOOLKIT]
bd630206 48 [--universal[=yes|no]] [--unicode[=yes|no]] [--debug[=yes|no]]
6bddfdbf
VZ
49 [--static[=yes|no]] [--version[=VERSION]] [--basename]
50 [--cc] [--cxx] [--cppflags [base]] [--cxxflags [base]] [--cflags]
51 [--rescomp] [--linkdeps] [--ld] [--utility=UTIL]
bd630206 52 [--libs [LIBS...]] [--optional-libs [LIBS...]]
16837dc3
VZ
53
54 wx-config returns information about the wxWidgets libraries available on
55 your system. It may be used to retrieve the information required to build
6bddfdbf 56 applications using these libraries using --cppflags, --cxxflags, --cflags,
16837dc3
VZ
57 and --libs options.
58
59 If multiple builds of wxWidgets are available, you can use the options
60 --prefix, --host, --toolkit, --unicode, --debug, --static, --universal and
61 --version to select from them. The --selected-config option shows the name
62 of the current configuration and --list shows available alternatives which
63 match specified criteria. The --utility option returns the correct version
64 of UTIL to use with the selected build. The --linkdeps option returns only
65 static libraries for your makefile link rule dependencies.
ceec2216 66
bd630206
VZ
67 The LIBS arguments (comma or space separated) may be used to specify the
68 wxWidgets libraries that you wish to use. The "std" label may be used to
69 import all libraries that would be used by default if none were specified
70 explicitly, e.g. wx-config --libs core,base. The "all" label may be used
71 to import all libraries that have been compiled which are shown in the
72 list below. The --optional-libs parameter should be followed by a list
73 of libs that should be linked to, but only if they are available.
74
de0573da
FM
75 Available libraries in this build are:
76 @BUILT_WX_LIBS@
9a98a854 77
ceec2216 78EOF
33380099 79
ceec2216
RL
80 exit $1
81}
33380099 82
ceec2216
RL
83# Unfussy people are the easiest to deal with, get them out of the way now.
84[ $# -gt 0 ] || usage 1
33380099 85
33380099 86
8ec45325
RL
87# Contentious tools determined by configure.
88EGREP="@EGREP@"
89
cf615ebb 90
ceec2216
RL
91# For the people who know what they want, or think they do:
92# Divide the valid arguments into functional groups for later examination,
93# then parse all command line arguments completely, deferring action on
94# output options until all significant input has been processed and any
95# decision about delegation has been taken.
cf615ebb 96
ceec2216
RL
97# Note early, that '-' is a complete no-no for use in option names below.
98# It totally falls apart as soon as it becomes part of a variable name.
99# Use '_' instead, and by the magic of it all just being bits, you'll
100# be able to use --my-option or --my_option from the command line at
101# your discretion. They are synonymous as user input, but _ALWAYS_ use
102# underscores for compound names in the code here, never a dash.
103
104
105# The list of all options we recognise. If it is not in here, then
106# it is not something we want to handle.
107# ------------------------------------------------------------------
108
109# Options that specify a distinct library build.
110#
111# Note also that order in this list is significant later on, as this sets
112# the precedence with which we will try to gauge the similarity of other
113# configs to this one. Options earlier in the list should be more crucial
114# to match well than those that follow. Options specified by the user will
115# always take precedence and are not subject to any partial ordering here.
116wxconfig_schema="host toolkit widgetset chartype debugtype flavour version linkage"
117
118# Options that are expected to generate some output.
92ea30ce
RL
119wxconfig_output_options="prefix exec_prefix
120 list
121 release version version_full
122 basename
123 cppflags cflags cxxflags
370d2fd7 124 rescomp
891ace05 125 rezflags
92ea30ce 126 libs
bd630206 127 optional_libs
92ea30ce
RL
128 linkdeps
129 cc cxx ld
ceec2216
RL
130 gl_libs"
131
132# Options that permit the user to supply hints that may affect the output.
133# These options all accept arbitrary values, to interpret as they please.
63f018eb 134wxconfig_input_options="prefix exec_prefix utility $wxconfig_schema"
cf615ebb 135
ceec2216
RL
136# Input options that accept only a yes or no argument.
137wxconfig_yesno_options="universal unicode debug static"
cf615ebb 138
ceec2216 139# Boolean options that do something or not.
6758d3d3 140wxconfig_flag_options="$wxconfig_yesno_options selected_config no_rpath inplace"
33380099 141
33380099 142
33380099 143
ceec2216
RL
144# Some simple sugar coating to keep things more readable below.
145# --------------------------------------------------------------
146
147# option_name _string
148# Returns NAME if _string is of the form: --NAME[=...]
149option_name()
150{
b2f55c8b 151 echo "$1" | sed 's/^--//;s/=.*//' | tr '-' '_'
ceec2216
RL
152}
153
154# option_value _string
155# Returns FOO if _string is of the form: --option=FOO
156option_value()
157{
b2f55c8b 158 echo "$1" | sed 's/^[^=]*=//'
ceec2216
RL
159}
160
161# match_field _value _list
162# Returns true if _value is a field in _list
163match_field()
164{
165 _match_field_match="$1"
166 shift
b2f55c8b 167 for _match_field_i do
ceec2216
RL
168 [ "x$_match_field_i" != "x$_match_field_match" ] || return 0
169 done
170 false
171}
172
173# remove_field _value _list
174# Returns _list minus any field(s) that match _value.
175remove_field()
cf615ebb 176{
ceec2216
RL
177 _remf_value="$1"
178 _remf_list=''
cf615ebb 179 shift
3950ea80 180 if [ -n "$_remf_value" ]; then
b2f55c8b 181 for _remf_item do
92ea30ce 182 [ "x$_remf_item" = "x$_remf_value" ] ||
3950ea80
RL
183 _remf_list="${_remf_list:+$_remf_list }$_remf_item"
184 done
185 echo "$_remf_list"
186 else
187 echo $*
188 fi
cf615ebb
VS
189}
190
ceec2216 191# validate_arg _domain _set _name _value
cf63f3d3 192# Boilerplate to validate an argument and initialise a pseudo-hash.
ceec2216
RL
193# This one is almost reduction into absurdity, and perhaps makes the
194# precise action of the argument parser below just a little more
195# obscure, but oh so neat and compact to use for multiple option
196# groups. It expands to replace repetitive clauses of the form:
197#
198# i="$(option_name $arg)"
199# if match_field "$i" $wxconfig_input_options; then
200# input_options="${input_options:+$input_options }$i"
201# eval "input_option_$i=$(option_value $arg)"
202# continue
203# fi
204#
205# with the one liners you see on the page below.
206validate_arg()
cf615ebb 207{
b2f55c8b 208 if match_field "$3" `eval echo \"\\\$$1_$2_options\"`; then
ceec2216
RL
209 eval "$2_options=\"\${$2_options:+\$$2_options }$3\""
210 eval "$2_option_$3=\"$4\""
211 return
67c13b6c 212 fi
ceec2216
RL
213 false
214}
215
216# check_yesno_option _ynoption _option _yesval _noval
217# This one might be made more generic and/or incorporated into
218# validate_arg above at some later stage, but right now we just
219# condition any specialist options into a generic one for later
220# handling. Once they are sanity checked there is no difference
221# in any case.
222check_yesno_option()
223{
92ea30ce
RL
224 eval "case \${yesno_option_$1-\${flag_option_$1-unset}} in
225 unset) ;;
226 y*|Y*) input_option_$2=\"$3\" ;;
227 n*|N*) input_option_$2=\"$4\" ;;
228 *)
229 decho
230 decho \" *** Error: Invalid request '--$1=\$yesno_option_$1'\"
231 decho \" Valid arguments for --$1 are: [ yes, no ]\"
232 decho
233 exit 1
234 ;;
ceec2216
RL
235 esac"
236}
67c13b6c 237
67c13b6c 238
ceec2216
RL
239
240# Now we are ready to find out what the user wants from us.
241# --------------------------------------------------------------
242
243# With just a little more complexity here we could have shortest
244# unique string matching for options, but that is probably overkill
245# today, so lets just get the job done.
246#
247# The important thing now then is that we simply read all input from
248# the user and don't try to act prematurely on partial information.
249# --help or an illegal argument are the only shortcuts out of here
250# at this point, otherwise, it's time to just shut up and listen for
251# a moment.
252
b2f55c8b 253for arg do
ceec2216
RL
254 case "$arg" in
255 --help|-h)
256 usage
257 ;;
258
259 --*=*)
b2f55c8b
MW
260 _name=`option_name $arg`
261 _value=`option_value $arg`
92ea30ce
RL
262 if validate_arg wxconfig input "$_name" "$_value" ||
263 validate_arg wxconfig yesno "$_name" "$_value"
ceec2216
RL
264 then
265 continue
cf615ebb 266 fi
ceec2216
RL
267 ;;
268
269 --*)
b2f55c8b 270 _name=`option_name $arg`
92ea30ce
RL
271 if validate_arg wxconfig flag "$_name" yes ||
272 validate_arg wxconfig output "$_name" yes
ceec2216
RL
273 then
274 continue
fef23dd4 275 fi
ceec2216 276 ;;
cf615ebb 277
ceec2216 278 *)
bd630206 279 # We validate the parameters later ...
6bddfdbf 280
ccde7008 281 if [ "$_name" = "cxxflags" ] || [ "$_name" = "cppflags" ] || [ "$_name" = "cflags" ]; then
6bddfdbf
VZ
282 cxx_parameters="${cxx_parameters:+$cxx_parameters }$arg"
283 elif [ "$_name" = "libs" ]; then
bd630206 284 libs_parameters="${libs_parameters:+$libs_parameters }$arg"
6bddfdbf 285 elif [ "$_name" = "optional_libs" ]; then
bd630206
VZ
286 optional_libs_parameters="${optional_libs_parameters:+$optional_libs_parameters }$arg"
287 else
1342e47c
VZ
288 # normally anything here are unattached arguments and signify an
289 # error but for compatibility with the 2.8 wx-config and,
290 # especially, configure scripts generated using 2.8 wxwin.m4 and
291 # hence doing `wx-config --version base,std`, we ignore anything
292 # following this option, just as 2.8 version used to do
293 if [ "$_name" != "version" ]; then
294 input_parameters="${input_parameters:+$input_parameters }$arg"
295 fi
bd630206 296 fi
ceec2216
RL
297 continue
298 ;;
299 esac
300 decho " *** Error: Unrecognised option: '$arg'"
301 decho "Use wx-config --help for information on command line options."
63f018eb 302 exit 2
ceec2216
RL
303done
304
305# validate_arg only checks and decomposes form. Sanity check the yes/no
306# options now too and push their respective mask values into place.
307
308check_yesno_option universal widgetset univ
309check_yesno_option unicode chartype unicode ansi
310check_yesno_option debug debugtype debug release
311check_yesno_option static linkage '-static'
312
ceec2216
RL
313# Dump everything we just read in debug mode.
314if [ -n "$WXDEBUG" ]; then
315
316 decho
bd630206
VZ
317 decho " input parameters = $input_parameters"
318 decho " libs parameters = $libs_parameters"
319 decho " optional-libs parameters = $optional_libs_parameters"
ceec2216
RL
320 decho " input options = $input_options"
321 for i in $input_options; do
b2f55c8b 322 decho " $i = `eval echo \"\\\$input_option_$i\"`"
ceec2216
RL
323 done
324 decho " yes/no options = $yesno_options"
325 for y in $yesno_options; do
b2f55c8b 326 decho " $y = `eval echo \"\\\$yesno_option_$y\"`"
ceec2216
RL
327 done
328 decho " flag options = $flag_options"
329 for f in $flag_options; do
b2f55c8b 330 decho " $f = `eval echo \"\\\$flag_option_$f\"`"
cf615ebb 331 done
ceec2216
RL
332 decho " output options = $output_options"
333 for o in $output_options; do
b2f55c8b 334 decho " $o = `eval echo \"\\\$output_option_$o\"`"
ceec2216
RL
335 done
336
337fi
338
cf615ebb 339
ceec2216
RL
340
341# Everything came in as a legal argument then, lets put some of
342# the pieces together with a little self knowledge to see what
343# we should do next.
344# --------------------------------------------------------------
345
346# get_mask [ _hash ]
347# Construct a config filename mask from a psuedo-hash of component variables.
348# The optional argument is the prefix of the hash to use. If not specified
349# this will return a mask derived from the command line options that were used.
350get_mask()
351{
352 [ $# -gt 0 ] || set m
353 eval echo "\${$1_host}\${$1_toolkit}\${$1_widgetset}-\${$1_chartype}-\${$1_debugtype}\${$1_linkage}-\${$1_version}\${$1_flavour}"
cf615ebb 354}
9a98a854 355
d9809627
RL
356# Returns true if this script is for a cross compiled config.
357is_cross() { [ "x@cross_compiling@" = "xyes" ]; }
358
ceec2216
RL
359
360# Determine the base directories we require.
361prefix=${input_option_prefix-${this_prefix:-@prefix@}}
0506bbbf 362exec_prefix=${input_option_exec_prefix-${input_option_prefix-${this_exec_prefix:-@exec_prefix@}}}
ceec2216
RL
363wxconfdir="@libdir@/wx/config"
364
b2f55c8b 365installed_configs=`cd "$wxconfdir" 2> /dev/null && ls | grep -v "^inplace-"`
ceec2216 366
d9809627 367is_cross && target="@host_alias@"
ceec2216
RL
368
369# Define a pseudo-hash to contain the specification of this wx-config
370# instance and its associated library.
371this_host="${target:+${target}-}"
372this_toolkit="@TOOLKIT_DIR@@TOOLKIT_VERSION@"
373this_widgetset="@WIDGET_SET@"
374this_chartype="@WX_CHARTYPE@"
375this_debugtype="@WX_DEBUGTYPE@"
376this_flavour="@WX_FLAVOUR@"
377this_version="@WX_RELEASE@"
b2f55c8b 378this_linkage=`[ "x@SHARED@" = "x1" ] || echo '-static'`
ceec2216 379
b2f55c8b 380this_config=`get_mask this`
ceec2216
RL
381
382# Extract the user specification from the options parsed.
b2f55c8b 383m_host=${input_option_host:+"${input_option_host}-?"}
ceec2216 384m_host=${m_host:-${input_option_host-$this_host}}
b2f55c8b
MW
385m_toolkit=${input_option_toolkit:-'[^-]+'}
386m_widgetset=${input_option_widgetset-'(univ)?'}
387m_chartype=${input_option_chartype:-'(unicode|ansi)'}
388m_debugtype=${input_option_debugtype:-'(debug|release)'}
ceec2216 389m_flavour=${input_option_flavour:+-$input_option_flavour}
b2f55c8b
MW
390m_flavour=${m_flavour:-${input_option_flavour-'(-[^-]+)?'}}
391m_version=${input_option_version:-'[0-9]+\.[0-9]+'}
392m_linkage=${input_option_linkage-'(-static)?'}
ceec2216 393
b2f55c8b 394configmask="^`get_mask`$"
ceec2216
RL
395
396
397# Dump the user specification in debug mode.
398if [ -n "$WXDEBUG" ]; then
399
400 decho
401 decho " prefix = '$prefix'"
402 decho " exec_prefix = '$exec_prefix'"
403 decho " wxconfdir = '$wxconfdir'"
404
405 decho " m_host = '$m_host'"
406 decho " m_toolkit = '$m_toolkit'"
407 decho " m_widgetset = '$m_widgetset'"
408 decho " m_chartype = '$m_chartype'"
409 decho " m_debugtype = '$m_debugtype'"
410 decho " m_flavour = '$m_flavour'"
411 decho " m_version = '$m_version'"
412 decho " m_linkage = '$m_linkage'"
413
414 decho " configmask = '$configmask'"
415 decho " this config = '$this_config'"
416 decho
417
418fi
419
420
421
9a09819a
RL
422# From here on, we'll need to be able to figure out a delegation target.
423# -----------------------------------------------------------------------
ceec2216
RL
424
425# The rules for delegation are:
426#
427# 1. If the specification is so general that it matches the default config
428# (ie. this one on a first pass), then the default config will be used
429# even if other installed libs would also match the spec.
430#
431# 2. If the default config does not match, find a list of all installed
432# libraries that do match.
433# a. If that list is empty, the specification is incompatible
434# with any installed lib. Warn and abort.
435# b. If that list contains exactly one candidate. Delegate to
436# that candidate.
437# c. If the list contains multiple candidates, pass on to step 3.
438#
439# 3. Attempt to discriminate among rival candidates by their similarity
440# to the default configuration (ie. this one). If we can find a unique
441# candidate in this way, delegate to it. If not, present a list of
442# options to the user and request that they disambiguate it with one or
443# more additional fields.
444#
445# To refine the specified pattern, we specialise each unbound field
446# using the default value from this config file. If that results in
447# no matches, we unbind it again and try the next field. If it still
448# results in multiple matches we try binding the next field as well
449# until a unique or null result again occurs.
450#
451# A more general way to look at this, is the feature specifiers are all
452# modifiers of the wx-config you are calling. If you supply none, the
453# default for that build configuration will be used. If you supply one
454# or more that the default build cannot satisfy, it will try to find the
455# config most like itself with the desired feature(s) enabled.
456# The features configured into the first wx-config called will be taken
457# as implicitly specified if it is necessary to disambiguate likely
458# candidates from the information that was explicitly provided.
459
460
461# But first, more sugar to keep what follows clear and legible.
462# --------------------------------------------------------------
463
9a09819a
RL
464# find_eligible_delegates _mask
465# Outputs all the config files installed which match the
466# (extended regex) _mask passed as an argument.
8ec45325 467find_eligible_delegates() { echo "$installed_configs" | $EGREP "$1" 2> /dev/null; }
9a09819a
RL
468
469# user_mask_fits _config
470# Returns true if the string _config satisfies the user specified mask.
8ec45325 471user_mask_fits() { echo "$1" | $EGREP "$configmask" > /dev/null 2>&1; }
9a09819a 472
ceec2216
RL
473# count_fields _word
474# Returns the number of IFS split fields in _word
475count_fields() { return $#; }
476
477# count_delegates _mask
478# Return the number of eligible config files that match _mask
b2f55c8b 479count_delegates() { count_fields `find_eligible_delegates $1`; }
ceec2216
RL
480
481# is_set _variablename
482# Returns true if $_variablename is initialised.
b2f55c8b
MW
483is_set() { [ "x`eval echo \"\\\${$1-unset}\"`" != "xunset" ]; }
484
485# not _cmd _args...
486# true iff _cmd is false
ac2e7107 487not() { if "$@"; then false; else true; fi; }
ceec2216
RL
488
489# do_find_best_delegate _unbound-options
490# The real worker part of find_best_delegate below. Recurses though all
491# unbound options binding them one at a time to the default derived from
492# this file until a unique match is made or no alternatives remain that
493# may be sensibly guessed at. It will preferentially bind the unspecified
494# options in the order they are listed in wxconfig_schema. Using this
495# partial ordering it should find the first match with the most significant
496# similarity to this file that unambiguously meets the user specification.
497# If such a match exists it will be output to stdout.
498#
499# Be careful if you modify this function. If the pruning logic is rendered
500# inoperative it will simply recurse over every permutation in the search
501# space, which may still appear to work, but add a couple more options (or
502# explicitly specify a few less) and you may not live long enough to learn
503# the result. WXDEBUG=findprogress is your friend here, it will show you
504# how many nodes get searched before a result. If you start seeing
505# increases in that number for the same input, check your work.
506# Raising the number of discriminating options from 6 to 8 raised the worst
507# case time for this to run (without pruning) from 3 to nearly 15 seconds
508# and its downhill fast from here if we have to ride that boat.
509# Early pruning still gets that down to under half a second (up from about
510# .25), so we have some breathing space yet before a different search method
511# will be called for, but lets not squander it.
512do_find_best_delegate()
ffef10f6 513{
ceec2216
RL
514 (
515 if [ "x$WXDEBUG" = "xverbose" ]; then
516 _fbd_indent="${_fbd_indent}. "
517 decho " $_fbd_indent---> unbound options: $*"
518 fi
519
b2f55c8b 520 for i do
ceec2216
RL
521
522 if [ "x$WXDEBUG" = "xverbose" ]; then
b2f55c8b 523 decho " ${_fbd_indent}binding '$i' with '`remove_field $i $*`' still free"
ceec2216
RL
524 [ -z "$_pruned" ] || decho " ${_fbd_indent} --- pruned: $_pruned ---"
525 fi
526
527 if (
528 eval m_$i=\$this_$i
b2f55c8b 529 _mask="^`get_mask`$"
ceec2216
RL
530
531 if [ "x$WXDEBUG" = "xverbose" ]; then
532 decho " ${_fbd_indent} checking: $_mask"
533 count_delegates "$_mask"
534 decho " $_fbd_indent $? eligible delegates"
b2f55c8b 535 for d in `find_eligible_delegates "$_mask"`; do
ceec2216
RL
536 decho " ${_fbd_indent} $d"
537 done
bd630206 538 fi
ceec2216
RL
539
540 count_delegates "$_mask"
541 _still_eligible=$?
542
543 if [ $_still_eligible -eq 1 ]; then
b2f55c8b 544 echo `find_eligible_delegates "$_mask"`
ceec2216
RL
545 return
546 fi
547
548 [ "x$WXDEBUG" != "xfindprogress" ] || printf "." 1>&2
549
92ea30ce 550 [ $_still_eligible -gt 1 ] && [ $# -gt 1 ] &&
b2f55c8b 551 do_find_best_delegate `remove_field $i $*`
92ea30ce 552 )
ceec2216
RL
553 then
554
555 return
556
557 elif [ $# -gt 1 ]; then
558
559 if [ "x$WXDEBUG" = "xverbose" ]; then
560 decho " ${_fbd_indent}pruning: $i"
561 _pruned="${_pruned:+$_pruned }$i"
562 fi
b2f55c8b 563 set `remove_field $i $*`
ceec2216 564
ffef10f6 565 fi
ceec2216 566
ffef10f6 567 done
ceec2216
RL
568 false
569 )
ffef10f6
VS
570}
571
ceec2216
RL
572# find_best_delegate
573# A simple wrapper around do_find_best_delegate that first determines
574# the unbound options (ie. the ones that the user did not explicitly
575# declare a preference for on the command line)
576find_best_delegate()
75f4be8a 577{
ceec2216 578 for _fbdi in $wxconfig_schema; do
92ea30ce 579 is_set input_option_$_fbdi ||
ceec2216
RL
580 _unbound_options="${_unbound_options:+$_unbound_options }$_fbdi"
581 done
582 do_find_best_delegate $_unbound_options
583}
8708fa76 584
75f4be8a 585
a13a7f89
RL
586# Legacy wx-config helpers.
587# -------------------------
588
589# get_legacy_mask
590# Returns a mask in the format used by wx2.4.
591get_legacy_mask()
592{
593 [ $# -gt 0 ] || set m
594 eval [ "x\${$1_chartype}" != "xunicode" ] || _unicode_flag=u
595 eval [ "x\${$1_debugtype}" != "xdebug" ] || _debug_flag=d
596 eval echo "wx\${$1_toolkit}${_unicode_flag}${_debug_flag}-\${$1_version}\${$1_host}-config"
597}
598
599# find_legacy_configs
600# Returns a list of configs installed by wx2.4 releases.
601find_legacy_configs()
602{
92ea30ce
RL
603 (
604 cd "$prefix/bin" &&
605 {
606 ls wx*-2.4-config | grep -v ^wxbase
607 ls wx*-2.4-config | grep ^wxbase
608 }
609 ) 2> /dev/null
a13a7f89
RL
610}
611
612# find_best_legacy_config
613# Returns the best legacy config for a given specification.
614# This assumes no matching new style config has been found.
615find_best_legacy_config()
616{
b2f55c8b 617 _legacy_configs=`find_legacy_configs`
a13a7f89 618 if [ -n "$_legacy_configs" ]; then
b2f55c8b 619 _legacy_mask=`get_legacy_mask`
a13a7f89 620 for d in $_legacy_configs; do
8ec45325 621 if echo $d | $EGREP $_legacy_mask > /dev/null 2>&1 ; then
a13a7f89
RL
622 echo "$d"
623 return
624 fi
625 done
626 fi
627 false
628}
629
630
631
9a09819a
RL
632# The only action we can perform authoritatively prior to delegation
633# is to list all the possible delegates.
634# --------------------------------------------------------------
635
636config_spec="$0 $*"
637[ -z "$WXDEBUG" ] || config_spec=$configmask
638
639# Next chance for another satisfied customer then
640#
641# If we want to get really polished here we can do plural checking,
642# but we should probably leave that until the day we gettextise it.
643if [ -n "$output_option_list" ]; then
644
645 _remains_in_prefix=$installed_configs
b2f55c8b
MW
646 _delegates=`find_eligible_delegates $configmask`
647 _best_delegate=`find_best_delegate`
9a09819a
RL
648
649 if [ "x$WXDEBUG" = "xverbose" ]; then
a13a7f89
RL
650 decho
651 decho " all = $_remains_in_prefix"
652 decho " matching = $_delegates"
653 decho " best = $_best_delegate"
654 decho " this = $this_config"
9a09819a
RL
655 fi
656
657 for d in $_delegates; do
b2f55c8b 658 _remains_in_prefix=`remove_field $d $_remains_in_prefix`
9a09819a
RL
659 done
660
661 echo
662 echo " Default config is $this_config"
663 echo
664
665 if user_mask_fits "$this_config" ; then
666
667 echo " Default config ${this_exec_prefix+in $this_exec_prefix }will be used for output"
668
669 if match_field "$this_config" $_delegates ; then
b2f55c8b 670 _delegates=`remove_field $this_config $_delegates`
9a09819a
RL
671 else
672 echo " though it is not installed in: $prefix"
673 if [ -n "$_best_delegate" ] && [ "x$_best_delegate" != "x$this_config" ]; then
674 echo
675 echo " Best alternate in $prefix:"
676 echo " $_best_delegate"
677 fi
678 fi
679
680 elif [ -n "$_best_delegate" ]; then
681
682 echo " Specification best match: $_best_delegate"
683
1320281c 684 elif [ -z "$_delegates" ]; then
9a09819a 685
b2f55c8b 686 _last_chance=`find_best_legacy_config`
a13a7f89
RL
687 if [ -n "$_last_chance" ]; then
688
689 echo " Specification matches legacy config: $_last_chance"
690
691 else
bd630206 692
a13a7f89 693 cat <<-EOF
bd630206
VZ
694 No config found to match: $config_spec
695 in $wxconfdir
9a09819a 696
bd630206
VZ
697 Please install the desired library build, or specify a different
698 prefix where it may be found. If the library is not installed
699 you may call its wx-config directly by specifying its full path.
9a09819a 700
bd630206 701EOF
9a09819a 702
a13a7f89
RL
703 fi
704
1320281c
RL
705 else
706 echo " Specification was ambiguous. Use additional feature options"
707 echo " to choose between alternate matches."
9a09819a
RL
708 fi
709
b2f55c8b 710 _delegates=`remove_field "$_best_delegate" $_delegates`
9a09819a
RL
711
712 if [ -n "$_delegates" ]; then
713 echo
714 echo " Alternate matches:"
715 for d in $_delegates; do
716 echo " $d"
717 done
718 fi
719 if [ -n "$_remains_in_prefix" ]; then
720 echo
721 echo " Also available in $prefix:"
722 for d in $_remains_in_prefix; do
723 echo " $d"
724 done
725 fi
726
b2f55c8b 727 _legacy_configs=`find_legacy_configs`
a13a7f89
RL
728 if [ -n "$_legacy_configs" ]; then
729 echo
730 echo " Legacy configs available in $prefix:"
731 for d in $_legacy_configs; do
b2f55c8b 732 echo " $d" | sed 's/-config$//'
a13a7f89
RL
733 done
734 fi
735
9a09819a
RL
736 echo
737 exit
738fi
739
740
75f4be8a 741
9a09819a
RL
742# ... so if that wasn't what they wanted, then we need to know for
743# certain, can this config satisfy the user specification?
ceec2216 744# --------------------------------------------------------------
00c81359 745
b2f55c8b 746if not user_mask_fits "$this_config" ; then
ceec2216
RL
747
748 # No? Then lets see if it knows anybody who can.
749 # But first, just be sure someone hasn't typo'd us into a loop.
750 # In present day wx, correct delegation should never need more
751 # than one hop so this is trivial to detect.
752
753 if [ -n "$WXCONFIG_DELEGATED" ]; then
754 decho
755 decho " *** Error: Bad config delegation"
756 decho
757 decho " to: $0"
758 decho " ($this_config) cannot satisfy:"
9a09819a 759 decho " $config_spec"
ceec2216
RL
760 decho " Someone has been terribly careless."
761 decho
762 exit 1
127e9080
VZ
763 fi
764
ceec2216
RL
765 count_delegates "$configmask"
766 _numdelegates=$?
767
768 if [ -n "$WXDEBUG" ]; then
769 decho " must delegate to an alternate config"
770 decho " potential delegates ($_numdelegates):"
b2f55c8b 771 for i in `find_eligible_delegates "$configmask"`; do
ceec2216
RL
772 decho " $i"
773 done
00c81359 774 fi
a43ed08a 775
ceec2216 776 if [ $_numdelegates -eq 0 ]; then
a13a7f89 777
b2f55c8b 778 _last_chance=`find_best_legacy_config`
a13a7f89
RL
779 if [ -n "$_last_chance" ]; then
780
b2f55c8b 781 for arg do
22642fb2
RL
782 case "$arg" in
783 --prefix*|--exec-prefix*| \
784 --version|--release|--basename| \
785 --static|--libs|--gl_libs| \
786 --cppflags|--cflags|--cxxflags| \
787 --cc|--cxx|--ld| \
788 --rezflags|--inplace)
789 _legacy_args="$_legacy_args $arg"
790 ;;
bd630206 791
22642fb2
RL
792 --static|--static=y*|--static=Y*)
793 _legacy_args="$_legacy_args --static"
794 ;;
795 esac
796 done
797
a13a7f89
RL
798 if [ -n "$WXDEBUG" ]; then
799 decho " found a suitable legacy delegate: $_last_chance"
22642fb2 800 decho "--> $prefix/bin/$_last_chance $_legacy_args"
a13a7f89
RL
801 fi
802
6ab7f778
SN
803 WXCONFIG_DELEGATED=yes
804 export WXCONFIG_DELEGATED
22642fb2 805 $prefix/bin/$_last_chance $_legacy_args
a13a7f89
RL
806 exit
807
808 else
d9809627
RL
809
810 cat 1>&2 <<-EOF
811
bd630206
VZ
812 Warning: No config found to match: $config_spec
813 in $wxconfdir
814 If you require this configuration, please install the desired
815 library build. If this is part of an automated configuration
816 test and no other errors occur, you may safely ignore it.
817 You may use wx-config --list to see all configs available in
818 the default prefix.
d9809627 819
bd630206 820EOF
d9809627
RL
821
822 # PIPEDREAM: from here we are actually just a teensy step
823 # from simply building the missing config for the user
824 # on the fly if this is an in tree wx-config.
825
a13a7f89
RL
826 exit 1
827 fi
a43ed08a
VZ
828 fi
829
ceec2216
RL
830 if [ $_numdelegates -gt 1 ]; then
831
832 [ -z "$WXDEBUG" ] || decho " must prune the list of eligible delegates"
833
b2f55c8b 834 best_delegate=`find_best_delegate`
ceec2216
RL
835
836 if [ -n "$best_delegate" ]; then
bd630206 837
ceec2216
RL
838 if [ -n "$WXDEBUG" ]; then
839 decho " found a suitable delegate: $best_delegate"
840 decho "--> $wxconfdir/$best_delegate $*"
841 fi
842
6ab7f778
SN
843 WXCONFIG_DELEGATED=yes
844 export WXCONFIG_DELEGATED
ceec2216
RL
845 $wxconfdir/$best_delegate $*
846 exit
847 fi
848
849 decho
3950ea80
RL
850 decho " *** Error: Specification is ambiguous"
851 decho " as $config_spec"
ceec2216 852 decho " Use additional feature options to choose between:"
b2f55c8b 853 for i in `find_eligible_delegates "$configmask"`; do
ceec2216
RL
854 decho " $i"
855 done
856 decho
9a98a854 857
ceec2216
RL
858 exit 1
859 fi
860
861 if [ -n "$WXDEBUG" ]; then
862 decho " using the only suitable delegate"
b2f55c8b 863 decho "--> $wxconfdir/`find_eligible_delegates $configmask` $*"
ceec2216
RL
864 fi
865
6ab7f778
SN
866 WXCONFIG_DELEGATED=yes
867 export WXCONFIG_DELEGATED
b2f55c8b 868 $wxconfdir/`find_eligible_delegates $configmask` $*
ceec2216 869 exit
9a98a854
VZ
870fi
871
251f47d1 872
251f47d1 873
ceec2216
RL
874# If we are still here, then from now on we are responsible for
875# all the user's needs. Time to rustle up some output for them.
876# --------------------------------------------------------------
877
878[ -z "$WXDEBUG" ] || decho " using this config"
879
9103d280
RL
880# If the user supplied a prefix, and the in tree config did not
881# delegate out to anything in that prefix, then reset the build
882# tree prefix to provide the correct output for using this
883# uninstalled wx build. Or put more simply:
884prefix=${this_prefix-$prefix}
0506bbbf 885exec_prefix=${this_exec_prefix-$exec_prefix}
ceec2216
RL
886
887includedir="@includedir@"
888libdir="@libdir@"
ffa0583f 889bindir="@bindir@"
ceec2216
RL
890
891# Trivial queries we can answer now.
6758d3d3
RL
892[ -z "$output_option_prefix" ] || echo $prefix
893[ -z "$output_option_exec_prefix" ] || echo $exec_prefix
894[ -z "$output_option_release" ] || echo "@WX_RELEASE@"
895[ -z "$output_option_version" ] || echo "@WX_VERSION@"
896[ -z "$output_option_version_full" ] || echo "@WX_SUBVERSION@"
897[ -z "$output_option_basename" ] || echo "@WX_LIBRARY_BASENAME_GUI@"
6758d3d3
RL
898[ -z "$output_option_cc" ] || echo "@CC@"
899[ -z "$output_option_cxx" ] || echo "@CXX@"
99d4fdfd 900[ -z "$output_option_ld" ] || echo "@CXX@ -o"
6758d3d3 901[ -z "$flag_option_selected_config" ] || echo "$this_config"
ceec2216 902
a55d039a
RL
903
904# --rezflags is deprecated and disabled (2005/11/29)
905if [ -n "$output_option_rezflags" ]; then
906 echo "@true"
907 decho "Warning: --rezflags, along with Mac OS classic resource building" \
908 "is deprecated. You should remove this from your Makefile and" \
bd630206 909 "build .app bundles instead."
a55d039a 910fi
004ee6da 911
ceec2216
RL
912
913# The rest are going to need a little more work.
914# --------------------------------------------------------------
915
ffa0583f
RL
916is_monolithic() { [ "x@MONOLITHIC@" = "x1" ]; }
917is_static() { [ -n "$this_linkage" ]; }
918is_installed() { [ -z "$this_prefix" ]; }
ceec2216
RL
919
920
ffa0583f
RL
921# Is the user after a support utility?
922# If this is a cross build, we need to find and return a suitable
923# native utility for the job, so we search:
924#
925# 1. local build dir (for native uninstalled builds only).
926# 2. (optional) user supplied prefix.
927# 3. configured install prefix.
928# 4. environment $PATH.
929#
930# and if such a thing still cannot be found, exit signalling an error.
931if [ -n "$input_option_utility" ]; then
932
933 # This is dumb, in tree binaries should be in a standard location
934 # like the libs, but work with what we've got for now.
935 is_cross || _util="$exec_prefix/utils/$input_option_utility/$input_option_utility"
936
b2f55c8b 937 if not is_installed && [ -x "$_util" ]; then
ffa0583f
RL
938 is_static || _preload="eval LD_LIBRARY_PATH=$exec_prefix/lib"
939 echo $_preload $_util
940 exit
941 fi
942
943 IFS=':'
944 _user_prefix=${input_option_exec_prefix:-$input_option_prefix}
945
946 for _util in "${input_option_utility}-@WX_RELEASE@@WX_FLAVOUR@" \
947 "${input_option_utility}-@WX_RELEASE@" \
92ea30ce 948 "${input_option_utility}"
ffa0583f
RL
949 do
950 for p in ${_user_prefix:+$_user_prefix/bin} $bindir $PATH; do
951
952 [ -z "$WXDEBUG" ] || decho " checking for: '$p/$_util'"
953
954 if [ -x "$p/$_util" ]; then
955 echo "$p/$_util"
956 exit
957 fi
958
959 done
960 done
961 exit 1
962
963fi
964
965
966# Still here? Then get the options together for building an app.
967# ----------------------------------------------------------------
968
ceec2216
RL
969# Additional configuration for individual library components.
970ldflags_gl="@LDFLAGS_GL@"
971
5ff751d6 972ldlibs_base="@WXCONFIG_LIBS@"
ceec2216
RL
973ldlibs_core="@EXTRALIBS_GUI@"
974ldlibs_gl="@OPENGL_LIBS@"
975ldlibs_html="@EXTRALIBS_HTML@"
976ldlibs_xml="@EXTRALIBS_XML@"
ceec2216 977ldlibs_adv="@EXTRALIBS_SDL@"
cf63f3d3 978ldlibs_stc="@EXTRALIBS_STC@"
ceec2216 979
ffa0583f 980
ceec2216
RL
981# lib_flags_for _liblist
982# This function returns a list of flags suitable to return with the
983# output of --libs for all of the libraries in _liblist. You can
984# add support for a new library by adding an entry for it in the
985# psuedo-hashes above if it requires additional linker options.
986lib_flags_for()
987{
988 [ -z "$WXDEBUG" ] || decho " fetching lib flags for: '$*'"
989
990 _all_ldflags=''
991 _all_libs=''
992 _wxlibs=''
993
92ea30ce 994 is_cross && _target="-${target}"
ceec2216 995
b2f55c8b 996 for lib do
ceec2216
RL
997
998 # We evidently can't trust people not to duplicate things in
999 # configure, or to keep them in any sort of sane order overall,
1000 # so only add unique new fields here even if it takes us a while.
1001 # In the case of libs, we bubble any duplicates to the end,
1002 # because if multiple libs require it, static linking at least
1003 # will require it to come after all of them. So long as local
1004 # order is ok in configure then we should always be able to
1005 # massage a correct result here like this.
1006 #
1007 # FIXME: ldlibs_core is totally bogus. Fix the duplication
1008 # there independently of this. This covers for it, but we
1009 # want to do this anyway because some libs may share common
1010 # deps without a common ancestor in wx. This is not a licence
1011 # for sloppy work elsewhere though and @GUI_TK_LIBRARY should
1012 # be fixed.
1013
b2f55c8b 1014 for f in `eval echo \"\\\$ldflags_$lib\"`; do
ceec2216
RL
1015 match_field "$f" $_all_ldflags || _all_ldflags="$_all_ldflags $f"
1016 done
1017
bd630206 1018 if match_field "$lib" @STD_BASE_LIBS@ ; then
ceec2216
RL
1019 _libname="@WX_LIBRARY_BASENAME_NOGUI@"
1020 else
1021 _libname="@WX_LIBRARY_BASENAME_GUI@"
1022 fi
1023 [ $lib = base ] || _libname="${_libname}_$lib"
1024 _libname="${_libname}-@WX_RELEASE@$_target"
1025
ffa0583f 1026 if is_static; then
ceec2216 1027 _wxlibs="$_wxlibs ${libdir}/lib${_libname}.a"
b2f55c8b 1028 for f in `eval echo \"\\\$ldlibs_$lib\"`; do
3838e2d3
RL
1029
1030 # Only propagate duplicate -libraries to their latest
1031 # possible position. Do not eliminate any other
1032 # duplicates that might occur. They should be fixed
1033 # in configure long before they get here.
1034 # This started as a workaround for Mac -framework,
1035 # but it seems like a better policy in general, which
1036 # will let the more heinous bugs in configure shake out.
1037 # We should maybe filter *.a here too, but not unless
1038 # we have to.
eb57b07a 1039 case "$f" in
b2f55c8b 1040 -l*) _all_libs="`remove_field $f $_all_libs` $f" ;;
eb57b07a
RL
1041 *) _all_libs="$_all_libs $f" ;;
1042 esac
3838e2d3 1043
ceec2216
RL
1044 done
1045 else
1046 _wxlibs="$_wxlibs -l${_libname}"
1047 fi
1048
1049 done
1050
1051 if [ -n "$WXDEBUG" ]; then
1052 decho " retrieved: ldflags = $_all_ldflags"
1053 decho " wxlibs = $_wxlibs"
1054 decho " alllibs = $_all_libs"
1055 fi
1056
1057 echo $_all_ldflags $_wxlibs $_all_libs
1058}
1059
fc2739d5
VZ
1060# this is the strict subset of the above function which returns only the
1061# (static) libraries themselves: this is used for linkdeps output which should
1062# output the list of libraries the main program should depend on
1063#
1064# of course, this duplication is bad but I'll leave to somebody else the care
3838e2d3
RL
1065# of refactoring this as I don't see any way to do it - VZ.
1066
1067# This (and the other cruft to support it) should be removed with
1068# reference to the FIXME above when configure stops piping us a slurry
1069# of options that need to be decomposed again for most practical uses - RL.
fc2739d5
VZ
1070link_deps_for()
1071{
1072 _wxlibs=''
1073
92ea30ce 1074 is_cross && _target="-${target}"
fc2739d5 1075
b2f55c8b 1076 for lib do
bd630206 1077 if match_field "$lib" @STD_BASE_LIBS@ ; then
fc2739d5
VZ
1078 _libname="@WX_LIBRARY_BASENAME_NOGUI@"
1079 else
1080 _libname="@WX_LIBRARY_BASENAME_GUI@"
1081 fi
1082 [ $lib = base ] || _libname="${_libname}_$lib"
1083 _libname="${_libname}-@WX_RELEASE@$_target"
1084
1085 _wxlibs="$_wxlibs ${libdir}/lib${_libname}.a"
1086 done
1087
1088 echo $_wxlibs
1089}
ceec2216
RL
1090
1091# Sanity check the list of libs the user provided us, if any.
1092# --------------------------------------------------------------
1093
bd630206
VZ
1094wx_libs=`echo "$libs_parameters" | tr ',' ' '`
1095wx_optional_libs=`echo "$optional_libs_parameters" | tr ',' ' '`
1096
1097# Add the --optional-libs, if they've been compiled and aren't already added
1098for i in $wx_optional_libs; do
1099 if match_field $i @BUILT_WX_LIBS@; then
1100 if not match_field $i $wx_libs; then
1101 wx_libs="${wx_libs:+$wx_libs }$i"
1102 fi
1103 fi
1104done
ceec2216
RL
1105
1106[ -z "$WXDEBUG" ] || decho " user supplied libs: '$wx_libs'"
1107
6bddfdbf
VZ
1108# Assume we are using the GUI, unless --libs was specified with no GUI libs
1109using_gui=yes
1110
ceec2216
RL
1111if is_monolithic; then
1112
bd630206
VZ
1113 # Only add additional info if --libs was specified and not just --optional-libs
1114 if [ -n "$output_option_libs" ]; then
1115 # Core libs are already built into the blob.
1116 for i in std @STD_GUI_LIBS@ @STD_BASE_LIBS@; do
1117 wx_libs=`remove_field $i $wx_libs`
1118 done
ceec2216 1119
bd630206 1120 wx_libs="@WXCONFIG_LDFLAGS_GUI@ `lib_flags_for $wx_libs`"
ceec2216 1121
bd630206
VZ
1122 # We still need the core lib deps for a static build though
1123 if is_static; then
1124 link_deps="${libdir}/libwx_@TOOLCHAIN_NAME@.a"
1125 wx_libs="$wx_libs $link_deps $ldlibs_core $ldlibs_base"
1126 else
1127 wx_libs="$wx_libs -lwx_@TOOLCHAIN_NAME@"
1128 fi
bd630206 1129 fi
ceec2216
RL
1130else # MONOLITHIC = 0
1131
bd630206
VZ
1132 # Import core libs by default, expand std if specified, or add base if omitted.
1133 if [ -n "$output_option_libs" ] && [ -z "$libs_parameters" ]; then
1134 wx_libs="@STD_GUI_LIBS@ @STD_BASE_LIBS@"
1135 elif match_field all $wx_libs; then
1136 wx_libs="@BUILT_WX_LIBS@"
6a9046db
RL
1137 elif match_field std $wx_libs; then
1138 # Bubble any libs that were already specified to the end
1139 # of the list and ensure static linking order is retained.
b2f55c8b 1140 wx_libs=`remove_field std $wx_libs`
bd630206 1141 for i in @STD_GUI_LIBS@ @STD_BASE_LIBS@; do
b2f55c8b 1142 wx_libs="`remove_field $i $wx_libs` $i"
ceec2216 1143 done
b2f55c8b 1144 elif not match_field base $wx_libs ; then
bd630206
VZ
1145 # Only add base if --libs was specified and not just --optional-libs
1146 if [ -n "$output_option_libs" ]; then
1147 wx_libs="$wx_libs base"
1148 fi
ceec2216
RL
1149 fi
1150
6bddfdbf
VZ
1151 if [ -n "$output_option_libs" ]; then
1152 using_gui=no
1153 for i in $wx_libs ; do
1154 if match_field "$i" @STD_GUI_LIBS@; then
1155 _guildflags="@WXCONFIG_LDFLAGS_GUI@"
1156 using_gui=yes
1157 break
1158 fi
1159 match_field "$i" @STD_BASE_LIBS@ || using_gui=yes
1160 done
1161 fi
ceec2216 1162
ffa0583f 1163 if is_static; then
b2f55c8b 1164 link_deps=`link_deps_for $wx_libs`
fc2739d5 1165 fi
b2f55c8b 1166 wx_libs="$_guildflags `lib_flags_for $wx_libs`"
251f47d1
VS
1167fi
1168
ceec2216 1169
6bddfdbf
VZ
1170# If they explicitly set "--cxx(pp)flags base" then they don't want the GUI
1171if [ "$cxx_parameters" = "base" ]; then
1172 using_gui=no
1173fi
1174
1175
ceec2216
RL
1176if [ -n "$WXDEBUG" ]; then
1177 decho
1178 decho " using libs: '$wx_libs'"
1179 decho " using_gui = $using_gui"
1180 decho
c39ee0ad 1181fi
251f47d1
VS
1182
1183
ceec2216
RL
1184# Endgame. Nothing left to discover now.
1185# --------------------------------------------------------------
251f47d1 1186
9103d280 1187[ "$using_gui" = "yes" ] || _gui_cppflags="-DwxUSE_GUI=0"
ceec2216 1188
ffa0583f 1189if is_installed; then
0506bbbf 1190 _include_cppflags="-I${includedir}/wx-@WX_RELEASE@@WX_FLAVOUR@"
ffa0583f 1191else
aa1c09fe 1192 _include_cppflags="-I${includedir}"
0506bbbf
RL
1193fi
1194
b2f55c8b 1195_cppflags=`echo "-I${libdir}/wx/include/@TOOLCHAIN_FULLNAME@" $_include_cppflags "@WXCONFIG_CPPFLAGS@" $_gui_cppflags`
ceec2216
RL
1196
1197# now without further ado, we can answer these too.
9103d280 1198[ -z "$output_option_cppflags" ] || echo $_cppflags
5ff751d6
VZ
1199[ -z "$output_option_cflags" ] || echo $_cppflags "@WXCONFIG_CFLAGS@"
1200[ -z "$output_option_cxxflags" ] || echo $_cppflags "@WXCONFIG_CXXFLAGS@"
b2f55c8b 1201[ -z "$output_option_gl_libs" ] || echo `lib_flags_for gl`
fc2739d5 1202[ -z "$output_option_linkdeps" ] || echo $link_deps
ceec2216
RL
1203
1204if [ -n "$output_option_libs" ]; then
bd630206 1205 # if --libs [--optional-libs] then output the full linker information
ceec2216 1206
92ea30ce
RL
1207 is_cross &&
1208 [ "x$libdir" = "x/usr/${target}/lib" ] ||
1209 [ "x$libdir" = "x/usr/lib" ] ||
1210 _ldflags="-L$libdir"
ceec2216 1211
ffa0583f
RL
1212 is_installed || [ -n "$flag_option_no_rpath" ] || _rpath="@WXCONFIG_RPATH@"
1213
1214 echo $_ldflags "@LDFLAGS@" $_rpath $wx_libs "@DMALLOC_LIBS@"
bd630206
VZ
1215
1216elif [ -n "$output_option_optional_libs" ]; then
1217 # if only --optional-libs then output just the libs
1218
1219 echo $wx_libs
ceec2216
RL
1220fi
1221
004ee6da 1222
a55d039a
RL
1223# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1224#
1225# Beyond here reside only machine or tool specific workarounds
1226# that require knowlege not obtainable prior to this comment.
1227#
1228# Please. Avoid addding things here, wx-config should avoid
1229# hard coding tool specific details. Do not use things here
1230# as an example of other things that should be here, These
1231# shouldn't be here either. This is a place of last resort
1232# for interim workarounds. I can but stress as strongly as
1233# the censor will allow, there are only bad examples of things
1234# that belong at this level of abstraction to follow. It is
1235# a limbo for glitches awaiting the Next Design Repair. Ok.
1236#
1237# With that firmly in mind, our debut dilemma is:
3f97aec5 1238
a55d039a 1239# Resource compilers. An elusive term that covers some pretty
004ee6da
RL
1240# dissimilar concepts on various platforms. The good news is,
1241# each platform has only one definition of 'resource', compiled
1242# or not, and so we can abstract that neatly to return a platform
1243# specific invocation of the appropriate tool. The bad news is,
1244# windres (at least) requires knowledge of the wx header files
1245# location(s) that cannot be predicted reliably before the call to
1246# wx-config is made. Currently for all known resource compilers,
1247# we can simply return a command and some salient configuration
1248# options in response to a request for --rescomp. So here we
1249# top up the options for any tools that may require information
1250# that was only just determined in the last few machine cycles,
1251# then output the necessary incantation for the platform.
1252#
1253# Most things should already be constant by the time configure
1254# has run. Do not add anything here that is already known there.
1255
1256if [ -n "$output_option_rescomp" ]; then
1257
1258 case "@RESCOMP@" in
1259 *windres|wrc)
1260 # Note that with late model windres, we could just insert
bd630206
VZ
1261 # _include_cppflags here, but use the old notation for now
1262 # as it is more universally accepted.
004ee6da
RL
1263 if is_installed; then
1264 echo "@RESCOMP@ --include-dir" \
1265 "${includedir}/wx-@WX_RELEASE@@WX_FLAVOUR@" \
1266 "@WXCONFIG_RESFLAGS@"
1267 else
1268 echo "@RESCOMP@ --include-dir ${includedir}" \
bd630206 1269 "@WXCONFIG_RESFLAGS@"
004ee6da
RL
1270 fi
1271 ;;
1272
1273 # neither rez not emxbind have any specific needs from
1274 # us, so just output what was determined by configure.
1275 *)
1276 echo @RESCOMP@ @WXCONFIG_RESFLAGS@
1277 ;;
1278 esac
1279
1280fi
1281
a55d039a
RL
1282#
1283# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
004ee6da 1284
ceec2216
RL
1285# And so that's it, we're done. Have a nice build.
1286
1287exit 0
9a98a854 1288
9a98a854 1289