]> git.ozlabs.org Git - petitboot/commitdiff
configure: Update to use AX_WITH_CURSES
authorGeoff Levand <geoff@infradead.org>
Sat, 20 Jul 2013 00:07:31 +0000 (17:07 -0700)
committerGeoff Levand <geoff@infradead.org>
Tue, 23 Jul 2013 17:39:08 +0000 (10:39 -0700)
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>
configure.ac.in
ui/ncurses/Makefile.am
ui/ncurses/generic-main.c
ui/ncurses/nc-boot-editor.c
ui/ncurses/nc-boot-editor.h
ui/ncurses/nc-cui.c
ui/ncurses/nc-menu.c
ui/ncurses/nc-menu.h
ui/ncurses/nc-scr.c
ui/ncurses/nc-scr.h
ui/ncurses/ps3-main.c

index 51cfdb8d8a444b63831b31a8f46f748388dfdb9c..8372b98860ed705c21b34c3786eddc41ff26c738 100644 (file)
@@ -28,14 +28,29 @@ AC_PROG_INSTALL
 AM_INIT_AUTOMAKE
 LT_INIT
 
 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_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>
 dnl Checking for va_copy availability
 AC_MSG_CHECKING([for va_copy])
 AC_TRY_LINK([#include <stdarg.h>
@@ -57,24 +72,6 @@ else
     fi
 fi
 
     fi
 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],
 AC_ARG_WITH(
        [twin-x11],
        [AS_HELP_STRING([--with-twin-x11],
index 6d360d2dae91600a060ec501c5e2ac9110f216d5..64b6eb1fd9215d2efeac97ffe458080cd9791f7b 100644 (file)
@@ -20,12 +20,11 @@ AM_CPPFLAGS = \
 AM_CFLAGS = \
        $(DEFAULT_CFLAGS)
 
 AM_CFLAGS = \
        $(DEFAULT_CFLAGS)
 
-AM_LDFLAGS = -lmenu -lform -lncurses
-
 common_libs = \
        libpbnc.la \
        $(top_builddir)/ui/common/libpbui.la \
 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
 
 
 noinst_LTLIBRARIES = libpbnc.la
 
index 6280a341987617a45c6d869beb0c935191a7944e..cafd23a5778258db070b8b612889e2db4681c1a0 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#if defined(HAVE_CONFIG_H)
 #include "config.h"
 #include "config.h"
-#endif
 
 #define _GNU_SOURCE
 
 #define _GNU_SOURCE
+
+#include <assert.h>
 #include <errno.h>
 #include <getopt.h>
 #include <signal.h>
 #include <errno.h>
 #include <getopt.h>
 #include <signal.h>
index 4579b1a3852c7e4552d205b7c1ecdf666f9c8547..0b658f240fabe89dfbf3592c651d152fe9fc6b62 100644 (file)
@@ -16,6 +16,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "config.h"
+
 #define _GNU_SOURCE
 
 #include <assert.h>
 #define _GNU_SOURCE
 
 #include <assert.h>
index bdcc5609736c2e9944e365171d10e3a906b5b017..a509f7598f5ef1cd03472a05e96aaee68b116b6d 100644 (file)
 #if !defined(_PB_NC_KED_H)
 #define _PB_NC_KED_H
 
 #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 <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"
 
 #include "types/types.h"
 #include "ui/common/ui-system.h"
index 3f82f85fe1bbe1fbba70f362afcc698535514c5f..4baaec17d52ca4c9e242b45669c7d5b01bdce776 100644 (file)
@@ -16,6 +16,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "config.h"
+
 #define _GNU_SOURCE
 
 #include <assert.h>
 #define _GNU_SOURCE
 
 #include <assert.h>
index 0612d8a74bb11d88444f16b098268d78468ba9ed..e28168edd4cf6d253e10e4c2f04fa3939fd25192 100644 (file)
@@ -16,6 +16,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "config.h"
+
 #define _GNU_SOURCE
 
 #include <assert.h>
 #define _GNU_SOURCE
 
 #include <assert.h>
index 750bef5c898ef77c5c74594972d986c7252b710f..f010835a378371c5a92c3d27a54219aea7c53f6b 100644 (file)
 #if !defined(_PB_NC_MENU_H)
 #define _PB_NC_MENU_H
 
 #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 <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"
 
 #include "log/log.h"
 #include "types/types.h"
index 062d34a7b177d835b1b81e5befc5b2fa95a37249..d2455d4408c72ecef8bc41414e95473616b20aae 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "config.h"
+
+#define _GNU_SOURCE
+
 #include <assert.h>
 #include <stdarg.h>
 
 #include <assert.h>
 #include <stdarg.h>
 
index f18753a4a74c128a3d04ffffb38bcb4c308936d1..a8aa314cfa86bec9a2108d2c22f1aa8b140c13e0 100644 (file)
 #define _PB_NC_SCR_H
 
 #include <linux/input.h> /* This must be included before ncurses.h */
 #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)
 
 #ifdef DEBUG
 #define DBG(fmt, args...) pb_log("DBG: " fmt, ## args)
index 57350556dc9489539c72490300a1a853ab269840..5be8c3258a9477671322f8ffcc0418a028a8d8a7 100644 (file)
  * ncurses mouse support
  */
 
  * ncurses mouse support
  */
 
-#if defined(HAVE_CONFIG_H)
 #include "config.h"
 #include "config.h"
-#endif
 
 #define _GNU_SOURCE
 
 #define _GNU_SOURCE
+
+#include <assert.h>
 #include <errno.h>
 #include <getopt.h>
 #include <signal.h>
 #include <errno.h>
 #include <getopt.h>
 #include <signal.h>