I can reproduce this compilation failure on my Apple MacBook Pro M1 with MacOS BigSur 11.2.
The configure script will check *ac_cv_posix1_2008_realpath* to ensure that
*realpath* function call exists on the target platform however this check failed.
Gnu global use *realpath* in many files, as you can see.
/libutil/getdbpath.c:240: if (realpath(p, root) == NULL) {
./libutil/getdbpath.c:327: s = realpath(makepath(root, s, NULL), buf);
./libutil/args.c:218: if (!realpath(confpath, real))
./libutil/path.h:44:char *realpath(const char *, char *);
./libutil/abs2rel.c:122: path = abs2rel("/sys/kern", realpath("/sys", resolvedname), result,
./libutil/abs2rel.c:132: path = abs2rel(realpath("/sys/kern", r1), realpath("/sys", r2),
./libutil/abs2rel.c:135: The realpath() function assures correct result, but don't forget that
./libutil/abs2rel.c:136: realpath() requires that all but the last component of the path exist.
./libutil/nearsort.c:49: if (root[0] == '\0' || realpath(path, real) == NULL)
./libutil/nearsort.c:52: fprintf(stderr, "realpath = %s\n", real);
./libutil/path.c:168: * realpath: get the complete path
./libutil/path.c:175:realpath(const char *in_path, char *out_path)
./libutil/find.c:492: * getrealpath: return a real path of dir using allocated area.
./libutil/find.c:495:getrealpath(const char *dir)
./libutil/find.c:499: if ((real = realpath(dir, NULL)) == NULL)
./libutil/find.c:518: if ((real = realpath(dir, NULL)) == NULL)
./libutil/find.c:694: if ((rootdir = realpath(start, NULL)) == NULL)
./libutil/find.c:705: curp->real = getrealpath(dir);
./libutil/find.c:915: curp->real = getrealpath(dir);
./htags/htags.c:1361: char realpath[MAXPATHLEN];
./htags/htags.c:1367: if (!vgetcwd(realpath, sizeof(realpath)))
./htags/htags.c:1371: snprintf(distpath, sizeof(distpath), "%s/HTML", realpath);
./htags/htags.c:1412: if (realpath(dbpath, buf) == NULL)
./htags/htags.c:1413: die("cannot get realpath of dbpath.");
./gozilla/gozilla.c:285: makefileurl(realpath(file, buf), 0, URL);
./global/global.c:893: if (realpath(path, buf) == NULL)
./global/global.c:923: if (realpath(file_list, buf) == NULL)
However, the *stdlib.h* in MacOS BigSur 11.2 does provide us with a *realpath* api,
I can workaround this configure check failure by removing the * ac_cv_posix1_2008_realpath* checker.
So maybe the configure script is not compatible on MacOS bigSur 11.2.
diff --git a/configure b/configure
index 100a690..4e54a52 100755
--- a/configure
+++ b/configure
@@ -14273,33 +14273,6 @@ case "$host_os" in
mingw*|*djgpp*)
;;
*)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX.1-2008 realpath is equipped" >&5
-$as_echo_n "checking whether POSIX.1-2008 realpath is equipped... " >&6; }
-if ${ac_cv_posix1_2008_realpath+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-main(){ (void)realpath("/./tmp", (void *)0); return 0; }
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_posix1_2008_realpath=yes
-else
- ac_cv_posix1_2008_realpath=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_posix1_2008_realpath" >&5
$as_echo "$ac_cv_posix1_2008_realpath" >&6; }
> Hello,
> Thank you for the report.
>
> Could you please send this report to the autoconf bug mailing
> list? Since this bug seems to be a autoconf's bug.
> I cannot do anything, because I don't have a reproduction
> environment for this problem.
>
> Thank you in advance.
>
> Regards,
> Shigio
> 2021年1月15日(金) 13:22 Michael Labbé <mlabbe@gmail.com>:
>
> Package global failed to compile on my arm 11.1 system. This is due to an
> error because realpath cannot be found. The fix is to modify configure to
> include stdlib.h.
>
> Line 14291 of configure on global-6.6.5:
>
> main(){ (void)realpath("/./tmp", (void *)0); return 0; }
>
> Insert one line before that:
>
> #include<stdlib.h>
> main(){ (void)realpath("/./tmp", (void *)0); return 0; }
>
> configure now succeeds.
> --
> Shigio YAMAGUCHI <shigio@gnu.org>
> PGP fingerprint:
> 26F6 31B4 3D62 4A92 7E6F 1C33 969C 3BE3 89DD A6EB