diff --git a/Makefile.am b/Makefile.am index 1d7d73f..74859c1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. -AM_CFLAGS = -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 @STATIC_CFLAGS@ +AM_CFLAGS = -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 SUBDIRS=po @@ -55,14 +55,11 @@ minidlnad_LDADD = \ @LIBID3TAG_LIBS@ \ @LIBSQLITE3_LIBS@ \ @LIBAVFORMAT_LIBS@ \ - @LIBAVUTIL_LIBS@ \ @LIBEXIF_LIBS@ \ @LIBINTL@ \ @LIBICONV@ \ -lFLAC $(flacogglibs) $(vorbislibs) $(avahilibs) -minidlnad_LDFLAGS = @STATIC_LDFLAGS@ - testupnpdescgen_SOURCES = testupnpdescgen.c upnpdescgen.c testupnpdescgen_LDADD = \ @LIBJPEG_LIBS@ \ diff --git a/configure.ac b/configure.ac index d8838c4..cb596b9 100644 --- a/configure.ac +++ b/configure.ac @@ -69,6 +69,7 @@ AC_FUNC_FORK AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK 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]) AC_CHECK_DECLS([SEEK_HOLE]) +AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [use clock_gettime])],) # # Check for struct ip_mreqn @@ -144,7 +145,6 @@ AC_COMPILE_IFELSE( ], [ AC_MSG_RESULT([no]) - AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [use clock_gettime])],) ]) AC_CHECK_HEADER(linux/netlink.h, @@ -411,10 +411,10 @@ for dir in "" /usr/local $SEARCH_DIR; do if test -n "$dir"; then LDFLAGS="$LDFLAGS -L$dir/lib" fi - AC_CHECK_LIB([id3tag], [id3_file_open], [LIBID3TAG_LIBS="-lid3tag"], [unset ac_cv_lib_id3tag_id3_file_open; LDFLAGS="$LDFLAGS_SAVE"; continue]) + AC_CHECK_LIB([id3tag -lz], [id3_file_open], [LIBID3TAG_LIBS="-lid3tag -lz"], [unset ac_cv_lib_id3tag_id3_file_open; LDFLAGS="$LDFLAGS_SAVE"; continue]) break done -test x"$ac_cv_lib_id3tag_id3_file_open" = x"yes" || AC_MSG_ERROR([Could not find libid3tag]) +test x"$ac_cv_lib_id3tag__lz___id3_file_open" = x"yes" || AC_MSG_ERROR([Could not find libid3tag]) AC_SUBST(LIBID3TAG_LIBS) LDFLAGS_SAVE="$LDFLAGS" @@ -435,20 +435,17 @@ for dir in "" /usr/local $SEARCH_DIR; do if test -n "$dir"; then LDFLAGS="$LDFLAGS -L$dir/lib" fi - AC_CHECK_LIB([avformat], [av_open_input_file], [LIBAVFORMAT_LIBS="-lavformat"], - [AC_CHECK_LIB([avformat], [avformat_open_input], [LIBAVFORMAT_LIBS="-lavformat"], + AC_CHECK_LIB([avformat -lavcodec -lavutil -lz], [avformat_open_input], [LIBAVFORMAT_LIBS="-lavformat -lavcodec -lavutil -lz"], + [AC_CHECK_LIB([avformat -lavcodec -lavutil -lz], [av_open_input_file], [LIBAVFORMAT_LIBS="-lavformat -lavcodec -lavutil -lz"], [unset ac_cv_lib_avformat_av_open_input_file; unset ac_cv_lib_avformat_avformat_open_input; LDFLAGS="$LDFLAGS_SAVE"; continue])]) break done -if test x"$ac_cv_lib_avformat_av_open_input_file" != x"yes" && - test x"$ac_cv_lib_avformat_avformat_open_input" != x"yes"; then +if test x"$ac_cv_lib_avformat__lavcodec__lavutil__lz___av_open_input_file" != x"yes" && + test x"$ac_cv_lib_avformat__lavcodec__lavutil__lz___avformat_open_input" != x"yes"; then AC_MSG_ERROR([Could not find libavformat - part of ffmpeg]) fi AC_SUBST(LIBAVFORMAT_LIBS) -AC_CHECK_LIB(avutil ,[av_rescale_q], [LIBAVUTIL_LIBS="-lavutil"], [AC_MSG_ERROR([Could not find libavutil - part of ffmpeg])]) -AC_SUBST(LIBAVUTIL_LIBS) - AC_CHECK_LIB(pthread, pthread_create) # test if we have vorbisfile @@ -609,10 +606,22 @@ AC_MSG_CHECKING([whether to build a static binary executable]) AC_ARG_ENABLE(static, [ --enable-static build a static binary executable],[ if test "$enableval" = "yes"; then - STATIC_CFLAGS="-DSTATIC" - AC_SUBST(STATIC_CFLAGS) - STATIC_LDFLAGS="-Wl,-Bstatic" - AC_SUBST(STATIC_LDFLAGS) + CFLAGS="$CFLAGS -DSTATIC" + LDFLAGS="$LDFLAGS -static" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ],[ + AC_MSG_RESULT([no]) + ] +) + +AC_MSG_CHECKING([whether to enable LTO]) +AC_ARG_ENABLE(lto, + [ --enable-lto enable link-time optimization],[ + if test "$enableval" = "yes"; then + CFLAGS="$CFLAGS -flto" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) diff --git a/image_utils.c b/image_utils.c index e8d9635..fc85968 100644 --- a/image_utils.c +++ b/image_utils.c @@ -137,7 +137,7 @@ init_source(j_decompress_ptr cinfo) return; } -static int +static boolean fill_input_buffer(j_decompress_ptr cinfo) { struct my_src_mgr *src = (void *)cinfo->src; diff --git a/upnphttp.c b/upnphttp.c index 08fdd79..d9f0a88 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -1641,7 +1641,7 @@ SendResp_resizedimg(struct upnphttp * h, char * object) char *resolution = NULL; char *key, *val; char *saveptr, *item = NULL; - int rotate; + int rotate = 0; int pixw = 0, pixh = 0; long long id; int rows=0, chunked, ret; @@ -1661,7 +1661,8 @@ SendResp_resizedimg(struct upnphttp * h, char * object) { file_path = result[3]; resolution = result[4]; - rotate = result[5] ? atoi(result[5]) : 0; + if (result[5]) + rotate = atoi(result[5]); } if( !file_path || !resolution || (access(file_path, F_OK) != 0) ) {