Avoid the include warnings for major().
authorWayne Davison <wayned@samba.org>
Tue, 7 Apr 2020 22:16:19 +0000 (15:16 -0700)
committerWayne Davison <wayned@samba.org>
Tue, 7 Apr 2020 22:16:19 +0000 (15:16 -0700)
configure.ac
m4/header_major_fixed.m4 [new file with mode: 0644]
prepare-source.mak

index 2752b6a40f26aa3ef632e14132c64d63007f78f2..5ca7a55e3453ead1788ee032aa41469e4aee3825 100644 (file)
@@ -351,7 +351,7 @@ AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
     sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
     popt.h popt/popt.h linux/falloc.h netinet/in_systm.h netinet/ip.h \
     zlib.h)
-AC_HEADER_MAJOR
+AC_HEADER_MAJOR_FIXED
 
 AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
diff --git a/m4/header_major_fixed.m4 b/m4/header_major_fixed.m4
new file mode 100644 (file)
index 0000000..395889c
--- /dev/null
@@ -0,0 +1,27 @@
+AC_DEFUN([AC_HEADER_MAJOR_FIXED],
+[AC_CACHE_CHECK(whether sys/types.h defines makedev,
+               ac_cv_header_sys_types_h_makedev,
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <sys/types.h>]],
+                                [[return makedev(0, 0);]])],
+               [if grep 'historical compatibility' conftest.err >/dev/null; then
+                  ac_cv_header_sys_types_h_makedev=no
+                else
+                  ac_cv_header_sys_types_h_makedev=yes
+                fi],
+               [ac_cv_header_sys_types_h_makedev=no])
+])
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+AC_CHECK_HEADER(sys/mkdev.h,
+               [AC_DEFINE(MAJOR_IN_MKDEV, 1,
+                          [Define to 1 if `major', `minor', and `makedev' are
+                           declared in <mkdev.h>.])])
+
+  if test $ac_cv_header_sys_mkdev_h = no; then
+    AC_CHECK_HEADER(sys/sysmacros.h,
+                   [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
+                              [Define to 1 if `major', `minor', and `makedev'
+                               are declared in <sysmacros.h>.])])
+  fi
+fi
+])
index ad291feb9a2b8c0b026812f95d2cc3555ed18fee..bc1938de68613898a065408499d1627dae206436 100644 (file)
@@ -1,6 +1,6 @@
 conf: configure.sh config.h.in
 
-aclocal.m4:
+aclocal.m4: m4/*.m4
        aclocal -I m4
 
 configure.sh: configure.ac aclocal.m4