Add an extra forward slash in front of $(pkgdatadir) to avoid the path
being translated to use backslashes under MSYS2/MinGW. This trick is
needed since DFLT_GVPRPATH is a string which is compiled and
backslashes in strings are interpreted as escape sequences. See
https://stackoverflow.com/a/
14189687
Fixes errors like this when using autotools with MinGW:
gvpr.c:228:41: error: incomplete universal character name \U
228 | pathp = path = concat(DFLT_GVPRPATH, path);
| ^
gvpr.c:228:41: warning: unknown escape sequence: '\m'
gvpr.c:228:41: warning: unknown escape sequence: '\g'
gvpr.c:228:41: warning: unknown escape sequence: '\s'
gvpr.c:228:41: warning: unknown escape sequence: '\g'
gvpr.c:228:41: warning: unknown escape sequence: '\g'
HOSTCC ?= $(CC)
GVPR_VERSION="2:0:0"
+if WITH_MINGW
+# Add an extra forward slash in front of $(pkgdatadir) to avoid the
+# path being translated to use backslashes under MSYS2/MinGW. This
+# trick is needed since DFLT_GVPRPATH is a string which is compiled
+# and backslashes in strings are interpreted as escape sequences. See
+# https://stackoverflow.com/a/14189687
+DFLT_GVPRPATH="\".$(PATH_SEPARATOR)/$(pkgdatadir)/gvpr\""
+else
+DFLT_GVPRPATH="\".$(PATH_SEPARATOR)$(pkgdatadir)/gvpr\""
+endif
+
AM_CPPFLAGS = \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/common \
-I$(top_builddir)/lib/common \
-I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt \
- -DDFLT_GVPRPATH="\".$(PATH_SEPARATOR)$(pkgdatadir)/gvpr\""
+ -DDFLT_GVPRPATH=$(DFLT_GVPRPATH)
pkginclude_HEADERS = gvpr.h
noinst_HEADERS = actions.h compile.h gdefs.h gprdata.inc gprstate.h parse.h \