1dnl Process this file with autoconf to produce a configure script.
2
3AC_PREREQ([2.64])
4
5dnl To set also in config.h.mingw
6dnl defines ($PACKAGE_NAME, $PACKAGE_VERSION, etc.)
7AC_INIT([EasyTAG], [2.4.3], [https://bugzilla.gnome.org/enter_bug.cgi?product=easytag], [easytag], [https://wiki.gnome.org/Apps/EasyTAG])
8
9AC_CONFIG_AUX_DIR([build-aux])
10AC_CONFIG_HEADERS([config.h])
11AC_CONFIG_SRCDIR([src/easytag.h])
12AC_CONFIG_MACRO_DIR([m4])
13
14dnl -------------------------------
15dnl Init automake
16dnl -------------------------------
17AM_INIT_AUTOMAKE([1.11.2 -Wall -Wno-portability check-news no-define dist-xz no-dist-gzip nostdinc subdir-objects])
18AM_MAINTAINER_MODE([enable])
19AM_SILENT_RULES([yes])
20
21dnl -------------------------------
22dnl Init Libtool
23dnl -------------------------------
24LT_PREREQ([2.2])
25LT_INIT([disable-static])
26
27dnl -------------------------------
28dnl Translation files.
29dnl -------------------------------
30IT_PROG_INTLTOOL([0.50.0])
31AC_SUBST([GETTEXT_PACKAGE], [$PACKAGE_TARNAME])
32AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Package name for gettext])
33AS_IF([test "x$USE_NLS" != "xno"],
34      [AC_DEFINE([ENABLE_NLS], [1], [Native Language support is enabled])])
35
36dnl AppData
37m4_ifdef([APPDATA_XML], [APPDATA_XML],
38         [AC_MSG_ERROR([appdata-tools is required for appdata-xml.m4])])
39
40dnl -------------------------------
41dnl Checks for programs.
42dnl -------------------------------
43AC_PROG_CC
44AM_PROG_CC_C_O
45AC_PROG_CXX
46AC_PROG_CXXCPP
47AC_PROG_SED
48PKG_PROG_PKG_CONFIG([0.24])
49
50AX_GENERATE_CHANGELOG
51
52AC_SUBST([GLIB_COMPILE_RESOURCES], [`$PKG_CONFIG --variable glib_compile_resources gio-2.0`])
53
54AC_PATH_PROG([GDK_PIXBUF_PIXDATA], [gdk-pixbuf-pixdata])
55AS_IF([test "x$ac_cv_path_GDK_PIXBUF_PIXDATA" = "x"],
56      [AC_MSG_ERROR([gdk-pixbuf-pixdata is required for image resources])])
57
58AC_MSG_CHECKING([for glib-mkenums script])
59GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
60AS_IF([test "x$GLIB_MKENUMS" = "x"],
61    [AC_MSG_ERROR([glib-mkenums not listed in glib-2.0 pkg-config file])],
62    [AC_SUBST([GLIB_MKENUMS])
63     AC_MSG_RESULT([$GLIB_MKENUMS])])
64
65dnl Man page, generated with xsltproc from DocBook XML.
66AC_ARG_ENABLE([man],
67    [AS_HELP_STRING([--disable-man], [Disable building the man page])])
68
69AS_IF([test "x$enable_man" != "xno"],
70    [AC_PATH_PROG([XSLTPROC], [xsltproc])
71     JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.4//EN],
72         [DocBook XML DTD V4.4], [have_docbookdtd=yes], [have_docbookdtd=no])
73     JH_CHECK_XML_CATALOG(
74         [http://docbook.sourceforge.net/release/xsl/current/html/refentry.xsl],
75         [DocBook XSL Stylesheets], [have_docbookxsl=yes],
76         [have_docbookxsl=no])
77     AS_IF([test "x$ac_cv_path_XSLTPROC" != "x" \
78         -a "x$have_docbookdtd" = "xyes" -a "x$have_docbookxsl" = "xyes"],
79         [have_manutils=yes],
80         [AS_IF([test "x$enable_man" = "xyes"],
81             [AC_MSG_ERROR(
82                 [man page generation requested but required utilities were not found])])
83          have_manutils=no])],
84    [have_manutils=no])
85
86AM_CONDITIONAL([ENABLE_MAN], [test "x$have_manutils" = "xyes"])
87
88dnl Check for testing utilities.
89AC_ARG_ENABLE([tests],
90              [AS_HELP_STRING([--disable-tests], [Disable support for tests run during make check])])
91
92AS_IF([test "x$enable_tests" != "xno"],
93      [AC_PATH_PROG([DESKTOP_FILE_VALIDATE], [desktop-file-validate])
94       AS_IF([test "x$ac_cv_path_DESKTOP_FILE_VALIDATE" != "xyes"],
95             [have_desktop_file_validate=yes],
96             [have_desktop_file_validate=no])
97       AC_PATH_PROG([GTESTER], [gtester])
98       AC_PATH_PROG([GTESTER_REPORT], [gtester-report])
99       AS_IF([test "x$ac_cv_path_GTESTER" != "xyes" -a "x$ac_cv_path_GTESTER_REPORT" != "xyes"],
100             [have_gtester=yes],
101             [have_gtester=no])],
102      [have_desktop_file_validate=no
103       have_gtester=no])
104
105AS_IF([test "x$have_desktop_file_validate" = "xyes" -a "x$have_gtester" = "xyes"],
106      [testing_utilities=yes],
107      [testing_utilities=no
108       AS_IF([test "x$enable_tests" = "xyes"],
109             [AC_MSG_ERROR([tests were requested but the required utilities were not found])])])
110
111AM_CONDITIONAL([EASYTAG_ENABLE_TESTS], [test "x$testing_utilities" = "xyes"])
112
113dnl Help.
114m4_ifdef([YELP_HELP_INIT], [YELP_HELP_INIT],
115         [AC_MSG_ERROR([yelp-tools is required to build EasyTAG help])])
116
117AC_PATH_PROG([YELP], [yelp])
118AS_IF([test "x$ac_cv_path_YELP" = "x"],
119      [AC_MSG_WARN([Yelp is required at runtime for user help])])
120
121dnl -------------------------------
122dnl Handle cross-compiling with mingw32.
123dnl -------------------------------
124AC_CANONICAL_HOST
125AC_MSG_CHECKING([whether to build with mingw32 for a Windows host])
126AS_CASE([$host_os],
127        [*mingw*], [windows_host=yes],
128        [windows_host=no])
129AC_MSG_RESULT([$windows_host])
130
131AM_CONDITIONAL([WINDOWS_HOST], [test "x$windows_host" = "xyes"])
132
133AS_IF([test "x$windows_host" = "xyes"],
134      [AC_CHECK_TOOL([WINDRES], [windres])
135       AS_IF([test -z "$WINDRES"],
136             [AC_MSG_ERROR([windres is required when building for a Windows host])])])
137
138dnl -------------------------------
139dnl Configure switches.
140dnl -------------------------------
141AC_ARG_ENABLE([mp3],
142              [AS_HELP_STRING([--disable-mp3], [Disable support for MP3 files (default=auto)])])
143
144AC_ARG_ENABLE([id3v23],
145              [AS_HELP_STRING([--disable-id3v23], [Disable support for writing id3v2.3 tags (default=enabled)])])
146
147AC_ARG_ENABLE([ogg],
148              [AS_HELP_STRING([--disable-ogg], [Disable support for Ogg Vorbis files (default=auto)])])
149
150AC_ARG_ENABLE([opus],
151              [AS_HELP_STRING([--disable-opus], [Disable support for Opus Vorbis files (default=auto)])])
152
153AC_ARG_ENABLE([speex],
154              [AS_HELP_STRING([--disable-speex], [Disable support for Ogg Speex files (default=auto)])])
155
156AC_ARG_ENABLE([flac],
157              [AS_HELP_STRING([--disable-flac], [Disable support for FLAC files (default=auto)])])
158
159AC_ARG_ENABLE([mp4],
160              [AS_HELP_STRING([--disable-mp4], [Disable support for MP4 files (default=auto)])])
161
162AC_ARG_ENABLE([wavpack],
163              [AS_HELP_STRING([--disable-wavpack], [Disable support for Wavpack files (default=auto)])])
164
165AC_ARG_ENABLE([nautilus_actions],
166              [AS_HELP_STRING([--disable-nautilus-actions], [do not build the nautilus context menu actions (default=auto)])])
167
168
169
170dnl -------------------------------
171dnl Checks for libraries.
172dnl -------------------------------
173
174dnl Patch from Ben Taylor to fix a Solaris bug (for CDDB)
175AC_CHECK_LIB([socket], [recv])
176
177
178dnl ################################################
179dnl # Ogg Vorbis libraries
180dnl ################################################
181
182OGG_DEPS="ogg >= 1.0 vorbis >= 1.0.1 vorbisfile"
183AS_IF([test "x$enable_ogg" != "xno"],
184      [PKG_CHECK_EXISTS([$OGG_DEPS], [have_ogg=yes], [have_ogg=no])],
185      [have_ogg=no])
186
187AS_IF([test "x$have_ogg" != "xno"],
188      [AC_DEFINE([ENABLE_OGG], [], [Define for Ogg Vorbis support])],
189      [OGG_DEPS=""
190       AS_IF([test "x$enable_ogg" = "xyes"],
191             [AC_MSG_ERROR([OGG Vorbis support requested but required dependencies ($OGG_DEPS) not found])])])
192
193dnl ################################################
194dnl # Opus libraries
195dnl ################################################
196
197OPUS_DEPS="opus >= 1.0 opusfile"
198AS_IF([test "x$enable_opus" != "xno"],
199      [PKG_CHECK_EXISTS([$OPUS_DEPS], [have_opus=yes], [have_opus=no])],
200      [have_opus=no])
201
202AS_IF([test "x$have_opus" != "xno"],
203      [AS_IF([test "x$have_ogg" = "xno"],
204             [AC_MSG_ERROR([Opus support requested but Ogg support disabled. Ogg support is required.])])
205       AC_DEFINE([ENABLE_OPUS], [], [Define for Ogg Opus support])],
206      [OPUS_DEPS=""
207       AS_IF([test "x$enable_opus" = "xyes"],
208             [AC_MSG_ERROR([Opus support requested but required dependencies ($OPUS_DEPS) not found])])])
209
210dnl ################################################
211dnl # libSpeex library
212dnl ################################################
213
214SPEEX_DEPS="speex"
215AS_IF([test "x$enable_speex" != "xno"],
216      [PKG_CHECK_EXISTS([$SPEEX_DEPS], [have_speex=yes], [have_speex=no])],
217      [have_speex=no])
218
219AS_IF([test "x$have_speex" != "xno"],
220      [AS_IF([test "x$have_ogg" = "xno"],
221             [AC_MSG_ERROR([Speex support requested but Ogg support disabled. Ogg support is required.])])
222       AC_DEFINE([ENABLE_SPEEX], [], [Define for Speex support])],
223      [SPEEX_DEPS=""
224       AS_IF([test "x$enable_speex" = "xyes"],
225             [AC_MSG_ERROR([OGG Speex support requested but required dependencies ($SPEEX_DEPS) not found])])])
226
227dnl ################################################
228dnl # libFLAC library
229dnl ################################################
230
231FLAC_DEPS="flac >= 1.1.4"
232AS_IF([test "x$enable_flac" != "xno"],
233      [PKG_CHECK_EXISTS([$FLAC_DEPS], [have_flac=yes], [have_flac=no])],
234      [have_flac=no])
235
236AS_IF([test "x$have_flac" != "xno"],
237      [AC_DEFINE([ENABLE_FLAC], [], [Define for FLAC support])],
238      [FLAC_DEPS=""
239       AS_IF([test "x$enable_flac" = "xyes"],
240             [AC_MSG_ERROR([FLAC support requested but required dependencies ($FLAC_DEPS) not found])])])
241
242dnl ################################################
243dnl # libid3tag and Id3lib libraries
244dnl ################################################
245ID3TAG_DEPS="id3tag"
246AS_IF([test "x$enable_mp3" != "xno"],
247      [PKG_CHECK_EXISTS([$ID3TAG_DEPS], [have_mp3=yes], [have_mp3=no])],
248      [have_mp3=no])
249
250AS_IF([test "x$have_mp3" != "xno"],
251      [AC_DEFINE([ENABLE_MP3], [], [Define for MP3 support])],
252      [ID3TAG_DEPS=""
253       AS_IF([test "x$enable_mp3" = "xyes"],
254             [AC_MSG_ERROR([MP3 support requested but required dependencies ($ID3TAG_DEPS) not found])])])
255
256AS_IF([test "x$have_mp3" = "xyes" -a "x$enable_id3v23" != "xno"],
257      dnl Check which libs are required by id3lib, libid3.la is fucked up
258      [LIBS_SAVE="$LIBS"
259       AC_SEARCH_LIBS([ID3Tag_Link], ["id3" "id3 -lstdc++" "id3 -lz" "id3 -lz -lstdc++"], [have_id3lib=yes], [have_id3lib=no])
260
261       dnl expected version for cross compiling
262       ID3LIB_MAJOR=3
263       ID3LIB_MINOR=8
264       ID3LIB_PATCH=0
265
266       AC_MSG_CHECKING([the id3lib version])
267       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
268#include <id3.h>
269#include <stdio.h>
270]],                                   [[
271    FILE *output;
272    output=fopen("conftest.id3","w");
273    fprintf(output,"ID3LIB_MAJOR=%d\nID3LIB_MINOR=%d\nID3LIB_PATCH=%d\n",ID3LIB_MAJOR_VERSION,ID3LIB_MINOR_VERSION,ID3LIB_PATCH_VERSION);
274    fclose(output);
275    return 0;
276]])], [. ./conftest.id3; AC_MSG_RESULT([${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH}])], [AC_MSG_ERROR([could not determine id3lib version])], [echo $ac_n "cross compiling; assuming ${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH} $ac_c"])
277       LIBS="$LIBS_SAVE"
278       AC_DEFINE_UNQUOTED([ID3LIB_MAJOR], [$ID3LIB_MAJOR], [id3lib major version])
279       AC_DEFINE_UNQUOTED([ID3LIB_MINOR], [$ID3LIB_MINOR], [id3lib minor version])
280       AC_DEFINE_UNQUOTED([ID3LIB_PATCH], [$ID3LIB_PATCH], [id3lib patch level])
281
282       AC_SUBST([ID3LIB_LIBS], [$ac_cv_search_ID3Tag_Link])
283       AC_DEFINE([ENABLE_ID3LIB], [], [Define for ID3v2.3 support])
284       ID3LIB_VERSION="(id3lib-$ID3LIB_MAJOR.$ID3LIB_MINOR.$ID3LIB_PATCH)"
285       AC_CHECK_DECLS([ID3Field_SetEncoding,
286                       ID3Field_GetEncoding,
287                       ID3Field_IsEncodable],
288                       [], [],
289                      [[#include <id3.h>]])],
290      [have_id3lib=no])
291
292
293dnl ################################################
294dnl # taglib library
295dnl ################################################
296
297TAGLIB_DEPS="taglib >= 1.9.1"
298AS_IF([test "x$enable_mp4" != "xno"],
299      [PKG_CHECK_EXISTS([$TAGLIB_DEPS], [have_taglib=yes], [have_taglib=no])],
300      [have_taglib=no])
301
302AS_IF([test "x$have_taglib" != "xno"],
303      [AC_DEFINE([ENABLE_MP4], [], [Define for taglib MP4 support])],
304      [TAGLIB_DEPS=""
305       AS_IF([test "x$enable_mp4" = "xyes"],
306             [AC_MSG_ERROR([Taglib MP4 support requested but required dependencies ($TAGLIB_DEPS) not found])])])
307
308dnl ################################################
309dnl # WavPack library
310dnl ################################################
311WAVPACK_DEPS="wavpack >= 4.40"
312AS_IF([test "x$enable_wavpack" != "xno"],
313      [PKG_CHECK_EXISTS([$WAVPACK_DEPS], [have_wavpack=yes], [have_wavpack=no])],
314      [have_wavpack=no])
315
316AS_IF([test "x$have_wavpack" != "xno"],
317      [AC_DEFINE([ENABLE_WAVPACK], [], [Define for Wavpack support])],
318      [WAVPACK_DEPS=""
319       AS_IF([test "x$enable_wavpack" = "xyes"],
320             [AC_MSG_ERROR([Wavpack support requested but required dependencies ($WAVPACK_DEPS) not found])])])
321
322dnl ################################################
323dnl # Nautilus
324dnl ################################################
325NAUTILUS_DEPS="libnautilus-extension >= 3.0 gio-unix-2.0"
326AS_IF([test "x$enable_nautilus_actions" != "xno"],
327      [PKG_CHECK_EXISTS([$NAUTILUS_DEPS], [have_libnautilus_extension=yes], [have_libnautilus_extension=no])],
328      [have_libnautilus_extension=no])
329
330AS_IF([test "x$have_libnautilus_extension" = "xno"],
331      [NAUTILUS_DEPS=""
332       AS_IF([test "x$enable_nautilus_actions" = "xyes"],
333             [AC_MSG_ERROR([Nautilus Actions build requested but required dependencies ($NAUTILUS_DEPS) not found])])],
334      [PKG_CHECK_MODULES([NAUTILUS], [$NAUTILUS_DEPS])
335       NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
336       AC_SUBST([NAUTILUS_EXTENSION_DIR], [$NAUTILUS_EXTENSION_DIR])])
337
338AM_CONDITIONAL([ENABLE_NAUTILUS_ACTIONS], [test x"$have_libnautilus_extension" != x"no"])
339
340dnl Check the pkg-config dependencies
341GIO_DEPS="gio-2.0 >= 2.38.0"
342AC_SUBST([GLIB_DEPRECATION_FLAGS],
343         ["-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38"])
344GTK_DEPS="gtk+-3.0 >= 3.10.0"
345AC_SUBST([GTK_DEPRECATION_FLAGS],
346         ["-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_10 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_10"])
347PKG_CHECK_MODULES([EASYTAG], [$GIO_DEPS $GTK_DEPS $OPUS_DEPS $OGG_DEPS $SPEEX_DEPS $FLAC_DEPS $ID3TAG_DEPS $TAGLIB_DEPS $WAVPACK_DEPS])
348
349dnl Check for winsock
350AC_SEARCH_LIBS([gethostbyname], [nsl socket], [],
351    [saved_LIBS=$LIBS
352     LIBS="-lws2_32 $LIBS"
353     AC_MSG_CHECKING([for gethostbyname in ws2_32])
354     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
355        [[gethostbyname ("");]])],
356        [have_ws2=yes], [have_ws2=no LIBS=$saved_LIBS])
357     AC_MSG_RESULT([$have_ws2])])
358
359dnl Set warning flags
360AX_IS_RELEASE([git-directory])
361AX_COMPILER_FLAGS([WARN_CFLAGS], [WARN_LDFLAGS],
362                  [$ax_is_release])
363
364GLIB_GSETTINGS
365
366AC_CONFIG_FILES([ Makefile
367                  doc/version.xml
368                  help/Makefile
369                  po/Makefile.in
370                  src/win32/easytag.rc
371               ])
372AC_OUTPUT
373
374echo
375echo Configuration for $PACKAGE_NAME $PACKAGE_VERSION :
376echo --------------------------------
377echo
378echo Source code location ....: $srcdir
379echo Host System Type ........: $host
380echo Preprocessor ............: $CC $CPPFLAGS
381echo Compiler ................: $CC $CFLAGS
382echo Compiler warnings .......: $WARN_CFLAGS
383echo C++ Compiler warnings ...: $WARN_CXXFLAGS
384echo Linker ..................: $CC $LDFLAGS $LIBS
385echo MP3 file support ........: $have_mp3
386echo ID3v2.3 tags support ....: $have_id3lib $ID3LIB_VERSION
387echo Ogg Vorbis file support .: $have_ogg
388echo Ogg Speex file support ..: $have_speex
389echo Ogg Opus file support ...: $have_opus
390echo FLAC file support .......: $have_flac
391echo MP4 file support ........: $have_taglib
392echo WavPack support .........: $have_wavpack
393echo NLS/gettext .............: $USE_NLS
394echo Nautilus actions ........: $have_libnautilus_extension
395echo Tests during make check .: $testing_utilities
396echo Install prefix ..........: $prefix
397echo
398echo Now type 'make' to build $PACKAGE_NAME $PACKAGE_VERSION,
399echo and then 'make install' for installation.
400echo
401