3 # -------------------------------------------------------------------------
5 # -------------------------------------------------------------------------
7 # Version and build type information:
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 release
="@WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@"
13 is_monolithic
="@MONOLITHIC@"
14 cross_compiling
="@cross_compiling@"
16 static_flag
="@STATIC_FLAG@"
19 # Misc configuration variables:
23 includedir
="@includedir@"
27 exec_prefix
="@exec_prefix@"
32 GCC_SEARCHES_USR_LOCAL_INCLUDE
="@GCC_SEARCHES_USR_LOCAL_INCLUDE@"
36 builddir
="@top_builddir_wxconfig@"
37 basename_nogui
="@WX_LIBRARY_BASENAME_NOGUI@"
38 basename_gui
="@WX_LIBRARY_BASENAME_GUI@"
40 TOOLCHAIN_NAME
="@TOOLCHAIN_NAME@"
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 CODE_GEN_FLAGS
="@CODE_GEN_FLAGS@"
52 CODE_GEN_FLAGS_CXX
="@CODE_GEN_FLAGS_CXX@"
53 LDFLAGS_EXE
="@LDFLAGS_EXE@"
54 MACRESWXCONFIG
="@MACRESWXCONFIG@"
55 EXTRALIBS_GUI
="@EXTRALIBS_GUI@"
57 WXCONFIG_LDFLAGS_GUI
="@WXCONFIG_LDFLAGS_GUI@"
60 # Linker flags for sublibraries:
62 CORE_BASE_LIBS
="@CORE_BASE_LIBS@"
63 CORE_GUI_LIBS
="@CORE_GUI_LIBS@"
65 ldlibs_base
="@WXCONFIG_EXTRALIBS@"
66 ldlibs_core
="@EXTRALIBS_GUI@"
67 ldlibs_xml
="@EXTRALIBS_XML@"
68 ldlibs_html
="@EXTRALIBS_HTML@"
69 ldlibs_odbc
="@EXTRALIBS_ODBC@"
70 ldlibs_adv
="@EXTRALIBS_SDL@"
72 ldflags_gl
="@LDFLAGS_GL@"
73 ldlibs_gl
="@OPENGL_LIBS@"
77 # -------------------------------------------------------------------------
79 # -------------------------------------------------------------------------
83 # is $1 among the rest of arguments?
90 if test $iii = $value ; then isin
=yes ; fi
95 # output linker commands needed to link against libraries passed as arguments
96 # (does not handle monolithic/multilib):
99 if test "$cross_compiling" = "yes" ; then
100 target_tag
="-${target}"
108 eval xlibs
=\
$ldlibs_$lib
109 eval xflags
=\
$ldflags_$lib
110 if isinlist
$lib $CORE_BASE_LIBS ; then
111 basename=$basename_nogui
113 basename=$basename_gui
115 if test $lib = "base" ; then
118 libname
="${basename}_${lib}"
121 all_ldflags
="$all_ldflags $xflags"
122 if test $static_flag = yes ; then
123 wxlibs
="$wxlibs ${libdir}/lib${libname}-${release}${target_tag}.a"
124 all_libs
="$all_libs $xlibs"
126 wxlibs
="$wxlibs -l${libname}-${release}${target_tag}"
130 echo $all_ldflags $wxlibs $all_libs
133 # output $(WXCONFIG_LDFLAGS_GUI) if any of libs passed as arguments is GUI
134 # library, nothing otherwise:
139 if isinlist
$lib $CORE_GUI_LIBS ; then
140 flags_to_ret
="$WXCONFIG_LDFLAGS_GUI"
146 # return the absolute path prepending builddir to it if needed
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
156 path
="$builddir/$path"
166 Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--release]
167 [--basename] [--static] [--libs[=LIBS]] [--gl-libs]
168 [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
169 [--cc] [--cxx] [--ld]
171 wx-config returns configuration information about the installed
172 version of wxWidgets. It may be used to query its version and
173 installation directories and also retrieve the C and C++ compilers
174 and linker which were used for its building and the corresponding
177 Ordinarily it should be installed to the appropriate system location
178 along with the headers and library files, but it is also possible to
179 use it to enable builds with an uninstalled wxWidgets version for
180 package building and bleeding edge developers. To do so, use it like
183 \${wx_builddir}/wx-config --prefix=\${wx_srcdir} --exec-prefix=\${wx_builddir}
185 Note that any other options supplied must come *after* the prefix
186 specification for it to take effect.
188 --static must come before --cppflags, --cflags, --cxxflags,
189 --libs and --gl-libs.
191 --libs can take optional argument that contains comma-separated list of
192 wxWidgets libraries to link against. This list can include both core
193 and contrib libraries. Special value "std" stands for all libraries linked
196 --gl-libs option is deprecated, used --libs=gl instead.
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.
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.
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
223 if test "${includedir}" != "/usr/include" \
224 -a "${includedir}" != "/usr/include/c++" \
225 -a \
( "${GCC_SEARCHES_USR_LOCAL_INCLUDE}" != "yes" \
226 -o "${includedir}" != "/usr/local/include" \
) \
227 -a \
( "${cross_compiling}" != "yes" \
228 -o "${includedir}" != "/usr/${target}/include" \
) ;
230 includes
=" -I${includedir}"
233 includes
="-I${libdir}/wx/include/${TOOLCHAIN_NAME}$includes"
235 # in inplace case we need to also add path to contrib headers -- do it
236 # unconditionally as they might be used and we have no way of knowing if
238 if test $inplace_flag = yes ; then
239 includes
="$includes -I${prefix}/contrib/include"
242 if test $static_flag = yes ; then
243 echo $includes ${WXDEBUG_DEFINE} ${TOOLCHAIN_DEFS} ${WXCONFIG_INCLUDE} ${WX_LARGEFILE_FLAGS}
245 echo $includes ${WXDEBUG_DEFINE} ${TOOLCHAIN_DEFS} ${TOOLCHAIN_DLL_DEFS} ${WXCONFIG_INCLUDE} ${WX_LARGEFILE_FLAGS}
249 if test $# -eq 0; then
253 while test $# -gt 0; do
255 -*=*) optarg
=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
261 prefix
=`makeabs $srcdir`
262 exec_prefix
=`makeabs $builddir`
269 if test $exec_prefix_set = no
; then
286 echo ${WX_MAJOR_VERSION_NUMBER}.
${WX_MINOR_VERSION_NUMBER}.
${WX_RELEASE_NUMBER}
301 echo `cppflags` ${CODE_GEN_FLAGS}
304 echo `cppflags` ${CODE_GEN_FLAGS} ${CODE_GEN_FLAGS_CXX}
310 echo `eval echo ${MACRESWXCONFIG}`
314 # find if the argument was --libs=list,of,libs or --libs:
315 if test "x$optarg" = "x" ; then
316 if test "$is_monolithic" = "0" ; then
317 # link against all libs if none given explicitly:
318 libs_list
="$CORE_GUI_LIBS $CORE_BASE_LIBS"
321 libs_list
=`echo "$optarg" | tr ',' ' '`
322 # always add wxBase, any wxApp needs it:
323 libs_list
="$libs_list base"
326 # include install directory only if it is not default:
327 if test "${libdir}" != "/usr/lib" \
328 -a \
( "${cross_compiling}" != "yes" \
329 -o "${libdir}" != "/usr/${target}/lib" \
) ;
334 # it's simpler to avoid handling "bae" itself at all as we add it in the
335 # end to the list of libraries anyhow
336 # in monolithic build, link against the main library:
337 if test "$is_monolithic" = "1" ; then
338 # filter out core libs, leave only contrib in libs_list:
340 for i
in $libs_list ; do
341 if isinlist
$i $CORE_GUI_LIBS $CORE_BASE_LIBS; then
342 libs_list
="" # do nothing
344 newlist
="$newlist $i"
350 contrib_libs
=`output_libs $libs_list`
351 if test $static_flag = yes ; then
352 echo "$libs ${LDFLAGS} ${WXCONFIG_LDFLAGS_GUI} ${WXCONFIG_RPATH} $contrib_libs ${libdir}/${WXCONFIG_LIBS_STATIC} ${EXTRALIBS_GUI} ${LIBS} ${DMALLOC_LIBS}"
354 echo $libs ${LDFLAGS} ${WXCONFIG_LDFLAGS_GUI} ${WXCONFIG_RPATH} $contrib_libs ${WXCONFIG_LIBS} ${DMALLOC_LIBS}
357 # we may need to replace "std" alias with its expansion
360 for i
in $libs_list; do
367 # if we have std, we're going to add base anyhow, avoid
368 # having it twice in the end
369 if [ $hadstd = 0 ]; then
370 newlist
="$newlist $i";
375 newlist
="$newlist $i"
380 if [ $hadstd = 1 ]; then
381 libs_list
="$libs_list $CORE_GUI_LIBS $CORE_BASE_LIBS"
384 # in multilib mode, link against all sublibraries:
385 wxlibs
=`output_libs $libs_list`
386 guildflags
=`get_ldflags_gui $libs_list`
387 echo $libs ${LDFLAGS} ${guildflags} ${WXCONFIG_RPATH} $wxlibs ${DMALLOC_LIBS}