From e460a5bf893227ccd7cdc9b8e5beec1ebc30a858 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 28 Nov 2007 10:40:32 +0100 Subject: [PATCH] build-sys: cleanup usage of linux/major.h The utils like fdisk or login are usable on non-linux systems. This patch allows to compile on systems without linux/major.h. Signed-off-by: Karel Zak Signed-off-by: Samuel Thibault --- configure.ac | 2 +- fdisk/fdisksgilabel.c | 1 - fdisk/fdisksunlabel.c | 5 +++++ login-utils/checktty.c | 8 ++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ed12e60b..8a1d96d7 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ AC_PATH_PROG(VOLID, vol_id, [], [$PATH:/lib/udev]) AC_SYS_LARGEFILE -AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h], [], [], [ +AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [ #ifdef HAVE_LINUX_COMPILER_H #include #endif diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c index 5adf64e3..c970c7cf 100644 --- a/fdisk/fdisksgilabel.c +++ b/fdisk/fdisksgilabel.c @@ -22,7 +22,6 @@ #include #include "nls.h" -#include /* FLOPPY_MAJOR */ #include "blkdev.h" diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c index ff9a182d..4ed97330 100644 --- a/fdisk/fdisksunlabel.c +++ b/fdisk/fdisksunlabel.c @@ -27,7 +27,9 @@ #include /* SCSI_IOCTL_GET_IDLUN */ #undef u_char #endif +#ifdef HAVE_LINUX_MAJOR_H #include /* FLOPPY_MAJOR */ +#endif #include "common.h" #include "fdisk.h" @@ -69,6 +71,9 @@ static inline __u32 __swap32(__u32 x) { #define SSWAP32(x) (other_endian ? __swap32(x) \ : (__u32)(x)) +#ifndef FLOPPY_MAJOR +#define FLOPPY_MAJOR 2 +#endif #ifndef IDE0_MAJOR #define IDE0_MAJOR 3 #endif diff --git a/login-utils/checktty.c b/login-utils/checktty.c index 16f9f2e8..c28ee833 100644 --- a/login-utils/checktty.c +++ b/login-utils/checktty.c @@ -25,12 +25,18 @@ #include "nls.h" #include +#ifdef HAVE_LINUX_MAJOR_H #include +#endif #include "pathnames.h" #include "login.h" #include "xstrncpy.h" +#ifndef TTY_MAJOR +#define TTY_MAJOR 4 +#endif + static gid_t mygroups[NGROUPS]; static int num_groups; @@ -118,6 +124,7 @@ add_to_class(struct ttyclass *tc, char *tty) static int isapty(const char *tty) { +#ifdef __linux__ char devname[100]; struct stat stb; @@ -147,6 +154,7 @@ isapty(const char *tty) #endif } +#endif /* __linux__ */ return 0; } -- 2.39.5