Skip to contentSkip to conversation

KLIBC support for device-mapper-1.01.04

PATCH Martin Schlemmer 2 participants 3 messages Aug 25, 2005 – Aug 27, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Some time back I sent a patch for KLIBC support for device-mapper, but no response so far. I have however updated the patch.

Comments and suggestions appreciated.

Regards,

Signature · 1 line
Martin Schlemmer
aclocal.m4 +94 -0
diff -urpN device-mapper.1.01.04/aclocal.m4 device-mapper.1.01.04.klibc/aclocal.m4
@@ -0,0 +1,94 @@
+# klibc.m4 serial 99
+## Copyright (C) 1995-2003 Free Software Foundation, Inc.
+## This file is free software, distributed under the terms of the GNU
+## General Public License.  As a special exception to the GNU General
+## Public License, this file may be distributed as part of a program
+## that contains a configuration script generated by Autoconf, under
+## the same distribution terms as the rest of that program.
+##
+## This file can can be used in projects which are not available under
+## the GNU General Public License or the GNU Library General Public
+## License but which still want to provide support for the GNU gettext
+## functionality.
+## Please note that the actual code of the KLIBC Library is partly covered
+## by the GNU Library General Public License, and party copyrighted by the
+## Regents of The University of California, and the rest is covered by a
+## MIT style license. 
+
+# Authors:
+#   Martin Schlemmer <[email protected]>, 2005.
+
+
+# AC_CHECK_KLIBC
+# --------------
+# Check if the user wants KLIBC support enabled.  If so, set KLIBC=yes and
+# fill in KLIBC_PREFIX, KLIBC_BINDIR, KLIBC_SBINDIR, KLIBC_LIBDIR and
+# KLIBC_INCLUDEDIR.  CC is also set to the proper klcc executable.
+# NOTE:  This should be called before AC_PROG_CC, and before header, function
+#        or type checks.
+AC_DEFUN([AC_CHECK_KLIBC],
+[AC_BEFORE([$0], [AC_PROG_CC])
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_ARG_ENABLE([klibc],
+              [AS_HELP_STRING([--enable-klibc],
+                              [Enable linking to klibc [no].  You need at
+                               least klibc-1.0 or later for this.  Set KLCC
+                               to the absolute file name of klcc if not in
+                               the PATH])],
+              [KLIBC=$enableval], [KLIBC=no])
+AC_ARG_ENABLE([klibc-layout],
+              [AS_HELP_STRING([--enable-klibc-layout],
+                              [Enable installing binaries, libraries and
+                               headers into the klibc prefix [yes] ])],
+              [if test "X$KLIBC" != Xno; then
+                 KLIBC_LAYOUT=$enableval
+               else
+                 KLIBC_LAYOUT=no
+               fi],
+              [if test "X$KLIBC" != Xno; then
+                 KLIBC_LAYOUT=yes
+               else
+                 KLIBC_LAYOUT=no
+               fi])
+
+if test "X$KLIBC" != Xno; then
+  # Basic cross compiling support.  I do not think it is wise to use
+  # AC_CHECK_TOOL, because if we are cross compiling, we do not want
+  # just 'klcc' to be returned ...
+  if test "${host_alias}" != "${build_alias}"; then
+    AC_CHECK_PROGS([KLCC], [${host_alias}-klcc], [no])
+  else
+    AC_CHECK_PROGS([KLCC], [klcc], [no])
+  fi
+  if test "X$KLCC" = Xno; then
+    AC_MSG_ERROR([cannot find klibc frontend 'klcc'!])
+  fi
+
+  CC="$KLCC"
+  CFLAGS="-Os"
+
+  KLIBC_KCROSS="$($KLCC -print-klibc-kcross 2>/dev/null)"
+  KLIBC_PREFIX="$($KLCC -print-klibc-prefix 2>/dev/null)"
+  KLIBC_BIN_DIR="$($KLCC -print-klibc-bindir 2>/dev/null)"
+  KLIBC_SBIN_DIR="${KLIBC_PREFIX}/${KLIBC_KCROSS}sbin"
+  KLIBC_LIB_DIR="$($KLCC -print-klibc-libdir 2>/dev/null)"
+  KLIBC_INCLUDE_DIR="$($KLCC -print-klibc-includedir 2>/dev/null)"
+
+  if test "X$KLIBC_LAYOUT" != Xno; then
+    prefix="$KLIBC_PREFIX"
+    bindir="$KLIBC_BIN_DIR"
+    sbindir="$KLIBC_SBIN_DIR"
+    libdir="$KLIBC_LIB_DIR"
+    includedir="$KLIBC_INCLUDE_DIR"
+  fi
+
+  # At least KLIBC_LIB_DIR should be valid, else klibc is too old or
+  # something went wrong
+  if test ! -d "$KLIBC_LIB_DIR"; then
+    AC_MSG_ERROR([your klibc installation is too old or not functional!])
+  fi
+fi
+
+AC_SUBST(KLIBC)
+])# AC_CHECK_KLIBC
+
configure.in +48 -23

