--- bison-3.1/src/output.c	2018-10-15 18:36:29.904915892 +0100
+++ bison-3.1/src/output.c	2018-10-15 18:39:56.535896440 +0100
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#define _GNU_SOURCE
+#include <stdio.h>
+
 #include <config.h>
 #include "system.h"
 
@@ -574,6 +577,10 @@
     if (*M4_GNU_OPTION)
       argv[i++] = M4_GNU_OPTION;
 
+    char *define = NULL;
+    asprintf(&define, "--define=b4_pkgdatadir=%s", datadir);
+    argv[i++] = define;
+
     argv[i++] = "-I";
     argv[i++] = datadir;
     if (trace_flag & trace_m4)
