]> granicus.if.org Git - graphviz/commitdiff
lib/gvpr: autotools: fix incorrect MinGW path translation in DFLT_GVPRPATH string
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Thu, 22 Jul 2021 04:40:36 +0000 (06:40 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 7 Dec 2021 06:35:00 +0000 (07:35 +0100)
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'

lib/gvpr/Makefile.am

index 087c270b9cfc1da8cb4c42118be70e3d77ca6923..001b18b43b7c0c9df04a54e136551db2ed9eb2cb 100644 (file)
@@ -5,13 +5,24 @@ pkgconfigdir = $(libdir)/pkgconfig
 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 \