-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
163 lines (131 loc) · 3.43 KB
/
configure.ac
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
AC_INIT(TagReport, [0.3])
AC_CONFIG_HEADER([config.h])
dnl Variable initialization
no_getopt_long=0
use_FLAC=0
use_OGG=0
use_ID3=0
use_TAGLIB=0
AC_PROG_CXXCPP
AC_LANG(C++)
if test "$ac_cv_cxx_compiler_gnu" = yes; then
CXXFLAGS="$CXXFLAGS -Wall -W $INCLUDES"
fi
LEX_LANG=CXX
YACC_LANG=CXX
AC_PROG_LEX
AC_PROG_YACC
AC_PROG_INSTALL
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [Enable debugging messages in TagReport.]),
[debug="$enableval"], [debug=no])
if test "$debug" = yes; then
DEBUG=""
else
DEBUG="-DNDEBUG"
fi
AC_SUBST(DEBUG)
AC_CHECK_PROG(TAGLIB_CONFIG, taglib-config, yes)
if test "$ac_cv_prog_TAGLIB_CONFIG" = yes; then
AC_MSG_CHECKING(for TagLib compiler flags)
if ! test "`taglib-config --cflags`" = "-I/usr/local/include"; then
TAGLIB_INCLUDE="`taglib-config --cflags`"
AC_MSG_RESULT($TAGLIB_INCLUDE)
else
AC_MSG_RESULT(not needed)
fi
AC_MSG_CHECKING(for TagLib linker flags)
if ! test "`taglib-config --libs`" = "-L/usr/local/lib"; then
TAGLIB_LD="`taglib-config --libs`"
AC_MSG_RESULT($TAGLIB_LD)
else
AC_MSG_RESULT(not needed)
fi
AC_DEFINE(USE_TAGLIB, 1, [TagLib support works.])
use_TAGLIB=1
fi
AC_CHECK_PROGS(DOCBOOK, docbook-to-man, [:])
AC_CHECK_HEADER([FLAC/metadata.h],
[
AC_CHECK_LIB([FLAC], FLAC__metadata_simple_iterator_new,
[
AC_DEFINE(USE_FLAC, 1, [FLAC support works. Don't change!])
BLIBS="$BLIBS -lFLAC"
use_FLAC=1
])
])
AC_CHECK_HEADER(vorbis/codec.h,
[
AC_CHECK_HEADER(vorbis/vorbisfile.h,
[
AC_CHECK_LIB(vorbisfile, ov_open,
[
AC_DEFINE(USE_OGG, 1, [Ogg Vorbis support works.])
dnl Really, it's the user's problem if they have libvorbisfile
dnl and not libvorbis and libogg too.
BLIBS="$BLIBS -lvorbisfile -lvorbis -logg"
use_OGG=1
], , [-lvorbis -logg])
])
])
AC_CHECK_HEADER(id3tag.h,
[
AC_CHECK_LIB(id3tag, id3_file_tag,
[
dnl Older versions don't have this.
AC_CHECK_LIB(id3tag, id3_frame_field,
[
AC_DEFINE(USE_ID3TAG, 1, [MAD ID3tag support works.])
BLIBS="$BLIBS -lid3tag -lz"
use_ID3=1
], , [-lz])
], , [-lz])
])
AC_CHECK_FUNC(getopt, [AC_DEFINE(HAVE_DECL_GETOPT, 1, [Needed for GNUgetopt headers to work on systems without a native getopt_long.])])
AC_SEARCH_LIBS(getopt_long, gnugetopt, , [no_getopt_long=1])
dnl We do this outside the command to allow SEARCH_LIBS to do its $LIBS
dnl thing
if test $no_getopt_long -eq 0; then
AC_DEFINE(HAVE_GETOPT_LONG, 1, [The getopt_long function is available.])
fi
AC_CHECK_HEADERS([getopt.h libiberty.h])
AC_SUBST(DOCBOOK)
if test $use_OGG -eq 1; then
yes_OGG="yes"
else
yes_OGG="no"
fi
if test $use_ID3 -eq 1; then
yes_ID3="yes"
else
yes_ID3="no"
fi
if test $use_TAGLIB -eq 1; then
yes_TAGLIB="yes"
else
yes_TAGLIB="no"
fi
if test $use_FLAC -eq 1; then
yes_FLAC="yes"
else
yes_FLAC="no"
fi
echo
echo "TagReport $PACKAGE_VERSION"
echo
echo "libflac support .............. $yes_FLAC"
echo "TagLib support ............... $yes_TAGLIB"
echo "libvorbisfile support ........ $yes_OGG"
echo "libid3tag support ............ $yes_ID3"
echo
if test $use_TAGLIB -eq 0 && test $use_OGG -eq 0 && test $use_ID3 -eq 0 && test $use_FLAC -eq 0; then
AC_MSG_ERROR([You need to install at least one of the following: taglib, libvorbisfile, id3tag, libflac.])
fi
AC_SUBST(TAGLIB_INCLUDE)
AC_SUBST(TAGLIB_LD)
AC_SUBST(TAGLIB_ROOT)
AC_SUBST(BLIBS)
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
echo
echo "Type make (or gmake) to begin the build."