]> git.saurik.com Git - wxWidgets.git/blame - wx-config.in
preferences menu implementation
[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@"
3a922bb4 10cross_compiling=@cross_compiling@
77e13408 11target=@host_alias@
2bffed64 12static_flag=@STATIC_FLAG@
9a98a854 13
75f4be8a
VZ
14usage()
15{
16 cat <<EOF
3d63bc3a 17Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--static]
40f7145c
GD
18 [--libs] [--gl-libs]
19 [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
75f4be8a
VZ
20 [--cc] [--cxx] [--ld]
21
22wx-config returns configuration information about the installed
23version of wxWindows. It may be used to query its version and
24installation directories and also retrieve the C and C++ compilers
25and linker which were used for its building and the corresponding
26flags.
2b5f62a0 27
82a649b6
RL
28Ordinarily it should be installed to the appropriate system location
29along with the headers and library files, but it is also possible to
30use it to enable builds with an uninstalled wxWindows version for
31package building and bleeding edge developers. To do so, use it like
32this:
33
dc5e3b9e 34\${wx_builddir}/wx-config --prefix=\${wx_srcdir} --exec-prefix=\${wx_builddir}
82a649b6
RL
35
36Note that any other options supplied must come *after* the prefix
37specification for it to take effect.
38
75f4be8a
VZ
39EOF
40
41 exit $1
42}
43
44cppflags()
45{
2b5f62a0
VZ
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
77e13408
RL
61 if test "@includedir@" != "/usr/include" \
62 -a "@includedir@" != "/usr/include/c++" \
2b5f62a0
VZ
63 -a \( "${GCC}" != "yes" \
64 -o "@includedir@" != "/usr/local/include" \) \
77e13408
RL
65 -a \( "${cross_compiling}" != "yes" \
66 -o "@includedir@" != "/usr/${target}/include" \) ;
3a922bb4 67 then
2b5f62a0 68 includes=" -I@includedir@"
75f4be8a 69 fi
00c81359 70
82a649b6 71 includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@$includes"
00c81359
RL
72
73 if test $static_flag = yes ; then
e26c13cf 74 echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
00c81359 75 else
e26c13cf 76 echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @TOOLCHAIN_DLL_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
00c81359 77 fi
75f4be8a 78}
9a98a854
VZ
79
80if test $# -eq 0; then
3a922bb4 81 usage 1 1>&2
9a98a854
VZ
82fi
83
84while 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)
79144b8a 108 echo @WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@.@WX_RELEASE_NUMBER@
9a98a854 109 ;;
3d63bc3a
RL
110 --static)
111 static_flag=yes
112 ;;
75f4be8a
VZ
113 --cppflags)
114 cppflags
115 ;;
9a98a854 116 --cflags)
75f4be8a
VZ
117 echo `cppflags` @CODE_GEN_FLAGS@
118 ;;
119 --cxxflags)
120 echo `cppflags` @CODE_GEN_FLAGS@ @CODE_GEN_FLAGS_CXX@
9a98a854 121 ;;
40f7145c
GD
122 --ldflags)
123 echo @LDFLAGS_EXE@
124 ;;
2baaf735
RR
125 --rezflags)
126 echo @LIBWXMACRESWXCONFIG@
127 ;;
9a98a854 128 --libs)
77e13408
RL
129 if test "@libdir@" != "/usr/lib" \
130 -a \( "${cross_compiling}" != "yes" \
131 -o "@libdir@" != "/usr/${target}/lib" \) ;
3a922bb4
RL
132 then
133 libs="-L@libdir@"
9a98a854 134 fi
3d63bc3a
RL
135
136 if test $static_flag = yes ; then
3bd8fb5f 137 echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @LIBS@ @DMALLOC_LIBS@"
3d63bc3a 138 else
3bd8fb5f 139 echo $libs @LDFLAGS@ @WXCONFIG_RPATH@ @WXCONFIG_LIBS@ @DMALLOC_LIBS@
3d63bc3a
RL
140 fi
141
3a922bb4
RL
142 ;;
143 --gl-libs)
885d4bf5
VS
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
82a649b6 149 echo @LDFLAGS_GL@ $gllibs
9a98a854 150 ;;
6ce73557
VZ
151 --cc)
152 echo $CC
153 ;;
154 --cxx)
155 echo $CXX
156 ;;
157 --ld)
158 echo $LD
159 ;;
9a98a854 160 *)
75f4be8a 161 usage 1 1>&2
9a98a854
VZ
162 ;;
163 esac
164 shift
165done
166