1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3m4_define([OL_MAJOR_VER], [0])
4m4_define([OL_MINOR_VER], [4])
5m4_define([OL_MICRO_VER], [3])
6m4_define([OL_BUILD], [])
7m4_define(OL_BUILD_VER,
8          m4_esyscmd([if test x]OL_BUILD[ == x-git; then git log -1 --format=format:%ad --date=short | sed 's/-//g'; fi]))
9
10m4_define([OL_VERSION], [OL_MAJOR_VER.OL_MINOR_VER.OL_MICRO_VER[]OL_BUILD[]OL_BUILD_VER])
11AC_INIT([osdlyrics], [OL_VERSION], [http://code.google.com/p/osd-lyrics/issues/list])
12AM_INIT_AUTOMAKE([-Wall -Werror])
13AC_CONFIG_SRCDIR([src/ol_main.c])
14AC_CONFIG_HEADERS([config.h])
15AC_DEFINE([PROGRAM_NAME], ["OSD Lyrics"], [The full name of the program to display])
16
17# Checks for header files.
18AC_PATH_X
19AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h stddef.h stdlib.h string.h sys/time.h unistd.h])
20
21# Checks for programs.
22AC_PROG_CC
23AC_PROG_CXX
24AC_PROG_MAKE_SET
25AM_PROG_CC_C_O
26AM_PROG_AR
27AC_PROG_RANLIB
28AC_CONFIG_FILES([ po/Makefile.in
29	Makefile
30	lib/Makefile
31        lib/chardetect/Makefile
32	dailydeb.sh
33	src/Makefile
34	src/tests/Makefile
35	data/Makefile
36])
37
38# Checks for typedefs, structures, and compiler characteristics.
39AC_HEADER_STDBOOL
40AC_C_INLINE
41AC_TYPE_INT32_T
42AC_TYPE_INT64_T
43AC_TYPE_PID_T
44AC_TYPE_SIZE_T
45AC_TYPE_SSIZE_T
46
47# Checks for library functions.
48# AM_GNU_GETTEXT
49AC_FUNC_FORK
50AC_FUNC_MALLOC
51AC_FUNC_REALLOC
52AC_CHECK_FUNCS([ftruncate gettimeofday memset pathconf sqrt strcasecmp strchr strdup strerror strrchr strstr])
53AM_ICONV
54
55#define paths
56OL_ICONDIR='${datadir}/${PACKAGE}/icons'
57AC_SUBST(OL_ICONDIR)
58OL_GUIDIR='${datadir}/${PACKAGE}'
59AC_SUBST(OL_GUIDIR)
60
61# gprof support
62AC_ARG_WITH(gprof-support,
63[  --with-gprof-support=DIR   Include gmon.out file renaming support
64  --without-gprof-support    Don't do gmon.out file renaming (default)],
65[ case "$withval" in
66  yes)
67    AC_MSG_RESULT(yes)
68    AC_DEFINE([WITH_GPROF_SUPPORT], [], [Support gprof profiling])
69    CFLAGS="-pg $CFLAGS"
70    LDFLAGS="-pg $LDFLAGS"
71    AC_MSG_WARN(--with-gprof-support called without argument - using default)
72    gmondir="/tmp"
73    AC_SUBST(gmondir)
74    ;;
75  no)
76    AC_MSG_RESULT(no)
77    ;;
78  *)
79    AC_MSG_RESULT(yes)
80    AC_DEFINE([WITH_GPROF_SUPPORT], [], [Support gprof profiling])
81    CFLAGS="-pg $CFLAGS"
82    LDFLAGS="-pg $LDFLAGS"
83    gmondir="$withval"
84    AC_SUBST(gmondir)
85    ;;
86  esac
87])
88
89# dev restrict support
90AC_ARG_WITH(werror,
91[  --with-werror   Build with -Wall -Werror],
92[ case "$withval" in
93  yes)
94    AC_MSG_RESULT(yes)
95    CFLAGS="-Wall -Werror $CFLAGS"
96    ;;
97  *)
98    AC_MSG_RESULT(no)
99    ;;
100  esac
101])
102
103dnl app indicators in Ubuntu
104APPINDICATOR_REQUIRED=0.0.7
105
106AC_ARG_ENABLE(appindicator,
107                        AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support for application indicators ]),
108                        [enable_appindicator=$enableval],
109                        [enable_appindicator="auto"])
110
111dnl MPD support
112AC_ARG_ENABLE([mpd],
113  [AS_HELP_STRING([--disable-mpd], [Disables MPD support. You won't need libmpd if you use this option])],
114  [],
115  [enable_mpd=yes])
116
117AC_ARG_ENABLE([xmms2],
118  [AS_HELP_STRING([--disable-xmms2], [Disables XMMS2 support. You won't need libxmmsclient if you use this option])],
119  [],
120  [enable_xmms2=yes])
121
122AC_ARG_ENABLE([amarok1],
123  [AS_HELP_STRING([--enable-amarok1], [Enables Amarok 1.4 support])],
124  [],
125  [enable_amarok1=no])
126
127AS_IF([test "x$enable_amarok1" != xno],
128  [AC_DEFINE([ENABLE_AMAROK1], [1], [Define if compile to support Amarok 1.4])])
129
130# Checks for libraries.
131AC_CHECK_LIB([dl], [exp])
132PKG_CHECK_MODULES([GTK2], [gtk+-2.0 >= 2.20.0,
133                          gthread-2.0,
134                          gmodule-export-2.0,
135                          gio-2.0,
136                          gio-unix-2.0])
137PKG_CHECK_MODULES([X11], [x11])   dnl For XGrabKey
138PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
139PKG_CHECK_MODULES([CURL], [libcurl])
140PKG_CHECK_MODULES([NOTIFY], [libnotify])
141PKG_CHECK_EXISTS([libnotify >= 0.7],
142  AC_DEFINE(HAVE_LIBNOTIFY_0_7, 1, [Have libnotify >= 0.7]))
143
144PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.3.0])
145MPD_CFLAGS=
146MPD_LIBS=
147AS_IF([test "x$enable_mpd" != "xno"],
148  [PKG_CHECK_MODULES([MPD], [libmpd],
149    [AC_DEFINE([ENABLE_MPD], [1], [Define if compile to support MPD])
150     #BUILD_MPD_SUPPORT=1
151    ],
152    [enable_mpd=no
153     #BUILD_MPD_SUPPORT=0
154     AC_MSG_WARN(
155       [libmpd is not available, use --disable-mpd to disable MPD support])
156    ])
157  ],
158  [BUILD_MPD_SUPPORT=0
159   AC_SUBST(MPD_CFLAGS)
160   AC_SUBST(MPD_LIBS)
161  ]
162)
163XMMS2_CFLAGS=
164XMMS2_LIBS=
165AS_IF([test "x$enable_xmms2" != "xno"],
166  [PKG_CHECK_MODULES([XMMS2], [xmms2-client],
167    [AC_DEFINE([ENABLE_XMMS2], [1], [Define if compile to support XMMS2])
168    ],
169    [enable_xmms2=no
170     AC_MSG_WARN(
171       [xmms2-client is not available, use --disable-xmms2 to disable XMMS2 support])
172    ])
173  ],
174  [BUILD_XMMS2_SUPPORT=0
175   AC_SUBST(XMMS2_CFLAGS)
176   AC_SUBST(XMMS2_LIBS)
177  ]
178)
179#AM_CONDITIONAL(BUILD_MPD_SUPPORT, [test "x$enable_mpd" != "xno"])
180#AC_SUBST(BUILD_MPD_SUPPORT)
181if test x$enable_appindicator = xauto ; then
182        PKG_CHECK_EXISTS([appindicator-0.1 >= $APPINDICATOR_REQUIRED],
183                         enable_appindicator="yes",
184                         enable_appindicator="no")
185fi
186
187if test x$enable_appindicator = xyes ; then
188        PKG_CHECK_EXISTS([appindicator-0.1 >= $APPINDICATOR_REQUIRED],,
189                         AC_MSG_ERROR([appindicator-0.1 is not installed]))
190        PKG_CHECK_MODULES(APP_INDICATOR,
191                        appindicator-0.1 >= $APPINDICATOR_REQUIRED)
192        AC_SUBST(APP_INDICATOR_CFLAGS)
193        AC_SUBST(APP_INDICATOR_LIBS)
194        AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator])
195fi
196AM_CONDITIONAL(HAVE_APP_INDICATOR, test x"$enable_appindicator" = xyes)
197
198# i18n support from GNU gettext.
199GETTEXT_PACKAGE=osdlyrics
200AC_SUBST(GETTEXT_PACKAGE)
201AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
202IT_PROG_INTLTOOL([0.35.0])
203AM_GLIB_GNU_GETTEXT
204
205# Checks for header files.
206AC_CHECK_HEADERS([stdlib.h string.h])
207
208# Checks for typedefs, structures, and compiler characteristics.
209
210# Checks for library functions.
211
212AC_OUTPUT
213