configure

changeset 431
bb7da585debc
parent 404
384f6d1f5784
equal deleted inserted replaced
169:fe49cff3c571 431:bb7da585debc
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:
58 --toolkit=(gtk3|gtk2|gtk2legacy|qt5|qt4|motif) 73 --debug add extra compile flags for debug builds
74 --release add extra compile flags for release builds
75 --toolkit=(libadwaita|gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|cocoa|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
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 240
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_motif() 357 return 0
380 { 358 }
381 printf "checking for motif... " 359 dependency_error_gtk4()
382 # dependency motif 360 {
383 while true 361 print_check_msg "$dep_checked_gtk4" "checking for gtk4... "
384 do 362 # dependency gtk4
385 CFLAGS="$CFLAGS -DUI_MOTIF" 363 while true
386 LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread" 364 do
387 echo yes 365 if [ -z "$PKG_CONFIG" ]; then
388 return 0 366 break
389 done 367 fi
390 368 if test_pkg_config "gtk4" "" "" "" ; then
391 echo no 369 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk4`"
392 return 1 370 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk4`"
393 } 371 else
394 dependency_wpf() 372 break
395 { 373 fi
396 printf "checking for wpf... " 374 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK4"
397 # dependency wpf platform="windows" 375 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
398 while true 376 print_check_msg "$dep_checked_gtk4" "yes\n"
399 do 377 dep_checked_gtk4=1
400 if isnotplatform "windows"; then 378 return 1
401 break 379 done
402 fi 380
403 CFLAGS="$CFLAGS -DUI_WPF" 381 print_check_msg "$dep_checked_gtk4" "no\n"
404 echo yes 382 dep_checked_gtk4=1
405 return 0 383 return 0
406 done 384 }
407 385 dependency_error_libadwaita()
408 echo no 386 {
409 return 1 387 print_check_msg "$dep_checked_libadwaita" "checking for libadwaita... "
410 } 388 # dependency libadwaita
411 dependency_cocoa() 389 while true
412 { 390 do
413 printf "checking for cocoa... " 391 if [ -z "$PKG_CONFIG" ]; then
392 break
393 fi
394 if test_pkg_config "libadwaita-1" "" "" "" ; then
395 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libadwaita-1`"
396 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libadwaita-1`"
397 else
398 break
399 fi
400 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK4 -DUI_LIBADWAITA"
401 TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread"
402 print_check_msg "$dep_checked_libadwaita" "yes\n"
403 dep_checked_libadwaita=1
404 return 1
405 done
406
407 print_check_msg "$dep_checked_libadwaita" "no\n"
408 dep_checked_libadwaita=1
409 return 0
410 }
411 dependency_error_motif()
412 {
413 print_check_msg "$dep_checked_motif" "checking for motif... "
414 # dependency motif platform="bsd"
415 while true
416 do
417 if notisplatform "bsd"; then
418 break
419 fi
420 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF -I/usr/local/include/X11"
421 TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread"
422 print_check_msg "$dep_checked_motif" "yes\n"
423 dep_checked_motif=1
424 return 1
425 done
426
427 # dependency motif
428 while true
429 do
430 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF"
431 TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread"
432 print_check_msg "$dep_checked_motif" "yes\n"
433 dep_checked_motif=1
434 return 1
435 done
436
437 print_check_msg "$dep_checked_motif" "no\n"
438 dep_checked_motif=1
439 return 0
440 }
441 dependency_error_cocoa()
442 {
443 print_check_msg "$dep_checked_cocoa" "checking for cocoa... "
414 # dependency cocoa platform="macos" 444 # dependency cocoa platform="macos"
415 while true 445 while true
416 do 446 do
417 if isnotplatform "macos"; then 447 if notisplatform "macos"; then
418 break 448 break
419 fi 449 fi
420 CFLAGS="$CFLAGS -DUI_COCOA" 450 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_COCOA"
421 LDFLAGS="$LDFLAGS -lobjc -framework Cocoa" 451 TEMP_LDFLAGS="$TEMP_LDFLAGS -lobjc -framework Cocoa"
422 echo yes 452 print_check_msg "$dep_checked_cocoa" "yes\n"
423 return 0 453 dep_checked_cocoa=1
424 done 454 return 1
425 455 done
426 echo no 456
427 return 1 457 print_check_msg "$dep_checked_cocoa" "no\n"
428 } 458 dep_checked_cocoa=1
459 return 0
460 }
461 dependency_error_winui()
462 {
463 print_check_msg "$dep_checked_winui" "checking for winui... "
464 # dependency winui platform="windows"
465 while true
466 do
467 if notisplatform "windows"; then
468 break
469 fi
470 TEMP_CFLAGS="$TEMP_CFLAGS -DUI_WINUI"
471 print_check_msg "$dep_checked_winui" "yes\n"
472 dep_checked_winui=1
473 return 1
474 done
475
476 print_check_msg "$dep_checked_winui" "no\n"
477 dep_checked_winui=1
478 return 0
479 }
480
481 # start collecting dependency information
482 echo > "$TEMP_DIR/flags.mk"
429 483
430 DEPENDENCIES_FAILED= 484 DEPENDENCIES_FAILED=
431 ERROR=0 485 ERROR=0
432 # general dependencies 486 # unnamed dependencies
433 CFLAGS= 487 TEMP_CFLAGS=
434 LDFLAGS= 488 TEMP_CXXFLAGS=
489 TEMP_LDFLAGS=
435 while true 490 while true
436 do 491 do
437 if isnotplatform "macos"; then 492 while true
493 do
494 if [ -z "$lang_c" ] ; then
495 ERROR=1
496 break
497 fi
498
438 break 499 break
439 fi 500 done
440 while true
441 do
442
443 cat >> $TEMP_DIR/make.mk << __EOF__
444 OBJ_EXT = o
445 LIB_EXT = a
446 PACKAGE_SCRIPT = package_osx.sh
447
448 __EOF__
449
450 break
451 done
452
453 break 501 break
454 done 502 done
455 while true 503 while true
456 do 504 do
457 if isnotplatform "unix"; then 505 if notisplatform "macos"; then
458 break 506 break
459 fi 507 fi
460 if isplatform "macos"; then 508 while true
509 do
510
511 cat >> "$TEMP_DIR/make.mk" << __EOF__
512 OBJ_EXT = .o
513 LIB_EXT = .a
514 PACKAGE_SCRIPT = package_osx.sh
515 __EOF__
461 break 516 break
462 fi 517 done
463 while true
464 do
465
466 cat >> $TEMP_DIR/make.mk << __EOF__
467 OBJ_EXT = o
468 LIB_EXT = a
469 PACKAGE_SCRIPT = package_unix.sh
470
471 __EOF__
472
473 break
474 done
475
476 break 518 break
477 done 519 done
478 520 while true
479 # add general dependency flags to config.mk 521 do
480 echo >> $TEMP_DIR/config.mk 522 if notisplatform "unix"; then
481 if [ ! -z "${CFLAGS}" ]; then 523 break
482 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk 524 fi
483 fi 525 if isplatform "macos" || istoolchain "macos"; then
484 if [ ! -z "${CXXFLAGS}" ]; then 526 break
485 echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk 527 fi
486 fi 528 while true
487 if [ ! -z "${LDFLAGS}" ]; then 529 do
488 echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk 530
531 cat >> "$TEMP_DIR/make.mk" << __EOF__
532 OBJ_EXT = .o
533 LIB_EXT = .a
534 PACKAGE_SCRIPT = package_unix.sh
535 __EOF__
536 break
537 done
538 break
539 done
540 while true
541 do
542 if notisplatform "bsd"; then
543 break
544 fi
545 while true
546 do
547
548 TEMP_CFLAGS="$TEMP_CFLAGS -I/usr/local/include"
549 TEMP_LDFLAGS="$TEMP_LDFLAGS -L/usr/local/lib"
550 break
551 done
552 break
553 done
554
555 # add general dependency flags to flags.mk
556 echo "# general flags" >> "$TEMP_DIR/flags.mk"
557 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
558 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
559 fi
560 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
561 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
562 fi
563 if [ -n "${TEMP_LDFLAGS}" ]; then
564 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
489 fi 565 fi
490 566
491 # 567 #
492 # OPTION VALUES 568 # OPTION VALUES
493 # 569 #
494 checkopt_toolkit_gtk3() 570 checkopt_toolkit_libadwaita()
495 { 571 {
496 VERR=0 572 VERR=0
497 dependency_gtk3 573 if dependency_error_libadwaita ; then
498 if [ $? -ne 0 ]; then 574 VERR=1
499 VERR=1 575 fi
500 fi 576 if [ $VERR -ne 0 ]; then
501 if [ $VERR -ne 0 ]; then 577 return 1
502 return 1 578 fi
503 fi 579 cat >> "$TEMP_DIR/make.mk" << __EOF__
504 cat >> $TEMP_DIR/make.mk << __EOF__
505 TOOLKIT = gtk 580 TOOLKIT = gtk
506 GTKOBJ = draw_cairo.o 581 GTKOBJ = draw_cairo.o
507 582 __EOF__
508 __EOF__ 583 return 0
509 return 0 584 }
510 } 585 checkopt_toolkit_gtk4()
511 checkopt_toolkit_gtk2() 586 {
512 { 587 VERR=0
513 VERR=0 588 if dependency_error_gtk4 ; then
514 dependency_gtk2 589 VERR=1
515 if [ $? -ne 0 ]; then 590 fi
516 VERR=1 591 if [ $VERR -ne 0 ]; then
517 fi 592 return 1
518 if [ $VERR -ne 0 ]; then 593 fi
519 return 1 594 cat >> "$TEMP_DIR/make.mk" << __EOF__
520 fi
521 cat >> $TEMP_DIR/make.mk << __EOF__
522 TOOLKIT = gtk 595 TOOLKIT = gtk
523 GTKOBJ = draw_cairo.o 596 GTKOBJ = draw_cairo.o
524 597 __EOF__
525 __EOF__ 598 return 0
526 return 0 599 }
600 checkopt_toolkit_gtk3()
601 {
602 VERR=0
603 if dependency_error_gtk3 ; then
604 VERR=1
605 fi
606 if [ $VERR -ne 0 ]; then
607 return 1
608 fi
609 cat >> "$TEMP_DIR/make.mk" << __EOF__
610 TOOLKIT = gtk
611 GTKOBJ = draw_cairo.o
612 __EOF__
613 return 0
614 }
615 checkopt_toolkit_gtk2()
616 {
617 VERR=0
618 if dependency_error_gtk2 ; then
619 VERR=1
620 fi
621 if [ $VERR -ne 0 ]; then
622 return 1
623 fi
624 cat >> "$TEMP_DIR/make.mk" << __EOF__
625 TOOLKIT = gtk
626 GTKOBJ = draw_cairo.o
627 __EOF__
628 return 0
527 } 629 }
528 checkopt_toolkit_gtk2legacy() 630 checkopt_toolkit_gtk2legacy()
529 { 631 {
530 VERR=0 632 VERR=0
531 dependency_gtk2legacy 633 if dependency_error_gtk2legacy ; then
532 if [ $? -ne 0 ]; then 634 VERR=1
533 VERR=1 635 fi
534 fi 636 if [ $VERR -ne 0 ]; then
535 if [ $VERR -ne 0 ]; then 637 return 1
536 return 1 638 fi
537 fi 639 cat >> "$TEMP_DIR/make.mk" << __EOF__
538 cat >> $TEMP_DIR/make.mk << __EOF__
539 TOOLKIT = gtk 640 TOOLKIT = gtk
540 GTKOBJ = draw_gdk.o 641 GTKOBJ = draw_gdk.o
541 642 __EOF__
542 __EOF__ 643 return 0
543 return 0
544 } 644 }
545 checkopt_toolkit_qt5() 645 checkopt_toolkit_qt5()
546 { 646 {
547 VERR=0 647 VERR=0
548 dependency_qt5 648 if dependency_error_qt5 ; then
549 if [ $? -ne 0 ]; then 649 VERR=1
550 VERR=1 650 fi
551 fi 651 if [ $VERR -ne 0 ]; then
552 if [ $VERR -ne 0 ]; then 652 return 1
553 return 1 653 fi
554 fi 654 cat >> "$TEMP_DIR/make.mk" << __EOF__
555 cat >> $TEMP_DIR/make.mk << __EOF__
556 TOOLKIT = qt 655 TOOLKIT = qt
557 LD = $(CXX) 656 LD = $(CXX)
558 657 __EOF__
559 __EOF__ 658 return 0
560 return 0
561 } 659 }
562 checkopt_toolkit_qt4() 660 checkopt_toolkit_qt4()
563 { 661 {
564 VERR=0 662 VERR=0
565 dependency_qt4 663 if dependency_error_qt4 ; then
566 if [ $? -ne 0 ]; then 664 VERR=1
567 VERR=1 665 fi
568 fi 666 if [ $VERR -ne 0 ]; then
569 if [ $VERR -ne 0 ]; then 667 return 1
570 return 1 668 fi
571 fi 669 cat >> "$TEMP_DIR/make.mk" << __EOF__
572 cat >> $TEMP_DIR/make.mk << __EOF__
573 TOOLKIT = qt 670 TOOLKIT = qt
574 LD = $(CXX) 671 LD = $(CXX)
575 672 __EOF__
576 __EOF__ 673 return 0
577 return 0 674 }
675 checkopt_toolkit_cocoa()
676 {
677 VERR=0
678 if dependency_error_cocoa ; then
679 VERR=1
680 fi
681 if [ $VERR -ne 0 ]; then
682 return 1
683 fi
684 cat >> "$TEMP_DIR/make.mk" << __EOF__
685 TOOLKIT = cocoa
686 __EOF__
687 return 0
578 } 688 }
579 checkopt_toolkit_motif() 689 checkopt_toolkit_motif()
580 { 690 {
581 VERR=0 691 VERR=0
582 dependency_motif 692 if dependency_error_motif ; then
583 if [ $? -ne 0 ]; then 693 VERR=1
584 VERR=1 694 fi
585 fi 695 if [ $VERR -ne 0 ]; then
586 if [ $VERR -ne 0 ]; then 696 return 1
587 return 1 697 fi
588 fi 698 cat >> "$TEMP_DIR/make.mk" << __EOF__
589 cat >> $TEMP_DIR/make.mk << __EOF__
590 TOOLKIT = motif 699 TOOLKIT = motif
591 700 __EOF__
592 __EOF__ 701 return 0
593 return 0
594 } 702 }
595 703
596 # 704 #
597 # TARGETS 705 # TARGETS
598 # 706 #
599 CFLAGS= 707
600 CXXFLAGS= 708 echo >> "$TEMP_DIR/flags.mk"
601 LDFLAGS= 709 echo "configuring target: tk"
602 710 echo "# flags for target tk" >> "$TEMP_DIR/flags.mk"
603 # Target: tk 711 TEMP_CFLAGS=
604 CFLAGS= 712 TEMP_CXXFLAGS=
605 LDFLAGS= 713 TEMP_LDFLAGS=
606 CXXFLAGS=
607 714
608 715
609 # Features 716 # Features
610 717
611 # Option: --toolkit 718 # Option: --toolkit
612 if [ -z $OPT_TOOLKIT ]; then 719 if [ -z "$OPT_TOOLKIT" ]; then
613 SAVED_ERROR=$ERROR 720 echo "auto-detecting option 'toolkit'"
614 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED 721 SAVED_ERROR="$ERROR"
615 ERROR=0 722 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
616 while true 723 ERROR=1
617 do 724 while true
618 if isplatform "windows"; then 725 do
619 checkopt_toolkit_wpf 726 if isplatform "windows"; then
620 if [ $? -eq 0 ]; then 727 if checkopt_toolkit_winui ; then
621 echo " toolkit: wpf" >> $TEMP_DIR/options 728 echo " toolkit: winui" >> "$TEMP_DIR/options"
622 ERROR=0 729 ERROR=0
623 break 730 break
624 fi 731 fi
625 fi 732 fi
626 if isplatform "macos"; then 733 if isplatform "macos"; then
627 checkopt_toolkit_cocoa 734 if checkopt_toolkit_cocoa ; then
628 if [ $? -eq 0 ]; then 735 echo " toolkit: cocoa" >> "$TEMP_DIR/options"
629 echo " toolkit: cocoa" >> $TEMP_DIR/options 736 ERROR=0
630 ERROR=0 737 break
631 break 738 fi
632 fi 739 fi
633 fi 740 if checkopt_toolkit_gtk4 ; then
634 checkopt_toolkit_gtk3 741 echo " toolkit: gtk4" >> "$TEMP_DIR/options"
635 if [ $? -eq 0 ]; then 742 ERROR=0
636 echo " toolkit: gtk3" >> $TEMP_DIR/options 743 break
637 ERROR=0 744 fi
638 break 745 if checkopt_toolkit_gtk3 ; then
639 fi 746 echo " toolkit: gtk3" >> "$TEMP_DIR/options"
640 checkopt_toolkit_qt5 747 ERROR=0
641 if [ $? -eq 0 ]; then 748 break
642 echo " toolkit: qt5" >> $TEMP_DIR/options 749 fi
643 ERROR=0 750 if checkopt_toolkit_gtk2 ; then
644 break 751 echo " toolkit: gtk2" >> "$TEMP_DIR/options"
645 fi 752 ERROR=0
646 checkopt_toolkit_gtk2 753 break
647 if [ $? -eq 0 ]; then 754 fi
648 echo " toolkit: gtk2" >> $TEMP_DIR/options 755 if checkopt_toolkit_qt4 ; then
649 ERROR=0 756 echo " toolkit: qt4" >> "$TEMP_DIR/options"
650 break 757 ERROR=0
651 fi 758 break
652 checkopt_toolkit_qt4 759 fi
653 if [ $? -eq 0 ]; then 760 if checkopt_toolkit_motif ; then
654 echo " toolkit: qt4" >> $TEMP_DIR/options 761 echo " toolkit: motif" >> "$TEMP_DIR/options"
655 ERROR=0 762 ERROR=0
656 break 763 break
657 fi 764 fi
658 checkopt_toolkit_motif 765 break
659 if [ $? -eq 0 ]; then 766 done
660 echo " toolkit: motif" >> $TEMP_DIR/options 767 if [ $ERROR -ne 0 ]; then
661 ERROR=0 768 SAVED_ERROR=1
662 break 769 SAVED_DEPENDENCIES_FAILED="option 'toolkit' $SAVED_DEPENDENCIES_FAILED"
663 fi 770 fi
664 break 771 ERROR="$SAVED_ERROR"
665 done 772 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
666 if [ $ERROR -ne 0 ]; then
667 SAVED_ERROR=1
668 fi
669 ERROR=$SAVED_ERROR
670 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED=
671 else 773 else
672 if false; then 774 echo "checking option toolkit = $OPT_TOOLKIT"
673 false 775 if false; then
674 elif [ $OPT_TOOLKIT = "gtk3" ]; then 776 false
675 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 777 elif [ "$OPT_TOOLKIT" = "libadwaita" ]; then
676 checkopt_toolkit_gtk3 778 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
677 if [ $? -ne 0 ]; then 779 if checkopt_toolkit_libadwaita ; then
678 ERROR=1 780 :
679 fi 781 else
680 elif [ $OPT_TOOLKIT = "gtk2" ]; then 782 ERROR=1
681 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 783 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
682 checkopt_toolkit_gtk2 784 fi
683 if [ $? -ne 0 ]; then 785 elif [ "$OPT_TOOLKIT" = "gtk4" ]; then
684 ERROR=1 786 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
685 fi 787 if checkopt_toolkit_gtk4 ; then
686 elif [ $OPT_TOOLKIT = "gtk2legacy" ]; then 788 :
687 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 789 else
688 checkopt_toolkit_gtk2legacy 790 ERROR=1
689 if [ $? -ne 0 ]; then 791 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
690 ERROR=1 792 fi
691 fi 793 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
692 elif [ $OPT_TOOLKIT = "qt5" ]; then 794 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
693 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 795 if checkopt_toolkit_gtk3 ; then
694 checkopt_toolkit_qt5 796 :
695 if [ $? -ne 0 ]; then 797 else
696 ERROR=1 798 ERROR=1
697 fi 799 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
698 elif [ $OPT_TOOLKIT = "qt4" ]; then 800 fi
699 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 801 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then
700 checkopt_toolkit_qt4 802 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
701 if [ $? -ne 0 ]; then 803 if checkopt_toolkit_gtk2 ; then
702 ERROR=1 804 :
703 fi 805 else
704 elif [ $OPT_TOOLKIT = "motif" ]; then 806 ERROR=1
705 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 807 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
706 checkopt_toolkit_motif 808 fi
707 if [ $? -ne 0 ]; then 809 elif [ "$OPT_TOOLKIT" = "gtk2legacy" ]; then
708 ERROR=1 810 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
709 fi 811 if checkopt_toolkit_gtk2legacy ; then
710 fi 812 :
711 fi 813 else
712 814 ERROR=1
713 echo >> $TEMP_DIR/config.mk 815 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
714 if [ ! -z "${CFLAGS}" ]; then 816 fi
715 echo "TK_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk 817 elif [ "$OPT_TOOLKIT" = "qt5" ]; then
716 fi 818 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
717 if [ ! -z "${CXXFLAGS}" ]; then 819 if checkopt_toolkit_qt5 ; then
718 echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk 820 :
719 fi 821 else
720 if [ ! -z "${LDFLAGS}" ]; then 822 ERROR=1
721 echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk 823 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
722 fi 824 fi
723 825 elif [ "$OPT_TOOLKIT" = "qt4" ]; then
826 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
827 if checkopt_toolkit_qt4 ; then
828 :
829 else
830 ERROR=1
831 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
832 fi
833 elif [ "$OPT_TOOLKIT" = "cocoa" ]; then
834 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
835 if checkopt_toolkit_cocoa ; then
836 :
837 else
838 ERROR=1
839 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
840 fi
841 elif [ "$OPT_TOOLKIT" = "motif" ]; then
842 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
843 if checkopt_toolkit_motif ; then
844 :
845 else
846 ERROR=1
847 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
848 fi
849 fi
850 fi
851
852 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
853 echo "TK_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
854 fi
855 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
856 echo "TK_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
857 fi
858 if [ "$BUILD_TYPE" = "debug" ]; then
859 if [ -n "$lang_c" ]; then
860 echo 'TK_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
861 fi
862 if [ -n "$lang_cpp" ]; then
863 echo 'TK_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
864 fi
865 fi
866 if [ "$BUILD_TYPE" = "release" ]; then
867 if [ -n "$lang_c" ]; then
868 echo 'TK_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
869 fi
870 if [ -n "$lang_cpp" ]; then
871 echo 'TK_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
872 fi
873 fi
874 if [ -n "${TEMP_LDFLAGS}" ]; then
875 echo "TK_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
876 fi
877
878
879 # final result
724 if [ $ERROR -ne 0 ]; then 880 if [ $ERROR -ne 0 ]; then
725 echo 881 echo
726 echo "Error: Unresolved dependencies" 882 echo "Error: Unresolved dependencies"
727 echo $DEPENDENCIES_FAILED 883 echo "$DEPENDENCIES_FAILED"
728 rm -Rf $TEMP_DIR 884 abort_configure
729 exit 1
730 fi 885 fi
731 886
732 echo "configure finished" 887 echo "configure finished"
733 echo 888 echo
734 echo "Build Config:" 889 echo "Build Config:"
735 echo " PREFIX: $PREFIX" 890 echo " PREFIX: $prefix"
736 echo " TOOLCHAIN: $TOOLCHAIN_NAME" 891 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
737 echo "Options:" 892 echo "Options:"
738 cat $TEMP_DIR/options 893 cat "$TEMP_DIR/options"
739 echo 894 echo
740 cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk 895
741 rm -Rf $TEMP_DIR 896 # generate the config.mk file
742 897 cat > "$TEMP_DIR/config.mk" << __EOF__
743 898 #
899 # config.mk generated by configure
900 #
901
902 __EOF__
903 write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
904 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
905 rm -Rf "$TEMP_DIR"

mercurial