Use isfinite instead of finite which is not available on Apple Silicon systems:
https://gitlab.gnome.org/GNOME/dia/-/issues/525

Based on:
https://gitlab.gnome.org/GNOME/dia/-/commit/3f80231714d692f1dea43bbaa4bfc4e49cbc8d46
--- lib/arrows.c.orig	2014-08-24 10:46:01.000000000 -0500
+++ lib/arrows.c	2023-02-06 02:46:20.000000000 -0600
@@ -18,7 +18,6 @@
 
 #include <config.h>
 
-#define _BSD_SOURCE 1 /* to get finite */
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
@@ -421,7 +420,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
   point_get_perp(&vt,&vl);
@@ -498,7 +497,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
   point_get_perp(&vt,&vl);
@@ -610,7 +609,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
   point_get_perp(&vt,&vl);
@@ -672,7 +671,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
 
@@ -718,7 +717,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
   point_get_perp(&vt,&vl);
@@ -832,7 +831,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
   point_get_perp(&vt,&vl);
@@ -908,7 +907,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
   point_get_perp(&vt,&vl);
@@ -946,7 +945,7 @@
   else {
     vl.x = 1.0; vl.y = 0.0;
   }
-  if (!finite(vl.x)) {
+  if (!isfinite(vl.x)) {
     vl.x = 1.0; vl.y = 0.0;
   }
   point_get_perp(&vt,&vl);
--- lib/boundingbox.c.orig	2014-08-24 10:46:01.000000000 -0500
+++ lib/boundingbox.c	2023-02-06 02:47:31.000000000 -0600
@@ -21,7 +21,6 @@
 
 #include <config.h>
 
-#define _BSD_SOURCE 1
 #include <math.h>
 #include <string.h> /* memcmp() */
 
--- objects/standard/arc.c.orig	2014-08-24 10:46:01.000000000 -0500
+++ objects/standard/arc.c	2023-02-06 02:47:19.000000000 -0600
@@ -18,7 +18,6 @@
 
 #include <config.h>
 
-#define _BSD_SOURCE 1 /* to get finite */
 #include <math.h>
 #include <assert.h>
 
@@ -405,7 +404,7 @@
             angle -= -atan2(oep0->y - arc->center.y, oep0->x - arc->center.x); /* minus angle of old */
             angle += -atan2(ep1->y - arc->center.y, ep1->x - arc->center.x); /* plus angle of new */
             angle -= -atan2(oep1->y - arc->center.y, oep1->x - arc->center.x); /* minus angle of old */
-            if (!finite(angle)){
+            if (!isfinite(angle)){
                     return 0;
             }
             if (angle < -1 * M_PI){