97 lines not on this page · raw message

dmsetup/Makefile.in +16 -7
diff -urpN device-mapper.1.01.04/dmsetup/Makefile.in device-mapper.1.01.04.klibc/dmsetup/Makefile.in
@@ -17,11 +17,20 @@ top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 
 TARGETS = dmsetup
-INSTALL_TYPE = install_dynamic
 
-ifeq ("@STATIC_LINK@", "yes")
-  TARGETS += dmsetup.static
-  INSTALL_TYPE += install_static
+ifeq ("@KLIBC@", "yes")
+  DMLIBS += -ldevmapper_klibc
+  DM_LIBRARY = libdevmapper_klibc.a
+  INSTALL_TYPE = install_dynamic
+else
+  DMLIBS += -ldevmapper
+  DM_LIBRARY = libdevmapper.so
+  INSTALL_TYPE = install_dynamic
+
+  ifeq ("@STATIC_LINK@", "yes")
+    TARGETS += dmsetup.static
+    INSTALL_TYPE += install_static
+  endif
 endif
 
 SOURCES = dmsetup.c
@@ -29,13 +38,13 @@ CLEAN_TARGETS = dmsetup dmsetup.static
 
 include ../make.tmpl
 
-dmsetup: $(OBJECTS) $(interfacedir)/libdevmapper.$(LIB_SUFFIX)
+dmsetup: $(OBJECTS) $(interfacedir)/$(DM_LIBRARY)
 	$(CC) -o $@ $(OBJECTS) $(LDFLAGS) \
-	      -L$(interfacedir) -L$(DESTDIR)/lib -ldevmapper $(LIBS)
+	      -L$(interfacedir) -L$(DESTDIR)/lib $(DMLIBS) $(LIBS)
 
 dmsetup.static: $(OBJECTS) $(interfacedir)/libdevmapper.a
 	$(CC) -o $@ $(OBJECTS) $(LDFLAGS) -static \
-	      -L$(interfacedir) -L$(DESTDIR)/lib -ldevmapper $(LIBS)
+	      -L$(interfacedir) -L$(DESTDIR)/lib $(DMLIBS) $(LIBS)
 
 install: $(INSTALL_TYPE)
 
dmsetup/dmsetup.c +14 -1
diff -urpN device-mapper.1.01.04/dmsetup/dmsetup.c device-mapper.1.01.04.klibc/dmsetup/dmsetup.c
@@ -26,7 +26,9 @@
 #include <dirent.h>
 #include <errno.h>
 #include <unistd.h>
-#include <libgen.h>
+#ifndef __KLIBC__
+# include <libgen.h>
+#endif
 #include <sys/wait.h>
 #include <unistd.h>
 #include <sys/param.h>
