aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure.in
blob: 369af50ef1d024534e98ec7ae164b0364ba6635e (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
dnl Process this file with autoconf to produce a configure script.
dnl AC_INIT(src/easytag.h)

AC_PREREQ(2.53)

dnl To set also in config.h.mingw
AC_INIT(easytag, 2.1.6) dnl defines ($PACKAGE, $VERSION)

AC_CONFIG_SRCDIR(src/easytag.h)
AC_CONFIG_MACRO_DIR([m4])
dnl -------------------------------
dnl Init automake
dnl -------------------------------
AM_INIT_AUTOMAKE(foreign)

dnl -------------------------------
dnl Translation files
dnl -------------------------------
ALL_LINGUAS="bg cs da de el es fr he hu it ja nl pl pt_BR ro ru sr sr@Latn sv uk zh_CN zh_TW"
GETTEXT_PACKAGE=easytag
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])

dnl -------------------------------
dnl Checks for programs.
dnl -------------------------------
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_ISC_POSIX
AM_MAINTAINER_MODE

dnl -------------------------
dnl Handle mingw32 or cygwin
dnl -------------------------
AC_MINGW32
AC_CYGWIN

dnl -------------------------------
dnl Configure switches.
dnl -------------------------------
AC_ARG_ENABLE(mp3,
              AC_HELP_STRING([--disable-mp3], [Disable support for MP3 files (default=enabled)]),
              , enable_mp3=yes)

AC_ARG_ENABLE(id3v23,
              AC_HELP_STRING([--disable-id3v23], [Disable support for writing id3v2.3 tags (default=enabled)]),
              , enable_id3v23=yes)

AC_ARG_ENABLE(ogg,
              AC_HELP_STRING([--disable-ogg], [Disable support for Ogg Vorbis files (default=enabled)]),
              , enable_ogg=yes)

AC_ARG_ENABLE(speex,
              AC_HELP_STRING([--disable-speex], [Disable support for Ogg Speex files (default=enabled)]),
              , enable_speex=yes)

AC_ARG_ENABLE(flac,
              AC_HELP_STRING([--disable-flac],[Disable support for FLAC files (default=enabled)]),
              , enable_flac=yes)

AC_ARG_ENABLE(mp4,
              AC_HELP_STRING([--disable-mp4],[Disable support for MP4 files (default=enabled)]),
              , enable_mp4=yes)

AC_ARG_ENABLE(wavpack,
              AC_HELP_STRING([--disable-wavpack],[Disable support for Wavpack files (default=enabled)]),
              , enable_wavpack=yes)


dnl -------------------------------
dnl Checks for libraries.
dnl -------------------------------

dnl GTK+-2 libraries
AM_PATH_GLIB_2_0(2.8.0,, AC_MSG_ERROR([*** GLIB >= 2.8.0 not installed! ***]))
AM_PATH_GTK_2_0(2.12.0,, AC_MSG_ERROR([*** GTK >= 2.12.0 not installed! ***]))
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.12.0 glib-2.0 >= 2.8.0)


dnl Patch from Ben Taylor to fix a Solaris bug (for CDDB)
AC_CHECK_LIB(socket, recv)


dnl ################################################
dnl # Ogg Vorbis librairies (rq : needed also for libFLAC)
dnl ################################################
dnl XIPH_PATH_OGG(enable_ogg="yes",enable_ogg="no")

if test "x$enable_ogg" = "xyes" -o "x$enable_flac" = "xyes"; then
    PKG_CHECK_MODULES(OGG, ogg >= 1.0, , ogg_available=no)
    if test "x$ogg_available" = "xno"; then
        echo "***"
        echo "*** Warning: libogg >= 1.0 needed"
        echo "***"
    fi
    PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, , ogg_available=no)
    if test "x$ogg_available" = "xno"; then
        echo "***"
        echo "*** Warning: libvorbis >= 1.0.1 needed"
        echo "***"
    fi
    AC_CHECK_LIB(m, cos) dnl Patch from Christian Weisgerber
    AC_CHECK_LIB(ogg, ogg_sync_init, , ogg_available=no)
    AC_CHECK_LIB(vorbis, vorbis_comment_init, , ogg_available=no)
    AC_CHECK_LIB(vorbisfile, ov_open, , ogg_available=no)
