]> git.saurik.com Git - wxWidgets.git/blame - wx-config.in
don't define DestroyClippingRegion() any more but simply use the base class version
[wxWidgets.git] / wx-config.in
CommitLineData
9a98a854
VZ
1#!/bin/sh
2
33380099
VS
3# -------------------------------------------------------------------------
4# Configured settings:
5# -------------------------------------------------------------------------
6
7# Version and build type information:
8
9WX_MAJOR_VERSION_NUMBER="@WX_MAJOR_VERSION_NUMBER@"
10WX_MINOR_VERSION_NUMBER="@WX_MINOR_VERSION_NUMBER@"
11WX_RELEASE_NUMBER="@WX_RELEASE_NUMBER@"
12release="@WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@"
13is_monolithic="@MONOLITHIC@"
14cross_compiling="@cross_compiling@"
15target="@host_alias@"
16static_flag="@STATIC_FLAG@"
17
18
19# Misc configuration variables:
20
0154f61a
VS
21update_prefixes()
22{
23 includedir="@includedir@"
24 libdir="@libdir@"
25}
33380099
VS
26prefix="@prefix@"
27exec_prefix="@exec_prefix@"
0154f61a
VS
28update_prefixes
29
6ce73557 30CC="@CC@"
2b5f62a0 31GCC="@GCC@"
31414f4c 32GCC_SEARCHES_USR_LOCAL_INCLUDE="@GCC_SEARCHES_USR_LOCAL_INCLUDE@"
6ce73557
VZ
33CXX="@CXX@"
34LD="@SHARED_LD@"
33380099
VS
35srcdir="@top_srcdir@"
36builddir="@top_builddir_wxconfig@"
37basename_nogui="@WX_LIBRARY_BASENAME_NOGUI@"
38basename_gui="@WX_LIBRARY_BASENAME_GUI@"
39
40TOOLCHAIN_NAME="@TOOLCHAIN_NAME@"
41LDFLAGS="@LDFLAGS@"
42WXCONFIG_RPATH="@WXCONFIG_RPATH@"
43DMALLOC_LIBS="@DMALLOC_LIBS@"
44WXCONFIG_LIBS="@WXCONFIG_LIBS@"
45WXCONFIG_LIBS_STATIC="@WXCONFIG_LIBS_STATIC@"
46WXDEBUG_DEFINE="@WXDEBUG_DEFINE@"
47TOOLCHAIN_DEFS="@TOOLCHAIN_DEFS@"
48TOOLCHAIN_DLL_DEFS="@TOOLCHAIN_DLL_DEFS@"
49WXCONFIG_INCLUDE="@WXCONFIG_INCLUDE@"
50WX_LARGEFILE_FLAGS="@WX_LARGEFILE_FLAGS@"
51CODE_GEN_FLAGS="@CODE_GEN_FLAGS@"
52CODE_GEN_FLAGS_CXX="@CODE_GEN_FLAGS_CXX@"
53LDFLAGS_EXE="@LDFLAGS_EXE@"
54MACRESWXCONFIG="@MACRESWXCONFIG@"
55EXTRALIBS_GUI="@EXTRALIBS_GUI@"
56LIBS="@LIBS@"
ffef10f6 57WXCONFIG_LDFLAGS_GUI="@WXCONFIG_LDFLAGS_GUI@"
cf615ebb
VS
58
59
60# Linker flags for sublibraries:
33380099 61
edd891e2
VS
62CORE_BASE_LIBS="@CORE_BASE_LIBS@"
63CORE_GUI_LIBS="@CORE_GUI_LIBS@"
cf615ebb 64
67c13b6c 65ldlibs_base="@WXCONFIG_EXTRALIBS@"
cf615ebb
VS
66ldlibs_core="@EXTRALIBS_GUI@"
67ldlibs_xml="@EXTRALIBS_XML@"
3527f29c 68ldlibs_html="@EXTRALIBS_HTML@"
bb41dcbe 69ldlibs_odbc="@EXTRALIBS_ODBC@"
f93ca9fd 70ldlibs_adv="@EXTRALIBS_SDL@"
cf615ebb
VS
71
72ldflags_gl="@LDFLAGS_GL@"
73ldlibs_gl="@OPENGL_LIBS@"
74
75
33380099
VS
76
77# -------------------------------------------------------------------------
78# Script code:
79# -------------------------------------------------------------------------
80
81exec_prefix_set=no
82
cf615ebb
VS
83# is $1 among the rest of arguments?
84isinlist()
85{
86 value=$1
87 shift
88 isin=no
89 for iii in $* ; do
90 if test $iii = $value ; then isin=yes ; fi
91 done
92 test $isin = yes
93}
94
95# output linker commands needed to link against libraries passed as arguments
96# (does not handle monolithic/multilib):
97output_libs()
98{
67c13b6c
VS
99 if test "$cross_compiling" = "yes" ; then
100 target_tag="-${target}"
101 fi
102
cf615ebb
VS
103 all_libs=""
104 all_ldflags=""
105 wxlibs=""
67c13b6c 106
cf615ebb
VS
107 for lib in $* ; do
108 eval xlibs=\$ldlibs_$lib
109 eval xflags=\$ldflags_$lib
110 if isinlist $lib $CORE_BASE_LIBS ; then
111 basename=$basename_nogui
112 else
113 basename=$basename_gui
114 fi
fef23dd4
VS
115 if test $lib = "base" ; then
116 libname="$basename"
117 else
118 libname="${basename}_${lib}"
119 fi
cf615ebb
VS
120
121 all_ldflags="$all_ldflags $xflags"
122 if test $static_flag = yes ; then
33380099 123 wxlibs="$wxlibs ${libdir}/lib${libname}-${release}${target_tag}.a"
cf615ebb
VS
124 all_libs="$all_libs $xlibs"
125 else
67c13b6c 126 wxlibs="$wxlibs -l${libname}-${release}${target_tag}"
cf615ebb
VS
127 fi
128 done
129
130 echo $all_ldflags $wxlibs $all_libs
131}
9a98a854 132
ffef10f6
VS
133# output $(WXCONFIG_LDFLAGS_GUI) if any of libs passed as arguments is GUI
134# library, nothing otherwise:
135get_ldflags_gui()
136{
137 flags_to_ret=""
138 for lib in $* ; do
139 if isinlist $lib $CORE_GUI_LIBS ; then
140 flags_to_ret="$WXCONFIG_LDFLAGS_GUI"
141 fi
142 done
143 echo $flags_to_ret
144}
145
52c71b80
VZ
146# return the absolute path prepending builddir to it if needed
147makeabs()
148{
149 path=$1
150 # TODO: this only works under Unix and even there it could be
151 # enhanced to remove ".." and "."
152 if [ `echo $path | sed 's/^\(.\).*/\1/'` != "/" ]; then
153 if [ $path = "." ]; then
154 path=$builddir
155 else
156 path="$builddir/$path"
157 fi
158 fi
159
160 echo $path
161}
162
75f4be8a
VZ
163usage()
164{
165 cat <<EOF
2f42e5b6 166Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--release]
cf615ebb 167 [--basename] [--static] [--libs[=LIBS]] [--gl-libs]
40f7145c 168 [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
75f4be8a
VZ
169 [--cc] [--cxx] [--ld]
170
171wx-config returns configuration information about the installed
b63b07a8 172version of wxWidgets. It may be used to query its version and
75f4be8a
VZ
173installation directories and also retrieve the C and C++ compilers
174and linker which were used for its building and the corresponding
175flags.
2b5f62a0 176
82a649b6
RL
177Ordinarily it should be installed to the appropriate system location
178along with the headers and library files, but it is also possible to
b63b07a8 179use it to enable builds with an uninstalled wxWidgets version for
82a649b6
RL
180package building and bleeding edge developers. To do so, use it like
181this:
182
dc5e3b9e 183\${wx_builddir}/wx-config --prefix=\${wx_srcdir} --exec-prefix=\${wx_builddir}
82a649b6
RL
184
185Note that any other options supplied must come *after* the prefix
186specification for it to take effect.
187
efe6c06f
VS
188--static must come before --cppflags, --cflags, --cxxflags,
189--libs and --gl-libs.
cf615ebb
VS
190
191--libs can take optional argument that contains comma-separated list of
b63b07a8 192wxWidgets libraries to link against. This list can include both core
1d8864ac
VZ
193and contrib libraries. Special value "std" stands for all libraries linked
194in by default.
cf615ebb 195
67c13b6c
VS
196--gl-libs option is deprecated, used --libs=gl instead.
197
75f4be8a
VZ
198EOF
199
200 exit $1
201}
202
203cppflags()
204{
2b5f62a0
VZ
205 # we should never specify -I/usr/include on the compiler command line: this
206 # is at best useless and at worst breaks compilation on the systems where
207 # the system headers are non-ANSI because gcc works around this by storing
208 # the ANSI-fied versions of them in its private directory which is searched
209 # after all the directories on the cmd line.
210 #
31414f4c
SN
211 # the situation is a bit more complicated with -I/usr/local/include:
212 # it shouldn't be specified with some gcc installations which look there
213 # by default anyhow and give warnings (at least 3.1 does) if it is
214 # specified explicitly --
215 # but this -I switch *is* needed for other gcc installation and for
216 # the other compilers.
217 # So I put a suitable test into configure.in and reuse the result here.
2b5f62a0
VZ
218 #
219 # note that we assume that if we use GNU cc we also use GNU c++ and vice
220 # versa, i.e. this won't work (either for --cflags or --cxxflags) if GNU C
221 # compiler and non-GNU C++ compiler are used or vice versa -- we'll fix
222 # this when/if anybody complains about it
33380099
VS
223 if test "${includedir}" != "/usr/include" \
224 -a "${includedir}" != "/usr/include/c++" \
31414f4c 225 -a \( "${GCC_SEARCHES_USR_LOCAL_INCLUDE}" != "yes" \
33380099 226 -o "${includedir}" != "/usr/local/include" \) \
77e13408 227 -a \( "${cross_compiling}" != "yes" \
33380099 228 -o "${includedir}" != "/usr/${target}/include" \) ;
3a922bb4 229 then
33380099 230 includes=" -I${includedir}"
75f4be8a 231 fi
00c81359 232
33380099 233 includes="-I${libdir}/wx/include/${TOOLCHAIN_NAME}$includes"
00c81359
RL
234
235 if test $static_flag = yes ; then
33380099 236 echo $includes ${WXDEBUG_DEFINE} ${TOOLCHAIN_DEFS} ${WXCONFIG_INCLUDE} ${WX_LARGEFILE_FLAGS}
00c81359 237 else
33380099 238 echo $includes ${WXDEBUG_DEFINE} ${TOOLCHAIN_DEFS} ${TOOLCHAIN_DLL_DEFS} ${WXCONFIG_INCLUDE} ${WX_LARGEFILE_FLAGS}
00c81359 239 fi
75f4be8a 240}
9a98a854
VZ
241
242if test $# -eq 0; then
3a922bb4 243 usage 1 1>&2
9a98a854
VZ
244fi
245
246while test $# -gt 0; do
247 case "$1" in
248 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
249 *) optarg= ;;
250 esac
251
252 case $1 in
52c71b80
VZ
253 --inplace)
254 prefix=`makeabs $srcdir`
255 exec_prefix=`makeabs $builddir`
256 exec_prefix_set=yes
0154f61a 257 update_prefixes
52c71b80 258 ;;
9a98a854
VZ
259 --prefix=*)
260 prefix=$optarg
261 if test $exec_prefix_set = no ; then
262 exec_prefix=$optarg
263 fi
0154f61a 264 update_prefixes
9a98a854
VZ
265 ;;
266 --prefix)
267 echo $prefix
268 ;;
269 --exec-prefix=*)
270 exec_prefix=$optarg
271 exec_prefix_set=yes
0154f61a 272 update_prefixes
9a98a854
VZ
273 ;;
274 --exec-prefix)
275 echo $exec_prefix
276 ;;
277 --version)
33380099 278 echo ${WX_MAJOR_VERSION_NUMBER}.${WX_MINOR_VERSION_NUMBER}.${WX_RELEASE_NUMBER}
9a98a854 279 ;;
2f42e5b6 280 --release)
cf615ebb 281 echo $release
2f42e5b6
VS
282 ;;
283 --basename)
9171d4b4 284 echo $basename_gui
2f42e5b6 285 ;;
3d63bc3a
RL
286 --static)
287 static_flag=yes
288 ;;
75f4be8a
VZ
289 --cppflags)
290 cppflags
291 ;;
9a98a854 292 --cflags)
33380099 293 echo `cppflags` ${CODE_GEN_FLAGS}
75f4be8a
VZ
294 ;;
295 --cxxflags)
33380099 296 echo `cppflags` ${CODE_GEN_FLAGS} ${CODE_GEN_FLAGS_CXX}
9a98a854 297 ;;
40f7145c 298 --ldflags)
33380099 299 echo ${LDFLAGS_EXE}
40f7145c 300 ;;
2baaf735 301 --rezflags)
09d3439c 302 echo `eval echo ${MACRESWXCONFIG}`
2baaf735 303 ;;
cf615ebb
VS
304
305 --libs*)
306 # find if the argument was --libs=list,of,libs or --libs:
307 if test "x$optarg" = "x" ; then
308 if test "$is_monolithic" = "0" ; then
309 # link against all libs if none given explicitly:
310 libs_list="$CORE_GUI_LIBS $CORE_BASE_LIBS"
311 fi
312 else
313 libs_list=`echo "$optarg" | tr ',' ' '`
67c13b6c
VS
314 # always add wxBase, any wxApp needs it:
315 libs_list="$libs_list base"
cf615ebb
VS
316 fi
317
318 # include install directory only if it is not default:
33380099 319 if test "${libdir}" != "/usr/lib" \
77e13408 320 -a \( "${cross_compiling}" != "yes" \
33380099 321 -o "${libdir}" != "/usr/${target}/lib" \) ;
3a922bb4 322 then
33380099 323 libs="-L${libdir}"
9a98a854 324 fi
3d63bc3a 325
1d8864ac
VZ
326 # it's simpler to avoid handling "bae" itself at all as we add it in the
327 # end to the list of libraries anyhow
cf615ebb
VS
328 # in monolithic build, link against the main library:
329 if test "$is_monolithic" = "1" ; then
330 # filter out core libs, leave only contrib in libs_list:
331 newlist=
332 for i in $libs_list ; do
1d8864ac 333 if isinlist $i $CORE_GUI_LIBS $CORE_BASE_LIBS; then
cf615ebb
VS
334 libs_list="" # do nothing
335 else
336 newlist="$newlist $i"
337 fi
338 done
339 libs_list="$newlist"
9171d4b4 340
cf615ebb
VS
341 # output link flags:
342 contrib_libs=`output_libs $libs_list`
343 if test $static_flag = yes ; then
ffef10f6 344 echo "$libs ${LDFLAGS} ${WXCONFIG_LDFLAGS_GUI} ${WXCONFIG_RPATH} $contrib_libs ${libdir}/${WXCONFIG_LIBS_STATIC} ${EXTRALIBS_GUI} ${LIBS} ${DMALLOC_LIBS}"
cf615ebb 345 else
ffef10f6 346 echo $libs ${LDFLAGS} ${WXCONFIG_LDFLAGS_GUI} ${WXCONFIG_RPATH} $contrib_libs ${WXCONFIG_LIBS} ${DMALLOC_LIBS}
cf615ebb 347 fi
3d63bc3a 348 else
1d8864ac
VZ
349 # we may need to replace "std" alias with its expansion
350 newlist=
351 hadstd=0
352 for i in $libs_list; do
353 case $i in
354 std)
355 hadstd=1
356 ;;
357
358 base)
359 # if we have std, we're going to add base anyhow, avoid
360 # having it twice in the end
361 if [ $hadstd = 0 ]; then
362 newlist="$newlist $i";
363 fi
364 ;;
365
366 *)
367 newlist="$newlist $i"
368 ;;
369 esac
370 done
371 libs_list="$newlist"
372 if [ $hadstd = 1 ]; then
373 libs_list="$libs_list $CORE_GUI_LIBS $CORE_BASE_LIBS"
374 fi
375
cf615ebb
VS
376 # in multilib mode, link against all sublibraries:
377 wxlibs=`output_libs $libs_list`
ffef10f6
VS
378 guildflags=`get_ldflags_gui $libs_list`
379 echo $libs ${LDFLAGS} ${guildflags} ${WXCONFIG_RPATH} $wxlibs ${DMALLOC_LIBS}
3d63bc3a
RL
380 fi
381
3a922bb4
RL
382 ;;
383 --gl-libs)
cf615ebb 384 output_libs gl
9a98a854 385 ;;
6ce73557
VZ
386 --cc)
387 echo $CC
388 ;;
389 --cxx)
390 echo $CXX
391 ;;
392 --ld)
393 echo $LD
394 ;;
9a98a854 395 *)
75f4be8a 396 usage 1 1>&2
9a98a854
VZ
397 ;;
398 esac
399 shift
400done
401