]> git.saurik.com Git - wxWidgets.git/blame - wx-config.in
*really* fixed searching in sorted arrays
[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
VZ
10srcdir=@top_srcdir@
11builddir=@top_builddir@
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
3d63bc3a 36Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--static]
40f7145c
GD
37 [--libs] [--gl-libs]
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 ;;
3d63bc3a
RL
134 --static)
135 static_flag=yes
136 ;;
75f4be8a
VZ
137 --cppflags)
138 cppflags
139 ;;
9a98a854 140 --cflags)
75f4be8a
VZ
141 echo `cppflags` @CODE_GEN_FLAGS@
142 ;;
143 --cxxflags)
144 echo `cppflags` @CODE_GEN_FLAGS@ @CODE_GEN_FLAGS_CXX@
9a98a854 145 ;;
40f7145c
GD
146 --ldflags)
147 echo @LDFLAGS_EXE@
148 ;;
2baaf735 149 --rezflags)
36825681 150 echo @MACRESWXCONFIG@
2baaf735 151 ;;
9a98a854 152 --libs)
77e13408
RL
153 if test "@libdir@" != "/usr/lib" \
154 -a \( "${cross_compiling}" != "yes" \
155 -o "@libdir@" != "/usr/${target}/lib" \) ;
3a922bb4
RL
156 then
157 libs="-L@libdir@"
9a98a854 158 fi
3d63bc3a
RL
159
160 if test $static_flag = yes ; then
3bd8fb5f 161 echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @LIBS@ @DMALLOC_LIBS@"
3d63bc3a 162 else
3bd8fb5f 163 echo $libs @LDFLAGS@ @WXCONFIG_RPATH@ @WXCONFIG_LIBS@ @DMALLOC_LIBS@
3d63bc3a
RL
164 fi
165
3a922bb4
RL
166 ;;
167 --gl-libs)
885d4bf5
VS
168 if test $static_flag = yes -a "x" != "x@WXCONFIG_LIBS_STATIC_GL@" ; then
169 gllibs="@libdir@/@WXCONFIG_LIBS_STATIC_GL@"
170 else
171 gllibs="@WXCONFIG_LIBS_GL@"
172 fi
82a649b6 173 echo @LDFLAGS_GL@ $gllibs
9a98a854 174 ;;
6ce73557
VZ
175 --cc)
176 echo $CC
177 ;;
178 --cxx)
179 echo $CXX
180 ;;
181 --ld)
182 echo $LD
183 ;;
9a98a854 184 *)
75f4be8a 185 usage 1 1>&2
9a98a854
VZ
186 ;;
187 esac
188 shift
189done
190