mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 0/2] ptxdist: pkg-config changes
@ 2017-11-06 15:26 Clemens Gruber
  2017-11-06 15:26 ` [ptxdist] [PATCH 1/2] ptxdist: Use pkg-config for ncurses detection Clemens Gruber
  2017-11-06 15:26 ` [ptxdist] [PATCH 2/2] ptxdist: Add more checks, recommended by autoscan Clemens Gruber
  0 siblings, 2 replies; 3+ messages in thread
From: Clemens Gruber @ 2017-11-06 15:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Hi,

this is a first attempt at fixing the problems with the hardcoded
libraries, occuring on ArchLinux (before ncurses 6.0+20170902-3).

As a solution, now we detect ncurses and its sublibraries panel and menu
through pkg-config. The --with-ncurses argument can still be used to
prepend the include search path. (If that is no longer necessary / not
used in practice, I can drop it in v2)

I also added some additional checks, recommended by autoscan 2.69, in
the 2nd commit.

Cheers,
Clemens

Clemens Gruber (2):
  ptxdist: Use pkg-config for ncurses detection
  ptxdist: Add more checks, recommended by autoscan

 Makefile.in              |  1 +
 configure.ac             | 52 +++++++++++++++++++++++++++++++++++++++++-------
 scripts/kconfig/Makefile |  2 +-
 3 files changed, 47 insertions(+), 8 deletions(-)

-- 
2.15.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ptxdist] [PATCH 1/2] ptxdist: Use pkg-config for ncurses detection
  2017-11-06 15:26 [ptxdist] [PATCH 0/2] ptxdist: pkg-config changes Clemens Gruber
@ 2017-11-06 15:26 ` Clemens Gruber
  2017-11-06 15:26 ` [ptxdist] [PATCH 2/2] ptxdist: Add more checks, recommended by autoscan Clemens Gruber
  1 sibling, 0 replies; 3+ messages in thread
From: Clemens Gruber @ 2017-11-06 15:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Use pkg-config to detect ncurses instead of AC_SEARCH_LIBS.

We still have a --with-ncurses option to prepend the search path of the
ncurses headers. The CFLAGS from pkg-config are always appended, as they
not only contain -I but also -D flags.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 Makefile.in              |  1 +
 configure.ac             | 27 ++++++++++++++++++++-------
 scripts/kconfig/Makefile |  2 +-
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index f454cbd1a..40c676c2b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -36,6 +36,7 @@ kconfig:
 	$(MAKE) -C "$(abs_srcdir)/scripts/kconfig" \
 		CONF_LIBS="@CONF_LIBS@" \
 		MCONF_LIBS="@MCONF_LIBS@" \
+		NCONF_LIBS="@NCONF_LIBS@" \
 		CURSES_LOC="@CURSES_LOC@" \
 		conf mconf $(NCONF)
 	@echo "done."
diff --git a/configure.ac b/configure.ac
index 5348db8a2..338fb6089 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,11 @@ dnl
 AC_PROG_CC
 AC_PROG_CXX
 
+dnl
+dnl Check for pkg-config
+dnl
+PKG_PROG_PKG_CONFIG
+
 dnl
 dnl Check header files, mostly for lxdialog & kconfig
 dnl
@@ -41,28 +46,36 @@ AC_SEARCH_LIBS(regcomp, [regex gnuregex],,
 CONF_LIBS=${LIBS}
 AC_SUBST(CONF_LIBS)
 
-AC_SEARCH_LIBS(mvaddch, [curses ncurses pdcurses], [CURSES_LIB=$ac_lib],
-	[AC_MSG_ERROR([curses development library not found, please install libncurses-dev])])
-MCONF_LIBS=${LIBS}
+PKG_CHECK_MODULES([NCURSES], [ncurses],, [
+	AC_MSG_ERROR([Cannot find ncurses library.])])
+MCONF_LIBS="${LIBS} ${NCURSES_LIBS}"
 AC_SUBST(MCONF_LIBS)
 
+PKG_CHECK_MODULES([NCURSES_PANEL], [panel],,
+	AC_MSG_ERROR([Cannot find ncurses panel library.])])
+PKG_CHECK_MODULES([NCURSES_MENU], [menu],,
+	AC_MSG_ERROR([Cannot find ncurses menu library.])])
+NCONF_LIBS="${LIBS} ${NCURSES_LIBS} ${NCURSES_PANEL_LIBS} ${NCURSES_MENU_LIBS}"
+AC_SUBST(NCONF_LIBS)
+
 AC_CHECK_HEADERS(
-	[curses.h ncurses.h ncurses/curses.h ncurses/ncurses.h pdcurses.h pdcurses/curses.h pdcurses/pdcurses.h],
+	[curses.h ncurses.h ncurses/curses.h ncurses/ncurses.h],
 	[CURSES_LOC="<$ac_header>";found_curses_headers=yes; break;])
 AS_IF([test "x$CURSES_LOC" = "x"],
-	[AC_MSG_ERROR([curses headers not found])])
+	[AC_MSG_ERROR([ncurses headers not found])])
 AC_SUBST(CURSES_LOC)
 
