]> git.saurik.com Git - wxWidgets.git/blob - wx-config.in
Regenerated file after adding except sample.
[wxWidgets.git] / wx-config.in
1 #!/bin/sh
2
3 # -------------------------------------------------------------------------
4 # Configured settings:
5 # -------------------------------------------------------------------------
6
7 # Version and build type information:
8
9 WX_MAJOR_VERSION_NUMBER="@WX_MAJOR_VERSION_NUMBER@"
10 WX_MINOR_VERSION_NUMBER="@WX_MINOR_VERSION_NUMBER@"
11 WX_RELEASE_NUMBER="@WX_RELEASE_NUMBER@"
12 WX_SUBRELEASE_NUMBER="@WX_SUBRELEASE_NUMBER@"
13 release="@WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@"
14 is_monolithic="@MONOLITHIC@"
15 cross_compiling="@cross_compiling@"
16 target="@host_alias@"
17 static_flag="@STATIC_FLAG@"
18 inplace_flag="no"
19
20 # Misc configuration variables:
21
22 update_prefixes()
23 {
24 includedir="@includedir@"
25 libdir="@libdir@"
26 }
27 prefix="@prefix@"
28 exec_prefix="@exec_prefix@"
29 update_prefixes
30
31 CC="@CC@"
32 GCC="@GCC@"
33 CXX="@CXX@"
34 LD="@SHARED_LD@"
35 srcdir="@top_srcdir@"
36 builddir="@top_builddir_wxconfig@"
37 basename_nogui="@WX_LIBRARY_BASENAME_NOGUI@"
38 basename_gui="@WX_LIBRARY_BASENAME_GUI@"
39
40 TOOLCHAIN_NAME="@TOOLCHAIN_NAME@"
41 LDFLAGS="@LDFLAGS@"
42 WXCONFIG_RPATH="@WXCONFIG_RPATH@"
43 DMALLOC_LIBS="@DMALLOC_LIBS@"
44 WXCONFIG_LIBS="@WXCONFIG_LIBS@"
45 WXCONFIG_LIBS_STATIC="@WXCONFIG_LIBS_STATIC@"
46 WXDEBUG_DEFINE="@WXDEBUG_DEFINE@"
47 TOOLCHAIN_DEFS="@TOOLCHAIN_DEFS@"
48 TOOLCHAIN_DLL_DEFS="@TOOLCHAIN_DLL_DEFS@"
49 WXCONFIG_INCLUDE="@WXCONFIG_INCLUDE@"
50 WX_LARGEFILE_FLAGS="@WX_LARGEFILE_FLAGS@"
51 GCC_PRAGMA_FLAGS="@GCC_PRAGMA_FLAGS@"
52 CODE_GEN_FLAGS="@CODE_GEN_FLAGS@"
53 CODE_GEN_FLAGS_CXX="@CODE_GEN_FLAGS_CXX@"
54 LDFLAGS_EXE="@LDFLAGS_EXE@"
55 MACRESWXCONFIG="@MACRESWXCONFIG@"
56 EXTRALIBS_GUI="@EXTRALIBS_GUI@"
57 LIBS="@LIBS@"
58 WXCONFIG_LDFLAGS_GUI="@WXCONFIG_LDFLAGS_GUI@"
59
60
61 # Linker flags for sublibraries:
62
63 CORE_BASE_LIBS="@CORE_BASE_LIBS@"
64 CORE_GUI_LIBS="@CORE_GUI_LIBS@"
65
66 ldlibs_base="@WXCONFIG_EXTRALIBS@"
67 ldlibs_core="@EXTRALIBS_GUI@"
68 ldlibs_xml="@EXTRALIBS_XML@"
69 ldlibs_html="@EXTRALIBS_HTML@"
70 ldlibs_odbc="@EXTRALIBS_ODBC@"
71 ldlibs_adv="@EXTRALIBS_SDL@"
72
73 ldflags_gl="@LDFLAGS_GL@"
74 ldlibs_gl="@OPENGL_LIBS@"
75
76
77
78 # -------------------------------------------------------------------------
79 # Script code:
80 # -------------------------------------------------------------------------
81
82 exec_prefix_set=no
83
84 # is $1 among the rest of arguments?
85 isinlist()
86 {
87 value=$1
88 shift
89 isin=no
90 for iii in $* ; do
91 if test $iii = $value ; then isin=yes ; fi
92 done
93 test $isin = yes
94 }
95
96 # output linker commands needed to link against libraries passed as arguments
97 # (does not handle monolithic/multilib):
98 output_libs()
99 {
100 if test "$cross_compiling" = "yes" ; then
101 target_tag="-${target}"
102 fi
103
104 all_libs=""
105 all_ldflags=""
106 wxlibs=""
107
108 for lib in $* ; do
109 eval xlibs=\$ldlibs_$lib
110 eval xflags=\$ldflags_$lib
111 if isinlist $lib $CORE_BASE_LIBS ; then
112 basename=$basename_nogui
113 else
114 basename=$basename_gui
115 fi
116 if test $lib = "base" ; then
117 libname="$basename"
118 else
119 libname="${basename}_${lib}"
120 fi
121
122 all_ldflags="$all_ldflags $xflags"
123 if test $static_flag = yes ; then
124 wxlibs="$wxlibs ${libdir}/lib${libname}-${release}${target_tag}.a"
125 all_libs="$all_libs $xlibs"
126 else
127 wxlibs="$wxlibs -l${libname}-${release}${target_tag}"
128 fi
129 done
130
131 echo $all_ldflags $wxlibs $all_libs
132 }
133
134 # output $(WXCONFIG_LDFLAGS_GUI) if any of libs passed as arguments is GUI
135 # library, nothing otherwise:
136 get_ldflags_gui()
137 {
138 flags_to_ret=""
139 for lib in $* ; do
140 if isinlist $lib $CORE_GUI_LIBS ; then
141 flags_to_ret="$WXCONFIG_LDFLAGS_GUI"
142 fi
143 done
144 echo $flags_to_ret
145 }
146
147 usage()
148 {
149 cat <<EOF
150 Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--inplace]
151 [--toolkit=TOOLKIT] [--unicode[=yes|no]] [--debug[=yes|no]]
152 [--universal[=yes|no]] [--host=HOST]
153 [--version[=VERSION]] [--version-full] [--release]
154 [--list] [--basename] [--static] [--libs] [--gl-libs]
155 [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
156 [--cc] [--cxx] [--ld] [LIBRARIES]
157
158 wx-config returns configuration information about the installed
159 version of wxWidgets. It may be used to query its version and
160 installation directories and also retrieve the C and C++ compilers
161 and linker which were used for its building and the corresponding
162 flags.
163
164 Ordinarily it should be installed to the appropriate system location
165 along with the headers and library files, but it is also possible to
166 use it to enable builds with an uninstalled wxWidgets version for
167 package building and bleeding edge developers. To do so, use it like
168 this:
169
170 \${wx_builddir}/wx-config --inplace
171
172 Note that any other options supplied must come *after* --inplace
173 for it to take effect.
174
175 --static must come before --cppflags, --cflags, --cxxflags,
176 --libs and --gl-libs and --libs must come before the other ones.
177
178 wx-config can take optional argument that contains comma- or space-separated
179 list of wxWidgets libraries to compile and link against. This list can
180 include both core and contrib libraries. Special value "std" stands for all
181 libraries linked in by default. Examples: "wx-config --libs core,base"
182 or "wx-config --cxxflags core,base".
183
184 --gl-libs option is deprecated, use "--libs gl" instead.
185
186 If there are several different builds of wxWidgets installed in same prefix,
187 you can use --host, --toolkit, --unicode, --debug, --universal and --version
188 options to select one of them. Use --list option to show all available builds
189 that match given criteria.
190
191 EOF
192
193 exit $1
194 }
195
196 cppflags()
197 {
198 includes="-I${libdir}/wx/include/${TOOLCHAIN_NAME}"
199
200 # in inplace case we need to also add path to contrib headers -- do it
201 # unconditionally as they might be used and we have no way of knowing if
202 # they really are
203 if test $inplace_flag = yes ; then
204 includes="$includes -I${prefix}/include -I${prefix}/contrib/include"
205 else
206 includes="$includes -I${includedir}/wx-${WX_MAJOR_VERSION_NUMBER}.${WX_MINOR_VERSION_NUMBER}"
207 fi
208
209 flags="$includes ${WXDEBUG_DEFINE} ${TOOLCHAIN_DEFS}"
210 if test $static_flag != yes ; then
211 flags="$flags ${TOOLCHAIN_DLL_DEFS}"
212 fi
213
214 if test $nogui_flag = "yes" ; then
215 flags="$flags -DwxUSE_GUI=0"
216 fi
217
218 echo "$flags${WXCONFIG_INCLUDE} ${WX_LARGEFILE_FLAGS} ${GCC_PRAGMA_FLAGS}"
219 }
220
221 if test $# -eq 0; then
222 usage 1 1>&2
223 fi
224
225
226 # handle libraries list:
227
228 libs_list=""
229
230 for arg in $*; do
231 case "$arg" in
232 -*)
233 ;;
234 *)
235 libs_list="$libs_list `echo "$arg" | tr ',' ' '`"
236 ;;
237 esac
238 done
239
240 if test "x$libs_list" = "x" ; then
241 if test "$is_monolithic" = "0" ; then
242 # link against all libs if none given explicitly:
243 libs_list="$CORE_GUI_LIBS $CORE_BASE_LIBS"
244 fi
245 else
246 # always add wxBase, any wxApp needs it:
247 libs_list="$libs_list base"
248 fi
249
250 # determine if at least one gui lib was used:
251 nogui_flag="yes"
252 for i in $libs_list; do
253 case $i in
254 base|net)
255 ;;
256 *)
257 nogui_flag="no"
258 ;;
259 esac
260 done
261
262
263 # handle options:
264
265 while test $# -gt 0; do
266 case "$1" in
267 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
268 *) optarg= ;;
269 esac
270
271 case $1 in
272 --inplace)
273 inplace_flag=yes
274 ;;
275 --prefix=*)
276 prefix=$optarg
277 if test $exec_prefix_set = no ; then
278 exec_prefix=$optarg
279 fi
280 update_prefixes
281 ;;
282 --prefix)
283 echo $prefix
284 ;;
285 --exec-prefix=*)
286 exec_prefix=$optarg
287 exec_prefix_set=yes
288 update_prefixes
289 ;;
290 --exec-prefix)
291 echo $exec_prefix
292 ;;
293 --version)
294 echo ${WX_MAJOR_VERSION_NUMBER}.${WX_MINOR_VERSION_NUMBER}.${WX_RELEASE_NUMBER}
295 ;;
296 --version-full)
297 echo ${WX_MAJOR_VERSION_NUMBER}.${WX_MINOR_VERSION_NUMBER}.${WX_RELEASE_NUMBER}.${WX_SUBRELEASE_NUMBER}
298 ;;
299 --release)
300 echo $release
301 ;;
302 --basename)
303 echo $basename_gui
304 ;;
305 --static)
306 static_flag=yes
307 ;;
308 --cppflags)
309 cppflags
310 ;;
311 --cflags)
312 echo `cppflags` ${CODE_GEN_FLAGS}
313 ;;
314 --cxxflags)
315 echo `cppflags` ${CODE_GEN_FLAGS} ${CODE_GEN_FLAGS_CXX}
316 ;;
317 --ldflags)
318 echo ${LDFLAGS_EXE}
319 ;;
320 --rezflags)
321 echo `eval echo ${MACRESWXCONFIG}`
322 ;;
323
324 --libs)
325 # include install directory only if it is not default:
326 if test "${libdir}" != "/usr/lib" \
327 -a \( "${cross_compiling}" != "yes" \
328 -o "${libdir}" != "/usr/${target}/lib" \) ;
329 then
330 libs="-L${libdir}"
331 fi
332
333 # it's simpler to avoid handling "base" itself at all as we add it in the
334 # end to the list of libraries anyhow
335 # in monolithic build, link against the main library:
336 if test "$is_monolithic" = "1" ; then
337 # filter out core libs, leave only contrib in libs_list:
338 newlist=
339 for i in $libs_list ; do
340 if isinlist $i $CORE_GUI_LIBS $CORE_BASE_LIBS; then
341 libs_list="" # do nothing
342 else
343 newlist="$newlist $i"
344 fi
345 done
346 libs_list="$newlist"
347
348 # output link flags:
349 contrib_libs=`output_libs $libs_list`
350 if test $static_flag = yes ; then
351 echo "$libs ${LDFLAGS} ${WXCONFIG_LDFLAGS_GUI} ${WXCONFIG_RPATH} $contrib_libs ${libdir}/${WXCONFIG_LIBS_STATIC} ${EXTRALIBS_GUI} ${LIBS} ${DMALLOC_LIBS}"
352 else
353 echo $libs ${LDFLAGS} ${WXCONFIG_LDFLAGS_GUI} ${WXCONFIG_RPATH} $contrib_libs ${WXCONFIG_LIBS} ${DMALLOC_LIBS}
354 fi
355 else
356 # we may need to replace "std" alias with its expansion
357 newlist=
358 hadstd=0
359 for i in $libs_list; do
360 case $i in
361 std)
362 hadstd=1
363 ;;
364
365 base)
366 # if we have std, we're going to add base anyhow, avoid
367 # having it twice in the end
368 if [ $hadstd = 0 ]; then
369 newlist="$newlist $i"
370 fi
371 ;;
372
373 *)
374 newlist="$newlist $i"
375 ;;
376 esac
377 done
378 libs_list="$newlist"
379 if [ $hadstd = 1 ]; then
380 libs_list="$libs_list $CORE_GUI_LIBS $CORE_BASE_LIBS"
381 fi
382
383 # in multilib mode, link against all sublibraries:
384 wxlibs=`output_libs $libs_list`
385 guildflags=`get_ldflags_gui $libs_list`
386 echo $libs ${LDFLAGS} ${guildflags} ${WXCONFIG_RPATH} $wxlibs ${DMALLOC_LIBS}
387 fi
388
389 ;;
390 --gl-libs)
391 output_libs gl
392 ;;
393 --cc)
394 echo $CC
395 ;;
396 --cxx)
397 echo $CXX
398 ;;
399 --ld)
400 echo $LD
401 ;;
402 --help|-h)
403 usage 1 1>&2
404 ;;
405 -*)
406 # unrecognized flag is error
407 usage 1 1>&2
408 ;;
409 esac
410 shift
411 done
412