Add check of ncurses*-config

The recent ncurses package provides ncurses*-config program to give the
proper cflags and libs.  Let's use them if available.

Right now, the ncurses version (5) is hard-coded.  It should be better
to be variable as well, but it'd be messy.  Hope the ncurses version won't
change rapidly.
This commit is contained in:
Takashi Iwai 2008-04-16 14:39:41 +02:00
parent c58817e8af
commit 8e3e09dd0b
2 changed files with 25 additions and 4 deletions

View file

@ -1,9 +1,10 @@
LDADD = $(CURSESLIB) AM_CFLAGS = @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
LDADD = @CURSESLIB@
bin_PROGRAMS = alsamixer bin_PROGRAMS = alsamixer
man_MANS = alsamixer.1 man_MANS = alsamixer.1
EXTRA_DIST = alsamixer.1 EXTRA_DIST = alsamixer.1
alsamixer_INCLUDES = -I$(top_srcdir)/include -DCURSESINC="$(CURSESINC)" alsamixer_INCLUDES = -I$(top_srcdir)/include
#LDFLAGS = -static #LDFLAGS = -static
#CFLAGS += -g -Wall #CFLAGS += -g -Wall

View file

@ -29,6 +29,9 @@ AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
AM_PATH_ALSA(1.0.16) AM_PATH_ALSA(1.0.16)
CURSESINC=""
CURSESLIB=""
CURSES_CFLAGS=""
AC_ARG_ENABLE(alsamixer, AC_ARG_ENABLE(alsamixer,
[ --disable-alsamixer Disable alsamixer compilation], [ --disable-alsamixer Disable alsamixer compilation],
[case "${enableval}" in [case "${enableval}" in
@ -46,13 +49,29 @@ if test x$alsamixer = xtrue; then
curseslib="$withval", curseslib="$withval",
curseslib="auto") curseslib="auto")
if test "$curseslib" = "ncursesw"; then if test "$curseslib" = "ncursesw"; then
AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
if test "$ncursesw5_config" = "yes"; then
CURSESINC="<ncurses.h>"
CURSESLIB=`ncursesw5-config --libs`
CURSES_CFLAGS=`ncursesw5-config --cflags`
curseslib="ncursesw"
else
AC_CHECK_LIB(ncursesw, initscr, AC_CHECK_LIB(ncursesw, initscr,
[ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"]) [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
fi fi
fi
if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
if test "$ncurses5_config" = "yes"; then
CURSESINC="<ncurses.h>"
CURSESLIB=`ncurses5-config --libs`
CURSES_CFLAGS=`ncurses5-config --cflags`
curseslib="ncurses"
else
AC_CHECK_LIB(ncurses, initscr, AC_CHECK_LIB(ncurses, initscr,
[ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"]) [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
fi fi
fi
if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
AC_CHECK_LIB(curses, initscr, AC_CHECK_LIB(curses, initscr,
[ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"]) [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
@ -64,6 +83,7 @@ fi
AC_SUBST(CURSESINC) AC_SUBST(CURSESINC)
AC_SUBST(CURSESLIB) AC_SUBST(CURSESLIB)
AC_SUBST(CURSES_CFLAGS)
test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$prefix" = xNONE && prefix=$ac_default_prefix