fi

AC_MSG_CHECKING(for Ogg Vorbis file support)
if test "x$enable_ogg" = "xyes"; then
    if test "x$ogg_available" = "xno"; then
        AC_MSG_RESULT(no)
        enable_ogg="no"
        echo "***"
        echo "*** Warning: Ogg Vorbis file support disabled"
        echo "*** (Install libogg and libvorbis libraries to enable it)"
        echo "***"
    else
        AC_MSG_RESULT(yes)
        AC_DEFINE(ENABLE_OGG,1,[Define for Ogg Vorbis support])
    fi
else
    echo "***"
    echo "*** Ogg Vorbis file support disabled on commandline"
    echo "*** (Install libogg and libvorbis libraries, and use --enable-ogg to enable it)"
    echo "***"
fi


dnl ################################################
dnl # libSpeex library
dnl ################################################
dnl check for system libspeex
dnl Note that libvorbis is required for speex support, even if the user chooses --disable-speex

if test "x$enable_speex" = "xyes"; then
    dnl Library required for speex files, if not found 'enable_speex' is disabled
    AC_CHECK_LIB(m, cos) dnl Patch from Christian Weisgerber
    AC_CHECK_LIB(speex, speex_packet_to_header, , speex_available=no)

    AC_MSG_CHECKING(for Speex file support)
    if test "x$speex_available" = "xno"; then
        AC_MSG_RESULT(no)
        enable_speex="no"
        echo "***"
        echo "*** Warning: Speex file support disabled, speex missing"
        echo "*** (Install speex, libogg and libvorbis libraries to enable it)"
        echo "***"
    elif test "x$enable_ogg" = "xno"; then
        AC_MSG_RESULT(no)
        enable_speex="no"
        echo "***"
        echo "*** Warning: Speex file support disabled, libvorbis missing"
        echo "*** (Install speex, libogg and libvorbis libraries to enable it)"
        echo "***"
    else
        AC_MSG_RESULT(yes)
        AC_DEFINE(ENABLE_SPEEX,1,[Define for Speex support])
    fi
else
    AC_MSG_CHECKING(for Speex file support)
    AC_MSG_RESULT(no)
    echo "***"
    echo "*** Speex file support disabled on commandline"
    echo "*** (Install speex, libogg and libvorbis libraries, and use --enable-speex to enable it)"
    echo "***"
fi


dnl ################################################
dnl # libFLAC library
dnl ################################################
dnl check for system libflac
dnl Note that libvorbis is required for flac support, even if the user chooses --disable-ogg

if test "x$enable_flac" = "xyes"; then
    dnl Library required for flac files, if not found 'enable_flac' is disabled
    AC_CHECK_LIB(m, cos) dnl Patch from Christian Weisgerber
    AC_CHECK_LIB(FLAC, FLAC__metadata_simple_iterator_new, , flac_available=no)

    AC_MSG_CHECKING(for FLAC file support)
    if test "x$flac_available" = "xno"; then
        AC_MSG_RESULT(no)
        enable_flac="no"
        echo "***"
        echo "*** Warning: FLAC file support disabled, libflac missing"
        echo "*** (Install libflac, libogg and libvorbis libraries to enable it)"
        echo "***"
    elif test "x$ogg_available" = "xno"; then
        AC_MSG_RESULT(no)
        enable_flac="no"
        echo "***"
        echo "*** Warning: FLAC file support disabled, libvorbis missing"
        echo "*** (Install libflac, libogg and libvorbis libraries to enable it)"
        echo "***"
    else
        AC_MSG_RESULT(yes)
        AC_DEFINE(ENABLE_FLAC,1,[Define for FLAC support])
    fi
else
    AC_MSG_CHECKING(for FLAC file support)
    AC_MSG_RESULT(no)
    echo "***"
    echo "*** FLAC file support disabled on commandline"
    echo "*** (Install libflac, libogg and libvorbis libraries, and use --enable-flac to enable it)"
    echo "***"
