81 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; |
89 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; |
82 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; |
90 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; |
83 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; |
91 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; |
84 "--infodir="*) INFODIR=${ARG#--infodir=} ;; |
92 "--infodir="*) INFODIR=${ARG#--infodir=} ;; |
85 "--mandir"*) MANDIR=${ARG#--mandir} ;; |
93 "--mandir"*) MANDIR=${ARG#--mandir} ;; |
86 "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; |
94 "--help"*) printhelp; abort_configure ;; |
87 "--debug") BUILD_TYPE="debug" ;; |
95 "--debug") BUILD_TYPE="debug" ;; |
88 "--release") BUILD_TYPE="release" ;; |
96 "--release") BUILD_TYPE="release" ;; |
89 "--enable-pg") FEATURE_PG=on ;; |
97 "--enable-pg") FEATURE_PG=on ;; |
90 "--disable-pg") unset FEATURE_PG ;; |
98 "--disable-pg") unset FEATURE_PG ;; |
91 "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; |
99 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
92 esac |
100 esac |
93 done |
101 done |
94 |
102 |
|
103 |
95 # set dir variables |
104 # set dir variables |
96 if [ -z "$BINDIR" ]; then |
105 BINDIR=${BINDIR:-"$EPREFIX/bin"} |
97 BINDIR=$EPREFIX/bin |
106 SBINDIR=${SBINDIR:-"$EPREFIX/sbin"} |
98 fi |
107 LIBDIR=${LIBDIR:-"$EPREFIX/lib"} |
99 if [ -z "$SBINDIR" ]; then |
108 LIBEXECDIR=${LIBEXECDIR:-"$EPREFIX/libexec"} |
100 SBINDIR=$EPREFIX/sbin |
109 DATADIR=${DATADIR:-"$PREFIX/share"} |
101 fi |
110 SYSCONFDIR=${SYSCONFDIR:-"$PREFIX/etc"} |
102 if [ -z "$LIBDIR" ]; then |
111 SHAREDSTATEDIR=${SHAREDSTATEDIR:-"$PREFIX/com"} |
103 LIBDIR=$EPREFIX/lib |
112 LOCALSTATEDIR=${LOCALSTATEDIR:-"$PREFIX/var"} |
104 fi |
113 INCLUDEDIR=${INCLUDEDIR:-"$PREFIX/include"} |
105 if [ -z "$LIBEXEC" ]; then |
114 INFODIR=${INFODIR:-"$PREFIX/info"} |
106 LIBEXECDIR=$EPREFIX/libexec |
115 MANDIR=${MANDIR:-"$PREFIX/man"} |
107 fi |
116 |
108 if [ -z "$DATADIR" ]; then |
117 # Test for availability of pkg-config |
109 DATADIR=$PREFIX/share |
118 PKG_CONFIG=$(command -v pkg-config) |
110 fi |
119 PKG_CONFIG=${PKG_CONFIG:-"false"} |
111 if [ -z "$SYSCONFDIR" ]; then |
|
112 SYSCONFDIR=$PREFIX/etc |
|
113 fi |
|
114 if [ -z "$SHAREDSTATEDIR" ]; then |
|
115 SHAREDSTATEDIR=$PREFIX/com |
|
116 fi |
|
117 if [ -z "$LOCALSTATEDIR" ]; then |
|
118 LOCALSTATEDIR=$PREFIX/var |
|
119 fi |
|
120 if [ -z "$INCLUDEDIR" ]; then |
|
121 INCLUDEDIR=$PREFIX/include |
|
122 fi |
|
123 if [ -z "$INFODIR" ]; then |
|
124 INFODIR=$PREFIX/info |
|
125 fi |
|
126 if [ -z "$MANDIR" ]; then |
|
127 MANDIR=$PREFIX/man |
|
128 fi |
|
129 |
|
130 which pkg-config > /dev/null |
|
131 if [ $? -eq 0 ]; then |
|
132 PKG_CONFIG=pkg-config |
|
133 else |
|
134 PKG_CONFIG=false |
|
135 fi |
|
136 |
120 |
137 # Simple uname based platform detection |
121 # Simple uname based platform detection |
138 # $PLATFORM is used for platform dependent dependency selection |
122 # $PLATFORM is used for platform dependent dependency selection |
|
123 OS=$(uname -s) |
|
124 OS_VERSION=$(uname -r) |
139 printf "detect platform... " |
125 printf "detect platform... " |
140 if [ "$OS" = "SunOS" ]; then |
126 if [ "$OS" = "SunOS" ]; then |
141 PLATFORM="solaris sunos unix svr4" |
127 PLATFORM="solaris sunos unix svr4" |
142 fi |
128 fi |
143 if [ "$OS" = "Linux" ]; then |
129 if [ "$OS" = "Linux" ]; then |
208 SHAREDSTATEDIR=$SHAREDSTATEDIR |
168 SHAREDSTATEDIR=$SHAREDSTATEDIR |
209 LOCALSTATEDIR=$LOCALSTATEDIR |
169 LOCALSTATEDIR=$LOCALSTATEDIR |
210 INCLUDEDIR=$INCLUDEDIR |
170 INCLUDEDIR=$INCLUDEDIR |
211 INFODIR=$INFODIR |
171 INFODIR=$INFODIR |
212 MANDIR=$MANDIR |
172 MANDIR=$MANDIR |
213 |
173 HOST=$HOST |
|
174 PREFIX=$PREFIX |
|
175 INSTALL_DIR=$INSTALL_DIR |
214 __EOF__ |
176 __EOF__ |
215 |
177 cat > "$TEMP_DIR/config.mk" << __EOF__ |
216 echo > "$TEMP_DIR/make.mk" |
178 # |
217 |
179 # config.mk generated by configure |
218 ENV_CFLAGS=$CFLAGS |
180 # |
219 ENV_LDFLAGS=$LDFLAGS |
181 __EOF__ |
220 ENV_CXXFLAGS=$CXXFLAGS |
182 sort -u "$TEMP_DIR/vars.mk" >> "$TEMP_DIR/config.mk" |
221 |
183 |
222 # Toolchain detection |
184 |
|
185 # toolchain detection |
223 # this will insert make vars to config.mk |
186 # this will insert make vars to config.mk |
224 . make/toolchain.sh |
187 . make/toolchain.sh |
225 |
188 if [ -n "$TOOLCHAIN_ERROR" ]; then |
226 # add user specified flags to config.mk |
189 echo "Toolchain error: $TOOLCHAIN_ERROR" |
227 echo "# project specific flags" >> "$TEMP_DIR/config.mk" |
190 echo "Abort." |
228 if [ -n "${ENV_CFLAGS}" ]; then |
191 abort_configure |
229 echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk" |
|
230 fi |
|
231 if [ -n "${ENV_CXXFLAGS}" ]; then |
|
232 echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk" |
|
233 fi |
|
234 if [ -n "${ENV_LDFLAGS}" ]; then |
|
235 echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk" |
|
236 fi |
192 fi |
237 |
193 |
238 # |
194 # |
239 # DEPENDENCIES |
195 # DEPENDENCIES |
240 # |
196 # |
|
197 |
|
198 # create buffer for make variables required by dependencies |
|
199 echo > "$TEMP_DIR/make.mk" |
241 |
200 |
242 dependency_libpq() |
201 dependency_libpq() |
243 { |
202 { |
244 printf "checking for libpq... " |
203 printf "checking for libpq... " |
245 # dependency libpq |
204 # dependency libpq |
246 while true |
205 while true |
247 do |
206 do |
248 if [ -z "$PKG_CONFIG" ]; then |
207 if [ -z "$PKG_CONFIG" ]; then |
249 break |
208 break |
250 fi |
209 fi |
251 $PKG_CONFIG libpq |
210 if ! $PKG_CONFIG libpq ; then |
252 if [ $? -ne 0 ] ; then |
211 break |
253 break |
212 fi |
254 fi |
213 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libpq)" |
255 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libpq`" |
214 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libpq)" |
256 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libpq`" |
|
257 echo yes |
215 echo yes |
258 return 0 |
216 return 0 |
259 done |
217 done |
260 |
218 |
261 echo no |
219 echo no |
298 { |
255 { |
299 printf "checking for libxml2... " |
256 printf "checking for libxml2... " |
300 # dependency libxml2 platform="macos" |
257 # dependency libxml2 platform="macos" |
301 while true |
258 while true |
302 do |
259 do |
303 if isnotplatform "macos"; then |
260 if ! isplatform "macos"; then |
304 break |
261 break |
305 fi |
262 fi |
306 xml2-config --cflags > /dev/null |
263 if tmp_flags=$(xml2-config --cflags) ; then |
307 if [ $? -eq 0 ]; then |
264 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" |
308 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`" |
|
309 else |
265 else |
310 break |
266 break |
311 fi |
267 fi |
312 xml2-config --libs > /dev/null |
268 if tmp_flags=$(xml2-config --libs) ; then |
313 if [ $? -eq 0 ]; then |
269 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" |
314 TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`" |
|
315 else |
270 else |
316 break |
271 break |
317 fi |
272 fi |
318 echo yes |
273 echo yes |
319 return 0 |
274 return 0 |
323 while true |
278 while true |
324 do |
279 do |
325 if [ -z "$PKG_CONFIG" ]; then |
280 if [ -z "$PKG_CONFIG" ]; then |
326 break |
281 break |
327 fi |
282 fi |
328 $PKG_CONFIG libxml-2.0 |
283 if ! $PKG_CONFIG libxml-2.0 ; then |
329 if [ $? -ne 0 ] ; then |
284 break |
330 break |
285 fi |
331 fi |
286 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libxml-2.0)" |
332 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libxml-2.0`" |
287 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libxml-2.0)" |
333 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libxml-2.0`" |
|
334 echo yes |
288 echo yes |
335 return 0 |
289 return 0 |
336 done |
290 done |
337 |
291 |
338 echo no |
292 echo no |
339 return 1 |
293 return 1 |
340 } |
294 } |
341 |
295 |
342 DEPENDENCIES_FAILED= |
296 DEPENDENCIES_FAILED= |
343 ERROR=0 |
297 ERROR=0 |
344 # general dependencies |
298 # unnamed dependencies |
345 TEMP_CFLAGS= |
299 TEMP_CFLAGS= |
346 TEMP_LDFLAGS= |
300 TEMP_LDFLAGS= |
347 while true |
301 while true |
348 do |
302 do |
349 while true |
303 while true |
350 do |
304 do |
351 |
305 |
352 |
|
353 break |
306 break |
354 done |
307 done |
355 |
|
356 break |
308 break |
357 done |
309 done |
358 |
310 |
359 # add general dependency flags to config.mk |
311 # add unnamed dependency flags to config.mk |
360 echo >> "$TEMP_DIR/config.mk" |
312 echo >> "$TEMP_DIR/config.mk" |
361 if [ -n "${TEMP_CFLAGS}" ]; then |
313 if [ -n "${TEMP_CFLAGS}" ]; then |
362 echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk |
314 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" |
363 fi |
|
364 if [ -n "${TEMP_CXXFLAGS}" ]; then |
|
365 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk |
|
366 fi |
315 fi |
367 if [ -n "${TEMP_LDFLAGS}" ]; then |
316 if [ -n "${TEMP_LDFLAGS}" ]; then |
368 echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk |
317 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" |
369 fi |
318 fi |
370 |
319 |
371 # |
320 # |
372 # OPTION VALUES |
321 # OPTION VALUES |
373 # |
322 # |
374 |
323 |
375 # |
324 # |
376 # TARGETS |
325 # TARGETS |
377 # |
326 # |
378 TEMP_CFLAGS= |
|
379 TEMP_CXXFLAGS= |
|
380 TEMP_LDFLAGS= |
|
381 |
327 |
382 # Target |
328 # Target |
383 TEMP_CFLAGS= |
329 TEMP_CFLAGS= |
384 TEMP_LDFLAGS= |
330 TEMP_LDFLAGS= |
385 TEMP_CXXFLAGS= |
331 |
386 |
332 if ! dependency_libxml2; then |
387 dependency_libxml2 |
|
388 if [ $? -ne 0 ]; then |
|
389 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
333 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
390 ERROR=1 |
334 ERROR=1 |
391 fi |
335 fi |
392 dependency_openssl |
336 if ! dependency_openssl; then |
393 if [ $? -ne 0 ]; then |
|
394 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " |
337 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " |
395 ERROR=1 |
338 ERROR=1 |
396 fi |
339 fi |
397 |
340 |
398 # Features |
341 # Features |
399 if [ -n "$FEATURE_PG" ]; then |
342 if [ -n "$FEATURE_PG" ]; then |
400 # check dependency |
343 # check dependency |
401 dependency_libpq |
344 if ! dependency_libpq ; then |
402 if [ $? -ne 0 ]; then |
|
403 # "auto" features can fail and are just disabled in this case |
345 # "auto" features can fail and are just disabled in this case |
404 if [ "$FEATURE_PG" != "auto" ]; then |
346 if [ "$FEATURE_PG" = "auto" ]; then |
|
347 unset FEATURE_PG |
|
348 else |
405 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " |
349 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " |
406 ERROR=1 |
350 ERROR=1 |
407 else |
|
408 unset FEATURE_PG |
|
409 fi |
351 fi |
410 fi |
352 fi |
411 fi |
353 fi |
412 |
354 |
413 |
355 |
414 echo >> "$TEMP_DIR/config.mk" |
356 echo >> "$TEMP_DIR/config.mk" |
415 if [ -n "${TEMP_CFLAGS}" ]; then |
357 if [ -n "${TEMP_CFLAGS}" ]; then |
416 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" |
358 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" |
417 fi |
359 fi |
418 if [ -n "${TEMP_CXXFLAGS}" ]; then |
|
419 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" |
|
420 fi |
|
421 if [ "$BUILD_TYPE" = "debug" ]; then |
360 if [ "$BUILD_TYPE" = "debug" ]; then |
422 echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" |
361 echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" |
423 echo 'CXXFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" |
|
424 fi |
362 fi |
425 if [ "$BUILD_TYPE" = "release" ]; then |
363 if [ "$BUILD_TYPE" = "release" ]; then |
426 echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" |
364 echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" |
427 echo 'CXXFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" |
|
428 fi |
365 fi |
429 if [ -n "${TEMP_LDFLAGS}" ]; then |
366 if [ -n "${TEMP_LDFLAGS}" ]; then |
430 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" |
367 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" |
431 fi |
368 fi |
432 |
369 |
433 if [ $ERROR -ne 0 ]; then |
370 if [ $ERROR -ne 0 ]; then |
434 echo |
371 echo |
435 echo "Error: Unresolved dependencies" |
372 echo "Error: Unresolved dependencies" |
436 echo "$DEPENDENCIES_FAILED" |
373 echo "$DEPENDENCIES_FAILED" |
437 rm -Rf "$TEMP_DIR" |
374 abort_configure |
438 exit 1 |
|
439 fi |
375 fi |
440 |
376 |
441 echo "configure finished" |
377 echo "configure finished" |
442 echo |
378 echo |
443 echo "Build Config:" |
379 echo "Build Config:" |