Hello.

Due to an error in configure.ac we've got a wrong C-code for testing "whether 
getcwd works":
In config.log:
conftest.c:29:18: error: initializer element is not constant
      char *cwd = getcwd(NULL, 0);
                  ^~~~~~
conftest.c:30:6: error: expected identifier or '(' before 'return'
      return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE;
      ^~~~~~
configure:17623: $? = 1
configure: program exited with status 1
configure: failed program was:
...
| #include <stdlib.h>
|      #include <unistd.h>
|      char *cwd = getcwd(NULL, 0);
|      return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE;
| int
| main ()
| {
|
|   ;
|   return 0;
| }


and it's always in ./configure:
checking whether getcwd(NULL, 0) works... no

Proposed fix in the attachment: configure_getcwd_check_fix.patch

I've tested it and I've got the correct result during ./configure:
checking whether getcwd(NULL, 0) works... yes
and in config.log




Yours sincerely,

Danilov Alexander

alexander.dani...@cma.se
diff -ru trunk/configure.ac trunk.fixed/configure.ac
--- trunk/configure.ac	2024-02-27 16:53:37.903873721 +0300
+++ trunk.fixed/configure.ac	2024-02-27 16:55:25.012602629 +0300
@@ -71,9 +71,7 @@
 AC_MSG_CHECKING([whether getcwd(NULL, 0) works])
 AC_CACHE_VAL([xml_cv_func_getcwd_null],
 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-     #include <unistd.h>
-     char *cwd = getcwd(NULL, 0);
-     return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE;]])],
+#include <unistd.h>]], [[const char *cwd = getcwd(NULL, 0); return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE;]])],
   [xml_cv_func_getcwd_null=yes],
   [xml_cv_func_getcwd_null=no])])
 AC_MSG_RESULT([$xml_cv_func_getcwd_null])

Reply via email to