From a98361d754d5d14499f8e3c8dee6163245fd6680 Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Mon, 25 Mar 2024 07:11:04 +0000
Subject: slibtoolize mode: slbt_st_get_stoolie_ctx(): support
 AC_CONFIG_MACRO_DIR.

---
 src/stoolie/slbt_stoolie_ctx.c | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

(limited to 'src/stoolie')

diff --git a/src/stoolie/slbt_stoolie_ctx.c b/src/stoolie/slbt_stoolie_ctx.c
index 337cb47..ec87821 100644
--- a/src/stoolie/slbt_stoolie_ctx.c
+++ b/src/stoolie/slbt_stoolie_ctx.c
@@ -157,7 +157,6 @@ int slbt_st_get_stoolie_ctx(
 					SLBT_NESTED_ERROR(dctx));
 	}
 
-	/* aux dir */
 	if (!ctx->auxbuf && ctx->cfgac) {
 		if (slbt_m4fake_expand_cmdarg(
 				dctx,ctx->cfgac,
@@ -175,7 +174,38 @@ int slbt_st_get_stoolie_ctx(
 	}
 
 	/* m4 dir */
-	if (ctx->makam) {
+	if (ctx->acinc) {
+		if (slbt_m4fake_expand_cmdarg(
+				dctx,ctx->acinc,
+				"AC_CONFIG_MACRO_DIR",
+				&pathbuf) < 0)
+			return slbt_st_free_stoolie_ctx_impl(
+				ctx,(-1),
+				SLBT_NESTED_ERROR(dctx));
+
+		if (pathbuf[0])
+			if (!(ctx->m4buf = strdup(pathbuf)))
+				return slbt_st_free_stoolie_ctx_impl(
+					ctx,(-1),
+					SLBT_NESTED_ERROR(dctx));
+	}
+
+	if (!ctx->m4buf && ctx->cfgac) {
+		if (slbt_m4fake_expand_cmdarg(
+				dctx,ctx->cfgac,
+				"AC_CONFIG_MACRO_DIR",
+				&pathbuf) < 0)
+			return slbt_st_free_stoolie_ctx_impl(
+				ctx,(-1),
+				SLBT_NESTED_ERROR(dctx));
+
+		if (pathbuf[0])
+			if (!(ctx->m4buf = strdup(pathbuf)))
+				return slbt_st_free_stoolie_ctx_impl(
+					ctx,(-1),
+					SLBT_NESTED_ERROR(dctx));
+	}
+	if (!ctx->m4buf && ctx->makam) {
 		for (pline=ctx->makam->txtlinev; !ctx->m4argv && *pline; pline++) {
 			if (!strncmp(*pline,"ACLOCAL_AMFLAGS",15)) {
 				if (isspace((*pline)[15]) || ((*pline)[15] == '=')) {
-- 
cgit v1.2.3