make/configure.vm

changeset 87
84f94d476934
parent 86
db21aab20169
equal deleted inserted replaced
86:db21aab20169 87:84f94d476934
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 )
115 118
116 Options: 119 Options:
117 #foreach( $opt in $options ) 120 #foreach( $opt in $options )
118 --${opt.argument}=${opt.valuesString} 121 ${opt.helpText}
119 #end 122 #end
120 #end 123 #end
121 #if( $features.size() > 0 ) 124 #if( $features.size() > 0 )
122 125
123 Optional Features: 126 Optional Features:
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 "--includedir="*) includedir=${D}{ARG#--includedir=} ;;
210 "--infodir="*) infodir=${D}{ARG#--infodir=} ;;
211 "--mandir"*) mandir=${D}{ARG#--mandir} ;;
212 "--localedir"*) localedir=${D}{ARG#--localedir} ;;
213 "--help"*) printhelp; abort_configure ;;
214 "--debug") BUILD_TYPE="debug" ;;
215 "--release") BUILD_TYPE="release" ;;
216 #foreach( $opt in $options ) 195 #foreach( $opt in $options )
217 "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;; 196 "--${opt.arg}="*) ${opt.varName}=${D}{ARG#--${opt.arg}=} ;;
218 "--${opt.argument}") 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 ;;
219 #end 198 #end
220 #foreach( $feature in $features ) 199 #foreach( $feature in $features )
221 "--enable-${feature.arg}") ${feature.varName}=on ;; 200 "--enable-${feature.arg}") ${feature.varName}=on ;;
222 "--disable-${feature.arg}") unset ${feature.varName} ;; 201 "--disable-${feature.arg}") unset ${feature.varName} ;;
223 #end 202 #end
224 "-"*) echo "unknown option: $ARG"; abort_configure ;; 203 "-"*) echo "unknown option: $ARG"; abort_configure ;;
225 esac 204 esac
226 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
227 218
228 ## Begin unparsed content. ** 219 ## Begin unparsed content. **
229 #[[ 220 #[[
230 221
231 # set defaults for dir variables 222 # set defaults for dir variables
234 : ${sbindir:='${exec_prefix}/sbin'} 225 : ${sbindir:='${exec_prefix}/sbin'}
235 : ${libdir:='${exec_prefix}/lib'} 226 : ${libdir:='${exec_prefix}/lib'}
236 : ${libexecdir:='${exec_prefix}/libexec'} 227 : ${libexecdir:='${exec_prefix}/libexec'}
237 : ${datarootdir:='${prefix}/share'} 228 : ${datarootdir:='${prefix}/share'}
238 : ${datadir:='${datarootdir}'} 229 : ${datadir:='${datarootdir}'}
239 : ${sysconfdir:='${prefix}/etc'}
240 : ${sharedstatedir:='${prefix}/com'} 230 : ${sharedstatedir:='${prefix}/com'}
241 : ${localstatedir:='${prefix}/var'} 231 if [ -z "$sysconfdir" ]; then
242 : ${runstatedir:='${localstatedir}/run'} 232 if [ "$prefix" = '/usr' ]; then
233 sysconfdir='/etc'
234 else
235 sysconfdir='${prefix}/etc'
236 fi
237 fi
238 if [ -z "$localstatedir" ]; then
239 if [ "$prefix" = '/usr' ]; then
240 localstatedir='/var'
241 else
242 localstatedir='${prefix}/var'
243 fi
244 fi
245 if [ -z "$runstatedir" ]; then
246 if [ "$prefix" = '/usr' ]; then
247 runstatedir='/var/run'
248 else
249 runstatedir='${prefix}/var'
250 fi
251 fi
243 : ${includedir:='${prefix}/include'} 252 : ${includedir:='${prefix}/include'}
244 : ${infodir:='${datarootdir}/info'} 253 : ${infodir:='${datarootdir}/info'}
245 : ${mandir:='${datarootdir}/man'} 254 : ${mandir:='${datarootdir}/man'}
246 : ${localedir:='${datarootdir}/locale'} 255 : ${localedir:='${datarootdir}/locale'}
247 256
248 # remember the above values and compare them later
249 orig_bindir="$bindir"
250 orig_sbindir="$sbindir"
251 orig_libdir="$libdir"
252 orig_libexecdir="$libexecdir"
253 orig_datarootdir="$datarootdir"
254 orig_datadir="$datadir"
255 orig_sysconfdir="$sysconfdir"
256 orig_sharedstatedir="$sharedstatedir"
257 orig_localstatedir="$localstatedir"
258 orig_runstatedir="$runstatedir"
259 orig_includedir="$includedir"
260 orig_infodir="$infodir"
261 orig_mandir="$mandir"
262 orig_localedir="$localedir"
263 257
264 # check if a config.site exists and load it 258 # check if a config.site exists and load it
259 CONFIG_SITE_OK=0
265 if [ -n "$CONFIG_SITE" ]; then 260 if [ -n "$CONFIG_SITE" ]; then
266 # CONFIG_SITE may contain space separated file names 261 # CONFIG_SITE may contain space separated file names
267 for cs in $CONFIG_SITE; do 262 for cs in $CONFIG_SITE; do
268 printf "loading defaults from $cs... " 263 printf "loading defaults from $cs... "
269 . "$cs" 264 if [ -f "$cs" ]; then
270 echo ok 265 . "$cs"
266 echo ok
267 CONFIG_SITE_OK=1
268 break
269 else
270 echo "not found"
271 fi
271 done 272 done
272 elif [ -f "$prefix/share/config.site" ]; then 273 elif [ -f "$prefix/share/config.site" ]; then
273 printf "loading site defaults... " 274 printf "loading site defaults... "
274 . "$prefix/share/config.site" 275 . "$prefix/share/config.site"
275 echo ok 276 echo ok
277 CONFIG_SITE_OK=1
276 elif [ -f "$prefix/etc/config.site" ]; then 278 elif [ -f "$prefix/etc/config.site" ]; then
277 printf "loading site defaults... " 279 printf "loading site defaults... "
278 . "$prefix/etc/config.site" 280 . "$prefix/etc/config.site"
279 echo ok 281 echo ok
280 else 282 CONFIG_SITE_OK=1
283 fi
284
285 if [ $CONFIG_SITE_OK -eq 0 ]; then
281 # 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
282 if test "$libdir" = '${exec_prefix}/lib'; then 287 if [ "$libdir" = '${exec_prefix}/lib' ] ; then
283 if [ "$OS" = "SunOS" ]; then 288 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then
284 test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64' 289 if [ "$OS" = "SunOS" ]; then
285 else 290 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64'
286 # check if the standard libdir even exists
287 if test -d "${exec_prefix}/lib" ; then
288 :
289 else 291 else
290 # if it does not, maybe a lib32 exists 292 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64'
291 test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32'
292 fi 293 fi
293 # now check if there is a special 64bit libdir that we should use 294 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then
294 for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do 295 if [ "$OS" = "SunOS" ]; then
295 if [ $ARCH = $i ]; then 296 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32'
296 test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64' 297 else
297 break 298 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32'
298 fi 299 fi
299 done
300 fi 300 fi
301 fi 301 fi
302 fi 302 fi
303 ]]# 303 ]]#
304 ## End of unparsed content ** 304 ## End of unparsed content **
305 305
306 # generate vars.mk 306 # generate vars.mk
307 cat > "$TEMP_DIR/vars.mk" << __EOF__ 307 cat > "$TEMP_DIR/vars.mk" << __EOF__
308 prefix=$prefix
309 exec_prefix=$exec_prefix
310 bindir=$bindir
311 sbindir=$sbindir
312 libdir=$libdir
313 libexecdir=$libexecdir
314 datarootdir=$datarootdir
315 datadir=$datadir
316 sysconfdir=$sysconfdir
317 sharedstatedir=$sharedstatedir
318 localstatedir=$localstatedir
319 runstatedir=$runstatedir
320 includedir=$includedir
321 infodir=$infodir
322 mandir=$mandir
323 localedir=$localedir
324 #foreach( $var in $vars ) 308 #foreach( $var in $vars )
325 ${var.varName}=${D}${var.varName} 309 ${var.varName}=${D}${var.varName}
326 #end 310 #end
327 __EOF__ 311 __EOF__
328 312
329 # toolchain detection utilities
330 . make/toolchain.sh
331 313
332 # 314 #
333 # DEPENDENCIES 315 # DEPENDENCIES
334 # 316 #
335 317
336 # check languages 318
337 lang_c=
338 lang_cpp=
339 #foreach( $lang in $languages )
340 if detect_${lang}_compiler ; then
341 lang_${lang}=1
342 fi
343 #end
344 319
345 # create buffer for make variables required by dependencies 320 # create buffer for make variables required by dependencies
346 echo > "$TEMP_DIR/make.mk" 321 echo > "$TEMP_DIR/make.mk"
347 322
348 test_pkg_config() 323 test_pkg_config()
649 #end 624 #end
650 fi 625 fi
651 #end 626 #end
652 627
653 #foreach( $opt in $target.options ) 628 #foreach( $opt in $target.options )
654 # Option: --${opt.argument} 629 # Option: --${opt.arg}
655 if [ -z "${D}${opt.varName}" ]; then 630 if [ -z "${D}${opt.varName}" ]; then
656 echo "auto-detecting option '${opt.argument}'" 631 echo "auto-detecting option '${opt.arg}'"
657 SAVED_ERROR="$ERROR" 632 SAVED_ERROR="$ERROR"
658 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" 633 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
659 ERROR=1 634 ERROR=1
660 while true 635 while true
661 do 636 do
662 #foreach( $optdef in $opt.defaults ) 637 #foreach( $optdef in $opt.defaults )
663 #if( $optdef.platform ) 638 #if( $optdef.platform )
664 if isplatform "$optdef.platform"; then 639 if isplatform "$optdef.platform"; then
665 #end 640 #end
666 if $optdef.func ; then 641 if $optdef.func ; then
667 echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options" 642 echo " ${opt.arg}: ${optdef.valueName}" >> "$TEMP_DIR/options"
668 ERROR=0 643 ERROR=0
669 break 644 break
670 fi 645 fi
671 #if( $optdef.platform ) 646 #if( $optdef.platform )
672 fi 647 fi
674 #end 649 #end
675 break 650 break
676 done 651 done
677 if [ $ERROR -ne 0 ]; then 652 if [ $ERROR -ne 0 ]; then
678 SAVED_ERROR=1 653 SAVED_ERROR=1
679 SAVED_DEPENDENCIES_FAILED="option '${opt.argument}' $SAVED_DEPENDENCIES_FAILED" 654 SAVED_DEPENDENCIES_FAILED="option '${opt.arg}' $SAVED_DEPENDENCIES_FAILED"
680 fi 655 fi
681 ERROR="$SAVED_ERROR" 656 ERROR="$SAVED_ERROR"
682 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" 657 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
683 else 658 else
684 echo "checking option ${opt.argument} = ${D}${opt.varName}" 659 echo "checking option ${opt.arg} = ${D}${opt.varName}"
685 if false; then 660 if false; then
686 false 661 false
687 #foreach( $optval in $opt.values ) 662 #foreach( $optval in $opt.values )
688 elif [ "${D}${opt.varName}" = "${optval.value}" ]; then 663 elif [ "${D}${opt.varName}" = "${optval.value}" ]; then
689 echo " ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options 664 echo " ${opt.arg}: ${D}${opt.varName}" >> $TEMP_DIR/options
690 if $optval.func ; then 665 if $optval.func ; then
691 : 666 :
692 else 667 else
693 ERROR=1 668 ERROR=1
694 DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED" 669 DEPENDENCIES_FAILED="option '${opt.arg}' $DEPENDENCIES_FAILED"
695 fi 670 fi
696 #end 671 #end
697 else 672 else
698 echo 673 echo
699 echo "Invalid option value - usage:" 674 echo "Invalid option value - usage:"
700 echo " --${opt.argument}=${opt.valuesString}" 675 echo " --${opt.arg}=${opt.valuesString}"
701 abort_configure 676 abort_configure
702 fi 677 fi
703 fi 678 fi
704 #end 679 #end
705 680
723 abort_configure 698 abort_configure
724 fi 699 fi
725 700
726 echo "configure finished" 701 echo "configure finished"
727 echo 702 echo
728 echo "Toolchain" 703 echo "Toolchain:"
729 echo " name: $TOOLCHAIN_NAME" 704 echo " name: $TOOLCHAIN_NAME"
730 if [ -n "$TOOLCHAIN_CC" ]; then 705 if [ -n "$TOOLCHAIN_CC" ]; then
731 echo " cc: $TOOLCHAIN_CC" 706 echo " cc: $TOOLCHAIN_CC"
732 fi 707 fi
733 if [ -n "$TOOLCHAIN_CXX" ]; then 708 if [ -n "$TOOLCHAIN_CXX" ]; then
738 fi 713 fi
739 if [ -n "$TOOLCHAIN_CSTD" ]; then 714 if [ -n "$TOOLCHAIN_CSTD" ]; then
740 echo " default C std: $TOOLCHAIN_CSTD" 715 echo " default C std: $TOOLCHAIN_CSTD"
741 fi 716 fi
742 echo 717 echo
743 echo "Build Config:" 718 echo "Config:"
744 echo " prefix: $prefix" 719 #foreach( $var in $vars )
745 echo " exec_prefix: $exec_prefix" 720 #if ($var.overridable)
746 if [ "$orig_bindir" != "$bindir" ]; then 721 printf ' %-16s' '${var.arg}:'
747 echo " bindir: $bindir" 722 echo "${D}${var.varName}"
748 fi 723 #end
749 if [ "$orig_sbindir" != "$sbindir" ]; then 724 #end
750 echo " sbindir: $sbindir"
751 fi
752 if [ "$orig_libdir" != "$libdir" ]; then
753 echo " libdir: $libdir"
754 fi
755 if [ "$orig_libexecdir" != "$libexecdir" ]; then
756 echo " libexecdir: $libexecdir"
757 fi
758 if [ "$orig_datarootdir" != "$datarootdir" ]; then
759 echo " datarootdir: $datarootdir"
760 fi
761 if [ "$orig_datadir" != "$datadir" ]; then
762 echo " datadir: $datadir"
763 fi
764 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then
765 echo " sysconfdir: $sysconfdir"
766 fi
767 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then
768 echo " sharedstatedir: $sharedstatedir"
769 fi
770 if [ "$orig_localstatedir" != "$localstatedir" ]; then
771 echo " localstatedir: $localstatedir"
772 fi
773 if [ "$orig_runstatedir" != "$runstatedir" ]; then
774 echo " runstatedir: $runstatedir"
775 fi
776 if [ "$orig_includedir" != "$includedir" ]; then
777 echo " includedir: $includedir"
778 fi
779 if [ "$orig_infodir" != "$infodir" ]; then
780 echo " infodir: $infodir"
781 fi
782 if [ "$orig_mandir" != "$mandir" ]; then
783 echo " mandir: $mandir"
784 fi
785 if [ "$orig_localedir" != "$localedir" ]; then
786 echo " localedir: $localedir"
787 fi
788 #if ( $options.size() > 0 ) 725 #if ( $options.size() > 0 )
789 echo 726 echo
790 echo "Options:" 727 echo "Options:"
791 cat "$TEMP_DIR/options" 728 cat "$TEMP_DIR/options"
792 #end 729 #end
793 #if ( $features.size() > 0 ) 730 #if ( $features.size() > 0 )
794 echo 731 echo
795 echo "Features:" 732 echo "Features:"
796 #foreach( $feature in $features ) 733 #foreach( $feature in $features )
734 printf ' %-16s' '$feature.name:'
797 if [ -n "${D}${feature.varName}" ]; then 735 if [ -n "${D}${feature.varName}" ]; then
798 echo " $feature.name: on" 736 echo 'on'
799 else 737 else
800 echo " $feature.name: off" 738 echo 'off'
801 fi 739 fi
802 #end 740 #end
803 #end 741 #end
804 echo 742 echo
805 743

mercurial