-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
425 lines (351 loc) · 11.9 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
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
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.25 $)dnl
AC_INIT(cdrdao, 1.2.3)
AC_CONFIG_SRCDIR(dao/main.cc)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AM_GCONF_SOURCE_2
AC_ARG_WITH(pcctsbin,[ --with-pcctsbin=dir set directory of PCCTS parser generator executables],[pcctsbin=$withval],[pcctsbin=default])
AC_ARG_WITH(pcctsinc,[ --with-pcctsinc=dir set directory of PCCTS parser generator includes],[pcctsinc=$withval],[pcctsinc=default])
AC_ARG_WITH(linux-qnx-sched,[ --with-linux-qnx-sched enable QNX real time scheduling for Linux],[AC_DEFINE(LINUX_QNX_SCHEDULING,1,"Use real time scheduling for Linux")])
AC_ARG_WITH(posix-threads,[ --with-posix-threads use Posix threads for ring buffer (default is YES)],[use_pthreads=$withval],[use_pthreads=default])
AC_ARG_WITH(scglib,[ --with-scglib use bundled libscg SCSI library (see INSTALL) (default is NO)],[scglib=$withval],[scglib=default])
AC_ARG_WITH(xdao,[ --with-xdao enable build of gcdmaster Gnome GUI front-end (default is YES)],[xdao=$withval],[xdao=default])
AC_ARG_WITH(ogg-support,[ --with-ogg-support enable OGG format support (default is YES)],[],[with_ogg_support=yes])
AC_ARG_WITH(mp3-support,[ --with-mp3-support enable MP3 format support (default is YES)],[],[with_mp3_support=yes])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_CHECK_PROG(AR,ar,ar)
AC_PROG_MAKE_SET
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h getopt.h malloc.h unistd.h sys/mman.h sched.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_TYPE_SIGNAL
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
case 2 in
$ac_cv_sizeof_short)
AC_DEFINE(size16,short,"")
SIZE16="short";;
$ac_cv_sizeof_int)
AC_DEFINE(size16,int,"")
SIZE16="int";;
esac
case 4 in
$ac_cv_sizeof_short) SIZE32="short";;
$ac_cv_sizeof_int) SIZE32="int";;
$ac_cv_sizeof_long) SIZE32="long";;
esac
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_CHECK_TYPE(int16_t,,AC_DEFINE_UNQUOTED(int16_t,$SIZE16,""))
AC_CHECK_TYPE(int32_t,,AC_DEFINE_UNQUOTED(int32_t,$SIZE32,""))
AC_CHECK_TYPE(u_int16_t,,AC_DEFINE_UNQUOTED(u_int16_t,$SIZE16,""))
AC_CHECK_TYPE(u_int32_t,,AC_DEFINE_UNQUOTED(u_int32_t,$SIZE32,""))
if test -z "$SIZE16"; then
AC_MSG_ERROR(No 16 bit type found on this platform!)
fi
dnl Check for additionally required libraries
AC_CHECK_FUNC(sched_getparam,AC_DEFINE(HAVE_SCHED_GETPARAM,1,""),
AC_CHECK_LIB(posix4,sched_getparam,[use_libposix4=yes;AC_DEFINE(HAVE_SCHED_GETPARAM)]))
AC_CHECK_FUNC(sched_get_priority_max,AC_DEFINE(HAVE_SCHED_GET_PRIORITY_MAX,1,""),
AC_CHECK_LIB(posix4,sched_get_priority_max,[use_libposix4=yes;AC_DEFINE(HAVE_SCHED_GET_PRIORITY_MAX,1,"")]))
AC_CHECK_FUNC(sched_setscheduler,AC_DEFINE(HAVE_SCHED_SETSCHEDULER,1,""),
AC_CHECK_LIB(posix4,sched_setscheduler,[use_libposix4=yes;AC_DEFINE(HAVE_SCHED_SETSCHEDULER,1,"")]))
AC_CHECK_LIB(socket,socket,[use_libsocket=yes])
AC_CHECK_LIB(socket,connect,[use_libsocket=yes])
dnl Add 'libsocket' if required
if test "$use_libsocket" = yes; then
LIBS="$LIBS -lsocket"
fi
dnl Check if libposix4 must be linked
if test "$use_libposix4" = yes; then
LIBS="$LIBS -lposix4"
fi
dnl Checks for library functions.
AC_CHECK_FUNCS(strerror)
AC_CHECK_FUNCS(mlockall munlockall)
AC_CHECK_FUNCS(getpagesize)
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNCS(setreuid setregid seteuid setegid setuid setgid)
AC_CHECK_FUNCS(inet_aton)
dnl check if Posix threads should be used
if test "$use_pthreads" = default; then
use_pthreads=yes
fi
if test "$use_pthreads" = yes; then
AC_CHECK_FUNC(pthread_create,have_pthread_std=yes,have_pthread_std=no)
if test "$have_pthread_std" = yes; then
AC_DEFINE(USE_POSIX_THREADS,1,"")
thread_libs=""
thread_test_lib=""
else
AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes,have_pthread=no)
if test "$have_pthread" = yes; then
AC_DEFINE(USE_POSIX_THREADS,1,"")
thread_libs="-lpthread"
thread_test_lib="pthread"
else
AC_CHECK_LIB(pthread32,pthread_create,have_pthread32=yes,have_pthread32=no)
if test "$have_pthread32" = yes; then
AC_DEFINE(USE_POSIX_THREADS)
thread_libs="-lpthread32"
thread_test_lib="pthread32"
else
AC_CHECK_LIB(c_r,pthread_create,have_c_r=yes,have_c_r=no)
if test "$have_c_r" = yes; then
AC_DEFINE(USE_POSIX_THREADS)
thread_libs="-lc_r"
thread_test_lib="c_r"
else
use_pthreads=no
fi
fi
fi
fi
if test "$use_pthreads" = yes; then
if test "$have_pthread_std" = yes; then
AC_CHECK_FUNCS(pthread_sigmask pthread_attr_setschedpolicy)
AC_CHECK_FUNCS(pthread_attr_setschedparam pthread_getschedparam)
AC_CHECK_FUNCS(pthread_setschedparam)
else
AC_CHECK_LIB($thread_test_lib,pthread_sigmask,AC_DEFINE(HAVE_PTHREAD_SIGMASK))
AC_CHECK_LIB($thread_test_lib,pthread_attr_setschedpolicy,AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCHEDPOLICY))
AC_CHECK_LIB($thread_test_lib,pthread_attr_setschedparam,AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCHEDPARAM))
AC_CHECK_LIB($thread_test_lib,pthread_getschedparam,AC_DEFINE(HAVE_PTHREAD_GETSCHEDPARAM))
AC_CHECK_LIB($thread_test_lib,pthread_setschedparam,AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM))
fi
fi
fi
if test "$use_pthreads" = yes; then
mydefs="-D_THREAD_SAFE -D_REENTRANT $mydefs"
fi
dnl Checks for pccts parser generator
en_pccts="no"
if test "$pcctsbin" = default; then
antlr_path='$(srcdir)/../pccts/antlr/antlr'
dlg_path='$(srcdir)/../pccts/dlg/dlg'
en_pccts="yes"
else
AC_PATH_PROG(antlr_path,antlr,no,$pcctsbin)
AC_PATH_PROG(dlg_path,dlg,no,$pcctsbin)
if test $antlr_path = "no" || test $dlg_path = "no"; then
AC_MSG_WARN([PCCTS: antlr or dlg not found in path, using own.])
antlr_path='$(srcdir)/../pccts/antlr/antlr'
dlg_path='$(srcdir)/../pccts/dlg/dlg'
en_pccts="yes"
fi
fi
if test "$pcctsinc" = default; then
pcctsinc='$(srcdir)/../pccts/h'
antlr_path='$(srcdir)/../pccts/antlr/antlr'
dlg_path='$(srcdir)/../pccts/dlg/dlg'
en_pccts="yes"
else
ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$pcctsinc"
AC_CHECK_HEADER(pcctscfg.h,,[
AC_MSG_WARN([PCCTS: headers not found in path, using own.])
pcctsinc='$(srcdir)/../pccts/h'
antlr_path='$(srcdir)/../pccts/antlr/antlr'
en_pccts="yes"])
CPPFLAGS="$ac_save_CPPFLAGS"
fi
utiltools="toc2cue cue2toc"
en_cdrdao=yes
en_toc2cue=yes
en_cue2toc=yes
en_toc2mp3=no
AC_PATH_LAME(3.92, [utiltools="$utiltools toc2mp3" en_toc2mp3=yes],
[echo "Building of toc2mp3 disabled"])
dnl Determine whether we're building the gcdaster GUI front-end
en_xdao=no
if test "$xdao" = default; then
xdao=yes
fi
if test "$xdao" = yes; then
en_xdao=yes
PKG_CHECK_MODULES(SIGCPP2, sigc++-2.0 >= 2.0.0,[],
[echo "Building of gcdmaster disabled"; en_xdao=no])
PKG_CHECK_MODULES([GTKMM], [gtkmm-3.0], [],
[echo "Building of gcdmaster disabled"; en_xdao=no])
fi
dnl Determine source for scsi interface class
if test "$scglib" = yes; then
scsilib_dir=scsilib
scsilib_incl='-I$(srcdir)/../scsilib/export -I$(srcdir)/../scsilib/export/libschily'
scsilib_libs="-L../scsilib/export"
en_scsilib="yes"
scsilib_libs="$scsilib_libs -lscg -lschily"
scsilib_objs="ScsiIf-lib.o"
case "$host" in
*-freebsd* | *-kfreebsd*-gnu)
scsilib_libs="$scsilib_libs -lcam"
;;
esac
else
en_scsilib="no (using native interface)"
scsilib_dir=""
scsilib_incl=""
scsilib_libs=""
case "$host" in
*-linux*)
scsilib_libs=""
scsilib_objs="ScsiIf-linux.o sg_err.o"
;;
*-freebsd* | *-kfreebsd*-gnu)
scsilib_libs="-lcam"
scsilib_objs="ScsiIf-freebsd-cam.o"
;;
*-netbsd*)
scsilib_libs="-lutil"
scsilib_objs="ScsiIf-netbsd.o"
;;
*-irix*)
scsilib_libs=""
scsilib_objs="ScsiIf-irix.o"
;;
*-darwin*)
scsilib_libs="-framework IOKit -framework CoreFoundation"
scsilib_objs="ScsiIf-osx.o"
;;
*-pc-cygwin*)
scsilib_libs=""
scsilib_objs="ScsiIf-win.o"
;;
*)
AC_MSG_ERROR([No native interface for operating system $host_os, use --with-libscg])
;;
esac
fi
dnl Selection of buffer code
case "$host" in
*)
dao_src=dao.cc
;;
esac
dnl Additional operating system dependent selections
case "$host" in
*-freebsd*)
if test "$use_pthreads" = yes; then
LDFLAGS="-pthread $LDFLAGS"
dnl -lc_r is automatically done by the linker
thread_libs=""
fi
;;
*darwin*)
AC_DEFINE(_P1003_1B_VISIBLE,1,"")
LIBS="$LIBS -framework CoreServices -framework IOKit"
;;
esac
dnl Sound device selection for xcdrdao
case "$host" in
*-linux* | *-freebsd* | *-kfreebsd*-gnu | *-solaris*)
sound_if_obj=SoundIF-ao.o
;;
*)
sound_if_obj=SoundIF-none.o
;;
esac
dnl Check for OGG support
if test "$with_ogg_support" = yes; then
PKG_CHECK_MODULES(VORBISFILE, vorbisfile >= 1.0, [],
[echo "OGG support disabled"; with_ogg_support=no])
fi
dnl Check for MP3 support
if test "$with_mp3_support" = yes; then
PKG_CHECK_MODULES(MAD, mad >= 0.10, [],
[echo "libMAD detection via pkg-config failed"; with_mp3_support=no])
if test "$with_mp3_support" = no; then
AC_CHECK_LIB(mad, mad_stream_init, [AC_CHECK_HEADER([mad.h])])
if test "$ac_cv_lib_mad_mad_stream_init" = yes; then
AC_ARG_VAR(MAD_LIBS,"")
AC_ARG_VAR(MAD_CFLAGS,"")
MAD_LIBS="-lmad"
MAD_CFLAGS=""
with_mp3_support=yes
else
echo "MP3 support disabled"; with_mp3_support=no
fi
fi
fi
dnl Check for libao support
if test "$with_mp3_support" = yes || test "$with_ogg_support" = yes || test "$en_xdao" = yes; then
PKG_CHECK_MODULES(AO, ao >= 0.8, [AC_DEFINE(HAVE_AO,1,"")],
[echo "Building of gcdmaster disabled"; with_ogg_support=no;
with_mp3_support=no; en_xdao=no])
fi
if test "$with_ogg_support" = yes; then
AC_DEFINE(HAVE_OGG_SUPPORT,1,"")
fi
if test "$with_mp3_support" = yes; then
AC_DEFINE(HAVE_MP3_SUPPORT,1,"")
fi
dnl General platform specific setup
case "$host" in
*-sysv4*)
mydefs="-DUNIXWARE $mydefs"
LIBS="$LIBS -L/usr/ucblib -lucb"
;;
esac
AC_SUBST(en_xdao)
AC_SUBST(en_toc2mp3)
AC_SUBST(en_toc2cue)
AC_SUBST(en_cue2toc)
AC_SUBST(en_cdrdao)
AC_SUBST(scsilib_dir)
AC_SUBST(scsilib_incl)
AC_SUBST(scsilib_libs)
AC_SUBST(scsilib_objs)
AC_SUBST(pcctsinc)
AC_SUBST(dao_src)
AC_SUBST(sound_if_obj)
AC_SUBST(thread_libs)
AC_SUBST(mydefs)
AC_SUBST(antlr_path)
AC_SUBST(dlg_path)
AM_CONDITIONAL([COND_XDAO], [test "$en_xdao" = yes])
AM_CONDITIONAL([COND_TOC2MP3], [test "$en_toc2mp3" = yes])
AM_CONDITIONAL([COND_SCSILIB], [test "$en_scsilib" = yes])
AM_CONDITIONAL([COND_PCCTS], [test "$en_pccts" = yes])
AM_CONDITIONAL([COND_MP3], [test "$with_mp3_support" = yes])
AM_CONDITIONAL([COND_OGG], [test "$with_ogg_support" = yes])
GLIB_GSETTINGS
AC_CONFIG_FILES([
trackdb/Makefile
dao/Makefile
utils/Makefile
xdao/Makefile
xdao/gcdmaster.schemas
xdao/stock/Makefile
paranoia/Makefile
pccts/Makefile
pccts/antlr/Makefile
pccts/dlg/Makefile
Makefile
specs/cdrdao.fedora.spec
])
AC_OUTPUT
echo
echo "------------------------------------------------------"
echo " Building scsilib : $en_scsilib"
echo " Building pccts : $en_pccts"
echo " Building cdrdao : $en_cdrdao"
echo " OGG support : $with_ogg_support"
echo " MP3 support : $with_mp3_support"
echo " Building toc2cue : $en_toc2cue"
echo " Building cue2toc : $en_cue2toc"
echo " Building toc2mp3 : $en_toc2mp3"
echo " Building gcdmaster : $en_xdao"
echo "------------------------------------------------------"