summaryrefslogtreecommitdiffstats
path: root/Src/Modules
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2026-05-27 05:39:30 +0200
committerMikael Magnusson <mikachu@gmail.com>2026-06-07 12:45:29 +0200
commit1426a4dfdc2eccbcbf0c2583efd802e4169b487b (patch)
treee69ac7a82eb40f2f6b5f382aad041ef293340682 /Src/Modules
parentunposted: zsh/nearcolor: update docs, add tests (diff)
downloadzsh-1426a4dfdc2eccbcbf0c2583efd802e4169b487b.tar
zsh-1426a4dfdc2eccbcbf0c2583efd802e4169b487b.tar.gz
zsh-1426a4dfdc2eccbcbf0c2583efd802e4169b487b.tar.bz2
zsh-1426a4dfdc2eccbcbf0c2583efd802e4169b487b.tar.lz
zsh-1426a4dfdc2eccbcbf0c2583efd802e4169b487b.tar.xz
zsh-1426a4dfdc2eccbcbf0c2583efd802e4169b487b.tar.zst
zsh-1426a4dfdc2eccbcbf0c2583efd802e4169b487b.zip
54669: add --disable-link-all-libs configure option
When this is used, libraries only needed by specific modules will only be linked to those modules (currently libgdbm and libpcre2). When --enable-cap is used, the main shell also uses libcap functions so we want to link that either way. Speaking of the cap module, it did some weird thing where it always compiles but creates useless builtins that only error, which means you can't rely on zmodload to check if they'll work. I'm sure someone will complain about me changing this but I'm going to at least try it and see if someone has a good reason for it. The gdbm module also has a big ifdef for the whole module, but instead of dummy builtins it just does #error, so remove that. We won't try to compile it if the user didn't ask for it, and if the user asked for it and it wouldn't compile, configure won't create a Makefile. Using the ac_cv_ cache variables in db_gdbm.mdd also doesn't actually work properly, those will remain set and enable the module to be linked after you pass --disable-gdbm and you will get the aforementioned #error. Use the enable_gdbm variable instead, like pcre.mdd does (and also cap.mdd now that I evilly made it conditional on --enable-cap).
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/cap.c10
-rw-r--r--Src/Modules/cap.mdd2
-rw-r--r--Src/Modules/db_gdbm.c10
-rw-r--r--Src/Modules/db_gdbm.mdd4
-rw-r--r--Src/Modules/pcre.mdd2
5 files changed, 6 insertions, 22 deletions
diff --git a/Src/Modules/cap.c b/Src/Modules/cap.c
index 6db7cbc2a..a99e15c88 100644
--- a/Src/Modules/cap.c
+++ b/Src/Modules/cap.c
@@ -30,8 +30,6 @@
#include "cap.mdh"
#include "cap.pro"
-#ifdef HAVE_CAP_GET_PROC
-
static int
bin_cap(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
{
@@ -116,14 +114,6 @@ bin_setcap(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
return ret;
}
-#else /* !HAVE_CAP_GET_PROC */
-
-# define bin_cap bin_notavail
-# define bin_getcap bin_notavail
-# define bin_setcap bin_notavail
-
-#endif /* !HAVE_CAP_GET_PROC */
-
/* module paraphernalia */
static struct builtin bintab[] = {
diff --git a/Src/Modules/cap.mdd b/Src/Modules/cap.mdd
index 905f7ca47..543cf0139 100644
--- a/Src/Modules/cap.mdd
+++ b/Src/Modules/cap.mdd
@@ -1,5 +1,5 @@
name=zsh/cap
-link=dynamic
+link=`if test "x$enable_cap" = xyes; then echo dynamic; else echo no; fi`
load=no
autofeatures="b:cap b:getcap b:setcap"
diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c
index 34f577e30..604788ae8 100644
--- a/Src/Modules/db_gdbm.c
+++ b/Src/Modules/db_gdbm.c
@@ -46,12 +46,6 @@ static void myfreeparamnode(HashNode hn);
static int no_database_action = 0;
-/*
- * Make sure we have all the bits I'm using for memory mapping, otherwise
- * I don't know what I'm doing.
- */
-#if defined(HAVE_GDBM_H) && defined(HAVE_GDBM_OPEN)
-
#include <gdbm.h>
static char *backtype = "db/gdbm";
@@ -817,7 +811,3 @@ myfreeparamnode(HashNode hn)
}
zfree(pm, sizeof(struct param));
}
-
-#else
-# error no gdbm
-#endif /* have gdbm */
diff --git a/Src/Modules/db_gdbm.mdd b/Src/Modules/db_gdbm.mdd
index 210c22177..122ba8a36 100644
--- a/Src/Modules/db_gdbm.mdd
+++ b/Src/Modules/db_gdbm.mdd
@@ -1,5 +1,5 @@
name=zsh/db/gdbm
-link='if test "x$ac_cv_lib_gdbm_gdbm_open" = xyes && test "x$ac_cv_header_gdbm_h" = xyes; then
+link='if test "x$enable_gdbm" = xyes; then
echo dynamic
else
echo no
@@ -10,3 +10,5 @@ load=no
autofeatures="b:ztie b:zuntie b:zgdbmpath p:zgdbm_tied"
objects="db_gdbm.o"
+
+libs="@GDBM_LIBS@"
diff --git a/Src/Modules/pcre.mdd b/Src/Modules/pcre.mdd
index 3e1579117..dac271b48 100644
--- a/Src/Modules/pcre.mdd
+++ b/Src/Modules/pcre.mdd
@@ -5,3 +5,5 @@ load=no
autofeatures="b:pcre_compile b:pcre_study b:pcre_match"
objects="pcre.o"
+
+libs="@PCRE_LIBS@"