Fix detection and use of pcre2.h from a subdirectory master
authorJakub Kulik <kulikjak@gmail.com>
Thu, 26 Jun 2025 10:39:32 +0000 (12:39 +0200)
committerFabian Keil <fk@fabiankeil.de>
Thu, 26 Jun 2025 11:22:33 +0000 (13:22 +0200)
SF bug #946.

configure.in
pcrs.h

index 094ccaa..a363a60 100644 (file)
@@ -887,8 +887,8 @@ AC_CHECK_LIB(pcre2-8, pcre2_compile_8, [
       AC_EGREP_HEADER(pcre2_pattern_info, pcre2.h,[have_pcre2=yes; AC_DEFINE(HAVE_PCRE2)], [AC_MSG_WARN([[pcre2 old version installed]]); have_pcre2=no])
    ], [
       AC_CHECK_HEADER(pcre2/pcre2.h, [
-         AC_EGREP_HEADER(pcre2_pattern_info, pcre2/pcre2.h, [have_pcre2=yes; AC_DEFINE(PCRE2_H_IN_SUBDIR)], [AC_MSG_WARN([[pcre2 old version installed]]); have_pcre2=no])
-      ], [have_pcre2=no])
+         AC_EGREP_HEADER(pcre2_pattern_info, pcre2/pcre2.h, [have_pcre2=yes; AC_DEFINE(HAVE_PCRE2) AC_DEFINE(PCRE2_H_IN_SUBDIR)], [AC_MSG_WARN([[pcre2 old version installed]]); have_pcre2=no])
+      ], [have_pcre2=no], [#define PCRE2_CODE_UNIT_WIDTH 8])
    ], [#define PCRE2_CODE_UNIT_WIDTH 8])
 ], [have_pcre2=no])
 
diff --git a/pcrs.h b/pcrs.h
index 8e2fb96..507d697 100644 (file)
--- a/pcrs.h
+++ b/pcrs.h
 #define PCRE2_CODE_UNIT_WIDTH 8
 #define PCREn(x) PCRE2_ ## x
 #ifndef _PCRE2_H
-#include <pcre2.h>
+#  ifdef PCRE2_H_IN_SUBDIR
+#    include <pcre2/pcre2.h>
+#  else
+#    include <pcre2.h>
+#  endif
 #endif
 
 /*