rpcsvc/nfs_prot.h \
sys/io.h \
pty.h \
- err.h])
+ err.h \
+ linux/version.h])
AC_CHECK_HEADERS([linux/raw.h],
[AM_CONDITIONAL([HAVE_RAW], [true])],
[AM_CONDITIONAL([HAVE_RAW], [false])])
include $(top_srcdir)/config/include-Makefile.am
dist_noinst_HEADERS = carefulputc.h env.h linux_reboot.h md5.h \
- nls.h pathnames.h setproctitle.h widechar.h xstrncpy.h
+ nls.h pathnames.h setproctitle.h widechar.h xstrncpy.h \
+ linux_version.h
--- /dev/null
+#ifndef LINUX_VERSION_H
+#define LINUX_VERSION_H
+
+#ifdef HAVE_LINUX_VERSION_H
+# include <linux/version.h>
+#endif
+
+#ifndef KERNEL_VERSION
+# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#endif
+
+int get_linux_version(void);
+
+#endif /* LINUX_VERSION_H */
--- /dev/null
+#include <stdio.h>
+#include <sys/utsname.h>
+
+#include "linux_version.h"
+
+int
+get_linux_version (void)
+{
+ static int kver = -1;
+ struct utsname uts;
+ int major;
+ int minor;
+ int teeny;
+
+ if (kver != -1)
+ return kver;
+ if (uname (&uts))
+ kver = 0;
+ else if (sscanf (uts.release, "%d.%d.%d", &major, &minor, &teeny) != 3)
+ kver = 0;
+ else
+ kver = KERNEL_VERSION (major, minor, teeny);
+
+ return kver;
+}