configure.ac 17.9 KB
Newer Older
1
# $Id$
2

3
AC_INIT(src/core/core.h)
Sam Hocevar's avatar
Sam Hocevar committed
4

5 6
AC_PREREQ(2.52)
AC_CONFIG_AUX_DIR(autotools)
Sam Hocevar's avatar
Sam Hocevar committed
7 8
AC_CANONICAL_SYSTEM

9
AM_INIT_AUTOMAKE(vls, 0.5.7-svn)
10
AM_CONFIG_HEADER(config.h)
Sam Hocevar's avatar
Sam Hocevar committed
11

12 13 14
dnl Main sources default
NEEDSRC_core=1
NEEDSRC_server=1
15
NEEDSRC_daemon=1
16
NEEDSRC_mpegbase=1
17
NEEDSRC_mpegmux=1
18
NEEDSRC_getopt=0
19

20 21 22 23 24 25 26 27
dnl Compiler flags
CXXFLAGS="${CXXFLAGS} -Wall -O2"

dnl Preprocessor flags
dnl See /usr/include/features.h for the meaning of these macros.
CPPFLAGS="${CPPFLAGS} -D_LARGEFILE_SOURCE"
CPPFLAGS="${CPPFLAGS} -D_LARGEFILE64_SOURCE"
CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64"
28

Gildas Bazin's avatar
Gildas Bazin committed
29
dnl Save CXXFLAGS and LDFLAGS
30
save_CPPFLAGS="${CPPFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
31
save_CXXFLAGS="${CXXFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
32 33 34 35
save_LDFLAGS="${LDFLAGS}"

dnl Check for tools
AC_PROG_MAKE_SET
36
AC_PROG_CXX
Gildas Bazin's avatar
Gildas Bazin committed
37 38 39 40 41
AC_PROG_CXXCPP
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(AR, ar, :)

dnl Set default language
42
AC_LANG(C++)
Sam Hocevar's avatar
Sam Hocevar committed
43

44
AM_PROG_LIBTOOL
Sam Hocevar's avatar
Sam Hocevar committed
45 46 47
AC_PROG_INSTALL

dnl
Gildas Bazin's avatar
Gildas Bazin committed
48
dnl  Endianness check
Sam Hocevar's avatar
Sam Hocevar committed
49
dnl
Gildas Bazin's avatar
Gildas Bazin committed
50
AC_C_BIGENDIAN
Sam Hocevar's avatar
Sam Hocevar committed
51

Sam Hocevar's avatar
Sam Hocevar committed
52 53 54
dnl Check for standard functions
AC_CHECK_FUNCS(gettimeofday select strerror strtol)
AC_CHECK_FUNCS(opendir usleep sigaction)
Sam Hocevar's avatar
Sam Hocevar committed
55 56 57 58 59 60 61 62 63 64 65
AC_FUNC_MMAP
AC_TYPE_SIGNAL

AC_CHECK_LIB(dl,dlopen,
  VLS_LIB="${VLS_LIB} -ldl"
)

AC_CHECK_LIB(crypt,crypt,
  VLS_LIB="${VLS_LIB} -lcrypt"
)

Sam Hocevar's avatar
Sam Hocevar committed
66 67 68 69 70 71 72 73 74 75 76 77
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect,
    VLS_LIB="${VLS_LIB} -lsocket"
)])

AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname,
    VLS_LIB="${VLS_LIB} -lnsl"
)])

AC_CHECK_FUNC(sem_post,,[AC_CHECK_LIB(posix4,sem_post,
    VLS_LIB="${VLS_LIB} -lposix4"
)])

78
have_nanosleep=0
Christophe Massiot's avatar
Christophe Massiot committed
79
AC_CHECK_FUNC(nanosleep,have_nanosleep=1,[AC_CHECK_LIB(rt,nanosleep,
80
  [VLS_LIB="${VLS_LIB} -lrt"; have_nanosleep=1]
Sam Hocevar's avatar
Sam Hocevar committed
81
  ,[AC_CHECK_LIB(posix4,nanosleep,
82
    [VLS_LIB="${VLS_LIB} -lposix4"; have_nanosleep=1]
Sam Hocevar's avatar
Sam Hocevar committed
83
)])])
Sam Hocevar's avatar
Sam Hocevar committed
84
if test "$have_nanosleep" = "1"; then
85 86 87
  AC_DEFINE(HAVE_NANOSLEEP, 1,
            Define if nanosleep is available.)
fi
Sam Hocevar's avatar
Sam Hocevar committed
88

