wx-config.in 47 KB

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