]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
ltmain.in: Add 'S_ISDIR' definition for MSVC
authorIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Wed, 26 Mar 2025 15:19:39 +0000 (17:19 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Thu, 7 Aug 2025 17:20:03 +0000 (20:20 +0300)
Several test failures occur from fix for sr #111191 with MSVC, which is
fixed by defining S_ISDIR with a different variable name, MSVC_ISDIR.

  error LNK2019: unresolved external symbol S_ISDIR referenced in func check_executable

* build-aux/ltmain.in: Define and use macro MSVC_ISDIR.

build-aux/ltmain.in

index bc1457edf97c6d2eda9ac152c0106fcba79e1c19..af01443032fa98bf9e1ee52fb363f916b60cd8ee 100644 (file)
@@ -3859,6 +3859,7 @@ int setenv (const char *, const char *, int);
 # define getcwd  _getcwd
 # define putenv  _putenv
 # define S_IXUSR _S_IEXEC
+# define MSVC_ISDIR(m)(((m) & S_IFMT) == S_IFDIR)
 #elif defined __MINGW32__
 # define setmode _setmode
 # define stat    _stat
@@ -4254,8 +4255,13 @@ check_executable (const char *path)
   if ((!path) || (!*path))
     return 0;
 
+#ifdef _MSC_VER
+  if ((stat (path, &st) >= 0) && !MSVC_ISDIR (st.st_mode)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+#else
   if ((stat (path, &st) >= 0) && !S_ISDIR (st.st_mode)
       && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+#endif
     return 1;
   else
     return 0;