"Fossies" - the Fresh Open Source Software Archive

Member "minidlna-1.3.0/configure.ac" (24 Nov 2020, 22638 Bytes) of package /linux/privat/minidlna-1.3.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 1.2.1_vs_1.3.0.

    1 # This file is part of MiniDLNA.
    2 #
    3 # MiniDLNA is free software; you can redistribute it and/or modify it
    4 # under the terms of the GNU Lesser General Public License as
    5 # published by the Free Software Foundation; either version 2 of the
    6 # License, or (at your option) any later version.
    7 #
    8 # MiniDLNA is distributed in the hope that it will be useful, but WITHOUT
    9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
   11 # License for more details.
   12 #
   13 # You should have received a copy of the GNU Lesser General Public
   14 # License along with MiniDLNA; if not, write to the Free Software
   15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   16 # USA.
   17 AC_INIT(MiniDLNA,1.1.3,,minidlna)
   18 #LT_INIT
   19 
   20 AC_CANONICAL_TARGET
   21 AM_INIT_AUTOMAKE([subdir-objects])
   22 AC_CONFIG_HEADERS([config.h])
   23 AM_SILENT_RULES([yes])
   24 
   25 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_USE_SYSTEM_EXTENSIONS])
   26 
   27 #MiniDLNA
   28 
   29 AM_ICONV
   30 AM_GNU_GETTEXT([external])
   31 AM_GNU_GETTEXT_VERSION(0.18)
   32 
   33 # Checks for programs.
   34 AC_PROG_AWK
   35 AC_PROG_CC
   36 AM_PROG_CC_C_O
   37 AC_PROG_INSTALL
   38 AC_PROG_LN_S
   39 AC_PROG_MAKE_SET
   40 
   41 # Default string definitions
   42 AC_DEFINE_UNQUOTED([OS_URL],"http://sourceforge.net/projects/minidlna/",[OS URL])
   43 AC_DEFINE_UNQUOTED([ROOTDEV_MANUFACTURER],"Justin Maggard", [Manufacturer])
   44 AC_DEFINE_UNQUOTED([ROOTDEV_MANUFACTURERURL],"http://www.netgear.com/", [Manufacturer URL])
   45 AC_DEFINE_UNQUOTED([ROOTDEV_MODELNAME],"Windows Media Connect compatible (MiniDLNA)", [Model name])
   46 AC_DEFINE_UNQUOTED([ROOTDEV_MODELDESCRIPTION],"MiniDLNA on " OS_NAME, [Model description])
   47 AC_DEFINE_UNQUOTED([ROOTDEV_MODELURL],OS_URL,[Model URL])
   48 
   49 
   50 ################################################################################################################
   51 # Checks for typedefs, structures, and compiler characteristics.
   52 AC_C_INLINE
   53 AC_TYPE_MODE_T
   54 AC_TYPE_OFF_T
   55 AC_TYPE_PID_T
   56 AC_TYPE_SIZE_T
   57 m4_ifdef([AC_TYPE_UINT8_T], [AC_TYPE_UINT8_T])
   58 m4_ifdef([AC_TYPE_INT32_T], [AC_TYPE_INT32_T])
   59 m4_ifdef([AC_TYPE_UINT32_T], [AC_TYPE_UINT32_T])
   60 m4_ifdef([AC_TYPE_UINT64_T], [AC_TYPE_UINT64_T])
   61 m4_ifdef([AC_TYPE_SSIZE_T], [AC_TYPE_SSIZE_T])
   62 AC_STRUCT_DIRENT_D_TYPE
   63 AC_STRUCT_ST_BLOCKS
   64 AC_HEADER_STDBOOL
   65 AC_C_BIGENDIAN
   66 
   67 # Checks for library functions.
   68 AC_FUNC_FORK
   69 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
   70 AC_CHECK_FUNCS([gethostname getifaddrs gettimeofday inet_ntoa memmove memset mkdir realpath select sendfile setlocale socket strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul])
   71 AC_CHECK_DECLS([SEEK_HOLE])
   72 AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [use clock_gettime])],)
   73 
   74 #
   75 # Check for struct ip_mreqn
   76 #
   77 AC_MSG_CHECKING(for struct ip_mreqn)
   78 AC_TRY_COMPILE([#include <netinet/in.h>], [
   79     struct ip_mreqn mreq;
   80     mreq.imr_address.s_addr = 0;
   81 ], [
   82     # Yes, we have it...
   83     AC_MSG_RESULT(yes)
   84     AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
   85 ], [
   86     # We'll just have to try and use struct ip_mreq
   87     AC_MSG_RESULT(no)
   88     AC_MSG_CHECKING(for struct ip_mreq)
   89     AC_TRY_COMPILE([#include <netinet/in.h>], [
   90         struct ip_mreq mreq;
   91         mreq.imr_interface.s_addr = 0;
   92     ], [
   93         # Yes, we have it...
   94         AC_MSG_RESULT(yes)
   95         AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
   96     ], [
   97         # No multicast support
   98         AC_MSG_ERROR([No multicast support])
   99     ])
  100 ])
  101 
  102 ################################################################################################################
  103 # Special include directories
  104 case $host in
  105     *-*-darwin*)
  106         DARWIN_OS=1
  107         SEARCH_DIR="/opt/local"
  108         INCLUDE_DIR="$SEARCH_DIR/include"
  109         ;;
  110     *-*-solaris*)
  111         AC_DEFINE([SOLARIS], [1], [we are on solaris])
  112         ;;
  113     *-*-cygwin*)
  114         CYGWIN_OS=1
  115         ;;
  116     *-*-freebsd*)
  117         FREEBSD_OS=1
  118         ;;
  119     *-*-openbsd*)
  120         OPENBSD_OS=1
  121         ;;
  122     *-*-linux*)
  123         if test -f /etc/redhat-release; then
  124             INCLUDE_DIR="/usr/include/ffmpeg"
  125         fi
  126         ;;
  127 esac
  128 
  129 AC_CHECK_HEADERS(syscall.h sys/syscall.h mach/mach_time.h)
  130 AC_MSG_CHECKING([for __NR_clock_gettime syscall])
  131 AC_COMPILE_IFELSE(
  132     [AC_LANG_PROGRAM(
  133         [
  134             #include <asm/unistd.h>
  135         ],
  136         [
  137             #ifndef __NR_clock_gettime
  138             #error
  139             #endif
  140         ]
  141     )],
  142     [
  143         AC_MSG_RESULT([yes])
  144         AC_DEFINE([HAVE_CLOCK_GETTIME_SYSCALL], [1], [Whether the __NR_clock_gettime syscall is defined])
  145     ],
  146     [
  147         AC_MSG_RESULT([no])
  148     ])
  149 
  150 AC_CHECK_HEADER(linux/netlink.h,
  151     [AC_DEFINE([HAVE_NETLINK],[1],[Support for Linux netlink])], [], [#include <sys/socket.h>])
  152 
  153 ################################################################################################################
  154 ### Library checks
  155 
  156 CPPFLAGS_SAVE="$CPPFLAGS"
  157 for dir in "" /usr/local $INCLUDE_DIR; do
  158     if test -n "$dir"; then
  159         CPPFLAGS="$CPPFLAGS_SAVE -I$dir"
  160     fi
  161     AC_CHECK_HEADERS([libavutil/avutil.h ffmpeg/libavutil/avutil.h libav/libavutil/avutil.h avutil.h ffmpeg/avutil.h libav/avutil.h], [HAVE_LIBAVUTIL=1])
  162     if test -z "$HAVE_LIBAVUTIL"; then
  163         unset ac_cv_header_avutil_h
  164         unset ac_cv_header_libavutil_avutil_h
  165         unset ac_cv_header_ffmpeg_avutil_h
  166         unset ac_cv_header_ffmpeg_libavutil_avutil_h
  167         unset ac_cv_header_libav_avutil_h
  168         unset ac_cv_header_libav_libavutil_avutil_h
  169         continue
  170     fi
  171     break
  172 done
  173 if test -z "$HAVE_LIBAVUTIL"; then
  174     AC_MSG_ERROR([libavutil headers not found or not usable])
  175 fi
  176 
  177 CPPFLAGS_SAVE="$CPPFLAGS"
  178 for dir in "" /usr/local $INCLUDE_DIR; do
  179     if test -n "$dir"; then
  180         CPPFLAGS="$CPPFLAGS_SAVE -I$dir"
  181     fi
  182     AC_CHECK_HEADERS([libavcodec/avcodec.h ffmpeg/libavcodec/avcodec.h libav/libavcodec/avcodec.h avcodec.h ffmpeg/avcodec.h libav/avcodec.h], [HAVE_LIBAVCODEC=1])
  183     if test -z "$HAVE_LIBAVCODEC"; then
  184         unset ac_cv_header_avcodec_h
  185         unset ac_cv_header_libavcodec_avcodec_h
  186         unset ac_cv_header_ffmpeg_avcodec_h
  187         unset ac_cv_header_ffmpeg_libavcodec_avcodec_h
  188         unset ac_cv_header_libav_avcodec_h
  189         unset ac_cv_header_libav_libavcodec_avcodec_h
  190         continue
  191     fi
  192     break
  193 done
  194 if test -z "$HAVE_LIBAVCODEC"; then
  195     AC_MSG_ERROR([libavcodec headers not found or not usable])
  196 fi
  197 
  198 CPPFLAGS_SAVE="$CPPFLAGS"
  199 for dir in "" /usr/local $INCLUDE_DIR; do
  200     if test -n "$dir"; then
  201         CPPFLAGS="$CPPFLAGS_SAVE -I$dir"
  202     fi
  203     AC_CHECK_HEADERS([libavformat/avformat.h ffmpeg/libavformat/avformat.h libav/libavformat/avformat.h avformat.h ffmpeg/avformat.h libav/avformat.h], [HAVE_LIBAVFORMAT=1])
  204     if test -z "$HAVE_LIBAVFORMAT"; then
  205         unset ac_cv_header_avformat_h
  206         unset ac_cv_header_libavformat_avformat_h
  207         unset ac_cv_header_ffmpeg_avformat_h
  208         unset ac_cv_header_ffmpeg_libavformat_avformat_h
  209         unset ac_cv_header_libav_avformat_h
  210         unset ac_cv_header_libav_libavformat_avformat_h
  211         continue
  212     fi
  213     break
  214 done
  215 if test -z "$HAVE_LIBAVFORMAT"; then
  216     AC_MSG_ERROR([libavformat headers not found or not usable])
  217 fi
  218 
  219 CPPFLAGS_SAVE="$CPPFLAGS"
  220 for dir in "" /usr/local $INCLUDE_DIR; do
  221     if test -n "$dir"; then
  222         CPPFLAGS="$CPPFLAGS -I$dir"
  223     fi
  224     AC_CHECK_HEADERS([jpeglib.h sqlite3.h libexif/exif-loader.h id3tag.h ogg/ogg.h vorbis/codec.h FLAC/metadata.h],,[unset $as_ac_Header; break],)
  225     if test x"$ac_cv_header_jpeglib_h" != x"yes"; then
  226         CPPFLAGS="$CPPFLAGS_SAVE"
  227         continue
  228     elif test x"$ac_cv_header_sqlite3_h" != x"yes"; then
  229         CPPFLAGS="$CPPFLAGS_SAVE"
  230         continue
  231     elif test x"$ac_cv_header_libexif_exif_loader_h" != x"yes"; then
  232         CPPFLAGS="$CPPFLAGS_SAVE"
  233         continue
  234     elif test x"$ac_cv_header_id3tag_h" != x"yes"; then
  235         CPPFLAGS="$CPPFLAGS_SAVE"
  236         continue
  237     elif test x"$ac_cv_header_ogg_ogg_h" != x"yes"; then
  238         CPPFLAGS="$CPPFLAGS_SAVE"
  239         continue
  240     elif test x"$ac_cv_header_vorbis_codec_h" != x"yes"; then
  241         CPPFLAGS="$CPPFLAGS_SAVE"
  242         continue
  243     elif test x"$ac_cv_header_FLAC_metadata_h" != x"yes"; then
  244         CPPFLAGS="$CPPFLAGS_SAVE"
  245         continue
  246     else
  247         break;
  248     fi
  249 done
  250 test x"$ac_cv_header_jpeglib_h" != x"yes" && AC_MSG_ERROR([libjpeg headers not found or not usable])
  251 test x"$ac_cv_header_sqlite3_h" != x"yes" && AC_MSG_ERROR([libsqlite3 headers not found or not usable])
  252 test x"$ac_cv_header_libexif_exif_loader_h" != x"yes" && AC_MSG_ERROR([libexif headers not found or not usable])
  253 test x"$ac_cv_header_id3tag_h" != x"yes" && AC_MSG_ERROR([libid3tag headers not found or not usable])
  254 test x"$ac_cv_header_ogg_ogg_h" != x"yes" && AC_MSG_ERROR([libogg headers not found or not usable])
  255 test x"$ac_cv_header_vorbis_codec_h" != x"yes" && AC_MSG_ERROR([libvorbis headers not found or not usable])
  256 test x"$ac_cv_header_FLAC_metadata_h" != x"yes" && AC_MSG_ERROR([libFLAC headers not found or not usable])
  257 
  258 CFLAGS_SAVE="$CFLAGS"
  259 CFLAGS="$CFLAGS -Wall -Werror"
  260 AC_MSG_CHECKING([if we should use the daemon() libc function])
  261 AC_COMPILE_IFELSE(
  262      [AC_LANG_PROGRAM(
  263          [
  264              #include <stdlib.h>
  265              #include <unistd.h>
  266          ],
  267          [
  268             return daemon(0, 0);
  269          ]
  270      )],
  271      [
  272          AC_DEFINE([USE_DAEMON], [1], 
  273                    [use the system's builtin daemon()])
  274          AC_MSG_RESULT([yes])
  275      ],
  276      [
  277          AC_MSG_RESULT([no])
  278      ])
  279 
  280 AC_MSG_CHECKING([if scandir declaration requires const char cast])
  281 AC_COMPILE_IFELSE(
  282      [AC_LANG_PROGRAM(
  283          [
  284              #include <stdlib.h>
  285              #include <sys/types.h>
  286              #include <dirent.h>
  287          ],
  288          [
  289             int filter(struct dirent *d);
  290             struct dirent **ptr = NULL;
  291             char *name = NULL;
  292             (void)scandir(name, &ptr, filter, alphasort);
  293          ]
  294      )],
  295      [
  296          AC_MSG_RESULT([no])
  297      ],
  298      [
  299          AC_DEFINE([SCANDIR_CONST], [1], 
  300                    [scandir needs const char cast])
  301 
  302          AC_MSG_RESULT([yes])
  303      ])
  304 
  305 AC_MSG_CHECKING([for linux sendfile support])
  306 AC_COMPILE_IFELSE(
  307      [AC_LANG_PROGRAM(
  308          [
  309              #include <sys/types.h>
  310              #include <sys/sendfile.h>
  311          ],
  312          [
  313              int tofd = 0, fromfd = 0;
  314              off_t offset;
  315              size_t total = 0;
  316              ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
  317              return nwritten;
  318          ]
  319      )],
  320      [
  321          AC_MSG_RESULT([yes])
  322          AC_DEFINE([HAVE_LINUX_SENDFILE_API], [1], [Whether linux sendfile() API is available])
  323      ],
  324      [
  325          AC_MSG_RESULT([no])
  326      ])
  327 
  328 AC_MSG_CHECKING([for darwin sendfile support])
  329 AC_COMPILE_IFELSE(
  330      [AC_LANG_PROGRAM(
  331          [
  332              #include <stdlib.h>
  333              #include <sys/types.h>
  334              #include <sys/socket.h>
  335              #include <sys/uio.h>
  336          ],
  337          [
  338              int fd = 0, s = 0;
  339              off_t offset = 0, len;
  340              struct sf_hdtr *hdtr = NULL;
  341              int flags = 0;
  342              int ret;
  343              ret = sendfile(fd, s, offset, &len, hdtr, flags);
  344              return ret;
  345          ]
  346      )],
  347      [
  348          AC_MSG_RESULT([yes])
  349          AC_DEFINE([HAVE_DARWIN_SENDFILE_API], [1], [Whether darwin sendfile() API is available])
  350      ],
  351      [
  352          AC_MSG_RESULT([no])
  353      ])
  354 
  355 AC_MSG_CHECKING([for freebsd sendfile support])
  356 AC_COMPILE_IFELSE(
  357      [AC_LANG_PROGRAM(
  358          [
  359              #include <stdlib.h>
  360              #include <sys/types.h>
  361              #include <sys/socket.h>
  362              #include <sys/uio.h>
  363          ],
  364          [
  365              int fromfd=0, tofd=0, ret, total=0;
  366              off_t offset=0, nwritten;
  367              struct sf_hdtr hdr;
  368              struct iovec hdtrl;
  369              hdr.headers = &hdtrl;
  370              hdr.hdr_cnt = 1;
  371              hdr.trailers = NULL;
  372              hdr.trl_cnt = 0;
  373              hdtrl.iov_base = NULL;
  374              hdtrl.iov_len = 0;
  375              ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
  376          ]
  377      )],
  378      [
  379          AC_MSG_RESULT([yes])
  380          AC_DEFINE([HAVE_FREEBSD_SENDFILE_API], [1], [Whether freebsd sendfile() API is available])
  381      ],
  382      [
  383          AC_MSG_RESULT([no])
  384      ])
  385 CFLAGS="$CFLAGS_SAVE"
  386 
  387 LDFLAGS_SAVE="$LDFLAGS"
  388 for dir in "" /usr/local $SEARCH_DIR; do
  389     if test -n "$dir"; then
  390         LDFLAGS="$LDFLAGS -L$dir/lib"
  391     fi
  392     AC_CHECK_LIB([jpeg], [jpeg_set_defaults], [LIBJPEG_LIBS="-ljpeg"], [unset ac_cv_lib_jpeg_jpeg_set_defaults; LDFLAGS="$LDFLAGS_SAVE"; continue])
  393     break
  394 done
  395 test x"$ac_cv_lib_jpeg_jpeg_set_defaults" = x"yes" || AC_MSG_ERROR([Could not find libjpeg])
  396 AC_SUBST(LIBJPEG_LIBS)
  397 
  398 LDFLAGS_SAVE="$LDFLAGS"
  399 for dir in "" /usr/local $SEARCH_DIR; do
  400     if test -n "$dir"; then
  401         LDFLAGS="$LDFLAGS -L$dir/lib"
  402     fi
  403     AC_CHECK_LIB([exif], [exif_data_new_from_file], [LIBEXIF_LIBS="-lexif"], [unset ac_cv_lib_exif_exif_data_new_from_file; LDFLAGS="$LDFLAGS_SAVE"; continue])
  404     break
  405 done
  406 test x"$ac_cv_lib_jpeg_jpeg_set_defaults" = x"yes" || AC_MSG_ERROR([Could not find libexif])
  407 AC_SUBST(LIBEXIF_LIBS)
  408 
  409 LDFLAGS_SAVE="$LDFLAGS"
  410 for dir in "" /usr/local $SEARCH_DIR; do
  411     if test -n "$dir"; then
  412         LDFLAGS="$LDFLAGS -L$dir/lib"
  413     fi
  414     AC_CHECK_LIB([id3tag -lz], [id3_file_open], [LIBID3TAG_LIBS="-lid3tag -lz"], [unset ac_cv_lib_id3tag_id3_file_open; LDFLAGS="$LDFLAGS_SAVE"; continue])
  415     break
  416 done
  417 test x"$ac_cv_lib_id3tag__lz___id3_file_open" = x"yes" || AC_MSG_ERROR([Could not find libid3tag])
  418 AC_SUBST(LIBID3TAG_LIBS)
  419 
  420 LDFLAGS_SAVE="$LDFLAGS"
  421 for dir in "" /usr/local $SEARCH_DIR; do
  422     if test -n "$dir"; then
  423         LDFLAGS="$LDFLAGS -L$dir/lib"
  424     fi
  425     AC_CHECK_LIB(sqlite3, sqlite3_open, [LIBSQLITE3_LIBS="-lsqlite3"], [unset ac_cv_lib_sqlite3_sqlite3_open; LDFLAGS="$LDFLAGS_SAVE"; continue])
  426     AC_CHECK_LIB(sqlite3, sqlite3_malloc, [AC_DEFINE([HAVE_SQLITE3_MALLOC], [1], [Define to 1 if the sqlite3_malloc function exists.])])
  427     AC_CHECK_LIB(sqlite3, sqlite3_prepare_v2, [AC_DEFINE([HAVE_SQLITE3_PREPARE_V2], [1], [Define to 1 if the sqlite3_prepare_v2 function exists.])])
  428     break
  429 done
  430 test x"$ac_cv_lib_sqlite3_sqlite3_open" = x"yes" || AC_MSG_ERROR([Could not find libsqlite3])
  431 AC_SUBST(LIBSQLITE3_LIBS)
  432 
  433 LDFLAGS_SAVE="$LDFLAGS"
  434 for dir in "" /usr/local $SEARCH_DIR; do
  435     if test -n "$dir"; then
  436         LDFLAGS="$LDFLAGS -L$dir/lib"
  437     fi
  438     AC_CHECK_LIB([avformat -lavcodec -lavutil -lz], [avformat_open_input], [LIBAVFORMAT_LIBS="-lavformat -lavcodec -lavutil -lz"],
  439 		 [AC_CHECK_LIB([avformat -lavcodec -lavutil -lz], [av_open_input_file], [LIBAVFORMAT_LIBS="-lavformat -lavcodec -lavutil -lz"],
  440 		  [unset ac_cv_lib_avformat_av_open_input_file; unset ac_cv_lib_avformat_avformat_open_input; LDFLAGS="$LDFLAGS_SAVE"; continue])])
  441     break
  442 done
  443 if test x"$ac_cv_lib_avformat__lavcodec__lavutil__lz___av_open_input_file" != x"yes" &&
  444    test x"$ac_cv_lib_avformat__lavcodec__lavutil__lz___avformat_open_input" != x"yes"; then
  445    AC_MSG_ERROR([Could not find libavformat - part of ffmpeg])
  446 fi
  447 AC_SUBST(LIBAVFORMAT_LIBS)
  448 
  449 AC_CHECK_LIB(pthread, pthread_create)
  450 
  451 # test if we have vorbisfile
  452 # prior versions had ov_open_callbacks in libvorbis, test that, too.
  453 AC_CHECK_LIB(vorbisfile, ov_open_callbacks,
  454         [AC_CHECK_HEADERS([vorbis/vorbisfile.h],
  455          AM_CONDITIONAL(HAVE_VORBISFILE, true)
  456          AC_DEFINE(HAVE_VORBISFILE,1,[Have vorbisfile]),
  457          AM_CONDITIONAL(HAVE_VORBISFILE, false))],
  458          AM_CONDITIONAL(HAVE_VORBISFILE, false),
  459          -lvorbis -logg)
  460 AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_stream,
  461         [AC_CHECK_HEADERS([FLAC/all.h],
  462          AM_CONDITIONAL(HAVE_FLAC, true)
  463          AC_DEFINE(HAVE_FLAC,1,[Have flac]),
  464          AM_CONDITIONAL(HAVE_FLAC, false))],
  465          AM_CONDITIONAL(HAVE_FLAC, false),
  466         -logg)
  467 # test without -logg to see whether we really need it (libflac can be without)
  468 AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_ogg_stream,
  469          AM_CONDITIONAL(HAVE_FLAC, true)
  470          AC_DEFINE(HAVE_FLAC,1,[Have flac])
  471          AM_CONDITIONAL(NEED_OGG, false),
  472         [AM_CONDITIONAL(NEED_OGG, true)])
  473 AC_CHECK_LIB(vorbisfile, vorbis_comment_query,
  474         AM_CONDITIONAL(NEED_VORBIS, false),
  475         AM_CONDITIONAL(NEED_VORBIS, true),
  476         -logg)
  477 
  478 AC_CHECK_LIB(avahi-client, avahi_threaded_poll_new,
  479         [AC_CHECK_HEADERS([avahi-common/thread-watch.h],
  480          AM_CONDITIONAL(HAVE_AVAHI, true)
  481          AC_DEFINE(HAVE_AVAHI,1,[Have avahi]),
  482          AM_CONDITIONAL(HAVE_AVAHI, false))],
  483          AM_CONDITIONAL(HAVE_AVAHI, false),
  484         -lavahi-client -lavahi-common)
  485 
  486 ################################################################################################################
  487 ### Header checks
  488 
  489 AC_CHECK_HEADERS([arpa/inet.h asm/unistd.h endian.h machine/endian.h fcntl.h libintl.h locale.h netdb.h netinet/in.h poll.h stddef.h stdlib.h string.h sys/file.h sys/inotify.h sys/ioctl.h sys/param.h sys/queue.h sys/socket.h sys/time.h unistd.h])
  490 test x"$ac_cv_header_poll_h" != x"yes" && AC_MSG_ERROR([poll.h not found or not usable])
  491 test x"$ac_cv_header_sys_queue_h" != x"yes" && AC_MSG_ERROR([sys/queue.h not found or not usable])
  492 
  493 AC_CHECK_FUNCS(inotify_init, AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel has inotify support]), [
  494     AC_MSG_CHECKING([for __NR_inotify_init syscall])
  495     AC_COMPILE_IFELSE(
  496          [AC_LANG_PROGRAM(
  497              [
  498                  #include <asm/unistd.h>
  499              ],
  500              [
  501                  #ifndef __NR_inotify_init
  502                  #error
  503                  #endif
  504              ]
  505          )],
  506          [
  507              AC_MSG_RESULT([yes])
  508              AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel has inotify support])
  509          ],
  510          [
  511              AC_MSG_RESULT([no])
  512          ])
  513 ])
  514 
  515 AC_CHECK_FUNCS(kqueue, AM_CONDITIONAL(HAVE_KQUEUE, true), AM_CONDITIONAL(HAVE_KQUEUE, false))
  516 
  517 ################################################################################################################
  518 ### Build Options
  519 
  520 AC_ARG_WITH(log-path,
  521 	AS_HELP_STRING([--with-log-path=PATH],[Default log path]),
  522 	[with_logpath="$withval"],[with_logpath="/var/log"])
  523 AC_DEFINE_UNQUOTED([DEFAULT_LOG_PATH],"${with_logpath}",[Log path])
  524 
  525 
  526 AC_ARG_WITH(db-path,
  527 	AS_HELP_STRING([--with-db-path=PATH],[Default DB path]),
  528 	[with_dbpath="$withval"],[with_dbpath="/var/cache/minidlna"])
  529 AC_DEFINE_UNQUOTED([DEFAULT_DB_PATH],"${with_dbpath}",[DB path])
  530 
  531 AC_ARG_WITH(os-name,
  532 	AS_HELP_STRING([--with-os-name=NAME],[OS Name]),
  533 	[with_osname="$withval"],[with_osname="$(uname -s)"])
  534 AC_DEFINE_UNQUOTED([OS_NAME],"${with_osname}",[OS Name])
  535 
  536 AC_ARG_WITH(os-version,
  537 	AS_HELP_STRING([--with-os-version=VERS],[OS Version]),
  538 	[with_osver="$withval"],[with_osver="$(uname -r)"])
  539 AC_DEFINE_UNQUOTED([OS_VERSION],"${with_osver}",[OS Version])
  540 
  541 AC_ARG_WITH(os-url,
  542 	AS_HELP_STRING([--with-os-url=URL],[OS URL]),
  543 	[with_osurl="$withval"],[with_osurl="http://www.netgear.com"])
  544 AC_DEFINE_UNQUOTED([OS_URL],"${with_osurl}",[OS URL])
  545 
  546 
  547 AC_MSG_CHECKING([whether to enable TiVo support])
  548 AC_ARG_ENABLE(tivo,
  549 	[  --enable-tivo           enable TiVo support],[
  550 	if test "$enableval" = "yes"; then
  551 		AC_DEFINE(TIVO_SUPPORT, 1, [Define to 1 if you want to enable TiVo support])
  552 		AM_CONDITIONAL(TIVO_SUPPORT, true)
  553 		AC_MSG_RESULT([yes])
  554 	else
  555 		AM_CONDITIONAL(TIVO_SUPPORT, false)
  556 		AC_MSG_RESULT([no])
  557 	fi
  558 	],[
  559 		AM_CONDITIONAL(TIVO_SUPPORT, false)
  560 		AC_MSG_RESULT([no])
  561 	]
  562 )
  563 
  564 AC_MSG_CHECKING([whether to enable generic NETGEAR device support])
  565 AC_ARG_ENABLE(netgear,
  566 	[  --enable-netgear        enable generic NETGEAR device support],[
  567 	if test "$enableval" = "yes"; then
  568 		AC_DEFINE([NETGEAR],[1],[Define to 1 if you want to enable generic NETGEAR device support])
  569 		AC_DEFINE_UNQUOTED([OS_URL],"http://www.netgear.com/")
  570 		AC_DEFINE_UNQUOTED([ROOTDEV_MANUFACTURERURL],"http://www.netgear.com/")
  571 		AC_DEFINE_UNQUOTED([ROOTDEV_MANUFACTURER],"NETGEAR")
  572 		AC_DEFINE_UNQUOTED([ROOTDEV_MODELNAME],"Windows Media Connect compatible (ReadyDLNA)")
  573 		AC_DEFINE_UNQUOTED([ROOTDEV_MODELDESCRIPTION],"ReadyDLNA")
  574                 AC_MSG_RESULT([yes])
  575         else
  576                 AC_MSG_RESULT([no])
  577         fi
  578         ],[
  579                 AC_MSG_RESULT([no])
  580         ]
  581 )
  582 
  583 AC_MSG_CHECKING([whether to enable NETGEAR ReadyNAS support])
  584 AC_ARG_ENABLE(readynas,
  585 	[  --enable-readynas       enable NETGEAR ReadyNAS support],[
  586 	if test "$enableval" = "yes"; then
  587 		AC_DEFINE([NETGEAR],[1],[Define to 1 if you want to enable generic NETGEAR device support])
  588 		AC_DEFINE([READYNAS],[1],[Define to 1 if you want to enable NETGEAR ReadyNAS support])
  589 		AC_DEFINE([TIVO_SUPPORT], 1, [Define to 1 if you want to enable TiVo support])
  590 		AC_DEFINE_UNQUOTED([OS_URL],"http://www.readynas.com/")
  591 		AC_DEFINE_UNQUOTED([ROOTDEV_MANUFACTURERURL],"http://www.netgear.com/")
  592 		AC_DEFINE_UNQUOTED([ROOTDEV_MANUFACTURER],"NETGEAR")
  593 		AC_DEFINE_UNQUOTED([ROOTDEV_MODELNAME],"Windows Media Connect compatible (ReadyDLNA)")
  594 		AC_DEFINE_UNQUOTED([ROOTDEV_MODELDESCRIPTION],"ReadyDLNA")
  595 		AM_CONDITIONAL(TIVO_SUPPORT, true)
  596 		AC_MSG_RESULT([yes])
  597 	else
  598 		AC_MSG_RESULT([no])
  599 	fi
  600 	],[
  601 		AC_MSG_RESULT([no])
  602 	]
  603 )
  604 
  605 AC_MSG_CHECKING([whether to build a static binary executable])
  606 AC_ARG_ENABLE(static,
  607 	[  --enable-static         build a static binary executable],[
  608 	if test "$enableval" = "yes"; then
  609 		CFLAGS="$CFLAGS -DSTATIC"
  610 		LDFLAGS="$LDFLAGS -static"
  611                 AC_MSG_RESULT([yes])
  612         else
  613                 AC_MSG_RESULT([no])
  614         fi
  615         ],[
  616                 AC_MSG_RESULT([no])
  617         ]
  618 )
  619 
  620 AC_MSG_CHECKING([whether to enable LTO])
  621 AC_ARG_ENABLE(lto,
  622 	[  --enable-lto            enable link-time optimization],[
  623 	if test "$enableval" = "yes"; then
  624 		CFLAGS="$CFLAGS -flto"
  625                 AC_MSG_RESULT([yes])
  626         else
  627                 AC_MSG_RESULT([no])
  628         fi
  629         ],[
  630                 AC_MSG_RESULT([no])
  631         ]
  632 )
  633 
  634 
  635 case "$target_os" in
  636 	darwin*)
  637 		;;
  638         freebsd*)
  639                 VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'`
  640                 OS_URL=http://www.freebsd.org/
  641                 ;;
  642 	solaris*)
  643 		AC_DEFINE([USE_IPF], [1], [Define to enable IPF])
  644 		AC_DEFINE([LOG_PERROR], [0], [Define to enable logging])
  645 		AC_DEFINE([SOLARIS_KSTATS], [1], [Define to enable Solaris Kernel Stats])
  646 		;;
  647 	kfreebsd*)
  648                 OS_URL=http://www.debian.org/
  649 		;;
  650         linux*)
  651 		;;
  652         openbsd*)
  653                 OS_URL=http://www.openbsd.org/
  654                 ;;
  655         *)
  656                 echo "Unknown OS : $target_os"
  657                 ;;
  658 esac
  659 
  660 
  661 AC_OUTPUT([ po/Makefile.in
  662 Makefile
  663 ])