iodine/src/osflags
Erik Ekman ec5c89a368
Merge pull request #93 from ffontaine/master
src/osflags: fully fix cross-compilation
2023-11-30 00:29:17 +01:00

59 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
: "${PKG_CONFIG:=pkg-config}"
case $2 in
link)
case $1 in
SunOS | solaris)
echo '-lsocket -lnsl';
;;
BeOS)
echo '-lsocket -lbind -lbsd';
;;
Haiku)
echo '-lnetwork -lbsd';
;;
windows32)
echo '-lws2_32 -liphlpapi';
;;
Linux)
FLAGS="";
"$PKG_CONFIG" --exists libselinux && FLAGS="$FLAGS $($PKG_CONFIG --libs libselinux)";
"$PKG_CONFIG" --exists libsystemd-daemon && FLAGS="$FLAGS $($PKG_CONFIG --libs libsystemd-daemon)";
"$PKG_CONFIG" --exists libsystemd && FLAGS="$FLAGS $($PKG_CONFIG --libs libsystemd)";
echo $FLAGS;
;;
esac
;;
cflags)
case $1 in
windows32)
echo '-DWINVER=0x0501';
;;
BeOS)
echo '-Dsocklen_t=int';
;;
Haiku)
echo '-D_DEFAULT_SOURCE';
;;
Darwin)
echo '-D__APPLE_USE_RFC_3542';
;;
Linux)
FLAGS="-D_GNU_SOURCE"
"$PKG_CONFIG" --exists libselinux && FLAGS="$FLAGS -DHAVE_SETCON";
"$PKG_CONFIG" --exists libsystemd-daemon && FLAGS="$FLAGS -DHAVE_SYSTEMD";
"$PKG_CONFIG" --exists libsystemd && FLAGS="$FLAGS -DHAVE_SYSTEMD";
echo $FLAGS;
;;
GNU/kFreeBSD|GNU)
echo '-D_GNU_SOURCE'
;;
esac
;;
*)
;;
esac