]> git.saurik.com Git - wxWidgets.git/blame - wx-config.in
SWIGged update for wxGTK
[wxWidgets.git] / wx-config.in
CommitLineData
9a98a854
VZ
1#!/bin/sh
2
3prefix=@prefix@
4exec_prefix=@exec_prefix@
5exec_prefix_set=no
6ce73557 6CC="@CC@"
2b5f62a0 7GCC="@GCC@"
6ce73557
VZ
8CXX="@CXX@"
9LD="@SHARED_LD@"
52c71b80 10srcdir=@top_srcdir@
e90ed8ad 11builddir=@top_builddir_wxconfig@
3a922bb4 12cross_compiling=@cross_compiling@
77e13408 13target=@host_alias@
2bffed64 14static_flag=@STATIC_FLAG@
9a98a854 15
52c71b80
VZ
16# return the absolute path prepending builddir to it if needed
17makeabs()
18{
19 path=$1
20 # TODO: this only works under Unix and even there it could be
21 # enhanced to remove ".." and "."
22 if [ `echo $path | sed 's/^\(.\).*/\1/'` != "/" ]; then
23 if [ $path = "." ]; then
24 path=$builddir
25 else
26 path="$builddir/$path"
27 fi
28 fi
29
30 echo $path
31}
32
75f4be8a
VZ
33usage()
34{
35 cat <<EOF
2f42e5b6
VS
36Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--release]
37 [--basename] [--static] [--libs] [--gl-libs]
40f7145c 38 [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
75f4be8a
VZ
39 [--cc] [--cxx] [--ld]
40
41wx-config returns configuration information about the installed
42version of wxWindows. It may be used to query its version and
43installation directories and also retrieve the C and C++ compilers
44and linker which were used for its building and the corresponding
45flags.
2b5f62a0 46
82a649b6
RL
47Ordinarily it should be installed to the appropriate system location
48along with the headers and library files, but it is also possible to
49use it to enable builds with an uninstalled wxWindows version for
50package building and bleeding edge developers. To do so, use it like
51this:
52
dc5e3b9e 53\${wx_builddir}/wx-config --prefix=\${wx_srcdir} --exec-prefix=\${wx_builddir}
82a649b6
RL
54
55Note that any other options supplied must come *after* the prefix
56specification for it to take effect.
57
75f4be8a
VZ
58EOF
59
60 exit $1
61}
62
63cppflags()
64{
2b5f62a0
VZ
65 # we should never specify -I/usr/include on the compiler command line: this
66 # is at best useless and at worst breaks compilation on the systems where
67 # the system headers are non-ANSI because gcc works around this by storing
68 # the ANSI-fied versions of them in its private directory which is searched
69 # after all the directories on the cmd line.
70 #
71 # the situation is a bit more complicated with -I/usr/local/include: again,
72 # it shouldn't be specified with gcc which looks there by default anyhow
73 # and gives warnings (at least 3.1 does) if it is specified explicitly --
74 # but this -I switch *is* needed for the other compilers
75 #
76 # note that we assume that if we use GNU cc we also use GNU c++ and vice
77 # versa, i.e. this won't work (either for --cflags or --cxxflags) if GNU C
78 # compiler and non-GNU C++ compiler are used or vice versa -- we'll fix
79 # this when/if anybody complains about it
77e13408
RL
80 if test "@includedir@" != "/usr/include" \
81 -a "@includedir@" != "/usr/include/c++" \
2b5f62a0
VZ
82 -a \( "${GCC}" != "yes" \
83 -o "@includedir@" != "/usr/local/include" \) \
77e13408
RL
84 -a \( "${cross_compiling}" != "yes" \
85 -o "@includedir@" != "/usr/${target}/include" \) ;
3a922bb4 86 then
2b5f62a0 87 includes=" -I@includedir@"
75f4be8a 88 fi
00c81359 89
82a649b6 90 includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@$includes"
00c81359
RL
91
92 if test $static_flag = yes ; then
e26c13cf 93 echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
00c81359 94 else
e26c13cf 95 echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @TOOLCHAIN_DLL_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
00c81359 96 fi
75f4be8a 97}
9a98a854
VZ
98
99if test $# -eq 0; then
3a922bb4 100 usage 1 1>&2
9a98a854
VZ
101fi
102
103while test $# -gt 0; do
104 case "$1" in
105 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
106 *) optarg= ;;
107 esac
108
109 case $1 in
52c71b80
VZ
110 --inplace)
111 prefix=`makeabs $srcdir`
112 exec_prefix=`makeabs $builddir`
113 exec_prefix_set=yes
114 ;;
9a98a854
VZ
115 --prefix=*)
116 prefix=$optarg
117 if test $exec_prefix_set = no ; then
118 exec_prefix=$optarg
119 fi
120 ;;
121 --prefix)
122 echo $prefix
123 ;;
124 --exec-prefix=*)
125 exec_prefix=$optarg
126 exec_prefix_set=yes
127 ;;
128 --exec-prefix)
129 echo $exec_prefix
130 ;;
131 --version)
79144b8a 132 echo @WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@.@WX_RELEASE_NUMBER@
9a98a854 133 ;;
2f42e5b6
VS
134 --release)
135 # Should echo @WX_RELEASE@ instead, but that doesn't seem to be replaced after
136 # configure has run on this file.
137 echo @WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@
138 ;;
139 --basename)
140 echo @WX_LIBRARY_BASENAME@
141 ;;
3d63bc3a
RL
142 --static)
143 static_flag=yes
144 ;;
75f4be8a
VZ
145 --cppflags)
146 cppflags
147 ;;
9a98a854 148 --cflags)
f0290fca 149 echo `cppflags` @CODE_GEN_FLAGS@
75f4be8a
VZ
150 ;;
151 --cxxflags)
f0290fca 152 echo `cppflags` @CODE_GEN_FLAGS@ @CODE_GEN_FLAGS_CXX@
9a98a854 153 ;;
40f7145c
GD
154 --ldflags)
155 echo @LDFLAGS_EXE@
156 ;;
2baaf735 157 --rezflags)
36825681 158 echo @MACRESWXCONFIG@
2baaf735 159 ;;
9a98a854 160 --libs)
77e13408
RL
161 if test "@libdir@" != "/usr/lib" \
162 -a \( "${cross_compiling}" != "yes" \
163 -o "@libdir@" != "/usr/${target}/lib" \) ;
3a922bb4
RL
164 then
165 libs="-L@libdir@"
9a98a854 166 fi
3d63bc3a
RL
167
168 if test $static_flag = yes ; then
c74dc163 169 echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @EXTRALIBS_GUI@ @LIBS@ @DMALLOC_LIBS@"
3d63bc3a 170 else
3bd8fb5f 171 echo $libs @LDFLAGS@ @WXCONFIG_RPATH@ @WXCONFIG_LIBS@ @DMALLOC_LIBS@
3d63bc3a
RL
172 fi
173
3a922bb4
RL
174 ;;
175 --gl-libs)
885d4bf5
VS
176 if test $static_flag = yes -a "x" != "x@WXCONFIG_LIBS_STATIC_GL@" ; then
177 gllibs="@libdir@/@WXCONFIG_LIBS_STATIC_GL@"
178 else
179 gllibs="@WXCONFIG_LIBS_GL@"
180 fi
82a649b6 181 echo @LDFLAGS_GL@ $gllibs
9a98a854 182 ;;
6ce73557
VZ
183 --cc)
184 echo $CC
185 ;;
186 --cxx)
187 echo $CXX
188 ;;
189 --ld)
190 echo $LD
191 ;;
9a98a854 192 *)
75f4be8a 193 usage 1 1>&2
9a98a854
VZ
194 ;;
195 esac
196 shift
197done
198