-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure.in
543 lines (468 loc) · 15.1 KB
/
configure.in
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
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
dnl This can be moved into AC_INIT when AC_PREREQ reaches 2.64.
m4_define([AC_PACKAGE_URL],[http://moc.daper.net/])
AC_INIT([Music On Console],[2.5.0-beta1],[[email protected]],[moc])
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE
AC_PREREQ(2.60)
dnl This can be removed when AC_PREREQ reaches 2.64.
if test -z "$PACKAGE_URL"
then
AC_SUBST([PACKAGE_URL],['AC_PACKAGE_URL'])
AC_DEFINE_UNQUOTED([PACKAGE_URL], ["$PACKAGE_URL"],
[Define to the home page for this package.])
fi
dnl Capture configuration options for this build.
AC_DEFINE_UNQUOTED([CONFIGURATION], ["$ac_configure_args"],
[Define to the configuration used to build MOC.])
dnl Capture SVN revision number for this build.
AC_PATH_PROG(SVNVERSION, [svnversion])
if test -n "$SVNVERSION"
then
SVNREVN=`$SVNVERSION -n $srcdir`
SVNREVN=`expr "$SVNREVN" : '\([[^:]]*\)'`
if test "x$SVNREVN" = "xexported"
then
unset SVNREVN
else
echo -n $SVNREVN > REVISION
EXTRA_DISTS="$EXTRA_DISTS REVISION"
fi
fi
if test -z "$SVNREVN" && test -f $srcdir/REVISION
then
SVNREVN=`cat $srcdir/REVISION`
EXTRA_DISTS="$EXTRA_DISTS REVISION"
fi
if test -n "$SVNREVN"
then
AC_DEFINE_UNQUOTED([PACKAGE_REVISION], ["$SVNREVN"],
[The SVN revision of this build.])
fi
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_AWK
AC_LIBTOOL_DLOPEN
AC_DISABLE_STATIC
AC_ENABLE_SHARED
AC_PROG_LIBTOOL
AC_LIB_LTDL
AC_SUBST([EXTRA_OBJS])
plugindir=$libdir/moc
AC_SUBST([plugindir])
PLUGIN_LDFLAGS='-module -avoid-version'
AC_SUBST([PLUGIN_LDFLAGS])
OS=`uname 2>/dev/null`
case "$OS" in
Linux)
AC_DEFINE([LINUX], 1, [Define if your system is GNU/Linux])
;;
OpenBSD)
AC_DEFINE([OPENBSD], 1, [Define if your system is OpenBSD])
;;
esac
AC_DEFINE([_FILE_OFFSET_BITS], 64, [Use 64bit IO])
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([fcntl.h string.h strings.h sys/param.h unistd.h sys/un.h \
sys/socket.h sys/types.h signal.h sys/time.h \
sys/wait.h sys/ioctl.h pwd.h regex.h \
time.h errno.h sys/stat.h assert.h locale.h wchar.h],,
AC_MSG_ERROR([Can't find required header files.]))
AC_CHECK_HEADERS([sys/select.h inttypes.h limits.h stdint.h])
AC_CHECK_FUNCS([sched_get_priority_max])
dnl langinfo
AC_CHECK_HEADERS([langinfo.h])
AC_CHECK_HEADERS([nl_types.h])
AC_CHECK_FUNCS([nl_langinfo])
dnl CODESET (taken from vim)
AC_MSG_CHECKING(for nl_langinfo(CODESET))
AC_TRY_LINK([
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
], [char *cs = nl_langinfo(CODESET);],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_NL_LANGINFO_CODESET], 1,
[Define if you have CODESET constant]),
AC_MSG_RESULT(no))
AC_C_BIGENDIAN
dnl Require with iconv for charset translation.
AM_ICONV
if test "x$am_cv_func_iconv" != xyes; then
AC_MSG_ERROR([No iconv library found.])
fi
EXTRA_LIBS="$EXTRA_LIBS $LIBICONV"
dnl librcc
COMPILE_RCC=no
AC_ARG_WITH(rcc, AS_HELP_STRING([--without-rcc],
[Compile without LIBRCC support]))
if test "x$with_rcc" != "xno"
then
AC_CHECK_HEADERS([librcc.h],
[AC_DEFINE([HAVE_RCC], 1, [Define if you have librcc.h])
AC_CHECK_LIB(rcc, rccInit,
[RCC_LIBS="-lrcc"
AC_SUBST([RCC_LIBS])
COMPILE_RCC=yes])
])
fi
AC_C_CONST
AC_C_FLEXIBLE_ARRAY_MEMBER
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(void *)
AC_C99_FUNC_LRINTF
AX_CFLAGS_GCC_OPTION(-Wall)
AX_CFLAGS_GCC_OPTION(-W)
PKG_PROG_PKG_CONFIG([0.20])
if test "x$PKG_CONFIG" = "x"
then
AC_MSG_WARN([No pkg-config utility found or it's too old, I will have trouble finding installed libraries.])
fi
PKG_CHECK_MODULES(GIO, gio-2.0)
EXTRA_LIBS="$EXTRA_LIBS $GIO_LIBS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $GIO_CFLAGS"
PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0)
EXTRA_LIBS="$EXTRA_LIBS $GIO_UNIX_LIBS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $GIO_UNIX_CFLAGS"
AC_ARG_ENABLE(cache, AS_HELP_STRING([--enable-cache],
[Enable tags caching code]))
if test "x$enable_cache" != "xno"
then
AX_PATH_BDB([4.1], [], [BDB4_DEPRECATED="yes"])
AX_PATH_BDB([4], [
LIBS="$BDB_LIBS $EXTRA_LIBS"
LDFLAGS="$BDB_LDFLAGS $LDFLAGS"
CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS"
],
AC_MSG_ERROR([BerkeleyDB (libdb) not found.]))
fi
AC_ARG_WITH(oss, AS_HELP_STRING([--without-oss],
[Compile without OSS support]))
if test "x$with_oss" != "xno"
then
OSSLIBDIR="$with_oss"
if test "x$with_oss" = "x" || test "x$with_oss" = "xyes"
then
OSSLIBDIR="/usr/lib/oss"
if test -f "/etc/oss.conf"
then
. /etc/oss.conf
fi
fi
if test -d "$OSSLIBDIR/include"
then
OSS_CFLAGS="-I$OSSLIBDIR/include"
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $OSS_CFLAGS"
AC_CHECK_HEADERS([sys/soundcard.h soundcard.h])
CPPFLAGS="$save_CPPFLAGS"
if test "$ac_cv_header_sys_soundcard_h" = "yes" -o \
"$ac_cv_header_soundcard_h" = "yes"
then
AC_DEFINE([HAVE_OSS], 1, [Define if you have OSS.])
EXTRA_OBJS="$EXTRA_OBJS oss.o"
CFLAGS="$CFLAGS $OSS_CFLAGS"
SOUND_DRIVERS="$SOUND_DRIVERS OSS"
AC_CHECK_LIB([ossaudio], [_oss_ioctl],
[EXTRA_LIBS="$EXTRA_LIBS -lossaudio"])
fi
fi
AC_ARG_WITH(sndio, AS_HELP_STRING([--without-sndio],
[Compile without SNDIO support]))
if test "x$with_sndio" != "xno"
then
AC_CHECK_HEADERS([sndio.h])
if test "$ac_cv_header_sndio_h" = "yes"
then
AC_DEFINE([HAVE_SNDIO], 1, [Define if you have SNDIO.])
EXTRA_OBJS="$EXTRA_OBJS sndio_out.o"
SOUND_DRIVERS="$SOUND_DRIVERS SNDIO"
AC_CHECK_LIB([sndio], [sio_open],
[EXTRA_LIBS="$EXTRA_LIBS -lsndio"])
fi
fi
AC_ARG_WITH(alsa, AS_HELP_STRING([--without-alsa],
[Compile without ALSA support]))
if test "x$with_alsa" != "xno"
then
PKG_CHECK_MODULES(ALSA, [alsa >= 0.9],
[SOUND_DRIVERS="$SOUND_DRIVERS ALSA"
EXTRA_OBJS="$EXTRA_OBJS alsa.o"
AC_DEFINE([HAVE_ALSA], 1, [Define if you have ALSA.])
EXTRA_LIBS="$EXTRA_LIBS $ALSA_LIBS"
CFLAGS="$CFLAGS $ALSA_CFLAGS"],
[true])
fi
AC_ARG_WITH(jack, AS_HELP_STRING([--without-jack],
[Compile without JACK support]))
if test "x$with_jack" != "xno"
then
PKG_CHECK_MODULES(JACK, [jack >= 0.4],
[SOUND_DRIVERS="$SOUND_DRIVERS JACK"
EXTRA_OBJS="$EXTRA_OBJS jack.o"
AC_DEFINE([HAVE_JACK], 1, [Define if you have JACK.])
EXTRA_LIBS="$EXTRA_LIBS $JACK_LIBS"
CFLAGS="$CFLAGS $JACK_CFLAGS"
AC_SEARCH_LIBS(jack_client_open, jack,
[AC_DEFINE([HAVE_JACK_CLIENT_OPEN], 1,
[Define to 1 if you have the `jack_client_open' function.])])],
[true])
fi
AC_SUBST([SOUNDDRIVER])
case "$host_os" in
openbsd*) SOUNDDRIVER="SNDIO:JACK:OSS";;
*) SOUNDDRIVER="JACK:ALSA:OSS";;
esac
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
[Enable debugging code]))
if test "x$enable_debug" = "xno"
then
AC_DEFINE([NDEBUG], 1, [Define if you don't want debugging code])
COMPILE_DEBUG='no'
else
if test "x$enable_debug" = "xgdb"
then
AX_CFLAGS_GCC_OPTION([-ggdb])
AX_CFLAGS_GCC_OPTION([-O0])
COMPILE_DEBUG='gdb'
fi
if test "x$ac_cv_cflags_gcc_option__ggdb" = "x"
then
AX_CFLAGS_GCC_OPTION([-g])
COMPILE_DEBUG='yes'
fi
EXTRA_OBJS="$EXTRA_OBJS null_out.o md5.o"
fi
AC_FUNC_MALLOC
AC_FUNC_STAT
AC_CHECK_FUNCS([getcwd memmove strcasecmp strdup strerror strncasecmp strchr \
strrchr socket gettimeofday getenv fork setsid kill bind listen \
accept time connect unlink send recv select strftime access freopen \
localtime_r mbsrtowcs mbstowcs execvp wcswidth strspn geteuid],,
AC_MSG_ERROR([Required standard C/UNIX functions are not present.]))
AC_CHECK_FUNC([sin], ,
[AC_CHECK_LIB([m], [sin], ,
AC_MSG_ERROR([No sin() function found.]))
EXTRA_LIBS="$EXTRA_LIBS -lm"])
AC_CHECK_FUNC([sinh], ,
[AC_CHECK_LIB([m], [sinh], ,
AC_MSG_ERROR([No sinh() function found.]))
EXTRA_LIBS="$EXTRA_LIBS -lm"])
dnl optional functions
AC_CHECK_FUNCS([strcasestr strerror_r syslog])
AX_CHECK_UNAME_SYSCALL
dnl MIME magic
AC_ARG_WITH(magic, AS_HELP_STRING([--without-magic],
[Compile without MIME magic support]))
COMPILE_MAGIC="no"
if test "x$with_magic" != "xno"
then
AC_CHECK_LIB(magic, magic_open,
[COMPILE_MAGIC="yes"
AC_DEFINE([HAVE_LIBMAGIC], 1, [Define if you have libmagic.])
EXTRA_LIBS="$EXTRA_LIBS -lmagic"])
fi
dnl FIXME: Support for this in the source code
AC_HEADER_DIRENT
ACX_PTHREAD
AC_FUNC_MMAP
if test "$ax_pthread_ok" != "yes"
then
AC_MSG_ERROR([[I don't know how to compile pthreads code on this system.]])
fi
CC="$PTHREAD_CC"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
EXTRA_LIBS="$EXTRA_LIBS $PTHREAD_LIBS"
AC_CHECK_FUNCS([getrlimit pthread_attr_getstacksize])
dnl __FUNCTION__
AC_TRY_COMPILE(,[printf(__FUNCTION__);], [AC_DEFINE([HAVE__FUNCTION__], 1,
[Define if we have __FUNCTION__ constant])])
dnl __attribute__
AC_TRY_COMPILE([#include <stdarg.h>],
[int f(const char *f, ...)
__attribute__((format (printf, 1, 2)))],
[AC_DEFINE([HAVE__ATTRIBUTE__], 1,
[Define if we have __attribute__ extension])])
dnl ncurses
MP_WITH_CURSES
if test -z "$CURSES_LIB"
then
AC_MSG_ERROR([You need curses/ncurses library and header files.])
fi
dnl popt
AC_CHECK_LIB([popt], [poptGetContext], [true], [POPT_MISSING="yes"])
dnl getopt
AC_CHECK_FUNC(getopt_long,
[AC_CHECK_HEADERS([getopt.h],,[AC_MSG_ERROR([You need getopt.h.])])],
[#FreeBSD has it there
AC_CHECK_LIB(gnugetopt,getopt_long,,
[AC_LIBOBJ(getopt)
AC_LIBOBJ(getopt1)
AC_CONFIG_LINKS([getopt.h:gnugetopt.h])]
)]
)
dnl samplerate
AC_ARG_WITH(samplerate, AS_HELP_STRING([--without-samplerate],
[Compile without libsamplerate]))
COMPILE_SAMPLERATE="no"
if test "x$with_samplerate" != "xno"
then
PKG_CHECK_MODULES(samplerate, samplerate >= 0.1.0,
[EXTRA_LIBS="$EXTRA_LIBS $samplerate_LIBS"
CFLAGS="$CFLAGS $samplerate_CFLAGS"
AC_DEFINE([HAVE_SAMPLERATE], 1,
[Define if you have libsamplerate])
COMPILE_SAMPLERATE="yes"],
[true])
fi
dnl Decoder plugins
m4_include(decoder_plugins/decoders.m4)
dnl curl
COMPILE_CURL="no"
AC_ARG_WITH(curl, AS_HELP_STRING([--without-curl],
[Compile without Network streams support]))
if test "x$with_curl" != "xno"
then
dnl FIXME: make a better curl test
AC_CHECK_PROG([CURL_CONFIG], [curl-config], [yes])
if test "x$CURL_CONFIG" = "xyes"
then
AC_MSG_CHECKING([libcurl version])
curl_ver=`curl-config --version | $AWK '{print $2}'`
curl_ver_major=`echo $curl_ver | $AWK -F. '{print $1}'`
curl_ver_minor=`echo $curl_ver | $AWK -F. '{print $2}'`
curl_ver_fix=`echo $curl_ver | $AWK -F. '{print $3}'`
# make 071202 from 7.12.2
curl_ver_number=`printf "%02d%02d%02d" $curl_ver_major \
$curl_ver_minor $curl_ver_fix`
if test "$curl_ver_number" -lt "071501"
then
CURL_DEPRECATED="yes"
fi
if test "$curl_ver_number" -ge "071202"
then
AC_MSG_RESULT([$curl_ver, OK])
CFLAGS="$CFLAGS `curl-config --cflags`"
EXTRA_LIBS="$EXTRA_LIBS `curl-config --libs`"
EXTRA_OBJS="$EXTRA_OBJS io_curl.o"
AC_DEFINE([HAVE_CURL], 1, [Define if you have libcurl])
COMPILE_CURL="yes"
else
AC_MSG_RESULT([$curl_ver, but minimum is 7.12.2])
fi
fi
fi
dnl Check for XZ.
AC_CHECK_PROG([XZ_MISSING], [xz], [no], [yes])
EXTRA_LIBS="$EXTRA_LIBS $CURSES_LIB"
AC_SUBST(EXTRA_LIBS)
AC_SUBST(EXTRA_DISTS)
AC_SUBST(EXTRA_CFLAGS)
AC_OUTPUT([Makefile
themes/Makefile
config.example
])
echo
echo "-----------------------------------------------------------------------"
echo "MOC will be compiled with:"
echo
if test `echo $DECODER_PLUGINS | $AWK '{print(length)}'` -le 50
then
echo "Decoder plugins: $DECODER_PLUGINS"
else
DECODERS_IX=`echo $DECODER_PLUGINS | $AWK '{match(substr($0, 1, 51), /.* /);print(RLENGTH)}'`
DECODERS_1=`echo $DECODER_PLUGINS | $AWK "{print(substr(\\$0, 1, $DECODERS_IX - 1))}"`
DECODERS_2=`echo $DECODER_PLUGINS | $AWK "{print(substr(\\$0, $DECODERS_IX + 1))}"`
echo "Decoder plugins: $DECODERS_1"
echo " $DECODERS_2"
fi
echo "Sound Drivers: "$SOUND_DRIVERS
echo "DEBUG: "$COMPILE_DEBUG
echo "RCC: "$COMPILE_RCC
echo "Network streams: "$COMPILE_CURL
echo "Resampling: "$COMPILE_SAMPLERATE
echo "MIME magic: "$COMPILE_MAGIC
echo "-----------------------------------------------------------------------"
echo
if test "x$FFMPEG_CONFIG" = "xyes"
then
echo "WARNING: Use of Debian's ffmpeg-config is deprecated;"
echo " please upgrade FFmpeg or it's libraries to a version"
echo " using pkg-config (FFmpeg release 0.5 or later)."
echo
fi
if test "x$BDB4_DEPRECATED" = "xyes"
then
echo "WARNING: After release 2.5 MOC will require Berkeley DB release"
echo " 4.1 or later. Plan to upgrade your libraries soon."
echo
fi
if test "x$CURL_DEPRECATED" = "xyes"
then
echo "WARNING: After release 2.5 MOC will require libcurl version"
echo " 7.15.1 or later. Plan to upgrade your libraries soon."
echo
fi
if test "x$FFMPEG_DEPRECATED" = "xyes"
then
echo "WARNING: After release 2.5 MOC will require FFmpeg/LibAV release"
echo " 0.7 or later. Plan to upgrade your libraries soon."
echo
fi
if test "x$POPT_MISSING" = "xyes"
then
echo "WARNING: After release 2.5 MOC will require libpopt. Plan"
echo " to install it before moving on from release 2.5."
echo
fi
if test "x$enable_debug" = "x"
then
echo "WARNING: After release 2.5 MOC debugging code will be disabled"
echo " by default. You should explicitly set the configure"
echo " '--enable-debug' option now."
echo
fi
if test "x$XZ_MISSING" = "xyes"
then
echo "WARNING: After release 2.5 MOC will use XZ to create tarballs"
echo " by default. If you wish to build tarballs, either plan"
echo " to install XZ soon or start using explicit 'dist-*'"
echo " 'make' targets."
echo
fi
if test "x$DECODER_PLUGINS" = "x"
then
echo "WARNING: No decoder plugins are to be compiled;"
echo " you will have to provide them separately."
echo
fi
if test "x$SOUND_DRIVERS" = "x"
then
echo "WARNING: No sound output methods are to be compiled;"
echo " you will not hear any sound!"
echo
fi
dnl
dnl If the warning below gets reported, then for further guidance:
dnl
dnl vi +/REQUEST_CHANNELS decoder_plugins/ffmpeg/ffmpeg.c
dnl
if test "x$want_ffmpeg" = "xyes" && \
test "x$ac_cv_member_struct_AVCodecContext_request_channels" != "xyes"
then
echo "WARNING: It appears that the FFmpeg/LibAV API has changed and no longer"
echo " supports downmixing to stereo as it did previously. Report"
echo " this message along with the output of 'ffmpeg --version' to"
echo " <$PACKAGE_BUGREPORT>. Meanwhile, you may have to live without"
echo " stereo downmixing."
echo
fi
echo "WARNING: Since MOC version 2 the executable file name has changed to mocp!"
echo " Please remove old moc binary if you have installed an older version."
echo