]> git.saurik.com Git - wxWidgets.git/blame_incremental - wx-config-wrapper.in
wxSplashScreen sample added to global makefiles.
[wxWidgets.git] / wx-config-wrapper.in
... / ...
CommitLineData
1#!/bin/sh
2
3# -------------------------------------------------------------------------
4# Location of wx:
5# -------------------------------------------------------------------------
6
7update_prefixes()
8{
9 includedir="@includedir@"
10 libdir="@libdir@"
11}
12prefix="@prefix@"
13exec_prefix="@exec_prefix@"
14update_prefixes
15
16srcdir="@top_srcdir@"
17builddir="@top_builddir_wxconfig@"
18
19
20# -------------------------------------------------------------------------
21# Wrapper script:
22# -------------------------------------------------------------------------
23
24exec_prefix_set=no
25
26# return the absolute path prepending builddir to it if needed
27makeabs()
28{
29 path=$1
30 # TODO: this only works under Unix and even there it could be
31 # enhanced to remove ".." and "."
32 if [ `echo $path | sed 's/^\(.\).*/\1/'` != "/" ]; then
33 if [ $path = "." ]; then
34 path=$builddir
35 else
36 path="$builddir/$path"
37 fi
38 fi
39
40 echo $path
41}
42
43# these determine wx-config script to use:
44m_toolkit='.*'
45m_univ='\(univ\)\?'
46m_unicode='\(unicode\|ansi\)'
47m_debug='\(debug\|release\)'
48m_version='[0-9]\+\.[0-9]\+'
49m_host=''
50
51# lists all wx-config scripts that match criteria specified above
52list_wx_config_scripts()
53{
54 mask="^${m_toolkit}${m_univ}-${m_unicode}-${m_debug}-${m_version}${m_host}$"
55
56 # if wx-config was called via wx$TOOLCHAIN_NAME-config symlink,
57 # try to extract the mask from it:
58 myname=`basename $0`
59 if test $myname != wx-config ; then
60 toolchain=`echo $myname | sed 's/wx\(.*\)-config/\1/'`
61 if test -f ${libdir}/wx/config/${toolchain} ; then
62 mask=$toolchain
63 fi
64 fi
65
66 if test -d ${libdir}/wx/config ; then
67 (cd ${libdir}/wx/config/ && ls -1 | grep "$mask" 2>/dev/null)
68 fi
69}
70
71# find first wx-config script that matches criteria
72find_wx_config_script()
73{
74 all_scripts=`list_wx_config_scripts`
75 # unless wxBase was explicitly requested, try to find a GUI version:
76 if test "$m_toolkit" != "base" ; then
77 script=`echo $all_scripts | tr ' ' '\n' | grep -v '^base' | head -n 1`
78 if test "x$script" != "x" ; then
79 echo ${libdir}/wx/config/${script}
80 exit 0
81 fi
82 fi
83
84 # otherwise (or if no GUI script was found), use alphabetically 1st script:
85 script=`echo $all_scripts | head -n 1`
86 if test -z "$script" ; then
87 echo "no suitable wx-config script found" >&2
88 exit 1
89 fi
90 echo ${libdir}/wx/config/${script}
91}
92
93
94# handle options:
95
96# arguments to pass to the real wx-config script:
97args=""
98
99for i in $*; do
100 case "$i" in
101 -*=*) optarg=`echo "$i" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
102 *) optarg= ;;
103 esac
104
105 case $i in
106 --inplace)
107 prefix=`makeabs $srcdir`
108 exec_prefix=`makeabs $builddir`
109 exec_prefix_set=yes
110 update_prefixes
111 args="$args --inplace"
112 ;;
113 --prefix=*)
114 prefix=$optarg
115 if test $exec_prefix_set = no ; then
116 exec_prefix=$optarg
117 fi
118 update_prefixes
119 ;;
120 --exec-prefix=*)
121 exec_prefix=$optarg
122 exec_prefix_set=yes
123 update_prefixes
124 ;;
125
126 --list)
127 # list available wx versions:
128 list_wx_config_scripts
129 exit
130 ;;
131
132 --toolkit=*)
133 m_toolkit=$optarg
134 ;;
135 --version=*)
136 m_version=$optarg
137 ;;
138 --unicode=*)
139 if test "x$optarg" = "xyes" ; then
140 m_unicode="unicode"
141 else
142 m_unicode="ansi"
143 fi
144 ;;
145 --unicode)
146 m_unicode="unicode"
147 ;;
148 --debug=*)
149 if test "x$optarg" = "xyes" ; then
150 m_debug="debug"
151 else
152 m_debug="release"
153 fi
154 ;;
155 --debug)
156 m_debug="debug"
157 ;;
158 --universal=*)
159 if test "x$optarg" = "xyes" ; then
160 m_univ="univ"
161 else
162 m_univ=""
163 fi
164 ;;
165 --universal)
166 m_univ="univ"
167 ;;
168 --host=*)
169 m_host="-$optarg"
170 ;;
171 *)
172 args="$args $i"
173 ;;
174 esac
175done
176
177args="--prefix=$prefix --exec-prefix=$exec_prefix $args"
178
179script=`find_wx_config_script`;
180if test "x$script" != "x" ; then
181 $script $args
182 exit $?
183else
184 exit 1
185fi