fi

dnl Check version of libFLAC installed
dnl version of libFLAC must be at least 1.1.0
if test "x$enable_flac" = "xyes"; then
    LIBS_SAVE="$LIBS"
    CFLAGS_SAVE="$CFLAGS"
    LIBS="$LIBS $LIBFLAC_LIBS"
    CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
    AC_MSG_CHECKING(for libFLAC version)
        AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <FLAC/format.h>
int 
main (void)
{
    FILE *output;
    char tmp[16];
    int libflac_major, libflac_minor, libflac_patch;

    sprintf(tmp,"%s",FLAC__VERSION_STRING);
    libflac_major = atoi( (char *)strtok(tmp,".") );
    libflac_minor = atoi( (char *)strtok(NULL,".") );
    libflac_patch = atoi( (char *)strtok(NULL,".") );
    output=fopen("conftest.flac","w");
    fprintf(output,"LIBFLAC_MAJOR=%d\nLIBFLAC_MINOR=%d\nLIBFLAC_PATCH=%d\n",libflac_major,libflac_minor,libflac_patch);
    fclose(output);
    exit(0);
}
], . ./conftest.flac; echo "${LIBFLAC_MAJOR}.${LIBFLAC_MINOR}.${LIBFLAC_PATCH}", AC_MSG_WARN(could not determine libFLAC version),[echo $ac_n "cross compiling; assuming ${LIBFLAC_MAJOR}.${LIBFLAC_MINOR}.${LIBFLAC_PATCH} $ac_c"])
    LIBS="$LIBS_SAVE"
    CFLAGS="$CFLAGS_SAVE"
    LIBFLAC_VERSION="(flac-$LIBFLAC_MAJOR.$LIBFLAC_MINOR.$LIBFLAC_PATCH)"
fi
AC_DEFINE_UNQUOTED(LIBFLAC_MAJOR, $LIBFLAC_MAJOR, [libflac major version])
AC_DEFINE_UNQUOTED(LIBFLAC_MINOR, $LIBFLAC_MINOR, [libflac minor version])
AC_DEFINE_UNQUOTED(LIBFLAC_PATCH, $LIBFLAC_PATCH, [libflac patch version])


dnl ################################################
dnl # libid3tag and Id3lib libraries
dnl ################################################
if test "x$enable_mp3" = "xyes"; then
    AC_MSG_CHECKING(for MP3 file support)
    AC_CHECK_HEADER(id3tag.h, [], [libid3tag_available=no])
    AC_CHECK_LIB(id3tag, id3_frame_field, [], [libid3tag_available=no], [-lz])
    if test "x$libid3tag_available" = "xno"; then
        AC_MSG_RESULT(no)
        enable_mp3="no"
        echo "***"
        echo "*** Warning: MP3 file support disabled, libid3tag missing"
        echo "***"
    else
        AC_MSG_RESULT(yes)
        AC_DEFINE(ENABLE_MP3,1,[Define for MP3 support])
    fi

    if test "x$enable_id3v23" = "xyes"; then
        dnl Check which libs are required by id3lib, libid3.la is fucked up
        AC_SEARCH_LIBS(ID3Tag_Link,"id3" "id3 -lstdc++" "id3 -lz" "id3 -lz -lstdc++",,AC_MSG_WARN(id3lib not found); id3lib_available=no)
         
        dnl Needed to link correctly with id3lib 3.8.0
        LIBS="-lz -lstdc++ $LIBS"
        dnl AC_CHECK_LIB(z,uncompress,AC_DEFINE_UNQUOTED(HAVE_ZLIB))
        
        dnl expected version for cross compiling
        ID3LIB_MAJOR=3
        ID3LIB_MINOR=8
        ID3LIB_PATCH=0
        
        AC_MSG_CHECKING(for id3lib version)
              AC_TRY_RUN([
        #include <id3.h>
        #include <stdio.h>
        int main ()
        {
            FILE *output;
            output=fopen("conftest.id3","w");
            fprintf(output,"ID3LIB_MAJOR=%d\nID3LIB_MINOR=%d\nID3LIB_PATCH=%d\n",ID3LIB_MAJOR_VERSION,ID3LIB_MINOR_VERSION,ID3LIB_PATCH_VERSION);
            fclose(output);
            exit(0);
        }
        ], . ./conftest.id3; echo "${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH}", AC_MSG_WARN(could not determine id3lib version); id3lib_available=no,[echo $ac_n "cross compiling; assuming ${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH} $ac_c"])
        AC_DEFINE_UNQUOTED(ID3LIB_MAJOR, $ID3LIB_MAJOR, [id3lib major version])
        AC_DEFINE_UNQUOTED(ID3LIB_MINOR, $ID3LIB_MINOR, [id3lib minor version])
        AC_DEFINE_UNQUOTED(ID3LIB_PATCH, $ID3LIB_PATCH, [id3lib patch level])
        
        AC_MSG_CHECKING(for MP3 file support)
        if test "x$id3lib_available" = "xno"; then
            AC_MSG_RESULT(no)
            echo "***"
            echo "*** Warning: id3v23 tags support disabled, id3lib missing"
            echo "***"
        else
            AC_MSG_RESULT(yes)
            AC_DEFINE(ENABLE_ID3LIB,1,[Define for id3v23 support])
            ID3LIB_VERSION="(id3lib-$ID3LIB_MAJOR.$ID3LIB_MINOR.$ID3LIB_PATCH)"
        fi
    fi
