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