From 782e47ecd725dd44d4425351e21540a6914b13aa Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 8 Sep 2013 01:11:16 +0000 Subject: [PATCH] build: Separate curses detection from gui configuration. It's cleaner to separate feature/library detection from the logic that decides whether an executable can be built. This patch creates a separate section for para_gui which contains the list of all objects for para_gui and sets $build_gui to either "yes" or "no", depending on whether a usable curses library was found. --- Makefile.in | 2 +- configure.ac | 55 ++++++++++++++++++++++++++-------------------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6d14029c..c500fb9e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -266,7 +266,7 @@ para_client: $(client_objs) para_gui: $(gui_objs) @[ -z "$(Q)" ] || echo 'LD $@' - $(Q) $(CC) -o $@ $(gui_objs) @gui_ldflags@ $(LDFLAGS) + $(Q) $(CC) -o $@ $(gui_objs) @curses_ldflags@ $(LDFLAGS) para_audiod: $(audiod_objs) @[ -z "$(Q)" ] || echo 'LD $@' diff --git a/configure.ac b/configure.ac index e9d8d848..e18a22e4 100644 --- a/configure.ac +++ b/configure.ac @@ -143,20 +143,6 @@ write_ldflags="" writers=" file" default_writer="FILE_WRITE" -gui_cmdline_objs="gui" -gui_errlist_objs=" - exec - signal - string - stat - ringbuffer - fd - gui - gui_theme - time - version - ggo -" play_errlist_objs="play fd sched ggo buffer_tree time string net afh_recv afh_common wma_afh wma_common mp3_afh @@ -400,27 +386,20 @@ fi AC_CHECK_HEADER(curses.h, [], [ have_curses="no" ]) -gui_ldflags="$curses_libs" +curses_ldflags="$curses_libs" AC_CHECK_LIB([ncursesw], [initscr], - [gui_ldflags="$curses_libs -lncursesw"], [ + [curses_ldflags="$curses_libs -lncursesw"], [ AC_CHECK_LIB([curses], [initscr], - [gui_ldflags="$curses_libs -lcurses"], + [curses_ldflags="$curses_libs -lcurses"], [have_curses="no"] ) ] ) -if test "$have_curses" = "yes"; then - AC_SUBST(curses_cppflags) - build_gui="yes" - executables="$executables gui" -else - build_gui="no" - AC_MSG_WARN([no curses lib, cannot build para_gui]) -fi +AC_SUBST(curses_cppflags) +AC_SUBST(curses_ldflags) CPPFLAGS="$OLD_CPPFLAGS" LDFLAGS="$OLD_LDFLAGS" LIBS="$OLD_LIBS" - ########################################################################### ip_mreqn AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast)) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @@ -1239,6 +1218,29 @@ else AC_MSG_WARN([no mixer support]) mixer_summary="para_fade: no" fi +########################################################################### gui +if test "$have_curses" = "yes"; then + build_gui="yes" + executables="$executables gui" + gui_cmdline_objs="gui" + gui_errlist_objs=" + exec + signal + string + stat + ringbuffer + fd + gui + gui_theme + time + version + ggo + " + gui_objs="add_cmdline($gui_cmdline_objs) $gui_errlist_objs" +else + build_gui="no" + AC_MSG_WARN([no curses lib, cannot build para_gui]) +fi ############################################################# error2.h AC_MSG_NOTICE(creating error2.h) @@ -1364,7 +1366,6 @@ AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS, objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc) AC_SUBST(gui_objs, add_dot_o($gui_objs)) -AC_SUBST(gui_ldflags, $gui_ldflags) AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS, objlist_to_errlist($gui_errlist_objs), errors used by para_gui) -- 2.39.5