summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2013-07-19 17:07:31 -0700
committerGeoff Levand <geoff@infradead.org>2013-07-23 10:39:08 -0700
commitf1599796efed1eb67759cf42f47fe4bf6a9bf93c (patch)
tree5cf13ffb598e62a45ed9830f76a74958785b2a44
parentf2747434dcdfe71c3a4d1b841070f4c9d8dc4965 (diff)
downloadtalos-petitboot-f1599796efed1eb67759cf42f47fe4bf6a9bf93c.tar.gz
talos-petitboot-f1599796efed1eb67759cf42f47fe4bf6a9bf93c.zip
configure: Update to use AX_WITH_CURSES
For a more portable build system convert to using the autoconf-archive AX_WITH_CURSES macros. Allows building on openSUSE, which has a different header file layout than other distros, and fixes menu entries with UTF-8 characters; this causes fedora installs (codename "Schrödinger´s cat") to break the UI. Signed-off-by: Geoff Levand <geoff@infradead.org>
-rw-r--r--configure.ac.in37
-rw-r--r--ui/ncurses/Makefile.am5
-rw-r--r--ui/ncurses/generic-main.c4
-rw-r--r--ui/ncurses/nc-boot-editor.c2
-rw-r--r--ui/ncurses/nc-boot-editor.h11
-rw-r--r--ui/ncurses/nc-cui.c2
-rw-r--r--ui/ncurses/nc-menu.c2
-rw-r--r--ui/ncurses/nc-menu.h11
-rw-r--r--ui/ncurses/nc-scr.c4
-rw-r--r--ui/ncurses/nc-scr.h14
-rw-r--r--ui/ncurses/ps3-main.c4
11 files changed, 64 insertions, 32 deletions
diff --git a/configure.ac.in b/configure.ac.in
index 51cfdb8..8372b98 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -28,14 +28,29 @@ AC_PROG_INSTALL
AM_INIT_AUTOMAKE
LT_INIT
-AC_CHECK_HEADERS([stdarg.h])
-AC_CHECK_HEADERS([varargs.h])
+AX_WITH_CURSES
+AX_WITH_CURSES_MENU
+AX_WITH_CURSES_FORM
+
+AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
+
+if test "x$ax_cv_curses" = xyes; then
+ if test "x$ax_cv_menu" != xyes; then
+ AC_MSG_ERROR([--with-ncurses requires the ncurses menu library])
+ fi
+ if test "x$ax_cv_form" != xyes; then
+ AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
+ fi
+fi
AC_CHECK_LIB([udev], [udev_new],
[],
[AC_MSG_FAILURE([The libudev development library is required by petitboot. Try installing the package libudev-dev or libudev-devel.])]
)
+AC_CHECK_HEADERS([stdarg.h])
+AC_CHECK_HEADERS([varargs.h])
+
dnl Checking for va_copy availability
AC_MSG_CHECKING([for va_copy])
AC_TRY_LINK([#include <stdarg.h>
@@ -58,24 +73,6 @@ else
fi
AC_ARG_WITH(
- [ncurses],
- [AS_HELP_STRING([--with-ncurses],
- [build text console UI programs using ncurses [default=yes]]
- )],
- [],
- [with_ncurses=yes]
-)
-AM_CONDITIONAL([WITH_NCURSES], [test "x$with_ncurses" = "xyes"])
-
-AS_IF(
- [test "x$with_ncurses" = "xyes"],
- AC_CHECK_LIB([ncurses], [initscr],
- [],
- [AC_MSG_FAILURE([--with-ncurses was given but the test for libncurses failed. Try installing the package ncurses-dev or ncurses-devel.])]
- )
-)
-
-AC_ARG_WITH(
[twin-x11],
[AS_HELP_STRING([--with-twin-x11],
[build x11 GUI programs using the twin window system [default=yes]]
diff --git a/ui/ncurses/Makefile.am b/ui/ncurses/Makefile.am
index 6d360d2..64b6eb1 100644
--- a/ui/ncurses/Makefile.am
+++ b/ui/ncurses/Makefile.am
@@ -20,12 +20,11 @@ AM_CPPFLAGS = \
AM_CFLAGS = \
$(DEFAULT_CFLAGS)
-AM_LDFLAGS = -lmenu -lform -lncurses
-
common_libs = \
libpbnc.la \
$(top_builddir)/ui/common/libpbui.la \
- $(top_builddir)/lib/libpbcore.la
+ $(top_builddir)/lib/libpbcore.la \
+ @MENU_LIB@ @FORM_LIB@ @CURSES_LIB@
noinst_LTLIBRARIES = libpbnc.la
diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c
index 6280a34..cafd23a 100644
--- a/ui/ncurses/generic-main.c
+++ b/ui/ncurses/generic-main.c
@@ -18,11 +18,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#if defined(HAVE_CONFIG_H)
#include "config.h"
-#endif
#define _GNU_SOURCE
+
+#include <assert.h>
#include <errno.h>
#include <getopt.h>
#include <signal.h>
diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c
index 4579b1a..0b658f2 100644
--- a/ui/ncurses/nc-boot-editor.c
+++ b/ui/ncurses/nc-boot-editor.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+
#define _GNU_SOURCE
#include <assert.h>
diff --git a/ui/ncurses/nc-boot-editor.h b/ui/ncurses/nc-boot-editor.h
index bdcc560..a509f75 100644
--- a/ui/ncurses/nc-boot-editor.h
+++ b/ui/ncurses/nc-boot-editor.h
@@ -19,9 +19,16 @@
#if !defined(_PB_NC_KED_H)
#define _PB_NC_KED_H
-#include <assert.h>
#include <linux/input.h> /* This must be included before ncurses.h */
-#include <form.h>
+#if defined HAVE_NCURSESW_FORM_H
+# include <ncursesw/form.h>
+#elif defined HAVE_NCURSES_FORM_H
+# include <ncurses/form.h>
+#elif defined HAVE_FORM_H
+# include <form.h>
+#else
+# error "Curses form.h not found."
+#endif
#include "types/types.h"
#include "ui/common/ui-system.h"
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 3f82f85..4baaec1 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+
#define _GNU_SOURCE
#include <assert.h>
diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c
index 0612d8a..e28168e 100644
--- a/ui/ncurses/nc-menu.c
+++ b/ui/ncurses/nc-menu.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+
#define _GNU_SOURCE
#include <assert.h>
diff --git a/ui/ncurses/nc-menu.h b/ui/ncurses/nc-menu.h
index 750bef5..f010835 100644
--- a/ui/ncurses/nc-menu.h
+++ b/ui/ncurses/nc-menu.h
@@ -19,9 +19,16 @@
#if !defined(_PB_NC_MENU_H)
#define _PB_NC_MENU_H
-#include <assert.h>
#include <linux/input.h> /* This must be included before ncurses.h */
-#include <menu.h>
+#if defined HAVE_NCURSESW_MENU_H
+# include <ncursesw/menu.h>
+#elif defined HAVE_NCURSES_MENU_H
+# include <ncurses/menu.h>
+#elif defined HAVE_MENU_H
+# include <menu.h>
+#else
+# error "Curses menu.h not found."
+#endif
#include "log/log.h"
#include "types/types.h"
diff --git a/ui/ncurses/nc-scr.c b/ui/ncurses/nc-scr.c
index 062d34a..d2455d4 100644
--- a/ui/ncurses/nc-scr.c
+++ b/ui/ncurses/nc-scr.c
@@ -16,6 +16,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+
+#define _GNU_SOURCE
+
#include <assert.h>
#include <stdarg.h>
diff --git a/ui/ncurses/nc-scr.h b/ui/ncurses/nc-scr.h
index f18753a..a8aa314 100644
--- a/ui/ncurses/nc-scr.h
+++ b/ui/ncurses/nc-scr.h
@@ -20,7 +20,19 @@
#define _PB_NC_SCR_H
#include <linux/input.h> /* This must be included before ncurses.h */
-#include <ncurses.h>
+#if defined HAVE_NCURSESW_CURSES_H
+# include <ncursesw/curses.h>
+#elif defined HAVE_NCURSESW_H
+# include <ncursesw.h>
+#elif defined HAVE_NCURSES_CURSES_H
+# include <ncurses/curses.h>
+#elif defined HAVE_NCURSES_H
+# include <ncurses.h>
+#elif defined HAVE_CURSES_H
+# include <curses.h>
+#else
+# error "Curses header file not found."
+#endif
#ifdef DEBUG
#define DBG(fmt, args...) pb_log("DBG: " fmt, ## args)
diff --git a/ui/ncurses/ps3-main.c b/ui/ncurses/ps3-main.c
index 5735055..5be8c32 100644
--- a/ui/ncurses/ps3-main.c
+++ b/ui/ncurses/ps3-main.c
@@ -24,11 +24,11 @@
* ncurses mouse support
*/
-#if defined(HAVE_CONFIG_H)
#include "config.h"
-#endif
#define _GNU_SOURCE
+
+#include <assert.h>
#include <errno.h>
#include <getopt.h>
#include <signal.h>
OpenPOWER on IntegriCloud