dnl Autoconf settings for vls AC_PREREQ(2.52) AC_INIT(src/core/core.h) AC_CONFIG_HEADER(src/core/defs.h) AC_CANONICAL_SYSTEM VLS_VERSION=0.5.6 AC_SUBST(VLS_VERSION) dnl Main sources default NEEDSRC_core=1 NEEDSRC_server=1 NEEDSRC_daemon=1 NEEDSRC_mpegbase=1 NEEDSRC_mpegmux=1 NEEDSRC_getopt=0 dnl Save CXXFLAGS and LDFLAGS save_CXXFLAGS="${CXXFLAGS}" save_LDFLAGS="${LDFLAGS}" dnl Check for tools AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CXX AC_PROG_CXXCPP AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(AR, ar, :) dnl Set default language AC_LANG(C++) dnl AM_PROG_LIBTOOL AC_PROG_INSTALL dnl dnl Endianness check dnl AC_C_BIGENDIAN dnl Check for standard functions AC_CHECK_FUNCS(gettimeofday select strerror strtol) AC_CHECK_FUNCS(opendir usleep sigaction) 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" ) 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" )]) have_nanosleep=0 AC_CHECK_FUNC(nanosleep,have_nanosleep=1,[AC_CHECK_LIB(rt,nanosleep, [VLS_LIB="${VLS_LIB} -lrt"; have_nanosleep=1] ,[AC_CHECK_LIB(posix4,nanosleep, [VLS_LIB="${VLS_LIB} -lposix4"; have_nanosleep=1] )])]) if test x$have_nanosleep = x1; then AC_DEFINE(HAVE_NANOSLEEP, 1, Define if nanosleep is available.) fi 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 defines nanosleep.) ]) dnl Check for pthreads - borrowed from XMMS THREAD_LIB=error if test "x${THREAD_LIB}" = xerror; then AC_CHECK_LIB(pthread,pthread_attr_init,THREAD_LIB="-lpthread") fi if test "x${THREAD_LIB}" = xerror; then AC_CHECK_LIB(pthreads,pthread_attr_init,THREAD_LIB="-lpthreads") fi if test "x${THREAD_LIB}" = xerror; then AC_CHECK_LIB(c_r,pthread_attr_init,THREAD_LIB="-lc_r") fi if test "x${THREAD_LIB}" = xerror; then 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 defines pthread_cond_t.)]) AC_EGREP_HEADER(struct ifreq,net/if.h,[ AC_DEFINE(STRUCT_IFREQ_IN_NET_IF_H, 1, Define if defines struct ifreq.)]) AC_EGREP_HEADER(struct iovec,sys/uio.h,[ AC_DEFINE(STRUCT_IOVEC_IN_SYS_UIO_H, 1, Define if defines struct iovec.)]) AC_EGREP_HEADER(strncasecmp,strings.h,[ AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1, Define if defines strncasecmp.)]) AC_EGREP_HEADER(getprotobyname,netdb.h,[ AC_DEFINE(GETPROTOBYNAME_IN_NETDB_H, 1, Define if defines getprotobyname.)]) dnl Check for headers AC_CHECK_HEADERS(stdint.h inttypes.h) AC_CHECK_HEADERS(stddef.h strings.h) AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h) AC_CHECK_HEADERS(dlfcn.h) AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h) AC_CHECK_HEADERS(crypt.h) 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], [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) VLS_LIB="${VLS_LIB} -lgnugetopt"], [need_getopt=:])]) if test x"$need_getopt" = x":"; then NEEDSRC_getopt=1 fi dnl Check for socklen_t AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, [AC_TRY_COMPILE( [#include #include ], [socklen_t len = 42; return len;], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)]) if test x$ac_cv_type_socklen_t != xno; then AC_DEFINE(HAVE_SOCKLEN_T, 1, Define if defines socklen_t.) fi dnl IPv6 support 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 dnl Check for SO_BINDTODEVICE AC_CACHE_CHECK([whether setsockopt accepts SO_BINDTODEVICE], [ac_cv_c_so_bindtodevice], [CXXFLAGS="${save_CXXFLAGS} -Wall -Werror" AC_TRY_COMPILE([#include #include ], [int optname(void) { return SO_BINDTODEVICE; }], 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 Check for standard plugin linking flags AC_CACHE_CHECK([if \$CXX accepts -shared], [ac_cv_ld_plugins], [CXXFLAGS="${save_CXXFLAGS} -shared" AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)]) if test x"$ac_cv_ld_plugins" != x"no"; then MODULE_LCFLAGS="${MODULE_LCFLAGS} -shared" fi dnl Check for Darwin plugin linking flags AC_CACHE_CHECK([if \$CXX accepts -bundle -undefined error -lcc_dynamic], [ac_cv_ld_darwin], [CXXFLAGS="${CXXFLAGS_save} -bundle -undefined error -lcc_dynamic" AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)]) if test "x${ac_cv_ld_darwin}" != "xno"; then MODULE_LCFLAGS="${MODULE_LCFLAGS} -bundle -undefined error -lcc_dynamic" fi AC_CACHE_CHECK([if \$CXX accepts -rdynamic], [ac_cv_ld_rdynamic], [CXXFLAGS="${save_CXXFLAGS} -rdynamic" AC_TRY_COMPILE([],, ac_cv_ld_rdynamic=yes, ac_cv_ld_rdynamic=no)]) if test x"$ac_cv_ld_rdynamic" != x"no"; then VLS_LCFLAGS="${VLS_LCFLAGS} -rdynamic" fi dnl End of the bizarre compilation tests CXXFLAGS="${save_CXXFLAGS}" 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 EXEEXT="" case ${target_os} in bsdi*) SYS=bsdi ;; darwin*) SYS=darwin ;; *mingw32*) SYS=mingw32 EXEEXT=".exe" VLS_LIB="${VLS_LIB} -lws2_32" ;; *) SYS=${target_os} ;; esac dnl dnl Check the architecture dnl ARCH=${target_cpu} dnl dnl default modules dnl BUILTINS="${BUILTINS} filechannel netchannel filereader ts2ts ps2ts localinput videoinput" dnl dnl Debugging mode dnl DEBUG=0 AC_ARG_ENABLE(debug, AC_HELP_STRING(--enable-debug, Enable debug mode (default disabled)), [ if test x$enableval = xno; then DEBUG=0; else DEBUG=1; fi ]) dnl dnl Profiling mode dnl PROFILING=0 AC_ARG_ENABLE(profiling, AC_HELP_STRING(--enable-profiling, Enable profiling mode (default disabled)), [ if test x$enableval = xyes; then PROFILING=1; fi ]) dnl dnl SYSLOG dnl AC_CHECK_HEADERS(syslog.h, SYSLOG=1, SYSLOG=0) AC_ARG_ENABLE(syslog, [ --disable-syslog Logging using syslogd (default enable)], [ if test x$enableval = xno then SYSLOG=0 fi]) if test x$enable_syslog = xyes then if test ${SYSLOG} = 0 then AC_MSG_ERROR([Could not find syslog.h. You can alternately configure using --disable-syslog]) fi fi dnl dnl Daemon mode dnl AC_ARG_ENABLE(daemon, [ --disable-daemon Disable daemon mode (default enabled)]) if test x$enable-daemon = xyes 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 else NEEDSRC_daemon=1 DAEMON=1 fi elif test x$enable-daemon = xno then DAEMON=0 NEEDSRC_daemon=0 fi dnl dnl DVD module dnl AC_ARG_ENABLE(dvd, AC_HELP_STRING(--disable-dvd, DVD support (default enabled))) AC_ARG_WITH(dvdread, AC_HELP_STRING(--with-dvdread=[PATH], path to libdvdread)) if test x$enable_dvd != xno then if test "x$with_dvdread" != x then test_CFLAGS="-I${with_dvdread}/include" fi save_CPPFLAGS=$CPPFLAGS save_CFLAGS=$CFLAGS CPPFLAGS="$save_CPPFLAGS $test_CFLAGS $DVBINPUT_CCFLAGS" AC_CHECK_HEADER(dvdread/dvd_reader.h, HAVE_LIBDVDREAD=1, HAVE_LIBDVDREAD=0) if test ${HAVE_LIBDVDREAD} = 1 then if test ${SYS} != mingw32 && test ${SYS} != darwin then PLUGINS="${PLUGINS} dvdreader" DVDREADER_LIB="${DVDREADER_LIB} -ldvdread -L${with_dvdread}/lib" else BUILTINS="${BUILTINS} dvdreader" DVDREADER_LIB="${DVDREADER_LIB} -ldvdread -ldvdcss -L${with_dvdread}/lib" fi 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 CPPFLAGS="$save_CPPFLAGS" fi dnl dnl DVB module dnl AC_ARG_ENABLE(dvb, AC_HELP_STRING(--enable-dvb, DVB support (default disabled))) AC_ARG_WITH(dvb, AC_HELP_STRING(--with-dvb=[PATH], path to DVB driver header files)) AC_ARG_WITH(dvb, AC_HELP_STRING(--with-libdvb=[PATH], path to libdvb)) if test "$enable_dvb" = "yes" then dnl Test for driver header files AC_MSG_CHECKING(for dvbdriver headers in ${with_dvb}) if test "x$with_dvb" = x then test_CFLAGS="" else test_CFLAGS="-I${with_dvb}/include" fi save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$save_CPPFLAGS $test_CFLAGS" AC_CHECK_HEADERS([linux/dvb/frontend.h], [DVBINPUT_CCFLAGS="${DVBINPUT_CCFLAGS} ${test_CFLAGS}" DVBINPUT_DCFLAGS="${DVBINPUT_DCFLAGS} ${test_CFLAGS}"], [AC_MSG_ERROR([Could not find dvbdriver on your system: you may get it from http://www.linuxtv.org/])]) CPPFLAGS="$save_CPPFLAGS" dnl Test for the libdvb library AC_MSG_CHECKING(for libdvb headers in ${with_libdvb}) if test "$with_libdvb" != "" then test_CFLAGS="-I${with_libdvb}/include -I${with_libdvb}" fi save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$save_CPPFLAGS $test_CFLAGS $DVBINPUT_CCFLAGS" AC_CHECK_HEADERS([DVB.hh],[ DVBINPUT_CCFLAGS="${DVBINPUT_CCFLAGS} ${test_CFLAGS}" ],[ 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" dnl Test for the lib existence if test -f "${with_libdvb}/lib/libdvb.a" then DVBINPUT_LIB="${DVBINPUT_LIB} -ldvb" DVBINPUT_DCFLAGS="${DVBINPUT_DCFLAGS} -I${with_libdvb}/include" DVBINPUT_LCFLAGS="${DVBINPUT_LCFLAGS} -L${with_libdvb}/lib" PLUGINS="${PLUGINS} dvbinput dvbreader" else AC_MSG_ERROR([cannot find ${with_libdvb}/libdvb.a, make sure you compiled libdvb in ${with_libdvb}]) fi fi dnl dnl Main sources checks dnl dnl dnl libdvbpsi dnl if test ${NEEDSRC_mpegmux} = 1 then AC_ARG_WITH(dvbpsi, AC_HELP_STRING(--with-dvbpsi=PATH, libdvbpsi headers and libraries)) AC_ARG_WITH(dvbpsi, AC_HELP_STRING(--with-dvbpsi-tree=PATH, libdvbpsi tree for static linking)) case "x$with_dvbpsi" in x|xyes|xno) if test "x$with_dvbpsi_tree" = x then AC_CHECK_HEADERS(dvbpsi/dvbpsi.h, [ VLS_LIB="${VLS_LIB} -ldvbpsi"], [ 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`" if test "x$real_dvbpsi_tree" = x 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" CCFLAGS="${CCFLAGS} -I${real_dvbpsi_tree}" DCFLAGS="${DCFLAGS} -I${real_dvbpsi_tree}" 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}) if test "x$with_dvbpsi" = x then test_LDFLAGS="" test_CFLAGS="" else test_LDFLAGS="-L${with_dvbpsi}/lib" test_CFLAGS="-I${with_dvbpsi}/include" fi save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$save_CPPFLAGS $test_CFLAGS" AC_CHECK_HEADERS([dvbpsi/dvbpsi.h],[ VLS_LIB="${VLS_LIB} -ldvbpsi -L${with_dvbpsi}/lib" CCFLAGS="${CCFLAGS} ${test_CFLAGS}" DCFLAGS="${DCFLAGS} ${test_CFLAGS}" ],[ 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 fi dnl dnl Configuration is finished dnl AC_SUBST(SYS) AC_SUBST(ARCH) AC_SUBST(NEEDSRC_core) AC_SUBST(NEEDSRC_server) AC_SUBST(NEEDSRC_daemon) AC_SUBST(NEEDSRC_mpegbase) AC_SUBST(NEEDSRC_mpegmux) AC_SUBST(NEEDSRC_getopt) AC_SUBST(BUILTINS) AC_SUBST(PLUGINS) AC_SUBST(DEBUG) AC_SUBST(PROFILING) AC_SUBST(SYSLOG) AC_SUBST(EXEEXT) AC_SUBST(CCFLAGS) AC_SUBST(DCFLAGS) AC_SUBST(LCFLAGS) AC_SUBST(MODULE_LCFLAGS) AC_SUBST(DVDREADER_LIB) AC_SUBST(DVBINPUT_LIB) AC_SUBST(DVBINPUT_CCFLAGS) AC_SUBST(DVBINPUT_DCFLAGS) AC_SUBST(DVBINPUT_LCFLAGS) AC_SUBST(VLS_LCFLAGS) AC_SUBST(VLS_LIB) AC_OUTPUT([Makefile.opts src/server/config.h]) echo " global configuration -------------------- system : ${SYS} architecture : ${ARCH} debug : ${DEBUG} profiling : ${PROFILING} vls configuration ----------------- vls version : ${VLS_VERSION} debug mode : ${DEBUG} system logging : ${SYSLOG} daemon mode : ${DAEMON} built-in modules : ${BUILTINS} plug-in modules : ${PLUGINS} "