|
1 #!/bin/sh |
|
2 |
|
3 |
|
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`" |
|
23 mkdir -p $TEMP_DIR |
|
24 if [ $? -ne 0 ]; then |
|
25 echo "Cannot create tmp dir" |
|
26 echo "Abort" |
|
27 fi |
|
28 touch $TEMP_DIR/options |
|
29 touch $TEMP_DIR/features |
|
30 |
|
31 # features |
|
32 |
|
33 # help text |
|
34 printhelp() |
|
35 { |
|
36 echo "Usage: $0 [OPTIONS]..." |
|
37 cat << __EOF__ |
|
38 Installation directories: |
|
39 --prefix=PREFIX path prefix for architecture-independent files |
|
40 [/usr] |
|
41 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
42 [PREFIX] |
|
43 |
|
44 --bindir=DIR user executables [EPREFIX/bin] |
|
45 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
46 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
47 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
48 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
49 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
50 --libdir=DIR object code libraries [EPREFIX/lib] |
|
51 --includedir=DIR C header files [PREFIX/include] |
|
52 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
53 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
54 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
55 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
56 |
|
57 Options: |
|
58 --toolkit=(gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif) |
|
59 |
|
60 __EOF__ |
|
61 } |
|
62 |
|
63 # |
|
64 # parse arguments |
|
65 # |
|
66 for ARG in $@ |
|
67 do |
|
68 case "$ARG" in |
|
69 "--prefix="*) PREFIX=${ARG#--prefix=} ;; |
|
70 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; |
|
71 "--bindir="*) BINDIR=${ARG#----bindir=} ;; |
|
72 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; |
|
73 "--libdir="*) LIBDIR=${ARG#--libdir=} ;; |
|
74 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; |
|
75 "--datadir="*) DATADIR=${ARG#--datadir=} ;; |
|
76 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; |
|
77 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; |
|
78 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; |
|
79 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; |
|
80 "--infodir="*) INFODIR=${ARG#--infodir=} ;; |
|
81 "--mandir"*) MANDIR=${ARG#--mandir} ;; |
|
82 "--help"*) printhelp; exit 1 ;; |
|
83 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; |
|
84 "-"*) echo "unknown option: $ARG"; exit 1 ;; |
|
85 esac |
|
86 done |
|
87 |
|
88 # set dir variables |
|
89 if [ -z "$BINDIR" ]; then |
|
90 BINDIR=$EPREFIX/bin |
|
91 fi |
|
92 if [ -z "$SBINDIR" ]; then |
|
93 SBINDIR=$EPREFIX/sbin |
|
94 fi |
|
95 if [ -z "$LIBDIR" ]; then |
|
96 LIBDIR=$EPREFIX/lib |
|
97 fi |
|
98 if [ -z "$LIBEXEC" ]; then |
|
99 LIBEXECDIR=$EPREFIX/libexec |
|
100 fi |
|
101 if [ -z "$DATADIR" ]; then |
|
102 DATADIR=$PREFIX/share |
|
103 fi |
|
104 if [ -z "$SYSCONFDIR" ]; then |
|
105 SYSCONFDIR=$PREFIX/etc |
|
106 fi |
|
107 if [ -z "$SHAREDSTATEDIR" ]; then |
|
108 SHAREDSTATEDIR=$PREFIX/com |
|
109 fi |
|
110 if [ -z "$LOCALSTATEDIR" ]; then |
|
111 LOCALSTATEDIR=$PREFIX/var |
|
112 fi |
|
113 if [ -z "$INCLUDEDIR" ]; then |
|
114 INCLUDEDIR=$PREFIX/include |
|
115 fi |
|
116 if [ -z "$INFODIR" ]; then |
|
117 INFODIR=$PREFIX/info |
|
118 fi |
|
119 if [ -z "$MANDIR" ]; then |
|
120 MANDIR=$PREFIX/man |
|
121 fi |
|
122 |
|
123 which pkg-config > /dev/null |
|
124 if [ $? -eq 0 ]; then |
|
125 PKG_CONFIG=pkg-config |
|
126 else |
|
127 PKG_CONFIG=false |
|
128 fi |
|
129 |
|
130 # Simple uname based platform detection |
|
131 # $PLATFORM is used for platform dependent dependency selection |
|
132 printf "detect platform... " |
|
133 if [ $OS = SunOS ]; then |
|
134 PLATFORM="solaris sunos unix svr4" |
|
135 fi |
|
136 if [ $OS = Linux ]; then |
|
137 PLATFORM="linux unix" |
|
138 fi |
|
139 if [ $OS = FreeBSD ]; then |
|
140 PLATFORM="freebsd bsd unix" |
|
141 fi |
|
142 if [ $OS = Darwin ]; then |
|
143 PLATFORM="macos osx bsd unix" |
|
144 fi |
|
145 echo $OS | grep "MINGW" > /dev/null |
|
146 if [ $? -eq 0 ]; then |
|
147 PLATFORM="windows mingw" |
|
148 fi |
|
149 |
|
150 if [ -z "$PLATFORM" ]; then |
|
151 PLATFORM="unix" |
|
152 fi |
|
153 |
|
154 for p in $PLATFORM |
|
155 do |
|
156 PLATFORM_NAME=$p |
|
157 break |
|
158 done |
|
159 echo $PLATFORM_NAME |
|
160 |
|
161 isplatform() |
|
162 { |
|
163 for p in $PLATFORM |
|
164 do |
|
165 if [ $p = $1 ]; then |
|
166 return 0 |
|
167 fi |
|
168 done |
|
169 return 1 |
|
170 } |
|
171 isnotplatform() |
|
172 { |
|
173 for p in $PLATFORM |
|
174 do |
|
175 if [ $p = $1 ]; then |
|
176 return 1 |
|
177 fi |
|
178 done |
|
179 return 0 |
|
180 } |
|
181 |
|
182 # generate config.mk and config.h |
|
183 cat > $TEMP_DIR/config.mk << __EOF__ |
|
184 # |
|
185 # config.mk generated by configure |
|
186 # |
|
187 |
|
188 # general vars |
|
189 |
|
190 PREFIX=$PREFIX |
|
191 EPREFIX=$EPREFIX |
|
192 |
|
193 BINDIR=$BINDIR |
|
194 SBINDIR=$SBINDIR |
|
195 LIBDIR=$LIBDIR |
|
196 LIBEXECDIR=$LIBEXECDIR |
|
197 DATADIR=$DATADIR |
|
198 SYSCONFDIR=$SYSCONFDIR |
|
199 SHAREDSTATEDIR=$SHAREDSTATEDIR |
|
200 LOCALSTATEDIR=$LOCALSTATEDIR |
|
201 INCLUDEDIR=$INCLUDEDIR |
|
202 INFODIR=$INFODIR |
|
203 MANDIR=$MANDIR |
|
204 |
|
205 __EOF__ |
|
206 |
|
207 echo > $TEMP_DIR/make.mk |
|
208 |
|
209 ENV_CFLAGS=$CFLAGS |
|
210 ENV_LDFLAGS=$LDFLAGS |
|
211 ENV_CXXFLAGS=$CXXFLAGS |
|
212 |
|
213 # Toolchain detection |
|
214 # this will insert make vars to config.mk |
|
215 . 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 |
|
229 # |
|
230 # DEPENDENCIES |
|
231 # |
|
232 |
|
233 dependency_qt4() |
|
234 { |
|
235 printf "checking for qt4... " |
|
236 # dependency qt4 |
|
237 while true |
|
238 do |
|
239 qmake-qt4 -o - /dev/null | grep DEFINES\ > /dev/null |
|
240 if [ $? -eq 0 ]; then |
|
241 CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep DEFINES\ `" |
|
242 else |
|
243 break |
|
244 fi |
|
245 qmake-qt4 -o - /dev/null | grep INCPATH\ > /dev/null |
|
246 if [ $? -eq 0 ]; then |
|
247 CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep INCPATH\ `" |
|
248 else |
|
249 break |
|
250 fi |
|
251 > /dev/null |
|
252 if [ $? -eq 0 ]; then |
|
253 LDFLAGS="$LDFLAGS ``" |
|
254 else |
|
255 break |
|
256 fi |
|
257 which qmake-qt4 > /dev/null |
|
258 if [ $? -ne 0 ]; then |
|
259 break |
|
260 fi |
|
261 echo yes |
|
262 return 0 |
|
263 done |
|
264 |
|
265 echo no |
|
266 return 1 |
|
267 } |
|
268 dependency_gtk2legacy() |
|
269 { |
|
270 printf "checking for gtk2legacy... " |
|
271 # dependency gtk2legacy |
|
272 while true |
|
273 do |
|
274 if [ -z "$PKG_CONFIG" ]; then |
|
275 break |
|
276 fi |
|
277 $PKG_CONFIG gtk+-2.0 |
|
278 if [ $? -ne 0 ] ; then |
|
279 break |
|
280 fi |
|
281 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`" |
|
282 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`" |
|
283 CFLAGS="$CFLAGS -DUI_GTK2 -DUI_GTK2LEGACY" |
|
284 LDFLAGS="$LDFLAGS -lpthread" |
|
285 echo yes |
|
286 return 0 |
|
287 done |
|
288 |
|
289 echo no |
|
290 return 1 |
|
291 } |
|
292 dependency_qt5() |
|
293 { |
|
294 printf "checking for qt5... " |
|
295 # dependency qt5 |
|
296 while true |
|
297 do |
|
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 |
|
332 do |
|
333 if [ -z "$PKG_CONFIG" ]; then |
|
334 break |
|
335 fi |
|
336 $PKG_CONFIG gtk+-2.0 |
|
337 if [ $? -ne 0 ] ; then |
|
338 break |
|
339 fi |
|
340 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`" |
|
341 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`" |
|
342 CFLAGS="$CFLAGS -DUI_GTK2" |
|
343 LDFLAGS="$LDFLAGS -lpthread" |
|
344 pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null |
|
345 if [ $? -ne 0 ]; then |
|
346 break |
|
347 fi |
|
348 echo yes |
|
349 return 0 |
|
350 done |
|
351 |
|
352 echo no |
|
353 return 1 |
|
354 } |
|
355 dependency_gtk3() |
|
356 { |
|
357 printf "checking for gtk3... " |
|
358 # dependency gtk3 |
|
359 while true |
|
360 do |
|
361 if [ -z "$PKG_CONFIG" ]; then |
|
362 break |
|
363 fi |
|
364 $PKG_CONFIG gtk+-3.0 |
|
365 if [ $? -ne 0 ] ; then |
|
366 break |
|
367 fi |
|
368 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-3.0`" |
|
369 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-3.0`" |
|
370 CFLAGS="$CFLAGS -DUI_GTK3" |
|
371 LDFLAGS="$LDFLAGS -lpthread" |
|
372 echo yes |
|
373 return 0 |
|
374 done |
|
375 |
|
376 echo no |
|
377 return 1 |
|
378 } |
|
379 dependency_gtk4() |
|
380 { |
|
381 printf "checking for gtk4... " |
|
382 # dependency gtk4 |
|
383 while true |
|
384 do |
|
385 if [ -z "$PKG_CONFIG" ]; then |
|
386 break |
|
387 fi |
|
388 $PKG_CONFIG gtk+-4.0 |
|
389 if [ $? -ne 0 ] ; then |
|
390 break |
|
391 fi |
|
392 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-4.0`" |
|
393 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-4.0`" |
|
394 CFLAGS="$CFLAGS -DUI_GTK3" |
|
395 LDFLAGS="$LDFLAGS -lpthread" |
|
396 echo yes |
|
397 return 0 |
|
398 done |
|
399 |
|
400 echo no |
|
401 return 1 |
|
402 } |
|
403 dependency_motif() |
|
404 { |
|
405 printf "checking for motif... " |
|
406 # dependency motif platform="bsd" |
|
407 while true |
|
408 do |
|
409 if isnotplatform "bsd"; then |
|
410 break |
|
411 fi |
|
412 CFLAGS="$CFLAGS -DUI_MOTIF -I/usr/local/include/X11" |
|
413 LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread" |
|
414 echo yes |
|
415 return 0 |
|
416 done |
|
417 |
|
418 # dependency motif |
|
419 while true |
|
420 do |
|
421 CFLAGS="$CFLAGS -DUI_MOTIF" |
|
422 LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread" |
|
423 echo yes |
|
424 return 0 |
|
425 done |
|
426 |
|
427 echo no |
|
428 return 1 |
|
429 } |
|
430 dependency_winui() |
|
431 { |
|
432 printf "checking for winui... " |
|
433 # dependency winui platform="windows" |
|
434 while true |
|
435 do |
|
436 if isnotplatform "windows"; then |
|
437 break |
|
438 fi |
|
439 CFLAGS="$CFLAGS -DUI_WINUI" |
|
440 echo yes |
|
441 return 0 |
|
442 done |
|
443 |
|
444 echo no |
|
445 return 1 |
|
446 } |
|
447 dependency_cocoa() |
|
448 { |
|
449 printf "checking for cocoa... " |
|
450 # dependency cocoa platform="macos" |
|
451 while true |
|
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 |
|
466 DEPENDENCIES_FAILED= |
|
467 ERROR=0 |
|
468 # general dependencies |
|
469 CFLAGS= |
|
470 LDFLAGS= |
|
471 while true |
|
472 do |
|
473 if isnotplatform "macos"; then |
|
474 break |
|
475 fi |
|
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 |
|
490 done |
|
491 while true |
|
492 do |
|
493 if isnotplatform "unix"; then |
|
494 break |
|
495 fi |
|
496 if isplatform "macos"; then |
|
497 break |
|
498 fi |
|
499 while true |
|
500 do |
|
501 |
|
502 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
503 OBJ_EXT = .o |
|
504 LIB_EXT = .a |
|
505 PACKAGE_SCRIPT = package_unix.sh |
|
506 |
|
507 __EOF__ |
|
508 |
|
509 break |
|
510 done |
|
511 |
|
512 break |
|
513 done |
|
514 while true |
|
515 do |
|
516 if isnotplatform "bsd"; then |
|
517 break |
|
518 fi |
|
519 while true |
|
520 do |
|
521 |
|
522 CFLAGS="$CFLAGS -I/usr/local/include" |
|
523 LDFLAGS="$LDFLAGS -L/usr/local/lib" |
|
524 |
|
525 break |
|
526 done |
|
527 |
|
528 break |
|
529 done |
|
530 |
|
531 # add general dependency flags to config.mk |
|
532 echo >> $TEMP_DIR/config.mk |
|
533 if [ ! -z "${CFLAGS}" ]; then |
|
534 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk |
|
535 fi |
|
536 if [ ! -z "${CXXFLAGS}" ]; then |
|
537 echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk |
|
538 fi |
|
539 if [ ! -z "${LDFLAGS}" ]; then |
|
540 echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk |
|
541 fi |
|
542 |
|
543 # |
|
544 # OPTION VALUES |
|
545 # |
|
546 checkopt_toolkit_gtk4() |
|
547 { |
|
548 VERR=0 |
|
549 dependency_gtk4 |
|
550 if [ $? -ne 0 ]; then |
|
551 VERR=1 |
|
552 fi |
|
553 if [ $VERR -ne 0 ]; then |
|
554 return 1 |
|
555 fi |
|
556 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
557 TOOLKIT = gtk |
|
558 GTKOBJ = draw_cairo.o |
|
559 |
|
560 __EOF__ |
|
561 return 0 |
|
562 } |
|
563 checkopt_toolkit_gtk3() |
|
564 { |
|
565 VERR=0 |
|
566 dependency_gtk3 |
|
567 if [ $? -ne 0 ]; then |
|
568 VERR=1 |
|
569 fi |
|
570 if [ $VERR -ne 0 ]; then |
|
571 return 1 |
|
572 fi |
|
573 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
574 TOOLKIT = gtk |
|
575 GTKOBJ = draw_cairo.o |
|
576 |
|
577 __EOF__ |
|
578 return 0 |
|
579 } |
|
580 checkopt_toolkit_gtk2() |
|
581 { |
|
582 VERR=0 |
|
583 dependency_gtk2 |
|
584 if [ $? -ne 0 ]; then |
|
585 VERR=1 |
|
586 fi |
|
587 if [ $VERR -ne 0 ]; then |
|
588 return 1 |
|
589 fi |
|
590 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
591 TOOLKIT = gtk |
|
592 GTKOBJ = draw_cairo.o |
|
593 |
|
594 __EOF__ |
|
595 return 0 |
|
596 } |
|
597 checkopt_toolkit_gtk2legacy() |
|
598 { |
|
599 VERR=0 |
|
600 dependency_gtk2legacy |
|
601 if [ $? -ne 0 ]; then |
|
602 VERR=1 |
|
603 fi |
|
604 if [ $VERR -ne 0 ]; then |
|
605 return 1 |
|
606 fi |
|
607 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
608 TOOLKIT = gtk |
|
609 GTKOBJ = draw_gdk.o |
|
610 |
|
611 __EOF__ |
|
612 return 0 |
|
613 } |
|
614 checkopt_toolkit_qt5() |
|
615 { |
|
616 VERR=0 |
|
617 dependency_qt5 |
|
618 if [ $? -ne 0 ]; 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 = qt |
|
626 LD = $(CXX) |
|
627 |
|
628 __EOF__ |
|
629 return 0 |
|
630 } |
|
631 checkopt_toolkit_qt4() |
|
632 { |
|
633 VERR=0 |
|
634 dependency_qt4 |
|
635 if [ $? -ne 0 ]; then |
|
636 VERR=1 |
|
637 fi |
|
638 if [ $VERR -ne 0 ]; then |
|
639 return 1 |
|
640 fi |
|
641 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
642 TOOLKIT = qt |
|
643 LD = $(CXX) |
|
644 |
|
645 __EOF__ |
|
646 return 0 |
|
647 } |
|
648 checkopt_toolkit_motif() |
|
649 { |
|
650 VERR=0 |
|
651 dependency_motif |
|
652 if [ $? -ne 0 ]; then |
|
653 VERR=1 |
|
654 fi |
|
655 if [ $VERR -ne 0 ]; then |
|
656 return 1 |
|
657 fi |
|
658 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
659 TOOLKIT = motif |
|
660 |
|
661 __EOF__ |
|
662 return 0 |
|
663 } |
|
664 |
|
665 # |
|
666 # TARGETS |
|
667 # |
|
668 CFLAGS= |
|
669 CXXFLAGS= |
|
670 LDFLAGS= |
|
671 |
|
672 # Target: tk |
|
673 CFLAGS= |
|
674 LDFLAGS= |
|
675 CXXFLAGS= |
|
676 |
|
677 |
|
678 # Features |
|
679 |
|
680 # Option: --toolkit |
|
681 if [ -z $OPT_TOOLKIT ]; then |
|
682 SAVED_ERROR=$ERROR |
|
683 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED |
|
684 ERROR=0 |
|
685 while true |
|
686 do |
|
687 if isplatform "windows"; then |
|
688 checkopt_toolkit_winui |
|
689 if [ $? -eq 0 ]; then |
|
690 echo " toolkit: winui" >> $TEMP_DIR/options |
|
691 ERROR=0 |
|
692 break |
|
693 fi |
|
694 fi |
|
695 if isplatform "macos"; then |
|
696 checkopt_toolkit_cocoa |
|
697 if [ $? -eq 0 ]; then |
|
698 echo " toolkit: cocoa" >> $TEMP_DIR/options |
|
699 ERROR=0 |
|
700 break |
|
701 fi |
|
702 fi |
|
703 checkopt_toolkit_gtk3 |
|
704 if [ $? -eq 0 ]; then |
|
705 echo " toolkit: gtk3" >> $TEMP_DIR/options |
|
706 ERROR=0 |
|
707 break |
|
708 fi |
|
709 checkopt_toolkit_qt5 |
|
710 if [ $? -eq 0 ]; then |
|
711 echo " toolkit: qt5" >> $TEMP_DIR/options |
|
712 ERROR=0 |
|
713 break |
|
714 fi |
|
715 checkopt_toolkit_gtk2 |
|
716 if [ $? -eq 0 ]; then |
|
717 echo " toolkit: gtk2" >> $TEMP_DIR/options |
|
718 ERROR=0 |
|
719 break |
|
720 fi |
|
721 checkopt_toolkit_qt4 |
|
722 if [ $? -eq 0 ]; then |
|
723 echo " toolkit: qt4" >> $TEMP_DIR/options |
|
724 ERROR=0 |
|
725 break |
|
726 fi |
|
727 checkopt_toolkit_motif |
|
728 if [ $? -eq 0 ]; then |
|
729 echo " toolkit: motif" >> $TEMP_DIR/options |
|
730 ERROR=0 |
|
731 break |
|
732 fi |
|
733 break |
|
734 done |
|
735 if [ $ERROR -ne 0 ]; then |
|
736 SAVED_ERROR=1 |
|
737 fi |
|
738 ERROR=$SAVED_ERROR |
|
739 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= |
|
740 else |
|
741 if false; then |
|
742 false |
|
743 elif [ $OPT_TOOLKIT = "gtk4" ]; then |
|
744 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
745 checkopt_toolkit_gtk4 |
|
746 if [ $? -ne 0 ]; then |
|
747 ERROR=1 |
|
748 fi |
|
749 elif [ $OPT_TOOLKIT = "gtk3" ]; then |
|
750 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
751 checkopt_toolkit_gtk3 |
|
752 if [ $? -ne 0 ]; then |
|
753 ERROR=1 |
|
754 fi |
|
755 elif [ $OPT_TOOLKIT = "gtk2" ]; then |
|
756 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
757 checkopt_toolkit_gtk2 |
|
758 if [ $? -ne 0 ]; then |
|
759 ERROR=1 |
|
760 fi |
|
761 elif [ $OPT_TOOLKIT = "gtk2legacy" ]; then |
|
762 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
763 checkopt_toolkit_gtk2legacy |
|
764 if [ $? -ne 0 ]; then |
|
765 ERROR=1 |
|
766 fi |
|
767 elif [ $OPT_TOOLKIT = "qt5" ]; then |
|
768 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
769 checkopt_toolkit_qt5 |
|
770 if [ $? -ne 0 ]; then |
|
771 ERROR=1 |
|
772 fi |
|
773 elif [ $OPT_TOOLKIT = "qt4" ]; then |
|
774 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
775 checkopt_toolkit_qt4 |
|
776 if [ $? -ne 0 ]; then |
|
777 ERROR=1 |
|
778 fi |
|
779 elif [ $OPT_TOOLKIT = "motif" ]; then |
|
780 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
781 checkopt_toolkit_motif |
|
782 if [ $? -ne 0 ]; then |
|
783 ERROR=1 |
|
784 fi |
|
785 fi |
|
786 fi |
|
787 |
|
788 echo >> $TEMP_DIR/config.mk |
|
789 if [ ! -z "${CFLAGS}" ]; then |
|
790 echo "TK_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk |
|
791 fi |
|
792 if [ ! -z "${CXXFLAGS}" ]; then |
|
793 echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk |
|
794 fi |
|
795 if [ ! -z "${LDFLAGS}" ]; then |
|
796 echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk |
|
797 fi |
|
798 |
|
799 if [ $ERROR -ne 0 ]; then |
|
800 echo |
|
801 echo "Error: Unresolved dependencies" |
|
802 echo $DEPENDENCIES_FAILED |
|
803 rm -Rf $TEMP_DIR |
|
804 exit 1 |
|
805 fi |
|
806 |
|
807 echo "configure finished" |
|
808 echo |
|
809 echo "Build Config:" |
|
810 echo " PREFIX: $PREFIX" |
|
811 echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
|
812 echo "Options:" |
|
813 cat $TEMP_DIR/options |
|
814 echo |
|
815 cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk |
|
816 rm -Rf $TEMP_DIR |
|
817 |
|
818 |