Re: cfdisk fails when --with-slang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 30, 2010 at 08:20:12PM -0400, Mike Frysinger wrote:
> 2.18 / current git:
> $ ./configure --with-slang

I forgot to test this setup and it seems than nobody uses -rc releases :-(

> gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -include ../config.h -I../include -
> DLOCALEDIR=\"/usr/share/locale\"  -fsigned-char -I../shlibs/blkid/src -g -O2 -
> MT cfdisk-cfdisk.o -MD -MP -MF .deps/cfdisk-cfdisk.Tpo -c -o cfdisk-cfdisk.o 
> `test -f 'cfdisk.c' || echo './'`cfdisk.c
> cfdisk.c: In function ‘get_string’:
> cfdisk.c:435:5: warning: implicit declaration of function ‘get_wch’
> mv -f .deps/cfdisk-cfdisk.Tpo .deps/cfdisk-cfdisk.Po
> /bin/sh ../libtool  --tag=CC   --mode=link gcc -std=gnu99 -fsigned-char -
> I../shlibs/blkid/src -g -O2   -o cfdisk cfdisk-cfdisk.o cfdisk-
> i386_sys_types.o cfdisk-gpt.o cfdisk-blkdev.o cfdisk-wholedisk.o cfdisk-
> mbsalign.o cfdisk-linux_version.o cfdisk-mbsalign.o -lslang 
> ../shlibs/blkid/src/libblkid.la 
> libtool: link: gcc -std=gnu99 -fsigned-char -I../shlibs/blkid/src -g -O2 -o 
> .libs/cfdisk cfdisk-cfdisk.o cfdisk-i386_sys_types.o cfdisk-gpt.o cfdisk-
> blkdev.o cfdisk-wholedisk.o cfdisk-mbsalign.o cfdisk-linux_version.o cfdisk-
> mbsalign.o  -lslang ../shlibs/blkid/src/.libs/libblkid.so /usr/local/src/util-
> linux/shlibs/uuid/src/.libs/libuuid.so
> cfdisk-mbsalign.o: In function `mbs_truncate':
> /usr/local/src/util-linux/fdisk/../lib/mbsalign.c:108: multiple definition of 
> `mbs_truncate'
> cfdisk-mbsalign.o:/usr/local/src/util-linux/fdisk/../lib/mbsalign.c:108: first 
> defined here
> cfdisk-mbsalign.o: In function `mbsalign':
> /usr/local/src/util-linux/fdisk/../lib/mbsalign.c:168: multiple definition of 
> `mbsalign'
> cfdisk-mbsalign.o:/usr/local/src/util-linux/fdisk/../lib/mbsalign.c:168: first 
> defined here
> cfdisk-cfdisk.o: In function `get_string':
> /usr/local/src/util-linux/fdisk/cfdisk.c:435: undefined reference to `get_wch'
> collect2: ld returned 1 exit status
> make: *** [cfdisk] Error 1
> 
> looks like Makefile.am lists mbsalign.c multiple times incorrectly, and the 
> ncurses-specific get_wch() is used all the time.

I found another problem with slang on my Fedora-12, the file <slang/slcurses.h>
includes <slang.h>, unfortunately nowhere is -I/usr/include/slang. The 
"pkg-config --cflags slang" command is also useless...

So I have added one extra check for <slang.h> (the another solution
could be a properly defined SLANG_CFLAGS=).

Please, review the patches below (both patches are already in git
tree).

    Karel


>From 965b4900b9d0a0d716273558e52e188820108709 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@xxxxxxxxxx>
Date: Thu, 1 Jul 2010 10:43:06 +0200
Subject: [PATCH 1/2] build-sys: explicitly check for slang.h

The slang/slcurses.h contains

  #includes <slang.h>

but we don't use -I/usr/include/slang (and this is also missing in
slang.pc), it means that we have manually include the slang.h file
in our configure script.

Note this is Fedora-12, maybe some others distros have more usable
slang headers...

Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>
---
 configure.ac |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7aff916..8c5f92f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -470,7 +470,15 @@ AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
 
 use_slang=no
 if test "x$with_slang" = xyes; then
-  AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes])
+  AC_CHECK_HEADERS([slang.h slang/slang.h])
+  AC_CHECK_HEADERS([slcurses.h slang/slcurses.h],
+                   [use_slang=yes], [], [
+#ifdef HAVE_SLANG_H
+#include <slang.h>
+#elif defined(HAVE_SLANG_SLANG_H)
+#include <slang/slang.h>
+#endif
+])
   if test "x$use_slang" = xno; then
     AC_MSG_ERROR([slang selected but slcurses.h not found])
   fi


>From 541e6934e1fe6833b125c1c64f9a1108bc3d09fa Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@xxxxxxxxxx>
Date: Thu, 1 Jul 2010 10:56:41 +0200
Subject: [PATCH 2/2] cfdisk: fix --with-slang

Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>
---
 fdisk/Makefile.am |    2 +-
 fdisk/cfdisk.c    |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/fdisk/Makefile.am b/fdisk/Makefile.am
index 9a9db0c..36871f3 100644
--- a/fdisk/Makefile.am
+++ b/fdisk/Makefile.am
@@ -54,7 +54,7 @@ endif
 if USE_SLANG
 sbin_PROGRAMS += cfdisk
 dist_man_MANS += cfdisk.8
-cfdisk_SOURCES = cfdisk.c $(fdisk_common) $(top_srcdir)/lib/mbsalign.c
+cfdisk_SOURCES = cfdisk.c $(fdisk_common)
 cfdisk_CFLAGS = $(cflags_blkid)
 cfdisk_LDADD = -lslang $(ldadd_blkid)
 else
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 30550c0..552858b 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -64,6 +64,13 @@
 #include <errno.h>
 #include <getopt.h>
 #include <fcntl.h>
+
+#ifdef HAVE_SLANG_H
+#include <slang.h>
+#elif defined(HAVE_SLANG_SLANG_H)
+#include <slang/slang.h>
+#endif
+
 #ifdef HAVE_SLCURSES_H
 #include <slcurses.h>
 #elif defined(HAVE_SLANG_SLCURSES_H)
@@ -73,6 +80,7 @@
 #elif defined(HAVE_NCURSES_NCURSES_H)
 #include <ncurses/ncurses.h>
 #endif
+
 #include <signal.h>
 #include <math.h>
 #include <string.h>
@@ -431,7 +439,8 @@ get_string(char *str, int len, char *def) {
 
     refresh();
 
-#if defined(HAVE_LIBNCURSESW) && defined(HAVE_WIDECHAR)
+#if !defined(HAVE_SLCURSES_H) && !defined(HAVE_SLANG_SLCURSES_H) && \
+    defined(HAVE_LIBNCURSESW) && defined(HAVE_WIDECHAR)
     while ((key = get_wch(&c)) != ERR &&
 	   c != '\r' && c != '\n' && c != KEY_ENTER) {
 #else

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux