Tue, 09 Jan 2024 00:01:03 +0100
migrate low level linked list tests - relates to #342
universe@753 | 1 | #!/bin/sh |
universe@753 | 2 | |
universe@753 | 3 | # create temporary directory |
universe@753 | 4 | TEMP_DIR=".tmp-`uname -n`" |
universe@753 | 5 | rm -Rf "$TEMP_DIR" |
universe@753 | 6 | if mkdir -p "$TEMP_DIR"; then |
universe@753 | 7 | : |
universe@753 | 8 | else |
universe@753 | 9 | echo "Cannot create tmp dir $TEMP_DIR" |
universe@753 | 10 | echo "Abort" |
universe@753 | 11 | exit 1 |
universe@753 | 12 | fi |
universe@753 | 13 | touch "$TEMP_DIR/options" |
universe@753 | 14 | touch "$TEMP_DIR/features" |
universe@753 | 15 | |
universe@753 | 16 | # define standard variables |
universe@753 | 17 | # also define standard prefix (this is where we will search for config.site) |
universe@753 | 18 | prefix=/usr |
universe@753 | 19 | exec_prefix= |
universe@753 | 20 | bindir= |
universe@753 | 21 | sbindir= |
universe@753 | 22 | libdir= |
universe@753 | 23 | libexecdir= |
universe@753 | 24 | datarootdir= |
universe@753 | 25 | datadir= |
universe@753 | 26 | sysconfdir= |
universe@753 | 27 | sharedstatedir= |
universe@753 | 28 | localstatedir= |
universe@753 | 29 | runstatedir= |
universe@753 | 30 | includedir= |
universe@753 | 31 | infodir= |
universe@753 | 32 | localedir= |
universe@753 | 33 | mandir= |
universe@753 | 34 | |
universe@753 | 35 | # custom variables |
universe@753 | 36 | src_dir=`pwd` |
universe@753 | 37 | DOXYGEN=`command -v doxygen` |
universe@753 | 38 | PANDOC=`command -v pandoc` |
universe@753 | 39 | |
universe@753 | 40 | # features |
universe@753 | 41 | |
universe@753 | 42 | # clean abort |
universe@753 | 43 | abort_configure() |
universe@753 | 44 | { |
universe@753 | 45 | rm -Rf "$TEMP_DIR" |
universe@753 | 46 | exit 1 |
universe@753 | 47 | } |
universe@753 | 48 | |
universe@753 | 49 | # help text |
universe@753 | 50 | printhelp() |
universe@753 | 51 | { |
universe@753 | 52 | echo "Usage: $0 [OPTIONS]..." |
universe@753 | 53 | cat << __EOF__ |
universe@753 | 54 | Installation directories: |
universe@753 | 55 | --prefix=PREFIX path prefix for architecture-independent files |
universe@753 | 56 | [/usr] |
universe@753 | 57 | --exec-prefix=EPREFIX path prefix for architecture-dependent files |
universe@753 | 58 | [PREFIX] |
universe@753 | 59 | |
universe@753 | 60 | --bindir=DIR user executables [EPREFIX/bin] |
universe@753 | 61 | --sbindir=DIR system admin executables [EPREFIX/sbin] |
universe@753 | 62 | --libexecdir=DIR program executables [EPREFIX/libexec] |
universe@753 | 63 | --sysconfdir=DIR system configuration files [PREFIX/etc] |
universe@753 | 64 | --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
universe@753 | 65 | --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
universe@753 | 66 | --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
universe@753 | 67 | --libdir=DIR object code libraries [EPREFIX/lib] |
universe@753 | 68 | --includedir=DIR C header files [PREFIX/include] |
universe@753 | 69 | --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
universe@753 | 70 | --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
universe@753 | 71 | --infodir=DIR info documentation [DATAROOTDIR/info] |
universe@753 | 72 | --mandir=DIR man documentation [DATAROOTDIR/man] |
universe@753 | 73 | --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
universe@753 | 74 | |
universe@753 | 75 | Options: |
universe@753 | 76 | --debug add extra compile flags for debug builds |
universe@753 | 77 | --release add extra compile flags for release builds |
universe@753 | 78 | --with-docs=(all|html|api|none) |
universe@753 | 79 | |
universe@772 | 80 | Optional Features: |
universe@772 | 81 | --enable-coverage |
universe@772 | 82 | |
universe@753 | 83 | __EOF__ |
universe@753 | 84 | } |
universe@753 | 85 | |
universe@753 | 86 | # |
universe@753 | 87 | # parse arguments |
universe@753 | 88 | # |
universe@753 | 89 | BUILD_TYPE="default" |
universe@753 | 90 | for ARG in "$@" |
universe@753 | 91 | do |
universe@753 | 92 | case "$ARG" in |
universe@753 | 93 | "--prefix="*) prefix=${ARG#--prefix=} ;; |
universe@753 | 94 | "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
universe@753 | 95 | "--bindir="*) bindir=${ARG#----bindir=} ;; |
universe@753 | 96 | "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
universe@753 | 97 | "--libdir="*) libdir=${ARG#--libdir=} ;; |
universe@753 | 98 | "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
universe@753 | 99 | "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
universe@753 | 100 | "--datadir="*) datadir=${ARG#--datadir=} ;; |
universe@753 | 101 | "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
universe@753 | 102 | "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
universe@753 | 103 | "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
universe@753 | 104 | "--includedir="*) includedir=${ARG#--includedir=} ;; |
universe@753 | 105 | "--infodir="*) infodir=${ARG#--infodir=} ;; |
universe@753 | 106 | "--mandir"*) mandir=${ARG#--mandir} ;; |
universe@753 | 107 | "--localedir"*) localedir=${ARG#--localedir} ;; |
universe@753 | 108 | "--help"*) printhelp; abort_configure ;; |
universe@753 | 109 | "--debug") BUILD_TYPE="debug" ;; |
universe@753 | 110 | "--release") BUILD_TYPE="release" ;; |
universe@753 | 111 | "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;; |
universe@772 | 112 | "--enable-coverage") FEATURE_COVERAGE=on ;; |
universe@772 | 113 | "--disable-coverage") unset FEATURE_COVERAGE ;; |
universe@753 | 114 | "-"*) echo "unknown option: $ARG"; abort_configure ;; |
universe@753 | 115 | esac |
universe@753 | 116 | done |
universe@753 | 117 | |
universe@753 | 118 | |
universe@753 | 119 | |
universe@753 | 120 | # set defaults for dir variables |
universe@753 | 121 | : ${exec_prefix:="$prefix"} |
universe@753 | 122 | : ${bindir:='${exec_prefix}/bin'} |
universe@753 | 123 | : ${sbindir:='${exec_prefix}/sbin'} |
universe@753 | 124 | : ${libdir:='${exec_prefix}/lib'} |
universe@753 | 125 | : ${libexecdir:='${exec_prefix}/libexec'} |
universe@753 | 126 | : ${datarootdir:='${prefix}/share'} |
universe@753 | 127 | : ${datadir:='${datarootdir}'} |
universe@753 | 128 | : ${sysconfdir:='${prefix}/etc'} |
universe@753 | 129 | : ${sharedstatedir:='${prefix}/com'} |
universe@753 | 130 | : ${localstatedir:='${prefix}/var'} |
universe@753 | 131 | : ${runstatedir:='${localstatedir}/run'} |
universe@753 | 132 | : ${includedir:='${prefix}/include'} |
universe@753 | 133 | : ${infodir:='${datarootdir}/info'} |
universe@753 | 134 | : ${mandir:='${datarootdir}/man'} |
universe@753 | 135 | : ${localedir:='${datarootdir}/locale'} |
universe@753 | 136 | |
universe@753 | 137 | # check if a config.site exists and load it |
universe@753 | 138 | if [ -n "$CONFIG_SITE" ]; then |
universe@753 | 139 | # CONFIG_SITE may contain space separated file names |
universe@753 | 140 | for cs in $CONFIG_SITE; do |
universe@753 | 141 | printf "loading defaults from $cs... " |
universe@753 | 142 | . "$cs" |
universe@753 | 143 | echo ok |
universe@753 | 144 | done |
universe@753 | 145 | elif [ -f "$prefix/share/config.site" ]; then |
universe@753 | 146 | printf "loading site defaults... " |
universe@753 | 147 | . "$prefix/share/config.site" |
universe@753 | 148 | echo ok |
universe@753 | 149 | elif [ -f "$prefix/etc/config.site" ]; then |
universe@753 | 150 | printf "loading site defaults... " |
universe@753 | 151 | . "$prefix/etc/config.site" |
universe@753 | 152 | echo ok |
universe@753 | 153 | fi |
universe@753 | 154 | |
universe@753 | 155 | # Test for availability of pkg-config |
universe@753 | 156 | PKG_CONFIG=`command -v pkg-config` |
universe@753 | 157 | : ${PKG_CONFIG:="false"} |
universe@753 | 158 | |
universe@753 | 159 | # Simple uname based platform detection |
universe@753 | 160 | # $PLATFORM is used for platform dependent dependency selection |
universe@753 | 161 | OS=`uname -s` |
universe@753 | 162 | OS_VERSION=`uname -r` |
universe@753 | 163 | printf "detect platform... " |
universe@753 | 164 | if [ "$OS" = "SunOS" ]; then |
universe@753 | 165 | PLATFORM="solaris sunos unix svr4" |
universe@753 | 166 | fi |
universe@753 | 167 | if [ "$OS" = "Linux" ]; then |
universe@753 | 168 | PLATFORM="linux unix" |
universe@753 | 169 | fi |
universe@753 | 170 | if [ "$OS" = "FreeBSD" ]; then |
universe@753 | 171 | PLATFORM="freebsd bsd unix" |
universe@753 | 172 | fi |
universe@753 | 173 | if [ "$OS" = "Darwin" ]; then |
universe@753 | 174 | PLATFORM="macos osx bsd unix" |
universe@753 | 175 | fi |
universe@753 | 176 | if echo "$OS" | grep -i "MINGW" > /dev/null; then |
universe@753 | 177 | PLATFORM="windows mingw" |
universe@753 | 178 | fi |
universe@753 | 179 | : ${PLATFORM:="unix"} |
universe@753 | 180 | |
universe@753 | 181 | PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
universe@753 | 182 | echo "$PLATFORM_NAME" |
universe@753 | 183 | |
universe@753 | 184 | isplatform() |
universe@753 | 185 | { |
universe@753 | 186 | for p in $PLATFORM |
universe@753 | 187 | do |
universe@753 | 188 | if [ "$p" = "$1" ]; then |
universe@753 | 189 | return 0 |
universe@753 | 190 | fi |
universe@753 | 191 | done |
universe@753 | 192 | return 1 |
universe@753 | 193 | } |
universe@753 | 194 | notisplatform() |
universe@753 | 195 | { |
universe@753 | 196 | for p in $PLATFORM |
universe@753 | 197 | do |
universe@753 | 198 | if [ "$p" = "$1" ]; then |
universe@753 | 199 | return 1 |
universe@753 | 200 | fi |
universe@753 | 201 | done |
universe@753 | 202 | return 0 |
universe@753 | 203 | } |
universe@753 | 204 | |
universe@753 | 205 | |
universe@753 | 206 | # generate vars.mk |
universe@753 | 207 | cat > "$TEMP_DIR/vars.mk" << __EOF__ |
universe@753 | 208 | prefix="$prefix" |
universe@753 | 209 | exec_prefix="$exec_prefix" |
universe@753 | 210 | bindir="$bindir" |
universe@753 | 211 | sbindir="$sbindir" |
universe@753 | 212 | libdir="$libdir" |
universe@753 | 213 | libexecdir="$libexecdir" |
universe@753 | 214 | datarootdir="$datarootdir" |
universe@753 | 215 | datadir="$datadir" |
universe@753 | 216 | sysconfdir="$sysconfdir" |
universe@753 | 217 | sharedstatedir="$sharedstatedir" |
universe@753 | 218 | localstatedir="$localstatedir" |
universe@753 | 219 | runstatedir="$runstatedir" |
universe@753 | 220 | includedir="$includedir" |
universe@753 | 221 | infodir="$infodir" |
universe@753 | 222 | mandir="$mandir" |
universe@753 | 223 | localedir="$localedir" |
universe@753 | 224 | src_dir="$src_dir" |
universe@753 | 225 | DOXYGEN="$DOXYGEN" |
universe@753 | 226 | PANDOC="$PANDOC" |
universe@753 | 227 | __EOF__ |
universe@753 | 228 | |
universe@753 | 229 | # toolchain detection utilities |
universe@753 | 230 | . make/toolchain.sh |
universe@753 | 231 | |
universe@753 | 232 | # |
universe@753 | 233 | # DEPENDENCIES |
universe@753 | 234 | # |
universe@753 | 235 | |
universe@753 | 236 | # check languages |
universe@753 | 237 | lang_c= |
universe@753 | 238 | lang_cpp= |
universe@753 | 239 | if detect_c_compiler ; then |
universe@753 | 240 | lang_c=1 |
universe@753 | 241 | fi |
universe@753 | 242 | |
universe@753 | 243 | # create buffer for make variables required by dependencies |
universe@753 | 244 | echo > "$TEMP_DIR/make.mk" |
universe@753 | 245 | |
universe@753 | 246 | test_pkg_config() |
universe@753 | 247 | { |
universe@753 | 248 | if "$PKG_CONFIG" --exists "$1" ; then : |
universe@753 | 249 | else return 1 ; fi |
universe@753 | 250 | if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : |
universe@753 | 251 | else return 1 ; fi |
universe@753 | 252 | if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : |
universe@753 | 253 | else return 1 ; fi |
universe@753 | 254 | if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : |
universe@753 | 255 | else return 1 ; fi |
universe@753 | 256 | return 0 |
universe@753 | 257 | } |
universe@753 | 258 | |
universe@796 | 259 | print_check_msg() |
universe@796 | 260 | { |
universe@796 | 261 | if [ -z "$1" ]; then |
universe@796 | 262 | shift |
universe@796 | 263 | printf "$@" |
universe@796 | 264 | fi |
universe@796 | 265 | } |
universe@796 | 266 | |
universe@772 | 267 | dependency_error_coverage() |
universe@772 | 268 | { |
universe@796 | 269 | print_check_msg "$dep_checked_coverage" "checking for coverage... " |
universe@772 | 270 | # dependency coverage |
universe@772 | 271 | while true |
universe@772 | 272 | do |
universe@788 | 273 | TEMP_CFLAGS="$TEMP_CFLAGS \${COVERAGE_CFLAGS}" |
universe@788 | 274 | TEMP_LDFLAGS="$TEMP_LDFLAGS \${COVERAGE_LDFLAGS}" |
universe@796 | 275 | print_check_msg "$dep_checked_coverage" "yes\n" |
universe@796 | 276 | dep_checked_coverage=1 |
universe@772 | 277 | return 1 |
universe@772 | 278 | done |
universe@772 | 279 | |
universe@796 | 280 | print_check_msg "$dep_checked_coverage" "no\n" |
universe@796 | 281 | dep_checked_coverage=1 |
universe@772 | 282 | return 0 |
universe@772 | 283 | } |
universe@753 | 284 | dependency_error_pandoc() |
universe@753 | 285 | { |
universe@796 | 286 | print_check_msg "$dep_checked_pandoc" "checking for pandoc... " |
universe@753 | 287 | # dependency pandoc |
universe@753 | 288 | while true |
universe@753 | 289 | do |
universe@753 | 290 | if test -n "$PANDOC" > /dev/null ; then |
universe@753 | 291 | : |
universe@753 | 292 | else |
universe@753 | 293 | break |
universe@753 | 294 | fi |
universe@796 | 295 | print_check_msg "$dep_checked_pandoc" "yes\n" |
universe@796 | 296 | dep_checked_pandoc=1 |
universe@753 | 297 | return 1 |
universe@753 | 298 | done |
universe@753 | 299 | |
universe@796 | 300 | print_check_msg "$dep_checked_pandoc" "no\n" |
universe@796 | 301 | dep_checked_pandoc=1 |
universe@753 | 302 | return 0 |
universe@753 | 303 | } |
universe@753 | 304 | dependency_error_c() |
universe@753 | 305 | { |
universe@796 | 306 | print_check_msg "$dep_checked_c" "checking for c... " |
universe@753 | 307 | # dependency c platform="mingw" |
universe@753 | 308 | while true |
universe@753 | 309 | do |
universe@753 | 310 | if notisplatform "mingw"; then |
universe@753 | 311 | break |
universe@753 | 312 | fi |
universe@753 | 313 | if [ -z "$lang_c" ] ; then |
universe@753 | 314 | break |
universe@753 | 315 | fi |
universe@753 | 316 | cat >> $TEMP_DIR/make.mk << __EOF__ |
universe@753 | 317 | # Dependency: c |
universe@753 | 318 | AR=ar |
universe@753 | 319 | ARFLAGS=r |
universe@753 | 320 | STLIB_EXT=.lib |
universe@753 | 321 | SHLIB_EXT=.dll |
universe@753 | 322 | |
universe@753 | 323 | __EOF__ |
universe@796 | 324 | print_check_msg "$dep_checked_c" "yes\n" |
universe@796 | 325 | dep_checked_c=1 |
universe@753 | 326 | return 1 |
universe@753 | 327 | done |
universe@753 | 328 | |
universe@753 | 329 | # dependency c platform="macos" |
universe@753 | 330 | while true |
universe@753 | 331 | do |
universe@753 | 332 | if notisplatform "macos"; then |
universe@753 | 333 | break |
universe@753 | 334 | fi |
universe@753 | 335 | if [ -z "$lang_c" ] ; then |
universe@753 | 336 | break |
universe@753 | 337 | fi |
universe@753 | 338 | cat >> $TEMP_DIR/make.mk << __EOF__ |
universe@753 | 339 | # Dependency: c |
universe@753 | 340 | AR=ar |
universe@753 | 341 | ARFLAGS=r |
universe@753 | 342 | STLIB_EXT=.a |
universe@753 | 343 | SHLIB_EXT=.dylib |
universe@753 | 344 | |
universe@753 | 345 | __EOF__ |
universe@796 | 346 | print_check_msg "$dep_checked_c" "yes\n" |
universe@796 | 347 | dep_checked_c=1 |
universe@753 | 348 | return 1 |
universe@753 | 349 | done |
universe@753 | 350 | |
universe@753 | 351 | # dependency c platform="unix" |
universe@753 | 352 | while true |
universe@753 | 353 | do |
universe@753 | 354 | if notisplatform "unix"; then |
universe@753 | 355 | break |
universe@753 | 356 | fi |
universe@753 | 357 | if [ -z "$lang_c" ] ; then |
universe@753 | 358 | break |
universe@753 | 359 | fi |
universe@753 | 360 | cat >> $TEMP_DIR/make.mk << __EOF__ |
universe@753 | 361 | # Dependency: c |
universe@753 | 362 | AR=ar |
universe@753 | 363 | ARFLAGS=r |
universe@753 | 364 | STLIB_EXT=.a |
universe@753 | 365 | SHLIB_EXT=.so |
universe@753 | 366 | |
universe@753 | 367 | __EOF__ |
universe@796 | 368 | print_check_msg "$dep_checked_c" "yes\n" |
universe@796 | 369 | dep_checked_c=1 |
universe@753 | 370 | return 1 |
universe@753 | 371 | done |
universe@753 | 372 | |
universe@796 | 373 | print_check_msg "$dep_checked_c" "no\n" |
universe@796 | 374 | dep_checked_c=1 |
universe@753 | 375 | return 0 |
universe@753 | 376 | } |
universe@753 | 377 | dependency_error_file_tools() |
universe@753 | 378 | { |
universe@796 | 379 | print_check_msg "$dep_checked_file_tools" "checking for file-tools... " |
universe@753 | 380 | # dependency file-tools |
universe@753 | 381 | while true |
universe@753 | 382 | do |
universe@753 | 383 | cat >> $TEMP_DIR/make.mk << __EOF__ |
universe@753 | 384 | # Dependency: file-tools |
universe@754 | 385 | MKDIR=/bin/mkdir -p |
universe@754 | 386 | RMFILE=/bin/rm -f |
universe@754 | 387 | RMDIR=/bin/rm -f -R |
universe@754 | 388 | COPYFILE=/bin/cp -f |
universe@754 | 389 | COPYALL=/bin/cp -f -R |
universe@754 | 390 | SYMLINK=/bin/ln -s |
universe@753 | 391 | |
universe@753 | 392 | __EOF__ |
universe@796 | 393 | print_check_msg "$dep_checked_file_tools" "yes\n" |
universe@796 | 394 | dep_checked_file_tools=1 |
universe@753 | 395 | return 1 |
universe@753 | 396 | done |
universe@753 | 397 | |
universe@796 | 398 | print_check_msg "$dep_checked_file_tools" "no\n" |
universe@796 | 399 | dep_checked_file_tools=1 |
universe@753 | 400 | return 0 |
universe@753 | 401 | } |
universe@753 | 402 | dependency_error_doxygen() |
universe@753 | 403 | { |
universe@796 | 404 | print_check_msg "$dep_checked_doxygen" "checking for doxygen... " |
universe@753 | 405 | # dependency doxygen |
universe@753 | 406 | while true |
universe@753 | 407 | do |
universe@753 | 408 | if test -n "$DOXYGEN" > /dev/null ; then |
universe@753 | 409 | : |
universe@753 | 410 | else |
universe@753 | 411 | break |
universe@753 | 412 | fi |
universe@796 | 413 | print_check_msg "$dep_checked_doxygen" "yes\n" |
universe@796 | 414 | dep_checked_doxygen=1 |
universe@753 | 415 | return 1 |
universe@753 | 416 | done |
universe@753 | 417 | |
universe@796 | 418 | print_check_msg "$dep_checked_doxygen" "no\n" |
universe@796 | 419 | dep_checked_doxygen=1 |
universe@753 | 420 | return 0 |
universe@753 | 421 | } |
universe@753 | 422 | |
universe@753 | 423 | # start collecting dependency information |
universe@753 | 424 | echo > "$TEMP_DIR/flags.mk" |
universe@753 | 425 | |
universe@753 | 426 | DEPENDENCIES_FAILED= |
universe@753 | 427 | ERROR=0 |
universe@753 | 428 | # unnamed dependencies |
universe@753 | 429 | TEMP_CFLAGS= |
universe@753 | 430 | TEMP_CXXFLAGS= |
universe@753 | 431 | TEMP_LDFLAGS= |
universe@753 | 432 | while true |
universe@753 | 433 | do |
universe@753 | 434 | while true |
universe@753 | 435 | do |
universe@753 | 436 | |
universe@753 | 437 | cat >> "$TEMP_DIR/make.mk" << __EOF__ |
universe@753 | 438 | # library version |
universe@759 | 439 | VERSION=3.1.0 |
universe@759 | 440 | LIBVERSION=4.1.0 |
universe@754 | 441 | LIBVERSION_MAJOR=4 |
universe@753 | 442 | |
universe@753 | 443 | # build directory structure !! do not change or override !! |
universe@754 | 444 | build_dir=${src_dir}/build |
universe@754 | 445 | docs_dir=${src_dir}/build/docs |
universe@754 | 446 | dist_dir=${src_dir}/dist |
universe@753 | 447 | |
universe@753 | 448 | __EOF__ |
universe@753 | 449 | break |
universe@753 | 450 | done |
universe@753 | 451 | break |
universe@753 | 452 | done |
universe@753 | 453 | |
universe@753 | 454 | # add general dependency flags to flags.mk |
universe@753 | 455 | echo "# general flags" >> "$TEMP_DIR/flags.mk" |
universe@753 | 456 | if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then |
universe@753 | 457 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
universe@753 | 458 | fi |
universe@753 | 459 | if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then |
universe@753 | 460 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
universe@753 | 461 | fi |
universe@753 | 462 | if [ -n "${TEMP_LDFLAGS}" ]; then |
universe@753 | 463 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
universe@753 | 464 | fi |
universe@753 | 465 | |
universe@753 | 466 | # |
universe@753 | 467 | # OPTION VALUES |
universe@753 | 468 | # |
universe@753 | 469 | checkopt_with_docs_all() |
universe@753 | 470 | { |
universe@753 | 471 | VERR=0 |
universe@753 | 472 | if dependency_error_pandoc ; then |
universe@753 | 473 | VERR=1 |
universe@753 | 474 | fi |
universe@753 | 475 | if dependency_error_doxygen ; then |
universe@753 | 476 | VERR=1 |
universe@753 | 477 | fi |
universe@753 | 478 | if [ $VERR -ne 0 ]; then |
universe@753 | 479 | return 1 |
universe@753 | 480 | fi |
universe@753 | 481 | cat >> "$TEMP_DIR/make.mk" << __EOF__ |
universe@753 | 482 | # Documentation |
universe@753 | 483 | WITH_DOCS_API=yes |
universe@753 | 484 | WITH_DOCS_HTML=yes |
universe@753 | 485 | |
universe@753 | 486 | __EOF__ |
universe@753 | 487 | return 0 |
universe@753 | 488 | } |
universe@753 | 489 | checkopt_with_docs_html() |
universe@753 | 490 | { |
universe@753 | 491 | VERR=0 |
universe@753 | 492 | if dependency_error_pandoc ; then |
universe@753 | 493 | VERR=1 |
universe@753 | 494 | fi |
universe@753 | 495 | if [ $VERR -ne 0 ]; then |
universe@753 | 496 | return 1 |
universe@753 | 497 | fi |
universe@753 | 498 | cat >> "$TEMP_DIR/make.mk" << __EOF__ |
universe@753 | 499 | # Documentation |
universe@753 | 500 | WITH_DOCS_HTML=yes |
universe@753 | 501 | |
universe@753 | 502 | __EOF__ |
universe@753 | 503 | return 0 |
universe@753 | 504 | } |
universe@753 | 505 | checkopt_with_docs_api() |
universe@753 | 506 | { |
universe@753 | 507 | VERR=0 |
universe@753 | 508 | if dependency_error_doxygen ; then |
universe@753 | 509 | VERR=1 |
universe@753 | 510 | fi |
universe@753 | 511 | if [ $VERR -ne 0 ]; then |
universe@753 | 512 | return 1 |
universe@753 | 513 | fi |
universe@753 | 514 | cat >> "$TEMP_DIR/make.mk" << __EOF__ |
universe@753 | 515 | # Documentation |
universe@753 | 516 | WITH_DOCS_API=yes |
universe@753 | 517 | |
universe@753 | 518 | __EOF__ |
universe@753 | 519 | return 0 |
universe@753 | 520 | } |
universe@753 | 521 | checkopt_with_docs_none() |
universe@753 | 522 | { |
universe@753 | 523 | VERR=0 |
universe@753 | 524 | if [ $VERR -ne 0 ]; then |
universe@753 | 525 | return 1 |
universe@753 | 526 | fi |
universe@753 | 527 | return 0 |
universe@753 | 528 | } |
universe@753 | 529 | |
universe@753 | 530 | # |
universe@753 | 531 | # TARGETS |
universe@753 | 532 | # |
universe@753 | 533 | |
universe@753 | 534 | echo >> "$TEMP_DIR/flags.mk" |
universe@753 | 535 | echo "configuring global target" |
universe@753 | 536 | echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" |
universe@753 | 537 | TEMP_CFLAGS= |
universe@753 | 538 | TEMP_CXXFLAGS= |
universe@753 | 539 | TEMP_LDFLAGS= |
universe@753 | 540 | |
universe@753 | 541 | if dependency_error_c; then |
universe@753 | 542 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED c " |
universe@753 | 543 | ERROR=1 |
universe@753 | 544 | fi |
universe@753 | 545 | if dependency_error_file_tools; then |
universe@753 | 546 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED file_tools " |
universe@753 | 547 | ERROR=1 |
universe@753 | 548 | fi |
universe@753 | 549 | |
universe@753 | 550 | # Features |
universe@772 | 551 | if [ -n "$FEATURE_COVERAGE" ]; then |
universe@772 | 552 | # check dependency |
universe@772 | 553 | if dependency_error_coverage ; then |
universe@772 | 554 | # "auto" features can fail and are just disabled in this case |
universe@772 | 555 | if [ "$FEATURE_COVERAGE" = "auto" ]; then |
universe@772 | 556 | DISABLE_FEATURE_COVERAGE=1 |
universe@772 | 557 | else |
universe@772 | 558 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED coverage " |
universe@772 | 559 | ERROR=1 |
universe@772 | 560 | fi |
universe@772 | 561 | fi |
universe@772 | 562 | if [ -n "$DISABLE_FEATURE_COVERAGE" ]; then |
universe@772 | 563 | unset FEATURE_COVERAGE |
universe@772 | 564 | fi |
universe@772 | 565 | fi |
universe@753 | 566 | |
universe@753 | 567 | # Option: --with-docs |
universe@753 | 568 | if [ -z "$OPT_WITH_DOCS" ]; then |
universe@753 | 569 | echo "auto-detecting option 'with-docs'" |
universe@753 | 570 | SAVED_ERROR="$ERROR" |
universe@753 | 571 | SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" |
universe@753 | 572 | ERROR=1 |
universe@753 | 573 | while true |
universe@753 | 574 | do |
universe@753 | 575 | if checkopt_with_docs_all ; then |
universe@753 | 576 | echo " with-docs: all" >> "$TEMP_DIR/options" |
universe@753 | 577 | ERROR=0 |
universe@753 | 578 | break |
universe@753 | 579 | fi |
universe@753 | 580 | if checkopt_with_docs_html ; then |
universe@753 | 581 | echo " with-docs: html" >> "$TEMP_DIR/options" |
universe@753 | 582 | ERROR=0 |
universe@753 | 583 | break |
universe@753 | 584 | fi |
universe@753 | 585 | if checkopt_with_docs_api ; then |
universe@753 | 586 | echo " with-docs: api" >> "$TEMP_DIR/options" |
universe@753 | 587 | ERROR=0 |
universe@753 | 588 | break |
universe@753 | 589 | fi |
universe@753 | 590 | if checkopt_with_docs_none ; then |
universe@753 | 591 | echo " with-docs: none" >> "$TEMP_DIR/options" |
universe@753 | 592 | ERROR=0 |
universe@753 | 593 | break |
universe@753 | 594 | fi |
universe@753 | 595 | break |
universe@753 | 596 | done |
universe@753 | 597 | if [ $ERROR -ne 0 ]; then |
universe@753 | 598 | SAVED_ERROR=1 |
universe@753 | 599 | SAVED_DEPENDENCIES_FAILED="option 'with-docs' $SAVED_DEPENDENCIES_FAILED" |
universe@753 | 600 | fi |
universe@753 | 601 | ERROR="$SAVED_ERROR" |
universe@753 | 602 | DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" |
universe@753 | 603 | else |
universe@753 | 604 | echo "checking option with-docs = $OPT_WITH_DOCS" |
universe@753 | 605 | if false; then |
universe@753 | 606 | false |
universe@753 | 607 | elif [ "$OPT_WITH_DOCS" = "all" ]; then |
universe@753 | 608 | echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options |
universe@753 | 609 | if checkopt_with_docs_all ; then |
universe@753 | 610 | : |
universe@753 | 611 | else |
universe@753 | 612 | ERROR=1 |
universe@753 | 613 | DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" |
universe@753 | 614 | fi |
universe@753 | 615 | elif [ "$OPT_WITH_DOCS" = "html" ]; then |
universe@753 | 616 | echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options |
universe@753 | 617 | if checkopt_with_docs_html ; then |
universe@753 | 618 | : |
universe@753 | 619 | else |
universe@753 | 620 | ERROR=1 |
universe@753 | 621 | DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" |
universe@753 | 622 | fi |
universe@753 | 623 | elif [ "$OPT_WITH_DOCS" = "api" ]; then |
universe@753 | 624 | echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options |
universe@753 | 625 | if checkopt_with_docs_api ; then |
universe@753 | 626 | : |
universe@753 | 627 | else |
universe@753 | 628 | ERROR=1 |
universe@753 | 629 | DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" |
universe@753 | 630 | fi |
universe@753 | 631 | elif [ "$OPT_WITH_DOCS" = "none" ]; then |
universe@753 | 632 | echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options |
universe@753 | 633 | if checkopt_with_docs_none ; then |
universe@753 | 634 | : |
universe@753 | 635 | else |
universe@753 | 636 | ERROR=1 |
universe@753 | 637 | DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" |
universe@753 | 638 | fi |
universe@753 | 639 | fi |
universe@753 | 640 | fi |
universe@753 | 641 | |
universe@753 | 642 | if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then |
universe@753 | 643 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
universe@753 | 644 | fi |
universe@753 | 645 | if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then |
universe@753 | 646 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
universe@753 | 647 | fi |
universe@753 | 648 | if [ "$BUILD_TYPE" = "debug" ]; then |
universe@753 | 649 | if [ -n "$lang_c" ]; then |
universe@753 | 650 | echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
universe@753 | 651 | fi |
universe@753 | 652 | if [ -n "$lang_cpp" ]; then |
universe@753 | 653 | echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
universe@753 | 654 | fi |
universe@753 | 655 | fi |
universe@753 | 656 | if [ "$BUILD_TYPE" = "release" ]; then |
universe@753 | 657 | if [ -n "$lang_c" ]; then |
universe@753 | 658 | echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
universe@753 | 659 | fi |
universe@753 | 660 | if [ -n "$lang_cpp" ]; then |
universe@753 | 661 | echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
universe@753 | 662 | fi |
universe@753 | 663 | fi |
universe@753 | 664 | if [ -n "${TEMP_LDFLAGS}" ]; then |
universe@753 | 665 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
universe@753 | 666 | fi |
universe@753 | 667 | |
universe@753 | 668 | |
universe@753 | 669 | # final result |
universe@753 | 670 | if [ $ERROR -ne 0 ]; then |
universe@753 | 671 | echo |
universe@753 | 672 | echo "Error: Unresolved dependencies" |
universe@753 | 673 | echo "$DEPENDENCIES_FAILED" |
universe@753 | 674 | abort_configure |
universe@753 | 675 | fi |
universe@753 | 676 | |
universe@753 | 677 | echo "configure finished" |
universe@753 | 678 | echo |
universe@753 | 679 | echo "Build Config:" |
universe@753 | 680 | echo " PREFIX: $prefix" |
universe@753 | 681 | echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
universe@753 | 682 | echo "Options:" |
universe@753 | 683 | cat "$TEMP_DIR/options" |
universe@772 | 684 | echo "Features:" |
universe@772 | 685 | if [ -n "$FEATURE_COVERAGE" ]; then |
universe@772 | 686 | echo " coverage: on" |
universe@772 | 687 | else |
universe@772 | 688 | echo " coverage: off" |
universe@772 | 689 | fi |
universe@753 | 690 | echo |
universe@753 | 691 | |
universe@753 | 692 | # generate the config.mk file |
universe@753 | 693 | cat > "$TEMP_DIR/config.mk" << __EOF__ |
universe@753 | 694 | # |
universe@753 | 695 | # config.mk generated by configure |
universe@753 | 696 | # |
universe@753 | 697 | |
universe@753 | 698 | __EOF__ |
universe@753 | 699 | write_toolchain_defaults "$TEMP_DIR/toolchain.mk" |
universe@753 | 700 | cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
universe@753 | 701 | rm -Rf "$TEMP_DIR" |
universe@753 | 702 | |
universe@753 | 703 | |
universe@796 | 704 |