Only when crash is built with "make eppic", eppic extension will be loaded at
startup automatically. This can give users a chance to choose if they don't
need eppic.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
Makefile | 3 +++
configure.c | 14 +++++++++++++-
main.c | 4 ++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 2c22f21..75e4fe5 100644
--- a/Makefile
+++ b/Makefile
@@ -298,6 +298,9 @@ endif
ifeq ($(findstring valgrind,$(MAKECMDGOALS)),valgrind)
CONF_TARGET_FLAG += -x valgrind
endif
+ifeq ($(findstring eppic,$(MAKECMDGOALS)),eppic)
+CONF_TARGET_FLAG += -x eppic
+endif
# To build the extensions library by default, uncomment the third command
# line below. Otherwise they can be built by entering "make extensions".
diff --git a/configure.c b/configure.c
index e062631..808e947 100644
--- a/configure.c
+++ b/configure.c
@@ -1863,6 +1863,9 @@ get_extra_flags(char *filename, char *initial)
*
* For valgrind:
* - enter -DVALGRIND in the CFLAGS.extra file
+ *
+ * For eppic:
+ * - enter -DEPPIC in the CFLAGS.extra file
*/
void
add_extra_lib(char *option)
@@ -1871,6 +1874,7 @@ add_extra_lib(char *option)
int snappy, add_DSNAPPY, add_lsnappy;
int zstd, add_DZSTD, add_lzstd;
int valgrind, add_DVALGRIND;
+ int add_DEPPIC;
char *cflags, *ldflags;
FILE *fp_cflags, *fp_ldflags;
char *mode;
@@ -1880,6 +1884,7 @@ add_extra_lib(char *option)
snappy = add_DSNAPPY = add_lsnappy = 0;
zstd = add_DZSTD = add_lzstd = 0;
valgrind = add_DVALGRIND = 0;
+ add_DEPPIC = 0;
ldflags = get_extra_flags("LDFLAGS.extra", NULL);
cflags = get_extra_flags("CFLAGS.extra", NULL);
@@ -1914,6 +1919,11 @@ add_extra_lib(char *option)
add_DVALGRIND++;
}
+ if (strcmp(option, "eppic") == 0) {
+ if (!cflags || !strstr(cflags, "-DEPPIC"))
+ add_DEPPIC++;
+ }
+
if ((lzo || snappy || zstd) &&
file_exists("diskdump.o") && (unlink("diskdump.o") <
0)) {
perror("diskdump.o");
@@ -1939,7 +1949,7 @@ add_extra_lib(char *option)
return;
}
- if (add_DLZO || add_DSNAPPY || add_DZSTD || add_DVALGRIND) {
+ if (add_DLZO || add_DSNAPPY || add_DZSTD || add_DVALGRIND || add_DEPPIC) {
while (fgets(inbuf, 512, fp_cflags))
;
if (add_DLZO)
@@ -1950,6 +1960,8 @@ add_extra_lib(char *option)
fputs("-DZSTD\n", fp_cflags);
if (add_DVALGRIND)
fputs("-DVALGRIND\n", fp_cflags);
+ if (add_DEPPIC)
+ fputs("-DEPPIC\n", fp_cflags);
}
if (add_llzo2 || add_lsnappy || add_lzstd) {
diff --git a/main.c b/main.c
index 70506f3..7279156 100644
--- a/main.c
+++ b/main.c
@@ -821,6 +821,10 @@ main_loop(void)
if (pc->flags & PRELOAD_EXTENSIONS)
preload_extensions(NULL);
+#ifdef EPPIC
+ else
+ preload_extensions("eppic.so");
+#endif
/*
* Return here if a non-recoverable error occurs
--
2.47.0