1#/**********************************************************
2# *
3# * mp3splt-gtk - utility using libmp3splt,
4# *                for mp3/ogg splitting without decoding
5# *
6# * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
7# * Copyright (c) 2005-2014 Munteanu Alexandru - m@ioalex.net
8# *
9# * http://mp3splt.sourceforge.net
10# *
11# *********************************************************/
12
13#/**********************************************************
14#
15# This program is free software; you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation; either version 2 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program; if not, write to the Free Software
27# Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
28#
29# *********************************************************/
30
31#################################################
32# Basic initialisations
33#################################################
34
35m4_define([minimum_libmp3splt_version],[0.9.2])
36
37AC_PREREQ(2.62)
38AC_INIT(mp3splt-gtk, 0.9.2, mp3splt.sf.net)
39
40# tell autoconf where to put the temporary files and scripts
41# it generates. Seems to be more clean to put them into a subdir;
42# One of this files is gnome-doc-utils.make, which is needed to
43# compile the help files.
44AC_CONFIG_AUX_DIR([build-aux])
45AC_CONFIG_MACRO_DIR([m4])
46# tell which file by being there indicates we are run from the
47# right directory
48AC_CONFIG_SRCDIR([src/mp3splt-gtk.c])
49# Initialize automake
50AM_INIT_AUTOMAKE
51
52# Tell autoconf where to put the output file that contains all
53# definitions our C program will need
54AC_CONFIG_HEADER([config.h])
55AM_MAINTAINER_MODE([enable])
56
57#################################################
58# Check for programs
59#################################################
60
61AC_PROG_CC
62AC_PROG_INSTALL
63
64# Include all m4 macros that have to do with the language C
65AC_LANG_C
66
67#gettext
68AC_CHECK_HEADERS([unistd.h])
69AM_GNU_GETTEXT([external])
70AM_GNU_GETTEXT_VERSION([0.13.1])
71
72AC_DEFINE_UNQUOTED([LIBMP3SPLT_WITH_SONAME], "libmp3splt0", [libmp3splt with soname])
73
74#################################################################
75# Enable libtool, check for libltdl and define @LIBLTDL@ and @INCLTDL@
76#################################################################
77
78ifdef([LT_CONFIG_LTDL_DIR],
79      [ LT_CONFIG_LTDL_DIR([libltdl]) ],
80      [])
81
82ifdef([LT_INIT],
83      [ LT_INIT([win32-dll]) ],
84      [ AC_PROG_LIBTOOL ])
85
86AC_WITH_LTDL
87
88#################################################################
89# Check for the type of the host
90#################################################################
91
92AC_MSG_CHECKING(the host)
93AM_CONDITIONAL(WIN32,false)
94case $host in
95	*linux*)
96		HOST="Linux-based system"
97		;;
98	*openbsd*)
99		HOST="OpenBSD"
100		LIBS="$LIBS `pkg-config --libs gtk+-3.0` -lpthread"
101		CFLAGS="$CFLAGS `pkg-config --cflags gtk+-3.0`"
102		;;
103	*netbsd*)
104		HOST="NetBSD"
105		LIBS="$LIBS -D_nl_domain_bindings=libintl_nl_domain_bindings -lintl -lstdc++"
106		;;
107	*freebsd*)
108		HOST="FreeBSD"
109		LIBS="$LIBS -lpthread"
110		;;
111	*mingw*)
112		HOST="Mingw"
113		AM_CONDITIONAL(WIN32,true)
114		;;
115	*solaris*)
116		HOST="Solaris"
117		LIBS="$LIBS -lsocket"
118		;;
119	*)
120		HOST="Other"
121		;;
122esac
123AC_MSG_RESULT($HOST)
124
125
126#################################################
127# Check for libraries
128#################################################
129
130#check for -lm
131AC_CHECK_LIB(m, pow, [ haslm="yes" ] , [ AC_MSG_ERROR([libm not found !]) ] )
132
133#check for -ltld
134AC_CHECK_LIB(ltdl, lt_dlopen, [ hasltdl="yes" ], [ AC_MSG_ERROR([libltdl not found - check libtool installation !]) ] )
135
136
137#################################################
138
139audacious_check="audclient >= 3.0"
140
141PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.4.2],
142[
143  CFLAGS="$CFLAGS -DGTK_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE"
144  #CFLAGS="$CFLAGS -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE"
145],
146[
147  AC_MSG_ERROR([Cannot find GTK >= 3.4.2])
148])
149
150#################################################
151# Initialize the gnome integration
152#################################################
153
154AM_CONDITIONAL(GNOME, false)
155AM_CONDITIONAL(HAVE_GNOME_DOC_UTILS, false)
156gnome="no"
157
158AC_ARG_ENABLE(gnome, AC_HELP_STRING([--disable-gnome], [Disable gnome support. ]),
159    [enable_gnome=$enableval],[enable_gnome="yes"])
160
161AM_CONDITIONAL(ENABLE_SK, true)
162
163if test "x$enable_gnome" = xyes;then
164  ifdef([GNOME_DOC_INIT],
165  [
166    GNOME_DOC_INIT([],
167                   [
168                     AM_CONDITIONAL(GNOME, true)
169                     AM_CONDITIONAL(HAVE_GNOME_DOC_UTILS, true)
170                     gnome="yes"
171                   ],
172                   [AC_MSG_ERROR([gnome-doc-utils not found.
173
174      Install it or configure with "--disable-gnome".])])
175  ],
176  [
177    AC_MSG_NOTICE([No GNOME_DOC_INIT found.])
178  ])
179fi
180
181
182#################################################
183#Check for libmp3splt
184
185PKG_CHECK_MODULES([LIBMP3SPLT], [libmp3splt = minimum_libmp3splt_version],
186[],
187[ AC_MSG_ERROR(libmp3splt version minimum_libmp3splt_version needed :
188
189Download the latest version of libmp3splt at http://mp3splt.sourceforge.net/
190) ])
191
192#################################################
193#Check for audacious
194
195AM_CONDITIONAL(AUDACIOUS,false)
196audacious="no"
197#checking for --disable-audacious & audacious library
198AC_ARG_ENABLE(audacious, AC_HELP_STRING([--disable-audacious], [Disable audacious player support. ]),
199    [enable_audacious=$enableval],[enable_audacious="yes"])
200
201if test "x$enable_audacious" = xyes;then
202  PKG_CHECK_MODULES([AUDACIOUS], [$audacious_check ],
203      [AM_CONDITIONAL(AUDACIOUS, true) audacious="yes" ],
204      [AC_MSG_ERROR([Audacious player development files for $audacious_check not found.
205
206    Install it or configure with "--disable-audacious".
207    If you want to compile with GTK 3.x, you need audacious >= 3.0.
208]) ])
209  PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1)
210fi
211
212
213#################################################
214#Check for gstreamer
215
216AM_CONDITIONAL(GSTREAMER,false)
217gstreamer="no"
218#checking for --disable-gstreamer & gstreamer library
219AC_ARG_ENABLE(gstreamer, AC_HELP_STRING([--disable-gstreamer], [Disable gstreamer 'internal' player support. ]),
220    [enable_gstreamer=$enableval],[enable_gstreamer="yes"])
221
222if test "x$enable_gstreamer" = xyes;then
223  PKG_CHECK_MODULES(GST, [gstreamer-1.0 >= 1.0],
224      [AM_CONDITIONAL(GSTREAMER,true) gstreamer="yes"],
225      [AC_MSG_ERROR([GStreamer >= 1.0 development files are not installed.
226
227    Install it or configure with "--disable-gstreamer".])])
228fi
229
230
231#################################################
232# Documentation of the code
233# (but only if doxygen is installed)
234#################################################
235
236doxygen_doc="no"
237with_graphviz="no"
238AC_ARG_ENABLE(doxygen_doc, [AC_HELP_STRING([--disable-doxygen_doc],[ Disable doxygen code documentation. ]) ],
239    [enable_doxygen_doc=$enableval],[enable_doxygen_doc="yes"])
240
241AM_CONDITIONAL(HAVE_DOXYGEN, false)
242AM_CONDITIONAL(HAVE_GRAPHVIZ, false)
243if test "x$enable_doxygen_doc" = xyes;then
244  AC_PATH_PROG([DOXYGEN],[doxygen])
245  AC_ARG_VAR(DOXYGEN,
246             [Location of the 'doxygen' program; if found we can generate documentation for the C code])
247
248  if test "x$DOXYGEN" != "x"; then
249   AM_CONDITIONAL(HAVE_DOXYGEN, true)
250   doxygen_doc="yes"
251
252   AC_PATH_PROG([GRAPHVIZ],[dot])
253   AC_ARG_VAR(GRAPHVIZ,
254              [Location of the 'dot' program from the graphviz suite; if found we can generate caller graphs for the documentation of the C code])
255   if test "x$GRAPHVIZ" = "x"; then
256     AC_MSG_WARN([*** dot from the graphviz package not found, inheritance diagrams will not be generated in code documentation])
257   else
258     AM_CONDITIONAL(HAVE_GRAPHVIZ, true)
259     with_graphviz="yes"
260   fi
261
262  fi
263fi
264
265
266#################################################
267#
268#################################################
269
270AM_CONDITIONAL(NO_IMAGES_DIR, false)
271AC_ARG_WITH([no_images_dir],
272    [AS_HELP_STRING([--with-no_images_dir],
273      [take images from the directory where the application is run])],
274    [AM_CONDITIONAL(NO_IMAGES_DIR, true)],
275    [])
276
277
278#################################################################
279# Check for some debugging, warnings and optimise options
280#################################################################
281
282AC_ARG_ENABLE(c-debug, [AC_HELP_STRING([--enable-c-debug],[ Enable debugging symbols. ]) ],
283    [enable_c_debug=$enableval],[enable_c_debug="no"])
284if test "x$enable_c_debug" = xyes;then
285  CFLAGS="$CFLAGS -g -Wall"
286fi
287
288AC_ARG_ENABLE(optimise, [AC_HELP_STRING([--enable-optimise],[ Enable O3 optimise. ]) ],
289    [enable_optimise=$enableval],[enable_optimise="no"])
290if test "x$enable_optimise" = xyes;then
291  CFLAGS="$CFLAGS -O3"
292fi
293
294AC_ARG_ENABLE(extra-warnings, [AC_HELP_STRING([--enable-extra-warnings],[ Enable extra warnings. ]) ],
295    [enable_extra_warnings=$enableval],[enable_extra_warnings="no"])
296if test "x$enable_extra_warnings" = xyes;then
297  CFLAGS="$CFLAGS -Wall -Wextra -Wswitch-enum -Wswitch-default -Wfloat-equal -Wbad-function-cast -Wcast-qual -Wunreachable-code"
298fi
299
300
301#################################################################
302# Check for cutter
303#################################################################
304
305AM_CONDITIONAL(HAS_CUTTER, false)
306
307AC_ARG_ENABLE(cutter, [AC_HELP_STRING([--disable-cutter],[ Disable Cutter unit testing. ]) ],
308    [enable_cutter=$enableval],[enable_cutter="yes"])
309
310if test "x$enable_cutter" = xyes;then
311
312AC_CHECK_CUTTER
313
314cutter_command="no"
315AC_CHECK_FILE([$CUTTER], [cutter_command="yes"])
316
317if test "x$CUTTER" != x;then
318  if test "x$cutter_command" = xyes;then
319    AM_CONDITIONAL(HAS_CUTTER, true)
320  fi
321fi
322
323fi
324
325
326#################################################
327# Generate Makefiles
328#################################################
329
330AC_CONFIG_FILES([Makefile src/Makefile m4/Makefile po/Makefile.in doc/Makefile doc/Doxyfile_all help/Makefile test/Makefile])
331
332#################################################
333# Define some useful constants
334#################################################
335
336# Gettext wants to know the path to the top directory and such things...
337top_builddir=`pwd`
338AC_SUBST(top_builddir)
339AC_SUBST(PACKAGE)
340AC_SUBST(LOCALEDIR)
341
342
343#################################################
344# Output configuration
345#################################################
346
347echo
348echo "---------------------------------------------------------"
349echo "Configuration:"
350echo
351echo "    install path:            ${prefix}"
352echo
353echo " Players :"
354echo
355echo "    gstreamer                $gstreamer"
356echo "    audacious                $audacious"
357echo "    snackAmp                 yes"
358echo
359echo " Other :"
360echo
361echo "    gnome support            $gnome"
362echo "    doxygen documentation    $doxygen_doc"
363echo "        with graphviz        $with_graphviz"
364echo "---------------------------------------------------------"
365echo
366
367# Tell autoconf to start outputting whatever it has to.
368AC_OUTPUT
369