configure

branch
newapi
changeset 277
5099a34747c4
parent 176
bc63cb601f6d
child 292
8e5e7adf5372
equal deleted inserted replaced
276:376921880a7f 277:5099a34747c4
1 #!/bin/sh 1 #!/bin/sh
2 2
3 3 # create temporary directory
4 PREFIX=/usr
5 EPREFIX=$PREFIX
6
7 BINDIR=
8 SBINDIR=
9 LIBDIR=
10 LIBEXECDIR=
11 DATADIR=
12 SYSCONFDIR=
13 SHAREDSTATEDIR=
14 LOCALSTATEDIR=
15 INCLUDEDIR=
16 INFODIR=
17 MANDIR=
18
19 OS=`uname -s`
20 OS_VERSION=`uname -r`
21
22 TEMP_DIR=".tmp-`uname -n`" 4 TEMP_DIR=".tmp-`uname -n`"
23 mkdir -p $TEMP_DIR 5 rm -Rf "$TEMP_DIR"
24 if [ $? -ne 0 ]; then 6 if mkdir -p "$TEMP_DIR"; then
25 echo "Cannot create tmp dir" 7 :
26 echo "Abort" 8 else
27 fi 9 echo "Cannot create tmp dir $TEMP_DIR"
28 touch $TEMP_DIR/options 10 echo "Abort"
29 touch $TEMP_DIR/features 11 exit 1
12 fi
13 touch "$TEMP_DIR/options"
14 touch "$TEMP_DIR/features"
15
16 # define standard variables
17 # also define standard prefix (this is where we will search for config.site)
18 prefix=/usr
19 exec_prefix=
20 bindir=
21 sbindir=
22 libdir=
23 libexecdir=
24 datarootdir=
25 datadir=
26 sysconfdir=
27 sharedstatedir=
28 localstatedir=
29 runstatedir=
30 includedir=
31 infodir=
32 localedir=
33 mandir=
34
35 # custom variables
30 36
31 # features 37 # features
38
39 # clean abort
40 abort_configure()
41 {
42 rm -Rf "$TEMP_DIR"
43 exit 1
44 }
32 45
33 # help text 46 # help text
34 printhelp() 47 printhelp()
35 { 48 {
36 echo "Usage: $0 [OPTIONS]..." 49 echo "Usage: $0 [OPTIONS]..."
37 cat << __EOF__ 50 cat << __EOF__
38 Installation directories: 51 Installation directories:
39 --prefix=PREFIX path prefix for architecture-independent files 52 --prefix=PREFIX path prefix for architecture-independent files
40 [/usr] 53 [/usr]
41 --exec-prefix=EPREFIX path prefix for architecture-dependent files 54 --exec-prefix=EPREFIX path prefix for architecture-dependent files
42 [PREFIX] 55 [PREFIX]
45 --sbindir=DIR system admin executables [EPREFIX/sbin] 58 --sbindir=DIR system admin executables [EPREFIX/sbin]
46 --libexecdir=DIR program executables [EPREFIX/libexec] 59 --libexecdir=DIR program executables [EPREFIX/libexec]
47 --sysconfdir=DIR system configuration files [PREFIX/etc] 60 --sysconfdir=DIR system configuration files [PREFIX/etc]
48 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 61 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
49 --localstatedir=DIR modifiable single-machine data [PREFIX/var] 62 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
63 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run]
50 --libdir=DIR object code libraries [EPREFIX/lib] 64 --libdir=DIR object code libraries [EPREFIX/lib]
51 --includedir=DIR C header files [PREFIX/include] 65 --includedir=DIR C header files [PREFIX/include]
52 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 66 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
53 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 67 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
54 --infodir=DIR info documentation [DATAROOTDIR/info] 68 --infodir=DIR info documentation [DATAROOTDIR/info]
55 --mandir=DIR man documentation [DATAROOTDIR/man] 69 --mandir=DIR man documentation [DATAROOTDIR/man]
70 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
56 71
57 Options: 72 Options:
73 --debug add extra compile flags for debug builds
74 --release add extra compile flags for release builds
58 --toolkit=(gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif) 75 --toolkit=(gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif)
59 76
60 __EOF__ 77 __EOF__
61 } 78 }
62 79
63 # 80 #
64 # parse arguments 81 # parse arguments
65 # 82 #
66 for ARG in $@ 83 BUILD_TYPE="default"
84 for ARG in "$@"
67 do 85 do
68 case "$ARG" in 86 case "$ARG" in
69 "--prefix="*) PREFIX=${ARG#--prefix=} ;; 87 "--prefix="*) prefix=${ARG#--prefix=} ;;
70 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; 88 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;;
71 "--bindir="*) BINDIR=${ARG#----bindir=} ;; 89 "--bindir="*) bindir=${ARG#----bindir=} ;;
72 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; 90 "--sbindir="*) sbindir=${ARG#--sbindir=} ;;
73 "--libdir="*) LIBDIR=${ARG#--libdir=} ;; 91 "--libdir="*) libdir=${ARG#--libdir=} ;;
74 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; 92 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;;
75 "--datadir="*) DATADIR=${ARG#--datadir=} ;; 93 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;;
76 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; 94 "--datadir="*) datadir=${ARG#--datadir=} ;;
77 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; 95 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;;
78 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; 96 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;;
79 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; 97 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;;
80 "--infodir="*) INFODIR=${ARG#--infodir=} ;; 98 "--includedir="*) includedir=${ARG#--includedir=} ;;
81 "--mandir"*) MANDIR=${ARG#--mandir} ;; 99 "--infodir="*) infodir=${ARG#--infodir=} ;;
82 "--help"*) printhelp; exit 1 ;; 100 "--mandir"*) mandir=${ARG#--mandir} ;;
83 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; 101 "--localedir"*) localedir=${ARG#--localedir} ;;
84 "-"*) echo "unknown option: $ARG"; exit 1 ;; 102 "--help"*) printhelp; abort_configure ;;
85 esac 103 "--debug") BUILD_TYPE="debug" ;;
104 "--release") BUILD_TYPE="release" ;;
105 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;;
106 "-"*) echo "unknown option: $ARG"; abort_configure ;;
107 esac
86 done 108 done
87 109
88 # set dir variables 110
89 if [ -z "$BINDIR" ]; then 111
90 BINDIR=$EPREFIX/bin 112 # set defaults for dir variables
91 fi 113 : ${exec_prefix:="$prefix"}
92 if [ -z "$SBINDIR" ]; then 114 : ${bindir:='${exec_prefix}/bin'}
93 SBINDIR=$EPREFIX/sbin 115 : ${sbindir:='${exec_prefix}/sbin'}
94 fi 116 : ${libdir:='${exec_prefix}/lib'}
95 if [ -z "$LIBDIR" ]; then 117 : ${libexecdir:='${exec_prefix}/libexec'}
96 LIBDIR=$EPREFIX/lib 118 : ${datarootdir:='${prefix}/share'}
97 fi 119 : ${datadir:='${datarootdir}'}
98 if [ -z "$LIBEXEC" ]; then 120 : ${sysconfdir:='${prefix}/etc'}
99 LIBEXECDIR=$EPREFIX/libexec 121 : ${sharedstatedir:='${prefix}/com'}
100 fi 122 : ${localstatedir:='${prefix}/var'}
101 if [ -z "$DATADIR" ]; then 123 : ${runstatedir:='${localstatedir}/run'}
102 DATADIR=$PREFIX/share 124 : ${includedir:='${prefix}/include'}
103 fi 125 : ${infodir:='${datarootdir}/info'}
104 if [ -z "$SYSCONFDIR" ]; then 126 : ${mandir:='${datarootdir}/man'}
105 SYSCONFDIR=$PREFIX/etc 127 : ${localedir:='${datarootdir}/locale'}
106 fi 128
107 if [ -z "$SHAREDSTATEDIR" ]; then 129 # check if a config.site exists and load it
108 SHAREDSTATEDIR=$PREFIX/com 130 if [ -n "$CONFIG_SITE" ]; then
109 fi 131 # CONFIG_SITE may contain space separated file names
110 if [ -z "$LOCALSTATEDIR" ]; then 132 for cs in $CONFIG_SITE; do
111 LOCALSTATEDIR=$PREFIX/var 133 printf "loading defaults from $cs... "
112 fi 134 . "$cs"
113 if [ -z "$INCLUDEDIR" ]; then 135 echo ok
114 INCLUDEDIR=$PREFIX/include 136 done
115 fi 137 elif [ -f "$prefix/share/config.site" ]; then
116 if [ -z "$INFODIR" ]; then 138 printf "loading site defaults... "
117 INFODIR=$PREFIX/info 139 . "$prefix/share/config.site"
118 fi 140 echo ok
119 if [ -z "$MANDIR" ]; then 141 elif [ -f "$prefix/etc/config.site" ]; then
120 MANDIR=$PREFIX/man 142 printf "loading site defaults... "
121 fi 143 . "$prefix/etc/config.site"
122 144 echo ok
123 which pkg-config > /dev/null 145 fi
124 if [ $? -eq 0 ]; then 146
125 PKG_CONFIG=pkg-config 147 # Test for availability of pkg-config
126 else 148 PKG_CONFIG=`command -v pkg-config`
127 PKG_CONFIG=false 149 : ${PKG_CONFIG:="false"}
128 fi
129 150
130 # Simple uname based platform detection 151 # Simple uname based platform detection
131 # $PLATFORM is used for platform dependent dependency selection 152 # $PLATFORM is used for platform dependent dependency selection
153 OS=`uname -s`
154 OS_VERSION=`uname -r`
132 printf "detect platform... " 155 printf "detect platform... "
133 if [ $OS = SunOS ]; then 156 if [ "$OS" = "SunOS" ]; then
134 PLATFORM="solaris sunos unix svr4" 157 PLATFORM="solaris sunos unix svr4"
135 fi 158 elif [ "$OS" = "Linux" ]; then
136 if [ $OS = Linux ]; then
137 PLATFORM="linux unix" 159 PLATFORM="linux unix"
138 fi 160 elif [ "$OS" = "FreeBSD" ]; then
139 if [ $OS = FreeBSD ]; then
140 PLATFORM="freebsd bsd unix" 161 PLATFORM="freebsd bsd unix"
141 fi 162 elif [ "$OS" = "OpenBSD" ]; then
142 if [ $OS = Darwin ]; then 163 PLATFORM="openbsd bsd unix"
164 elif [ "$OS" = "NetBSD" ]; then
165 PLATFORM="netbsd bsd unix"
166 elif [ "$OS" = "Darwin" ]; then
143 PLATFORM="macos osx bsd unix" 167 PLATFORM="macos osx bsd unix"
144 fi 168 elif echo "$OS" | grep -i "MINGW" > /dev/null; then
145 echo $OS | grep "MINGW" > /dev/null
146 if [ $? -eq 0 ]; then
147 PLATFORM="windows mingw" 169 PLATFORM="windows mingw"
148 fi 170 fi
149 171 : ${PLATFORM:="unix"}
150 if [ -z "$PLATFORM" ]; then 172
151 PLATFORM="unix" 173 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
152 fi 174 echo "$PLATFORM_NAME"
153
154 for p in $PLATFORM
155 do
156 PLATFORM_NAME=$p
157 break
158 done
159 echo $PLATFORM_NAME
160 175
161 isplatform() 176 isplatform()
162 { 177 {
163 for p in $PLATFORM 178 for p in $PLATFORM
164 do 179 do
165 if [ $p = $1 ]; then 180 if [ "$p" = "$1" ]; then
166 return 0 181 return 0
167 fi 182 fi
168 done 183 done
169 return 1 184 return 1
170 } 185 }
171 isnotplatform() 186 notisplatform()
172 { 187 {
173 for p in $PLATFORM 188 for p in $PLATFORM
174 do 189 do
175 if [ $p = $1 ]; then 190 if [ "$p" = "$1" ]; then
176 return 1 191 return 1
177 fi 192 fi
178 done 193 done
179 return 0 194 return 0
180 } 195 }
181 196 istoolchain()
182 # generate config.mk and config.h 197 {
183 cat > $TEMP_DIR/config.mk << __EOF__ 198 for t in $TOOLCHAIN
184 # 199 do
185 # config.mk generated by configure 200 if [ "$t" = "$1" ]; then
186 # 201 return 0
187 202 fi
188 # general vars 203 done
189 204 return 1
190 PREFIX=$PREFIX 205 }
191 EPREFIX=$EPREFIX 206 notistoolchain()
192 207 {
193 BINDIR=$BINDIR 208 for t in $TOOLCHAIN
194 SBINDIR=$SBINDIR 209 do
195 LIBDIR=$LIBDIR 210 if [ "$t" = "$1" ]; then
196 LIBEXECDIR=$LIBEXECDIR 211 return 1
197 DATADIR=$DATADIR 212 fi
198 SYSCONFDIR=$SYSCONFDIR 213 done
199 SHAREDSTATEDIR=$SHAREDSTATEDIR 214 return 0
200 LOCALSTATEDIR=$LOCALSTATEDIR 215 }
201 INCLUDEDIR=$INCLUDEDIR 216
202 INFODIR=$INFODIR 217
203 MANDIR=$MANDIR 218 # generate vars.mk
204 219 cat > "$TEMP_DIR/vars.mk" << __EOF__
205 __EOF__ 220 prefix=$prefix
206 221 exec_prefix=$exec_prefix
207 echo > $TEMP_DIR/make.mk 222 bindir=$bindir
208 223 sbindir=$sbindir
209 ENV_CFLAGS=$CFLAGS 224 libdir=$libdir
210 ENV_LDFLAGS=$LDFLAGS 225 libexecdir=$libexecdir
211 ENV_CXXFLAGS=$CXXFLAGS 226 datarootdir=$datarootdir
212 227 datadir=$datadir
213 # Toolchain detection 228 sysconfdir=$sysconfdir
214 # this will insert make vars to config.mk 229 sharedstatedir=$sharedstatedir
230 localstatedir=$localstatedir
231 runstatedir=$runstatedir
232 includedir=$includedir
233 infodir=$infodir
234 mandir=$mandir
235 localedir=$localedir
236 __EOF__
237
238 # toolchain detection utilities
215 . make/toolchain.sh 239 . make/toolchain.sh
216 240
217 # add user specified flags to config.mk
218 echo >> $TEMP_DIR/config.mk
219 if [ ! -z "${ENV_CFLAGS}" ]; then
220 echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
221 fi
222 if [ ! -z "${ENV_CXXFLAGS}" ]; then
223 echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
224 fi
225 if [ ! -z "${ENV_LDFLAGS}" ]; then
226 echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
227 fi
228
229 # 241 #
230 # DEPENDENCIES 242 # DEPENDENCIES
231 # 243 #
232 244
233 dependency_qt4() 245 # check languages
234 { 246 lang_c=
235 printf "checking for qt4... " 247 lang_cpp=
236 # dependency qt4 248 if detect_c_compiler ; then
237 while true 249 lang_c=1
238 do 250 fi
239 qmake-qt4 -o - /dev/null | grep DEFINES\ > /dev/null 251
240 if [ $? -eq 0 ]; then 252 # create buffer for make variables required by dependencies
241 CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep DEFINES\ `" 253 echo > "$TEMP_DIR/make.mk"
242 else 254
243 break 255 test_pkg_config()
244 fi 256 {
245 qmake-qt4 -o - /dev/null | grep INCPATH\ > /dev/null 257 if "$PKG_CONFIG" --exists "$1" ; then :
246 if [ $? -eq 0 ]; then 258 else return 1 ; fi
247 CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep INCPATH\ `" 259 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
248 else 260 else return 1 ; fi
249 break 261 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
250 fi 262 else return 1 ; fi
251 > /dev/null 263 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
252 if [ $? -eq 0 ]; then 264 else return 1 ; fi
253 LDFLAGS="$LDFLAGS ``" 265 return 0
254 else 266 }
255 break 267
256 fi 268 print_check_msg()
257 which qmake-qt4 > /dev/null 269 {
258 if [ $? -ne 0 ]; then 270 if [ -z "$1" ]; then
259 break 271 shift
260 fi 272 printf "$@"
261 echo yes 273 fi
262 return 0 274 }
263 done 275
264 276 dependency_error_gtk2legacy()
265 echo no 277 {
266 return 1 278 print_check_msg "$dep_checked_gtk2legacy" "checking for gtk2legacy... "
267 } 279 # dependency gtk2legacy
268 dependency_gtk2legacy()
269 {
270 printf "checking for gtk2legacy... "
271 # dependency gtk2legacy
272 while true 280 while true
273 do 281 do
274 if [ -z "$PKG_CONFIG" ]; then 282 if [ -z "$PKG_CONFIG" ]; then
275 break 283 break
276 fi 284 fi
277 $PKG_CONFIG gtk+-2.0 285 if test_pkg_config "gtk+-2.0" "" "" "" ; then
278 if [ $? -ne 0 ] ; then 286 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`"
279 break 287 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`"
280 fi 288 else
281 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`" 289 break
282 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`" 290 fi
283 CFLAGS="$CFLAGS -DUI_GTK2 -DUI_GTK2LEGACY" 291 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK2 -DUI_GTK2LEGACY"
284 LDFLAGS="$LDFLAGS -lpthread" 292 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
285 echo yes 293 print_check_msg "$dep_checked_gtk2legacy" "yes\n"
286 return 0 294 dep_checked_gtk2legacy=1
287 done 295 return 1
288 296 done
289 echo no 297
290 return 1 298 print_check_msg "$dep_checked_gtk2legacy" "no\n"
291 } 299 dep_checked_gtk2legacy=1
292 dependency_qt5() 300 return 0
293 { 301 }
294 printf "checking for qt5... " 302 dependency_error_gtk2()
295 # dependency qt5 303 {
296 while true 304 print_check_msg "$dep_checked_gtk2" "checking for gtk2... "
297 do 305 # dependency gtk2
298 qmake-qt5 -o - /dev/null | grep DEFINES\ > /dev/null
299 if [ $? -eq 0 ]; then
300 CFLAGS="$CFLAGS `qmake-qt5 -o - /dev/null | grep DEFINES\ `"
301 else
302 break
303 fi
304 qmake-qt5 -o - /dev/null | grep INCPATH\ > /dev/null
305 if [ $? -eq 0 ]; then
306 CFLAGS="$CFLAGS `qmake-qt5 -o - /dev/null | grep INCPATH\ `"
307 else
308 break
309 fi
310 > /dev/null
311 if [ $? -eq 0 ]; then
312 LDFLAGS="$LDFLAGS ``"
313 else
314 break
315 fi
316 which qmake-qt5 > /dev/null
317 if [ $? -ne 0 ]; then
318 break
319 fi
320 echo yes
321 return 0
322 done
323
324 echo no
325 return 1
326 }
327 dependency_gtk2()
328 {
329 printf "checking for gtk2... "
330 # dependency gtk2
331 while true 306 while true
332 do 307 do
333 if [ -z "$PKG_CONFIG" ]; then 308 if [ -z "$PKG_CONFIG" ]; then
334 break 309 break
335 fi 310 fi
336 $PKG_CONFIG gtk+-2.0 311 if pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null ; then
337 if [ $? -ne 0 ] ; then 312 :
338 break 313 else
339 fi 314 break
340 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`" 315 fi
341 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`" 316 if test_pkg_config "gtk+-2.0" "" "" "" ; then
342 CFLAGS="$CFLAGS -DUI_GTK2" 317 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`"
343 LDFLAGS="$LDFLAGS -lpthread" 318 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`"
344 pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null 319 else
345 if [ $? -ne 0 ]; then 320 break
346 break 321 fi
347 fi 322 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK2"
348 echo yes 323 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
349 return 0 324 print_check_msg "$dep_checked_gtk2" "yes\n"
350 done 325 dep_checked_gtk2=1
351 326 return 1
352 echo no 327 done
353 return 1 328
354 } 329 print_check_msg "$dep_checked_gtk2" "no\n"
355 dependency_gtk3() 330 dep_checked_gtk2=1
356 { 331 return 0
357 printf "checking for gtk3... " 332 }
358 # dependency gtk3 333 dependency_error_gtk3()
334 {
335 print_check_msg "$dep_checked_gtk3" "checking for gtk3... "
336 # dependency gtk3
359 while true 337 while true
360 do 338 do
361 if [ -z "$PKG_CONFIG" ]; then 339 if [ -z "$PKG_CONFIG" ]; then
362 break 340 break
363 fi 341 fi
364 $PKG_CONFIG gtk+-3.0 342 if test_pkg_config "gtk+-3.0" "" "" "" ; then
365 if [ $? -ne 0 ] ; then 343 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-3.0`"
366 break 344 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-3.0`"
367 fi 345 else
368 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-3.0`" 346 break
369 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-3.0`" 347 fi
370 CFLAGS="$CFLAGS -DUI_GTK3" 348 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK3"
371 LDFLAGS="$LDFLAGS -lpthread" 349 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
372 echo yes 350 print_check_msg "$dep_checked_gtk3" "yes\n"
373 return 0 351 dep_checked_gtk3=1
374 done 352 return 1
375 353 done
376 echo no 354
377 return 1 355 print_check_msg "$dep_checked_gtk3" "no\n"
378 } 356 dep_checked_gtk3=1
379 dependency_gtk4() 357 return 0
380 { 358 }
381 printf "checking for gtk4... " 359 dependency_error_gtk4()
382 # dependency gtk4 360 {
361 print_check_msg "$dep_checked_gtk4" "checking for gtk4... "
362 # dependency gtk4
383 while true 363 while true
384 do 364 do
385 if [ -z "$PKG_CONFIG" ]; then 365 if [ -z "$PKG_CONFIG" ]; then
386 break 366 break
387 fi 367 fi
388 $PKG_CONFIG gtk+-4.0 368 if test_pkg_config "gtk+-4.0" "" "" "" ; then
389 if [ $? -ne 0 ] ; then 369 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-4.0`"
390 break 370 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-4.0`"
391 fi 371 else
392 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-4.0`" 372 break
393 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-4.0`" 373 fi
394 CFLAGS="$CFLAGS -DUI_GTK3" 374 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK3"
395 LDFLAGS="$LDFLAGS -lpthread" 375 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
396 echo yes 376 print_check_msg "$dep_checked_gtk4" "yes\n"
397 return 0 377 dep_checked_gtk4=1
398 done 378 return 1
399 379 done
400 echo no 380
401 return 1 381 print_check_msg "$dep_checked_gtk4" "no\n"
402 } 382 dep_checked_gtk4=1
403 dependency_motif() 383 return 0
404 { 384 }
405 printf "checking for motif... " 385 dependency_error_motif()
386 {
387 print_check_msg "$dep_checked_motif" "checking for motif... "
406 # dependency motif platform="bsd" 388 # dependency motif platform="bsd"
407 while true 389 while true
408 do 390 do
409 if isnotplatform "bsd"; then 391 if notisplatform "bsd"; then
410 break 392 break
411 fi 393 fi
412 CFLAGS="$CFLAGS -DUI_MOTIF -I/usr/local/include/X11" 394 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF -I/usr/local/include/X11"
413 LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread" 395 TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread"
414 echo yes 396 print_check_msg "$dep_checked_motif" "yes\n"
415 return 0 397 dep_checked_motif=1
416 done 398 return 1
417 399 done
418 # dependency motif 400
419 while true 401 # dependency motif
420 do 402 while true
421 CFLAGS="$CFLAGS -DUI_MOTIF" 403 do
422 LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread" 404 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF"
423 echo yes 405 TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread"
424 return 0 406 print_check_msg "$dep_checked_motif" "yes\n"
425 done 407 dep_checked_motif=1
426 408 return 1
427 echo no 409 done
428 return 1 410
429 } 411 print_check_msg "$dep_checked_motif" "no\n"
430 dependency_winui() 412 dep_checked_motif=1
431 { 413 return 0
432 printf "checking for winui... " 414 }
415 dependency_error_cocoa()
416 {
417 print_check_msg "$dep_checked_cocoa" "checking for cocoa... "
418 # dependency cocoa platform="macos"
419 while true
420 do
421 if notisplatform "macos"; then
422 break
423 fi
424 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_COCOA"
425 TEMP_LDFLAGS="$TEMP_LDFLAGS -lobjc -framework Cocoa"
426 print_check_msg "$dep_checked_cocoa" "yes\n"
427 dep_checked_cocoa=1
428 return 1
429 done
430
431 print_check_msg "$dep_checked_cocoa" "no\n"
432 dep_checked_cocoa=1
433 return 0
434 }
435 dependency_error_winui()
436 {
437 print_check_msg "$dep_checked_winui" "checking for winui... "
433 # dependency winui platform="windows" 438 # dependency winui platform="windows"
434 while true 439 while true
435 do 440 do
436 if isnotplatform "windows"; then 441 if notisplatform "windows"; then
437 break 442 break
438 fi 443 fi
439 CFLAGS="$CFLAGS -DUI_WINUI" 444 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_WINUI"
440 echo yes 445 print_check_msg "$dep_checked_winui" "yes\n"
441 return 0 446 dep_checked_winui=1
442 done 447 return 1
443 448 done
444 echo no 449
445 return 1 450 print_check_msg "$dep_checked_winui" "no\n"
446 } 451 dep_checked_winui=1
447 dependency_cocoa() 452 return 0
448 { 453 }
449 printf "checking for cocoa... " 454
450 # dependency cocoa platform="macos" 455 # start collecting dependency information
451 while true 456 echo > "$TEMP_DIR/flags.mk"
452 do
453 if isnotplatform "macos"; then
454 break
455 fi
456 CFLAGS="$CFLAGS -DUI_COCOA"
457 LDFLAGS="$LDFLAGS -lobjc -framework Cocoa"
458 echo yes
459 return 0
460 done
461
462 echo no
463 return 1
464 }
465 457
466 DEPENDENCIES_FAILED= 458 DEPENDENCIES_FAILED=
467 ERROR=0 459 ERROR=0
468 # general dependencies 460 # unnamed dependencies
469 CFLAGS= 461 TEMP_CFLAGS=
470 LDFLAGS= 462 TEMP_CXXFLAGS=
463 TEMP_LDFLAGS=
471 while true 464 while true
472 do 465 do
473 if isnotplatform "macos"; then 466 while true
467 do
468 if [ -z "$lang_c" ] ; then
469 ERROR=1
470 break
471 fi
472
474 break 473 break
475 fi 474 done
476 while true
477 do
478
479 cat >> $TEMP_DIR/make.mk << __EOF__
480 OBJ_EXT = .o
481 LIB_EXT = .a
482 PACKAGE_SCRIPT = package_osx.sh
483
484 __EOF__
485
486 break
487 done
488
489 break 475 break
490 done 476 done
491 while true 477 while true
492 do 478 do
493 if isnotplatform "unix"; then 479 if notisplatform "macos"; then
494 break 480 break
495 fi 481 fi
496 if isplatform "macos"; then 482 while true
497 break 483 do
498 fi 484
499 while true 485 cat >> "$TEMP_DIR/make.mk" << __EOF__
500 do
501
502 cat >> $TEMP_DIR/make.mk << __EOF__
503 OBJ_EXT = .o 486 OBJ_EXT = .o
504 LIB_EXT = .a 487 LIB_EXT = .a
505 PACKAGE_SCRIPT = package_unix.sh 488 PACKAGE_SCRIPT = package_osx.sh
506 489 __EOF__
507 __EOF__
508
509 break 490 break
510 done 491 done
511
512 break 492 break
513 done 493 done
514 while true 494 while true
515 do 495 do
516 if isnotplatform "bsd"; then 496 if notisplatform "unix"; then
517 break 497 break
518 fi 498 fi
519 while true 499 if isplatform "macos" || istoolchain "macos"; then
520 do
521
522 CFLAGS="$CFLAGS -I/usr/local/include"
523 LDFLAGS="$LDFLAGS -L/usr/local/lib"
524
525 break 500 break
526 done 501 fi
527 502 while true
503 do
504
505 cat >> "$TEMP_DIR/make.mk" << __EOF__
506 OBJ_EXT = .o
507 LIB_EXT = .a
508 PACKAGE_SCRIPT = package_unix.sh
509 __EOF__
510 break
511 done
528 break 512 break
529 done 513 done
530 514 while true
531 # add general dependency flags to config.mk 515 do
532 echo >> $TEMP_DIR/config.mk 516 if notisplatform "bsd"; then
533 if [ ! -z "${CFLAGS}" ]; then 517 break
534 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk 518 fi
535 fi 519 while true
536 if [ ! -z "${CXXFLAGS}" ]; then 520 do
537 echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk 521
538 fi 522 TEMP_CFLAGS="$TEMP_CFLAGS -I/usr/local/include"
539 if [ ! -z "${LDFLAGS}" ]; then 523 TEMP_LDFLAGS="$TEMP_LDFLAGS -L/usr/local/lib"
540 echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk 524 break
525 done
526 break
527 done
528
529 # add general dependency flags to flags.mk
530 echo "# general flags" >> "$TEMP_DIR/flags.mk"
531 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
532 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
533 fi
534 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
535 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
536 fi
537 if [ -n "${TEMP_LDFLAGS}" ]; then
538 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
541 fi 539 fi
542 540
543 # 541 #
544 # OPTION VALUES 542 # OPTION VALUES
545 # 543 #
546 checkopt_toolkit_gtk4() 544 checkopt_toolkit_gtk4()
547 { 545 {
548 VERR=0 546 VERR=0
549 dependency_gtk4 547 if dependency_error_gtk4 ; then
550 if [ $? -ne 0 ]; then 548 VERR=1
551 VERR=1 549 fi
552 fi 550 if [ $VERR -ne 0 ]; then
553 if [ $VERR -ne 0 ]; then 551 return 1
554 return 1 552 fi
555 fi 553 cat >> "$TEMP_DIR/make.mk" << __EOF__
556 cat >> $TEMP_DIR/make.mk << __EOF__
557 TOOLKIT = gtk 554 TOOLKIT = gtk
558 GTKOBJ = draw_cairo.o 555 GTKOBJ = draw_cairo.o
559 556 __EOF__
560 __EOF__ 557 return 0
561 return 0
562 } 558 }
563 checkopt_toolkit_gtk3() 559 checkopt_toolkit_gtk3()
564 { 560 {
565 VERR=0 561 VERR=0
566 dependency_gtk3 562 if dependency_error_gtk3 ; then
567 if [ $? -ne 0 ]; then 563 VERR=1
568 VERR=1 564 fi
569 fi 565 if [ $VERR -ne 0 ]; then
570 if [ $VERR -ne 0 ]; then 566 return 1
571 return 1 567 fi
572 fi 568 cat >> "$TEMP_DIR/make.mk" << __EOF__
573 cat >> $TEMP_DIR/make.mk << __EOF__
574 TOOLKIT = gtk 569 TOOLKIT = gtk
575 GTKOBJ = draw_cairo.o 570 GTKOBJ = draw_cairo.o
576 571 __EOF__
577 __EOF__ 572 return 0
578 return 0
579 } 573 }
580 checkopt_toolkit_gtk2() 574 checkopt_toolkit_gtk2()
581 { 575 {
582 VERR=0 576 VERR=0
583 dependency_gtk2 577 if dependency_error_gtk2 ; then
584 if [ $? -ne 0 ]; then 578 VERR=1
585 VERR=1 579 fi
586 fi 580 if [ $VERR -ne 0 ]; then
587 if [ $VERR -ne 0 ]; then 581 return 1
588 return 1 582 fi
589 fi 583 cat >> "$TEMP_DIR/make.mk" << __EOF__
590 cat >> $TEMP_DIR/make.mk << __EOF__
591 TOOLKIT = gtk 584 TOOLKIT = gtk
592 GTKOBJ = draw_cairo.o 585 GTKOBJ = draw_cairo.o
593 586 __EOF__
594 __EOF__ 587 return 0
595 return 0
596 } 588 }
597 checkopt_toolkit_gtk2legacy() 589 checkopt_toolkit_gtk2legacy()
598 { 590 {
599 VERR=0 591 VERR=0
600 dependency_gtk2legacy 592 if dependency_error_gtk2legacy ; then
601 if [ $? -ne 0 ]; then 593 VERR=1
602 VERR=1 594 fi
603 fi 595 if [ $VERR -ne 0 ]; then
604 if [ $VERR -ne 0 ]; then 596 return 1
605 return 1 597 fi
606 fi 598 cat >> "$TEMP_DIR/make.mk" << __EOF__
607 cat >> $TEMP_DIR/make.mk << __EOF__
608 TOOLKIT = gtk 599 TOOLKIT = gtk
609 GTKOBJ = draw_gdk.o 600 GTKOBJ = draw_gdk.o
610 601 __EOF__
611 __EOF__ 602 return 0
612 return 0
613 } 603 }
614 checkopt_toolkit_qt5() 604 checkopt_toolkit_qt5()
615 { 605 {
616 VERR=0 606 VERR=0
617 dependency_qt5 607 if dependency_error_qt5 ; then
618 if [ $? -ne 0 ]; then 608 VERR=1
619 VERR=1 609 fi
620 fi 610 if [ $VERR -ne 0 ]; then
621 if [ $VERR -ne 0 ]; then 611 return 1
622 return 1 612 fi
623 fi 613 cat >> "$TEMP_DIR/make.mk" << __EOF__
624 cat >> $TEMP_DIR/make.mk << __EOF__
625 TOOLKIT = qt 614 TOOLKIT = qt
626 LD = $(CXX) 615 LD = $(CXX)
627 616 __EOF__
628 __EOF__ 617 return 0
629 return 0
630 } 618 }
631 checkopt_toolkit_qt4() 619 checkopt_toolkit_qt4()
632 { 620 {
633 VERR=0 621 VERR=0
634 dependency_qt4 622 if dependency_error_qt4 ; then
635 if [ $? -ne 0 ]; then 623 VERR=1
636 VERR=1 624 fi
637 fi 625 if [ $VERR -ne 0 ]; then
638 if [ $VERR -ne 0 ]; then 626 return 1
639 return 1 627 fi
640 fi 628 cat >> "$TEMP_DIR/make.mk" << __EOF__
641 cat >> $TEMP_DIR/make.mk << __EOF__
642 TOOLKIT = qt 629 TOOLKIT = qt
643 LD = $(CXX) 630 LD = $(CXX)
644 631 __EOF__
645 __EOF__ 632 return 0
646 return 0
647 } 633 }
648 checkopt_toolkit_motif() 634 checkopt_toolkit_motif()
649 { 635 {
650 VERR=0 636 VERR=0
651 dependency_motif 637 if dependency_error_motif ; then
652 if [ $? -ne 0 ]; then 638 VERR=1
653 VERR=1 639 fi
654 fi 640 if [ $VERR -ne 0 ]; then
655 if [ $VERR -ne 0 ]; then 641 return 1
656 return 1 642 fi
657 fi 643 cat >> "$TEMP_DIR/make.mk" << __EOF__
658 cat >> $TEMP_DIR/make.mk << __EOF__
659 TOOLKIT = motif 644 TOOLKIT = motif
660 645 __EOF__
661 __EOF__ 646 return 0
662 return 0
663 } 647 }
664 648
665 # 649 #
666 # TARGETS 650 # TARGETS
667 # 651 #
668 CFLAGS= 652
669 CXXFLAGS= 653 echo >> "$TEMP_DIR/flags.mk"
670 LDFLAGS= 654 echo "configuring target: tk"
671 655 echo "# flags for target tk" >> "$TEMP_DIR/flags.mk"
672 # Target: tk 656 TEMP_CFLAGS=
673 CFLAGS= 657 TEMP_CXXFLAGS=
674 LDFLAGS= 658 TEMP_LDFLAGS=
675 CXXFLAGS=
676 659
677 660
678 # Features 661 # Features
679 662
680 # Option: --toolkit 663 # Option: --toolkit
681 if [ -z $OPT_TOOLKIT ]; then 664 if [ -z "$OPT_TOOLKIT" ]; then
682 SAVED_ERROR=$ERROR 665 echo "auto-detecting option 'toolkit'"
683 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED 666 SAVED_ERROR="$ERROR"
684 ERROR=0 667 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
685 while true 668 ERROR=1
686 do 669 while true
687 if isplatform "windows"; then 670 do
688 checkopt_toolkit_winui 671 if isplatform "windows"; then
689 if [ $? -eq 0 ]; then 672 if checkopt_toolkit_winui ; then
690 echo " toolkit: winui" >> $TEMP_DIR/options 673 echo " toolkit: winui" >> "$TEMP_DIR/options"
691 ERROR=0 674 ERROR=0
692 break 675 break
693 fi 676 fi
694 fi 677 fi
695 if isplatform "macos"; then 678 if isplatform "macos"; then
696 checkopt_toolkit_cocoa 679 if checkopt_toolkit_cocoa ; then
697 if [ $? -eq 0 ]; then 680 echo " toolkit: cocoa" >> "$TEMP_DIR/options"
698 echo " toolkit: cocoa" >> $TEMP_DIR/options 681 ERROR=0
699 ERROR=0 682 break
700 break 683 fi
701 fi 684 fi
702 fi 685 if checkopt_toolkit_gtk3 ; then
703 checkopt_toolkit_gtk3 686 echo " toolkit: gtk3" >> "$TEMP_DIR/options"
704 if [ $? -eq 0 ]; then 687 ERROR=0
705 echo " toolkit: gtk3" >> $TEMP_DIR/options 688 break
706 ERROR=0 689 fi
707 break 690 if checkopt_toolkit_qt5 ; then
708 fi 691 echo " toolkit: qt5" >> "$TEMP_DIR/options"
709 checkopt_toolkit_qt5 692 ERROR=0
710 if [ $? -eq 0 ]; then 693 break
711 echo " toolkit: qt5" >> $TEMP_DIR/options 694 fi
712 ERROR=0 695 if checkopt_toolkit_gtk2 ; then
713 break 696 echo " toolkit: gtk2" >> "$TEMP_DIR/options"
714 fi 697 ERROR=0
715 checkopt_toolkit_gtk2 698 break
716 if [ $? -eq 0 ]; then 699 fi
717 echo " toolkit: gtk2" >> $TEMP_DIR/options 700 if checkopt_toolkit_qt4 ; then
718 ERROR=0 701 echo " toolkit: qt4" >> "$TEMP_DIR/options"
719 break 702 ERROR=0
720 fi 703 break
721 checkopt_toolkit_qt4 704 fi
722 if [ $? -eq 0 ]; then 705 if checkopt_toolkit_motif ; then
723 echo " toolkit: qt4" >> $TEMP_DIR/options 706 echo " toolkit: motif" >> "$TEMP_DIR/options"
724 ERROR=0 707 ERROR=0
725 break 708 break
726 fi 709 fi
727 checkopt_toolkit_motif 710 break
728 if [ $? -eq 0 ]; then 711 done
729 echo " toolkit: motif" >> $TEMP_DIR/options 712 if [ $ERROR -ne 0 ]; then
730 ERROR=0 713 SAVED_ERROR=1
731 break 714 SAVED_DEPENDENCIES_FAILED="option 'toolkit' $SAVED_DEPENDENCIES_FAILED"
732 fi 715 fi
733 break 716 ERROR="$SAVED_ERROR"
734 done 717 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
735 if [ $ERROR -ne 0 ]; then
736 SAVED_ERROR=1
737 fi
738 ERROR=$SAVED_ERROR
739 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED=
740 else 718 else
741 if false; then 719 echo "checking option toolkit = $OPT_TOOLKIT"
742 false 720 if false; then
743 elif [ $OPT_TOOLKIT = "gtk4" ]; then 721 false
744 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 722 elif [ "$OPT_TOOLKIT" = "gtk4" ]; then
745 checkopt_toolkit_gtk4 723 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
746 if [ $? -ne 0 ]; then 724 if checkopt_toolkit_gtk4 ; then
747 ERROR=1 725 :
748 fi 726 else
749 elif [ $OPT_TOOLKIT = "gtk3" ]; then 727 ERROR=1
750 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 728 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
751 checkopt_toolkit_gtk3 729 fi
752 if [ $? -ne 0 ]; then 730 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
753 ERROR=1 731 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
754 fi 732 if checkopt_toolkit_gtk3 ; then
755 elif [ $OPT_TOOLKIT = "gtk2" ]; then 733 :
756 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 734 else
757 checkopt_toolkit_gtk2 735 ERROR=1
758 if [ $? -ne 0 ]; then 736 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
759 ERROR=1 737 fi
760 fi 738 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then
761 elif [ $OPT_TOOLKIT = "gtk2legacy" ]; then 739 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
762 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 740 if checkopt_toolkit_gtk2 ; then
763 checkopt_toolkit_gtk2legacy 741 :
764 if [ $? -ne 0 ]; then 742 else
765 ERROR=1 743 ERROR=1
766 fi 744 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
767 elif [ $OPT_TOOLKIT = "qt5" ]; then 745 fi
768 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 746 elif [ "$OPT_TOOLKIT" = "gtk2legacy" ]; then
769 checkopt_toolkit_qt5 747 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
770 if [ $? -ne 0 ]; then 748 if checkopt_toolkit_gtk2legacy ; then
771 ERROR=1 749 :
772 fi 750 else
773 elif [ $OPT_TOOLKIT = "qt4" ]; then 751 ERROR=1
774 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 752 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
775 checkopt_toolkit_qt4 753 fi
776 if [ $? -ne 0 ]; then 754 elif [ "$OPT_TOOLKIT" = "qt5" ]; then
777 ERROR=1 755 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
778 fi 756 if checkopt_toolkit_qt5 ; then
779 elif [ $OPT_TOOLKIT = "motif" ]; then 757 :
780 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 758 else
781 checkopt_toolkit_motif 759 ERROR=1
782 if [ $? -ne 0 ]; then 760 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
783 ERROR=1 761 fi
784 fi 762 elif [ "$OPT_TOOLKIT" = "qt4" ]; then
785 fi 763 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
786 fi 764 if checkopt_toolkit_qt4 ; then
787 765 :
788 echo >> $TEMP_DIR/config.mk 766 else
789 if [ ! -z "${CFLAGS}" ]; then 767 ERROR=1
790 echo "TK_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk 768 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
791 fi 769 fi
792 if [ ! -z "${CXXFLAGS}" ]; then 770 elif [ "$OPT_TOOLKIT" = "motif" ]; then
793 echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk 771 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
794 fi 772 if checkopt_toolkit_motif ; then
795 if [ ! -z "${LDFLAGS}" ]; then 773 :
796 echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk 774 else
797 fi 775 ERROR=1
798 776 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
777 fi
778 fi
779 fi
780
781 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
782 echo "TK_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
783 fi
784 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
785 echo "TK_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
786 fi
787 if [ "$BUILD_TYPE" = "debug" ]; then
788 if [ -n "$lang_c" ]; then
789 echo 'TK_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
790 fi
791 if [ -n "$lang_cpp" ]; then
792 echo 'TK_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
793 fi
794 fi
795 if [ "$BUILD_TYPE" = "release" ]; then
796 if [ -n "$lang_c" ]; then
797 echo 'TK_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
798 fi
799 if [ -n "$lang_cpp" ]; then
800 echo 'TK_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
801 fi
802 fi
803 if [ -n "${TEMP_LDFLAGS}" ]; then
804 echo "TK_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
805 fi
806
807
808 # final result
799 if [ $ERROR -ne 0 ]; then 809 if [ $ERROR -ne 0 ]; then
800 echo 810 echo
801 echo "Error: Unresolved dependencies" 811 echo "Error: Unresolved dependencies"
802 echo $DEPENDENCIES_FAILED 812 echo "$DEPENDENCIES_FAILED"
803 rm -Rf $TEMP_DIR 813 abort_configure
804 exit 1
805 fi 814 fi
806 815
807 echo "configure finished" 816 echo "configure finished"
808 echo 817 echo
809 echo "Build Config:" 818 echo "Build Config:"
810 echo " PREFIX: $PREFIX" 819 echo " PREFIX: $prefix"
811 echo " TOOLCHAIN: $TOOLCHAIN_NAME" 820 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
812 echo "Options:" 821 echo "Options:"
813 cat $TEMP_DIR/options 822 cat "$TEMP_DIR/options"
814 echo 823 echo
815 cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk 824
816 rm -Rf $TEMP_DIR 825 # generate the config.mk file
817 826 cat > "$TEMP_DIR/config.mk" << __EOF__
818 827 #
828 # config.mk generated by configure
829 #
830
831 __EOF__
832 write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
833 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
834 rm -Rf "$TEMP_DIR"

mercurial