configure

changeset 87
84f94d476934
parent 86
db21aab20169
equal deleted inserted replaced
86:db21aab20169 87:84f94d476934
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 cat << '__EOF__'
90 --prefix=PREFIX path prefix for architecture-independent files
91 [$prefix]
92 --exec-prefix=EPREFIX path prefix for architecture-dependent files
93 [PREFIX]
94
95 --bindir=DIR user executables [EPREFIX/bin]
96 --sbindir=DIR system admin executables [EPREFIX/sbin]
97 --libexecdir=DIR program executables [EPREFIX/libexec]
98 --sysconfdir=DIR system configuration files [PREFIX/etc]
99 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
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 90
110 Build Types: 91 Build Types:
111 --debug add extra compile flags for debug builds 92 --debug add extra compile flags for debug builds
112 --release add extra compile flags for release builds 93 --release add extra compile flags for release builds
113 94
114 __EOF__ 95 __EOF__
96 abort_configure
115 } 97 }
116 98
117 # create temporary directory 99 # create temporary directory
118 TEMP_DIR=".tmp-`uname -n`" 100 TEMP_DIR=".tmp-`uname -n`"
119 rm -Rf "$TEMP_DIR" 101 rm -Rf "$TEMP_DIR"
125 exit 1 107 exit 1
126 fi 108 fi
127 touch "$TEMP_DIR/options" 109 touch "$TEMP_DIR/options"
128 touch "$TEMP_DIR/features" 110 touch "$TEMP_DIR/features"
129 111
130 # define standard variables 112 # config variables
131 # also define standard prefix (this is where we will search for config.site)
132 prefix=/usr
133 exec_prefix=
134 bindir=
135 sbindir=
136 libdir=
137 libexecdir=
138 datarootdir=
139 datadir=
140 sysconfdir=
141 sharedstatedir=
142 localstatedir=
143 runstatedir=
144 includedir=
145 infodir=
146 localedir=
147 mandir=
148
149 # custom variables
150 113
151 # features 114 # features
152 115
153 # 116 #
154 # parse arguments 117 # parse arguments
155 # 118 #
156 BUILD_TYPE="default" 119 BUILD_TYPE="default"
157 for ARG in "$@" 120 for ARG in "$@"
158 do 121 do
159 case "$ARG" in 122 case "$ARG" in
160 "--prefix="*) prefix=${ARG#--prefix=} ;; 123 "--help"*) printhelp ;;
161 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; 124 "--debug") BUILD_TYPE="debug" ;;
162 "--bindir="*) bindir=${ARG#----bindir=} ;; 125 "--release") BUILD_TYPE="release" ;;
163 "--sbindir="*) sbindir=${ARG#--sbindir=} ;;
164 "--libdir="*) libdir=${ARG#--libdir=} ;;
165 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;;
166 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;;
167 "--datadir="*) datadir=${ARG#--datadir=} ;;
168 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;;
169 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;;
170 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;;
171 "--includedir="*) includedir=${ARG#--includedir=} ;;
172 "--infodir="*) infodir=${ARG#--infodir=} ;;
173 "--mandir"*) mandir=${ARG#--mandir} ;;
174 "--localedir"*) localedir=${ARG#--localedir} ;;
175 "--help"*) printhelp; abort_configure ;;
176 "--debug") BUILD_TYPE="debug" ;;
177 "--release") BUILD_TYPE="release" ;;
178 "-"*) echo "unknown option: $ARG"; abort_configure ;; 126 "-"*) echo "unknown option: $ARG"; abort_configure ;;
179 esac 127 esac
180 done 128 done
129
130 # toolchain detection utilities
131 . make/toolchain.sh
132
133 # check languages
134 lang_c=
135 lang_cpp=
136 if detect_c_compiler ; then
137 lang_c=1
138 fi
181 139
182 140
183 141
184 # set defaults for dir variables 142 # set defaults for dir variables
185 : ${exec_prefix:="$prefix"} 143 : ${exec_prefix:="$prefix"}
187 : ${sbindir:='${exec_prefix}/sbin'} 145 : ${sbindir:='${exec_prefix}/sbin'}
188 : ${libdir:='${exec_prefix}/lib'} 146 : ${libdir:='${exec_prefix}/lib'}
189 : ${libexecdir:='${exec_prefix}/libexec'} 147 : ${libexecdir:='${exec_prefix}/libexec'}
190 : ${datarootdir:='${prefix}/share'} 148 : ${datarootdir:='${prefix}/share'}
191 : ${datadir:='${datarootdir}'} 149 : ${datadir:='${datarootdir}'}
192 : ${sysconfdir:='${prefix}/etc'}
193 : ${sharedstatedir:='${prefix}/com'} 150 : ${sharedstatedir:='${prefix}/com'}
194 : ${localstatedir:='${prefix}/var'} 151 if [ -z "$sysconfdir" ]; then
195 : ${runstatedir:='${localstatedir}/run'} 152 if [ "$prefix" = '/usr' ]; then
153 sysconfdir='/etc'
154 else
155 sysconfdir='${prefix}/etc'
156 fi
157 fi
158 if [ -z "$localstatedir" ]; then
159 if [ "$prefix" = '/usr' ]; then
160 localstatedir='/var'
161 else
162 localstatedir='${prefix}/var'
163 fi
164 fi
165 if [ -z "$runstatedir" ]; then
166 if [ "$prefix" = '/usr' ]; then
167 runstatedir='/var/run'
168 else
169 runstatedir='${prefix}/var'
170 fi
171 fi
196 : ${includedir:='${prefix}/include'} 172 : ${includedir:='${prefix}/include'}
197 : ${infodir:='${datarootdir}/info'} 173 : ${infodir:='${datarootdir}/info'}
198 : ${mandir:='${datarootdir}/man'} 174 : ${mandir:='${datarootdir}/man'}
199 : ${localedir:='${datarootdir}/locale'} 175 : ${localedir:='${datarootdir}/locale'}
200 176
201 # remember the above values and compare them later
202 orig_bindir="$bindir"
203 orig_sbindir="$sbindir"
204 orig_libdir="$libdir"
205 orig_libexecdir="$libexecdir"
206 orig_datarootdir="$datarootdir"
207 orig_datadir="$datadir"
208 orig_sysconfdir="$sysconfdir"
209 orig_sharedstatedir="$sharedstatedir"
210 orig_localstatedir="$localstatedir"
211 orig_runstatedir="$runstatedir"
212 orig_includedir="$includedir"
213 orig_infodir="$infodir"
214 orig_mandir="$mandir"
215 orig_localedir="$localedir"
216 177
217 # check if a config.site exists and load it 178 # check if a config.site exists and load it
179 CONFIG_SITE_OK=0
218 if [ -n "$CONFIG_SITE" ]; then 180 if [ -n "$CONFIG_SITE" ]; then
219 # CONFIG_SITE may contain space separated file names 181 # CONFIG_SITE may contain space separated file names
220 for cs in $CONFIG_SITE; do 182 for cs in $CONFIG_SITE; do
221 printf "loading defaults from $cs... " 183 printf "loading defaults from $cs... "
222 . "$cs" 184 if [ -f "$cs" ]; then
223 echo ok 185 . "$cs"
186 echo ok
187 CONFIG_SITE_OK=1
188 break
189 else
190 echo "not found"
191 fi
224 done 192 done
225 elif [ -f "$prefix/share/config.site" ]; then 193 elif [ -f "$prefix/share/config.site" ]; then
226 printf "loading site defaults... " 194 printf "loading site defaults... "
227 . "$prefix/share/config.site" 195 . "$prefix/share/config.site"
228 echo ok 196 echo ok
197 CONFIG_SITE_OK=1
229 elif [ -f "$prefix/etc/config.site" ]; then 198 elif [ -f "$prefix/etc/config.site" ]; then
230 printf "loading site defaults... " 199 printf "loading site defaults... "
231 . "$prefix/etc/config.site" 200 . "$prefix/etc/config.site"
232 echo ok 201 echo ok
233 else 202 CONFIG_SITE_OK=1
203 fi
204
205 if [ $CONFIG_SITE_OK -eq 0 ]; then
234 # try to detect the correct libdir on our own, except it was changed by the user 206 # try to detect the correct libdir on our own, except it was changed by the user
235 if test "$libdir" = '${exec_prefix}/lib'; then 207 if [ "$libdir" = '${exec_prefix}/lib' ] ; then
236 if [ "$OS" = "SunOS" ]; then 208 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then
237 test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64' 209 if [ "$OS" = "SunOS" ]; then
238 else 210 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64'
239 # check if the standard libdir even exists
240 if test -d "${exec_prefix}/lib" ; then
241 :
242 else 211 else
243 # if it does not, maybe a lib32 exists 212 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64'
244 test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32'
245 fi 213 fi
246 # now check if there is a special 64bit libdir that we should use 214 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then
247 for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do 215 if [ "$OS" = "SunOS" ]; then
248 if [ $ARCH = $i ]; then 216 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32'
249 test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64' 217 else
250 break 218 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32'
251 fi 219 fi
252 done
253 fi 220 fi
254 fi 221 fi
255 fi 222 fi
256 223
257 224
258 # generate vars.mk 225 # generate vars.mk
259 cat > "$TEMP_DIR/vars.mk" << __EOF__ 226 cat > "$TEMP_DIR/vars.mk" << __EOF__
260 prefix=$prefix
261 exec_prefix=$exec_prefix
262 bindir=$bindir
263 sbindir=$sbindir
264 libdir=$libdir
265 libexecdir=$libexecdir
266 datarootdir=$datarootdir
267 datadir=$datadir
268 sysconfdir=$sysconfdir
269 sharedstatedir=$sharedstatedir
270 localstatedir=$localstatedir
271 runstatedir=$runstatedir
272 includedir=$includedir
273 infodir=$infodir
274 mandir=$mandir
275 localedir=$localedir
276 __EOF__ 227 __EOF__
277 228
278 # toolchain detection utilities
279 . make/toolchain.sh
280 229
281 # 230 #
282 # DEPENDENCIES 231 # DEPENDENCIES
283 # 232 #
284 233
285 # check languages 234
286 lang_c=
287 lang_cpp=
288 if detect_c_compiler ; then
289 lang_c=1
290 fi
291 235
292 # create buffer for make variables required by dependencies 236 # create buffer for make variables required by dependencies
293 echo > "$TEMP_DIR/make.mk" 237 echo > "$TEMP_DIR/make.mk"
294 238
295 test_pkg_config() 239 test_pkg_config()
397 abort_configure 341 abort_configure
398 fi 342 fi
399 343
400 echo "configure finished" 344 echo "configure finished"
401 echo 345 echo
402 echo "Toolchain" 346 echo "Toolchain:"
403 echo " name: $TOOLCHAIN_NAME" 347 echo " name: $TOOLCHAIN_NAME"
404 if [ -n "$TOOLCHAIN_CC" ]; then 348 if [ -n "$TOOLCHAIN_CC" ]; then
405 echo " cc: $TOOLCHAIN_CC" 349 echo " cc: $TOOLCHAIN_CC"
406 fi 350 fi
407 if [ -n "$TOOLCHAIN_CXX" ]; then 351 if [ -n "$TOOLCHAIN_CXX" ]; then
412 fi 356 fi
413 if [ -n "$TOOLCHAIN_CSTD" ]; then 357 if [ -n "$TOOLCHAIN_CSTD" ]; then
414 echo " default C std: $TOOLCHAIN_CSTD" 358 echo " default C std: $TOOLCHAIN_CSTD"
415 fi 359 fi
416 echo 360 echo
417 echo "Build Config:" 361 echo "Config:"
418 echo " prefix: $prefix"
419 echo " exec_prefix: $exec_prefix"
420 if [ "$orig_bindir" != "$bindir" ]; then
421 echo " bindir: $bindir"
422 fi
423 if [ "$orig_sbindir" != "$sbindir" ]; then
424 echo " sbindir: $sbindir"
425 fi
426 if [ "$orig_libdir" != "$libdir" ]; then
427 echo " libdir: $libdir"
428 fi
429 if [ "$orig_libexecdir" != "$libexecdir" ]; then
430 echo " libexecdir: $libexecdir"
431 fi
432 if [ "$orig_datarootdir" != "$datarootdir" ]; then
433 echo " datarootdir: $datarootdir"
434 fi
435 if [ "$orig_datadir" != "$datadir" ]; then
436 echo " datadir: $datadir"
437 fi
438 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then
439 echo " sysconfdir: $sysconfdir"
440 fi
441 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then
442 echo " sharedstatedir: $sharedstatedir"
443 fi
444 if [ "$orig_localstatedir" != "$localstatedir" ]; then
445 echo " localstatedir: $localstatedir"
446 fi
447 if [ "$orig_runstatedir" != "$runstatedir" ]; then
448 echo " runstatedir: $runstatedir"
449 fi
450 if [ "$orig_includedir" != "$includedir" ]; then
451 echo " includedir: $includedir"
452 fi
453 if [ "$orig_infodir" != "$infodir" ]; then
454 echo " infodir: $infodir"
455 fi
456 if [ "$orig_mandir" != "$mandir" ]; then
457 echo " mandir: $mandir"
458 fi
459 if [ "$orig_localedir" != "$localedir" ]; then
460 echo " localedir: $localedir"
461 fi
462 echo 362 echo
463 363
464 # generate the config.mk file 364 # generate the config.mk file
465 pwd=`pwd` 365 pwd=`pwd`
466 cat > "$TEMP_DIR/config.mk" << __EOF__ 366 cat > "$TEMP_DIR/config.mk" << __EOF__

mercurial