89 90 91 92 93 94
dnl Mac OS X and other OSes don't have declaration for nanosleep
AC_EGREP_HEADER(nanosleep,time.h,[
  AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
            Define if <time.h> defines nanosleep.)
])      

Sam Hocevar's avatar
Sam Hocevar committed
95 96
dnl  Check for pthreads - borrowed from XMMS
THREAD_LIB=error
Sam Hocevar's avatar
Sam Hocevar committed
97
if test "${THREAD_LIB}" = error; then
Sam Hocevar's avatar
Sam Hocevar committed
98 99
  AC_CHECK_LIB(pthread,pthread_attr_init,THREAD_LIB="-lpthread")
fi
Sam Hocevar's avatar
Sam Hocevar committed
100
if test "${THREAD_LIB}" = error; then
Sam Hocevar's avatar
Sam Hocevar committed
101 102
  AC_CHECK_LIB(pthreads,pthread_attr_init,THREAD_LIB="-lpthreads")
fi
Sam Hocevar's avatar
Sam Hocevar committed
103
if test "${THREAD_LIB}" = error; then
Sam Hocevar's avatar
Sam Hocevar committed
104 105
  AC_CHECK_LIB(c_r,pthread_attr_init,THREAD_LIB="-lc_r")
fi
Sam Hocevar's avatar
Sam Hocevar committed
106
if test "${THREAD_LIB}" = error; then
Sam Hocevar's avatar
Sam Hocevar committed
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
  AC_CHECK_FUNC(pthread_attr_init)
  THREAD_LIB=""
fi

VLS_LIB="${VLS_LIB} ${THREAD_LIB}"


dnl Check for misc headers
AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
            Define if <pthread.h> defines pthread_cond_t.)])
AC_EGREP_HEADER(struct ifreq,net/if.h,[
  AC_DEFINE(STRUCT_IFREQ_IN_NET_IF_H, 1,
            Define if <net/if.h> defines struct ifreq.)])
AC_EGREP_HEADER(struct iovec,sys/uio.h,[
  AC_DEFINE(STRUCT_IOVEC_IN_SYS_UIO_H, 1,
            Define if <sys/uio.h> defines struct iovec.)])
AC_EGREP_HEADER(strncasecmp,strings.h,[
  AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
            Define if <strings.h> defines strncasecmp.)])
AC_EGREP_HEADER(getprotobyname,netdb.h,[
  AC_DEFINE(GETPROTOBYNAME_IN_NETDB_H, 1,
            Define if <netdb.h> defines getprotobyname.)])

dnl Check for headers
132
AC_CHECK_HEADERS(stdint.h inttypes.h)
133
AC_CHECK_HEADERS(stddef.h strings.h)
Sam Hocevar's avatar
Sam Hocevar committed
134
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h)
135
AC_CHECK_HEADERS(dlfcn.h)
Sam Hocevar's avatar
Sam Hocevar committed
136
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
137 138
AC_CHECK_HEADERS(crypt.h)

139 140 141 142 143 144

dnl Check for getopt
need_getopt=false
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
  AC_CHECK_LIB([gnugetopt],[getopt_long],
Damien Lucas's avatar
Damien Lucas committed
145
    [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) VLS_LIB="${VLS_LIB} -lgnugetopt"],
146
    [need_getopt=:])])
147 148 149
if test x"$need_getopt" = x":"; then
  NEEDSRC_getopt=1
fi
150 151


152 153 154
dnl Check for socklen_t
AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
  [AC_TRY_COMPILE(
Christophe Massiot's avatar
Christophe Massiot committed
155 156
     [#include <sys/types.h>
      #include <sys/socket.h>],
157 158 159
     [socklen_t len = 42; return len;],
     ac_cv_type_socklen_t=yes,
     ac_cv_type_socklen_t=no)])
Sam Hocevar's avatar
Sam Hocevar committed
160
if test "$ac_cv_type_socklen_t" != "no"; then
161 162 163
  AC_DEFINE(HAVE_SOCKLEN_T, 1,
            Define if <sys/socket.h> defines socklen_t.)
fi
Sam Hocevar's avatar
Sam Hocevar committed
164

165
dnl IPv6 support
Christophe Massiot's avatar
Christophe Massiot committed
166 167 168 169 170 171 172 173 174 175 176 177
have_ipv6=false
AC_CHECK_FUNC(inet_pton,[have_ipv6=:],[
  AC_CHECK_LIB(resolv,inet_pton,
    [have_ipv6=:])
])
AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
  [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=false])
