Skip to content

Commit

Permalink
Build: prefer ncursesw if it exists (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Renker committed Oct 11, 2020
1 parent c572032 commit 52710a5
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
48 changes: 47 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -3836,7 +3836,51 @@ else
as_fn_error $? "math library not found" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for waddstr in -lncurses" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for waddstr in -lncursesw" >&5
$as_echo_n "checking for waddstr in -lncursesw... " >&6; }
if ${ac_cv_lib_ncursesw_waddstr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lncursesw $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char waddstr ();
int
main ()
{
return waddstr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ncursesw_waddstr=yes
else
ac_cv_lib_ncursesw_waddstr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_waddstr" >&5
$as_echo "$ac_cv_lib_ncursesw_waddstr" >&6; }
if test "x$ac_cv_lib_ncursesw_waddstr" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNCURSESW 1
_ACEOF
LIBS="-lncursesw $LIBS"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for waddstr in -lncurses" >&5
$as_echo_n "checking for waddstr in -lncurses... " >&6; }
if ${ac_cv_lib_ncurses_waddstr+:} false; then :
$as_echo_n "(cached) " >&6
Expand Down Expand Up @@ -3883,6 +3927,8 @@ else
as_fn_error $? "ncurses library not found" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
if ${ac_cv_lib_pthread_pthread_create+:} false; then :
Expand Down
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ AC_HEADER_STDBOOL

# Tests involving libraries
AC_CHECK_LIB([m], [pow], [], [AC_MSG_ERROR(math library not found)])
AC_CHECK_LIB([ncurses], [waddstr], [], [AC_MSG_ERROR(ncurses library not found)])
AC_CHECK_LIB([ncursesw], [waddstr],
[],
[AC_CHECK_LIB([ncurses], [waddstr], [], [AC_MSG_ERROR(ncurses library not found)])])
AC_CHECK_LIB([pthread], [pthread_create], [CFLAGS="$CFLAGS -pthread"],
[AC_MSG_ERROR(pthread library not found)])

Expand Down
4 changes: 4 additions & 0 deletions wavemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
#include <ctype.h>
#include <math.h>
#include <stdbool.h>
#ifdef HAVE_LIBNCURSESW
#include <ncursesw/curses.h>
#else
#include <ncurses.h>
#endif

#include "llist.h"

Expand Down

0 comments on commit 52710a5

Please sign in to comment.