From 3a6c1f049bb3643c86eb87f6c69cf7c3d3c95c86 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 24 May 2024 09:37:57 -0400 Subject: configure: Use --with/--without for libraries --- build/header.mk | 2 +- build/msg-if.sh | 4 ++-- build/pkgconf.sh | 18 +++++++----------- build/pkgs.mk | 10 +++++----- build/use/libacl.c | 9 --------- build/use/libcap.c | 9 --------- build/use/libselinux.c | 9 --------- build/use/liburing.c | 9 --------- build/use/oniguruma.c | 9 --------- build/with/libacl.c | 9 +++++++++ build/with/libcap.c | 9 +++++++++ build/with/libselinux.c | 9 +++++++++ build/with/liburing.c | 9 +++++++++ build/with/oniguruma.c | 9 +++++++++ 14 files changed, 60 insertions(+), 64 deletions(-) delete mode 100644 build/use/libacl.c delete mode 100644 build/use/libcap.c delete mode 100644 build/use/libselinux.c delete mode 100644 build/use/liburing.c delete mode 100644 build/use/oniguruma.c create mode 100644 build/with/libacl.c create mode 100644 build/with/libcap.c create mode 100644 build/with/libselinux.c create mode 100644 build/with/liburing.c create mode 100644 build/with/oniguruma.c (limited to 'build') diff --git a/build/header.mk b/build/header.mk index fb8246d..09454c5 100644 --- a/build/header.mk +++ b/build/header.mk @@ -51,7 +51,7 @@ HEADERS := \ gen/has/uselocale.h # Previously generated by pkgs.mk -PKG_HEADERS := ${ALL_PKGS:%=gen/use/%.h} +PKG_HEADERS := ${ALL_PKGS:%=gen/with/%.h} gen/config.h: ${PKG_HEADERS} ${HEADERS} ${MSG} "[ GEN] $@" diff --git a/build/msg-if.sh b/build/msg-if.sh index 8112aea..e0d0957 100755 --- a/build/msg-if.sh +++ b/build/msg-if.sh @@ -6,8 +6,8 @@ # Print a success/failure indicator from a makefile: # # $ ./configure -# [ CC ] use/liburing.c ✘ -# [ CC ] use/oniguruma.c ✔ +# [ CC ] with/liburing.c ✘ +# [ CC ] with/oniguruma.c ✔ set -eu diff --git a/build/pkgconf.sh b/build/pkgconf.sh index 96e4bf1..244c95d 100755 --- a/build/pkgconf.sh +++ b/build/pkgconf.sh @@ -26,22 +26,18 @@ esac if [ -z "$MODE" ]; then # Check whether the libraries exist at all for LIB; do - # Check ${USE_$LIB} - USE_LIB="USE_$(printf '%s' "$LIB" | tr 'a-z-' 'A-Z_')" - eval "USE=\"\${$USE_LIB:-}\"" - case "$USE" in - y|1) - continue - ;; - n|0) - exit 1 - ;; + # Check ${WITH_$LIB} + WITH_LIB="WITH_$(printf '%s' "$LIB" | tr 'a-z-' 'A-Z_')" + eval "WITH=\"\${$WITH_LIB:-}\"" + case "$WITH" in + y|1) continue ;; + n|0) exit 1 ;; esac CFLAGS=$("$0" --cflags "$LIB") || exit 1 LDFLAGS=$("$0" --ldflags "$LIB") || exit 1 LDLIBS=$("$0" --ldlibs "$LIB") || exit 1 - build/cc.sh $CFLAGS $LDFLAGS build/use/$LIB.c $LDLIBS || exit 1 + build/cc.sh $CFLAGS $LDFLAGS build/with/$LIB.c $LDLIBS || exit 1 done fi diff --git a/build/pkgs.mk b/build/pkgs.mk index 5a26548..5de9ac2 100644 --- a/build/pkgs.mk +++ b/build/pkgs.mk @@ -8,7 +8,7 @@ include gen/vars.mk include gen/flags.mk include build/exports.mk -HEADERS := ${ALL_PKGS:%=gen/use/%.h} +HEADERS := ${ALL_PKGS:%=gen/with/%.h} gen/pkgs.mk: ${HEADERS} ${MSG} "[ GEN] $@" @@ -24,10 +24,10 @@ gen/pkgs.mk: ${HEADERS} .PHONY: gen/pkgs.mk -# Convert gen/use/foo.h to foo -PKG = ${@:gen/use/%.h=%} +# Convert gen/with/foo.h to foo +PKG = ${@:gen/with/%.h=%} ${HEADERS}:: @${MKDIR} ${@D} - @build/define-if.sh use/${PKG} build/pkgconf.sh ${PKG} >$@ 2>$@.log; \ - build/msg-if.sh "[ CC ] use/${PKG}.c" test $$? -eq 0; + @build/define-if.sh with/${PKG} build/pkgconf.sh ${PKG} >$@ 2>$@.log; \ + build/msg-if.sh "[ CC ] with/${PKG}.c" test $$? -eq 0; diff --git a/build/use/libacl.c b/build/use/libacl.c deleted file mode 100644 index de1fe50..0000000 --- a/build/use/libacl.c +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright © Tavian Barnes -// SPDX-License-Identifier: 0BSD - -#include - -int main(void) { - acl_free(0); - return 0; -} diff --git a/build/use/libcap.c b/build/use/libcap.c deleted file mode 100644 index 58e832c..0000000 --- a/build/use/libcap.c +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright © Tavian Barnes -// SPDX-License-Identifier: 0BSD - -#include - -int main(void) { - cap_free(0); - return 0; -} diff --git a/build/use/libselinux.c b/build/use/libselinux.c deleted file mode 100644 index bca409d..0000000 --- a/build/use/libselinux.c +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright © Tavian Barnes -// SPDX-License-Identifier: 0BSD - -#include - -int main(void) { - freecon(0); - return 0; -} diff --git a/build/use/liburing.c b/build/use/liburing.c deleted file mode 100644 index bea499a..0000000 --- a/build/use/liburing.c +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright © Tavian Barnes -// SPDX-License-Identifier: 0BSD - -#include - -int main(void) { - io_uring_free_probe(0); - return 0; -} diff --git a/build/use/oniguruma.c b/build/use/oniguruma.c deleted file mode 100644 index cb17596..0000000 --- a/build/use/oniguruma.c +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright © Tavian Barnes -// SPDX-License-Identifier: 0BSD - -#include - -int main(void) { - onig_free(0); - return 0; -} diff --git a/build/with/libacl.c b/build/with/libacl.c new file mode 100644 index 0000000..de1fe50 --- /dev/null +++ b/build/with/libacl.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +int main(void) { + acl_free(0); + return 0; +} diff --git a/build/with/libcap.c b/build/with/libcap.c new file mode 100644 index 0000000..58e832c --- /dev/null +++ b/build/with/libcap.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +int main(void) { + cap_free(0); + return 0; +} diff --git a/build/with/libselinux.c b/build/with/libselinux.c new file mode 100644 index 0000000..bca409d --- /dev/null +++ b/build/with/libselinux.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +int main(void) { + freecon(0); + return 0; +} diff --git a/build/with/liburing.c b/build/with/liburing.c new file mode 100644 index 0000000..bea499a --- /dev/null +++ b/build/with/liburing.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +int main(void) { + io_uring_free_probe(0); + return 0; +} diff --git a/build/with/oniguruma.c b/build/with/oniguruma.c new file mode 100644 index 0000000..cb17596 --- /dev/null +++ b/build/with/oniguruma.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +int main(void) { + onig_free(0); + return 0; +} -- cgit v1.2.3