if ${have_ipv6}; then
  AC_DEFINE(HAVE_IPV6, 1, Define if the system have IPv6 structures.)
fi

Tristan Leteurtre's avatar
Tristan Leteurtre committed
178 179
dnl Check Unix socket
have_unixsocket=false
Sam Hocevar's avatar
Sam Hocevar committed
180 181
AC_MSG_CHECKING(for sockaddr_un in sys/un.h)
AC_EGREP_HEADER(sockaddr_un,sys/un.h,
Tristan Leteurtre's avatar
Tristan Leteurtre committed
182
  [AC_MSG_RESULT(yes); have_unixsocket=true], [AC_MSG_RESULT(no); have_unixsocket=false])
Tristan Leteurtre's avatar
Tristan Leteurtre committed
183
if ${have_unixsocket}; then
Sam Hocevar's avatar
Sam Hocevar committed
184
  AC_DEFINE(HAVE_SOCKADDR_UN_IN_SYS_UN_H, 1, Define if the system can handle Unix sockets.)
Tristan Leteurtre's avatar
Tristan Leteurtre committed
185
fi
186

Sam Hocevar's avatar
Sam Hocevar committed
187 188 189
dnl Check for SO_BINDTODEVICE
AC_CACHE_CHECK([whether setsockopt accepts SO_BINDTODEVICE],
    [ac_cv_c_so_bindtodevice],
Gildas Bazin's avatar
Gildas Bazin committed
190
    [CXXFLAGS="${save_CXXFLAGS} -Wall -Werror"
Sam Hocevar's avatar
Sam Hocevar committed
191 192
     AC_TRY_COMPILE([#include <sys/types.h>
                     #include <sys/socket.h>],
Sam Hocevar's avatar
Sam Hocevar committed
193
        [return SO_BINDTODEVICE;],
Sam Hocevar's avatar
Sam Hocevar committed
194 195 196 197 198 199
        ac_cv_c_so_bindtodevice=yes, ac_cv_c_so_bindtodevice=no)])
if test x"$ac_cv_c_so_bindtodevice" != x"no"; then
    AC_DEFINE(HAVE_SO_BINDTODEVICE, 1, Define if setsockopt accepts SO_BINDTODEVICE.)
fi

dnl End of the bizarre compilation tests
200
CPPFLAGS="${save_CPPFLAGS}"
Gildas Bazin's avatar
Gildas Bazin committed
201
CXXFLAGS="${save_CXXFLAGS}"
Sam Hocevar's avatar
Sam Hocevar committed
202 203 204 205 206 207 208 209 210 211
LDFLAGS="${save_LDFLAGS}"


dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_HEADER_TIME

dnl
dnl  Check the operating system
dnl
212
case "${target_os}" in
Sam Hocevar's avatar
Sam Hocevar committed
213 214 215 216 217 218
  bsdi*)
    SYS=bsdi
    ;;
  darwin*)
    SYS=darwin
    ;;
Gildas Bazin's avatar
Gildas Bazin committed
219 220 221 222
  *mingw32*)
    SYS=mingw32
    VLS_LIB="${VLS_LIB} -lws2_32"
    ;;
Sam Hocevar's avatar
Sam Hocevar committed
223
  *)
224
    SYS="${target_os}"
Sam Hocevar's avatar
Sam Hocevar committed
225 226 227 228 229 230
    ;;
esac

dnl
dnl  Check the architecture
dnl
231
ARCH="${target_cpu}"
Sam Hocevar's avatar
Sam Hocevar committed
232

233 234 235
dnl
dnl  default modules
dnl
Tristan Leteurtre's avatar
Tristan Leteurtre committed
236
BUILTINS="${BUILTINS} filechannel netchannel filereader ts2ts ps2ts localinput videoinput dummyinterface telnetinterface nativeinterface unixinterface normaltrickplay tcpinput tcpreader"
Sam Hocevar's avatar
Sam Hocevar committed
237 238 239 240

dnl
dnl  Debugging mode
dnl
Damien Lucas's avatar
Damien Lucas committed
241
DEBUG=0
Sam Hocevar's avatar
Sam Hocevar committed
242
AC_ARG_ENABLE(debug,
Damien Lucas's avatar
Damien Lucas committed
243
AC_HELP_STRING(--enable-debug, Enable debug mode (default disabled)),
244 245 246 247 248 249 250
[ if test "$enableval" = "no"; then
    DEBUG=0
  else
    DEBUG=1
    CPPFLAGS="${CPPFLAGS} -DDEBUG"
    CXXFLAGS="${CXXFLAGS} -g"
  fi ])
