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