Index: configure
--- configure.orig	2025-07-19 23:57:51.000000000 +0200
+++ configure	2025-07-29 22:58:04.792043000 +0200
@@ -25411,7 +25411,9 @@
 
         LUA_INCLUDES=""
         LUA_LIBS=""
-        LUA_INSTALL_DIR=""
+	if test -z "$LUA_INSTALL_DIR" ; then
+	        LUA_INSTALL_DIR=""
+	fi
 
         if test -n "$lua_inc"; then
            CFLAGS="$CFLAGS -I$lua_inc"
Index: lib/ortho/trapezoid.c
--- lib/ortho/trapezoid.c.orig	2025-07-19 23:57:44.000000000 +0200
+++ lib/ortho/trapezoid.c	2025-07-29 22:58:04.792221000 +0200
@@ -34,6 +34,11 @@
 #include <util/list.h>
 #include <util/unreachable.h>
 
+#include <sys/param.h>
+#if __FreeBSD_version <= 704101 || (__FreeBSD_version >= 800000 && __FreeBSD_version < 802502) || (__FreeBSD_version >= 900000 && __FreeBSD_version < 900027)
+#define log2(x)  (log(x)/log(2))
+#endif
+
 /* Node types */
 
 #define T_X     1
Index: lib/util/gv_find_me.c
--- lib/util/gv_find_me.c.orig	2025-07-19 23:57:44.000000000 +0200
+++ lib/util/gv_find_me.c	2025-07-29 22:59:16.114353000 +0200
@@ -2,6 +2,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <util/gv_find_me.h>
 
 #ifdef __APPLE__
Index: plugin/gd/gvrender_gd.c
--- plugin/gd/gvrender_gd.c.orig	2025-07-19 23:57:44.000000000 +0200
+++ plugin/gd/gvrender_gd.c	2025-07-29 22:58:04.792336000 +0200
@@ -32,6 +32,10 @@
 #include <util/alloc.h>
 #include <util/unreachable.h>
 
+#ifndef HAVE_GD_FONTCONFIG
+#define HAVE_GD_FONTCONFIG
+#endif
+
 enum {
 	FORMAT_GIF,
 	FORMAT_JPEG,
Index: plugin/gd/gvtextlayout_gd.c
--- plugin/gd/gvtextlayout_gd.c.orig	2025-07-19 23:57:44.000000000 +0200
+++ plugin/gd/gvtextlayout_gd.c	2025-07-29 22:58:04.792417000 +0200
@@ -20,6 +20,10 @@
 #include <util/strcasecmp.h>
 #include <util/strview.h>
 
+#ifndef HAVE_GD_FONTCONFIG
+#define HAVE_GD_FONTCONFIG
+#endif
+
 #ifdef HAVE_GD_FREETYPE
 
 /* fontsize at which text is omitted entirely */