Sam Hocevar's avatar
Sam Hocevar committed
251 252 253 254 255 256

dnl
dnl  Profiling mode
dnl
PROFILING=0
AC_ARG_ENABLE(profiling,
Gildas Bazin's avatar
Gildas Bazin committed
257
AC_HELP_STRING(--enable-profiling, Enable profiling mode (default disabled)),
258 259 260 261 262
[ if test "$enableval" = "yes"; then
    PROFILING=1
    CXXFLAGS="${CXXFLAGS} -pg"
    LDFLAGS="${LDFLAGS} -pg"
  fi ])
Sam Hocevar's avatar
Sam Hocevar committed
263

264 265 266 267 268
dnl
dnl SYSLOG
dnl
AC_CHECK_HEADERS(syslog.h, SYSLOG=1, SYSLOG=0)
AC_ARG_ENABLE(syslog,
269
[  --disable-syslog         Logging using syslogd (default enabled)],
Sam Hocevar's avatar
Sam Hocevar committed
270
[ if test "$enableval" = "no"
271 272 273 274
   then
    SYSLOG=0
   fi])
  
Sam Hocevar's avatar
Sam Hocevar committed
275
if test "$enable_syslog" != "no"
276 277 278 279 280 281 282 283
then
  if test ${SYSLOG} = 0
  then
    AC_MSG_ERROR([Could not find syslog.h. You can alternately configure
using --disable-syslog])
  fi
fi

284 285 286
dnl
dnl  Daemon mode
dnl
287
DAEMON=1
288 289
AC_ARG_ENABLE(daemon,
[  --disable-daemon        Disable daemon mode (default enabled)])
Sam Hocevar's avatar
Sam Hocevar committed
290
if test "$enable-daemon" != "no"
291 292 293 294 295 296
then
  if test ${SYSLOG} = 0
  then
    AC_MSG_ERROR([Could not find syslog.h. Syslog is required to run in daemon mode. You can alternately configure
using --disable-syslog and --disable-daemon])
    DAEMON=0
297
    NEEDSRC_daemon=0
298 299 300 301 302 303 304
  else
    NEEDSRC_daemon=1
    DAEMON=1
  fi
fi


Sam Hocevar's avatar
Sam Hocevar committed
305 306 307 308 309 310
dnl
dnl  PVR module
dnl
AC_CHECK_HEADER(linux/videodev.h, PLUGINS="${PLUGINS} pvrreader")


311 312 313 314
dnl 
dnl  DVD module
dnl
AC_ARG_ENABLE(dvd,
Gildas Bazin's avatar
Gildas Bazin committed
315
AC_HELP_STRING(--disable-dvd, DVD support (default enabled)))
Sam Hocevar's avatar
Sam Hocevar committed
316
if test "$enable_dvd" != "no"
317 318 319 320 321
then
  AC_CHECK_HEADER(dvdread/dvd_reader.h,
                  HAVE_LIBDVDREAD=1, HAVE_LIBDVDREAD=0)
  if test ${HAVE_LIBDVDREAD} = 1
  then
322 323 324 325 326 327 328
    case ${SYS} in
      darwin)
        BUILTINS="${BUILTINS} dvdreader"
        VLS_LIB="${VLS_LIB} -ldvdread -ldvdcss"
        ;;
      *)
        PLUGINS="${PLUGINS} dvdreader"
329
        DVDREADER_LIBADD="${DVDREADER_LIBADD} -ldvdread"
330 331
        ;;
    esac
332 333 334 335 336 337 338
  else
    AC_MSG_ERROR([The development package for libdvdread is not installed.
Please install it and try again. Alternatively you can also configure with
--disable-dvd.])
  fi
fi

Damien Lucas's avatar
Damien Lucas committed
339
dnl
340 341 342
dnl  DVB module
dnl
AC_ARG_ENABLE(dvb,
Gildas Bazin's avatar
Gildas Bazin committed
343
AC_HELP_STRING(--enable-dvb, DVB support (default disabled)))
344
AC_ARG_WITH(dvb,
345
AC_HELP_STRING(--with-dvb=[PATH], path to DVB driver header files))
Damien Lucas's avatar
Damien Lucas committed
346 347
AC_ARG_WITH(dvb,
AC_HELP_STRING(--with-libdvb=[PATH], path to libdvb))
Sam Hocevar's avatar
Sam Hocevar committed
348
if test "$enable_dvb" = "yes"
349
then
350
  dnl Test for driver header files
