Sun, 30 Nov 2025 22:55:34 +0100
update uwproj
| 0 | 1 | #!/bin/sh |
| 2 | ||
| 3 | ||
| 4 | # some utility functions | |
| 5 | isplatform() | |
| 6 | { | |
| 7 | for p in $PLATFORM | |
| 8 | do | |
| 9 | if [ "$p" = "$1" ]; then | |
| 10 | return 0 | |
| 11 | fi | |
| 12 | done | |
| 13 | return 1 | |
| 14 | } | |
| 15 | notisplatform() | |
| 16 | { | |
| 17 | for p in $PLATFORM | |
| 18 | do | |
| 19 | if [ "$p" = "$1" ]; then | |
| 20 | return 1 | |
| 21 | fi | |
| 22 | done | |
| 23 | return 0 | |
| 24 | } | |
| 25 | istoolchain() | |
| 26 | { | |
| 27 | for t in $TOOLCHAIN | |
| 28 | do | |
| 29 | if [ "$t" = "$1" ]; then | |
| 30 | return 0 | |
| 31 | fi | |
| 32 | done | |
| 33 | return 1 | |
| 34 | } | |
| 35 | notistoolchain() | |
| 36 | { | |
| 37 | for t in $TOOLCHAIN | |
| 38 | do | |
| 39 | if [ "$t" = "$1" ]; then | |
| 40 | return 1 | |
| 41 | fi | |
| 42 | done | |
| 43 | return 0 | |
| 44 | } | |
| 45 | ||
| 46 | # clean abort | |
| 47 | abort_configure() | |
| 48 | { | |
| 49 | rm -Rf "$TEMP_DIR" | |
| 50 | exit 1 | |
| 51 | } | |
| 52 | ||
| 53 | # Test for availability of pkg-config | |
| 54 | PKG_CONFIG=`command -v pkg-config` | |
| 55 | : ${PKG_CONFIG:="false"} | |
| 56 | ||
| 57 | # Simple uname based platform detection | |
| 58 | # $PLATFORM is used for platform dependent dependency selection | |
| 59 | OS=`uname -s` | |
| 60 | OS_VERSION=`uname -r` | |
|
69
f70ba8f14b41
update uwproj (fixes configure on solaris)
Mike Becker <universe@uap-core.de>
parents:
48
diff
changeset
|
61 | ARCH=`uname -m` |
| 0 | 62 | printf "detect platform... " |
| 63 | if [ "$OS" = "SunOS" ]; then | |
| 64 | PLATFORM="solaris sunos unix svr4" | |
| 65 | elif [ "$OS" = "Linux" ]; then | |
| 66 | PLATFORM="linux unix" | |
| 67 | elif [ "$OS" = "FreeBSD" ]; then | |
| 68 | PLATFORM="freebsd bsd unix" | |
| 69 | elif [ "$OS" = "OpenBSD" ]; then | |
| 70 | PLATFORM="openbsd bsd unix" | |
| 71 | elif [ "$OS" = "NetBSD" ]; then | |
| 72 | PLATFORM="netbsd bsd unix" | |
| 73 | elif [ "$OS" = "Darwin" ]; then | |
| 74 | PLATFORM="macos osx bsd unix" | |
| 75 | elif echo "$OS" | grep -i "MINGW" > /dev/null; then | |
| 76 | PLATFORM="windows mingw" | |
| 77 | fi | |
| 78 | : ${PLATFORM:="unix"} | |
| 79 | ||
| 80 | PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` | |
| 81 | echo "$PLATFORM_NAME" | |
| 82 | ||
| 83 | ||
| 84 | # help text | |
| 85 | printhelp() | |
| 86 | { | |
| 87 | echo "Usage: $0 [OPTIONS]..." | |
| 70 | 88 | echo 'Configuration:' |
| 89 | cat << '__EOF__' | |
| 0 | 90 | |
| 91 | Build Types: | |
| 45 | 92 | --debug add extra compile flags for debug builds |
| 93 | --release add extra compile flags for release builds | |
| 0 | 94 | |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
95 | Optional Features: |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
96 | --enable-static statically link libstdc++ |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
97 | --enable-asan compile with address sanitizer |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
98 | --enable-ubsan compile with undefined behavior sanitizer |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
99 | |
| 0 | 100 | __EOF__ |
| 70 | 101 | abort_configure |
| 0 | 102 | } |
| 103 | ||
| 104 | # create temporary directory | |
| 105 | TEMP_DIR=".tmp-`uname -n`" | |
| 106 | rm -Rf "$TEMP_DIR" | |
| 107 | if mkdir -p "$TEMP_DIR"; then | |
| 108 | : | |
| 109 | else | |
| 110 | echo "Cannot create tmp dir $TEMP_DIR" | |
| 111 | echo "Abort" | |
| 112 | exit 1 | |
| 113 | fi | |
| 114 | touch "$TEMP_DIR/options" | |
| 115 | touch "$TEMP_DIR/features" | |
| 116 | ||
| 70 | 117 | # config variables |
| 0 | 118 | |
| 119 | # features | |
| 120 | ||
| 121 | # | |
| 122 | # parse arguments | |
| 123 | # | |
| 124 | BUILD_TYPE="default" | |
| 125 | for ARG in "$@" | |
| 126 | do | |
| 127 | case "$ARG" in | |
| 70 | 128 | "--help"*) printhelp ;; |
| 129 | "--debug") BUILD_TYPE="debug" ;; | |
| 130 | "--release") BUILD_TYPE="release" ;; | |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
131 | "--enable-static") FEATURE_STATIC=on ;; |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
132 | "--disable-static") unset FEATURE_STATIC ;; |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
133 | "--enable-asan") FEATURE_ASAN=on ;; |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
134 | "--disable-asan") unset FEATURE_ASAN ;; |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
135 | "--enable-ubsan") FEATURE_UBSAN=on ;; |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
136 | "--disable-ubsan") unset FEATURE_UBSAN ;; |
| 0 | 137 | "-"*) echo "unknown option: $ARG"; abort_configure ;; |
| 138 | esac | |
| 139 | done | |
| 140 | ||
| 70 | 141 | # toolchain detection utilities |
| 142 | . make/toolchain.sh | |
| 143 | ||
| 144 | # check languages | |
| 145 | lang_c= | |
| 146 | lang_cpp= | |
| 147 | if detect_cpp_compiler ; then | |
| 148 | lang_cpp=1 | |
| 149 | fi | |
| 150 | ||
| 0 | 151 | |
| 152 | ||
| 153 | # set defaults for dir variables | |
| 154 | : ${exec_prefix:="$prefix"} | |
| 155 | : ${bindir:='${exec_prefix}/bin'} | |
| 156 | : ${sbindir:='${exec_prefix}/sbin'} | |
| 157 | : ${libdir:='${exec_prefix}/lib'} | |
| 158 | : ${libexecdir:='${exec_prefix}/libexec'} | |
| 159 | : ${datarootdir:='${prefix}/share'} | |
| 160 | : ${datadir:='${datarootdir}'} | |
| 161 | : ${sharedstatedir:='${prefix}/com'} | |
| 70 | 162 | if [ -z "$sysconfdir" ]; then |
| 163 | if [ "$prefix" = '/usr' ]; then | |
| 164 | sysconfdir='/etc' | |
| 165 | else | |
| 166 | sysconfdir='${prefix}/etc' | |
| 167 | fi | |
| 168 | fi | |
| 169 | if [ -z "$localstatedir" ]; then | |
| 170 | if [ "$prefix" = '/usr' ]; then | |
| 171 | localstatedir='/var' | |
| 172 | else | |
| 173 | localstatedir='${prefix}/var' | |
| 174 | fi | |
| 175 | fi | |
| 176 | if [ -z "$runstatedir" ]; then | |
| 177 | if [ "$prefix" = '/usr' ]; then | |
| 178 | runstatedir='/var/run' | |
| 179 | else | |
| 180 | runstatedir='${prefix}/var' | |
| 181 | fi | |
| 182 | fi | |
| 0 | 183 | : ${includedir:='${prefix}/include'} |
| 184 | : ${infodir:='${datarootdir}/info'} | |
| 185 | : ${mandir:='${datarootdir}/man'} | |
| 186 | : ${localedir:='${datarootdir}/locale'} | |
| 187 | ||
| 45 | 188 | |
| 0 | 189 | # check if a config.site exists and load it |
| 70 | 190 | CONFIG_SITE_OK=0 |
| 0 | 191 | if [ -n "$CONFIG_SITE" ]; then |
| 192 | # CONFIG_SITE may contain space separated file names | |
| 193 | for cs in $CONFIG_SITE; do | |
| 194 | printf "loading defaults from $cs... " | |
| 70 | 195 | if [ -f "$cs" ]; then |
| 196 | . "$cs" | |
| 197 | echo ok | |
| 198 | CONFIG_SITE_OK=1 | |
| 199 | break | |
| 200 | else | |
| 201 | echo "not found" | |
| 202 | fi | |
| 0 | 203 | done |
| 204 | elif [ -f "$prefix/share/config.site" ]; then | |
| 205 | printf "loading site defaults... " | |
| 206 | . "$prefix/share/config.site" | |
| 207 | echo ok | |
| 70 | 208 | CONFIG_SITE_OK=1 |
| 0 | 209 | elif [ -f "$prefix/etc/config.site" ]; then |
| 210 | printf "loading site defaults... " | |
| 211 | . "$prefix/etc/config.site" | |
| 212 | echo ok | |
| 70 | 213 | CONFIG_SITE_OK=1 |
| 214 | fi | |
| 215 | ||
| 216 | if [ $CONFIG_SITE_OK -eq 0 ]; then | |
|
69
f70ba8f14b41
update uwproj (fixes configure on solaris)
Mike Becker <universe@uap-core.de>
parents:
48
diff
changeset
|
217 | # try to detect the correct libdir on our own, except it was changed by the user |
| 70 | 218 | if [ "$libdir" = '${exec_prefix}/lib' ] ; then |
| 219 | if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then | |
| 220 | if [ "$OS" = "SunOS" ]; then | |
| 221 | [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64' | |
|
69
f70ba8f14b41
update uwproj (fixes configure on solaris)
Mike Becker <universe@uap-core.de>
parents:
48
diff
changeset
|
222 | else |
| 70 | 223 | [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64' |
|
69
f70ba8f14b41
update uwproj (fixes configure on solaris)
Mike Becker <universe@uap-core.de>
parents:
48
diff
changeset
|
224 | fi |
| 70 | 225 | elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then |
| 226 | if [ "$OS" = "SunOS" ]; then | |
| 227 | [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32' | |
| 228 | else | |
| 229 | [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32' | |
| 230 | fi | |
|
69
f70ba8f14b41
update uwproj (fixes configure on solaris)
Mike Becker <universe@uap-core.de>
parents:
48
diff
changeset
|
231 | fi |
|
f70ba8f14b41
update uwproj (fixes configure on solaris)
Mike Becker <universe@uap-core.de>
parents:
48
diff
changeset
|
232 | fi |
| 0 | 233 | fi |
| 234 | ||
| 235 | ||
| 236 | # generate vars.mk | |
| 237 | cat > "$TEMP_DIR/vars.mk" << __EOF__ | |
| 238 | __EOF__ | |
| 239 | ||
| 240 | ||
| 241 | # | |
| 242 | # DEPENDENCIES | |
| 243 | # | |
| 244 | ||
| 70 | 245 | |
| 0 | 246 | |
| 247 | # create buffer for make variables required by dependencies | |
| 248 | echo > "$TEMP_DIR/make.mk" | |
| 249 | ||
| 250 | test_pkg_config() | |
| 251 | { | |
| 252 | if "$PKG_CONFIG" --exists "$1" ; then : | |
| 253 | else return 1 ; fi | |
| 254 | if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : | |
| 255 | else return 1 ; fi | |
| 256 | if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : | |
| 257 | else return 1 ; fi | |
| 258 | if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : | |
| 259 | else return 1 ; fi | |
| 260 | return 0 | |
| 261 | } | |
| 262 | ||
| 263 | print_check_msg() | |
| 264 | { | |
| 265 | if [ -z "$1" ]; then | |
| 266 | shift | |
| 267 | printf "$@" | |
| 268 | fi | |
| 269 | } | |
| 270 | ||
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
271 | dependency_error_asan() |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
272 | { |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
273 | print_check_msg "$dep_checked_asan" "checking for asan... " |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
274 | # dependency asan toolchain="gnuc" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
275 | while true |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
276 | do |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
277 | if notistoolchain "gnuc"; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
278 | break |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
279 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
280 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS -fsanitize=address" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
281 | TEMP_LDFLAGS="$TEMP_LDFLAGS -fsanitize=address" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
282 | print_check_msg "$dep_checked_asan" "yes\n" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
283 | dep_checked_asan=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
284 | return 1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
285 | done |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
286 | |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
287 | print_check_msg "$dep_checked_asan" "no\n" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
288 | dep_checked_asan=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
289 | return 0 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
290 | } |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
291 | dependency_error_static() |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
292 | { |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
293 | print_check_msg "$dep_checked_static" "checking for static... " |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
294 | # dependency static toolchain="gnuc" |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
295 | while true |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
296 | do |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
297 | if notistoolchain "gnuc"; then |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
298 | break |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
299 | fi |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
300 | TEMP_LDFLAGS="$TEMP_LDFLAGS -static" |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
301 | print_check_msg "$dep_checked_static" "yes\n" |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
302 | dep_checked_static=1 |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
303 | return 1 |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
304 | done |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
305 | |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
306 | print_check_msg "$dep_checked_static" "no\n" |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
307 | dep_checked_static=1 |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
308 | return 0 |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
309 | } |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
310 | dependency_error_ubsan() |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
311 | { |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
312 | print_check_msg "$dep_checked_ubsan" "checking for ubsan... " |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
313 | # dependency ubsan toolchain="gnuc" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
314 | while true |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
315 | do |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
316 | if notistoolchain "gnuc"; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
317 | break |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
318 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
319 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS -fsanitize=undefined" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
320 | TEMP_LDFLAGS="$TEMP_LDFLAGS -fsanitize=undefined" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
321 | print_check_msg "$dep_checked_ubsan" "yes\n" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
322 | dep_checked_ubsan=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
323 | return 1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
324 | done |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
325 | |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
326 | print_check_msg "$dep_checked_ubsan" "no\n" |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
327 | dep_checked_ubsan=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
328 | return 0 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
329 | } |
| 0 | 330 | |
| 331 | # start collecting dependency information | |
| 332 | echo > "$TEMP_DIR/flags.mk" | |
| 333 | ||
| 334 | DEPENDENCIES_FAILED= | |
| 335 | ERROR=0 | |
| 336 | # unnamed dependencies | |
| 337 | TEMP_CFLAGS="$CFLAGS" | |
| 338 | TEMP_CXXFLAGS="$CXXFLAGS" | |
| 339 | TEMP_LDFLAGS="$LDFLAGS" | |
| 340 | while true | |
| 341 | do | |
| 342 | while true | |
| 343 | do | |
| 344 | if [ -z "$lang_cpp" ] ; then | |
| 345 | ERROR=1 | |
| 346 | break | |
| 347 | fi | |
| 348 | ||
|
10
bf159cf9f4b6
improve heatmap::add() by using C++23 ranges-v3
Mike Becker <universe@uap-core.de>
parents:
5
diff
changeset
|
349 | TEMP_CXXFLAGS="$TEMP_CXXFLAGS -std=c++23" |
| 0 | 350 | break |
| 351 | done | |
| 352 | break | |
| 353 | done | |
| 354 | ||
| 45 | 355 | # build type |
| 356 | if [ "$BUILD_TYPE" = "debug" ]; then | |
| 357 | TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS" | |
| 358 | TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 359 | fi | |
| 360 | if [ "$BUILD_TYPE" = "release" ]; then | |
| 361 | TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS" | |
| 362 | TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS" | |
| 363 | fi | |
| 364 | ||
| 0 | 365 | # add general dependency flags to flags.mk |
| 366 | echo "# general flags" >> "$TEMP_DIR/flags.mk" | |
| 367 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then | |
| 368 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 369 | fi | |
| 370 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then | |
| 371 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 372 | fi | |
| 373 | if [ -n "${TEMP_LDFLAGS}" ]; then | |
| 374 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 375 | fi | |
| 376 | ||
| 377 | # | |
| 378 | # OPTION VALUES | |
| 379 | # | |
| 380 | ||
| 381 | # | |
| 382 | # TARGETS | |
| 383 | # | |
| 384 | ||
| 385 | echo >> "$TEMP_DIR/flags.mk" | |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
386 | echo "configuring global target" |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
387 | echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" |
| 0 | 388 | TEMP_CFLAGS= |
| 389 | TEMP_CXXFLAGS= | |
| 390 | TEMP_LDFLAGS= | |
| 391 | ||
| 392 | ||
| 393 | # Features | |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
394 | if [ -n "$FEATURE_STATIC" ]; then |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
395 | # check dependency |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
396 | if dependency_error_static ; then |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
397 | # "auto" features can fail and are just disabled in this case |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
398 | if [ "$FEATURE_STATIC" = "auto" ]; then |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
399 | DISABLE_FEATURE_STATIC=1 |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
400 | else |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
401 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED static " |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
402 | ERROR=1 |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
403 | fi |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
404 | fi |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
405 | if [ -n "$DISABLE_FEATURE_STATIC" ]; then |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
406 | unset FEATURE_STATIC |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
407 | fi |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
408 | fi |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
409 | if [ -n "$FEATURE_STATIC" ]; then |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
410 | : |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
411 | else |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
412 | : |
|
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
413 | fi |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
414 | if [ -n "$FEATURE_ASAN" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
415 | # check dependency |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
416 | if dependency_error_asan ; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
417 | # "auto" features can fail and are just disabled in this case |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
418 | if [ "$FEATURE_ASAN" = "auto" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
419 | DISABLE_FEATURE_ASAN=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
420 | else |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
421 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED asan " |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
422 | ERROR=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
423 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
424 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
425 | if [ -n "$DISABLE_FEATURE_ASAN" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
426 | unset FEATURE_ASAN |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
427 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
428 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
429 | if [ -n "$FEATURE_ASAN" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
430 | : |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
431 | else |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
432 | : |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
433 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
434 | if [ -n "$FEATURE_UBSAN" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
435 | # check dependency |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
436 | if dependency_error_ubsan ; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
437 | # "auto" features can fail and are just disabled in this case |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
438 | if [ "$FEATURE_UBSAN" = "auto" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
439 | DISABLE_FEATURE_UBSAN=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
440 | else |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
441 | DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ubsan " |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
442 | ERROR=1 |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
443 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
444 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
445 | if [ -n "$DISABLE_FEATURE_UBSAN" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
446 | unset FEATURE_UBSAN |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
447 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
448 | fi |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
449 | if [ -n "$FEATURE_UBSAN" ]; then |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
450 | : |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
451 | else |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
452 | : |
|
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
453 | fi |
| 0 | 454 | |
| 455 | ||
| 456 | if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then | |
| 457 | echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 458 | fi | |
| 459 | if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then | |
| 460 | echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 461 | fi | |
| 462 | if [ -n "${TEMP_LDFLAGS}" ]; then | |
| 463 | echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" | |
| 464 | fi | |
| 465 | ||
| 466 | ||
| 467 | # final result | |
| 468 | if [ $ERROR -ne 0 ]; then | |
| 469 | echo | |
| 470 | echo "Error: Unresolved dependencies" | |
| 471 | echo "$DEPENDENCIES_FAILED" | |
| 472 | abort_configure | |
| 473 | fi | |
| 474 | ||
| 475 | echo "configure finished" | |
| 476 | echo | |
| 70 | 477 | echo "Toolchain:" |
| 45 | 478 | echo " name: $TOOLCHAIN_NAME" |
| 479 | if [ -n "$TOOLCHAIN_CC" ]; then | |
| 480 | echo " cc: $TOOLCHAIN_CC" | |
| 481 | fi | |
| 482 | if [ -n "$TOOLCHAIN_CXX" ]; then | |
| 483 | echo " cxx: $TOOLCHAIN_CXX" | |
| 484 | fi | |
| 485 | if [ -n "$TOOLCHAIN_WSIZE" ]; then | |
| 486 | echo " word size: $TOOLCHAIN_WSIZE bit" | |
| 487 | fi | |
| 488 | if [ -n "$TOOLCHAIN_CSTD" ]; then | |
| 489 | echo " default C std: $TOOLCHAIN_CSTD" | |
| 490 | fi | |
| 491 | echo | |
| 70 | 492 | echo "Config:" |
| 45 | 493 | echo |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
494 | echo "Features:" |
| 70 | 495 | printf ' %-16s' 'static:' |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
496 | if [ -n "$FEATURE_STATIC" ]; then |
| 70 | 497 | echo 'on' |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
498 | else |
| 70 | 499 | echo 'off' |
|
34
cc9d74d5eb46
add configure option for static linking
Mike Becker <universe@uap-core.de>
parents:
10
diff
changeset
|
500 | fi |
| 70 | 501 | printf ' %-16s' 'asan:' |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
502 | if [ -n "$FEATURE_ASAN" ]; then |
| 70 | 503 | echo 'on' |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
504 | else |
| 70 | 505 | echo 'off' |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
506 | fi |
| 70 | 507 | printf ' %-16s' 'ubsan:' |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
508 | if [ -n "$FEATURE_UBSAN" ]; then |
| 70 | 509 | echo 'on' |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
510 | else |
| 70 | 511 | echo 'off' |
|
48
c7b37d5e26cf
add asan and ubsan features
Mike Becker <universe@uap-core.de>
parents:
45
diff
changeset
|
512 | fi |
| 0 | 513 | echo |
| 514 | ||
| 515 | # generate the config.mk file | |
| 45 | 516 | pwd=`pwd` |
| 0 | 517 | cat > "$TEMP_DIR/config.mk" << __EOF__ |
| 518 | # | |
| 45 | 519 | # config.mk generated by: |
| 520 | # pwd: $pwd | |
| 521 | # $0 $@ | |
| 0 | 522 | # |
| 523 | ||
| 524 | __EOF__ | |
| 525 | write_toolchain_defaults "$TEMP_DIR/toolchain.mk" | |
| 45 | 526 | cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
| 0 | 527 | rm -Rf "$TEMP_DIR" |