Fix building whereami on Hurd
authorAndreas Rönnquist <gusnan@debian.org>
Tue, 7 Dec 2021 00:58:44 +0000 (01:58 +0100)
committerColin Clark <colin.clark@cclark.uk>
Wed, 29 Dec 2021 12:28:59 +0000 (12:28 +0000)
src/whereami.c

index b94ce26..fe12eba 100644 (file)
@@ -3,6 +3,10 @@
 //   by Gregory Pakosz (@gpakosz)
 // https://github.com/gpakosz/whereami
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 // in case you want to #include "whereami.c" in a larger compilation unit
 #if !defined(WHEREAMI_H)
 #include <whereami.h>
@@ -160,7 +164,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
   return length;
 }
 
-#elif defined(__linux__) || defined(__CYGWIN__) || defined(__sun) || defined(WAI_USE_PROC_SELF_EXE)
+#elif defined(__linux__) || defined(__CYGWIN__) || defined(__sun) || defined(__GNU__) || defined(WAI_USE_PROC_SELF_EXE)
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -183,6 +187,10 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
 #endif
 #endif
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 WAI_FUNCSPEC
 int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
 {