/* Define as 1 if we need myrealloc */
#define NEED_MYREALLOC 0
-/* Define as 1 if chown() or chgrp() follows symlinks */
+/* Define as 1 if chown() follows symlinks and you don't have lchown() */
#define CHOWN_FOLLOWS_SYMLINK 0
/* Define as 1 if you have <sys/select.h> */
#define HAVE_SYS_SELECT_H 0
+/* Define as 1 if you have lchown() */
+#define HAVE_LCHOWN 0
+
#endif
AC_DEFINE(HAVE_S_ISSOCK)
fi
-dnl Does chown() follow symlinks? This should be a good enough test.
-AC_MSG_CHECKING(whether chown() follows symlinks...)
-AC_ARG_ENABLE([broken-chown],
-[ --enable-broken-chown this system's chown follows symbolic links],
- result=yes, result=no)
-if test $result = no; then
- if test `id -u` = 0; then
- rm -f foo bar
- touch foo
- ln -s foo bar
- chown 10 bar
- if test `ls -l foo | awk '{print $3}'` != "root"; then
- result=yes
- else
- result=no
- fi
- rm -f foo bar
- else
- AC_MSG_CHECKING((cannot check by non-root user))
- result=no
- fi
-fi
-AC_MSG_RESULT($result)
-if test $result = yes; then
- AC_DEFINE(CHOWN_FOLLOWS_SYMLINK)
-fi
-
AC_MSG_CHECKING(if timezone is defined...)
AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
AC_CHECK_FUNC(strerror, [], MISCOBJS="$MISCOBJS strerror.o")
AC_CHECK_FUNC(strtol, [], MISCOBJS="$MISCOBJS strtol.o")
AC_CHECK_FUNC(strtoul, [], MISCOBJS="$MISCOBJS strtoul.o")
+LCHOWN=no
+AC_CHECK_FUNC(lchown, [LCHOWN=yes; AC_DEFINE(HAVE_LCHOWN)])
+
+if test "$LCHOWN" = no; then
+ dnl Does chown() follow symlinks? This should be a good enough test.
+ AC_MSG_CHECKING(whether chown() follows symlinks...)
+ AC_ARG_ENABLE([broken-chown],
+ [ --enable-broken-chown this system's chown follows symbolic links],
+ result=yes, result=no)
+ if test $result = no; then
+ if test `id -u` = 0; then
+ rm -f foo bar
+ touch foo
+ ln -s foo bar
+ chown 10 bar
+ if test `ls -l foo | awk '{print $3}'` != "root"; then
+ result=yes
+ else
+ result=no
+ fi
+ rm -f foo bar
+ else
+ AC_MSG_CHECKING((cannot check by non-root user))
+ result=no
+ fi
+ fi
+
+ AC_MSG_RESULT($result)
+ if test $result = yes; then
+ AC_DEFINE(CHOWN_FOLLOWS_SYMLINK)
+ fi
+fi
if test -n "$MISCOBJS"; then
LIBMISC=-lmisc