make/configure.vm

changeset 1523
b5c32391802f
parent 1492
cc83ce484bf7
child 1526
047f8a19f7fa
equal deleted inserted replaced
1520:03d703c3cfe9 1523:b5c32391802f
84 84
85 # help text 85 # help text
86 printhelp() 86 printhelp()
87 { 87 {
88 echo "Usage: $0 [OPTIONS]..." 88 echo "Usage: $0 [OPTIONS]..."
89 cat << __EOF__ 89 echo 'Configuration:'
90 Installation directories: 90 #foreach( $cfg in $config )
91 --prefix=PREFIX path prefix for architecture-independent files 91 if true \
92 [${D}prefix] 92 #if( $cfg.platform )
93 --exec-prefix=EPREFIX path prefix for architecture-dependent files 93 && isplatform "${cfg.platform}" \
94 [PREFIX] 94 #end
95 95 #foreach( $np in $cfg.notList )
96 --bindir=DIR user executables [EPREFIX/bin] 96 && notisplatform "${np}" \
97 --sbindir=DIR system admin executables [EPREFIX/sbin] 97 #end
98 --libexecdir=DIR program executables [EPREFIX/libexec] 98 ; then
99 --sysconfdir=DIR system configuration files [PREFIX/etc] 99 :
100 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 100 #foreach( $var in $cfg.vars )
101 --localstatedir=DIR modifiable single-machine data [PREFIX/var] 101 #if( $var.overridable )
102 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] 102 if test -z "${D}${var.varName}__described__"; then
103 --libdir=DIR object code libraries [EPREFIX/lib] 103 ${var.varName}__described__=1
104 --includedir=DIR C header files [PREFIX/include] 104 cat << '__EOF__'
105 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 105 ${var.helpText}
106 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 106 __EOF__
107 --infodir=DIR info documentation [DATAROOTDIR/info] 107 fi
108 --mandir=DIR man documentation [DATAROOTDIR/man] 108 #end
109 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] 109 #end
110 fi
111 #end
112 cat << '__EOF__'
110 113
111 Build Types: 114 Build Types:
112 --debug add extra compile flags for debug builds 115 --debug add extra compile flags for debug builds
113 --release add extra compile flags for release builds 116 --release add extra compile flags for release builds
114 #if( $options.size() > 0 ) 117 #if( $options.size() > 0 )
125 ${feature.helpText} 128 ${feature.helpText}
126 #end 129 #end
127 #end 130 #end
128 131
129 __EOF__ 132 __EOF__
133 abort_configure
130 } 134 }
131 135
132 # create temporary directory 136 # create temporary directory
133 TEMP_DIR=".tmp-`uname -n`" 137 TEMP_DIR=".tmp-`uname -n`"
134 rm -Rf "$TEMP_DIR" 138 rm -Rf "$TEMP_DIR"
140 exit 1 144 exit 1
141 fi 145 fi
142 touch "$TEMP_DIR/options" 146 touch "$TEMP_DIR/options"
143 touch "$TEMP_DIR/features" 147 touch "$TEMP_DIR/features"
144 148
145 # define standard variables 149 # config variables
146 # also define standard prefix (this is where we will search for config.site)
147 prefix=/usr
148 exec_prefix=
149 bindir=
150 sbindir=
151 libdir=
152 libexecdir=
153 datarootdir=
154 datadir=
155 sysconfdir=
156 sharedstatedir=
157 localstatedir=
158 runstatedir=
159 includedir=
160 infodir=
161 localedir=
162 mandir=
163
164 # custom variables
165 #foreach( $cfg in $config ) 150 #foreach( $cfg in $config )
166 if true \ 151 if true \
167 #if( $cfg.platform ) 152 #if( $cfg.platform )
168 && isplatform "${cfg.platform}" \ 153 && isplatform "${cfg.platform}" \
169 #end 154 #end
170 #foreach( $np in $cfg.notList ) 155 #foreach( $np in $cfg.notList )
171 && notisplatform "${np}" \ 156 && notisplatform "${np}" \
172 #end 157 #end
173 ; then 158 ; then
159 :
174 #foreach( $var in $cfg.vars ) 160 #foreach( $var in $cfg.vars )
175 #if( $var.exec ) 161 if test -z "${D}${var.varName}__initialized__"; then
176 ${var.varName}=`${var.value}` 162 ${var.varName}__initialized__=1
177 #else 163 #if( $var.exec )
178 ${var.varName}="${var.value}" 164 ${var.varName}=`${var.value}`
179 #end 165 #else
166 ${var.varName}="${var.value}"
167 #end
168 fi
180 #end 169 #end
181 fi 170 fi
182 #end 171 #end
183 172
184 # features 173 # features
193 # 182 #
194 BUILD_TYPE="default" 183 BUILD_TYPE="default"
195 for ARG in "$@" 184 for ARG in "$@"
196 do 185 do
197 case "$ARG" in 186 case "$ARG" in
198 "--prefix="*) prefix=${D}{ARG#--prefix=} ;; 187 #foreach( $var in $vars )
199 "--exec-prefix="*) exec_prefix=${D}{ARG#--exec-prefix=} ;; 188 #if ($var.overridable)
200 "--bindir="*) bindir=${D}{ARG#----bindir=} ;; 189 "--${var.arg}="*) ${var.varName}=${D}{ARG#--${var.arg}=} ;;
201 "--sbindir="*) sbindir=${D}{ARG#--sbindir=} ;; 190 #end
202 "--libdir="*) libdir=${D}{ARG#--libdir=} ;; 191 #end
203 "--libexecdir="*) libexecdir=${D}{ARG#--libexecdir=} ;; 192 "--help"*) printhelp ;;
204 "--datarootdir="*) datarootdir=${D}{ARG#--datarootdir=} ;; 193 "--debug") BUILD_TYPE="debug" ;;
205 "--datadir="*) datadir=${D}{ARG#--datadir=} ;; 194 "--release") BUILD_TYPE="release" ;;
206 "--sysconfdir="*) sysconfdir=${D}{ARG#--sysconfdir=} ;;
207 "--sharedstatedir="*) sharedstatedir=${D}{ARG#--sharedstatedir=} ;;
208 "--localstatedir="*) localstatedir=${D}{ARG#--localstatedir=} ;;
209 "--runstatedir="*) runstatedir=${D}{ARG#--runstatedir=} ;;
210 "--includedir="*) includedir=${D}{ARG#--includedir=} ;;
211 "--infodir="*) infodir=${D}{ARG#--infodir=} ;;
212 "--mandir"*) mandir=${D}{ARG#--mandir} ;;
213 "--localedir"*) localedir=${D}{ARG#--localedir} ;;
214 "--help"*) printhelp; abort_configure ;;
215 "--debug") BUILD_TYPE="debug" ;;
216 "--release") BUILD_TYPE="release" ;;
217 #foreach( $opt in $options ) 195 #foreach( $opt in $options )
218 "--${opt.arg}="*) ${opt.varName}=${D}{ARG#--${opt.arg}=} ;; 196 "--${opt.arg}="*) ${opt.varName}=${D}{ARG#--${opt.arg}=} ;;
219 "--${opt.arg}") echo "option '$ARG' needs a value:"; echo " $ARG=${opt.valuesString}"; abort_configure ;; 197 "--${opt.arg}") echo "option '$ARG' needs a value:"; echo " $ARG=${opt.valuesString}"; abort_configure ;;
220 #end 198 #end
221 #foreach( $feature in $features ) 199 #foreach( $feature in $features )
222 "--enable-${feature.arg}") ${feature.varName}=on ;; 200 "--enable-${feature.arg}") ${feature.varName}=on ;;
223 "--disable-${feature.arg}") unset ${feature.varName} ;; 201 "--disable-${feature.arg}") unset ${feature.varName} ;;
224 #end 202 #end
225 "-"*) echo "unknown option: $ARG"; abort_configure ;; 203 "-"*) echo "unknown option: $ARG"; abort_configure ;;
226 esac 204 esac
227 done 205 done
206
207 # toolchain detection utilities
208 . make/toolchain.sh
209
210 # check languages
211 lang_c=
212 lang_cpp=
213 #foreach( $lang in $languages )
214 if detect_${lang}_compiler ; then
215 lang_${lang}=1
216 fi
217 #end
228 218
229 ## Begin unparsed content. ** 219 ## Begin unparsed content. **
230 #[[ 220 #[[
231 221
232 # set defaults for dir variables 222 # set defaults for dir variables
262 : ${includedir:='${prefix}/include'} 252 : ${includedir:='${prefix}/include'}
263 : ${infodir:='${datarootdir}/info'} 253 : ${infodir:='${datarootdir}/info'}
264 : ${mandir:='${datarootdir}/man'} 254 : ${mandir:='${datarootdir}/man'}
265 : ${localedir:='${datarootdir}/locale'} 255 : ${localedir:='${datarootdir}/locale'}
266 256
267 # remember the above values and compare them later
268 orig_bindir="$bindir"
269 orig_sbindir="$sbindir"
270 orig_libdir="$libdir"
271 orig_libexecdir="$libexecdir"
272 orig_datarootdir="$datarootdir"
273 orig_datadir="$datadir"
274 orig_sysconfdir="$sysconfdir"
275 orig_sharedstatedir="$sharedstatedir"
276 orig_localstatedir="$localstatedir"
277 orig_runstatedir="$runstatedir"
278 orig_includedir="$includedir"
279 orig_infodir="$infodir"
280 orig_mandir="$mandir"
281 orig_localedir="$localedir"
282 257
283 # check if a config.site exists and load it 258 # check if a config.site exists and load it
259 CONFIG_SITE_OK=0
284 if [ -n "$CONFIG_SITE" ]; then 260 if [ -n "$CONFIG_SITE" ]; then
285 # CONFIG_SITE may contain space separated file names 261 # CONFIG_SITE may contain space separated file names
286 for cs in $CONFIG_SITE; do 262 for cs in $CONFIG_SITE; do
287 printf "loading defaults from $cs... " 263 printf "loading defaults from $cs... "
288 . "$cs" 264 if [ -f "$cs" ]; then
289 echo ok 265 . "$cs"
266 echo ok
267 CONFIG_SITE_OK=1
268 break
269 else
270 echo "not found"
271 fi
290 done 272 done
291 elif [ -f "$prefix/share/config.site" ]; then 273 elif [ -f "$prefix/share/config.site" ]; then
292 printf "loading site defaults... " 274 printf "loading site defaults... "
293 . "$prefix/share/config.site" 275 . "$prefix/share/config.site"
294 echo ok 276 echo ok
277 CONFIG_SITE_OK=1
295 elif [ -f "$prefix/etc/config.site" ]; then 278 elif [ -f "$prefix/etc/config.site" ]; then
296 printf "loading site defaults... " 279 printf "loading site defaults... "
297 . "$prefix/etc/config.site" 280 . "$prefix/etc/config.site"
298 echo ok 281 echo ok
299 else 282 CONFIG_SITE_OK=1
283 fi
284
285 if [ $CONFIG_SITE_OK -eq 0 ]; then
300 # try to detect the correct libdir on our own, except it was changed by the user 286 # try to detect the correct libdir on our own, except it was changed by the user
301 if test "$libdir" = '${exec_prefix}/lib'; then 287 if [ "$libdir" = '${exec_prefix}/lib' ] ; then
302 if [ "$OS" = "SunOS" ]; then 288 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then
303 test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64' 289 if [ "$OS" = "SunOS" ]; then
304 else 290 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64'
305 # check if the standard libdir even exists
306 if test -d "${exec_prefix}/lib" ; then
307 :
308 else 291 else
309 # if it does not, maybe a lib32 exists 292 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64'
310 test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32'
311 fi 293 fi
312 # now check if there is a special 64bit libdir that we should use 294 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then
313 for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do 295 if [ "$OS" = "SunOS" ]; then
314 if [ $ARCH = $i ]; then 296 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32'
315 test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64' 297 else
316 break 298 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32'
317 fi 299 fi
318 done
319 fi 300 fi
320 fi 301 fi
321 fi 302 fi
322 ]]# 303 ]]#
323 ## End of unparsed content ** 304 ## End of unparsed content **
324 305
325 # generate vars.mk 306 # generate vars.mk
326 cat > "$TEMP_DIR/vars.mk" << __EOF__ 307 cat > "$TEMP_DIR/vars.mk" << __EOF__
327 prefix=$prefix
328 exec_prefix=$exec_prefix
329 bindir=$bindir
330 sbindir=$sbindir
331 libdir=$libdir
332 libexecdir=$libexecdir
333 datarootdir=$datarootdir
334 datadir=$datadir
335 sysconfdir=$sysconfdir
336 sharedstatedir=$sharedstatedir
337 localstatedir=$localstatedir
338 runstatedir=$runstatedir
339 includedir=$includedir
340 infodir=$infodir
341 mandir=$mandir
342 localedir=$localedir
343 #foreach( $var in $vars ) 308 #foreach( $var in $vars )
344 ${var.varName}=${D}${var.varName} 309 ${var.varName}=${D}${var.varName}
345 #end 310 #end
346 __EOF__ 311 __EOF__
347 312
348 # toolchain detection utilities
349 . make/toolchain.sh
350 313
351 # 314 #
352 # DEPENDENCIES 315 # DEPENDENCIES
353 # 316 #
354 317
355 # check languages 318
356 lang_c=
357 lang_cpp=
358 #foreach( $lang in $languages )
359 if detect_${lang}_compiler ; then
360 lang_${lang}=1
361 fi
362 #end
363 319
364 # create buffer for make variables required by dependencies 320 # create buffer for make variables required by dependencies
365 echo > "$TEMP_DIR/make.mk" 321 echo > "$TEMP_DIR/make.mk"
366 322
367 test_pkg_config() 323 test_pkg_config()
742 abort_configure 698 abort_configure
743 fi 699 fi
744 700
745 echo "configure finished" 701 echo "configure finished"
746 echo 702 echo
747 echo "Toolchain" 703 echo "Toolchain:"
748 echo " name: $TOOLCHAIN_NAME" 704 echo " name: $TOOLCHAIN_NAME"
749 if [ -n "$TOOLCHAIN_CC" ]; then 705 if [ -n "$TOOLCHAIN_CC" ]; then
750 echo " cc: $TOOLCHAIN_CC" 706 echo " cc: $TOOLCHAIN_CC"
751 fi 707 fi
752 if [ -n "$TOOLCHAIN_CXX" ]; then 708 if [ -n "$TOOLCHAIN_CXX" ]; then
757 fi 713 fi
758 if [ -n "$TOOLCHAIN_CSTD" ]; then 714 if [ -n "$TOOLCHAIN_CSTD" ]; then
759 echo " default C std: $TOOLCHAIN_CSTD" 715 echo " default C std: $TOOLCHAIN_CSTD"
760 fi 716 fi
761 echo 717 echo
762 echo "Build Config:" 718 echo "Config:"
763 echo " prefix: $prefix" 719 #foreach( $var in $vars )
764 echo " exec_prefix: $exec_prefix" 720 #if ($var.overridable)
765 if [ "$orig_bindir" != "$bindir" ]; then 721 printf ' %-16s' '${var.arg}:'
766 echo " bindir: $bindir" 722 echo "${D}${var.varName}"
767 fi 723 #end
768 if [ "$orig_sbindir" != "$sbindir" ]; then 724 #end
769 echo " sbindir: $sbindir"
770 fi
771 if [ "$orig_libdir" != "$libdir" ]; then
772 echo " libdir: $libdir"
773 fi
774 if [ "$orig_libexecdir" != "$libexecdir" ]; then
775 echo " libexecdir: $libexecdir"
776 fi
777 if [ "$orig_datarootdir" != "$datarootdir" ]; then
778 echo " datarootdir: $datarootdir"
779 fi
780 if [ "$orig_datadir" != "$datadir" ]; then
781 echo " datadir: $datadir"
782 fi
783 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then
784 echo " sysconfdir: $sysconfdir"
785 fi
786 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then
787 echo " sharedstatedir: $sharedstatedir"
788 fi
789 if [ "$orig_localstatedir" != "$localstatedir" ]; then
790 echo " localstatedir: $localstatedir"
791 fi
792 if [ "$orig_runstatedir" != "$runstatedir" ]; then
793 echo " runstatedir: $runstatedir"
794 fi
795 if [ "$orig_includedir" != "$includedir" ]; then
796 echo " includedir: $includedir"
797 fi
798 if [ "$orig_infodir" != "$infodir" ]; then
799 echo " infodir: $infodir"
800 fi
801 if [ "$orig_mandir" != "$mandir" ]; then
802 echo " mandir: $mandir"
803 fi
804 if [ "$orig_localedir" != "$localedir" ]; then
805 echo " localedir: $localedir"
806 fi
807 #if ( $options.size() > 0 ) 725 #if ( $options.size() > 0 )
808 echo 726 echo
809 echo "Options:" 727 echo "Options:"
810 cat "$TEMP_DIR/options" 728 cat "$TEMP_DIR/options"
811 #end 729 #end
812 #if ( $features.size() > 0 ) 730 #if ( $features.size() > 0 )
813 echo 731 echo
814 echo "Features:" 732 echo "Features:"
815 #foreach( $feature in $features ) 733 #foreach( $feature in $features )
734 printf ' %-16s' '$feature.name:'
816 if [ -n "${D}${feature.varName}" ]; then 735 if [ -n "${D}${feature.varName}" ]; then
817 echo " $feature.name: on" 736 echo 'on'
818 else 737 else
819 echo " $feature.name: off" 738 echo 'off'
820 fi 739 fi
821 #end 740 #end
822 #end 741 #end
823 echo 742 echo
824 743

mercurial