include: Fallback to UTMP unless there is UTMPX support
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sun, 19 Apr 2015 21:45:17 +0000 (23:45 +0200)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Mon, 20 Apr 2015 13:24:30 +0000 (15:24 +0200)
Fixes compilation against uClibc-0.9.30 for instance

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
include/libbb.h

index 21da5f100e2db6e19a265c157dda6b3701e7bf52..f0ac1f50d4ccaeea73aed8bf22bd09f38b9f43a2 100644 (file)
 # include <selinux/av_permissions.h>
 #endif
 #if ENABLE_FEATURE_UTMP
-# include <utmpx.h>
+# if defined __UCLIBC__ && ( \
+    (UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 32) \
+     && UCLIBC_VERSION < KERNEL_VERSION(0, 9, 34) \
+     && defined __UCLIBC_HAS_UTMPX__ \
+    ) || ( \
+        UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 34) \
+       ) \
+  )
+#  include <utmpx.h>
+# elif defined __UCLIBC__
+#  include <utmp.h>
+#  define utmpx utmp
+#  define setutxent setutent
+#  define endutxent endutent
+#  define getutxent getutent
+#  define getutxid getutid
+#  define getutxline getutline
+#  define pututxline pututline
+#  define utmpxname utmpname
+#  define updwtmpx updwtmp
+#  define _PATH_UTMPX _PATH_UTMP
+# else
+#  include <utmpx.h>
+# endif
 #endif
 #if ENABLE_LOCALE_SUPPORT
 # include <locale.h>