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