Sam Hocevar's avatar
Sam Hocevar committed
351
  if test "$with_dvb" = ""
352
  then
353 354
    test_CFLAGS=""
  else
Sam Hocevar's avatar
Sam Hocevar committed
355
    test_CFLAGS="-I${with_dvb}/include -I${with_dvb}/include"
356
  fi
357
  save_CPPFLAGS="$CPPFLAGS"
358
  CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
359
  AC_CHECK_HEADERS([linux/dvb/frontend.h],
360 361
                   [DVBINPUT_CXXFLAGS="${DVBINPUT_CXXFLAGS} ${test_CFLAGS}"
                    DVBINPUT_CPPFLAGS="${DVBINPUT_CPPFLAGS} ${test_CFLAGS}"],
362
                   [AC_MSG_ERROR([Could not find dvbdriver on your system: you may get it from http://www.linuxtv.org/])])
Damien Lucas's avatar
Damien Lucas committed
363
  CPPFLAGS="$save_CPPFLAGS"
364

Damien Lucas's avatar
Damien Lucas committed
365
  dnl Test for the libdvb library
Sam Hocevar's avatar
Sam Hocevar committed
366 367 368 369 370
  if test "$with_libdvb" != ""
  then
    test_CFLAGS="-I${with_libdvb}/include -I${with_libdvb}"
  fi
  save_CPPFLAGS="$CPPFLAGS"
371
  CPPFLAGS="$save_CPPFLAGS $test_CFLAGS $DVBINPUT_CXXFLAGS"
Sam Hocevar's avatar
Sam Hocevar committed
372
  AC_CHECK_HEADERS([DVB.hh],
373
   [DVBINPUT_CXXFLAGS="${DVBINPUT_CXXFLAGS} ${test_CFLAGS}"],
Sam Hocevar's avatar
Sam Hocevar committed
374 375
   [AC_MSG_ERROR([Could not find libdvb headers on your system: you may get it from http://www.metzlerbros.org/dvb/index.html])])
  CPPFLAGS="$save_CPPFLAGS"
376

Sam Hocevar's avatar
Sam Hocevar committed
377 378 379
  dnl Test for the lib existence
  if test -f "${with_libdvb}/libdvb.a"
  then
380 381
    DVBINPUT_CPPFLAGS="${DVBINPUT_CPPFLAGS} -I${with_libdvb}/include -I${with_libdvb}"
    DVBINPUT_LIBADD="${DVBINPUT_LIBADD} -L${with_libdvb} -ldvb"
Sam Hocevar's avatar
Sam Hocevar committed
382 383 384
    PLUGINS="${PLUGINS} dvbinput dvbreader"
  else
    AC_CHECK_LIB(dvb_pic,main,
385 386
     [DVBINPUT_LIBADD="${DVBINPUT_LIBADD} -ldvb_pic"
      DVBINPUT_CPPFLAGS="${DVBINPUT_CPPFLAGS} -I${with_libdvb}/include -I${with_libdvb}"
Sam Hocevar's avatar
Sam Hocevar committed
387 388
      PLUGINS="${PLUGINS} dvbinput dvbreader"],
     [AC_CHECK_LIB(dvb,main,
389 390
       [DVBINPUT_LIBADD="${DVBINPUT_LIBADD} -ldvb"
        DVBINPUT_CPPFLAGS="${DVBINPUT_CPPFLAGS} -I${with_libdvb}/include -I${with_libdvb}"
Sam Hocevar's avatar
Sam Hocevar committed
391 392 393
        PLUGINS="${PLUGINS} dvbinput dvbreader"],
     [AC_MSG_ERROR([cannot find ${with_libdvb}/libdvb.a, make sure you compiled libdvb in ${with_libdvb}])])])
  fi
394
fi
395

Tristan Leteurtre's avatar
Tristan Leteurtre committed
396 397 398 399 400
dnl 
dnl  V4L-ffmpeg module
dnl
AC_ARG_ENABLE(v4l,
AC_HELP_STRING(--enable-v4l, V4L support (default disabled)))
401
AC_ARG_WITH(ffmpeg,
Tristan Leteurtre's avatar
Tristan Leteurtre committed
402 403 404 405
AC_HELP_STRING(--with-ffmpeg=[PATH], path to ffmpeg header files))
AC_ARG_WITH(v4l,
AC_HELP_STRING(--with-v4l=[PATH], path to v4l header files))

Sam Hocevar's avatar
Sam Hocevar committed
406
if test "$enable_v4l" = "yes"
Tristan Leteurtre's avatar
Tristan Leteurtre committed
407 408 409
then
  dnl Test for videodev.h
  AC_MSG_CHECKING(for v4l headers in ${with_v4l})
Sam Hocevar's avatar
Sam Hocevar committed
410
  if test "$with_v4l" != ""
Tristan Leteurtre's avatar
Tristan Leteurtre committed
411 412 413 414 415 416
  then
    test_CFLAGS="-I${with_v4l}/include"
  fi
  save_CPPFLAGS="${CPPFLAGS}"
  CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
  AC_CHECK_HEADERS([linux/videodev.h],
Tristan Leteurtre's avatar
Tristan Leteurtre committed
417 418
                   [RAW2TS_CXXFLAGS="${RAW2TS_CXXFLAGS} ${test_CFLAGS}"
                    RAW2TS_CPPFLAGS="${RAW2TS_CPPFLAGS} ${test_CFLAGS}"],
Tristan Leteurtre's avatar
Tristan Leteurtre committed
419 420 421 422 423
                   [AC_MSG_ERROR([Could not find video4linux headers])])
  CPPFLAGS="${save_CPPFLAGS}"
  
  dnl Test for avcodec.h
  AC_MSG_CHECKING(for ffmpeg headers in ${with_ffmpeg})
Sam Hocevar's avatar
Sam Hocevar committed
424
  if test "$with_ffmpeg" != ""
Tristan Leteurtre's avatar
Tristan Leteurtre committed
425 426 427 428 429 430
  then
    test_CFLAGS="-I${with_ffmpeg}/libavcodec"
  fi
  save_CPPFLAGS="${CPPFLAGS}"
  CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
  AC_CHECK_HEADERS([avcodec.h],
Tristan Leteurtre's avatar
Tristan Leteurtre committed
431 432
                   [RAW2TS_CXXFLAGS="${RAW2TS_CXXFLAGS} ${test_CFLAGS}"
                    RAW2TS_CPPFLAGS="${RAW2TS_CPPFLAGS} ${test_CFLAGS}"],
Tristan Leteurtre's avatar
Tristan Leteurtre committed
433 434 435 436 437 438
                   [AC_MSG_ERROR([Could not find ffmpeg/libavcodec headers])])
  CPPFLAGS="${save_CPPFLAGS}"

  dnl Test for the lib existence
  if test -f "${with_ffmpeg}/libavcodec/libavcodec.a"
  then
Tristan Leteurtre's avatar
Tristan Leteurtre committed
439 440
    RAW2TS_CPPFLAGS="${RAW2TS_CPPFLAGS} -I${with_ffmpeg}/libavcodec"
    RAW2TS_LIBADD="${RAW2TS_LIBADD} -L${with_ffmpeg}/libavcodec ${with_ffmpeg}/libavcodec/libavcodec.a"
Tristan Leteurtre's avatar
Tristan Leteurtre committed
441 442 443 444 445 446
    BUILTINS="${BUILTINS} v4linput v4lreader raw2ts"
  else
    AC_MSG_ERROR([cannot find ${with_ffmpeg}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg}/libavcodec])
  fi
fi

447 448 449 450 451 452 453 454
dnl 
dnl  ASI module
dnl
AC_ARG_ENABLE(asi,
AC_HELP_STRING(--enable-asi, ASI support (default disabled)))
AC_ARG_WITH(asi,
AC_HELP_STRING(--with-asi=[PATH], path to ASI header files))

Sam Hocevar's avatar
Sam Hocevar committed
455
if test "$enable_asi" = "yes"
456 457 458
then
  dnl Test for asi.h
  AC_MSG_CHECKING(for ASI headers in ${with_asi})
Sam Hocevar's avatar
Sam Hocevar committed
459
  if test "$with_asi" != ""
460 461 462 463 464 465
  then
    test_CFLAGS="-I${with_asi}"
  fi
  save_CPPFLAGS="${CPPFLAGS}"
  CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
  AC_CHECK_HEADERS([asi.h],
466 467
                   [ASIINPUT_CXXFLAGS="${ASIINPUT_CXXFLAGS} ${test_CFLAGS}"
                    ASIREADER_CXXFLAGS="${ASIREADER_CXXFLAGS} ${test_CFLAGS}"],
468 469 470 471 472 473 474
                   [AC_MSG_ERROR([Could not find ASI headers])])
  CPPFLAGS="${save_CPPFLAGS}"
  
  dnl No test for lib.
  PLUGINS="${PLUGINS} asiinput asireader"
fi

475 476 477 478 479 480 481 482 483
dnl
dnl Main sources checks
dnl

dnl 
dnl  libdvbpsi
dnl
if test ${NEEDSRC_mpegmux} = 1
then
484
  AC_ARG_WITH(dvbpsi,
Gildas Bazin's avatar
Gildas Bazin committed
485
  AC_HELP_STRING(--with-dvbpsi=PATH, libdvbpsi headers and libraries))
486
  AC_ARG_WITH(dvbpsi,
Gildas Bazin's avatar
Gildas Bazin committed
487
  AC_HELP_STRING(--with-dvbpsi-tree=PATH, libdvbpsi tree for static linking))
Sam Hocevar's avatar
Sam Hocevar committed
488 489 490
  case "$with_dvbpsi" in
  ""|yes|no)
    if test "$with_dvbpsi_tree" = ""
491
    then
492
      AC_CHECK_HEADERS(dvbpsi/dvbpsi.h,
493
        [ VLS_LIB="${VLS_LIB} -ldvbpsi"],
494 495 496 497
        [ AC_MSG_ERROR([cannot find libdvbpsi headers]) ])
    else
      AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
      real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
Sam Hocevar's avatar
Sam Hocevar committed
498
      if test "$real_dvbpsi_tree" = ""
499 500 501 502 503 504 505 506 507 508
      then
        dnl  The given directory can't be found
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
      fi
      if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
      then
        dnl  Use a custom libdvbpsi
        AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
        VLS_LIB="${VLS_LIB} ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
509 510
        CXXFLAGS="${CXXFLAGS} -I${real_dvbpsi_tree}"
        CPPFLAGS="${CPPFLAGS} -I${real_dvbpsi_tree}"
511 512 513 514 515 516 517 518 519
      else
        dnl  The given libdvbpsi wasn't built
        AC_MSG_RESULT(no)
        AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
      fi
    fi
  ;;
  *)
    AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
Sam Hocevar's avatar
Sam Hocevar committed
520
    if test "$with_dvbpsi" = ""
521 522 523 524 525 526 527
    then
      test_LDFLAGS=""
      test_CFLAGS=""
    else
      test_LDFLAGS="-L${with_dvbpsi}/lib"
      test_CFLAGS="-I${with_dvbpsi}/include"
    fi
528
    save_CPPFLAGS=$CPPFLAGS
529
    CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
530
    AC_CHECK_HEADERS([dvbpsi/dvbpsi.h],[
531 532 533
      VLS_LIB="${VLS_LIB} ${test_LDFLAGS} -ldvbpsi"
      CXXFLAGS="${CXXFLAGS} ${test_CFLAGS}"
      CPPFLAGS="${CPPFLAGS} ${test_CFLAGS}"
534 535 536 537 538 539
      ],[
      AC_MSG_ERROR([Could not find libdvbpsi on your system: you may get it from www.videolan.org, you'll need at least version 0.1.1])
    ])
    CPPFLAGS="$save_CPPFLAGS"
  ;;
  esac
540 541
fi

542 543 544
dnl Extra manager functions
AC_ARG_WITH(extrafunc,
 AC_HELP_STRING(--with-extrafunc=FILE, File containing extra functions definitions))
Sam Hocevar's avatar
Sam Hocevar committed
545
    if test "$with_extrafunc" = ""
546
    then
Tristan Leteurtre's avatar
Tristan Leteurtre committed
547
      MANAGER_EXTRA_FLAG="-DMANAGER_EXTRA='\"manager_backwardcomp.cpp\"'"
548 549 550 551
    else
      MANAGER_EXTRA_FLAG="-DMANAGER_EXTRA='\"${with_extrafunc}\"'"
    fi

552 553 554 555 556 557 558 559
AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Server ${VERSION} (" __DATE__ ") - (c) 1999-2003 VideoLAN", [Copyright string])
AM_CONDITIONAL(NEEDSRC_core, test "${NEEDSRC_core}" = "1")
AM_CONDITIONAL(NEEDSRC_server, test "${NEEDSRC_server}" = "1")
AM_CONDITIONAL(NEEDSRC_daemon, test "${NEEDSRC_daemon}" = "1")
AM_CONDITIONAL(NEEDSRC_mpegbase, test "${NEEDSRC_mpegbase}" = "1")
AM_CONDITIONAL(NEEDSRC_mpegmux, test "${NEEDSRC_mpegmux}" = "1")
AM_CONDITIONAL(NEEDSRC_getopt, test "${NEEDSRC_getopt}" = "1")
AM_CONDITIONAL(UNTRUE, false)
560

Sam Hocevar's avatar
Sam Hocevar committed
561 562 563 564 565
dnl 
dnl  Configuration is finished
dnl
AC_SUBST(SYS)
AC_SUBST(ARCH)
566

567 568
AC_SUBST(BUILTINS)
AC_SUBST(PLUGINS)
Sam Hocevar's avatar
Sam Hocevar committed
569

570 571 572
AC_SUBST(DVBINPUT_LIBADD)
AC_SUBST(DVBINPUT_CXXFLAGS)
AC_SUBST(DVBINPUT_CPPFLAGS)
Sam Hocevar's avatar
Sam Hocevar committed
573

574
AC_SUBST(DVDREADER_LIBADD)
Sam Hocevar's avatar
Sam Hocevar committed
575

576 577 578
AC_SUBST(TCPINPUT_LIBADD)
AC_SUBST(TCPINPUT_CXXFLAGS)
AC_SUBST(TCPINPUT_CPPFLAGS)
Sam Hocevar's avatar
Sam Hocevar committed
579

580 581 582
AC_SUBST(TCPREADER_LIBADD)
AC_SUBST(TCPREADER_CXXFLAGS)
AC_SUBST(TCPREADER_CPPFLAGS)
583

584 585 586
AC_SUBST(ASIINPUT_LIBADD)
AC_SUBST(ASIINPUT_CXXFLAGS)
AC_SUBST(ASIINPUT_CPPFLAGS)
Tristan Leteurtre's avatar
Tristan Leteurtre committed
587

588 589 590
AC_SUBST(ASIREADER_LIBADD)
AC_SUBST(ASIREADER_CXXFLAGS)
AC_SUBST(ASIREADER_CPPFLAGS)
591

Tristan Leteurtre's avatar
Tristan Leteurtre committed
592 593 594
AC_SUBST(RAW2TS_LIBADD)
AC_SUBST(RAW2TS_CXXFLAGS)
AC_SUBST(RAW2TS_CPPFLAGS)
595

596
AC_SUBST(MANAGER_EXTRA_FLAG)
Sam Hocevar's avatar
Sam Hocevar committed
597
AC_SUBST(VLS_LIB)
598 599 600 601 602 603 604
AC_SUBST(VLS_LDFLAGS)

AC_OUTPUT([
  Makefile
  autotools/Makefile
  debian/Makefile
  doc/Makefile
605
  doc/developer/Makefile
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
  src/Makefile
  src/modules/Makefile
  src/modules/asiinput/Makefile
  src/modules/asireader/Makefile
  src/modules/dummyinterface/Makefile
  src/modules/dvbinput/Makefile
  src/modules/dvbreader/Makefile
  src/modules/dvdreader/Makefile
  src/modules/filechannel/Makefile
  src/modules/filereader/Makefile
  src/modules/localinput/Makefile
  src/modules/nativeinterface/Makefile
  src/modules/netchannel/Makefile
  src/modules/normaltrickplay/Makefile
  src/modules/ps2ts/Makefile
  src/modules/pvrreader/Makefile
  src/modules/raw2ts/Makefile
  src/modules/tcpinput/Makefile
  src/modules/tcpreader/Makefile
  src/modules/telnetinterface/Makefile
  src/modules/ts2ts/Makefile
Tristan Leteurtre's avatar
Tristan Leteurtre committed
627
  src/modules/unixinterface/Makefile
628 629 630 631
  src/modules/v4linput/Makefile
  src/modules/v4lreader/Makefile
  src/modules/videoinput/Makefile
])
Sam Hocevar's avatar
Sam Hocevar committed
632 633 634 635

echo "
global configuration
--------------------
636 637 638 639
system                  : ${SYS}
architecture            : ${ARCH}
debug                   : ${DEBUG}
profiling               : ${PROFILING}
Sam Hocevar's avatar
Sam Hocevar committed
640 641 642

vls configuration
-----------------
643
vls version             : ${VERSION}
644
debug mode              : ${DEBUG}
645 646
system logging          : ${SYSLOG}
daemon mode             : ${DAEMON}
647 648
built-in modules        : ${BUILTINS}
plug-in modules         : ${PLUGINS}
Sam Hocevar's avatar
Sam Hocevar committed
649 650
"