// 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>
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>
#endif
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
WAI_FUNCSPEC
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
{