fi


dnl ################################################
dnl # libmp4v2 library
dnl ################################################
if test "x$enable_mp4" = "xyes"; then
    dnl Librairies required for mp4 files, if not found 'enable_mp4' is disabled
    AC_MSG_CHECKING(for MP4 file support)
    AC_CHECK_HEADER(mp4v2/mp4v2.h, [], [mp4_available=no])
    AC_CHECK_LIB(mp4v2, MP4GetTrackMediaDataName, [], [mp4_available=no], [-lmp4v2])
fi

AC_MSG_CHECKING(for MP4/AAC file support)
if test "x$enable_mp4" = "xyes"; then
    if test "x$mp4_available" = "xno"; then
        AC_MSG_RESULT(no)
        enable_mp4="no"
        echo "***"
        echo "*** Warning: MP4 file support disabled"
        echo "*** (Install libmp4v2 >= 1.9.0 to enable it)"
        echo "***"
    else

        dnl Check version of mp4v2 installed
        LIBS_SAVE="$LIBS"
        CFLAGS_SAVE="$CFLAGS"
        LIBS="$LIBS $LIBMP4V2_LIBS"
        CFLAGS="$CFLAGS $LIBMP4V2_CFLAGS"
        AC_MSG_CHECKING(for libmp4v2 version)
            AC_TRY_RUN([
                #include <stdio.h>
                #include <mp4v2/mp4v2.h>
                int main (void)
                {
                    FILE *output;
                    output=fopen("conftest.mp4v2","w");
                    fprintf(output,"MP4V2_PROJECT_name=%s\nMP4V2_PROJECT_version=%s\n",PACKAGE_TARNAME,PACKAGE_VERSION);
                    fclose(output);
                    exit(0);
                }
            ], . ./conftest.mp4v2; echo "${LIBMP4V2_NAME}-${LIBMP4V2_VERSION}", AC_MSG_WARN(could not determine libmp4v2 version),[echo $ac_n "cross compiling; assuming ${LIBMP4V2_NAME}-${LIBMP4V2_VERSION} $ac_c"])
        LIBS="$LIBS_SAVE"
        CFLAGS="$CFLAGS_SAVE"
        if test "$LIBMP4V2_VERSION" != ""; then
            LIBMP4V2_VERSION="($LIBMP4V2_NAME-$LIBMP4V2_VERSION)"
        fi

        dnl Version 1.6 of libmp4v2 introduces an index argument for MP4GetMetadataCoverart. So we define 'NEWMP4' if it is the case
        AC_COMPILE_IFELSE([
           #include <mp4v2/mp4v2.h>
           main () {
           MP4FileHandle hFile;
           MP4GetMetadataCoverArt(hFile, NULL, NULL,0); }
        ], AC_DEFINE(NEWMP4,1,[Define for MP4 lib with multiple image support]),)

        AC_MSG_RESULT(yes)
        AC_DEFINE(ENABLE_MP4,1,[Define for MP4 support])
    fi
