]> git.saurik.com Git - wxWidgets.git/blame_incremental - wx-config.in
updated
[wxWidgets.git] / wx-config.in
... / ...
CommitLineData
1#!/bin/sh
2
3prefix=@prefix@
4exec_prefix=@exec_prefix@
5exec_prefix_set=no
6CC="@CC@"
7GCC="@GCC@"
8CXX="@CXX@"
9LD="@SHARED_LD@"
10srcdir=@top_srcdir@
11builddir=@top_builddir_wxconfig@
12cross_compiling=@cross_compiling@
13target=@host_alias@
14static_flag=@STATIC_FLAG@
15
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
33usage()
34{
35 cat <<EOF
36Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--release]
37 [--basename] [--static] [--libs] [--gl-libs]
38 [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
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.
46
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
53\${wx_builddir}/wx-config --prefix=\${wx_srcdir} --exec-prefix=\${wx_builddir}
54
55Note that any other options supplied must come *after* the prefix
56specification for it to take effect.
57
58EOF
59
60 exit $1
61}
62
63cppflags()
64{
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
80 if test "@includedir@" != "/usr/include" \
81 -a "@includedir@" != "/usr/include/c++" \
82 -a \( "${GCC}" != "yes" \
83 -o "@includedir@" != "/usr/local/include" \) \
84 -a \( "${cross_compiling}" != "yes" \
85 -o "@includedir@" != "/usr/${target}/include" \) ;
86 then
87 includes=" -I@includedir@"
88 fi
89
90 includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@$includes"
91
92 if test $static_flag = yes ; then
93 echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
94 else
95 echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @TOOLCHAIN_DLL_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
96 fi
97}
98
99if test $# -eq 0; then
100 usage 1 1>&2
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
110 --inplace)
111 prefix=`makeabs $srcdir`
112 exec_prefix=`makeabs $builddir`
113 exec_prefix_set=yes
114 ;;
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)
132 echo @WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@.@WX_RELEASE_NUMBER@
133 ;;
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 ;;
142 --static)
143 static_flag=yes
144 ;;
145 --cppflags)
146 cppflags
147 ;;
148 --cflags)
149 echo `cppflags` @CODE_GEN_FLAGS@
150 ;;
151 --cxxflags)
152 echo `cppflags` @CODE_GEN_FLAGS@ @CODE_GEN_FLAGS_CXX@
153 ;;
154 --ldflags)
155 echo @LDFLAGS_EXE@
156 ;;
157 --rezflags)
158 echo @MACRESWXCONFIG@
159 ;;
160 --libs)
161 if test "@libdir@" != "/usr/lib" \
162 -a \( "${cross_compiling}" != "yes" \
163 -o "@libdir@" != "/usr/${target}/lib" \) ;
164 then
165 libs="-L@libdir@"
166 fi
167
168 if test $static_flag = yes ; then
169 echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @EXTRALIBS_GUI@ @LIBS@ @DMALLOC_LIBS@"
170 else
171 echo $libs @LDFLAGS@ @WXCONFIG_RPATH@ @WXCONFIG_LIBS@ @DMALLOC_LIBS@
172 fi
173
174 ;;
175 --gl-libs)
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
181 echo @LDFLAGS_GL@ $gllibs
182 ;;
183 --cc)
184 echo $CC
185 ;;
186 --cxx)
187 echo $CXX
188 ;;
189 --ld)
190 echo $LD
191 ;;
192 *)
193 usage 1 1>&2
194 ;;
195 esac
196 shift
197done
198