]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | prefix=@prefix@ | |
4 | exec_prefix=@exec_prefix@ | |
5 | exec_prefix_set=no | |
6 | CC="@CC@" | |
7 | GCC="@GCC@" | |
8 | CXX="@CXX@" | |
9 | LD="@SHARED_LD@" | |
10 | cross_compiling=@cross_compiling@ | |
11 | target=@host_alias@ | |
12 | static_flag=@STATIC_FLAG@ | |
13 | ||
14 | usage() | |
15 | { | |
16 | cat <<EOF | |
17 | Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--static] | |
18 | [--libs] [--gl-libs] | |
19 | [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags] | |
20 | [--cc] [--cxx] [--ld] | |
21 | ||
22 | wx-config returns configuration information about the installed | |
23 | version of wxWindows. It may be used to query its version and | |
24 | installation directories and also retrieve the C and C++ compilers | |
25 | and linker which were used for its building and the corresponding | |
26 | flags. | |
27 | ||
28 | Ordinarily it should be installed to the appropriate system location | |
29 | along with the headers and library files, but it is also possible to | |
30 | use it to enable builds with an uninstalled wxWindows version for | |
31 | package building and bleeding edge developers. To do so, use it like | |
32 | this: | |
33 | ||
34 | \${wx_builddir}/wx-config --prefix=\${wx_srcdir} --exec-prefix=\${wx_builddir} | |
35 | ||
36 | Note that any other options supplied must come *after* the prefix | |
37 | specification for it to take effect. | |
38 | ||
39 | EOF | |
40 | ||
41 | exit $1 | |
42 | } | |
43 | ||
44 | cppflags() | |
45 | { | |
46 | # we should never specify -I/usr/include on the compiler command line: this | |
47 | # is at best useless and at worst breaks compilation on the systems where | |
48 | # the system headers are non-ANSI because gcc works around this by storing | |
49 | # the ANSI-fied versions of them in its private directory which is searched | |
50 | # after all the directories on the cmd line. | |
51 | # | |
52 | # the situation is a bit more complicated with -I/usr/local/include: again, | |
53 | # it shouldn't be specified with gcc which looks there by default anyhow | |
54 | # and gives warnings (at least 3.1 does) if it is specified explicitly -- | |
55 | # but this -I switch *is* needed for the other compilers | |
56 | # | |
57 | # note that we assume that if we use GNU cc we also use GNU c++ and vice | |
58 | # versa, i.e. this won't work (either for --cflags or --cxxflags) if GNU C | |
59 | # compiler and non-GNU C++ compiler are used or vice versa -- we'll fix | |
60 | # this when/if anybody complains about it | |
61 | if test "@includedir@" != "/usr/include" \ | |
62 | -a "@includedir@" != "/usr/include/c++" \ | |
63 | -a \( "${GCC}" != "yes" \ | |
64 | -o "@includedir@" != "/usr/local/include" \) \ | |
65 | -a \( "${cross_compiling}" != "yes" \ | |
66 | -o "@includedir@" != "/usr/${target}/include" \) ; | |
67 | then | |
68 | includes=" -I@includedir@" | |
69 | fi | |
70 | ||
71 | includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@$includes" | |
72 | ||
73 | if test $static_flag = yes ; then | |
74 | echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@ | |
75 | else | |
76 | echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @TOOLCHAIN_DLL_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@ | |
77 | fi | |
78 | } | |
79 | ||
80 | if test $# -eq 0; then | |
81 | usage 1 1>&2 | |
82 | fi | |
83 | ||
84 | while test $# -gt 0; do | |
85 | case "$1" in | |
86 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; | |
87 | *) optarg= ;; | |
88 | esac | |
89 | ||
90 | case $1 in | |
91 | --prefix=*) | |
92 | prefix=$optarg | |
93 | if test $exec_prefix_set = no ; then | |
94 | exec_prefix=$optarg | |
95 | fi | |
96 | ;; | |
97 | --prefix) | |
98 | echo $prefix | |
99 | ;; | |
100 | --exec-prefix=*) | |
101 | exec_prefix=$optarg | |
102 | exec_prefix_set=yes | |
103 | ;; | |
104 | --exec-prefix) | |
105 | echo $exec_prefix | |
106 | ;; | |
107 | --version) | |
108 | echo @WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@.@WX_RELEASE_NUMBER@ | |
109 | ;; | |
110 | --static) | |
111 | static_flag=yes | |
112 | ;; | |
113 | --cppflags) | |
114 | cppflags | |
115 | ;; | |
116 | --cflags) | |
117 | echo `cppflags` @CODE_GEN_FLAGS@ | |
118 | ;; | |
119 | --cxxflags) | |
120 | echo `cppflags` @CODE_GEN_FLAGS@ @CODE_GEN_FLAGS_CXX@ | |
121 | ;; | |
122 | --ldflags) | |
123 | echo @LDFLAGS_EXE@ | |
124 | ;; | |
125 | --rezflags) | |
126 | echo @LIBWXMACRESWXCONFIG@ | |
127 | ;; | |
128 | --libs) | |
129 | if test "@libdir@" != "/usr/lib" \ | |
130 | -a \( "${cross_compiling}" != "yes" \ | |
131 | -o "@libdir@" != "/usr/${target}/lib" \) ; | |
132 | then | |
133 | libs="-L@libdir@" | |
134 | fi | |
135 | ||
136 | if test $static_flag = yes ; then | |
137 | echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @LIBS@ @DMALLOC_LIBS@" | |
138 | else | |
139 | echo $libs @LDFLAGS@ @WXCONFIG_RPATH@ @WXCONFIG_LIBS@ @DMALLOC_LIBS@ | |
140 | fi | |
141 | ||
142 | ;; | |
143 | --gl-libs) | |
144 | if test $static_flag = yes -a "x" != "x@WXCONFIG_LIBS_STATIC_GL@" ; then | |
145 | gllibs="@libdir@/@WXCONFIG_LIBS_STATIC_GL@" | |
146 | else | |
147 | gllibs="@WXCONFIG_LIBS_GL@" | |
148 | fi | |
149 | echo @LDFLAGS_GL@ $gllibs | |
150 | ;; | |
151 | --cc) | |
152 | echo $CC | |
153 | ;; | |
154 | --cxx) | |
155 | echo $CXX | |
156 | ;; | |
157 | --ld) | |
158 | echo $LD | |
159 | ;; | |
160 | *) | |
161 | usage 1 1>&2 | |
162 | ;; | |
163 | esac | |
164 | shift | |
165 | done | |
166 |