qulogic/libgnt

Move ncurses check into libgnt directory.

2018-04-27, Elliott Sales de Andrade
9d0f414a31ea
Parents 08842d7fcc41
Children 6fa8670646ca
Move ncurses check into libgnt directory.
  • +1 -1
    gnt.h
  • +0 -2
    gntmain.c
  • +0 -2
    gntutils.c
  • +3 -5
    gntwm.c
  • +72 -2
    meson.build
  • --- a/gnt.h Fri Apr 27 04:49:22 2018 -0400
    +++ b/gnt.h Fri Apr 27 05:38:28 2018 -0400
    @@ -32,7 +32,7 @@
    #include <glib.h>
    #ifdef HAVE_CONFIG_H
    -# include <config.h>
    +# include <gntconfig.h>
    #endif
    #ifdef _WIN32
    # undef KEY_EVENT
    --- a/gntmain.c Fri Apr 27 04:49:22 2018 -0400
    +++ b/gntmain.c Fri Apr 27 05:38:28 2018 -0400
    @@ -25,8 +25,6 @@
    #define _XOPEN_SOURCE_EXTENDED
    #endif
    -#include "config.h"
    -
    #include <gmodule.h>
    #include <sys/types.h>
    --- a/gntutils.c Fri Apr 27 04:49:22 2018 -0400
    +++ b/gntutils.c Fri Apr 27 05:38:28 2018 -0400
    @@ -20,8 +20,6 @@
    * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
    */
    -#include "config.h"
    -
    #include "gntinternal.h"
    #undef GNT_LOG_DOMAIN
    #define GNT_LOG_DOMAIN "Utils"
    --- a/gntwm.c Fri Apr 27 04:49:22 2018 -0400
    +++ b/gntwm.c Fri Apr 27 05:38:28 2018 -0400
    @@ -20,7 +20,9 @@
    * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
    */
    -#include "config.h"
    +#include "gntinternal.h"
    +#undef GNT_LOG_DOMAIN
    +#define GNT_LOG_DOMAIN "WM"
    #ifdef USE_PYTHON
    #include <Python.h>
    @@ -44,10 +46,6 @@
    #include <string.h>
    #include <time.h>
    -#include "gntinternal.h"
    -#undef GNT_LOG_DOMAIN
    -#define GNT_LOG_DOMAIN "WM"
    -
    #include "gntwm.h"
    #include "gntstyle.h"
    #include "gnt.h"
    --- a/meson.build Fri Apr 27 04:49:22 2018 -0400
    +++ b/meson.build Fri Apr 27 05:38:28 2018 -0400
    @@ -1,3 +1,66 @@
    +gnt_config = configuration_data()
    +#######################################################################
    +# Check for ncurses and other things used by the console UI
    +#######################################################################
    +ncurses_available = false
    +if get_option('consoleui')
    + ncurses_available = true
    + ncurses_inc = []
    + ncurses_libs = [
    + compiler.find_library('ncursesw', required : false),
    + compiler.find_library('panelw', required : false)
    + ]
    + if not ncurses_libs[0].found() or not ncurses_libs[1].found()
    + ncurses_available = false
    + endif
    +
    + if IS_WIN32
    + # FIXME: $host ?
    + ncurses_sys_prefix = '/usr/$host/sys-root/mingw'
    + else
    + ncurses_sys_prefix = '/usr'
    + endif
    +
    + ncurses_sys_dirs = [ncurses_sys_prefix + '/include/ncursesw',
    + ncurses_sys_prefix + '/include']
    +
    + if ncurses_available
    + # Some distros put the headers in ncursesw/, some don't
    + found_ncurses_h = false
    + foreach location : ncurses_sys_dirs
    + f = location + '/ncurses.h'
    + if not found_ncurses_h
    + if compiler.has_header_symbol(f, 'get_wch',
    + prefix : '#define _XOPEN_SOURCE_EXTENDED')
    + if location != '.'
    + ncurses_inc += [include_directories(location)]
    + endif
    + found_ncurses_h = true
    + endif
    + endif
    + endforeach
    +
    + if not found_ncurses_h
    + ncurses_inc = []
    + ncurses_libs = []
    + ncurses_available = false
    + endif
    + else
    + # ncursesw was not found. Look for plain old ncurses
    + ncurses_libs = [
    + compiler.find_library('ncurses', required : false),
    + compiler.find_library('panel', required : false)
    + ]
    + ncurses_available = ncurses_libs[0].found() and ncurses_libs[1].found()
    + gnt_config.set('NO_WIDECHAR', true)
    + endif
    +
    + ncurses = declare_dependency(
    + include_directories : ncurses_inc,
    + dependencies : ncurses_libs
    + )
    +endif
    +
    libgnt_SOURCES = [
    'gntwidget.c',
    'gntbindable.c',
    @@ -56,7 +119,14 @@
    'gnt.h'
    ]
    -if enable_consoleui
    +if ncurses_available
    +
    +# Check for Python headers
    +python_dep = dependency('python3')
    +gnt_config.set('USE_PYTHON', python_dep.found())
    +
    +configure_file(output : 'gntconfig.h',
    + configuration : gnt_config)
    install_headers(libgnt_headers, subdir : 'gnt')
    @@ -99,4 +169,4 @@
    subdir('wms')
    subdir('test')
    -endif # enable_consoleui
    +endif # ncurses_available