| 83 |
83 |
| 84 # help text |
84 # help text |
| 85 printhelp() |
85 printhelp() |
| 86 { |
86 { |
| 87 echo "Usage: $0 [OPTIONS]..." |
87 echo "Usage: $0 [OPTIONS]..." |
| 88 cat << __EOF__ |
88 echo 'Configuration:' |
| 89 Installation directories: |
89 if true \ |
| 90 --prefix=PREFIX path prefix for architecture-independent files |
90 ; then |
| 91 [$prefix] |
91 : |
| 92 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
92 if test -z "$TOOLKIT_HOME__described__"; then |
| 93 [PREFIX] |
93 TOOLKIT_HOME__described__=1 |
| 94 |
94 cat << '__EOF__' |
| 95 --bindir=DIR user executables [EPREFIX/bin] |
95 --toolkit-home location of the toolkit installation (default: /usr) |
| 96 --sbindir=DIR system admin executables [EPREFIX/sbin] |
96 __EOF__ |
| 97 --libexecdir=DIR program executables [EPREFIX/libexec] |
97 fi |
| 98 --sysconfdir=DIR system configuration files [PREFIX/etc] |
98 fi |
| 99 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
99 cat << '__EOF__' |
| 100 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
| 101 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
| 102 --libdir=DIR object code libraries [EPREFIX/lib] |
|
| 103 --includedir=DIR C header files [PREFIX/include] |
|
| 104 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
| 105 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
| 106 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
| 107 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
| 108 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
| 109 |
100 |
| 110 Build Types: |
101 Build Types: |
| 111 --debug add extra compile flags for debug builds |
102 --debug add extra compile flags for debug builds |
| 112 --release add extra compile flags for release builds |
103 --release add extra compile flags for release builds |
| 113 |
104 |
| 114 Optional Features: |
105 Optional Features: |
| 115 --enable-asan enable address sanitization |
106 --enable-asan enable address sanitization |
| 116 --enable-tools enable compilation of tools |
107 --enable-tools enable compilation of tools |
| 117 |
108 |
| 118 __EOF__ |
109 __EOF__ |
| |
110 abort_configure |
| 119 } |
111 } |
| 120 |
112 |
| 121 # create temporary directory |
113 # create temporary directory |
| 122 TEMP_DIR=".tmp-`uname -n`" |
114 TEMP_DIR=".tmp-`uname -n`" |
| 123 rm -Rf "$TEMP_DIR" |
115 rm -Rf "$TEMP_DIR" |
| 164 # |
144 # |
| 165 BUILD_TYPE="default" |
145 BUILD_TYPE="default" |
| 166 for ARG in "$@" |
146 for ARG in "$@" |
| 167 do |
147 do |
| 168 case "$ARG" in |
148 case "$ARG" in |
| 169 "--prefix="*) prefix=${ARG#--prefix=} ;; |
149 "--toolkit-home="*) TOOLKIT_HOME=${ARG#--toolkit-home=} ;; |
| 170 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
150 "--help"*) printhelp ;; |
| 171 "--bindir="*) bindir=${ARG#----bindir=} ;; |
151 "--debug") BUILD_TYPE="debug" ;; |
| 172 "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
152 "--release") BUILD_TYPE="release" ;; |
| 173 "--libdir="*) libdir=${ARG#--libdir=} ;; |
|
| 174 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
|
| 175 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
|
| 176 "--datadir="*) datadir=${ARG#--datadir=} ;; |
|
| 177 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
|
| 178 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
|
| 179 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
|
| 180 "--runstatedir="*) runstatedir=${ARG#--runstatedir=} ;; |
|
| 181 "--includedir="*) includedir=${ARG#--includedir=} ;; |
|
| 182 "--infodir="*) infodir=${ARG#--infodir=} ;; |
|
| 183 "--mandir"*) mandir=${ARG#--mandir} ;; |
|
| 184 "--localedir"*) localedir=${ARG#--localedir} ;; |
|
| 185 "--help"*) printhelp; abort_configure ;; |
|
| 186 "--debug") BUILD_TYPE="debug" ;; |
|
| 187 "--release") BUILD_TYPE="release" ;; |
|
| 188 "--enable-asan") FEATURE_ASAN=on ;; |
153 "--enable-asan") FEATURE_ASAN=on ;; |
| 189 "--disable-asan") unset FEATURE_ASAN ;; |
154 "--disable-asan") unset FEATURE_ASAN ;; |
| 190 "--enable-tools") FEATURE_TOOLS=on ;; |
155 "--enable-tools") FEATURE_TOOLS=on ;; |
| 191 "--disable-tools") unset FEATURE_TOOLS ;; |
156 "--disable-tools") unset FEATURE_TOOLS ;; |
| 192 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
157 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
| 193 esac |
158 esac |
| 194 done |
159 done |
| |
160 |
| |
161 # toolchain detection utilities |
| |
162 . make/toolchain.sh |
| |
163 |
| |
164 # check languages |
| |
165 lang_c= |
| |
166 lang_cpp= |
| |
167 if detect_c_compiler ; then |
| |
168 lang_c=1 |
| |
169 fi |
| 195 |
170 |
| 196 |
171 |
| 197 |
172 |
| 198 # set defaults for dir variables |
173 # set defaults for dir variables |
| 199 : ${exec_prefix:="$prefix"} |
174 : ${exec_prefix:="$prefix"} |
| 228 : ${includedir:='${prefix}/include'} |
203 : ${includedir:='${prefix}/include'} |
| 229 : ${infodir:='${datarootdir}/info'} |
204 : ${infodir:='${datarootdir}/info'} |
| 230 : ${mandir:='${datarootdir}/man'} |
205 : ${mandir:='${datarootdir}/man'} |
| 231 : ${localedir:='${datarootdir}/locale'} |
206 : ${localedir:='${datarootdir}/locale'} |
| 232 |
207 |
| 233 # remember the above values and compare them later |
|
| 234 orig_bindir="$bindir" |
|
| 235 orig_sbindir="$sbindir" |
|
| 236 orig_libdir="$libdir" |
|
| 237 orig_libexecdir="$libexecdir" |
|
| 238 orig_datarootdir="$datarootdir" |
|
| 239 orig_datadir="$datadir" |
|
| 240 orig_sysconfdir="$sysconfdir" |
|
| 241 orig_sharedstatedir="$sharedstatedir" |
|
| 242 orig_localstatedir="$localstatedir" |
|
| 243 orig_runstatedir="$runstatedir" |
|
| 244 orig_includedir="$includedir" |
|
| 245 orig_infodir="$infodir" |
|
| 246 orig_mandir="$mandir" |
|
| 247 orig_localedir="$localedir" |
|
| 248 |
208 |
| 249 # check if a config.site exists and load it |
209 # check if a config.site exists and load it |
| |
210 CONFIG_SITE_OK=0 |
| 250 if [ -n "$CONFIG_SITE" ]; then |
211 if [ -n "$CONFIG_SITE" ]; then |
| 251 # CONFIG_SITE may contain space separated file names |
212 # CONFIG_SITE may contain space separated file names |
| 252 for cs in $CONFIG_SITE; do |
213 for cs in $CONFIG_SITE; do |
| 253 printf "loading defaults from $cs... " |
214 printf "loading defaults from $cs... " |
| 254 . "$cs" |
215 if [ -f "$cs" ]; then |
| 255 echo ok |
216 . "$cs" |
| |
217 echo ok |
| |
218 CONFIG_SITE_OK=1 |
| |
219 break |
| |
220 else |
| |
221 echo "not found" |
| |
222 fi |
| 256 done |
223 done |
| 257 elif [ -f "$prefix/share/config.site" ]; then |
224 elif [ -f "$prefix/share/config.site" ]; then |
| 258 printf "loading site defaults... " |
225 printf "loading site defaults... " |
| 259 . "$prefix/share/config.site" |
226 . "$prefix/share/config.site" |
| 260 echo ok |
227 echo ok |
| |
228 CONFIG_SITE_OK=1 |
| 261 elif [ -f "$prefix/etc/config.site" ]; then |
229 elif [ -f "$prefix/etc/config.site" ]; then |
| 262 printf "loading site defaults... " |
230 printf "loading site defaults... " |
| 263 . "$prefix/etc/config.site" |
231 . "$prefix/etc/config.site" |
| 264 echo ok |
232 echo ok |
| 265 else |
233 CONFIG_SITE_OK=1 |
| |
234 fi |
| |
235 |
| |
236 if [ $CONFIG_SITE_OK -eq 0 ]; then |
| 266 # try to detect the correct libdir on our own, except it was changed by the user |
237 # try to detect the correct libdir on our own, except it was changed by the user |
| 267 if test "$libdir" = '${exec_prefix}/lib'; then |
238 if [ "$libdir" = '${exec_prefix}/lib' ] ; then |
| 268 if [ "$OS" = "SunOS" ]; then |
239 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then |
| 269 test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64' |
240 if [ "$OS" = "SunOS" ]; then |
| 270 else |
241 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64' |
| 271 # check if the standard libdir even exists |
|
| 272 if test -d "${exec_prefix}/lib" ; then |
|
| 273 : |
|
| 274 else |
242 else |
| 275 # if it does not, maybe a lib32 exists |
243 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64' |
| 276 test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32' |
|
| 277 fi |
244 fi |
| 278 # now check if there is a special 64bit libdir that we should use |
245 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then |
| 279 for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do |
246 if [ "$OS" = "SunOS" ]; then |
| 280 if [ $ARCH = $i ]; then |
247 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32' |
| 281 test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64' |
248 else |
| 282 break |
249 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32' |
| 283 fi |
250 fi |
| 284 done |
|
| 285 fi |
251 fi |
| 286 fi |
252 fi |
| 287 fi |
253 fi |
| 288 |
254 |
| 289 |
255 |
| 290 # generate vars.mk |
256 # generate vars.mk |
| 291 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
257 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
| 292 prefix=$prefix |
258 srcdir=$srcdir |
| 293 exec_prefix=$exec_prefix |
259 TOOLKIT_HOME=$TOOLKIT_HOME |
| 294 bindir=$bindir |
|
| 295 sbindir=$sbindir |
|
| 296 libdir=$libdir |
|
| 297 libexecdir=$libexecdir |
|
| 298 datarootdir=$datarootdir |
|
| 299 datadir=$datadir |
|
| 300 sysconfdir=$sysconfdir |
|
| 301 sharedstatedir=$sharedstatedir |
|
| 302 localstatedir=$localstatedir |
|
| 303 runstatedir=$runstatedir |
|
| 304 includedir=$includedir |
|
| 305 infodir=$infodir |
|
| 306 mandir=$mandir |
|
| 307 localedir=$localedir |
|
| 308 __EOF__ |
260 __EOF__ |
| 309 |
261 |
| 310 # toolchain detection utilities |
|
| 311 . make/toolchain.sh |
|
| 312 |
262 |
| 313 # |
263 # |
| 314 # DEPENDENCIES |
264 # DEPENDENCIES |
| 315 # |
265 # |
| 316 |
266 |
| 317 # check languages |
267 |
| 318 lang_c= |
|
| 319 lang_cpp= |
|
| 320 if detect_c_compiler ; then |
|
| 321 lang_c=1 |
|
| 322 fi |
|
| 323 |
268 |
| 324 # create buffer for make variables required by dependencies |
269 # create buffer for make variables required by dependencies |
| 325 echo > "$TEMP_DIR/make.mk" |
270 echo > "$TEMP_DIR/make.mk" |
| 326 |
271 |
| 327 test_pkg_config() |
272 test_pkg_config() |
| 750 fi |
692 fi |
| 751 if [ -n "$TOOLCHAIN_CSTD" ]; then |
693 if [ -n "$TOOLCHAIN_CSTD" ]; then |
| 752 echo " default C std: $TOOLCHAIN_CSTD" |
694 echo " default C std: $TOOLCHAIN_CSTD" |
| 753 fi |
695 fi |
| 754 echo |
696 echo |
| 755 echo "Build Config:" |
697 echo "Config:" |
| 756 echo " prefix: $prefix" |
698 printf ' %-16s' 'toolkit-home:' |
| 757 echo " exec_prefix: $exec_prefix" |
699 echo "$TOOLKIT_HOME" |
| 758 if [ "$orig_bindir" != "$bindir" ]; then |
|
| 759 echo " bindir: $bindir" |
|
| 760 fi |
|
| 761 if [ "$orig_sbindir" != "$sbindir" ]; then |
|
| 762 echo " sbindir: $sbindir" |
|
| 763 fi |
|
| 764 if [ "$orig_libdir" != "$libdir" ]; then |
|
| 765 echo " libdir: $libdir" |
|
| 766 fi |
|
| 767 if [ "$orig_libexecdir" != "$libexecdir" ]; then |
|
| 768 echo " libexecdir: $libexecdir" |
|
| 769 fi |
|
| 770 if [ "$orig_datarootdir" != "$datarootdir" ]; then |
|
| 771 echo " datarootdir: $datarootdir" |
|
| 772 fi |
|
| 773 if [ "$orig_datadir" != "$datadir" ]; then |
|
| 774 echo " datadir: $datadir" |
|
| 775 fi |
|
| 776 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then |
|
| 777 echo " sysconfdir: $sysconfdir" |
|
| 778 fi |
|
| 779 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then |
|
| 780 echo " sharedstatedir: $sharedstatedir" |
|
| 781 fi |
|
| 782 if [ "$orig_localstatedir" != "$localstatedir" ]; then |
|
| 783 echo " localstatedir: $localstatedir" |
|
| 784 fi |
|
| 785 if [ "$orig_runstatedir" != "$runstatedir" ]; then |
|
| 786 echo " runstatedir: $runstatedir" |
|
| 787 fi |
|
| 788 if [ "$orig_includedir" != "$includedir" ]; then |
|
| 789 echo " includedir: $includedir" |
|
| 790 fi |
|
| 791 if [ "$orig_infodir" != "$infodir" ]; then |
|
| 792 echo " infodir: $infodir" |
|
| 793 fi |
|
| 794 if [ "$orig_mandir" != "$mandir" ]; then |
|
| 795 echo " mandir: $mandir" |
|
| 796 fi |
|
| 797 if [ "$orig_localedir" != "$localedir" ]; then |
|
| 798 echo " localedir: $localedir" |
|
| 799 fi |
|
| 800 echo |
700 echo |
| 801 echo "Features:" |
701 echo "Features:" |
| |
702 printf ' %-16s' 'asan:' |
| 802 if [ -n "$FEATURE_ASAN" ]; then |
703 if [ -n "$FEATURE_ASAN" ]; then |
| 803 echo " asan: on" |
704 echo 'on' |
| 804 else |
705 else |
| 805 echo " asan: off" |
706 echo 'off' |
| 806 fi |
707 fi |
| |
708 printf ' %-16s' 'tools:' |
| 807 if [ -n "$FEATURE_TOOLS" ]; then |
709 if [ -n "$FEATURE_TOOLS" ]; then |
| 808 echo " tools: on" |
710 echo 'on' |
| 809 else |
711 else |
| 810 echo " tools: off" |
712 echo 'off' |
| 811 fi |
713 fi |
| 812 echo |
714 echo |
| 813 |
715 |
| 814 # generate the config.mk file |
716 # generate the config.mk file |
| 815 pwd=`pwd` |
717 pwd=`pwd` |