+CPPFLAGS="${NCURSES_CFLAGS}"
 AC_ARG_WITH(ncurses, AS_HELP_STRING([--with-ncurses],[Include path to the ncurses headers]),
 	[
 		if test "x$withval" != "xyes"; then
-			CPPFLAGS="-I$withval"
-			AC_SUBST(CPPFLAGS)
+			CPPFLAGS="-I$withval ${CPPFLAGS}"
 		fi
 		with_ncurses=yes
 	],[
 		with_ncurses=auto
 ])
+AC_SUBST(CPPFLAGS)
 
 AC_CHECK_HEADER(
 	[menu.h],
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 78a631680..7b2631702 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -25,7 +25,7 @@ endif
 
 conf-libs  := $(CONF_LIBS)
 mconf-libs := $(MCONF_LIBS)
-nconf-libs := -lncurses -lmenu -lpanel
+nconf-libs := $(NCONF_LIBS)
 
 lkc-deps := lkc.h lkc_defs.h expr.h
 
-- 
2.15.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ptxdist] [PATCH 2/2] ptxdist: Add more checks, recommended by autoscan
  2017-11-06 15:26 [ptxdist] [PATCH 0/2] ptxdist: pkg-config changes Clemens Gruber
  2017-11-06 15:26 ` [ptxdist] [PATCH 1/2] ptxdist: Use pkg-config for ncurses detection Clemens Gruber
@ 2017-11-06 15:26 ` Clemens Gruber
  1 sibling, 0 replies; 3+ messages in thread
From: Clemens Gruber @ 2017-11-06 15:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Checks recommended by autoscan (taken from configure.scan)
Only the PROG checks were ommitted, because of the already existing GNU
tools checks.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 configure.ac | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/configure.ac b/configure.ac
index f00ccdba5..6cef3e496 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,8 @@ dnl Check header files, mostly for lxdialog & kconfig
 dnl
 AC_HEADER_STDC
 
+AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h stddef.h stdlib.h string.h sys/time.h unistd.h])
+
 AC_CHECK_HEADER([regex.h], [], AC_MSG_ERROR([Cannot find regex.h.]))
 
 AC_SEARCH_LIBS(regcomp, [regex gnuregex],,
@@ -90,6 +92,29 @@ AC_CHECK_HEADER(
 ])
 AM_CONDITIONAL(BUILD_NCONF, test "x$NCURSES_FOUND" = "xyes")
 
+dnl
+dnl Checks for typedefs, structures, and compiler characteristics.
+dnl
+AC_CHECK_HEADER_STDBOOL
+AC_C_INLINE
+AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INT8_T
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT8_T
+
+dnl
+dnl Checks for library functions.
+dnl
+AC_FUNC_ALLOCA
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([bzero gettimeofday memmove memset mkdir regcomp setlocale strcasecmp strchr strcspn strdup strncasecmp strpbrk strrchr strspn strtol strtoull uname])
+
 
 AC_SYS_INTERPRETER
 if test "$interpval" != yes ; then
-- 
2.15.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-06 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 15:26 [ptxdist] [PATCH 0/2] ptxdist: pkg-config changes Clemens Gruber
2017-11-06 15:26 ` [ptxdist] [PATCH 1/2] ptxdist: Use pkg-config for ncurses detection Clemens Gruber
2017-11-06 15:26 ` [ptxdist] [PATCH 2/2] ptxdist: Add more checks, recommended by autoscan Clemens Gruber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox