diff --git a/meson.build b/meson.build index fcfb3eb..e9233b4 100644 --- a/meson.build +++ b/meson.build @@ -124,6 +124,14 @@ else endif have_getopt_long = cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE') +if not cc.has_header_symbol('limits.h', 'PATH_MAX', prefix: system_ext_define) + if host_machine.system() == 'windows' + # see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation + configh_data.set('PATH_MAX', 260) + else + configh_data.set('PATH_MAX', 4096) + endif +endif # Silence some security & deprecation warnings on MSVC # for some unix/C functions we use. diff --git a/tools/tools-common.c b/tools/tools-common.c index 0c1ffb9..254499d 100644 --- a/tools/tools-common.c +++ b/tools/tools-common.c @@ -42,9 +42,6 @@ #ifdef _MSC_VER #include #include -#ifndef PATH_MAX -#define PATH_MAX MAX_PATH -#endif #else #include #include