aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorAnna “CyberTailor” <cyber@sysrq.in>2021-07-08 19:05:06 +0500
committerOmar Polo <op@omarpolo.com>2021-07-08 16:56:29 +0200
commit8c9b8f487e9efd3eab489d205fd55d97da34a6c3 (patch)
tree3346b54132b738b8e71c69128585756afadd3ae6 /configure
parent9c84a04f9cf948abc9d1c94e37a25a1f857b77b1 (diff)
replace add_{cflags,ldflags} with add_library
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure38
1 files changed, 10 insertions, 28 deletions
diff --git a/configure b/configure
index 7f1889d..016ae56 100755
--- a/configure
+++ b/configure
@@ -62,40 +62,25 @@ BINDIR=
INSTALL="install"
-add_cflags() {
- CFLAGS="${CFLAGS} $(pkg-config --cflags "$1")"
-}
-
-add_ldflags() {
- LDFLAGS="${LDFLAGS} $(pkg-config --libs "$1")"
+add_library() {
+ if pkg-config "$1"; then
+ CFLAGS="${CFLAGS} $(pkg-config --cflags "$1")"
+ LDFLAGS="${LDFLAGS} $(pkg-config --libs "$1")"
+ fi
}
# try to auto detect CFLAGS and LDFLAGS
if which pkg-config 2>/dev/null 1>&2; then
- if pkg-config libtls; then
- add_cflags "libtls"
- add_ldflags "libtls"
- fi
-
- if pkg-config openssl; then
- add_cflags "openssl"
- add_ldflags "openssl"
- fi
+ add_library "libtls"
+ add_library "openssl"
case "$(uname)" in
OpenBSD)
# use libevent and imsg in base
;;
*)
- if pkg-config libevent; then
- add_cflags "libevent"
- add_ldflags "libevent"
- fi
-
- if pkg-config libimsg; then
- add_cflags "libimsg"
- add_ldflags "libimsg"
- fi
+ add_library "libevent"
+ add_library "libimsg"
;;
esac
@@ -103,10 +88,7 @@ if which pkg-config 2>/dev/null 1>&2; then
*BSD|DragonFly|Darwin)
;;
*)
- if pkg-config libbsd-ctor libbsd-overlay; then
- add_cflags "libbsd-ctor libbsd-overlay"
- add_ldflags "libbsd-ctor libbsd-overlay"
- fi
+ add_library "libbsd-ctor libbsd-overlay"
;;
esac
fi