src/test/resources/golden-sample/configure

changeset 66
dc758dcd4645
parent 63
ac47c2fb2c4a
child 67
e43d30273f74
equal deleted inserted replaced
65:6db50c6df6e3 66:dc758dcd4645
165 done 165 done
166 return 0 166 return 0
167 } 167 }
168 168
169 169
170 # generate config.mk 170 # generate vars.mk
171 cat > "$TEMP_DIR/vars.mk" << __EOF__ 171 cat > "$TEMP_DIR/vars.mk" << __EOF__
172 PREFIX=$PREFIX 172 PREFIX=$PREFIX
173 EPREFIX=$EPREFIX 173 EPREFIX=$EPREFIX
174 BINDIR=$BINDIR 174 BINDIR=$BINDIR
175 SBINDIR=$SBINDIR 175 SBINDIR=$SBINDIR
184 MANDIR=$MANDIR 184 MANDIR=$MANDIR
185 HOST=$HOST 185 HOST=$HOST
186 PREFIX=$PREFIX 186 PREFIX=$PREFIX
187 INSTALL_DIR=$INSTALL_DIR 187 INSTALL_DIR=$INSTALL_DIR
188 __EOF__ 188 __EOF__
189 cat > "$TEMP_DIR/config.mk" << __EOF__ 189 sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
190 # 190
191 # config.mk generated by configure 191
192 # 192 # toolchain detection utilities
193 __EOF__
194 sort -u "$TEMP_DIR/vars.mk" >> "$TEMP_DIR/config.mk"
195
196
197 # toolchain detection
198 # this will insert make vars to config.mk
199 . make/toolchain.sh 193 . make/toolchain.sh
200 if [ -n "$TOOLCHAIN_ERROR" ]; then
201 echo "Toolchain error: $TOOLCHAIN_ERROR"
202 echo "Abort."
203 abort_configure
204 fi
205 194
206 # 195 #
207 # DEPENDENCIES 196 # DEPENDENCIES
208 # 197 #
209 198
212 201
213 test_pkg_config() 202 test_pkg_config()
214 { 203 {
215 if "$PKG_CONFIG" --exists "$1" ; then : 204 if "$PKG_CONFIG" --exists "$1" ; then :
216 else return 1 ; fi 205 else return 1 ; fi
217 if [ -n "$2" ] && "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : 206 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
218 else return 1 ; fi 207 else return 1 ; fi
219 if [ -n "$3" ] && "$PKG_CONFIG" --exact-version="$3" "$1" ; then : 208 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
220 else return 1 ; fi 209 else return 1 ; fi
221 if [ -n "$4" ] && "$PKG_CONFIG" --max-version="$4" "$1" ; then : 210 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
222 else return 1 ; fi 211 else return 1 ; fi
223 return 0 212 return 0
224 } 213 }
225 214
226 dependency_error_libpq() 215 dependency_error_libpq()
318 done 307 done
319 308
320 echo no 309 echo no
321 return 0 310 return 0
322 } 311 }
312
313 # start collecting dependency information
314 echo > "$TEMP_DIR/flags.mk"
323 315
324 DEPENDENCIES_FAILED= 316 DEPENDENCIES_FAILED=
325 ERROR=0 317 ERROR=0
326 # unnamed dependencies 318 # unnamed dependencies
327 TEMP_CFLAGS= 319 TEMP_CFLAGS=
320 TEMP_CXXFLAGS=
328 TEMP_LDFLAGS= 321 TEMP_LDFLAGS=
329 while true 322 while true
330 do 323 do
331 while true 324 while true
332 do 325 do
326 if detect_cpp_compiler ; then
327 :
328 else
329 ERROR=1
330 break
331 fi
333 332
334 break 333 break
335 done 334 done
336 break 335 break
337 done 336 done
338 337
339 # add unnamed dependency flags to config.mk 338 # add general dependency flags to flags.mk
340 echo >> "$TEMP_DIR/config.mk" 339 echo "# general flags" >> "$TEMP_DIR/flags.mk"
341 if [ -n "${TEMP_CFLAGS}" ]; then 340 if [ -n "${TEMP_CFLAGS}" ]; then
342 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 341 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
342 fi
343 if [ -n "${TEMP_CXXFLAGS}" ]; then
344 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
343 fi 345 fi
344 if [ -n "${TEMP_LDFLAGS}" ]; then 346 if [ -n "${TEMP_LDFLAGS}" ]; then
345 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 347 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
346 fi 348 fi
347 349
348 # 350 #
349 # OPTION VALUES 351 # OPTION VALUES
350 # 352 #
351 353
352 # 354 #
353 # TARGETS 355 # TARGETS
354 # 356 #
355 357
358 echo >> "$TEMP_DIR/flags.mk"
356 # Target 359 # Target
360 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
357 TEMP_CFLAGS= 361 TEMP_CFLAGS=
362 TEMP_CXXFLAGS=
358 TEMP_LDFLAGS= 363 TEMP_LDFLAGS=
359 364
360 if dependency_error_libxml2; then 365 if dependency_error_libxml2; then
361 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " 366 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
362 ERROR=1 367 ERROR=1
379 fi 384 fi
380 fi 385 fi
381 fi 386 fi
382 387
383 388
384 echo >> "$TEMP_DIR/config.mk"
385 if [ -n "${TEMP_CFLAGS}" ]; then 389 if [ -n "${TEMP_CFLAGS}" ]; then
386 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 390 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
391 fi
392 if [ -n "${TEMP_CXXFLAGS}" ]; then
393 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
387 fi 394 fi
388 if [ "$BUILD_TYPE" = "debug" ]; then 395 if [ "$BUILD_TYPE" = "debug" ]; then
389 echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" 396 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
397 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
390 fi 398 fi
391 if [ "$BUILD_TYPE" = "release" ]; then 399 if [ "$BUILD_TYPE" = "release" ]; then
392 echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" 400 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
401 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
393 fi 402 fi
394 if [ -n "${TEMP_LDFLAGS}" ]; then 403 if [ -n "${TEMP_LDFLAGS}" ]; then
395 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 404 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
396 fi 405 fi
397 406
407
408 # final result
398 if [ $ERROR -ne 0 ]; then 409 if [ $ERROR -ne 0 ]; then
399 echo 410 echo
400 echo "Error: Unresolved dependencies" 411 echo "Error: Unresolved dependencies"
401 echo "$DEPENDENCIES_FAILED" 412 echo "$DEPENDENCIES_FAILED"
402 abort_configure 413 abort_configure
412 echo " pg: on" 423 echo " pg: on"
413 else 424 else
414 echo " pg: off" 425 echo " pg: off"
415 fi 426 fi
416 echo 427 echo
417 cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk 428
429 # generate the config.mk file
430 cat > "$TEMP_DIR/config.mk" << __EOF__
431 #
432 # config.mk generated by configure
433 #
434
435 __EOF__
436 write_toolchain_defaults "$TEMP_DIR/config.mk"
437 cat "$TEMP_DIR/config.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
418 rm -Rf "$TEMP_DIR" 438 rm -Rf "$TEMP_DIR"
419 439
420 440

mercurial