screen: fix autoconf misdetection
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 27 Jun 2015 12:25:43 +0000 (14:25 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 27 Jun 2015 12:29:48 +0000 (14:29 +0200)
The configure script shipped by screen uses the presence of `elf.h` and `-lelf`
as indicator for an SVR4 system which implies a `#define BUGGYGETLOGIN`.

The SVR4 `getlogin()` replacement function does not compile with a musl
toolchain and we do not want it anyway, so patch configure to remove the broken
SVR4 detection logic.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
utils/screen/Makefile
utils/screen/patches/200-musl-compat.patch

index 634121424c3032f7d602c829826b3bbd6b9408ea..5879e37a60d671a7ffd6c37830cb7085e3dc342d 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=screen
 PKG_VERSION:=4.2.1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/screen
@@ -40,6 +40,10 @@ define Build/Configure
        )
        # XXX: memmove() works well with overlapped memory areas
        echo "#define USEMEMMOVE 1" >>$(PKG_BUILD_DIR)/config.h
+  ifeq ($(CONFIG_USE_MUSL),y)
+       # XXX: assume a working getlogin() for musl
+       echo "#undef BUGGYGETLOGIN" >>$(PKG_BUILD_DIR)/config.h
+  endif
 endef
 
 define Package/screen/install
index 2586bb9843898a3fe692bd6a3e8c9697aca2d796..5bbc9d0ea5262d35f9eea289514110c79078216f 100644 (file)
@@ -1,3 +1,50 @@
+--- a/configure
++++ b/configure
+@@ -4154,44 +4154,6 @@ fi
+ rm -f conftest*
+-oldlibs="$LIBS"
+-LIBS="$LIBS -lelf"
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SVR4..." >&5
+-$as_echo "$as_me: checking SVR4..." >&6;}
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <utmpx.h>
+-
+-int
+-main ()
+-{
+-
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+-  ac_fn_c_check_header_mongrel "$LINENO" "dwarf.h" "ac_cv_header_dwarf_h" "$ac_includes_default"
+-if test "x$ac_cv_header_dwarf_h" = xyes; then :
+-  $as_echo "#define SVR4 1" >>confdefs.h
+- $as_echo "#define BUGGYGETLOGIN 1" >>confdefs.h
+-
+-else
+-  ac_fn_c_check_header_mongrel "$LINENO" "elf.h" "ac_cv_header_elf_h" "$ac_includes_default"
+-if test "x$ac_cv_header_elf_h" = xyes; then :
+-  $as_echo "#define SVR4 1" >>confdefs.h
+- $as_echo "#define BUGGYGETLOGIN 1" >>confdefs.h
+-
+-fi
+-
+-
+-fi
+-
+-
+-
+-else
+-  LIBS="$oldlibs"
+-fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+ for ac_header in stropts.h string.h strings.h
 --- a/utmp.c
 +++ b/utmp.c
 @@ -33,6 +33,7 @@