configure

changeset 74
ed9a5ffd1f13
parent 68
ae763178ee1e
equal deleted inserted replaced
73:b383b1b61cbf 74:ed9a5ffd1f13
12 fi 12 fi
13 touch "$TEMP_DIR/options" 13 touch "$TEMP_DIR/options"
14 touch "$TEMP_DIR/features" 14 touch "$TEMP_DIR/features"
15 15
16 # define standard variables 16 # define standard variables
17 PREFIX=/usr 17 # also define standard prefix (this is where we will search for config.site)
18 EPREFIX= 18 prefix=/usr
19 BINDIR= 19 exec_prefix=
20 SBINDIR= 20 bindir=
21 LIBDIR= 21 sbindir=
22 LIBEXECDIR= 22 libdir=
23 DATADIR= 23 libexecdir=
24 SYSCONFDIR= 24 datarootdir=
25 SHAREDSTATEDIR= 25 datadir=
26 LOCALSTATEDIR= 26 sysconfdir=
27 INCLUDEDIR= 27 sharedstatedir=
28 INFODIR= 28 localstatedir=
29 MANDIR= 29 runstatedir=
30 includedir=
31 infodir=
32 localedir=
33 mandir=
30 34
31 # custom variables 35 # custom variables
32 36
33 # features 37 # features
34 38
54 --sbindir=DIR system admin executables [EPREFIX/sbin] 58 --sbindir=DIR system admin executables [EPREFIX/sbin]
55 --libexecdir=DIR program executables [EPREFIX/libexec] 59 --libexecdir=DIR program executables [EPREFIX/libexec]
56 --sysconfdir=DIR system configuration files [PREFIX/etc] 60 --sysconfdir=DIR system configuration files [PREFIX/etc]
57 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 61 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
58 --localstatedir=DIR modifiable single-machine data [PREFIX/var] 62 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
63 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run]
59 --libdir=DIR object code libraries [EPREFIX/lib] 64 --libdir=DIR object code libraries [EPREFIX/lib]
60 --includedir=DIR C header files [PREFIX/include] 65 --includedir=DIR C header files [PREFIX/include]
61 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 66 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
62 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 67 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
63 --infodir=DIR info documentation [DATAROOTDIR/info] 68 --infodir=DIR info documentation [DATAROOTDIR/info]
64 --mandir=DIR man documentation [DATAROOTDIR/man] 69 --mandir=DIR man documentation [DATAROOTDIR/man]
70 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
65 71
66 __EOF__ 72 __EOF__
67 } 73 }
68 74
69 # 75 #
71 # 77 #
72 BUILD_TYPE="default" 78 BUILD_TYPE="default"
73 for ARG in "$@" 79 for ARG in "$@"
74 do 80 do
75 case "$ARG" in 81 case "$ARG" in
76 "--prefix="*) PREFIX=${ARG#--prefix=} ;; 82 "--prefix="*) prefix=${ARG#--prefix=} ;;
77 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; 83 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;;
78 "--bindir="*) BINDIR=${ARG#----bindir=} ;; 84 "--bindir="*) bindir=${ARG#----bindir=} ;;
79 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; 85 "--sbindir="*) sbindir=${ARG#--sbindir=} ;;
80 "--libdir="*) LIBDIR=${ARG#--libdir=} ;; 86 "--libdir="*) libdir=${ARG#--libdir=} ;;
81 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; 87 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;;
82 "--datadir="*) DATADIR=${ARG#--datadir=} ;; 88 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;;
83 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; 89 "--datadir="*) datadir=${ARG#--datadir=} ;;
84 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; 90 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;;
85 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; 91 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;;
86 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; 92 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;;
87 "--infodir="*) INFODIR=${ARG#--infodir=} ;; 93 "--includedir="*) includedir=${ARG#--includedir=} ;;
88 "--mandir"*) MANDIR=${ARG#--mandir} ;; 94 "--infodir="*) infodir=${ARG#--infodir=} ;;
95 "--mandir"*) mandir=${ARG#--mandir} ;;
96 "--localedir"*) localedir=${ARG#--localedir} ;;
89 "--help"*) printhelp; abort_configure ;; 97 "--help"*) printhelp; abort_configure ;;
90 "--debug") BUILD_TYPE="debug" ;; 98 "--debug") BUILD_TYPE="debug" ;;
91 "--release") BUILD_TYPE="release" ;; 99 "--release") BUILD_TYPE="release" ;;
92 "-"*) echo "unknown option: $ARG"; abort_configure ;; 100 "-"*) echo "unknown option: $ARG"; abort_configure ;;
93 esac 101 esac
94 done 102 done
95 103
96 104
97 # set dir variables 105
98 : ${EPREFIX:="$PREFIX"} 106 # set defaults for dir variables
99 : ${BINDIR:="$EPREFIX/bin"} 107 : ${exec_prefix:="$prefix"}
100 : ${SBINDIR:="$EPREFIX/sbin"} 108 : ${bindir:='${exec_prefix}/bin'}
101 : ${LIBDIR:="$EPREFIX/lib"} 109 : ${sbindir:='${exec_prefix}/sbin'}
102 : ${LIBEXECDIR:="$EPREFIX/libexec"} 110 : ${libdir:='${exec_prefix}/lib'}
103 : ${DATADIR:="$PREFIX/share"} 111 : ${libexecdir:='${exec_prefix}/libexec'}
104 : ${SYSCONFDIR:="$PREFIX/etc"} 112 : ${datarootdir:='${prefix}/share'}
105 : ${SHAREDSTATEDIR:="$PREFIX/com"} 113 : ${datadir:='${datarootdir}'}
106 : ${LOCALSTATEDIR:="$PREFIX/var"} 114 : ${sysconfdir:='${prefix}/etc'}
107 : ${INCLUDEDIR:="$PREFIX/include"} 115 : ${sharedstatedir:='${prefix}/com'}
108 : ${INFODIR:="$PREFIX/info"} 116 : ${localstatedir:='${prefix}/var'}
109 : ${MANDIR:="$PREFIX/man"} 117 : ${runstatedir:='${localstatedir}/run'}
118 : ${includedir:='${prefix}/include'}
119 : ${infodir:='${datarootdir}/info'}
120 : ${mandir:='${datarootdir}/man'}
121 : ${localedir:='${datarootdir}/locale'}
122
123 # check if a config.site exists and load it
124 if [ -n "$CONFIG_SITE" ]; then
125 # CONFIG_SITE may contain space separated file names
126 for cs in $CONFIG_SITE; do
127 printf "loading defaults from $cs... "
128 . "$cs"
129 echo ok
130 done
131 elif [ -f "$prefix/share/config.site" ]; then
132 printf "loading site defaults... "
133 . "$prefix/share/config.site"
134 echo ok
135 elif [ -f "$prefix/etc/config.site" ]; then
136 printf "loading site defaults... "
137 . "$prefix/etc/config.site"
138 echo ok
139 fi
110 140
111 # Test for availability of pkg-config 141 # Test for availability of pkg-config
112 PKG_CONFIG=`command -v pkg-config` 142 PKG_CONFIG=`command -v pkg-config`
113 : ${PKG_CONFIG:="false"} 143 : ${PKG_CONFIG:="false"}
114 144
159 } 189 }
160 190
161 191
162 # generate vars.mk 192 # generate vars.mk
163 cat > "$TEMP_DIR/vars.mk" << __EOF__ 193 cat > "$TEMP_DIR/vars.mk" << __EOF__
164 PREFIX=$PREFIX 194 prefix="$prefix"
165 EPREFIX=$EPREFIX 195 exec_prefix="$exec_prefix"
166 BINDIR=$BINDIR 196 bindir="$bindir"
167 SBINDIR=$SBINDIR 197 sbindir="$sbindir"
168 LIBDIR=$LIBDIR 198 libdir="$libdir"
169 LIBEXECDIR=$LIBEXECDIR 199 libexecdir="$libexecdir"
170 DATADIR=$DATADIR 200 datarootdir="$datarootdir"
171 SYSCONFDIR=$SYSCONFDIR 201 datadir="$datadir"
172 SHAREDSTATEDIR=$SHAREDSTATEDIR 202 sysconfdir="$sysconfdir"
173 LOCALSTATEDIR=$LOCALSTATEDIR 203 sharedstatedir="$sharedstatedir"
174 INCLUDEDIR=$INCLUDEDIR 204 localstatedir="$localstatedir"
175 INFODIR=$INFODIR 205 runstatedir="$runstatedir"
176 MANDIR=$MANDIR 206 includedir="$includedir"
207 infodir="$infodir"
208 mandir="$mandir"
209 localedir="$localedir"
177 __EOF__ 210 __EOF__
178 sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
179
180 211
181 # toolchain detection utilities 212 # toolchain detection utilities
182 . make/toolchain.sh 213 . make/toolchain.sh
183 214
184 # 215 #
235 break 266 break
236 done 267 done
237 268
238 # add general dependency flags to flags.mk 269 # add general dependency flags to flags.mk
239 echo "# general flags" >> "$TEMP_DIR/flags.mk" 270 echo "# general flags" >> "$TEMP_DIR/flags.mk"
240 if [ -n "${TEMP_CFLAGS}" ]; then 271 if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
241 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 272 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
242 fi 273 fi
243 if [ -n "${TEMP_CXXFLAGS}" ]; then 274 if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
244 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 275 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
245 fi 276 fi
246 if [ -n "${TEMP_LDFLAGS}" ]; then 277 if [ -n "${TEMP_LDFLAGS}" ]; then
247 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" 278 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
248 fi 279 fi
254 # 285 #
255 # TARGETS 286 # TARGETS
256 # 287 #
257 288
258 echo >> "$TEMP_DIR/flags.mk" 289 echo >> "$TEMP_DIR/flags.mk"
259 # Target: default 290 echo "configuring target: default"
260 echo "# flags for target default" >> "$TEMP_DIR/flags.mk" 291 echo "# flags for target default" >> "$TEMP_DIR/flags.mk"
261 TEMP_CFLAGS= 292 TEMP_CFLAGS=
262 TEMP_CXXFLAGS= 293 TEMP_CXXFLAGS=
263 TEMP_LDFLAGS= 294 TEMP_LDFLAGS=
264 295
265 296
266 # Features 297 # Features
267 298
268 299
269 if [ -n "${TEMP_CFLAGS}" ]; then 300 if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
270 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 301 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
271 fi 302 fi
272 if [ -n "${TEMP_CXXFLAGS}" ]; then 303 if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
273 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 304 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
274 fi 305 fi
275 if [ "$BUILD_TYPE" = "debug" ]; then 306 if [ "$BUILD_TYPE" = "debug" ]; then
276 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" 307 if [ -n "$lang_c" ]; then
277 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" 308 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
309 fi
310 if [ -n "$lang_cpp" ]; then
311 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
312 fi
278 fi 313 fi
279 if [ "$BUILD_TYPE" = "release" ]; then 314 if [ "$BUILD_TYPE" = "release" ]; then
280 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" 315 if [ -n "$lang_c" ]; then
281 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" 316 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
317 fi
318 if [ -n "$lang_cpp" ]; then
319 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
320 fi
282 fi 321 fi
283 if [ -n "${TEMP_LDFLAGS}" ]; then 322 if [ -n "${TEMP_LDFLAGS}" ]; then
284 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" 323 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
285 fi 324 fi
286 325
294 fi 333 fi
295 334
296 echo "configure finished" 335 echo "configure finished"
297 echo 336 echo
298 echo "Build Config:" 337 echo "Build Config:"
299 echo " PREFIX: $PREFIX" 338 echo " PREFIX: $prefix"
300 echo " TOOLCHAIN: $TOOLCHAIN_NAME" 339 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
301 echo 340 echo
302 341
303 # generate the config.mk file 342 # generate the config.mk file
304 cat > "$TEMP_DIR/config.mk" << __EOF__ 343 cat > "$TEMP_DIR/config.mk" << __EOF__
305 # 344 #

mercurial