aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Romanko <me@blankhex.com>2025-09-06 16:19:50 +0300
committerMikhail Romanko <me@blankhex.com>2025-09-06 16:19:50 +0300
commit4196e8f4c9148d0f0ff6572d5cc0a814150d72eb (patch)
tree576c1cd9fbff09de169da4c7e88c9fdb5ccbdecd
parent7cae7045044619f29b1926730c23319ad5d5af4a (diff)
downloadbhlib-4196e8f4c9148d0f0ff6572d5cc0a814150d72eb.tar.gz
Make MT flags configurable in configure script
Remove hardcoded multithreading flags so that we can support exotic compilers/OSs
-rwxr-xr-xconfigure17
1 files changed, 14 insertions, 3 deletions
diff --git a/configure b/configure
index a6e35a2..903cbf2 100755
--- a/configure
+++ b/configure
@@ -18,6 +18,9 @@ cflags=${CFLAGS}
ldflags=${LDFLAGS}
ldlibs=${LDLIBS}
ldshared=${LDSHARED:--shared}
+cflagsmt=${CFLAGSMT:--pthread}
+ldflagsmt=${LDFLAGSMT:--pthread}
+ldlibsmt=${LDLIBSMT}
platform=""
display_help="no"
@@ -32,6 +35,9 @@ for option do
--ldflags=*) ldflags="${option#--ldflags=}" ;;
--ldlibs=*) ldlibs="${option#--ldlibs=}" ;;
--ldshared=*) ldshared="${option#--ldshared=}" ;;
+ --cflagsmt=*) cflagsmt="${option#--cflagsmt=}" ;;
+ --ldflagsmt=*) ldflagsmt="${option#--ldflagsmt=}" ;;
+ --ldlibsmt=*) ldlibsmt="${option#--ldlibsmt=}" ;;
--platform=*) platform="${option#--platform=}" ;;
--prefix=*) prefix_path="${option#--prefix=}" ;;
--enable-shared|--enable-shared=yes) enable_shared="yes" ;;
@@ -65,8 +71,11 @@ Options:
--arflags= Archiver flags
--cflags= Compiler flags
--ldflags= Linker flags
- --ldlibs= Extra libraries
+ --ldlibs= Linker libraries
--ldshared= Linker flags for shared libraries
+ --cflagsmt= Compiler flags for multithreading
+ --ldflagsmt= Linker flags for multithreading
+ --ldlibsmt= Linker libraries for multithreading
--platform=[Posix|Win32|Dummy] Specify target platform
--prefix= Install prefix
--enable-shared[=yes|no] Make shared library
@@ -124,8 +133,10 @@ if [ "$enable_pic" = "no" ] && [ "$enable_shared" = "yes" ]; then
echo "configure: WARNING: expect build failure"
fi
-if [ "$enable_mt" = "yes" ] && [ "$platform" = "Posix" ]; then
- ldlibs="$ldlibs -pthread"
+if [ "$enable_mt" = "yes" ]; then
+ cflags="$cflags $cflagsmt"
+ ldflags="$ldflags $ldflagsmt"
+ ldlibs="$ldlibs $ldlibsmt"
fi
# Create directories