| 82 |
83 |
| 83 # help text |
84 # help text |
| 84 printhelp() |
85 printhelp() |
| 85 { |
86 { |
| 86 echo "Usage: $0 [OPTIONS]..." |
87 echo "Usage: $0 [OPTIONS]..." |
| 87 cat << __EOF__ |
88 echo 'Configuration:' |
| 88 Installation directories: |
89 cat << '__EOF__' |
| 89 --prefix=PREFIX path prefix for architecture-independent files |
|
| 90 [$prefix] |
|
| 91 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
| 92 [PREFIX] |
|
| 93 |
|
| 94 --bindir=DIR user executables [EPREFIX/bin] |
|
| 95 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
| 96 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
| 97 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
| 98 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
| 99 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
| 100 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
| 101 --libdir=DIR object code libraries [EPREFIX/lib] |
|
| 102 --includedir=DIR C header files [PREFIX/include] |
|
| 103 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
| 104 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
| 105 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
| 106 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
| 107 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
| 108 |
90 |
| 109 Build Types: |
91 Build Types: |
| 110 --debug add extra compile flags for debug builds |
92 --debug add extra compile flags for debug builds |
| 111 --release add extra compile flags for release builds |
93 --release add extra compile flags for release builds |
| 112 |
94 |
| 113 __EOF__ |
95 __EOF__ |
| |
96 abort_configure |
| 114 } |
97 } |
| 115 |
98 |
| 116 # create temporary directory |
99 # create temporary directory |
| 117 TEMP_DIR=".tmp-`uname -n`" |
100 TEMP_DIR=".tmp-`uname -n`" |
| 118 rm -Rf "$TEMP_DIR" |
101 rm -Rf "$TEMP_DIR" |
| 124 exit 1 |
107 exit 1 |
| 125 fi |
108 fi |
| 126 touch "$TEMP_DIR/options" |
109 touch "$TEMP_DIR/options" |
| 127 touch "$TEMP_DIR/features" |
110 touch "$TEMP_DIR/features" |
| 128 |
111 |
| 129 # define standard variables |
112 # config variables |
| 130 # also define standard prefix (this is where we will search for config.site) |
|
| 131 prefix=/usr |
|
| 132 exec_prefix= |
|
| 133 bindir= |
|
| 134 sbindir= |
|
| 135 libdir= |
|
| 136 libexecdir= |
|
| 137 datarootdir= |
|
| 138 datadir= |
|
| 139 sysconfdir= |
|
| 140 sharedstatedir= |
|
| 141 localstatedir= |
|
| 142 runstatedir= |
|
| 143 includedir= |
|
| 144 infodir= |
|
| 145 localedir= |
|
| 146 mandir= |
|
| 147 |
|
| 148 # custom variables |
|
| 149 |
113 |
| 150 # features |
114 # features |
| 151 |
115 |
| 152 # |
116 # |
| 153 # parse arguments |
117 # parse arguments |
| 154 # |
118 # |
| 155 BUILD_TYPE="default" |
119 BUILD_TYPE="default" |
| 156 for ARG in "$@" |
120 for ARG in "$@" |
| 157 do |
121 do |
| 158 case "$ARG" in |
122 case "$ARG" in |
| 159 "--prefix="*) prefix=${ARG#--prefix=} ;; |
123 "--help"*) printhelp ;; |
| 160 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
124 "--debug") BUILD_TYPE="debug" ;; |
| 161 "--bindir="*) bindir=${ARG#----bindir=} ;; |
125 "--release") BUILD_TYPE="release" ;; |
| 162 "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
|
| 163 "--libdir="*) libdir=${ARG#--libdir=} ;; |
|
| 164 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
|
| 165 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
|
| 166 "--datadir="*) datadir=${ARG#--datadir=} ;; |
|
| 167 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
|
| 168 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
|
| 169 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
|
| 170 "--includedir="*) includedir=${ARG#--includedir=} ;; |
|
| 171 "--infodir="*) infodir=${ARG#--infodir=} ;; |
|
| 172 "--mandir"*) mandir=${ARG#--mandir} ;; |
|
| 173 "--localedir"*) localedir=${ARG#--localedir} ;; |
|
| 174 "--help"*) printhelp; abort_configure ;; |
|
| 175 "--debug") BUILD_TYPE="debug" ;; |
|
| 176 "--release") BUILD_TYPE="release" ;; |
|
| 177 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
126 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
| 178 esac |
127 esac |
| 179 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 |
| 180 |
139 |
| 181 |
140 |
| 182 |
141 |
| 183 # set defaults for dir variables |
142 # set defaults for dir variables |
| 184 : ${exec_prefix:="$prefix"} |
143 : ${exec_prefix:="$prefix"} |
| 186 : ${sbindir:='${exec_prefix}/sbin'} |
145 : ${sbindir:='${exec_prefix}/sbin'} |
| 187 : ${libdir:='${exec_prefix}/lib'} |
146 : ${libdir:='${exec_prefix}/lib'} |
| 188 : ${libexecdir:='${exec_prefix}/libexec'} |
147 : ${libexecdir:='${exec_prefix}/libexec'} |
| 189 : ${datarootdir:='${prefix}/share'} |
148 : ${datarootdir:='${prefix}/share'} |
| 190 : ${datadir:='${datarootdir}'} |
149 : ${datadir:='${datarootdir}'} |
| 191 : ${sysconfdir:='${prefix}/etc'} |
|
| 192 : ${sharedstatedir:='${prefix}/com'} |
150 : ${sharedstatedir:='${prefix}/com'} |
| 193 : ${localstatedir:='${prefix}/var'} |
151 if [ -z "$sysconfdir" ]; then |
| 194 : ${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 |
| 195 : ${includedir:='${prefix}/include'} |
172 : ${includedir:='${prefix}/include'} |
| 196 : ${infodir:='${datarootdir}/info'} |
173 : ${infodir:='${datarootdir}/info'} |
| 197 : ${mandir:='${datarootdir}/man'} |
174 : ${mandir:='${datarootdir}/man'} |
| 198 : ${localedir:='${datarootdir}/locale'} |
175 : ${localedir:='${datarootdir}/locale'} |
| 199 |
176 |
| 200 # remember the above values and compare them later |
|
| 201 orig_bindir="$bindir" |
|
| 202 orig_sbindir="$sbindir" |
|
| 203 orig_libdir="$libdir" |
|
| 204 orig_libexecdir="$libexecdir" |
|
| 205 orig_datarootdir="$datarootdir" |
|
| 206 orig_datadir="$datadir" |
|
| 207 orig_sysconfdir="$sysconfdir" |
|
| 208 orig_sharedstatedir="$sharedstatedir" |
|
| 209 orig_localstatedir="$localstatedir" |
|
| 210 orig_runstatedir="$runstatedir" |
|
| 211 orig_includedir="$includedir" |
|
| 212 orig_infodir="$infodir" |
|
| 213 orig_mandir="$mandir" |
|
| 214 orig_localedir="$localedir" |
|
| 215 |
177 |
| 216 # check if a config.site exists and load it |
178 # check if a config.site exists and load it |
| |
179 CONFIG_SITE_OK=0 |
| 217 if [ -n "$CONFIG_SITE" ]; then |
180 if [ -n "$CONFIG_SITE" ]; then |
| 218 # CONFIG_SITE may contain space separated file names |
181 # CONFIG_SITE may contain space separated file names |
| 219 for cs in $CONFIG_SITE; do |
182 for cs in $CONFIG_SITE; do |
| 220 printf "loading defaults from $cs... " |
183 printf "loading defaults from $cs... " |
| 221 . "$cs" |
184 if [ -f "$cs" ]; then |
| 222 echo ok |
185 . "$cs" |
| |
186 echo ok |
| |
187 CONFIG_SITE_OK=1 |
| |
188 break |
| |
189 else |
| |
190 echo "not found" |
| |
191 fi |
| 223 done |
192 done |
| 224 elif [ -f "$prefix/share/config.site" ]; then |
193 elif [ -f "$prefix/share/config.site" ]; then |
| 225 printf "loading site defaults... " |
194 printf "loading site defaults... " |
| 226 . "$prefix/share/config.site" |
195 . "$prefix/share/config.site" |
| 227 echo ok |
196 echo ok |
| |
197 CONFIG_SITE_OK=1 |
| 228 elif [ -f "$prefix/etc/config.site" ]; then |
198 elif [ -f "$prefix/etc/config.site" ]; then |
| 229 printf "loading site defaults... " |
199 printf "loading site defaults... " |
| 230 . "$prefix/etc/config.site" |
200 . "$prefix/etc/config.site" |
| 231 echo ok |
201 echo ok |
| |
202 CONFIG_SITE_OK=1 |
| |
203 fi |
| |
204 |
| |
205 if [ $CONFIG_SITE_OK -eq 0 ]; then |
| |
206 # try to detect the correct libdir on our own, except it was changed by the user |
| |
207 if [ "$libdir" = '${exec_prefix}/lib' ] ; then |
| |
208 if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then |
| |
209 if [ "$OS" = "SunOS" ]; then |
| |
210 [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64' |
| |
211 else |
| |
212 [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64' |
| |
213 fi |
| |
214 elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then |
| |
215 if [ "$OS" = "SunOS" ]; then |
| |
216 [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32' |
| |
217 else |
| |
218 [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32' |
| |
219 fi |
| |
220 fi |
| |
221 fi |
| 232 fi |
222 fi |
| 233 |
223 |
| 234 |
224 |
| 235 # generate vars.mk |
225 # generate vars.mk |
| 236 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
226 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
| 237 prefix=$prefix |
|
| 238 exec_prefix=$exec_prefix |
|
| 239 bindir=$bindir |
|
| 240 sbindir=$sbindir |
|
| 241 libdir=$libdir |
|
| 242 libexecdir=$libexecdir |
|
| 243 datarootdir=$datarootdir |
|
| 244 datadir=$datadir |
|
| 245 sysconfdir=$sysconfdir |
|
| 246 sharedstatedir=$sharedstatedir |
|
| 247 localstatedir=$localstatedir |
|
| 248 runstatedir=$runstatedir |
|
| 249 includedir=$includedir |
|
| 250 infodir=$infodir |
|
| 251 mandir=$mandir |
|
| 252 localedir=$localedir |
|
| 253 __EOF__ |
227 __EOF__ |
| 254 |
228 |
| 255 # toolchain detection utilities |
|
| 256 . make/toolchain.sh |
|
| 257 |
229 |
| 258 # |
230 # |
| 259 # DEPENDENCIES |
231 # DEPENDENCIES |
| 260 # |
232 # |
| 261 |
233 |
| 262 # check languages |
234 |
| 263 lang_c= |
|
| 264 lang_cpp= |
|
| 265 if detect_c_compiler ; then |
|
| 266 lang_c=1 |
|
| 267 fi |
|
| 268 |
235 |
| 269 # create buffer for make variables required by dependencies |
236 # create buffer for make variables required by dependencies |
| 270 echo > "$TEMP_DIR/make.mk" |
237 echo > "$TEMP_DIR/make.mk" |
| 271 |
238 |
| 272 test_pkg_config() |
239 test_pkg_config() |
| 677 fi |
644 fi |
| 678 if [ -n "$TOOLCHAIN_CSTD" ]; then |
645 if [ -n "$TOOLCHAIN_CSTD" ]; then |
| 679 echo " default C std: $TOOLCHAIN_CSTD" |
646 echo " default C std: $TOOLCHAIN_CSTD" |
| 680 fi |
647 fi |
| 681 echo |
648 echo |
| 682 echo "Build Config:" |
649 echo "Config:" |
| 683 echo " prefix: $prefix" |
|
| 684 echo " exec_prefix: $exec_prefix" |
|
| 685 if [ "$orig_bindir" != "$bindir" ]; then |
|
| 686 echo " bindir: $bindir" |
|
| 687 fi |
|
| 688 if [ "$orig_sbindir" != "$sbindir" ]; then |
|
| 689 echo " sbindir: $sbindir" |
|
| 690 fi |
|
| 691 if [ "$orig_libdir" != "$libdir" ]; then |
|
| 692 echo " libdir: $libdir" |
|
| 693 fi |
|
| 694 if [ "$orig_libexecdir" != "$libexecdir" ]; then |
|
| 695 echo " libexecdir: $libexecdir" |
|
| 696 fi |
|
| 697 if [ "$orig_datarootdir" != "$datarootdir" ]; then |
|
| 698 echo " datarootdir: $datarootdir" |
|
| 699 fi |
|
| 700 if [ "$orig_datadir" != "$datadir" ]; then |
|
| 701 echo " datadir: $datadir" |
|
| 702 fi |
|
| 703 if [ "$orig_sysconfdir" != "$sysconfdir" ]; then |
|
| 704 echo " sysconfdir: $sysconfdir" |
|
| 705 fi |
|
| 706 if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then |
|
| 707 echo " sharedstatedir: $sharedstatedir" |
|
| 708 fi |
|
| 709 if [ "$orig_localstatedir" != "$localstatedir" ]; then |
|
| 710 echo " localstatedir: $localstatedir" |
|
| 711 fi |
|
| 712 if [ "$orig_runstatedir" != "$runstatedir" ]; then |
|
| 713 echo " runstatedir: $runstatedir" |
|
| 714 fi |
|
| 715 if [ "$orig_includedir" != "$includedir" ]; then |
|
| 716 echo " includedir: $includedir" |
|
| 717 fi |
|
| 718 if [ "$orig_infodir" != "$infodir" ]; then |
|
| 719 echo " infodir: $infodir" |
|
| 720 fi |
|
| 721 if [ "$orig_mandir" != "$mandir" ]; then |
|
| 722 echo " mandir: $mandir" |
|
| 723 fi |
|
| 724 if [ "$orig_localedir" != "$localedir" ]; then |
|
| 725 echo " localedir: $localedir" |
|
| 726 fi |
|
| 727 echo |
650 echo |
| 728 |
651 |
| 729 # generate the config.mk file |
652 # generate the config.mk file |
| 730 pwd=`pwd` |
653 pwd=`pwd` |
| 731 cat > "$TEMP_DIR/config.mk" << __EOF__ |
654 cat > "$TEMP_DIR/config.mk" << __EOF__ |