else
    AC_MSG_RESULT(no)
    enable_mp4="no"
    echo "***"
    echo "*** MP4 file support disabled on commandline"
    echo "*** (Install libmp4v2 and use --enable-mp4 to enable it)"
    echo "***"
fi


dnl ################################################
dnl # WavPack library
dnl ################################################
if test "x$enable_wavpack" = "xyes"; then
    dnl Librairies required for wavpack files, if not found 'enable_wavpack' is disabled
    PKG_CHECK_MODULES(WAVPACK, wavpack >= 4.40, , wavpack_available=no)
    if test "x$wavpack_available" = "xno"; then
        echo "***"
        echo "*** Warning: wavpack >= 4.40 needed"
        echo "***"
    fi
    AC_CHECK_LIB(m, cos)
    AC_CHECK_LIB(wavpack, WavpackOpenFileInput, , wavpack_available=no)
fi

AC_MSG_CHECKING(for Wavpack file support)
if test "x$enable_wavpack" = "xyes"; then
    if test "x$wavpack_available" = "xno"; then
        AC_MSG_RESULT(no)
        enable_wavpack="no"
        echo "***"
        echo "*** Warning: Wavpack file support disabled"
        echo "*** (Install libwavpack to enable it)"
        echo "***"
    else
        AC_MSG_RESULT(yes)
        AC_DEFINE(ENABLE_WAVPACK,1,[Define for Wavpack support])
    fi
else
    AC_MSG_RESULT(no)
    enable_wavpack="no"
    echo "***"
    echo "*** Wavpack file support disabled on commandline"
    echo "*** (Install libwavpack, and use --enable-wavpack to enable it)"
    echo "***"
fi

dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])

dnl To enable 'gprof' profiling
dnl CFLAGS="$CFLAGS -pg"


dnl -------------------------------
dnl Checks for header files.
dnl -------------------------------
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h)


dnl -------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl -------------------------------
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM


dnl -------------------------------
dnl Checks for library functions.
dnl -------------------------------
AC_FUNC_FORK
AC_FUNC_STAT
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(mkdir strstr strtol mkstemp)


dnl -------------------------------
dnl check for NLS
dnl -------------------------------
AM_GLIB_GNU_GETTEXT
dnl AM_GNU_GETTEXT_VERSION(0.10.40)


dnl -------------------------------
dnl config header
dnl -------------------------------
AM_CONFIG_HEADER(config.h)


AC_OUTPUT([ Makefile
            easytag.spec
            doc/easytag.1
            src/Makefile
            src/id3lib/Makefile
            src/libapetag/Makefile
            src/libmpg123/Makefile
            po/Makefile.in
         ])

echo 
echo Configuration for $PACKAGE $VERSION :
echo --------------------------------
echo 
echo Source code location ....: $srcdir
echo Host System Type ........: $host
echo Preprocessor ............: $CC $CPPFLAGS
echo Compiler ................: $CC $CFLAGS
echo Linker ..................: $CC $LDFLAGS $LIBS
echo GTK2 version ............: `pkg-config --modversion gtk+-2.0`
echo MP3 file support ........: $enable_mp3
echo ID3v2.3 tags support ....: $enable_id3v23 $ID3LIB_VERSION
echo Ogg Vorbis file support .: $enable_ogg
echo Speex file support ......: $enable_speex
echo FLAC file support .......: $enable_flac $LIBFLAC_VERSION
echo MP4 file support ........: $enable_mp4 $LIBMP4V2_VERSION
echo WavPack support .........: $enable_wavpack
echo NLS/gettext .............: $USE_NLS
echo Install path ............: $prefix
echo 
echo Now type 'make' to build $PACKAGE $VERSION,
echo and then 'make install' for installation.
echo