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