summaryrefslogtreecommitdiff
path: root/configure.in
blob: 86c379197511eabf00235e6074d01fd0652c139a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
AC_INIT(configure.in)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(ncmpcpp, 0.3.2_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]), [clock=$enableval], [clock=no])
AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support]), [unicode=$enableval], [unicode=yes])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor]), [taglib=$withval], [taglib=no])
AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the Internet]), [curl=$withval], [curl=no])

if test "$clock" = "yes"; then
	AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
fi

dnl ======================
dnl = checking for iconv =
dnl ======================
AC_CHECK_FILE([/usr/share/i18n/SUPPORTED], AC_DEFINE([SUPPORTED_LOCALES], ["/usr/share/i18n/SUPPORTED"], [ ]),
	AC_CHECK_FILE([/etc/locale.gen], AC_DEFINE([SUPPORTED_LOCALES], ["/etc/locale.gen"], [ ]),
	AC_MSG_NOTICE(cannot find list of supported locales, iconv support will be disabled))
)
AC_CHECK_HEADERS([iconv.h], , AC_MSG_NOTICE(cannot find iconv.h header, iconv support will be disabled))

dnl ========================
dnl = checking for ncurses =
dnl ========================
if test "$unicode" = "yes" ; then
	ncurses_config_bin=ncursesw5-config
	ncurses_lib=ncursesw
	CPPFLAGS="$CPPFLAGS -D_UTF8"
else
	ncurses_config_bin=ncurses5-config
	ncurses_lib=ncurses
fi
AC_PATH_PROG(NCURSES_CONFIG, $ncurses_config_bin)
if test "$NCURSES_CONFIG" != "" ; then
	CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
	LDFLAGS="$LDFLAGS `$NCURSES_CONFIG --libs`"
	AC_CHECK_LIB($ncurses_lib, initscr, , AC_MSG_ERROR([$ncurses_lib library is required]))
else
	AC_CHECK_LIB($ncurses_lib, initscr, LDFLAGS="$LDFLAGS -l$ncurses_lib", AC_MSG_ERROR([$ncurses_lib library is required]))
fi
AC_CHECK_HEADERS([ncurses.h], , AC_MSG_ERROR([missing ncurses.h header]))

dnl =================================
dnl = checking for curl and pthread =
dnl =================================
if test "$curl" = "yes" ; then
	AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread", AC_MSG_ERROR([pthread library is required]))
	AC_CHECK_HEADERS([pthread.h], , AC_MSG_ERROR([missing pthread.h header]))
	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`", AC_MSG_ERROR([curl library is required]))
		AC_CHECK_HEADERS([curl/curl.h], , AC_MSG_ERROR([missing curl.h header]))
	else
		AC_MSG_ERROR([curl-config executable is missing])
	fi
fi

dnl =======================
dnl = checking for taglib =
dnl =======================
if test "$taglib" = "yes" ; 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], , AC_MSG_ERROR([missing taglib.h header]))
	else
		AC_MSG_ERROR([taglib-config executable is missing])
	fi
fi

AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
AC_OUTPUT