build: Separate curses detection from gui configuration.
authorAndre Noll <maan@systemlinux.org>
Sun, 8 Sep 2013 01:11:16 +0000 (01:11 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 1 Dec 2013 10:47:32 +0000 (11:47 +0100)
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
configure.ac

index 6d14029..c500fb9 100644 (file)
@@ -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 $@'
index e9d8d84..e18a22e 100644 (file)
@@ -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)