From 7c988e04e048e1c70f2bc049abda8a02fafa8930 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 4 May 2022 19:19:11 +0200 Subject: [PATCH] Make self-test of "./unrealircd module" check if ./Config has been ran. That is: it checks if the Makefile is there to avoid a mysterious "No rule to make target 'custommodule'" error message. --- src/modulemanager.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/modulemanager.c b/src/modulemanager.c index 9f50d8ffa..47b91f3f2 100644 --- a/src/modulemanager.c +++ b/src/modulemanager.c @@ -1655,21 +1655,23 @@ void mm_parse_c_file(int argc, char *args[]) void mm_self_test(void) { char name[512]; - snprintf(name, sizeof(name), "%s/src/modules/third", BUILDDIR); - if (file_exists(name)) - return; + if (!file_exists(BUILDDIR)) { fprintf(stderr, "ERROR: Directory %s does not exist.\n" "The UnrealIRCd source is required for the module manager to work!\n", BUILDDIR); + exit(-1); } else { - fprintf(stderr, "ERROR: Directory %s exists, but %s does not.\n" - "The UnrealIRCd source is required for the module manager to work.\n" - "It seems you only have a partial build directory??\n", - BUILDDIR, name); + snprintf(name, sizeof(name), "%s/src/modules/third/Makefile", BUILDDIR); + if (!file_exists(name)) + { + fprintf(stderr, "ERROR: Directory %s exists, but your UnrealIRCd is not compiled yet.\n" + "You must compile your UnrealIRCd first (run './Config', then 'make install')\n", + BUILDDIR); + exit(-1); + } } - exit(-1); } void modulemanager(int argc, char *args[])