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