Files
ncmpcpp/configure.in
2009-05-21 11:59:21 +02:00

141 lines
5.0 KiB
Plaintext

AC_INIT(configure.in)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(ncmpcpp, 0.3.5_pre)
AC_PREREQ(2.59)
AC_LANG_CPLUSPLUS
AC_PROG_CXX
AM_PROG_LIBTOOL
AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no])
AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support @<:@default=yes@:>@]), [unicode=$enableval], [unicode=yes])
AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the Internet @<:@default=auto@:>@]), [curl=$withval], [curl=auto])
AC_ARG_WITH(iconv, AS_HELP_STRING([--with-iconv], [Enable iconv support (Note: if you use utf-8 system wide, you can disable this) @<:@default=auto@:>@]), [iconv=$withval], [iconv=auto])
AC_ARG_WITH(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
AC_ARG_WITH(threads, AS_HELP_STRING([--with-threads], [Enable threading support using posix threads @<:@default=auto@:>@]), [threads=$withval], [threads=auto])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
if test "$clock" = "yes"; then
AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
fi
dnl ====================================
dnl = checking for win32 related stuff =
dnl ====================================
AC_CHECK_LIB(ws2_32, _head_libws2_32_a, LDFLAGS="$LDFLAGS -lws2_32", )
AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
dnl ================================
dnl = checking for various headers =
dnl ================================
AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
dnl ======================
dnl = checking for iconv =
dnl ======================
if test "$iconv" != "no" ; then
AC_CHECK_HEADERS([iconv.h],
AC_MSG_CHECKING([whether iconv takes const char **])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]]),
AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
,
if test "$iconv" = "yes"; then
AC_MSG_ERROR([iconv.h header is required])
fi
)
fi
dnl ========================
dnl = checking for ncurses =
dnl ========================
if test "$pdcurses" = "no" ; then
pdcurses=XCurses
if test "$unicode" = "yes" ; then
curses_config_bin=ncursesw5-config
curses_lib=ncursesw
AC_DEFINE([_UTF8], [1], [enables unicode support])
else
curses_config_bin=ncurses5-config
curses_lib=ncurses
fi
else
if test "$pdcurses" = "yes" ; then
pdcurses=XCurses
fi
curses_config_bin=xcurses-config
curses_lib=$pdcurses
AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
fi
AC_PATH_PROG(CURSES_CONFIG, $curses_config_bin)
if test "$pdcurses" = "XCurses" && test "$CURSES_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
AC_CHECK_LIB($curses_lib, initscr, , AC_MSG_ERROR([$curses_lib library is required]))
else
AC_CHECK_LIB($curses_lib, initscr, LDFLAGS="$LDFLAGS -l$curses_lib", AC_MSG_ERROR([$curses_lib library is required]))
fi
if test "$pdcurses" != "no" ; then
AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
fi
AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing ncurses.h header]))
dnl =================================
dnl = checking for curl and pthread =
dnl =================================
if test "$curl" != "no" ; then
if test "$threads" != "no" ; then
AC_CHECK_HEADERS([pthread.h], AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
if test "$threads" = "yes" ; then
AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
fi
), )
fi
AC_PATH_PROG(CURL_CONFIG, curl-config)
if test "$CURL_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
if test "$curl" = "yes" ; then
AC_MSG_ERROR([curl library is required])
fi
)
AC_CHECK_HEADERS([curl/curl.h], ,
if test "$curl" = "yes" ; then
AC_MSG_ERROR([missing curl.h header])
fi
)
else
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
if test "$curl" = "yes" ; then
AC_MSG_ERROR([curl library is required])
fi
)
fi
fi
dnl =======================
dnl = checking for taglib =
dnl =======================
if test "$taglib" != "no" ; then
AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
if test "$TAGLIB_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
AC_CHECK_HEADERS([taglib.h], ,
if test "$taglib" = "yes" ; then
AC_MSG_ERROR([missing taglib.h header])
fi
)
else
if test "$taglib" = "yes" ; then
AC_MSG_ERROR([taglib-config executable is missing])
fi
fi
fi
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
AC_OUTPUT