Wed, 07 May 2025 23:59:13 +0200
update uwproj
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | #!/bin/sh |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | |
85 | 3 | |
4 | # some utility functions | |
5 | isplatform() | |
6 | { | |
7 | for p in $PLATFORM | |
8 | do | |
9 | if [ "$p" = "$1" ]; then | |
10 | return 0 | |
11 | fi | |
12 | done | |
13 | return 1 | |
14 | } | |
15 | notisplatform() | |
16 | { | |
17 | for p in $PLATFORM | |
18 | do | |
19 | if [ "$p" = "$1" ]; then | |
20 | return 1 | |
21 | fi | |
22 | done | |
23 | return 0 | |
24 | } | |
25 | istoolchain() | |
26 | { | |
27 | for t in $TOOLCHAIN | |
28 | do | |
29 | if [ "$t" = "$1" ]; then | |
30 | return 0 | |
31 | fi | |
32 | done | |
33 | return 1 | |
34 | } | |
35 | notistoolchain() | |
36 | { | |
37 | for t in $TOOLCHAIN | |
38 | do | |
39 | if [ "$t" = "$1" ]; then | |
40 | return 1 | |
41 | fi | |
42 | done | |
43 | return 0 | |
44 | } | |
45 | ||
46 | # clean abort | |
47 | abort_configure() | |
48 | { | |
49 | rm -Rf "$TEMP_DIR" | |
50 | exit 1 | |
51 | } | |
52 | ||
53 | # Test for availability of pkg-config | |
54 | PKG_CONFIG=`command -v pkg-config` | |
55 | : ${PKG_CONFIG:="false"} | |
56 | ||
57 | # Simple uname based platform detection | |
58 | # $PLATFORM is used for platform dependent dependency selection | |
59 | OS=`uname -s` | |
60 | OS_VERSION=`uname -r` | |
61 | printf "detect platform... " | |
62 | if [ "$OS" = "SunOS" ]; then | |
63 | PLATFORM="solaris sunos unix svr4" | |
64 | elif [ "$OS" = "Linux" ]; then | |
65 | PLATFORM="linux unix" | |
66 | elif [ "$OS" = "FreeBSD" ]; then | |
67 | PLATFORM="freebsd bsd unix" | |
68 | elif [ "$OS" = "OpenBSD" ]; then | |
69 | PLATFORM="openbsd bsd unix" | |
70 | elif [ "$OS" = "NetBSD" ]; then | |
71 | PLATFORM="netbsd bsd unix" | |
72 | elif [ "$OS" = "Darwin" ]; then | |
73 | PLATFORM="macos osx bsd unix" | |
74 | elif echo "$OS" | grep -i "MINGW" > /dev/null; then | |
75 | PLATFORM="windows mingw" | |
76 | fi | |
77 | : ${PLATFORM:="unix"} | |
78 | ||
79 | PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` | |
80 | echo "$PLATFORM_NAME" | |
81 | ||
82 | ||
83 | # help text | |
84 | printhelp() | |
85 | { | |
86 | echo "Usage: $0 [OPTIONS]..." | |
87 | cat << __EOF__ | |
88 | Installation directories: | |
89 | --prefix=PREFIX path prefix for architecture-independent files | |
90 | [$prefix] | |
91 | --exec-prefix=EPREFIX path prefix for architecture-dependent files | |
92 | [PREFIX] | |
93 | ||
94 | --bindir=DIR user executables [EPREFIX/bin] | |
95 | --sbindir=DIR system admin executables [EPREFIX/sbin] | |
96 | --libexecdir=DIR program executables [EPREFIX/libexec] | |
97 | --sysconfdir=DIR system configuration files [PREFIX/etc] | |
98 | --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] | |
99 | --localstatedir=DIR modifiable single-machine data [PREFIX/var] | |
100 | --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] | |
101 | --libdir=DIR object code libraries [EPREFIX/lib] | |
102 | --includedir=DIR C header files [PREFIX/include] | |
103 | --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] | |
104 | --datadir=DIR read-only architecture-independent data [DATAROOTDIR] | |
105 | --infodir=DIR info documentation [DATAROOTDIR/info] | |
106 | --mandir=DIR man documentation [DATAROOTDIR/man] | |
107 | --localedir=DIR locale-dependent data [DATAROOTDIR/locale] | |
108 | ||
109 | Build Types: | |
110 | --debug add extra compile flags for debug builds | |
111 | --release add extra compile flags for release builds | |
112 | ||
113 | __EOF__ | |
114 | } | |
115 | ||
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
116 | # create temporary directory |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
117 | TEMP_DIR=".tmp-`uname -n`" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
118 | rm -Rf "$TEMP_DIR" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
119 | if mkdir -p "$TEMP_DIR"; then |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
120 | : |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
121 | else |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
122 | echo "Cannot create tmp dir $TEMP_DIR" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
123 | echo "Abort" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
124 | exit 1 |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
125 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
126 | touch "$TEMP_DIR/options" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
127 | touch "$TEMP_DIR/features" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
128 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
129 | # define standard variables |
74
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
130 | # also define standard prefix (this is where we will search for config.site) |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
131 | prefix=/usr |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
132 | exec_prefix= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
133 | bindir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
134 | sbindir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
135 | libdir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
136 | libexecdir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
137 | datarootdir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
138 | datadir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
139 | sysconfdir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
140 | sharedstatedir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
141 | localstatedir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
142 | runstatedir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
143 | includedir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
144 | infodir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
145 | localedir= |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
146 | mandir= |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
147 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
148 | # custom variables |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
149 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
150 | # features |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
151 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
152 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
153 | # parse arguments |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
154 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
155 | BUILD_TYPE="default" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
156 | for ARG in "$@" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
157 | do |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
158 | case "$ARG" in |
74
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
159 | "--prefix="*) prefix=${ARG#--prefix=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
160 | "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
161 | "--bindir="*) bindir=${ARG#----bindir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
162 | "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
163 | "--libdir="*) libdir=${ARG#--libdir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
164 | "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
165 | "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
166 | "--datadir="*) datadir=${ARG#--datadir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
167 | "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
168 | "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
169 | "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
170 | "--includedir="*) includedir=${ARG#--includedir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
171 | "--infodir="*) infodir=${ARG#--infodir=} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
172 | "--mandir"*) mandir=${ARG#--mandir} ;; |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
173 | "--localedir"*) localedir=${ARG#--localedir} ;; |
85 | 174 | "--help"*) printhelp; abort_configure ;; |
175 | "--debug") BUILD_TYPE="debug" ;; | |
176 | "--release") BUILD_TYPE="release" ;; | |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
177 | "-"*) echo "unknown option: $ARG"; abort_configure ;; |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
178 | esac |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
179 | done |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
180 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
181 | |
74
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
182 | |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
183 | # set defaults for dir variables |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
184 | : ${exec_prefix:="$prefix"} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
185 | : ${bindir:='${exec_prefix}/bin'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
186 | : ${sbindir:='${exec_prefix}/sbin'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
187 | : ${libdir:='${exec_prefix}/lib'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
188 | : ${libexecdir:='${exec_prefix}/libexec'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
189 | : ${datarootdir:='${prefix}/share'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
190 | : ${datadir:='${datarootdir}'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
191 | : ${sysconfdir:='${prefix}/etc'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
192 | : ${sharedstatedir:='${prefix}/com'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
193 | : ${localstatedir:='${prefix}/var'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
194 | : ${runstatedir:='${localstatedir}/run'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
195 | : ${includedir:='${prefix}/include'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
196 | : ${infodir:='${datarootdir}/info'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
197 | : ${mandir:='${datarootdir}/man'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
198 | : ${localedir:='${datarootdir}/locale'} |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
199 | |
85 | 200 | # remember the above values and compare them later |
201 | orig_bindir="$bindir" | |
202 | orig_sbindir="$sbindir" | |
203 | orig_libdir="$libdir" | |
204 | orig_libexecdir="$libexecdir" | |
205 | orig_datarootdir="$datarootdir" | |
206 | orig_datadir="$datadir" | |
207 | orig_sysconfdir="$sysconfdir" | |
208 | orig_sharedstatedir="$sharedstatedir" | |
209 | orig_localstatedir="$localstatedir" | |
210 | orig_runstatedir="$runstatedir" | |
211 | orig_includedir="$includedir" | |
212 | orig_infodir="$infodir" | |
213 | orig_mandir="$mandir" | |
214 | orig_localedir="$localedir" | |
215 | ||
74
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
216 | # check if a config.site exists and load it |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
217 | if [ -n "$CONFIG_SITE" ]; then |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
218 | # CONFIG_SITE may contain space separated file names |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
219 | for cs in $CONFIG_SITE; do |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
220 | printf "loading defaults from $cs... " |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
221 | . "$cs" |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
222 | echo ok |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
223 | done |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
224 | elif [ -f "$prefix/share/config.site" ]; then |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
225 | printf "loading site defaults... " |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
226 | . "$prefix/share/config.site" |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
227 | echo ok |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
228 | elif [ -f "$prefix/etc/config.site" ]; then |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
229 | printf "loading site defaults... " |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
230 | . "$prefix/etc/config.site" |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
231 | echo ok |
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
232 | fi |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
233 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
234 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
235 | # generate vars.mk |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
236 | cat > "$TEMP_DIR/vars.mk" << __EOF__ |
85 | 237 | prefix=$prefix |
238 | exec_prefix=$exec_prefix | |
239 | bindir=$bindir | |
240 | sbindir=$sbindir | |
241 | libdir=$libdir | |
242 | libexecdir=$libexecdir | |
243 | datarootdir=$datarootdir | |
244 | datadir=$datadir | |
245 | sysconfdir=$sysconfdir | |
246 | sharedstatedir=$sharedstatedir | |
247 | localstatedir=$localstatedir | |
248 | runstatedir=$runstatedir | |
249 | includedir=$includedir | |
250 | infodir=$infodir | |
251 | mandir=$mandir | |
252 | localedir=$localedir | |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
253 | __EOF__ |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
254 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
255 | # toolchain detection utilities |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
256 | . make/toolchain.sh |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
257 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
258 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
259 | # DEPENDENCIES |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
260 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
261 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
262 | # check languages |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
263 | lang_c= |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
264 | lang_cpp= |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
265 | if detect_c_compiler ; then |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
266 | lang_c=1 |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
267 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
268 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
269 | # create buffer for make variables required by dependencies |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
270 | echo > "$TEMP_DIR/make.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
271 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
272 | test_pkg_config() |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
273 | { |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
274 | if "$PKG_CONFIG" --exists "$1" ; then : |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
275 | else return 1 ; fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
276 | if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
277 | else return 1 ; fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
278 | if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
279 | else return 1 ; fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
280 | if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
281 | else return 1 ; fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
282 | return 0 |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
283 | } |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
284 | |
85 | 285 | print_check_msg() |
286 | { | |
287 | if [ -z "$1" ]; then | |
288 | shift | |
289 | printf "$@" | |
290 | fi | |
291 | } | |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
292 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
293 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
294 | # start collecting dependency information |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
295 | echo > "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
296 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
297 | DEPENDENCIES_FAILED= |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
298 | ERROR=0 |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
299 | # unnamed dependencies |
85 | 300 | TEMP_CFLAGS="$CFLAGS" |
301 | TEMP_CXXFLAGS="$CXXFLAGS" | |
302 | TEMP_LDFLAGS="$LDFLAGS" | |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
303 | while true |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
304 | do |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
305 | while true |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
306 | do |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
307 | if [ -z "$lang_c" ] ; then |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
308 | ERROR=1 |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
309 | break |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
310 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
311 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
312 | break |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
313 | done |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
314 | break |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
315 | done |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
316 | |
85 | 317 | # build type |
318 | if [ "$BUILD_TYPE" = "debug" ]; then | |
319 | TEMP_CFLAGS="\${DEBUG_CFLAGS}$TEMP_CFLAGS" | |
320 | TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS}$TEMP_CXXFLAGS" | |
321 | fi | |
322 | if [ "$BUILD_TYPE" = "release" ]; then | |
323 | TEMP_CFLAGS="\${RELEASE_CFLAGS}$TEMP_CFLAGS" | |
324 | TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS}$TEMP_CXXFLAGS" | |
325 | fi | |
326 | ||
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
327 | # add general dependency flags to flags.mk |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
328 | echo "# general flags" >> "$TEMP_DIR/flags.mk" |
85 | 329 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
330 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
331 | fi |
85 | 332 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
333 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
334 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
335 | if [ -n "${TEMP_LDFLAGS}" ]; then |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
336 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
337 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
338 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
339 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
340 | # OPTION VALUES |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
341 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
342 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
343 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
344 | # TARGETS |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
345 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
346 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
347 | echo >> "$TEMP_DIR/flags.mk" |
74
ed9a5ffd1f13
update uwproj (adds support for config.site)
Mike Becker <universe@uap-core.de>
parents:
68
diff
changeset
|
348 | echo "configuring target: default" |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
349 | echo "# flags for target default" >> "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
350 | TEMP_CFLAGS= |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
351 | TEMP_CXXFLAGS= |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
352 | TEMP_LDFLAGS= |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
353 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
354 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
355 | # Features |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
356 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
357 | |
85 | 358 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
359 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
360 | fi |
85 | 361 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
362 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
363 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
364 | if [ -n "${TEMP_LDFLAGS}" ]; then |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
365 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
366 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
367 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
368 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
369 | # final result |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
370 | if [ $ERROR -ne 0 ]; then |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
371 | echo |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
372 | echo "Error: Unresolved dependencies" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
373 | echo "$DEPENDENCIES_FAILED" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
374 | abort_configure |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
375 | fi |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
376 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
377 | echo "configure finished" |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
378 | echo |
85 | 379 | echo "Toolchain" |
380 | echo " name: $TOOLCHAIN_NAME" | |
381 | if [ -n "$TOOLCHAIN_CC" ]; then | |
382 | echo " cc: $TOOLCHAIN_CC" | |
383 | fi | |
384 | if [ -n "$TOOLCHAIN_CXX" ]; then | |
385 | echo " cxx: $TOOLCHAIN_CXX" | |
386 | fi | |
387 | if [ -n "$TOOLCHAIN_WSIZE" ]; then | |
388 | echo " word size: $TOOLCHAIN_WSIZE bit" | |
389 | fi | |
390 | if [ -n "$TOOLCHAIN_CSTD" ]; then | |
391 | echo " default C std: $TOOLCHAIN_CSTD" | |
392 | fi | |
393 | echo | |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
394 | echo "Build Config:" |
85 | 395 | echo " prefix: $prefix" |
396 | echo " exec_prefix: $exec_prefix" | |
397 | if [ "$orig_bindir" != "$bindir" ]; then | |
398 | echo " bindir: $bindir" | |
399 | fi | |
400 | if [ "$orig_sbindir" != "$sbindir" ]; then | |
401 | echo " sbindir: $sbindir" | |
402 | fi | |
403 | if [ "$orig_libdir" != "$libdir" ]; then | |
404 | echo " libdir: $libdir" | |
405 | fi | |
406 | if [ "$orig_libexecdir" != "$libexecdir" ]; then | |
407 | echo " libexecdir: $libexecdir" | |
408 | fi | |
409 | if [ "$orig_datarootdir" != "$datarootdir" ]; then | |
410 | echo " datarootdir: $datarootdir" | |
411 | fi | |
412 | if [ "$orig_datadir" != "$datadir" ]; then | |
413 | echo " datadir: $datadir" | |
414 | fi | |
415 | if [ "$orig_sysconfdir" != "$sysconfdir" ]; then | |
416 | echo " sysconfdir: $sysconfdir" | |
417 | fi | |
418 | if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then | |
419 | echo " sharedstatedir: $sharedstatedir" | |
420 | fi | |
421 | if [ "$orig_localstatedir" != "$localstatedir" ]; then | |
422 | echo " localstatedir: $localstatedir" | |
423 | fi | |
424 | if [ "$orig_runstatedir" != "$runstatedir" ]; then | |
425 | echo " runstatedir: $runstatedir" | |
426 | fi | |
427 | if [ "$orig_includedir" != "$includedir" ]; then | |
428 | echo " includedir: $includedir" | |
429 | fi | |
430 | if [ "$orig_infodir" != "$infodir" ]; then | |
431 | echo " infodir: $infodir" | |
432 | fi | |
433 | if [ "$orig_mandir" != "$mandir" ]; then | |
434 | echo " mandir: $mandir" | |
435 | fi | |
436 | if [ "$orig_localedir" != "$localedir" ]; then | |
437 | echo " localedir: $localedir" | |
438 | fi | |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
439 | echo |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
440 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
441 | # generate the config.mk file |
85 | 442 | pwd=`pwd` |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
443 | cat > "$TEMP_DIR/config.mk" << __EOF__ |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
444 | # |
85 | 445 | # config.mk generated by: |
446 | # pwd: $pwd | |
447 | # $0 $@ | |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
448 | # |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
449 | |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
450 | __EOF__ |
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
451 | write_toolchain_defaults "$TEMP_DIR/toolchain.mk" |
85 | 452 | cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
68
ae763178ee1e
replace autoconf with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
453 | rm -Rf "$TEMP_DIR" |