@@ -1054,7 +1056,18 @@ static int _process_switches(int *argc, 
 	memset(&_values, 0, sizeof(_values));
 
 	namebase = strdup((*argv)[0]);
+#ifndef __KLIBC__
 	base = basename(namebase);
+#else
+	base = strrchr(namebase, '/');
+	if (base != NULL)
+		/* Remove leading '/' */
+		base++;
+	else
+		/* Already basename ? */
+		base = namebase;
+	
+#endif
 
 	if (!strcmp(base, "devmap_name")) {
 		free(namebase);
lib/Makefile.in +21 -10
diff -urpN device-mapper.1.01.04/lib/Makefile.in device-mapper.1.01.04.klibc/lib/Makefile.in
@@ -29,12 +29,16 @@ SOURCES = libdm-common.c libdm-file.c $(
 
 INCLUDES = -I$(interface)
 
-LIB_STATIC = $(interface)/libdevmapper.a
-
-ifeq ("@LIB_SUFFIX@","dylib")
-  LIB_SHARED = $(interface)/libdevmapper.dylib
+ifeq ("@KLIBC@", "yes")
+  LIB_STATIC = $(interface)/libdevmapper_klibc.a
 else
-  LIB_SHARED = $(interface)/libdevmapper.so
+  LIB_STATIC = $(interface)/libdevmapper.a
+
+  ifeq ("@LIB_SUFFIX@","dylib")
+    LIB_SHARED = $(interface)/libdevmapper.dylib
+  else
+    LIB_SHARED = $(interface)/libdevmapper.so
+  endif
 endif
 
 CFLAGS += -DDEVICE_UID=@DEVICE_UID@ -DDEVICE_GID=@DEVICE_GID@ \
@@ -47,8 +51,14 @@ include ../make.tmpl
 
 INSTALL_TYPE = install_dynamic
 
-ifeq ("@STATIC_LINK@", "yes")
-  INSTALL_TYPE += install_static
+ifeq ("@KLIBC@", "yes")
+  INSTALL_TYPE = install_static
+else
+  INSTALL_TYPE = install_dynamic
+
+  ifeq ("@STATIC_LINK@", "yes")
+    INSTALL_TYPE += install_static
+  endif
 endif
 
 install: $(INSTALL_TYPE)
@@ -60,7 +70,8 @@ install_dynamic: install_@interface@
 		$(includedir)/libdevmapper.h
 
 install_static: install_@interface@_static
-	$(LN_S) -f libdevmapper.a.$(LIB_VERSION) $(libdir)/libdevmapper.a
+	$(LN_S) -f $(notdir $(LIB_STATIC)).$(LIB_VERSION) \
+		$(libdir)/$(notdir $(LIB_STATIC))
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.h \
 		$(includedir)/libdevmapper.h
 
@@ -72,9 +83,9 @@ install_ioctl: ioctl/libdevmapper.$(LIB_
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
 		$(libdir)/libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION)
 
-install_ioctl_static: ioctl/libdevmapper.a
+install_ioctl_static: ioctl/$(notdir $(LIB_STATIC))
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
-		$(libdir)/libdevmapper.a.$(LIB_VERSION)
+		$(libdir)/$(notdir $(LIB_STATIC)).$(LIB_VERSION)
 
 .PHONY: distclean_lib distclean
 
lib/ioctl/libdm-iface.c +15 -8
diff -urpN device-mapper.1.01.04/lib/ioctl/libdm-iface.c device-mapper.1.01.04.klibc/lib/ioctl/libdm-iface.c
@@ -122,24 +122,30 @@ static int _get_proc_number(const char *
 			    uint32_t *number)
 {
 	FILE *fl;
-	char nm[256];
-	int c;
+	char nm[256], buf[300];
+	int num, size;
 
 	if (!(fl = fopen(file, "r"))) {
 		log_error("%s: fopen failed: %s", file, strerror(errno));
 		return 0;
 	}
 
-	while (!feof(fl)) {
-		if (fscanf(fl, "%d %255s\n", number, &nm[0]) == 2) {
+	/* Use fread+sscanf for klibc compatibility. */
+	do {
+		size = 0;
+		do {
+			num = fread(&buf[size], sizeof(char), 1, fl);
+			if (num > 0)
+				size++;
+		} while (num > 0 && buf[size - 1] != '\n');
+		buf[size] = '\0';
+		if (sscanf(buf, "%d %255s\n", number, &nm[0]) == 2) {
 			if (!strcmp(name, nm)) {
 				fclose(fl);
 				return 1;
 			}
-		} else do {
-			c = fgetc(fl);
-		} while (c != EOF && c != '\n');
-	}
+		}
+	} while (num > 0);
 	fclose(fl);
 
 	log_error("%s: No entry for %s found", file, name);
@@ -151,6 +157,7 @@ static int _control_device_number(uint32
 	if (!_get_proc_number(PROC_DEVICES, MISC_NAME, major) ||
 	    !_get_proc_number(PROC_MISC, DM_NAME, minor)) {
 		*major = 0;
+		printf("Failed to get device number!\n");
 		return 0;
 	}
 
lib/libdm-file.c +4 -2
diff -urpN device-mapper.1.01.04/lib/libdm-file.c device-mapper.1.01.04.klibc/lib/libdm-file.c
@@ -16,11 +16,13 @@
 #include "lib.h"
 #include "libdm-file.h"
 
-#include <sys/file.h>
+#ifndef __KLIBC__
+# include <sys/file.h>
+#endif
 #include <fcntl.h>
 #include <dirent.h>
 
-#ifdef linux
+#if defined(linux) && !defined(__KLIBC__)
 #  include <malloc.h>
 #endif
 
make.tmpl.in +6 -1
diff -urpN device-mapper.1.01.04/make.tmpl.in device-mapper.1.01.04.klibc/make.tmpl.in
@@ -56,7 +55,12 @@ endif
 
 .SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib
 
-CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline
+CFLAGS+=-fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline
+
+ifeq ("@KLIBC@", "no")
+  # These ones make klibc compiles very loud
+  CFLAGS+=-Wshadow -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
+endif
 
 #CFLAGS += -W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual -Wmissing-noreturn
 
#1 lore raw
Quoted 5 lines · Martin Schlemmer

Hi,

Some time back I sent a patch for KLIBC support for device-mapper, but no response so far. I have however updated the patch.

Ok, I checked multipath-tools again, and did query on the klibc mailing lists (no real response), and decided to not have the _klibc suffix on the library. Also tweaked the build to build a binary default linked dynamic to klibc, with --enable-static_link giving static linked binary.

Comments once again welcome.

Thanks,

Signature · 1 line
Martin Schlemmer
aclocal.m4 +94 -0
diff -urpN device-mapper.1.01.04/aclocal.m4 device-mapper.1.01.04.klibc/aclocal.m4
@@ -0,0 +1,94 @@
+# klibc.m4 serial 99
+## Copyright (C) 1995-2003 Free Software Foundation, Inc.
+## This file is free software, distributed under the terms of the GNU
+## General Public License.  As a special exception to the GNU General
+## Public License, this file may be distributed as part of a program
+## that contains a configuration script generated by Autoconf, under
+## the same distribution terms as the rest of that program.
+##
+## This file can can be used in projects which are not available under
+## the GNU General Public License or the GNU Library General Public
+## License but which still want to provide support for the GNU gettext
+## functionality.
+## Please note that the actual code of the KLIBC Library is partly covered
+## by the GNU Library General Public License, and party copyrighted by the
+## Regents of The University of California, and the rest is covered by a
+## MIT style license. 
+
+# Authors:
+#   Martin Schlemmer <[email protected]>, 2005.
+
+
+# AC_CHECK_KLIBC
+# --------------
+# Check if the user wants KLIBC support enabled.  If so, set KLIBC=yes and
+# fill in KLIBC_PREFIX, KLIBC_BINDIR, KLIBC_SBINDIR, KLIBC_LIBDIR and
+# KLIBC_INCLUDEDIR.  CC is also set to the proper klcc executable.
+# NOTE:  This should be called before AC_PROG_CC, and before header, function
+#        or type checks.
+AC_DEFUN([AC_CHECK_KLIBC],
+[AC_BEFORE([$0], [AC_PROG_CC])
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_ARG_ENABLE([klibc],
+              [AS_HELP_STRING([--enable-klibc],
+                              [Enable linking to klibc [no].  You need at
+                               least klibc-1.0 or later for this.  Set KLCC
+                               to the absolute file name of klcc if not in
+                               the PATH])],
+              [KLIBC=$enableval], [KLIBC=no])
+AC_ARG_ENABLE([klibc-layout],
+              [AS_HELP_STRING([--enable-klibc-layout],
+                              [Enable installing binaries, libraries and
+                               headers into the klibc prefix [yes] ])],
+              [if test "X$KLIBC" != Xno; then
+                 KLIBC_LAYOUT=$enableval
+               else
+                 KLIBC_LAYOUT=no
+               fi],
+              [if test "X$KLIBC" != Xno; then
+                 KLIBC_LAYOUT=yes
+               else
+                 KLIBC_LAYOUT=no
+               fi])
+
+if test "X$KLIBC" != Xno; then
+  # Basic cross compiling support.  I do not think it is wise to use
+  # AC_CHECK_TOOL, because if we are cross compiling, we do not want
+  # just 'klcc' to be returned ...
+  if test "${host_alias}" != "${build_alias}"; then
+    AC_CHECK_PROGS([KLCC], [${host_alias}-klcc], [no])
+  else
+    AC_CHECK_PROGS([KLCC], [klcc], [no])
+  fi
+  if test "X$KLCC" = Xno; then
+    AC_MSG_ERROR([cannot find klibc frontend 'klcc'!])
+  fi
+
+  CC="$KLCC"
+  CFLAGS="-Os"
+
+  KLIBC_KCROSS="$($KLCC -print-klibc-kcross 2>/dev/null)"
+  KLIBC_PREFIX="$($KLCC -print-klibc-prefix 2>/dev/null)"
+  KLIBC_BIN_DIR="$($KLCC -print-klibc-bindir 2>/dev/null)"
+  KLIBC_SBIN_DIR="${KLIBC_PREFIX}/${KLIBC_KCROSS}sbin"
+  KLIBC_LIB_DIR="$($KLCC -print-klibc-libdir 2>/dev/null)"
+  KLIBC_INCLUDE_DIR="$($KLCC -print-klibc-includedir 2>/dev/null)"
+
+  if test "X$KLIBC_LAYOUT" != Xno; then
+    prefix="$KLIBC_PREFIX"
+    bindir="$KLIBC_BIN_DIR"
+    sbindir="$KLIBC_SBIN_DIR"
+    libdir="$KLIBC_LIB_DIR"
+    includedir="$KLIBC_INCLUDE_DIR"
+  fi
+
+  # At least KLIBC_LIB_DIR should be valid, else klibc is too old or
+  # something went wrong
+  if test ! -d "$KLIBC_LIB_DIR"; then
+    AC_MSG_ERROR([your klibc installation is too old or not functional!])
+  fi
+fi
+
+AC_SUBST(KLIBC)
+])# AC_CHECK_KLIBC
+
configure.in +48 -23

97 lines not on this page · raw message

dmsetup/Makefile.in +5 -1
diff -urpN device-mapper.1.01.04/dmsetup/Makefile.in device-mapper.1.01.04.klibc/dmsetup/Makefile.in
@@ -19,6 +19,10 @@ VPATH = @srcdir@
 TARGETS = dmsetup
 INSTALL_TYPE = install_dynamic
 
+ifeq ("@KLIBC@", "yes")
+  EXTRA_LDFLAGS = -shared
+endif
+
 ifeq ("@STATIC_LINK@", "yes")
   TARGETS += dmsetup.static
   INSTALL_TYPE += install_static
@@ -30,7 +34,7 @@ CLEAN_TARGETS = dmsetup dmsetup.static
 include ../make.tmpl
 
 dmsetup: $(OBJECTS) $(interfacedir)/libdevmapper.$(LIB_SUFFIX)
-	$(CC) -o $@ $(OBJECTS) $(LDFLAGS) \
+	$(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) \
 	      -L$(interfacedir) -L$(DESTDIR)/lib -ldevmapper $(LIBS)
 
 dmsetup.static: $(OBJECTS) $(interfacedir)/libdevmapper.a
dmsetup/dmsetup.c +14 -1
diff -urpN device-mapper.1.01.04/dmsetup/dmsetup.c device-mapper.1.01.04.klibc/dmsetup/dmsetup.c
@@ -26,7 +26,9 @@
 #include <dirent.h>
 #include <errno.h>
 #include <unistd.h>
-#include <libgen.h>
+#ifndef __KLIBC__
+# include <libgen.h>
+#endif
 #include <sys/wait.h>
 #include <unistd.h>
 #include <sys/param.h>
@@ -1054,7 +1056,18 @@ static int _process_switches(int *argc, 
 	memset(&_values, 0, sizeof(_values));
 
 	namebase = strdup((*argv)[0]);
+#ifndef __KLIBC__
 	base = basename(namebase);
+#else
+	base = strrchr(namebase, '/');
+	if (base != NULL)
+		/* Remove leading '/' */
+		base++;
+	else
+		/* Already basename ? */
+		base = namebase;
+	
+#endif
 
 	if (!strcmp(base, "devmap_name")) {
 		free(namebase);
lib/Makefile.in +8 -2
diff -urpN device-mapper.1.01.04/lib/Makefile.in device-mapper.1.01.04.klibc/lib/Makefile.in
@@ -47,8 +47,14 @@ include ../make.tmpl
 
 INSTALL_TYPE = install_dynamic
 
-ifeq ("@STATIC_LINK@", "yes")
-  INSTALL_TYPE += install_static
+ifeq ("@KLIBC@", "yes")
+  INSTALL_TYPE = install_static
+else
+  INSTALL_TYPE = install_dynamic
+
+  ifeq ("@STATIC_LINK@", "yes")
+    INSTALL_TYPE += install_static
+  endif
 endif
 
 install: $(INSTALL_TYPE)
lib/ioctl/libdm-iface.c +15 -8
diff -urpN device-mapper.1.01.04/lib/ioctl/libdm-iface.c device-mapper.1.01.04.klibc/lib/ioctl/libdm-iface.c
@@ -122,24 +122,30 @@ static int _get_proc_number(const char *
 			    uint32_t *number)
 {
 	FILE *fl;
-	char nm[256];
-	int c;
+	char nm[256], buf[300];
+	int num, size;
 
 	if (!(fl = fopen(file, "r"))) {
 		log_error("%s: fopen failed: %s", file, strerror(errno));
 		return 0;
 	}
 
-	while (!feof(fl)) {
-		if (fscanf(fl, "%d %255s\n", number, &nm[0]) == 2) {
+	/* Use fread+sscanf for klibc compatibility. */
+	do {
+		size = 0;
+		do {
+			num = fread(&buf[size], sizeof(char), 1, fl);
+			if (num > 0)
+				size++;
+		} while (num > 0 && buf[size - 1] != '\n');
+		buf[size] = '\0';
+		if (sscanf(buf, "%d %255s\n", number, &nm[0]) == 2) {
 			if (!strcmp(name, nm)) {
 				fclose(fl);
 				return 1;
 			}
-		} else do {
-			c = fgetc(fl);
-		} while (c != EOF && c != '\n');
-	}
+		}
+	} while (num > 0);
 	fclose(fl);
 
 	log_error("%s: No entry for %s found", file, name);
@@ -151,6 +157,7 @@ static int _control_device_number(uint32
 	if (!_get_proc_number(PROC_DEVICES, MISC_NAME, major) ||
 	    !_get_proc_number(PROC_MISC, DM_NAME, minor)) {
 		*major = 0;
+		printf("Failed to get device number!\n");
 		return 0;
 	}
 
lib/libdm-file.c +4 -2
diff -urpN device-mapper.1.01.04/lib/libdm-file.c device-mapper.1.01.04.klibc/lib/libdm-file.c
@@ -16,11 +16,13 @@
 #include "lib.h"
 #include "libdm-file.h"
 
-#include <sys/file.h>
+#ifndef __KLIBC__
+# include <sys/file.h>
+#endif
 #include <fcntl.h>
 #include <dirent.h>
 
-#ifdef linux
+#if defined(linux) && !defined(__KLIBC__)
 #  include <malloc.h>
 #endif
 
make.tmpl.in +6 -1
diff -urpN device-mapper.1.01.04/make.tmpl.in device-mapper.1.01.04.klibc/make.tmpl.in
@@ -56,7 +56,12 @@ endif
 
 .SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib
 
-CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline
+CFLAGS+=-fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline
+
+ifeq ("@KLIBC@", "no")
+  # These ones make klibc compiles very loud
+  CFLAGS+=-Wshadow -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
+endif
 
 #CFLAGS += -W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual -Wmissing-noreturn
 
#2 lore raw
Quoted 7 lines · Martin Schlemmer
Quoted 5 lines · Martin Schlemmer

Hi,

Some time back I sent a patch for KLIBC support for device-mapper, but no response so far. I have however updated the patch.

Quoted 7 lines

Ok, I checked multipath-tools again, and did query on the klibc mailing lists (no real response), and decided to not have the _klibc suffix on the library. Also tweaked the build to build a binary default linked dynamic to klibc, with --enable-static_link giving static linked binary.

Comments once again welcome.

Sorry for the lack of feedback; I'm a bit backlogged in my life :-/ at the moment... I'll try to catch up as soon as possible.

-hpa