make/configure.vm

Wed, 09 Dec 2020 11:33:00 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 09 Dec 2020 11:33:00 +0100
changeset 1
fcacc15a2ef2
parent 0
804d8803eade
permissions
-rw-r--r--

add .hgignore

0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 #foreach( $var in $vars )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #if( $var.exec )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 ${var.name}=`${var.value}`
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 ${var.name}=${var.value}
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 #if ( ! $project.hasVar("PREFIX") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 PREFIX=/usr
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 #if ( ! $project.hasVar("EPREFIX") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 EPREFIX=$PREFIX
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 #if ( ! $project.hasVar("BINDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 BINDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 #if ( ! $project.hasVar("SBINDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 SBINDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 #if ( ! $project.hasVar("LIBDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 LIBDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 #if ( ! $project.hasVar("LIBEXECDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 LIBEXECDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #if ( ! $project.hasVar("DATADIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 DATADIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #if ( ! $project.hasVar("SYSCONFDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 SYSCONFDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #if ( ! $project.hasVar("SHAREDSTATEDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 SHAREDSTATEDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #if ( ! $project.hasVar("LOCALSTATEDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 LOCALSTATEDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 #if ( ! $project.hasVar("INCLUDEDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 INCLUDEDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 #if ( ! $project.hasVar("INFODIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 INFODIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 #if ( ! $project.hasVar("MANDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 MANDIR=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 OS=`uname -s`
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 OS_VERSION=`uname -r`
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 TEMP_DIR=".tmp-`uname -n`"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 mkdir -p $TEMP_DIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 echo "Cannot create tmp dir"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 echo "Abort"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 touch $TEMP_DIR/options
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 touch $TEMP_DIR/features
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 # features
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 #foreach( $feature in $features )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 #if( ${feature.isDefault()} )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 ${feature.getVarName()}=on
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 # help text
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 printhelp()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 {
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 echo "Usage: $0 [OPTIONS]..."
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 cat << __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 Installation directories:
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 --prefix=PREFIX path prefix for architecture-independent files
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 [/usr]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 --exec-prefix=EPREFIX path prefix for architecture-dependent files
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 [PREFIX]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 --bindir=DIR user executables [EPREFIX/bin]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 --sbindir=DIR system admin executables [EPREFIX/sbin]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 --libexecdir=DIR program executables [EPREFIX/libexec]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 --sysconfdir=DIR system configuration files [PREFIX/etc]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 --libdir=DIR object code libraries [EPREFIX/lib]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 --includedir=DIR C header files [PREFIX/include]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 --infodir=DIR info documentation [DATAROOTDIR/info]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 --mandir=DIR man documentation [DATAROOTDIR/man]
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 #if( $options.size() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 Options:
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 #foreach( $opt in $options )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 --${opt.getArgument()}=${opt.getValuesString()}
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 #if( $features.size() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 Optional Features:
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 #foreach( $feature in $features )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 #if( $feature.default )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 --disable-${feature.arg}
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 #else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 --enable-${feature.arg}
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 }
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 # parse arguments
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 #set( $D = '$' )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 for ARG in $@
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 case "$ARG" in
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 "--prefix="*) PREFIX=${D}{ARG#--prefix=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 "--exec-prefix="*) EPREFIX=${D}{ARG#--exec-prefix=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 "--bindir="*) BINDIR=${D}{ARG#----bindir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 "--sbindir="*) SBINDIR=${D}{ARG#--sbindir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 "--libdir="*) LIBDIR=${D}{ARG#--libdir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 "--libexecdir="*) LIBEXECDIR=${D}{ARG#--libexecdir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 "--datadir="*) DATADIR=${D}{ARG#--datadir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 "--sysconfdir="*) SYSCONFDIR=${D}{ARG#--sysconfdir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 "--mandir"*) MANDIR=${D}{ARG#--mandir} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 "--help"*) printhelp; exit 1 ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 #foreach( $opt in $options )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 #foreach( $feature in $features )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 "--enable-${feature.arg}") ${feature.getVarName()}=on ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 "--disable-${feature.arg}") unset ${feature.getVarName()} ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 "-"*) echo "unknown option: $ARG"; exit 1 ;;
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 esac
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 # set dir variables
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 if [ -z "$BINDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 BINDIR=$EPREFIX/bin
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 if [ -z "$SBINDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 SBINDIR=$EPREFIX/sbin
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 if [ -z "$LIBDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156 LIBDIR=$EPREFIX/lib
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158 if [ -z "$LIBEXEC" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 LIBEXECDIR=$EPREFIX/libexec
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 if [ -z "$DATADIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 DATADIR=$PREFIX/share
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 if [ -z "$SYSCONFDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 SYSCONFDIR=$PREFIX/etc
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 if [ -z "$SHAREDSTATEDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 SHAREDSTATEDIR=$PREFIX/com
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 if [ -z "$LOCALSTATEDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 LOCALSTATEDIR=$PREFIX/var
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 if [ -z "$INCLUDEDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 INCLUDEDIR=$PREFIX/include
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 if [ -z "$INFODIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 INFODIR=$PREFIX/info
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 if [ -z "$MANDIR" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 MANDIR=$PREFIX/man
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 which pkg-config > /dev/null
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 if [ $? -eq 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 PKG_CONFIG=pkg-config
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 PKG_CONFIG=false
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 # Simple uname based platform detection
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 # $PLATFORM is used for platform dependent dependency selection
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 printf "detect platform... "
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 if [ $OS = SunOS ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 PLATFORM="solaris sunos unix svr4"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 if [ $OS = Linux ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 PLATFORM="linux unix"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 if [ $OS = FreeBSD ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 PLATFORM="freebsd bsd unix"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 if [ $OS = Darwin ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 PLATFORM="macos osx bsd unix"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 echo $OS | grep "MINGW" > /dev/null
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 if [ $? -eq 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 PLATFORM="windows mingw"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 if [ -z "$PLATFORM" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 PLATFORM="unix"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214 for p in $PLATFORM
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 PLATFORM_NAME=$p
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 echo $PLATFORM_NAME
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 isplatform()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222 {
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223 for p in $PLATFORM
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 if [ $p = $1 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 return 0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 return 1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230 }
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 isnotplatform()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 {
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 for p in $PLATFORM
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 if [ $p = $1 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236 return 1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 return 0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 }
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 # generate config.mk and config.h
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 cat > $TEMP_DIR/config.mk << __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 # config.mk generated by configure
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248 # general vars
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249 #foreach( $var in $vars )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 ${var.name}=$${var.name}
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253 #if ( ! $project.hasVar("PREFIX") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 PREFIX=$PREFIX
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 #if ( ! $project.hasVar("EPREFIX") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257 EPREFIX=$EPREFIX
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 #if ( ! $project.hasVar("BINDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261 BINDIR=$BINDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263 #if ( ! $project.hasVar("SBINDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264 SBINDIR=$SBINDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266 #if ( ! $project.hasVar("LIBDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267 LIBDIR=$LIBDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269 #if ( ! $project.hasVar("LIBEXECDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 LIBEXECDIR=$LIBEXECDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 #if ( ! $project.hasVar("DATADIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 DATADIR=$DATADIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 #if ( ! $project.hasVar("SYSCONFDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276 SYSCONFDIR=$SYSCONFDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278 #if ( ! $project.hasVar("SHAREDSTATEDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279 SHAREDSTATEDIR=$SHAREDSTATEDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 #if ( ! $project.hasVar("LOCALSTATEDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282 LOCALSTATEDIR=$LOCALSTATEDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
284 #if ( ! $project.hasVar("INCLUDEDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
285 INCLUDEDIR=$INCLUDEDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
286 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 #if ( ! $project.hasVar("INFODIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288 INFODIR=$INFODIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290 #if ( ! $project.hasVar("MANDIR") )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291 MANDIR=$MANDIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
294 __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
295
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
296 echo > $TEMP_DIR/make.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
297
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
298 ENV_CFLAGS=$CFLAGS
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
299 ENV_LDFLAGS=$LDFLAGS
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
300 ENV_CXXFLAGS=$CXXFLAGS
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
301
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
302 # Toolchain detection
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
303 # this will insert make vars to config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
304 . make/toolchain.sh
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
305
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
306 # add user specified flags to config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
307 echo >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
308 if [ ! -z "${ENV_CFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
309 echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
310 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
311 if [ ! -z "${ENV_CXXFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
312 echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
313 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
314 if [ ! -z "${ENV_LDFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
315 echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
316 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
317
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
318 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319 # DEPENDENCIES
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
321
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322 #foreach( $dependency in $namedDependencies )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
323 dependency_${dependency.name}()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
324 {
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
325 printf "checking for ${dependency.name}... "
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
326 #foreach( $sub in $dependency.getSubdependencies() )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
327 # dependency $sub.name $sub.getPlatformString()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
328 while true
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
329 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
330 #if( $sub.platform )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
331 if isnotplatform "${sub.platform}"; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
332 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
333 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
334 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335 #foreach( $not in $sub.getNotList() )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336 if isplatform "${not}"; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
338 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
339 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340 #if( $sub.pkgconfig.size() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 if [ -z "$PKG_CONFIG" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
345 #foreach( $pkg in $sub.pkgconfig )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346 $PKG_CONFIG $pkg.getPkgConfigParam()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
347 if [ $? -ne 0 ] ; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
353 #foreach( $flags in $sub.flags )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
354 #if( $flags.exec )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
355 $flags.value > /dev/null
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
356 if [ $? -eq 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
357 $flags.varName="$$flags.varName `$flags.value`"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
358 else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
359 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
360 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
361 #else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362 $flags.varName="$$flags.varName $flags.value"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
365 #foreach( $test in $sub.tests )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
366 $test > /dev/null
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
368 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
369 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
370 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
371 #if ( $sub.make.length() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
372 cat >> $TEMP_DIR/make.mk << __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
373 # Dependency: $dependency.name
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
374 $sub.make
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
375 __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
376 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
377 echo yes
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
378 return 0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
379 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
380
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
381 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
382 echo no
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
383 return 1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
384 }
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
385 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
386
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
387 DEPENDENCIES_FAILED=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
388 ERROR=0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
389 #if( $dependencies.size() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
390 # general dependencies
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
391 CFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
392 LDFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
393 #foreach( $dependency in $dependencies )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
394 while true
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
395 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
396 #if( $dependency.platform )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
397 if isnotplatform "${dependency.platform}"; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
398 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
399 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
400 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
401 #foreach( $not in $dependency.getNotList() )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
402 if isplatform "${not}"; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
403 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
404 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
405 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
406 while true
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
407 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
408 #if( $dependency.pkgconfig.size() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
409 if [ -z "$PKG_CONFIG" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
410 ERROR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
411 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
412 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
413 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
414 #foreach( $pkg in $dependency.pkgconfig )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
415 printf "checking for pkg-config package $pkg.getPkgConfigParam()... "
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
416 $PKG_CONFIG $pkg.getPkgConfigParam()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
417 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
418 echo no
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
419 ERROR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
420 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
421 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
422 echo yes
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
423 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
424 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
425 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
426
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
427 #foreach( $flags in $dependency.flags )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
428 #if( $flags.exec )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
429 $flags.value > /dev/null
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
430 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
431 $flags.varName="$$flags.varName `$flags.value`"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
432 else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
433 ERROR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
434 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
435 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
436 #else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
437 $flags.varName="$$flags.varName $flags.value"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
438 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
439 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
440 #if ( $dependency.make.length() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
441 cat >> $TEMP_DIR/make.mk << __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
442 $dependency.make
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
443 __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
444 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
445
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
446 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
447 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
448
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
449 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
450 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
451 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
452
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
453 # add general dependency flags to config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
454 echo >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
455 if [ ! -z "${CFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
456 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
457 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
458 if [ ! -z "${CXXFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
459 echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
460 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
461 if [ ! -z "${LDFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
462 echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
463 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
464 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
465
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
466 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
467 # OPTION VALUES
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
468 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
469 #foreach( $opt in $options )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
470 #foreach( $val in $opt.values )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
471 ${val.func}()
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
472 {
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
473 VERR=0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
474 #foreach( $dep in $val.dependencies )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
475 dependency_$dep
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
476 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
477 VERR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
478 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
479 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
480 if [ $VERR -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
481 return 1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
482 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
483 #foreach( $def in $val.defines )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
484 CFLAGS="$CFLAGS ${def.toFlags()}"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
485 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
486 #if( $val.hasMake() )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
487 cat >> $TEMP_DIR/make.mk << __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
488 $val.make
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
489 __EOF__
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
490 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
491 return 0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
492 }
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
493 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
494 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
495
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
496 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
497 # TARGETS
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
498 #
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
499 CFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
500 CXXFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
501 LDFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
502
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
503 #foreach( $target in $targets )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
504 #if ( $target.name )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
505 # Target: $target.name
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
506 #else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
507 # Target
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
508 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
509 CFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
510 LDFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
511 CXXFLAGS=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
512
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
513 #foreach( $dependency in $target.dependencies )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
514 dependency_$dependency
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
515 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
516 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
517 ERROR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
518 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
519 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
520
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
521 # Features
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
522 #foreach( $feature in $target.features )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
523 if [ ! -z "$${feature.getVarName()}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
524 #foreach( $dependency in $feature.dependencies )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
525 # check dependency
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
526 dependency_$dependency
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
527 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
528 # "auto" features can fail and are just disabled in this case
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
529 if [ $${feature.getVarName()} != "auto" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
530 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
531 ERROR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
532 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
533 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
534 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
535 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
536 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
537
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
538 #foreach( $opt in $target.options )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
539 # Option: --${opt.argument}
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
540 if [ -z ${D}${opt.getVarName()} ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
541 SAVED_ERROR=$ERROR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
542 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
543 ERROR=0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
544 while true
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
545 do
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
546 #foreach( $optdef in $opt.defaults )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
547 #if( $optdef.platform )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
548 if isplatform "$optdef.platform"; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
549 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
550 $optdef.func
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
551 if [ $? -eq 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
552 echo " ${opt.argument}: ${optdef.valueName}" >> $TEMP_DIR/options
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
553 ERROR=0
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
554 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
555 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
556 #if( $optdef.platform )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
557 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
558 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
559 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
560 break
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
561 done
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
562 if [ $ERROR -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
563 SAVED_ERROR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
564 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
565 ERROR=$SAVED_ERROR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
566 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED=
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
567 else
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
568 if false; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
569 false
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
570 #foreach( $optval in $opt.values )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
571 elif [ ${D}${opt.getVarName()} = "${optval.value}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
572 echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
573 $optval.func
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
574 if [ $? -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
575 ERROR=1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
576 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
577 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
578 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
579 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
580 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
581
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
582 echo >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
583 if [ ! -z "${CFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
584 echo "${target.getCFlags()} += $CFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
585 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
586 if [ ! -z "${CXXFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
587 echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
588 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
589 if [ ! -z "${LDFLAGS}" ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
590 echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
591 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
592
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
593 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
594 if [ $ERROR -ne 0 ]; then
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
595 echo
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
596 echo "Error: Unresolved dependencies"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
597 echo $DEPENDENCIES_FAILED
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
598 rm -Rf $TEMP_DIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
599 exit 1
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
600 fi
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
601
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
602 echo "configure finished"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
603 echo
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
604 echo "Build Config:"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
605 echo " PREFIX: $PREFIX"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
606 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
607 #if ( $options.size() > 0 )
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
608 echo "Options:"
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
609 cat $TEMP_DIR/options
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
610 #end
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
611 echo
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
612 cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
613 rm -Rf $TEMP_DIR
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
614
804d8803eade add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
615

mercurial