diff --git a/.gitignore b/.gitignore index 0f46af5..1402b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,44 @@ -src/automatic.conf -src/*.o -src/automatic -src/automatic-mw -Makefile Makefile.in -depcomp -install-sh -missing -aclocal.m4 -configure -config.log -config.status -src/.deps -src/tests/.deps +Makefile + +compile +test-driver + +*.o +*.log + +# http://www.gnu.org/software/autoconf + +/build +/depcomp +/install-sh +/missing +/aclocal.m4 +/autom4te.cache +/configure +/configure.in +/config.log +/config.status +/configure.lineno + +.deps + +src/automatic src/version.h src/automatic.state -src/*.log -src/Makefile.in -src/tests/Makefile.in -autom4te.cache/ -configure.lineno -Makefile.in -src/Makefile.in -src/tests/Makefile.in -configure -aclocal.m4 +src/automatic-mw +src/automatic.conf +src/core +src/.dirstamp + +src/tests/utils_test +src/tests/parser_test +src/tests/base64_test +src/tests/list_test +src/tests/http_test +src/tests/prowl_test +src/tests/json_test +src/tests/regex_test +src/tests/toasty_test +src/tests/pushalot_test +src/tests/*.trs diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..466322e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +language: c +compiler: gcc + +env: + global: + # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created + # via the "travis encrypt" command using the project repo's public key + - secure: "Ysin0s3j16SENbMtvulpD9vB1YwjQdGkLp5F9RRQCC0t7wxRPZX7yItSxvYBCRFE7yikuqFXq9792bcImQvrcH0CIalGsfjC8We3B2zCS4rxIVbNyc1kW3QaCoVjXSqSEnyjUr4ca+HtbwVXV3o40rodh7ACnqBMNq3MlyAkmAU=" + +addons: + coverity_scan: + project: + name: "1100101/Automatic" + description: "Build submitted via Travis CI" + notification_email: 1100101@gmail.com + build_command_prepend: "./autogen.sh; ./configure; make clean" + build_command: "make" + branch_pattern: coverity_scan + +# Change this to your needs +script: ./autogen.sh && ./configure && make diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1ca44e8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,91 @@ +# Minimal version of CMake +cmake_minimum_required (VERSION 3.0) + +# Build type +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) +endif () + +# Define project name +project (Automatic + LANGUAGES C + VERSION 0.9) + +include(CTest) +include(GNUInstallDirs) +if(EXISTS ${CMAKE_SOURCE_DIR}/.git) + find_package(Git) +endif() + +if(GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-list --max-count=1 --abbrev-commit HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE) + configure_file(include/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY) +endif() + +# include custom Modules +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") + +set(automatic_srcs + src/automatic.c + src/base64.c + src/config_parser.c + src/downloads.c + src/feed_item.c + src/file.c + src/filters.c + src/json.c + src/list.c + src/memwatch.c + src/output.c + src/prowl.c + src/pushover.c + src/regex.c + src/rss_feed.c + src/state.c + src/torrent.c + src/transmission.c + src/urlcode.c + src/utils.c + src/web.c + src/xml_parser.c) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic") + +option(AUTOMATIC_BUILD_TESTS "Build the test programs" OFF) + +find_package(CURL 7.15.0 REQUIRED) +find_package(LibXml2 2.6.31 REQUIRED) +find_package(PCRE 7.4 REQUIRED) + +add_executable(automatic ${automatic_srcs}) +target_include_directories(automatic PRIVATE "${CMAKE_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}") +target_link_libraries(automatic PRIVATE CURL::libcurl LibXml2::LibXml2 PCRE::PCRE) + +# installation +include(systemdservice) + +install(TARGETS automatic DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES src/automatic.conf-sample DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) + +# Install service if we have systemd +if (SYSTEMD_FOUND) + if(NOT EXISTS "${SYSTEMD_SERVICES_INSTALL_DIR}/automatic.service") + configure_file(src/automatic.service.in ${CMAKE_CURRENT_BINARY_DIR}/automatic.service @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/automatic.service + DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR} + COMPONENT data + ) + else() + message(STATUS "Note: Not installing automatic.service, file already exists") + endif() +endif (SYSTEMD_FOUND) + +if(AUTOMATIC_BUILD_TESTS) + enable_testing() + add_subdirectory(src/tests) +endif() diff --git a/ChangeLog b/ChangeLog index 20b21e5..23bbe6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,36 @@ +2022-01-27 v0.9.0: + Fixed: The app fails to daemonize properly in some situations + +2013-04-04 v0.8.3 + Fixed: Don't expect HTTP headers to be of the correct case (Content-Disposition vs. Content-disposition) + Fixes issue with torrent filenames. + +2012-01-17 v0.8.2 + Fixed: Segfault because of some really long magnet URIs + Fixed: Prevent crash when an invalid RSS feed is used + +2012-11-12 v0.8.1 + Fixed: The previous state wasn't always properly restored after a restart + Fixed: If the config file contains 'folder' suboptions with escaped whitespace ("My\ Download\ Folder") + the escaping backlash is now filtered out. + Fixes issue where Transmission doesn't properly recognize a JSON packet sent by Automatic. + +2012-06-14 v0.8.0 + Added: URL Rewrite for torrent download URLs + Added: Reload configuration when SIGHUP is received + Added: Configuration text can be split over multiple lines now. + Use '\' or '+' at the end of a line to signal a linebreak. + Fixed: Configure curl to accept encoded data. (HTTP header "Accept-Encoding") + 2012-03-14 v0.7.3 Added: Support Magnet URIs in torrent feeds + 2012-02-10 v0.7.2 Fixed: Downloading a torrent from a feed caused a crash in some rare situations. - + 2012-01-09 v0.7.1 Fixed: Problems with assigning a feed ID. - + 2011-12-08 v.0.7.0 Added: Assign each feed an ID, and bind filters to a certain feed using the ID. Changed: Store RSS GUID in history file instead of item URL. @@ -26,7 +51,7 @@ 2010-10-17 v0.6.4 Added: New commandline option "--append-log|-a" to not overwrite the log from a previous session Fixed: Wrong regular expression for "Content-Disposition" still included a stray double-quote sometimes - + 2010-05-11 v0.6.2 Fixed: The config parser choked on multiple newlines at the end of a config file diff --git a/INSTALL b/INSTALL index 9f3393a..35b68b3 100644 --- a/INSTALL +++ b/INSTALL @@ -4,12 +4,17 @@ Installation instructions 1. Dependencies ---------------- -Automatic makes use of the libcurl and libxml2 libraries, so make sure those are installed. +Automatic makes use of the libcurl, libxml2 and libpcre libraries, so make sure those are installed. +You'll also need automake to run autogen.sh - on Debian-derived distros, `apt-get install automake`. 2. Configuration ---------------- -First configure the tool by typing +First autogenerate the configuration files by typing + + ./autogen.sh + +then configure the tool by typing ./configure diff --git a/README b/README index 1157d48..d678b63 100644 --- a/README +++ b/README @@ -11,5 +11,4 @@ Automatic is configured via a configuration file (by default placed at /etc/auto The file contains further instructions on how to configure the tool. -If you have questions, suggestions or you think you found a bug, -you can contact me at 1100101+automaticgmailcom or at http://forum.transmissionbt.com +If you have questions, suggestions or you think you found a bug, you can contact me at 1100101+automaticgmailcom. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..3630403 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +aclocal +autoconf +automake --add-missing --copy --ignore-deps + + diff --git a/cmake/FindPCRE.cmake b/cmake/FindPCRE.cmake new file mode 100644 index 0000000..0daa0ff --- /dev/null +++ b/cmake/FindPCRE.cmake @@ -0,0 +1,97 @@ +#.rst: +# FindPCRE +# -------- +# Finds the PCRECPP library +# +# This will define the following variables:: +# +# PCRE_FOUND - system has libpcrecpp +# PCRE_INCLUDE_DIRS - the libpcrecpp include directory +# PCRE_LIBRARIES - the libpcrecpp libraries +# PCRE_DEFINITIONS - the libpcrecpp definitions +# +# and the following imported targets:: +# +# PCRE::PCRECPP - The PCRECPP library +# PCRE::PCRE - The PCRE library + +if(NOT PCRE::PCRE) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_PCRE libpcrecpp QUIET) + endif() + + find_path(PCRE_INCLUDE_DIR pcrecpp.h + PATHS ${PC_PCRE_INCLUDEDIR}) + find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp + PATHS ${PC_PCRE_LIBDIR}) + find_library(PCRE_LIBRARY_RELEASE NAMES pcre + PATHS ${PC_PCRE_LIBDIR}) + find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd + PATHS ${PC_PCRE_LIBDIR}) + find_library(PCRE_LIBRARY_DEBUG NAMES pcred + PATHS ${PC_PCRE_LIBDIR}) + set(PCRE_VERSION ${PC_PCRE_VERSION}) + + include(SelectLibraryConfigurations) + select_library_configurations(PCRECPP) + select_library_configurations(PCRE) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(PCRE + REQUIRED_VARS PCRECPP_LIBRARY PCRE_LIBRARY PCRE_INCLUDE_DIR + VERSION_VAR PCRE_VERSION) + + if(PCRE_FOUND) + set(PCRE_LIBRARIES ${PCRECPP_LIBRARY} ${PCRE_LIBRARY}) + set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) + if(WIN32) + set(PCRE_DEFINITIONS -DPCRE_STATIC=1) + endif() + + if(NOT TARGET PCRE::PCRE) + add_library(PCRE::PCRE UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRE_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRE_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}") + if(WIN32) + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_COMPILE_DEFINITIONS PCRE_STATIC=1) + endif() + + endif() + if(NOT TARGET PCRE::PCRECPP) + add_library(PCRE::PCRECPP UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRECPP_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRECPP_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRECPP PROPERTIES + INTERFACE_LINK_LIBRARIES PCRE::PCRE) + endif() + if(TARGET pcre) + add_dependencies(PCRE::PCRE pcre) + endif() + set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP PCRE::PCRE) + else() + if(PCRE_FIND_REQUIRED) + message(FATAL_ERROR "PCRE not found. Possibly use -DENABLE_INTERNAL_PCRE=ON to build PCRE") + endif() + endif() + + mark_as_advanced(PCRE_INCLUDE_DIR PCRECPP_LIBRARY PCRE_LIBRARY) +endif() diff --git a/cmake/systemdservice.cmake b/cmake/systemdservice.cmake new file mode 100644 index 0000000..c67cabc --- /dev/null +++ b/cmake/systemdservice.cmake @@ -0,0 +1,21 @@ +######## +# Find systemd service dir + +pkg_check_modules(SYSTEMD "systemd") +if (SYSTEMD_FOUND AND "${SYSTEMD_SERVICES_INSTALL_DIR}" STREQUAL "") + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} + --variable=systemdsystemunitdir systemd + OUTPUT_VARIABLE SYSTEMD_SERVICES_INSTALL_DIR) + string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SERVICES_INSTALL_DIR + "${SYSTEMD_SERVICES_INSTALL_DIR}") +elseif (NOT SYSTEMD_FOUND AND SYSTEMD_SERVICES_INSTALL_DIR) + message (FATAL_ERROR "Variable SYSTEMD_SERVICES_INSTALL_DIR is\ + defined, but we can't find systemd using pkg-config") +endif() + +if (SYSTEMD_FOUND) + set(WITH_SYSTEMD "ON") + message(STATUS "systemd services install dir: ${SYSTEMD_SERVICES_INSTALL_DIR}") +else() + set(WITH_SYSTEMD "OFF") +endif (SYSTEMD_FOUND) diff --git a/configure b/configure deleted file mode 100755 index 5058a53..0000000 --- a/configure +++ /dev/null @@ -1,7357 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for Automatic 0.7.3. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: http://forum.dsmg600.info/t2291-%5BREL%5D-Automatic-funplug-0.5.html -$0: about your system, including any error possibly output -$0: before this message. Then install a modern shell, or -$0: manually run the script under such a shell if you do -$0: have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='Automatic' -PACKAGE_TARNAME='automatic' -PACKAGE_VERSION='0.7.3' -PACKAGE_STRING='Automatic 0.7.3' -PACKAGE_BUGREPORT='http://forum.dsmg600.info/t2291-%5BREL%5D-Automatic-funplug-0.5.html' -PACKAGE_URL='' - -ac_unique_file="src/automatic.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -EGREP -GREP -CPP -PCRE_LIBS -PCRE_CFLAGS -LIBXML_LIBS -LIBXML_CFLAGS -LIBCURL_LIBS -LIBCURL_CFLAGS -PCRE_MINIMUM -LIBXML2_MINIMUM -CURL_MINIMUM -DBG_BUILD_FALSE -DBG_BUILD_TRUE -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG -am__fastdepCXX_FALSE -am__fastdepCXX_TRUE -CXXDEPMODE -ac_ct_CXX -CXXFLAGS -CXX -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -VERSION_NUMBER -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_dependency_tracking -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR -LIBCURL_CFLAGS -LIBCURL_LIBS -LIBXML_CFLAGS -LIBXML_LIBS -PCRE_CFLAGS -PCRE_LIBS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures Automatic 0.7.3 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/automatic] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Automatic 0.7.3:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - PKG_CONFIG path to pkg-config utility - PKG_CONFIG_PATH - directories to add to pkg-config's search path - PKG_CONFIG_LIBDIR - path overriding pkg-config's built-in search path - LIBCURL_CFLAGS - C compiler flags for LIBCURL, overriding pkg-config - LIBCURL_LIBS - linker flags for LIBCURL, overriding pkg-config - LIBXML_CFLAGS - C compiler flags for LIBXML, overriding pkg-config - LIBXML_LIBS linker flags for LIBXML, overriding pkg-config - PCRE_CFLAGS C compiler flags for PCRE, overriding pkg-config - PCRE_LIBS linker flags for PCRE, overriding pkg-config - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -Automatic configure 0.7.3 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ----------------------------------------------------------------------------------- ## -## Report this to http://forum.dsmg600.info/t2291-%5BREL%5D-Automatic-funplug-0.5.html ## -## ----------------------------------------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_find_intX_t LINENO BITS VAR -# ----------------------------------- -# Finds a signed integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_intX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in int$2_t 'int' 'long int' \ - 'long long int' 'short int' 'signed char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) - < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - case $ac_type in #( - int$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_intX_t - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_uintX_t - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Automatic $as_me 0.7.3, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -VERSION_NUMBER=0.7.3 - - - -am__api_version='1.11' - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='automatic' - VERSION='0.7.3' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - - -# Checks for c compiler. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - - - - - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi -if test . != "x"; then - supported_build=yes - if test "x$GCC" = "xyes" ; then - CFLAGS="-Wdeclaration-after-statement -O3 -funroll-loops" - CXXFLAGS="-O3 -funroll-loops" - fi - CPPFLAGS="$CPPFLAGS -DNDEBUG" -else - supported_build=no - if test "x$GCC" = "xyes" ; then - CFLAGS="-g -Wall -W -Wdeclaration-after-statement -O0 -funroll-loops" - CXXFLAGS="-g -Wall -W -O0 -funroll-loops" - fi -fi - if test "x$supported_build" = "xno"; then - DBG_BUILD_TRUE= - DBG_BUILD_FALSE='#' -else - DBG_BUILD_TRUE='#' - DBG_BUILD_FALSE= -fi - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - - - -CURL_MINIMUM=7.15.0 -LIBXML2_MINIMUM=2.6.31 -PCRE_MINIMUM=7.4 - - - - -# export these variable (so Makefile substitutions can be made.) - - - - -# Checks for libraries. - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBCURL" >&5 -$as_echo_n "checking for LIBCURL... " >&6; } - -if test -n "$LIBCURL_CFLAGS"; then - pkg_cv_LIBCURL_CFLAGS="$LIBCURL_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl >= \$CURL_MINIMUM\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libcurl >= $CURL_MINIMUM") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBCURL_CFLAGS=`$PKG_CONFIG --cflags "libcurl >= $CURL_MINIMUM" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$LIBCURL_LIBS"; then - pkg_cv_LIBCURL_LIBS="$LIBCURL_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl >= \$CURL_MINIMUM\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libcurl >= $CURL_MINIMUM") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBCURL_LIBS=`$PKG_CONFIG --libs "libcurl >= $CURL_MINIMUM" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - LIBCURL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcurl >= $CURL_MINIMUM" 2>&1` - else - LIBCURL_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcurl >= $CURL_MINIMUM" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$LIBCURL_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (libcurl >= $CURL_MINIMUM) were not met: - -$LIBCURL_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables LIBCURL_CFLAGS -and LIBCURL_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables LIBCURL_CFLAGS -and LIBCURL_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - LIBCURL_CFLAGS=$pkg_cv_LIBCURL_CFLAGS - LIBCURL_LIBS=$pkg_cv_LIBCURL_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBXML" >&5 -$as_echo_n "checking for LIBXML... " >&6; } - -if test -n "$LIBXML_CFLAGS"; then - pkg_cv_LIBXML_CFLAGS="$LIBXML_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= \$LIBXML2_MINIMUM\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= $LIBXML2_MINIMUM") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBXML_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= $LIBXML2_MINIMUM" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$LIBXML_LIBS"; then - pkg_cv_LIBXML_LIBS="$LIBXML_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= \$LIBXML2_MINIMUM\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= $LIBXML2_MINIMUM") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBXML_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= $LIBXML2_MINIMUM" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - LIBXML_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libxml-2.0 >= $LIBXML2_MINIMUM" 2>&1` - else - LIBXML_PKG_ERRORS=`$PKG_CONFIG --print-errors "libxml-2.0 >= $LIBXML2_MINIMUM" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$LIBXML_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (libxml-2.0 >= $LIBXML2_MINIMUM) were not met: - -$LIBXML_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables LIBXML_CFLAGS -and LIBXML_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables LIBXML_CFLAGS -and LIBXML_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - LIBXML_CFLAGS=$pkg_cv_LIBXML_CFLAGS - LIBXML_LIBS=$pkg_cv_LIBXML_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCRE" >&5 -$as_echo_n "checking for PCRE... " >&6; } - -if test -n "$PCRE_CFLAGS"; then - pkg_cv_PCRE_CFLAGS="$PCRE_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre >= \$PCRE_MINIMUM\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpcre >= $PCRE_MINIMUM") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PCRE_CFLAGS=`$PKG_CONFIG --cflags "libpcre >= $PCRE_MINIMUM" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$PCRE_LIBS"; then - pkg_cv_PCRE_LIBS="$PCRE_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre >= \$PCRE_MINIMUM\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpcre >= $PCRE_MINIMUM") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PCRE_LIBS=`$PKG_CONFIG --libs "libpcre >= $PCRE_MINIMUM" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - PCRE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpcre >= $PCRE_MINIMUM" 2>&1` - else - PCRE_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpcre >= $PCRE_MINIMUM" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$PCRE_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (libpcre >= $PCRE_MINIMUM) were not met: - -$PCRE_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables PCRE_CFLAGS -and PCRE_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables PCRE_CFLAGS -and PCRE_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - PCRE_CFLAGS=$pkg_cv_PCRE_CFLAGS - PCRE_LIBS=$pkg_cv_PCRE_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_global_init in -lcurl" >&5 -$as_echo_n "checking for curl_global_init in -lcurl... " >&6; } -if ${ac_cv_lib_curl_curl_global_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcurl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char curl_global_init (); -int -main () -{ -return curl_global_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_curl_curl_global_init=yes -else - ac_cv_lib_curl_curl_global_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curl_curl_global_init" >&5 -$as_echo "$ac_cv_lib_curl_curl_global_init" >&6; } -if test "x$ac_cv_lib_curl_curl_global_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBCURL 1 -_ACEOF - - LIBS="-lcurl $LIBS" - -fi - - -# Checks for header files. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 -$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if ${ac_cv_header_sys_wait_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) -#endif -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif - -int -main () -{ - int s; - wait (&s); - s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_sys_wait_h=yes -else - ac_cv_header_sys_wait_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 -$as_echo "$ac_cv_header_sys_wait_h" >&6; } -if test $ac_cv_header_sys_wait_h = yes; then - -$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in fcntl.h stdint.h stdlib.h string.h sys/param.h sys/time.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes -else - ac_cv_c_const=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - -ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" -case $ac_cv_c_int8_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int8_t $ac_cv_c_int8_t -_ACEOF -;; -esac - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 -$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if ${ac_cv_struct_tm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -int -main () -{ -struct tm tm; - int *p = &tm.tm_sec; - return !p; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_struct_tm=time.h -else - ac_cv_struct_tm=sys/time.h -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } -if test $ac_cv_struct_tm = sys/time.h; then - -$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h - -fi - -ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" -case $ac_cv_c_uint8_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT8_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint8_t $ac_cv_c_uint8_t -_ACEOF -;; - esac - - -# Checks for library functions. -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - -for ac_header in vfork.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" -if test "x$ac_cv_header_vfork_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VFORK_H 1 -_ACEOF - -fi - -done - -for ac_func in fork vfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 -$as_echo_n "checking for working fork... " >&6; } -if ${ac_cv_func_fork_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_fork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* By Ruediger Kuhlmann. */ - return fork () < 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_fork_works=yes -else - ac_cv_func_fork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 -$as_echo "$ac_cv_func_fork_works" >&6; } - -else - ac_cv_func_fork_works=$ac_cv_func_fork -fi -if test "x$ac_cv_func_fork_works" = xcross; then - case $host in - *-*-amigaos* | *-*-msdosdjgpp*) - # Override, as these systems have only a dummy fork() stub - ac_cv_func_fork_works=no - ;; - *) - ac_cv_func_fork_works=yes - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} -fi -ac_cv_func_vfork_works=$ac_cv_func_vfork -if test "x$ac_cv_func_vfork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 -$as_echo_n "checking for working vfork... " >&6; } -if ${ac_cv_func_vfork_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_vfork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Thanks to Paul Eggert for this test. */ -$ac_includes_default -#include -#ifdef HAVE_VFORK_H -# include -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. The compiler - is told about this with #include , but some compilers - (e.g. gcc -O) don't grok . Test for this by using a - static variable whose address is put into a register that is - clobbered by the vfork. */ -static void -#ifdef __cplusplus -sparc_address_test (int arg) -# else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} - -int -main () -{ - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (0); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. This - test uses lots of local variables, at least as many local - variables as main has allocated so far including compiler - temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris - 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should - reuse the register of parent for one of the local variables, - since it will think that parent can't possibly be used any more - in this routine. Assigning to the local variable will thus - munge parent in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent - from child file descriptors. If the child closes a descriptor - before it execs or exits, this munges the parent's descriptor - as well. Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - return ( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_vfork_works=yes -else - ac_cv_func_vfork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 -$as_echo "$ac_cv_func_vfork_works" >&6; } - -fi; -if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=$ac_cv_func_vfork - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} -fi - -if test "x$ac_cv_func_vfork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h - -else - -$as_echo "#define vfork fork" >>confdefs.h - -fi -if test "x$ac_cv_func_fork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h - -fi - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - - -$as_echo "#define malloc rpl_malloc" >>confdefs.h - -fi - - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 -$as_echo_n "checking for GNU libc compatible realloc... " >&6; } -if ${ac_cv_func_realloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_realloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif - -int -main () -{ -return ! realloc (0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_realloc_0_nonnull=yes -else - ac_cv_func_realloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } -if test $ac_cv_func_realloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_REALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_REALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" realloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS realloc.$ac_objext" - ;; -esac - - -$as_echo "#define realloc rpl_realloc" >>confdefs.h - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if ${ac_cv_type_signal+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -int -main () -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_signal=int -else - ac_cv_type_signal=void -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 -$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } -if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f conftest.sym conftest.file -echo >conftest.file -if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then : - ac_cv_func_lstat_dereferences_slashed_symlink=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - /* Linux will dereference the symlink and fail, as required by POSIX. - That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_lstat_dereferences_slashed_symlink=yes -else - ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -else - # If the `ln -s' command failed, then we probably don't even - # have an lstat function. - ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f conftest.sym conftest.file - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 -$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } - -test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && - -cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 -_ACEOF - - -if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then - case " $LIBOBJS " in - *" lstat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lstat.$ac_objext" - ;; -esac - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 -$as_echo_n "checking whether stat accepts an empty string... " >&6; } -if ${ac_cv_func_stat_empty_string_bug+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_stat_empty_string_bug=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - return stat ("", &sbuf) == 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_stat_empty_string_bug=no -else - ac_cv_func_stat_empty_string_bug=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 -$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } -if test $ac_cv_func_stat_empty_string_bug = yes; then - case " $LIBOBJS " in - *" stat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS stat.$ac_objext" - ;; -esac - - -cat >>confdefs.h <<_ACEOF -#define HAVE_STAT_EMPTY_STRING_BUG 1 -_ACEOF - -fi - -for ac_func in strftime -do : - ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" -if test "x$ac_cv_func_strftime" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRFTIME 1 -_ACEOF - -else - # strftime is in -lintl on SCO UNIX. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 -$as_echo_n "checking for strftime in -lintl... " >&6; } -if ${ac_cv_lib_intl_strftime+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lintl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char strftime (); -int -main () -{ -return strftime (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_intl_strftime=yes -else - ac_cv_lib_intl_strftime=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 -$as_echo "$ac_cv_lib_intl_strftime" >&6; } -if test "x$ac_cv_lib_intl_strftime" = xyes; then : - $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h - -LIBS="-lintl $LIBS" -fi - -fi -done - -for ac_func in dup2 gettimeofday localtime_r regcomp strerror strstr -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - -ac_config_files="$ac_config_files Makefile src/Makefile src/tests/Makefile" - - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${DBG_BUILD_TRUE}" && test -z "${DBG_BUILD_FALSE}"; then - as_fn_error $? "conditional \"DBG_BUILD\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by Automatic $as_me 0.7.3, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -Automatic config.status 0.7.3 -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "src/tests/Makefile") CONFIG_FILES="$CONFIG_FILES src/tests/Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - diff --git a/configure.in b/configure.ac similarity index 91% rename from configure.in rename to configure.ac index af1ae7c..36cbc2b 100644 --- a/configure.in +++ b/configure.ac @@ -1,13 +1,13 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -m4_define([version_number],0.7.3) +m4_define([version_number],0.9) -AC_INIT([Automatic],[version_number],[http://forum.dsmg600.info/t2291-%5BREL%5D-Automatic-funplug-0.5.html]) +AC_INIT([Automatic],[version_number],[https://github.com/1100101/Automatic]) AC_SUBST(VERSION_NUMBER,[version_number]) AC_CONFIG_SRCDIR([src/automatic.c]) -AM_INIT_AUTOMAKE([1.10 foreign]) +AM_INIT_AUTOMAKE([1.10 foreign subdir-objects]) # Checks for c compiler. AC_PROG_CC diff --git a/include/automatic.h b/include/automatic.h index 83a0bac..886df2f 100644 --- a/include/automatic.h +++ b/include/automatic.h @@ -21,15 +21,15 @@ */ #ifdef MEMWATCH - #include "memwatch.h" + #include "memwatch.h" #endif #define AM_DEFAULT_RPC_VERSION 4 -#define AM_DEFAULT_INTERVAL 30 -#define AM_DEFAULT_HOST "localhost" -#define AM_DEFAULT_RPCPORT 9091 -#define AM_TRANSMISSION_1_2 2 -#define AM_TRANSMISSION_1_3 3 -#define AM_TRANSMISSION_EXTERNAL 1 +#define AM_DEFAULT_INTERVAL 30 +#define AM_DEFAULT_HOST "localhost" +#define AM_DEFAULT_RPCPORT 9091 +#define AM_TRANSMISSION_1_2 2 +#define AM_TRANSMISSION_1_3 3 +#define AM_TRANSMISSION_EXTERNAL 1 #include @@ -39,31 +39,31 @@ /** \cond */ struct auto_handle { - char *transmission_path; - char *statefile; - char *torrent_folder; - char *auth; - char *host; - char *prowl_key; - char *transmission_external; - rss_feeds feeds; - am_filters filters; - simple_list downloads; - int8_t rpc_version; - uint16_t max_bucket_items; - uint8_t bucket_changed; - uint8_t check_interval; - uint8_t use_transmission; - uint8_t start_torrent; - uint16_t rpc_port; - uint8_t transmission_version; - int16_t upspeed; - uint8_t prowl_key_valid; + char *transmission_path; + char *statefile; + char *torrent_folder; + char *auth; + char *host; + char *prowl_key; + char *pushover_key; + char *transmission_external; + rss_feeds feeds; + am_filters filters; + simple_list downloads; + int8_t rpc_version; + uint16_t max_bucket_items; + uint8_t bucket_changed; + uint8_t check_interval; + uint8_t use_transmission; + uint8_t start_torrent; + uint16_t rpc_port; + uint8_t transmission_version; + int16_t upspeed; + uint8_t prowl_key_valid; + uint8_t match_only; }; /** \endcond */ typedef struct auto_handle auto_handle; - -/* uint8_t am_get_verbose(void); */ - +typedef struct auto_handle am_session_t; #endif diff --git a/include/filters.h b/include/filters.h old mode 100755 new mode 100644 diff --git a/include/output.h b/include/output.h index b619b87..e416f7e 100644 --- a/include/output.h +++ b/include/output.h @@ -37,5 +37,7 @@ typedef enum debug_type debug_type; unsigned char log_init(const char *logfile, char msglevel, char append_log); void log_close(void); +unsigned char pid_create(const char *pidfile, int pid); +void pid_close(); char* getlogtime_str(char *buf); void am_printf( const char * file, int line, debug_type type, int withTime, const char * format, ... ); diff --git a/include/pushover.h b/include/pushover.h new file mode 100644 index 0000000..3316327 --- /dev/null +++ b/include/pushover.h @@ -0,0 +1,26 @@ +/* + * pushover.h + * + * Created on: Oct 5, 2014 + * Author: sew + */ + +#ifndef PUSHOVER_H__ +#define PUSHOVER_H__ + +#include + +enum pushover_event { + PUSHOVER_NEW_DOWNLOAD = 1, + PUSHOVER_DOWNLOAD_FAILED = 2 +}; + +typedef enum pushover_event pushover_event; + + +int8_t pushover_sendNotification(enum pushover_event event, const char* apikey, const char *filename); + +int16_t sendPushoverNotification(const char* apikey, const char* event, const char* desc); + + +#endif //PUSHOVER_H__ diff --git a/include/regex.h b/include/regex.h index 09a2f56..57c5267 100644 --- a/include/regex.h +++ b/include/regex.h @@ -2,4 +2,5 @@ uint8_t isRegExMatch(const char* pattern, const char* str); char* getRegExMatch(const char* pattern, const char* str, uint8_t which_result); -char * performRegexReplace(const char* str, const char* pattern, const char* replace); \ No newline at end of file +char * performRegexReplace(const char* str, const char* pattern, const char* replace); + diff --git a/include/state.h b/include/state.h index 2ab1fc5..2ab1912 100644 --- a/include/state.h +++ b/include/state.h @@ -19,5 +19,5 @@ -int save_state(const char* state_file, const simple_list const list); +int save_state(const char* state_file, const simple_list list); int load_state(const char* state_file, simple_list *list); diff --git a/include/urlcode.h b/include/urlcode.h old mode 100755 new mode 100644 diff --git a/include/utils.h b/include/utils.h index 289bd28..5d61cfe 100644 --- a/include/utils.h +++ b/include/utils.h @@ -45,16 +45,28 @@ #include +#if !defined(__cplusplus) + #ifdef HAVE_STDBOOL_H + #include + #elif !defined(__bool_true_false_are_defined) + #define bool uint8_t + #define true 1 + #define false 0 + #endif +#endif + void* am_malloc(size_t size); void* am_realloc(void *p, size_t size); void am_free(void *p); char* am_strdup(const char *str); char* am_strndup(const char *str, int len); - + char* resolve_path(const char *path); char* get_home_folder(void); char* get_temp_folder(void); char* get_tr_folder(void); -char* strstrip( char * str ); +char* am_strstrip( char * str ); +char* am_replace_str(const char *s, const char *pattern, const char *subst); +char* am_stringToLower(char *string); #endif diff --git a/include/version.h.in b/include/version.h.in new file mode 100644 index 0000000..ef8314a --- /dev/null +++ b/include/version.h.in @@ -0,0 +1,3 @@ +#define SVN_REVISION "@GIT_REVISION@" +#define SHORT_VERSION_STRING "@CMAKE_PROJECT_VERSION@" +#define LONG_VERSION_STRING "@CMAKE_PROJECT_VERSION@ (@GIT_REVISION@)" diff --git a/include/web.h b/include/web.h index c837fa8..3c56c6d 100644 --- a/include/web.h +++ b/include/web.h @@ -38,7 +38,7 @@ struct HTTPResponse { char *data; char *content_filename; /**< name of the downloaded file determined through header field "Content-Length" */ size_t size; /**< size of the received data determined through header field "Content-Length" */ - uint32_t responseCode; + long responseCode; }; typedef struct HTTPResponse HTTPResponse; diff --git a/src/Makefile.am b/src/Makefile.am old mode 100644 new mode 100755 index 1f393a2..464e40c --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = . tests -INCLUDES = -I$(top_srcdir)/include/ +AM_CPPFLAGS = -I$(top_srcdir)/include/ AM_CFLAGS = $(LIBXML_CFLAGS) $(LIBCURL_CFLAGS) $(PCRE_CFLAGS) @@ -21,6 +21,7 @@ automatic_SOURCES = \ $(top_srcdir)/src/output.c \ $(top_srcdir)/src/filters.c \ $(top_srcdir)/src/prowl.c \ + $(top_srcdir)/src/pushover.c \ $(top_srcdir)/src/regex.c \ $(top_srcdir)/src/rss_feed.c \ $(top_srcdir)/src/state.c \ @@ -43,6 +44,7 @@ noinst_HEADERS = \ $(top_srcdir)/include/output.h \ $(top_srcdir)/include/filters.h \ $(top_srcdir)/include/prowl.h \ + $(top_srcdir)/include/pushover.h \ $(top_srcdir)/include/regex.h \ $(top_srcdir)/include/rss_feed.h \ $(top_srcdir)/include/state.h \ @@ -54,17 +56,13 @@ noinst_HEADERS = \ $(top_srcdir)/include/xml_parser.h automatic_mw_SOURCES = \ - $(automatic_SOURCES) \ - $(top_srcdir)/src/memwatch.c + $(automatic_SOURCES) \ + $(top_srcdir)/src/memwatch.c if DBG_BUILD - automatic_mw_HEADERS = \ - $(noinst_HEADERS) \ - $(top_srcdir)/include/memwatch.h - automatic_mwdir = . - automatic_mw_CPPFLAGS = -DMEMWATCH -DDEBUG -O0 -ggdb3 + automatic_mw_CPPFLAGS = $(AM_CPPFLAGS) -DMEMWATCH -DDEBUG -O0 -ggdb3 endif dist_sysconf_DATA = automatic.conf-sample @@ -85,6 +83,7 @@ BUILT_SOURCES = \ version.h: echo '#define SVN_REVISION "'`git rev-parse --short HEAD`'"' > version.h + echo '#define SHORT_VERSION_STRING "'@VERSION_NUMBER@'"' >> version.h echo '#define LONG_VERSION_STRING "'@VERSION_NUMBER@' ('`git rev-parse --short HEAD`')"' >> version.h strip: diff --git a/src/automatic.c b/src/automatic.c index 80359d1..bed12ff 100644 --- a/src/automatic.c +++ b/src/automatic.c @@ -20,7 +20,7 @@ #define AM_DEFAULT_CONFIGFILE "/etc/automatic.conf" #define AM_DEFAULT_STATEFILE ".automatic.state" #define AM_DEFAULT_VERBOSE P_MSG -#define AM_DEFAULT_NOFORK 0 +#define AM_DEFAULT_NOFORK false #define AM_DEFAULT_MAXBUCKET 30 #define AM_DEFAULT_USETRANSMISSION 1 #define AM_DEFAULT_STARTTORRENTS 1 @@ -50,6 +50,7 @@ #include "file.h" #include "output.h" #include "prowl.h" +#include "pushover.h" #include "regex.h" #include "state.h" #include "torrent.h" @@ -61,15 +62,18 @@ PRIVATE char AutoConfigFile[MAXPATHLEN + 1]; PRIVATE void session_free(auto_handle *as); -PRIVATE uint8_t isMagnetURI(const char* uri); -uint8_t closing = 0; -uint8_t nofork = AM_DEFAULT_NOFORK; +PRIVATE bool isMagnetURI(const char* uri); +PRIVATE auto_handle * mySession = NULL; +PRIVATE bool closing = false; +PRIVATE bool nofork = AM_DEFAULT_NOFORK; +PRIVATE bool isRunning = false; +PRIVATE bool seenHUP = false; /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// PRIVATE void usage(void) { - printf("usage: automatic [-fh] [-v level] [-l logfile] [-c file]\n" + printf("usage: automatic [-fh] [-v level] [-l logfile] [-c file] [-p pidfile]\n" "\n" "Automatic %s\n" "\n" @@ -79,7 +83,8 @@ PRIVATE void usage(void) { " -c --configfile Path to configuration file\n" " -o --once Quit Automatic after first check of RSS feeds\n" " -l --logfile Log messages to \n" - " -a --append-log Don't overwrite logfile from a previous session" + " -a --append-log Don't overwrite logfile from a previous session\n" + " -p --pidfile create pidfile" "\n", LONG_VERSION_STRING ); exit(0); } @@ -87,9 +92,10 @@ PRIVATE void usage(void) { /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -PRIVATE void readargs(int argc, char ** argv, char **c_file, char** logfile, char **xmlfile, - uint8_t * nofork, uint8_t * verbose, uint8_t *once, uint8_t *append_log) { - char optstr[] = "afhv:c:l:ox:"; +PRIVATE void readargs(int argc, char ** argv, char **c_file, char** logfile, char** pidfile, char **xmlfile, + bool * nofork, uint8_t * verbose, uint8_t * once, uint8_t * append_log, + uint8_t * match_only) { + char optstr[] = "afhv:c:l:p:ox:m"; struct option longopts[] = { { "verbose", required_argument, NULL, 'v' }, { "nodaemon", no_argument, NULL, 'f' }, @@ -97,8 +103,10 @@ PRIVATE void readargs(int argc, char ** argv, char **c_file, char** logfile, cha { "configfile", required_argument, NULL, 'c' }, { "once", no_argument, NULL, 'o' }, { "logfile", required_argument, NULL, 'l' }, + { "pidfile", required_argument, NULL, 'p' }, { "append-log", no_argument, NULL, 'a' }, { "xml", required_argument, NULL, 'x' }, + { "match-only", no_argument, NULL, 'm' }, { NULL, 0, NULL, 0 } }; int opt; @@ -111,7 +119,7 @@ PRIVATE void readargs(int argc, char ** argv, char **c_file, char** logfile, cha *verbose = atoi(optarg); break; case 'f': - *nofork = 1; + *nofork = true; break; case 'c': *c_file = optarg; @@ -119,14 +127,20 @@ PRIVATE void readargs(int argc, char ** argv, char **c_file, char** logfile, cha case 'l': *logfile = optarg; break; + case 'p': + *pidfile = optarg; + break; case 'x': *xmlfile = optarg; - *nofork = 1; + *nofork = true; *once = 1; break; case 'o': *once = 1; break; + case 'm': + *match_only = 1; + break; default: usage(); break; @@ -134,6 +148,7 @@ PRIVATE void readargs(int argc, char ** argv, char **c_file, char** logfile, cha } } + /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -144,6 +159,7 @@ PRIVATE void shutdown_daemon(auto_handle *as) { } session_free(as); SessionID_free(); + pid_close(); log_close(); exit(EXIT_SUCCESS); } @@ -151,20 +167,15 @@ PRIVATE void shutdown_daemon(auto_handle *as) { /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -PRIVATE int daemonize(void) { +PRIVATE int daemonize(const char* pidfile) { int fd; - if (getppid() == 1) { - return -1; - } - switch (fork()) { case 0: break; case -1: - fprintf(stderr, "Error daemonizing (fork)! %d - %s", errno, strerror( - errno)); - return -1; + dbg_printf(P_ERROR, "Error daemonizing (fork)! %d - %s", errno, strerror(errno)); + return errno; default: _exit(0); } @@ -172,18 +183,16 @@ PRIVATE int daemonize(void) { umask(0); /* change the file mode mask */ if (setsid() < 0) { - fprintf(stderr, "Error daemonizing (setsid)! %d - %s", errno, strerror( - errno)); - return -1; + dbg_printf(P_ERROR, "Error daemonizing (setsid)! %d - %s", errno, strerror(errno)); + return errno; } switch (fork()) { case 0: break; case -1: - fprintf(stderr, "Error daemonizing (fork2)! %d - %s\n", errno, strerror( - errno)); - return -1; + dbg_printf(P_ERROR, "Error daemonizing (fork2)! %d - %s\n", errno, strerror(errno)); + return errno; default: _exit(0); } @@ -205,51 +214,22 @@ PRIVATE int daemonize(void) { dup2(fd, 2); close(fd); } - return 0; -} -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -PRIVATE void signal_handler(int sig) { - switch (sig) { - case SIGINT: - case SIGTERM: { - dbg_printf(P_INFO2, "SIGTERM/SIGINT caught"); - closing = 1; - break; - } + if (pidfile && *pidfile && getpid()) { + pid_create(pidfile, getpid()); } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -PRIVATE void setup_signals(void) { - signal(SIGCHLD, SIG_IGN); /* ignore child */ - signal(SIGTSTP, SIG_IGN); /* ignore tty signals */ - signal(SIGTTOU, SIG_IGN); - signal(SIGTTIN, SIG_IGN); - signal(SIGTERM, signal_handler); /* catch kill signal */ - signal(SIGINT , signal_handler); /* catch kill signal */ + return 0; } /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -/* -uint8_t am_get_verbose(void) { - return verbose; -}*/ - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - auto_handle* session_init(void) { char path[MAXPATHLEN]; char *home; - auto_handle *ses = am_malloc(sizeof(auto_handle)); + am_session_t *ses = am_malloc(sizeof(am_session_t)); /* numbers */ ses->rpc_version = AM_DEFAULT_RPC_VERSION; @@ -271,7 +251,9 @@ auto_handle* session_init(void) { am_free(home); ses->statefile = am_strdup(path); ses->prowl_key = NULL; + ses->pushover_key = NULL; ses->prowl_key_valid = 0; + ses->match_only = 0; ses->transmission_external = NULL; /* lists */ @@ -286,6 +268,133 @@ auto_handle* session_init(void) { /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// +PRIVATE void printSessionSettings() { + dbg_printf(P_INFO, "Transmission version: 1.%d", mySession->transmission_version); + dbg_printf(P_INFO, "RPC host: %s", mySession->host != NULL ? mySession->host : AM_DEFAULT_HOST); + dbg_printf(P_INFO, "RPC port: %d", mySession->rpc_port); + dbg_printf(P_INFO, "RPC auth: %s", mySession->auth != NULL ? mySession->auth : "none"); + dbg_printf(P_INFO, "config file: %s", AutoConfigFile); + dbg_printf(P_INFO, "Transmission home: %s", mySession->transmission_path); + dbg_printf(P_INFO, "check interval: %d min", mySession->check_interval); + dbg_printf(P_INFO, "Upload limit: %d KB/s", mySession->upspeed); + dbg_printf(P_INFO, "torrent folder: %s", mySession->torrent_folder); + dbg_printf(P_INFO, "start torrents: %s", mySession->start_torrent == 1 ? "yes" : "no"); + dbg_printf(P_INFO, "state file: %s", mySession->statefile); + + /* determine RPC version */ + if(mySession->use_transmission && mySession->transmission_version == AM_TRANSMISSION_1_3) { + mySession->rpc_version = getRPCVersion((mySession->host != NULL) ? mySession->host : AM_DEFAULT_HOST, + mySession->rpc_port, mySession->auth); + if(mySession->rpc_version != 0) { + dbg_printf(P_INFO, "Transmission RPC Version: %d", mySession->rpc_version); + } + } + + if(mySession->prowl_key) { + dbg_printf(P_INFO, "Prowl API key: %s", mySession->prowl_key); + } + + if(mySession->pushover_key) { + dbg_printf(P_INFO, "Pushover Token+User: %s", mySession->pushover_key); + } + + dbg_printf(P_MSG, "%d feed URLs", listCount(mySession->feeds)); + dbg_printf(P_MSG, "Read %d filters from config file", listCount(mySession->filters)); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +PRIVATE bool setupSession(auto_handle * session) { + bool sessionOk = true; + + if(session != NULL) { + if(listCount(session->feeds) == 0) { + dbg_printf(P_ERROR, "No feeds specified in automatic.conf!"); + sessionOk = false; + } + + if(listCount(session->filters) == 0) { + dbg_printf(P_ERROR, "No filters specified in automatic.conf!"); + sessionOk = false; + } + + if(sessionOk) { + // There's been a previous session. + // Copy over some of its values, and properly free its memory. + if(mySession != NULL) { + session->match_only = mySession->match_only; + if(mySession->bucket_changed) { + save_state(mySession->statefile, mySession->downloads); + } + + session_free(mySession); + } + + mySession = session; + + /* check if Prowl API key is given, and if it is valid */ + if(mySession->prowl_key && verifyProwlAPIKey(mySession->prowl_key) == 1 ) { + mySession->prowl_key_valid = 1; + } + + load_state(mySession->statefile, &mySession->downloads); + printSessionSettings(); + } + } else { + sessionOk = false; + } + + return sessionOk; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +PRIVATE void signal_handler(int sig) { + switch (sig) { + case SIGINT: + case SIGTERM: { + dbg_printf(P_INFO2, "SIGTERM/SIGINT caught"); + closing = true; + break; + } + case SIGHUP: { + if(isRunning || !mySession) { + seenHUP = true; + } else { + auto_handle * s = NULL; + dbg_printf(P_MSG, "Caught SIGHUP. Reloading config file."); + s = session_init(); + if((parse_config_file(s, AutoConfigFile) != 0) || !setupSession(s)) { + dbg_printf(P_ERROR, "Error parsing config file. Keeping the old settings."); + session_free(s); + } + + seenHUP = false; + } + + break; + } + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +PRIVATE void setup_signals(void) { + signal(SIGCHLD, SIG_IGN); /* ignore child */ + signal(SIGTSTP, SIG_IGN); /* ignore tty signals */ + signal(SIGTTOU, SIG_IGN); + signal(SIGTTIN, SIG_IGN); + signal(SIGTERM, signal_handler); /* catch kill signal */ + signal(SIGINT , signal_handler); /* catch kill signal */ + signal(SIGHUP , signal_handler); /* catch hangup signal */ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + PRIVATE void session_free(auto_handle *as) { if (as) { am_free(as->transmission_path); @@ -300,6 +409,8 @@ PRIVATE void session_free(auto_handle *as) { as->auth = NULL; am_free(as->prowl_key); as->prowl_key = NULL; + am_free(as->pushover_key); + as->pushover_key = NULL; am_free(as->transmission_external); as->transmission_external = NULL; freeList(&as->feeds, feed_free); @@ -314,8 +425,26 @@ PRIVATE void session_free(auto_handle *as) { /////////////////////////////////////////////////////////////////////////////////////////////////// PRIVATE HTTPResponse* downloadTorrent(CURL* curl_session, const char* url) { - dbg_printf(P_INFO2, "[downloadTorrent] url=%s, curl_session=%p", url, (void*)curl_session); - return getHTTPData(url, NULL, &curl_session); + HTTPResponse * torrent = NULL; + dbg_printf(P_INFO2, "[downloadTorrent] url=%s, curl_session=%p", url, (void*)curl_session); + torrent = getHTTPData(url, NULL, &curl_session); + if(torrent && torrent->responseCode != 200) { + switch(torrent->responseCode) { + case 401: + dbg_printf(P_ERROR, "Error downloading torrent (HTTP error %d: Bad authentication)", torrent->responseCode); + break; + case 403: + dbg_printf(P_ERROR, "Error downloading torrent (HTTP error %d: Forbidden)", torrent->responseCode); + break; + default: + dbg_printf(P_ERROR, "Error downloading torrent (HTTP error %d)", torrent->responseCode); + } + + HTTPResponse_free(torrent); + torrent = NULL; + } + + return torrent; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -380,22 +509,27 @@ PRIVATE int8_t addMagnetToTM(const auto_handle *ah, const char* magnet_uri, cons int8_t success = -1; torrent_id_t tid; char url[MAX_URL_LEN]; - - if (ah->transmission_version == AM_TRANSMISSION_1_3) { - snprintf( url, MAX_URL_LEN, "http://%s:%d/transmission/rpc", (ah->host != NULL) ? ah->host : AM_DEFAULT_HOST, ah->rpc_port); - tid = uploadMagnet(magnet_uri, url, ah->auth, ah->start_torrent, folder); - if(tid > 0) { /* tid > 0: torrent ID --> torrent was added to TM */ - success = 1; - if(ah->upspeed > 0) { - changeUploadSpeed(url, ah->auth, tid, ah->upspeed, ah->rpc_version); - } - } else if(tid == 0) { /* duplicate torrent */ - success = 0; - } else { /* torrent was not added */ - success = -1; - } + + if (ah->use_transmission) { + if (ah->transmission_version == AM_TRANSMISSION_1_3) { + snprintf( url, MAX_URL_LEN, "http://%s:%d/transmission/rpc", (ah->host != NULL) ? ah->host : AM_DEFAULT_HOST, ah->rpc_port); + tid = uploadMagnet(magnet_uri, url, ah->auth, ah->start_torrent, folder); + if(tid > 0) { /* tid > 0: torrent ID --> torrent was added to TM */ + success = 1; + if(ah->upspeed > 0) { + changeUploadSpeed(url, ah->auth, tid, ah->upspeed, ah->rpc_version); + } + } else if(tid == 0) { /* duplicate torrent */ + success = 0; + } else { /* torrent was not added */ + success = -1; + } + } else { + dbg_printf(P_ERROR, "[addMagnetToTM] Magnet Links only work with Transmission 1.3+"); + } } else { - dbg_printf(P_ERROR, "[addMagnetToTM] Magnet Links only work with Transmission 1.3+"); + success = 1; // debug! + dbg_printf(P_ERROR, "[addMagnetToTM] Magnet links only work with Transmission, but use of Transmission is disabled in configuration!"); } return success; } @@ -404,78 +538,93 @@ PRIVATE int8_t addMagnetToTM(const auto_handle *ah, const char* magnet_uri, cons /////////////////////////////////////////////////////////////////////////////////////////////////// PRIVATE void processRSSList(auto_handle *session, CURL *curl_session, const simple_list items, const rss_feed * feed) { - simple_list current_item = items; HTTPResponse *torrent = NULL; char fname[MAXPATHLEN]; char *download_folder = NULL; char *feedID = NULL; char *download_url = NULL; - int8_t result; if(!curl_session && !session) { printf("curl_session == NULL && session == NULL\n"); abort(); } - + if(feed != NULL) { feedID = feed->id; } while(current_item && current_item->data) { feed_item item = (feed_item)current_item->data; + if(isMatch(session->filters, item->name, feedID, &download_folder)) { - if(has_been_downloaded(session->downloads, item)) { - dbg_printf(P_INFO, "Duplicate torrent: %s", item->name); - } else { - dbg_printft(P_MSG, "[%s] Found new download: %s (%s)", feedID, item->name, item->url); - if(isMagnetURI(item->url)) { - result = addMagnetToTM(session, item->url, download_folder); - } else { - // Rewrite torrent URL, if necessary - if(feed->url_pattern !=NULL && feed->url_replace != NULL) { - download_url = rewriteURL(item->url, feed->url_pattern, feed->url_replace); - } - - torrent = downloadTorrent(curl_session, download_url != NULL ? download_url : item->url); - am_free(download_url); - - if(torrent) { - if(torrent->responseCode == 200) { - get_filename(fname, torrent->content_filename, item->url, session->torrent_folder); - /* add torrent to Transmission */ - result = addTorrentToTM(session, torrent->data, torrent->size, fname, download_folder); + if(!session->match_only) { + if(has_been_downloaded(session->downloads, item)) { + dbg_printf(P_INFO, "Duplicate torrent: %s", item->name); + } else { + int8_t result = -1; + dbg_printft(P_MSG, "[%s] Found new download: %s (%s)", feedID, item->name, item->url); + if(isMagnetURI(item->url)) { + result = addMagnetToTM(session, item->url, download_folder); } else { - dbg_printf(P_ERROR, "Error: Download failed (Error Code %d)", torrent->responseCode); + // It's a torrent file + // Rewrite torrent URL, if necessary + if((feed != NULL) && (feed->url_pattern != NULL) && (feed->url_replace != NULL)) { + download_url = rewriteURL(item->url, feed->url_pattern, feed->url_replace); + } + + torrent = downloadTorrent(curl_session, download_url != NULL ? download_url : item->url); + if(torrent) { + get_filename(fname, torrent->content_filename, item->url, session->torrent_folder); + + /* add torrent to Transmission */ + result = addTorrentToTM(session, torrent->data, torrent->size, fname, download_folder); + HTTPResponse_free(torrent); + } + + am_free(download_url); } - } - - HTTPResponse_free(torrent); - } - - // process result - if( result >= 0) { //result == 0 -> duplicate torrent - if(result > 0 && session->prowl_key_valid) { //torrent was added - prowl_sendNotification(PROWL_NEW_DOWNLOAD, session->prowl_key, item->name); - } - /* add url to bucket list */ - result = addToBucket(item->guid != NULL ? item->guid : item->url, &session->downloads, session->max_bucket_items); - if (result == 0) { - session->bucket_changed = 1; - save_state(session->statefile, session->downloads); - } - } else { //an error occurred - if(session->prowl_key_valid) { - prowl_sendNotification(PROWL_DOWNLOAD_FAILED, session->prowl_key, item->name); - } - } - } + + // process result + if( result >= 0) { //result == 0 -> duplicate torrent + if(result > 0) { //torrent was added + if(session->prowl_key_valid) { + prowl_sendNotification(PROWL_NEW_DOWNLOAD, session->prowl_key, item->name); + } + + if(session->pushover_key) { + pushover_sendNotification(PUSHOVER_NEW_DOWNLOAD, session->pushover_key, item->name); + } + } + + /* add url to bucket list */ + result = addToBucket(item->guid != NULL ? item->guid : item->url, &session->downloads, session->max_bucket_items); + if (result == 0) { + session->bucket_changed = 1; + save_state(session->statefile, session->downloads); + } + } else { //an error occurred + if(session->prowl_key_valid) { + prowl_sendNotification(PROWL_DOWNLOAD_FAILED, session->prowl_key, item->name); + } + + if(session->pushover_key) { + pushover_sendNotification(PUSHOVER_DOWNLOAD_FAILED, session->pushover_key, item->name); + } + } + } + } else { + dbg_printft(P_MSG, "[%s] Match: %s (%s)", feedID, item->name, item->url); + } } - + current_item = current_item->next; } } +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + PRIVATE HTTPResponse* getRSSFeed(const rss_feed* feed, CURL **session) { return getHTTPData(feed->url, feed->cookies, session); } @@ -487,7 +636,7 @@ PRIVATE uint16_t processFeed(auto_handle *session, rss_feed* feed, uint8_t first HTTPResponse *response = NULL; CURL *curl_session = NULL; uint32_t item_count = 0; - + response = getRSSFeed(feed, &curl_session); dbg_printf(P_INFO2, "[processFeed] curl_session=%p", (void*)curl_session); @@ -506,11 +655,11 @@ PRIVATE uint16_t processFeed(auto_handle *session, rss_feed* feed, uint8_t first session->max_bucket_items += item_count; dbg_printf(P_INFO2, "History bucket size changed: %d", session->max_bucket_items); } - + processRSSList(session, curl_session, items, feed); freeList(&items, freeFeedItem); } - + HTTPResponse_free(response); closeCURLSession(curl_session); } @@ -518,6 +667,9 @@ PRIVATE uint16_t processFeed(auto_handle *session, rss_feed* feed, uint8_t first return item_count; } +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + PRIVATE uint16_t processFile(auto_handle *session, const char* xmlfile) { uint32_t item_count = 0; char *xmldata = NULL; @@ -528,7 +680,7 @@ PRIVATE uint16_t processFile(auto_handle *session, const char* xmlfile) { assert(xmlfile && *xmlfile); dbg_printf(P_INFO, "Reading RSS feed file: %s", xmlfile); xmldata = readFile(xmlfile, &fileLen); - + if(xmldata != NULL) { fileLen = strlen(xmldata); items = parse_xmldata(xmldata, fileLen, &item_count, &dummy_ttl); @@ -546,11 +698,11 @@ PRIVATE uint16_t processFile(auto_handle *session, const char* xmlfile) { /////////////////////////////////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { - auto_handle *session = NULL; + auto_handle * ses = NULL; char *config_file = NULL; char *logfile = NULL; + char *pidfile = NULL; char *xmlfile = NULL; - int daemonized = 0; char erbuf[100]; NODE *current = NULL; uint32_t count = 0; @@ -558,6 +710,7 @@ int main(int argc, char **argv) { uint8_t once = 0; uint8_t verbose = AM_DEFAULT_VERBOSE; uint8_t append_log = 0; + uint8_t match_only = 0; /* this sets the log level to the default before anything else is done. ** This way, if any outputting happens in readargs(), it'll be printed @@ -565,128 +718,103 @@ int main(int argc, char **argv) { */ log_init(NULL, verbose, 0); - readargs(argc, argv, &config_file, &logfile, &xmlfile, &nofork, &verbose, &once, &append_log); + readargs(argc, argv, &config_file, &logfile, &pidfile, &xmlfile, &nofork, &verbose, &once, &append_log, &match_only); /* reinitialize the logging with the values from the command line */ log_init(logfile, verbose, append_log); + dbg_printf(P_MSG, "Automatic version: %s", LONG_VERSION_STRING); + if(!config_file) { config_file = am_strdup(AM_DEFAULT_CONFIGFILE); } - - strncpy(AutoConfigFile, config_file, strlen(config_file)); - session = session_init(); + strcpy(AutoConfigFile, config_file); - if(parse_config_file(session, AutoConfigFile) != 0) { - if(errno == ENOENT) { - snprintf(erbuf, sizeof(erbuf), "Cannot find file '%s'", config_file); - } else { - snprintf(erbuf, sizeof(erbuf), "Unknown error"); - } - fprintf(stderr, "Error parsing config file: %s\n", erbuf); - shutdown_daemon(session); + ses = session_init(); + ses->match_only = match_only; + + if(parse_config_file(ses, AutoConfigFile) != 0) { + if(errno == ENOENT) { + snprintf(erbuf, sizeof(erbuf), "Cannot find file '%s'", config_file); + } else { + snprintf(erbuf, sizeof(erbuf), "Unknown error"); + } + + fprintf(stderr, "Error parsing config file: %s\n", erbuf); + shutdown_daemon(ses); + } + + if(!setupSession(ses)) { + shutdown_daemon(ses); } setup_signals(); if(!nofork) { - /* start daemon */ - if(daemonize() != 0) { - dbg_printf(P_ERROR, "Error: Daemonize failed. Aborting..."); - shutdown_daemon(session); + int result = daemonize(pidfile); + if(result != 0) { + dbg_printf(P_ERROR, "Error: Daemonize failed (%d). Aborting...", result); + shutdown_daemon(mySession); } - daemonized = 1; dbg_printft( P_MSG, "Daemon started"); } - filter_printList(session->filters); - - dbg_printf(P_MSG, "Automatic version: %s", LONG_VERSION_STRING); dbg_printf(P_INFO, "verbose level: %d", verbose); - dbg_printf(P_INFO, "Transmission version: 1.%d", session->transmission_version); - dbg_printf(P_INFO, "RPC host: %s", session->host != NULL ? session->host : AM_DEFAULT_HOST); - dbg_printf(P_INFO, "RPC port: %d", session->rpc_port); - dbg_printf(P_INFO, "RPC auth: %s", session->auth != NULL ? session->auth : "none"); - dbg_printf(P_INFO, "foreground mode: %s", nofork == 1 ? "yes" : "no"); - dbg_printf(P_INFO, "config file: %s", AutoConfigFile); - dbg_printf(P_INFO, "Transmission home: %s", session->transmission_path); - dbg_printf(P_INFO, "check interval: %d min", session->check_interval); - dbg_printf(P_INFO, "Upload limit: %d KB/s", session->upspeed); - dbg_printf(P_INFO, "torrent folder: %s", session->torrent_folder); - dbg_printf(P_INFO, "start torrents: %s", session->start_torrent == 1 ? "yes" : "no"); - dbg_printf(P_INFO, "state file: %s", session->statefile); - if(session->prowl_key) { - dbg_printf(P_INFO, "Prowl API key: %s", session->prowl_key); - } - dbg_printf(P_MSG, "%d feed URLs", listCount(session->feeds)); - dbg_printf(P_MSG, "Read %d filters from config file", listCount(session->filters)); + dbg_printf(P_INFO, "foreground mode: %s", nofork == true ? "yes" : "no"); - - if(listCount(session->feeds) == 0) { - dbg_printf(P_ERROR, "No feed URL specified in automatic.conf!\n"); - shutdown_daemon(session); - } - - if(listCount(session->filters) == 0) { - dbg_printf(P_ERROR, "No filters specified in automatic.conf!\n"); - shutdown_daemon(session); - } - - /* determine RPC version */ - if(session->use_transmission && - session->transmission_version == AM_TRANSMISSION_1_3) { - session->rpc_version = getRPCVersion( - (session->host != NULL) ? session->host : AM_DEFAULT_HOST, - session->rpc_port,session->auth); - dbg_printf(P_INFO, "RPC Version: %d", session->rpc_version); - } - - /* check if Prowl API key is given, and if it is valid */ - if(session->prowl_key && verifyProwlAPIKey(session->prowl_key) == 1 ) { - session->prowl_key_valid = 1; - } - - load_state(session->statefile, &session->downloads); while(!closing) { + isRunning = true; dbg_printft( P_INFO, "------ Checking for new episodes ------"); if(xmlfile && *xmlfile) { - processFile(session, xmlfile); + processFile(mySession, xmlfile); once = 1; } else { - current = session->feeds; + current = mySession->feeds; count = 0; while(current && current->data) { ++count; - processFeed(session, current->data, first_run); + processFeed(mySession, current->data, first_run); current = current->next; } if(first_run) { - dbg_printf(P_INFO2, "New bucket size: %d", session->max_bucket_items); + dbg_printf(P_INFO2, "New bucket size: %d", mySession->max_bucket_items); } first_run = 0; } + /* leave loop when program is only supposed to run once */ if(once) { break; } - sleep(session->check_interval * 60); + + isRunning = false; + + if(seenHUP) { + signal_handler(SIGHUP); + } + + sleep(mySession->check_interval * 60); } - shutdown_daemon(session); + + shutdown_daemon(mySession); return 0; } -PRIVATE uint8_t isMagnetURI(const char* url) { +/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +PRIVATE bool isMagnetURI(const char* url) { if(url == NULL || *url == 0) { - return 0; + return false; } - + if(strlen(url) < 7) { - return 0; + return false; } - + return !strncmp(url, "magnet:", 7); - + } diff --git a/src/automatic.conf-sample b/src/automatic.conf-sample old mode 100644 new mode 100755 index db5e741..080d010 --- a/src/automatic.conf-sample +++ b/src/automatic.conf-sample @@ -5,6 +5,9 @@ # Transmission version. Options are "1.2", "1.3", and "external" transmission-version = "1.3" +# For Transmission 1.2x only: Path to the Transmission configuration files +# transmission-home = "~/.config/transmission" + # Call an external program instead of transmission directly # # If you use this, set transmission-version to "external" @@ -26,9 +29,6 @@ transmission-version = "1.3" # For Transmission 1.3x and newer only: If you configured Transmission/Clutch to use password authentication, Automatic needs that information as well # rpc-auth = "user:password" -# For Transmission 1.2x only: Path to the Transmission configuration files -# transmission-home = "~/.config/transmission" - ##################### ## General options ## @@ -37,16 +37,29 @@ transmission-version = "1.3" # list of feed URLs. You can specify one or more feeds, in case of the latter use curly brackets (see the "patterns" option for an example) # Obsolete. Use "feed" option instead. -url = "" +#url = "" # A feed contains at least a feed URL and some optional parameters: # "cookie" => If the feed sits behind a login-secured site, you may specify the cookie information here so that Automatic # can download the feed (and any torrents that are matched) # "id" => Give a feed a numeric ID which can be used to restrict certain filters to only be used with a specific feed. - -feed = { url => "" - cookie => "" - id => 1 +# +# Sometimes the download URLs in the RSS feed don't point to the correct download location for the torrent. +# Then a URL rewrite is necessary. You can use the following (optional) parameters to do that: +# "url_pattern" => Pattern of the URL as found in the RSS feed. Use regular expressions and capture groups +# to capture parts of the URL that need to be reused. +# "url_replace" => The 'new' URL that ought to be used as the actual download link for the torrent. +# You can insert the captured groups from 'url_pattern' here. +# Example: +# "url_pattern" => "http://www.sometorrentsite.com/rssdownload.php/(.+)$" # This URL has 1 capture group (the part in parentheses) +# "url_replace" => "http://www.sometorrentsite.com/download.php?/\1" # Using '\1' in the URL places that part from the above URL +# # at the end of the new URL + +feed = { url => "" + cookie => "" + id => 1 + url_pattern => "" + url_replace => "" } @@ -72,14 +85,18 @@ torrent-folder = "/tmp" # path to the file which stores information about already downloaded torrents (so they don't get readded to Transmission) statefile = "~/.config/automatic.state" -# Prowl API key. You can use this to send push notifications to an iPhone. See http://prowl.weks.net for more information +# Prowl API key. You can use this to send push notifications to an iPhone or an iPad. See http://prowl.weks.net for more information #prowl-apikey = "" +# Pushover API key. Pushover is a service to receive instant push notifications on your phone or tablet from a variety of sources. +# Concatenate API token and user/group key: token_key&user=user_key, ex. "KzGDORePKggZaC0QOYAMyEEuzJnjUi&user=c8a1495ee75825de5983cd1abc8031" +#pushover-apikey = "" + # patterns contains a number of regular expressions which are matched against the RSS feed entries # please don't use curly brackets within a regular expression, it'll horribly break the configuration parser :) # letter-casing does not matter # -# This is obsolete. See "filter" use below +# !!! This is obsolete. See the option "filter" below !!! #patterns = { "Name.of.Something.I.Want.to.Download.Automatically.*HDTV" # "Something.else.to.download.*720p" @@ -93,8 +110,22 @@ statefile = "~/.config/automatic.state" # "feedid" ==> Use this filter only for RSS items from the feed with the specified feed ID # # Please don't use curly brackets within a regular expression, it'll horribly break the configuration parser :) +# +# You can split very long patterns or folders (actually, any sub-option that is a string) over multiple lines, if you end the previous +# line with a '\' or '+': +# +# filter = { pattern => "This.is.a.really.long.*" + +# "regular.expression.spanning" \ +# "multiple.lines" +# } +# + +filter = { pattern => "Name.of.Something.I.Want.to.Download.Automatically.*HDTV" + folder => "/your/download/folder" + feedid => 1 + } -filter = { pattern => "Name.of.Something.I.Want.to.Download.Automatically.*HDTV" +filter = { pattern => "(?!.*(720p|1080p))Something.Else.I.Desparately.Need.To.Watch.But.Not.In.HD" folder => "/your/download/folder" feedid => 1 } diff --git a/src/automatic.service.in b/src/automatic.service.in new file mode 100644 index 0000000..95c785f --- /dev/null +++ b/src/automatic.service.in @@ -0,0 +1,17 @@ +[Unit] +Description=Automatic RSS Downloader + +[Service] +PermissionsStartOnly=True +Type=forking +PIDFile=/run/automatic/automatic.pid +RuntimeDirectory=automatic +CacheDirectory=automatic +LogsDirectory=automatic +LogsDirectoryMode=0755 + +ExecStart=@CMAKE_INSTALL_PREFIX@/automatic -c /etc/automatic.conf --logfile /var/log/automatic/automatic.log -p /run/automatic/automatic.pid +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/src/base64.c b/src/base64.c index c956d86..c029f49 100644 --- a/src/base64.c +++ b/src/base64.c @@ -29,22 +29,25 @@ static const char alphabet[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst * \return pointer to b64-encoded string */ char *base64_encode(const char *input, uint32_t len, uint32_t * setme_len) { - uint32_t i = 0, j = 0; + uint32_t i = 0, j = 0; unsigned char char_3[3]; unsigned char char_4[4]; - uint32_t enc_size, count = 0; - char *ret = NULL, *out = NULL; + uint32_t enc_size, count = 0; + char *ret = NULL, *out = NULL; + + if(!setme_len || !input || len <= 0) { + if(setme_len) { + *setme_len = 0; + } - if(!setme_len || !input || len <= 0) { - *setme_len = 0; - return NULL; - } + return NULL; + } - enc_size = ((len + 13) / 3) * 4; - ret = am_malloc(enc_size); - out = ret; + enc_size = ((len + 13) / 3) * 4; + ret = am_malloc(enc_size); + out = ret; - dbg_printf(P_DBG, "Calculated encoded size: %d", enc_size); + dbg_printf(P_DBG, "Calculated encoded size: %d", enc_size); while (len--) { char_3[i++] = *(input++); if (i == 3) { @@ -54,10 +57,10 @@ char *base64_encode(const char *input, uint32_t len, uint32_t * setme_len) { char_4[3] = char_3[2] & 0x3f; for(i = 0; i < 4; i++) { - *out = alphabet[char_4[i]]; - out++; - count++; - } + *out = alphabet[char_4[i]]; + out++; + count++; + } i = 0; } } @@ -65,7 +68,7 @@ char *base64_encode(const char *input, uint32_t len, uint32_t * setme_len) { if (i != 0) { for(j = i; j < 3; j++) { char_3[j] = '\0'; - } + } char_4[0] = (char_3[0] & 0xfc) >> 2; char_4[1] = ((char_3[0] & 0x03) << 4) + ((char_3[1] & 0xf0) >> 4); @@ -74,18 +77,18 @@ char *base64_encode(const char *input, uint32_t len, uint32_t * setme_len) { for (j = 0; j < i + 1; j++) { *out = alphabet[char_4[j]]; - out++; - count++; - } + out++; + count++; + } while(i++ < 3) { *out = '='; - out++; - count++; - } + out++; + count++; + } } - *out = '\0'; - dbg_printf(P_DBG, "Actual encoded size: %d", count); - *setme_len = count; + *out = '\0'; + dbg_printf(P_DBG, "Actual encoded size: %d", count); + *setme_len = count; return ret; } @@ -95,13 +98,13 @@ static int is_base64(unsigned char c) { } static char find(char c) { - int i; - for(i = 0; i < 64; i++) { - if(alphabet[i] == c) { - return i; - } - } - return -1; + int i; + for(i = 0; i < 64; i++) { + if(alphabet[i] == c) { + return i; + } + } + return -1; } /** \brief Decode Base64-encoded data. @@ -119,19 +122,19 @@ char *base64_decode(const char *encoded_string, uint32_t in_len, uint32_t * setm unsigned char char_array_4[4], char_array_3[3]; char *ret = NULL, *out = NULL; - if(!setme_len || !encoded_string) { - return NULL; - } + if(!setme_len || !encoded_string) { + return NULL; + } ret = am_malloc(3 * (in_len / 4) + 2); - out = ret; + out = ret; while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { char_array_4[i++] = encoded_string[in_]; in_++; if (i ==4) { for (i = 0; i < 4; i++) { char_array_4[i] = find(char_array_4[i]); - } + } char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); @@ -139,9 +142,9 @@ char *base64_decode(const char *encoded_string, uint32_t in_len, uint32_t * setm for (i = 0; (i < 3); i++) { *out = char_array_3[i]; - out++; - count++; - } + out++; + count++; + } i = 0; } } @@ -158,14 +161,14 @@ char *base64_decode(const char *encoded_string, uint32_t in_len, uint32_t * setm char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; for (j = 0; (j < i - 1); j++) { - *out = char_array_3[j]; - out++; - count++; - } + *out = char_array_3[j]; + out++; + count++; + } } - *out = '\0'; + *out = '\0'; - *setme_len = count; + *setme_len = count; return ret; } diff --git a/src/config_parser.c b/src/config_parser.c index 39dbef5..46fe8b0 100644 --- a/src/config_parser.c +++ b/src/config_parser.c @@ -51,20 +51,22 @@ /** \cond */ -#define MAX_OPT_LEN 50 -#define MAX_PARAM_LEN 20000 +#define MAX_OPT_LEN 50 +#define MAX_PARAM_LEN 20000 -struct option_item { - char *str; +struct suboption { + char *option; + char *value; }; -typedef struct option_item option_item_t; +typedef struct suboption suboption_t; /** \endcond */ PRIVATE void freeOptionItem(void* item) { if(item != NULL) { - option_item_t* obj = (option_item_t*)item; - am_free(obj->str); + suboption_t* obj = (suboption_t*)item; + am_free(obj->option); + am_free(obj->value); am_free(obj); } } @@ -78,69 +80,22 @@ PRIVATE void set_path(const char *src, char **dst) { if ( *dst != NULL ) { am_free(*dst); } - *dst = am_strdup(tmp); - am_free(tmp); - } - } -} - -/* TODO: This does currently more than it should, clean this up. */ -PRIVATE char* trim_obsolete(const char *str) { - - int tmp_pos; - char c; - char *retStr; - char *tmp = (char*)am_malloc(MAX_PARAM_LEN+1); - uint32_t line_pos = 0; - uint32_t len = strlen(str); - if(!tmp) { - dbg_printf(P_ERROR, "[trim] calloc(MAX_PARAM_LEN) failed!"); - return NULL; - } - - memset(tmp, 0, MAX_PARAM_LEN+1); - - while (isspace(str[line_pos])) { - ++line_pos; - } + *dst = am_replace_str(tmp, "\\ ", " "); - tmp_pos = 0; - while(line_pos < len) { - /* case 1: quoted strings */ - if (str[line_pos] == '"' || str[line_pos] == '\'') { - c = str[line_pos]; - ++line_pos; /* skip quote */ - while(str[line_pos] != c && line_pos < len && str[line_pos] != '\n' && str[line_pos] != '\0') { - tmp[tmp_pos++] = str[line_pos++]; - } - - if(str[line_pos] == c) { - line_pos++; /* skip the closing quote */ - } - } else { - while(line_pos < len && str[line_pos] != '\n' && str[line_pos] != '\0') { - tmp[tmp_pos++] = str[line_pos++]; + if(*dst == NULL) { + dbg_printf(P_ERROR, "[set_path] Error executing am_replace_str()!"); } - } - - while (isspace(str[line_pos])) { - ++line_pos; + + am_free(tmp); } } - - tmp[tmp_pos] = '\0'; - assert(strlen(tmp) < MAX_PARAM_LEN); - retStr = am_strdup(tmp); - am_free(tmp); - - return retStr; } /* http://stackoverflow.com/questions/122616/how-do-i-trim-leading-trailing-whitespace-in-a-standard-way */ PRIVATE char* trim(const char *str) { const char *end; - + if(!str || !*str) { return NULL; } @@ -151,7 +106,7 @@ PRIVATE char* trim(const char *str) { } if(*str == 0) // All spaces? - { + { return NULL; } @@ -165,7 +120,7 @@ PRIVATE char* trim(const char *str) { while(end > str && isspace(*end)) { end--; } - + /* skip single or double quote */ if (*end == '"' || *end == '\'') { end--; @@ -182,7 +137,7 @@ PRIVATE int parseUInt(const char *str) { int is_num = 1; uint32_t i; uint32_t result = -1; - + char * trimmed = trim(str); for(i = 0; i < strlen(trimmed); i++) { @@ -190,192 +145,190 @@ PRIVATE int parseUInt(const char *str) { is_num--; } } - + if(is_num == 1 && atoi(trimmed) > 0) { result = atoi(trimmed); } - + am_free(trimmed); - return result; } -PRIVATE simple_list parseMultiOption(const char *str) { +PRIVATE suboption_t* parseSubOption(char* line) { + const char *subopt_delim = "=>"; + uint32_t i = 0; + + suboption_t* option_item = NULL; + char *option = NULL; + char *param = NULL; + + assert(line && *line); + + while(line[i] != '\0') { + if(line[i] == subopt_delim[0] && line[i+1] == subopt_delim[1]) { + if(i >1) { + option = am_strndup(line, i-1); + param = trim(line + i + strlen(subopt_delim)); + } else { + dbg_printf(P_ERROR, "Error: Suboption '%s' is malformed!", line); + } + break; + } + + i++; + } + + if(option && param) { + option_item = (suboption_t*)am_malloc(sizeof(suboption_t)); + option_item->option = option; + option_item->value = param; + } + + if(!option_item) { + dbg_printf(P_ERROR, "Error parsing suboption from input string '%s')", line); + am_free(option); + am_free(param); + } + + return option_item; +} + +PRIVATE simple_list parseMultiOption(const char *str) { int tmp_pos; - char c; - char *tmp = (char*)am_malloc(MAX_PARAM_LEN+1); uint32_t line_pos = 0; uint32_t len = strlen(str); simple_list options = NULL; + char tmp[MAX_PARAM_LEN]; + int last_dbl_quote_pos; + int8_t parse_error = 0; + int32_t current_line_pos = 0; - if(!tmp) { - dbg_printf(P_ERROR, "[shorten] calloc(MAX_PARAM_LEN) failed!"); + if(len == 0) { + dbg_printf(P_ERROR, "[parseMultiOption] empty input string!"); return NULL; } - while (isspace(str[line_pos])) { - ++line_pos; - } - - while(line_pos < len) { - memset(tmp, 0, MAX_PARAM_LEN+1); + while(line_pos < len) { + memset(&tmp, 0, sizeof(tmp)); + // Skip any initial whitespace + while (line_pos < len && isspace(str[line_pos])) { + ++line_pos; + } + tmp_pos = 0; - - /* case 1: quoted strings */ - if (str[line_pos] == '"' || str[line_pos] == '\'') { - c = str[line_pos]; - ++line_pos; /* skip quote */ + parse_error = 0; + last_dbl_quote_pos = -1; + + while(line_pos < len && str[line_pos] != '\0') { + if(str[line_pos] == '\"') { + last_dbl_quote_pos = tmp_pos; + } else if(str[line_pos] == '\n') { + // Text is broken over multiple lines + if(str[line_pos - 1] == '\\' || str[line_pos - 1] == '+') { + // skip newline + line_pos++; + // skip whitespace at the beginning of the next line + while (line_pos < len && isspace(str[line_pos])) { + ++line_pos; + } - while(str[line_pos] != c && line_pos < len && str[line_pos] != '\n' && str[line_pos] != '\0') { - tmp[tmp_pos++] = str[line_pos++]; - } + if(str[line_pos] == '\"' && last_dbl_quote_pos != -1) { + // Reset the string index to the position of the last double-quote, and properly null-terminate it + tmp_pos = last_dbl_quote_pos; + tmp[tmp_pos] = '\0'; - if(str[line_pos] == c) { - line_pos++; /* skip the closing quote */ - } - } else { - while(line_pos < len && str[line_pos] != '\n' && str[line_pos] != '\0') { - tmp[tmp_pos++] = str[line_pos++]; + // Skip the double-quote on the new line as well + line_pos++; + } else { + tmp[tmp_pos] = '\0'; + dbg_printf(P_ERROR, "[parseMultiOption] Parsing error at line '%s'", &tmp[current_line_pos]); + parse_error = 1; + break; + } + } else { + // If the character before the newline is not a backslash ('\'), consider this suboption complete + break; + } + + current_line_pos = tmp_pos; } + + tmp[tmp_pos++] = str[line_pos++]; } - /* A line is finished, end it with a null terminator */ + if(parse_error) { + break; + } + + /* A suboption is finished, end it with a null terminator */ tmp[tmp_pos] = '\0'; /* store the line in our list */ if(tmp_pos != 0) { - option_item_t* i = (option_item_t*)am_malloc(sizeof(option_item_t)); - + suboption_t* i = parseSubOption(tmp); + if(i != NULL) { - i->str = am_strdup(tmp); addItem(i, &options); + } else { + dbg_printf(P_ERROR, "Invalid suboption string: '%s'", tmp); } } - - /* skip any additional whitespace at the end of the line */ - while (isspace(str[line_pos])) { - ++line_pos; - } } - assert(strlen(tmp) < MAX_PARAM_LEN); - am_free(tmp); - return options; } - -PRIVATE int parseSubOption(char* line, char **option, char **param) { - const char *subopt_delim = "=>"; - uint32_t i = 0; - - *option = NULL; - *param = NULL; - - assert(line && *line); - - while(line[i] != '\0') { - if(line[i] == subopt_delim[0] && line[i+1] == subopt_delim[1]) { - *option = am_strndup(line, i-1); - *param = am_strdup(line + i + strlen(subopt_delim)); - break; - } - - i++; - } - - if(*option && *param) - return 0; - else - return -1; -} - -PRIVATE int parseFilter(am_filters *patlist, const char* match) { - char *option = NULL, *param = NULL; +PRIVATE int parseFilter(am_filters *filters, const char* filter_str) { am_filter filter = NULL; int32_t result = SUCCESS; /* be optimistic */ - simple_list option_list = NULL; + simple_list option_list = NULL; NODE * current = NULL; - option_item_t *opt_item = NULL; - - option_list = parseMultiOption(match); + suboption_t *opt_item = NULL; + char *tmpStr = NULL; + + option_list = parseMultiOption(filter_str); current = option_list; while (current != NULL) { - opt_item = (option_item_t*)current->data; + opt_item = (suboption_t*)current->data; if(opt_item != NULL) { if(!filter) { filter = filter_new(); assert(filter && "filter_new() failed!"); - } - - if(parseSubOption(opt_item->str, &option, ¶m) == 0) { - if(!strncmp(option, "pattern", 7)) { - filter->pattern = trim(param); - } else if(!strncmp(option, "folder", 6)) { - filter->folder = trim(param); - } else if(!strncmp(option, "feedid", 6)) { - filter->feedID = trim(param); - } else { - dbg_printf(P_ERROR, "Unknown suboption '%s'!", option); - } - - am_free(option); - am_free(param); + } + + if(!strncmp(opt_item->option, "pattern", 7)) { + filter->pattern = trim(opt_item->value); + } else if(!strncmp(opt_item->option, "folder", 6)) { + tmpStr = trim(opt_item->value); + set_path(tmpStr, &filter->folder); + am_free(tmpStr); + } else if(!strncmp(opt_item->option, "feedid", 6)) { + filter->feedID = trim(opt_item->value); } else { - dbg_printf(P_ERROR, "Invalid suboption string: '%s'!", opt_item->str); + dbg_printf(P_ERROR, "Unknown suboption '%s'!", opt_item->option); } } else { assert(0 && "opt_item == NULL"); } - + current = current->next; } if(filter && filter->pattern) { - filter_add(filter, patlist); + filter_add(filter, filters); } else { - dbg_printf(P_ERROR, "Invalid filter: '%s'", match); + dbg_printf(P_ERROR, "Invalid filter: '%s'", filter_str); + filter_free(filter); result = FAILURE; } - - if(option_list != NULL) { - freeList(&option_list, freeOptionItem); - } - - return result; -} -PRIVATE int addPatterns_old(am_filters *patlist, const char* strlist) { - simple_list option_list = NULL; - NODE * current = NULL; - option_item_t *opt_item = NULL; - - assert(patlist != NULL); - - option_list = parseMultiOption(strlist); - current = option_list; - - while (current != NULL) { - opt_item = (option_item_t*)current->data; - if(opt_item != NULL) { - am_filter pat = filter_new(); - assert(pat != NULL); - pat->pattern = strdup(opt_item->str); - filter_add(pat, patlist); - } else { - assert(0 && "opt_item == NULL"); - } - - current = current->next; - } - if(option_list != NULL) { freeList(&option_list, freeOptionItem); } - - return SUCCESS; + + return result; } PRIVATE void parseCookiesFromURL(rss_feed* feed) { @@ -387,48 +340,41 @@ PRIVATE void parseCookiesFromURL(rss_feed* feed) { } PRIVATE int parseFeed(rss_feeds *feeds, const char* feedstr) { - char *option = NULL, *param = NULL; rss_feed* feed = NULL; int32_t result = SUCCESS; /* be optimistic */ - simple_list option_list = NULL; + simple_list option_list = NULL; NODE * current = NULL; - option_item_t *opt_item = NULL; + suboption_t *opt_item = NULL; option_list = parseMultiOption(feedstr); current = option_list; - + while (current != NULL) { - opt_item = (option_item_t*)current->data; + opt_item = (suboption_t*)current->data; + if(opt_item != NULL) { if(!feed) { feed = feed_new(); assert(feed && "feed_new() failed!"); } - - if(parseSubOption(opt_item->str, &option, ¶m) == 0) { - if(!strncmp(option, "url_pattern", 11)) { - feed->url_pattern = trim(param); - } else if(!strncmp(option, "url_replace", 11)) { - feed->url_replace = trim(param); - } else if(!strncmp(option, "url", 3)) { - feed->url = trim(param); - } else if(!strncmp(option, "cookies", 6)) { - feed->cookies = trim(param); - } else if(!strncmp(option, "id", 2)) { - feed->id = trim(param); - } else { - dbg_printf(P_ERROR, "Unknown suboption '%s'!", option); - } - - am_free(option); - am_free(param); + + if(!strncmp(opt_item->option, "url_pattern", 11)) { + feed->url_pattern = trim(opt_item->value); + } else if(!strncmp(opt_item->option, "url_replace", 11)) { + feed->url_replace = trim(opt_item->value); + } else if(!strncmp(opt_item->option, "url", 3)) { + feed->url = trim(opt_item->value); + } else if(!strncmp(opt_item->option, "cookies", 6)) { + feed->cookies = trim(opt_item->value); + } else if(!strncmp(opt_item->option, "id", 2)) { + feed->id = trim(opt_item->value); } else { - dbg_printf(P_ERROR, "Invalid suboption string: '%s'!", opt_item->str); + dbg_printf(P_ERROR, "Unknown suboption '%s'!", opt_item->option); } } else { assert(0 && "opt_item == NULL"); } - + current = current->next; } @@ -441,6 +387,7 @@ PRIVATE int parseFeed(rss_feeds *feeds, const char* feedstr) { feed_add(feed, feeds); } else { dbg_printf(P_ERROR, "Invalid feed: '%s'", feedstr); + feed_free(feed); result = FAILURE; } @@ -451,41 +398,6 @@ PRIVATE int parseFeed(rss_feeds *feeds, const char* feedstr) { return result; } -/* Deprecated */ -PRIVATE int getFeeds(NODE **head, const char* strlist) { - simple_list option_list = NULL; - NODE * current = NULL; - option_item_t *opt_item = NULL; - - assert(head != NULL); - - option_list = parseMultiOption(strlist); - current = option_list; - - while (current != NULL) { - opt_item = (option_item_t*)current->data; - if(opt_item != NULL) { - rss_feed* feed = feed_new(); - assert(feed && "feed_new() failed!"); - feed->url = strdup(opt_item->str); - - /* Maybe the cookies are encoded within the URL */ - parseCookiesFromURL(feed); - feed_add(feed, head); - } else { - assert(0 && "opt_item == NULL"); - } - - current = current->next; - } - - if(option_list != NULL) { - freeList(&option_list, freeOptionItem); - } - - return 0; -} - /** \brief parse option from configuration file. * * \param[in,out] as Pointer to session handle @@ -497,17 +409,22 @@ PRIVATE int getFeeds(NODE **head, const char* strlist) { */ PRIVATE int set_option(auto_handle *as, const char *opt, const char *param, option_type type) { int32_t numval; - dbg_printf(P_INFO2, "%s=%s (type: %d)", opt, param, type); + int32_t result = SUCCESS; + + dbg_printf(P_INFO2, "[config] %s=%s (type: %d)", opt, param, type); assert(as != NULL); if(!strcmp(opt, "url")) { - getFeeds(&as->feeds, param); + dbg_printf(P_ERROR, "the 'url' option is not supported any more, please use the 'feed' option instead!"); + result = FAILURE; } else if(!strcmp(opt, "feed")) { - parseFeed(&as->feeds, param); + result = parseFeed(&as->feeds, param); } else if(!strcmp(opt, "transmission-home")) { set_path(param, &as->transmission_path); } else if(!strcmp(opt, "prowl-apikey")) { as->prowl_key = am_strdup(param); + } else if(!strcmp(opt, "pushover-apikey")) { + as->pushover_key = am_strdup(param); } else if(!strcmp(opt, "transmission-version")) { if (!strcmp(param, "external")) { /* we should probably only set this when transmission-external is set */ @@ -572,14 +489,37 @@ PRIVATE int set_option(auto_handle *as, const char *opt, const char *param, opti dbg_printf(P_ERROR, "Unknown parameter for option '%s': '%s'", opt, param); } } else if(!strcmp(opt, "patterns")) { - addPatterns_old(&as->filters, param); + dbg_printf(P_ERROR, "the 'patterns' option is not supported any more, please use the 'filter' option instead!"); + result = FAILURE; } else if(!strcmp(opt, "filter")) { - parseFilter(&as->filters, param); + result = parseFilter(&as->filters, param); } else { dbg_printf(P_ERROR, "Unknown option: %s", opt); } - - return 0; + + return result; +} + +PRIVATE int SkipWhitespace(const char *line, int line_pos, int * line_number) { + int len = 0; + + /* skip whitespaces */ + if(line && *line) { + len = strlen(line); + + while (isspace(line[line_pos]) && line_pos < len) { + if(line[line_pos] == '\n') { + *line_number += 1; + dbg_printf(P_DBG, "skipping newline (line %d)", *line_number); + } + + ++line_pos; + } + } else { + line_pos = -1; + } + + return line_pos; } @@ -593,31 +533,29 @@ int parse_config_file(struct auto_handle *as, const char *filename) { FILE *fp = NULL; char *line = NULL; char opt[MAX_OPT_LEN + 1]; - char *param = NULL; - char erbuf[100]; - char c; /* for the "" and '' check */ + char param[MAX_PARAM_LEN + 1]; + char c; /* for the "" and '' check */ int line_num = 0; - int line_pos; /* line pos */ - int opt_pos; /* opt pos */ - int param_pos; /* param pos */ + int line_pos = 0; + int opt_pos; + int param_pos; int parse_error = 0; - int opt_good = 0; - int param_good = 0; struct stat fs; option_type type; - if(stat(filename, &fs) == -1) { + if ((fp = fopen(filename, "rb")) == NULL) { + perror("fopen"); return -1; } - dbg_printf(P_INFO2, "Configuration file size: %d", fs.st_size); - if ((fp = fopen(filename, "rb")) == NULL) { - perror("fopen"); + if(stat(filename, &fs) == -1) { + fclose(fp); return -1; } if ((line = am_malloc(fs.st_size + 1)) == NULL) { dbg_printf(P_ERROR, "Can't allocate memory for 'line': %s (%ldb)", strerror(errno), fs.st_size + 1); + fclose(fp); return -1; } @@ -627,27 +565,20 @@ int parse_config_file(struct auto_handle *as, const char *filename) { am_free(line); return -1; } - + + /* NULL-terminate the result */ + line[fs.st_size] = '\0'; + if(fp) { fclose(fp); } - line_pos = 0; - - param = (char*)am_malloc(MAX_PARAM_LEN + 1); - if(!param) { - dbg_printf(P_ERROR, "Can't allocate memory for 'param': %s (%ldb)", strerror(errno), MAX_PARAM_LEN + 1); - am_free(line); - return -1; - } while(line_pos != fs.st_size) { - /* skip whitespaces */ - while (isspace(line[line_pos])) { - if(line[line_pos] == '\n') { - dbg_printf(P_INFO2, "skipping newline (line %d)", line_num); - line_num++; - } - ++line_pos; + line_pos = SkipWhitespace(line, line_pos, &line_num); + + if(line_pos < 0) { + parse_error = 1; + break; } if(line_pos >= fs.st_size) { @@ -656,10 +587,11 @@ int parse_config_file(struct auto_handle *as, const char *filename) { /* comment */ if (line[line_pos] == '#') { - dbg_printf(P_INFO2, "skipping comment (line %d)", line_num); + ////dbg_printf(P_INFO2, "skipping comment (line %d)", line_num); while (line[line_pos] != '\n') { ++line_pos; } + ++line_num; ++line_pos; /* skip the newline as well */ continue; @@ -667,29 +599,27 @@ int parse_config_file(struct auto_handle *as, const char *filename) { /* read option */ for (opt_pos = 0; isprint(line[line_pos]) && line[line_pos] != ' ' && - line[line_pos] != '#' && line[line_pos] != '='; /* NOTHING */) { - opt[opt_pos++] = line[line_pos++]; - if (opt_pos >= MAX_OPT_LEN) { - dbg_printf(P_ERROR, "too long option at line %d", line_num); - parse_error = 1; - opt_good = 0; - } + line[line_pos] != '#' && line[line_pos] != '='; /* NOTHING */) { + opt[opt_pos++] = line[line_pos++]; + if (opt_pos >= MAX_OPT_LEN) { + dbg_printf(P_ERROR, "too long option at line %d", line_num); + parse_error = 1; + } } + if (opt_pos == 0 || parse_error == 1) { dbg_printf(P_ERROR, "parse error at line %d (pos: %d)", line_num, line_pos); parse_error = 1; break; } else { opt[opt_pos] = '\0'; - opt_good = 1; } - /* skip whitespaces */ - while (isspace(line[line_pos])) { - if(line[line_pos] == '\n') { - line_num++; - dbg_printf(P_INFO2, "skipping newline (line %d)", line_num); - } - ++line_pos; + + line_pos = SkipWhitespace(line, line_pos, &line_num); + + if(line_pos < 0) { + parse_error = 1; + break; } if(line_pos >= fs.st_size) { @@ -698,18 +628,16 @@ int parse_config_file(struct auto_handle *as, const char *filename) { /* check for '=' */ if (line[line_pos++] != '=') { - snprintf(erbuf, sizeof(erbuf), "Option '%s' needs a parameter (line %d)", opt, line_num); + dbg_printf(P_ERROR, "Option '%s' needs a parameter (line %d)", opt, line_num); parse_error = 1; break; } - /* skip whitespaces */ - while (isspace(line[line_pos])) { - if(line[line_pos] == '\n') { - line_num++; - dbg_printf(P_INFO2, "skipping newline (line %d)", line_num); - } - ++line_pos; + line_pos = SkipWhitespace(line, line_pos, &line_num); + + if(line_pos < 0) { + parse_error = 1; + break; } if(line_pos >= fs.st_size) { @@ -722,84 +650,87 @@ int parse_config_file(struct auto_handle *as, const char *filename) { if (line[line_pos] == '"' || line[line_pos] == '\'') { c = line[line_pos]; /* single or double quote */ ++line_pos; /* skip quote */ - parse_error = 0; - for (param_pos = 0; line[line_pos] != c; /* NOTHING */) { - if(line_pos < fs.st_size && param_pos < MAX_PARAM_LEN && line[line_pos] != '\n') { - param[param_pos++] = line[line_pos++]; - } else { - snprintf(erbuf, sizeof(erbuf), "Option %s has a too long parameter (line %d)\n",opt, line_num); - parse_error = 1; + parse_error = 1; + for (param_pos = 0; (param_pos < MAX_PARAM_LEN) && (line_pos < fs.st_size) && (line[line_pos] != '\n'); /* NOTHING */) { + if( line[line_pos] == c) { + parse_error = 0; break; } + param[param_pos++] = line[line_pos++]; } + if(parse_error == 0) { - line_pos++; /* skip the closing " or ' */ + line_pos++; /* skip the closing single or double quote */ type = CONF_TYPE_STRING; } else { + dbg_printf(P_ERROR, "Option '%s' has a too long parameter (line %d). Closing quote missing?", opt, line_num); break; } - /* case 2: multiple items, linebreaks allowed */ - } else if (line[line_pos] == '{') { - dbg_printf(P_INFO2, "reading multiline param", line_num); + } else if (line[line_pos] == '{') { /* case 2: multiple items, linebreaks allowed */ + dbg_printf(P_DBG, "reading multiline param", line_num); ++line_pos; - parse_error = 0; - for (param_pos = 0; line[line_pos] != '}'; /* NOTHING */) { - if(line_pos < fs.st_size && param_pos < MAX_PARAM_LEN) { - param[param_pos++] = line[line_pos++]; - if(line[line_pos] == '\n') - line_num++; - } else { - snprintf(erbuf, sizeof(erbuf), "Option %s has a too long parameter (line %d)\n", opt, line_num); - parse_error = 1; + parse_error = 1; + + for (param_pos = 0; (line_pos < fs.st_size) && (param_pos < MAX_PARAM_LEN); /* NOTHING */) { + if(line[line_pos] == '}') { + parse_error = 0; break; } + param[param_pos++] = line[line_pos++]; + if(line[line_pos] == '\n') { + line_num++; + } } - dbg_printf(P_INFO2, "multiline param: param_good=%d", param_good); + if(parse_error == 0) { - line_pos++; /* skip the closing '}' */ + line_pos++; /* skip the closing '}' */ type = CONF_TYPE_STRINGLIST; } else { + dbg_printf(P_ERROR, "Option %s has a too long parameter (line %d). Closing bracket missing?", opt, line_num); + parse_error = 1; break; } - /* Case 3: integers */ - } else { + } else { /* Case 3: integers */ parse_error = 0; - for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos]) - && line[line_pos] != '#'; /* NOTHING */) { + for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos]) && line[line_pos] != '#'; /* NOTHING */) { param[param_pos++] = line[line_pos++]; if (param_pos >= MAX_PARAM_LEN) { - snprintf(erbuf, sizeof(erbuf), "Option %s has a too long parameter (line %d)\n", opt, line_num); + dbg_printf(P_ERROR, "Option %s has a too long parameter (line %d)", opt, line_num); parse_error = 1; break; } } + if(parse_error == 0) { type = CONF_TYPE_INT; } else { break; } } + param[param_pos] = '\0'; - dbg_printf(P_INFO2, "[parse_config_file] option: %s", opt); - dbg_printf(P_INFO2, "[parse_config_file] param: %s (%d byte)", param, strlen(param)); - dbg_printf(P_INFO2, "[parse_config_file] -----------------"); - set_option(as, opt, param, type); - - /* skip whitespaces */ - while (isspace(line[line_pos])) { - if(line[line_pos] == '\n') - line_num++; - ++line_pos; + dbg_printf(P_DBG, "[parse_config_file] option: %s", opt); + dbg_printf(P_DBG, "[parse_config_file] param: %s (%d byte)", param, strlen(param)); + dbg_printf(P_DBG, "[parse_config_file] -----------------"); + + if(set_option(as, opt, param, type) == FAILURE) { + parse_error = 1; + break; } - + + line_pos = SkipWhitespace(line, line_pos, &line_num); + + if(line_pos < 0) { + parse_error = 1; + break; + } + if(line_pos >= fs.st_size) { break; } } am_free(line); - am_free(param); return (parse_error == 1) ? -1 : 0; } - diff --git a/src/downloads.c b/src/downloads.c index 9dbfd5a..2823a86 100644 --- a/src/downloads.c +++ b/src/downloads.c @@ -48,7 +48,7 @@ static uint8_t bucket_hasGUID(const char * guid, NODE *head) { NODE *p = head; char *x; - + if(guid && *guid) { while (p != NULL) { x = (char*)p->data; @@ -60,7 +60,7 @@ static uint8_t bucket_hasGUID(const char * guid, NODE *head) { p = p->next; } } - + return 0; } @@ -73,15 +73,7 @@ static uint8_t bucket_hasGUID(const char * guid, NODE *head) { */ uint8_t has_been_downloaded(const simple_list bucket, const feed_item item) { -#if 0 - if(bucket_hasGUID(item->guid, bucket) || bucket_hasGUID(item->url, bucket)) { - return 1; - } - - return 0; -#else return bucket_hasGUID(item->guid, bucket) || bucket_hasGUID(item->url, bucket); -#endif } /** \brief add new item to bucket list @@ -94,12 +86,12 @@ uint8_t has_been_downloaded(const simple_list bucket, const feed_item item) { * The size of the provided bucket list is kept to maxBucketItems. * If it gets larger than the specified value, the oldest element is removed from the list. */ -int addToBucket(const char* guid, NODE **head, const int maxBucketItems) { - +int addToBucket(const char* guid, NODE **head, const uint16_t maxBucketItems) { addToHead(am_strdup(guid), head); - if(maxBucketItems > 0 && listCount(*head) > (uint32_t)maxBucketItems) { + if(maxBucketItems > 0 && listCount(*head) > maxBucketItems) { dbg_printf(P_INFO2, "[add_to_bucket] bucket gets too large, deleting last item...\n"); removeLast(*head, NULL); } + return 0; } diff --git a/src/file.c b/src/file.c index 40f5c55..3a9dc1f 100644 --- a/src/file.c +++ b/src/file.c @@ -75,7 +75,7 @@ char* readFile(const char *fname, uint32_t *setme_len) { * \return 0 if saving was successful, -1 otherwise. */ int saveFile(const char *name, const void *data, uint32_t size) { - int fh, ret = -1; + int fh, ret = 0; if (!name || !data) { return -1; @@ -88,15 +88,15 @@ int saveFile(const char *name, const void *data, uint32_t size) { } else { ret = write(fh, data, size); if ((uint32_t)ret != size) { - dbg_printf(P_ERROR, "[saveFile] Error writing torrent file: %s", - strerror(errno)); + dbg_printf(P_ERROR, "[saveFile] Error writing torrent file: %s", (errno)); ret = -1; } else { dbg_printf(P_INFO, "Saved torrent file '%s'", name); } + fchmod(fh, 0644); close(fh); - ret = 0; } + return ret; } diff --git a/src/filters.c b/src/filters.c index bedee28..245cfad 100644 --- a/src/filters.c +++ b/src/filters.c @@ -85,6 +85,8 @@ PUBLIC void filter_printList(simple_list list) { cur = cur->next; } dbg_printf(P_INFO2, "------- end -------------\n"); +#else + (void)list; #endif } diff --git a/src/json.c b/src/json.c index d8fe5e5..62d95e0 100644 --- a/src/json.c +++ b/src/json.c @@ -36,48 +36,54 @@ * The packet can then be sent to Transmission via HTTP POST. */ char* makeTorrentAddFilenameJSON(const char* torrent_name, uint8_t start, const char* folder, uint32_t *setme_size) { - char *buf = NULL; - char *folder_str = NULL; - int buf_size, json_size, folderstr_size = 0; - const char *JSONstr = - "{\n" - "\"method\": \"torrent-add\",\n" - "\"arguments\": {\n" - "\"filename\": \"%s\",\n" + char *buf = NULL; + char *folder_str = NULL; + int buf_size, json_size, folderstr_size = 0; + const char *JSONstr = + "{\n" + "\"method\": \"torrent-add\",\n" + "\"arguments\": {\n" + "\"filename\": \"%s\",\n" "%s" "\"paused\": %d\n" - "}\n" - "}"; + "}\n" + "}"; + + if(!setme_size) { + dbg_printf(P_ERROR, "setme_size == NULL"); + return NULL; + } + + *setme_size = 0; - *setme_size = 0; + if(folder && *folder) { + folderstr_size = strlen(folder) + 20; + folder_str = (char*)am_malloc(folderstr_size); + assert(folder_str && "am_malloc(folder_str) failed!"); + snprintf(folder_str, folderstr_size, "\"download-dir\": \"%s\",\n", folder); + dbg_printf(P_INFO, "folder_str: %s", folder_str); + } - if(folder && *folder) { - folderstr_size = strlen(folder) + 20; - folder_str = (char*)am_malloc(folderstr_size); - assert(folder_str && "am_malloc(folder_str) failed!"); - snprintf(folder_str, folderstr_size, "\"download-dir\": \"%s\",\n", folder); - dbg_printf(P_INFO, "folder_str: %s", folder_str); - } + buf_size = strlen(torrent_name) + strlen(JSONstr) + folderstr_size + 10; + buf = (char*)am_malloc(buf_size); + memset(buf, 0, buf_size); - buf_size = strlen(torrent_name) + strlen(JSONstr) + folderstr_size + 10; - buf = (char*)am_malloc(buf_size); - memset(buf, 0, buf_size); - json_size = snprintf(buf, buf_size, JSONstr, torrent_name, folder_str ? folder_str : "", start ? 0 : 1); - if(json_size < 0 || json_size >= buf_size) { - dbg_printf(P_ERROR, "Error producing JSON string with Base64-encoded metadata: %s", strerror(errno)); - am_free(buf); - return NULL; - } - - buf[json_size] = '\0'; - dbg_printf(P_INFO2, "JSON: %s", buf); - - if(setme_size) { - *setme_size = json_size; - } - - am_free(folder_str); - return buf; + json_size = snprintf(buf, buf_size, JSONstr, torrent_name, folder_str ? folder_str : "", start ? 0 : 1); + + if(json_size < 0 || json_size >= buf_size) { + dbg_printf(P_ERROR, "Error producing JSON string with Base64-encoded metadata: %s", strerror(errno)); + am_free(folder_str); + am_free(buf); + return NULL; + } + + buf[json_size] = '\0'; + dbg_printf(P_INFO2, "JSON: %s", buf); + + *setme_size = json_size; + + am_free(folder_str); + return buf; } /** \brief Create a Transmission-specific JSON packet in order to add a new download @@ -95,21 +101,26 @@ char* makeTorrentAddFilenameJSON(const char* torrent_name, uint8_t start, const */ char* makeTorrentAddMetaInfoJSON(const void *data, uint32_t tsize, uint8_t start, const char* folder, uint32_t *setme_size) { - char *encoded = NULL; + char *encoded = NULL; - char *buf = NULL; - char *folder_str = NULL; - int buf_size, json_size, folderstr_size = 0; - uint32_t enc_size; - const char *JSONstr = - "{\n" - "\"method\": \"torrent-add\",\n" - "\"arguments\": {\n" - "\"metainfo\": \"%s\",\n" - "%s" - "\"paused\": %d\n" - "}\n" - "}"; + char *buf = NULL; + char *folder_str = NULL; + int buf_size, json_size, folderstr_size = 0; + uint32_t enc_size; + const char *JSONstr = + "{\n" + "\"method\": \"torrent-add\",\n" + "\"arguments\": {\n" + "\"metainfo\": \"%s\",\n" + "%s" + "\"paused\": %d\n" + "}\n" + "}"; + + if(!setme_size) { + dbg_printf(P_ERROR, "setme_size == NULL"); + return NULL; + } *setme_size = 0; @@ -130,24 +141,26 @@ char* makeTorrentAddMetaInfoJSON(const void *data, uint32_t tsize, uint8_t start json_size = snprintf(buf, buf_size, JSONstr, encoded, folder_str ? folder_str : "", start ? 0 : 1); if(json_size < 0 || json_size >= buf_size) { dbg_printf(P_ERROR, "Error producing JSON string with Base64-encoded metadata: %s", strerror(errno)); + am_free(folder_str); am_free(encoded); am_free(buf); return NULL; } + buf[json_size] = '\0'; dbg_printf(P_INFO2, "JSON: %s", buf); - if(setme_size) { - *setme_size = json_size; - } + + *setme_size = json_size; + am_free(folder_str); am_free(encoded); return buf; } + return NULL; } char* makeChangeUpSpeedJSON(torrent_id_t tID, uint32_t upspeed, uint8_t rpcVersion, uint32_t *setme_size) { - char *buf = NULL; int buf_size, json_size = 0; const char *JSONstr = @@ -160,6 +173,11 @@ char* makeChangeUpSpeedJSON(torrent_id_t tID, uint32_t upspeed, uint8_t rpcVersi "}\n" "}"; + if(!setme_size) { + dbg_printf(P_ERROR, "setme_size == NULL"); + return NULL; + } + *setme_size = 0; if(rpcVersion <= 0) { @@ -198,9 +216,7 @@ char* makeChangeUpSpeedJSON(torrent_id_t tID, uint32_t upspeed, uint8_t rpcVersi } buf[json_size] = '\0'; - if(setme_size) { - *setme_size = json_size; - } + *setme_size = json_size; return buf; } @@ -215,13 +231,10 @@ char* makeChangeUpSpeedJSON(torrent_id_t tID, uint32_t upspeed, uint8_t rpcVersi */ char* parseResponse(const char* response) { - const char* result_regex = "\"result\":\\s*\"(.+)\""; - char *result_str = NULL; - result_str = getRegExMatch(result_regex, response, 1); - return result_str; + const char* result_regex = "\"result\":\\s*\"(.+)\""; + return getRegExMatch(result_regex, response, 1); } - torrent_id_t parseTorrentID(const char* response) { const char* result_regex = "\"id\":\\s*(\\d+)"; char *result_str = NULL; @@ -241,6 +254,7 @@ int8_t parseRPCVersion(const char* response) { char *result_str = NULL; int8_t result = -1; result_str = getRegExMatch(result_regex, response, 1); + if(result_str) { result = atoi(result_str); am_free(result_str); diff --git a/src/list.c b/src/list.c index 51320f4..a4df714 100644 --- a/src/list.c +++ b/src/list.c @@ -225,7 +225,7 @@ int addToTail(void* elem, NODE **head) { void freeList( NODE **head, listFuncPtr freeFunc ) { NODE* node = NULL; - dbg_printf(P_INFO2, "[cleanupList] size before: %d", listCount(*head)); + dbg_printf(P_DBG, "[cleanupList] size before: %d", listCount(*head)); while (*head != NULL) { node = *head; *head = (*head)->next; @@ -236,7 +236,7 @@ void freeList( NODE **head, listFuncPtr freeFunc ) { } am_free(node); } - dbg_printf(P_INFO2, "[cleanupList] size after: %d", listCount(*head)); + dbg_printf(P_DBG, "[cleanupList] size after: %d", listCount(*head)); } /** \brief Remove the last item of a list diff --git a/src/memwatch.c b/src/memwatch.c index c3a2eb1..a05c8ea 100644 --- a/src/memwatch.c +++ b/src/memwatch.c @@ -834,7 +834,8 @@ static int mwARI( const char *estr ) { int c; fprintf(mwSTDERR, "\n%s\nMEMWATCH: Abort, Retry or Ignore? ", estr); (void) fgets(inbuf,sizeof(inbuf),stdin); - for( c=0; inbuf[c] && inbuf[c] <= ' '; c++ ) ; + for( c=0; inbuf[c] && inbuf[c] <= ' '; c++ ) + ; c = inbuf[c]; if( c == 'R' || c == 'r' ) { mwBreakOut( estr ); @@ -1749,7 +1750,7 @@ static int mwRelink( mwData* mw, const char* file, int line ) { if( mw1->next ) { if( !mwIsReadAddr(mw1->next,mwDataSize) || - !mw1->next->check != CHKVAL(mw1) || + (!mw1->next->check) != CHKVAL(mw1) || mw1->next->prev != mw1 ) { mwWrite("relink: forward chain's last intact MW is MW-%p, %ld %sbytes at %s(%d)\n", @@ -1791,7 +1792,7 @@ static int mwRelink( mwData* mw, const char* file, int line ) { if( mw2->prev ) { if( !mwIsReadAddr(mw2->prev,mwDataSize) || - !mw2->prev->check != CHKVAL(mw2) || + (!mw2->prev->check) != CHKVAL(mw2) || mw2->prev->next != mw2 ) { mwWrite("relink: reverse chain's last intact MW is MW-%p, %ld %sbytes at %s(%d)\n", diff --git a/src/output.c b/src/output.c index 1bc7343..e8f927e 100644 --- a/src/output.c +++ b/src/output.c @@ -44,6 +44,8 @@ static FILE *gLogFP = NULL; static int8_t gMsglevel; +static const char *gPidfile = NULL; + unsigned char log_init(const char *logfile, char msglevel, char append_log) { gMsglevel = msglevel; if(logfile && *logfile) { @@ -69,6 +71,31 @@ void log_close(void) { } } +unsigned char pid_create(const char *pidfile, int pid) { + FILE *gPidFP; + + if(pidfile && *pidfile) { + if((gPidFP = fopen(pidfile, "w")) == NULL) { + dbg_printf(P_ERROR, "[pid_create] Opening '%s' for pidfile failed", pidfile); + return 1; //bad (well, not really) + } else { + dbg_printf(P_MSG, "[pid_create] Opening '%s' for pidfile (pid:%d)", pidfile, pid); + fprintf(gPidFP, "%d\n", pid); + fclose(gPidFP); + gPidfile = pidfile; + } + } + return 1; //all good +} + +void pid_close() { + if(gPidfile && *gPidfile) { + remove(gPidfile); + gPidfile = NULL; + } +} + + /** \brief Print log information to stdout. * * \param[in] type Type of logging statement. diff --git a/src/prowl.c b/src/prowl.c index 99c5418..2e8704b 100644 --- a/src/prowl.c +++ b/src/prowl.c @@ -32,7 +32,7 @@ #include "output.h" #include "utils.h" -#define PROWL_URL "https://prowlapp.com" +#define PROWL_URL "https://api.prowlapp.com" #define PROWL_ADD "/publicapi/add" #define PROWL_VERIFY "/publicapi/verify" @@ -44,7 +44,7 @@ static const char* getProwlErrorMessage(const uint16_t responseCode) { response = "Bad request"; break; case 401: - response = "Invald API key"; + response = "Invalid API key"; break; case 405: response = "Method not allowed (non-SSL connection)"; @@ -120,6 +120,7 @@ int16_t sendProwlNotification(const char* apikey, const char* event, const char* } am_free(data); } + return result; } @@ -141,13 +142,13 @@ int16_t verifyProwlAPIKey(const char* apikey) { dbg_printf(P_ERROR, "Error: Prowl API key '%s' is invalid (%d)!", apikey, response->responseCode); result = -response->responseCode; } - + HTTPResponse_free(response); } - + closeCURLSession(curl_session); } - + return result; } @@ -160,11 +161,11 @@ int8_t prowl_sendNotification(enum prowl_event event, const char* apikey, const switch(event) { case PROWL_NEW_DOWNLOAD: event_str = "Torrent File Auto-Added"; - snprintf(desc, 500, "%s", filename); + snprintf(desc, sizeof(desc), "%s", filename); break; case PROWL_DOWNLOAD_FAILED: event_str = "Auto-Add Failed"; - snprintf(desc, 500, "%s", filename); + snprintf(desc, sizeof(desc), "%s", filename); break; default: dbg_printf(P_ERROR, "Unknown Prowl event code %d", event); @@ -178,5 +179,6 @@ int8_t prowl_sendNotification(enum prowl_event event, const char* apikey, const } else { result = 0; } + return result; } diff --git a/src/pushover.c b/src/pushover.c new file mode 100644 index 0000000..543c56d --- /dev/null +++ b/src/pushover.c @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2008 Frank Aurich (1100101+automatic@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + + +#include +#include +#include +#include + +#ifdef MEMWATCH +#include "memwatch.h" +#endif + +#include "pushover.h" +#include "web.h" +#include "output.h" +#include "utils.h" + +#define PUSHOVER_URL "https://api.pushover.net" +#define PUSHOVER_ADD "/1/messages.json" + +static const char* getErrorMessage(const uint16_t responseCode) { + const char* response; + + switch(responseCode) { + case 400: + response = "Bad request"; + break; + case 405: + response = "Method not allowed (non-SSL connection)"; + break; + case 406: + response = "API limit exceeded"; + break; + case 410: + response = "AuthorizationToken no longer valid"; + break; + case 500: + response = "Internal server error"; + break; + case 503: + response = "Service unavailable"; + break; + default: + response = "Unknown error!"; + } + return response; +} + +static char* createMessage(const char* apikey, const char* event, const char* desc, int32_t *size) { + int32_t result, apikey_length, event_length, desc_length, total_size; + + char *msg = NULL; + + *size = 0; + + if(!apikey) { + dbg_printf(P_ERROR, "[createMessage] apikey == NULL"); + *size = 0; + return NULL; + } + + if(!desc) { + dbg_printf(P_ERROR, "[createMessage] desc == NULL"); + *size = 0; + return NULL; + } + + apikey_length = strlen(apikey); + event_length = event ? strlen(event) : 0; + desc_length = desc ? strlen(desc) : 0; + + total_size = apikey_length + event_length + desc_length + 80; + msg = (char*)am_malloc(total_size); + + if(msg) { + result = snprintf(msg, total_size, "token=%s&title=%s&message=%s", apikey, event, desc); + *size = result; + } + return msg; +} + +int16_t sendPushoverNotification(const char* apikey, const char* event, const char* desc) { + int16_t result = -1; + int32_t data_size; + char url[128]; + HTTPResponse *response = NULL; + char *data = NULL; + + data = createMessage(apikey, event, desc, &data_size); + + if(data) { + snprintf(url, 128, "%s%s", PUSHOVER_URL, PUSHOVER_ADD); + response = sendHTTPData(url, NULL, data, data_size); + if(response) { + if(response->responseCode == 200) { + result = 1; + } else { + dbg_printf(P_ERROR, "Pushover Notification failed: %s (%d)", + getErrorMessage(response->responseCode), + response->responseCode); + result = -response->responseCode; + } + HTTPResponse_free(response); + } + am_free(data); + } + + return result; +} + +int8_t pushover_sendNotification(enum pushover_event event, const char* apikey, const char *filename) { + int8_t result; + char desc[500]; + char *event_str = NULL; + + switch(event) { + case PUSHOVER_NEW_DOWNLOAD: + event_str = "Torrent File Auto-Added"; + snprintf(desc, sizeof(desc), "%s", filename); + break; + case PUSHOVER_DOWNLOAD_FAILED: + event_str = "Auto-Add Failed"; + snprintf(desc, sizeof(desc), "%s", filename); + break; + default: + dbg_printf(P_ERROR, "Unknown Pushover event code %d", event); + return 0; + } + + dbg_printf(P_INFO, "[pushover_sendNotification] I: %d E: %s\tD: %s", event, event_str, desc); + + if(sendPushoverNotification(apikey, event_str, desc) == 1) { + result = 1; + } else { + result = 0; + } + return result; +} diff --git a/src/regex.c b/src/regex.c index 50f1d1b..9f8c678 100644 --- a/src/regex.c +++ b/src/regex.c @@ -10,9 +10,20 @@ #include "memwatch.h" #endif -#define OVECCOUNT 30 +PRIVATE int32_t getPCRECaptureCount(const pcre * code) { + int32_t count = 0; + int32_t result; + if(code != NULL) { + if((result = pcre_fullinfo(code, NULL, PCRE_INFO_CAPTURECOUNT, &count)) != 0) { + dbg_printf(P_ERROR, "[getPCRECaptureCount] pcre_fullinfo() returned %d", result); + count = result; + } + } + + return count; +} -static pcre* init_regex(const char* pattern) { +PRIVATE pcre* init_regex(const char* pattern) { int err; pcre *re = NULL; const char* errbuf = NULL; @@ -28,6 +39,7 @@ static pcre* init_regex(const char* pattern) { if(re == NULL) { dbg_printf(P_ERROR, "[init_regex] PCRE compilation failed at offset %d: %s (pattern: %s)", err, errbuf, pattern); } + return re; } @@ -55,6 +67,7 @@ uint8_t isRegExMatch(const char* pattern, const char* str) { err = pcre_exec(preg, NULL, str, strlen(str), 0, 0, NULL, 0); dbg_printf(P_DBG, "[isRegExMatch] err=%d", err); if (!err) { /* regex matches */ + dbg_printf(P_MSG, "[isRegExMatch] '%s' matches '%s'", pattern, str); result = 1; } else { if(err != PCRE_ERROR_NOMATCH) { @@ -64,32 +77,48 @@ uint8_t isRegExMatch(const char* pattern, const char* str) { } pcre_free(preg); } + return result; } -int32_t getRegExCaptureGroups(const char* pattern, const char* str, int catgroupcount, const char ***stringlist) { +int32_t getRegExCaptureGroups(const char* pattern, const char* str, const char ***stringlist) { int32_t count = -1; pcre *result_preg = NULL; - int * offsets = NULL; + int32_t * ovec = NULL; + int32_t captureGroupCount; + int32_t ovecSize; if(!str || (str && strlen(str) == 0)) { dbg_printf(P_ERROR, "[getRegExCaptureGroups] Empty string!"); return 0; } - offsets = (int*)am_malloc(catgroupcount * sizeof(int)); - - if(offsets == NULL) { - dbg_printf(P_ERROR, "[getRegExCaptureGroups] malloc(offsets) failed!"); - return 0; - } - result_preg = init_regex(pattern); + if(result_preg) { - dbg_printf(P_INFO2, "[getRegExCaptureGroups] Text to match against: %s (%d byte)", str, strlen(str)); - count = pcre_exec(result_preg, NULL, str, strlen(str), 0, 0, offsets, catgroupcount); + captureGroupCount = getPCRECaptureCount(result_preg); + + if(captureGroupCount < 0) { + captureGroupCount = 9; // Fallback, in case pcre_fullinfo() returned an error + } + + ovecSize = captureGroupCount > 0 ? (captureGroupCount + 1 ) * 3 : 0; + + if(ovecSize > 0) { + ovec = (int32_t*)am_malloc(ovecSize * sizeof(int32_t)); + + if(ovec == NULL) { + dbg_printf(P_ERROR, "[getRegExCaptureGroups] malloc(offsets) failed!"); + pcre_free(result_preg); + return 0; + } + } + + dbg_printf(P_DBG, "[getRegExCaptureGroups] Text to match against: %s (%d byte)", str, strlen(str)); + + count = pcre_exec(result_preg, NULL, str, strlen(str), 0, 0, ovec, ovecSize); if(count > 1) { /* regex matches */ - if(pcre_get_substring_list(str, offsets, count, stringlist) < 0) { + if(pcre_get_substring_list(str, ovec, count, stringlist) < 0) { dbg_printf(P_ERROR, "[getRegExCaptureGroups] Unable to obtain captured strings in regular expression."); } } else if(count < 0) { @@ -97,14 +126,14 @@ int32_t getRegExCaptureGroups(const char* pattern, const char* str, int catgroup dbg_printf(P_DBG, "[getRegExCaptureGroups] No match"); } else { dbg_printf(P_ERROR, "[getRegExCaptureGroups] regexec error: %d", count); - } + } } + am_free(ovec); + pcre_free(result_preg); } - - am_free(offsets); - + return count; } @@ -129,39 +158,18 @@ char* getRegExMatch(const char* pattern, const char* str, uint8_t which_result) return NULL; } -#if 1 - count = getRegExCaptureGroups(pattern, str, OVECCOUNT, &stringlist); - if(count > which_result) { - result_str = am_strdup(stringlist[which_result]); - pcre_free_substring_list(stringlist); - } -#else - result_preg = init_regex(pattern); - if(result_preg) { - dbg_printf(P_INFO2, "[getRegExMatch] Text to match against: %s (%d byte)", str, strlen(str)); - count = pcre_exec(result_preg, NULL, str, strlen(str), 0, 0, offsets, OVECCOUNT); - if(count > which_result) { /* regex matches */ - if(pcre_get_substring_list(str, offsets, count, &stringlist) < 0) { - dbg_printf(P_ERROR, "[getRegExMatch] Unable to obtain captured strings in regular expression."); - } else { - int i; - for (i = 0; i < count; i++) { - dbg_printf(P_DBG, "%2d: %s", i, stringlist[i]); - } - result_str = am_strdup(stringlist[which_result]); - pcre_free_substring_list(stringlist); - } - } else if(count < 0) { - if(count == PCRE_ERROR_NOMATCH) { - dbg_printf(P_DBG, "[getRegExMatch] No match"); - } else { - dbg_printf(P_ERROR, "[getRegExMatch] regexec error: %d", count); - } + count = getRegExCaptureGroups(pattern, str, &stringlist); + + if(count > 0) { + if(count > which_result) { + result_str = am_strdup(stringlist[which_result]); + pcre_free_substring_list(stringlist); + } else { + dbg_printf(P_ERROR, "[getRegexMatch] Requested substring (%d) exceeds number of captured substrings (%d)!", which_result, count); } - pcre_free(result_preg); } - #endif - return strstrip(result_str); + + return am_strstrip(result_str); } char * performRegexReplace(const char* str, const char* pattern, const char* replace) { @@ -194,7 +202,7 @@ char * performRegexReplace(const char* str, const char* pattern, const char* rep return NULL; } - match_count = getRegExCaptureGroups(pattern, str, OVECCOUNT, &stringlist); + match_count = getRegExCaptureGroups(pattern, str, &stringlist); if(match_count > 1) { len = strlen(replace); for(pos = 0; pos < len; ++pos) { diff --git a/src/rss_feed.c b/src/rss_feed.c index 93fa1cc..86dbd4c 100644 --- a/src/rss_feed.c +++ b/src/rss_feed.c @@ -55,7 +55,7 @@ PUBLIC rss_feed* feed_new(void) { rss_feed* i = (rss_feed*)am_malloc(sizeof(struct rss_feed)); if(i != NULL) { i->url = NULL; - i->cookies = NULL; + i->cookies = NULL; i->id = NULL; i->url_pattern = NULL; i->url_replace = NULL; @@ -74,22 +74,24 @@ PUBLIC rss_feed* feed_new(void) { */ void feed_printList(simple_list list) { #ifdef DEBUG - NODE *cur = list; - rss_feed* x; - - dbg_printf(P_INFO2, "------- start -------------\n"); - while(cur != NULL && cur->data != NULL) { - dbg_printf(P_INFO2, "data: (%p)\n", (void*)cur->data); - x = (rss_feed*)cur->data; - if(x->url != NULL) { - dbg_printf(P_INFO2, " url: %s (%p)\n", x->url, (void*)x->url); - } - dbg_printf(P_INFO2, " ttl: %d\n", x->ttl); - /*dbg_printf(P_INFO2, " count: %d\n", x->count);*/ - dbg_printf(P_INFO2, " next: (%p)\n", (void*)cur->next); - cur = cur->next; - } - dbg_printf(P_INFO2, "------- end -------------\n"); + NODE *cur = list; + rss_feed* x; + + dbg_printf(P_INFO2, "------- start -------------\n"); + while(cur != NULL && cur->data != NULL) { + dbg_printf(P_INFO2, "data: (%p)\n", (void*)cur->data); + x = (rss_feed*)cur->data; + if(x->url != NULL) { + dbg_printf(P_INFO2, " url: %s (%p)\n", x->url, (void*)x->url); + } + dbg_printf(P_INFO2, " ttl: %d\n", x->ttl); + /*dbg_printf(P_INFO2, " count: %d\n", x->count);*/ + dbg_printf(P_INFO2, " next: (%p)\n", (void*)cur->next); + cur = cur->next; + } + dbg_printf(P_INFO2, "------- end -------------\n"); +#else + (void)list; #endif } @@ -112,14 +114,14 @@ PUBLIC void feed_add(rss_feed* p, NODE **head) { * removeLast() as the 2nd parameter to ensure proper memory deallocation. */ void feed_free(void* listItem) { - rss_feed* x = (rss_feed*)listItem; - - if(x != NULL) { - am_free(x->url); - am_free(x->cookies); - am_free(x->id); - am_free(x->url_pattern); - am_free(x->url_replace); - am_free(x); - } + rss_feed* x = (rss_feed*)listItem; + + if(x != NULL) { + am_free(x->url); + am_free(x->cookies); + am_free(x->id); + am_free(x->url_pattern); + am_free(x->url_replace); + am_free(x); + } } diff --git a/src/state.c b/src/state.c index fd52bc8..afa489e 100644 --- a/src/state.c +++ b/src/state.c @@ -41,11 +41,11 @@ #include "list.h" #ifdef MEMWATCH - #include "memwatch.h" + #include "memwatch.h" #endif /** \cond */ -#define MAX_LINE_LEN 300 +#define MAX_LINE_LEN 2048 /** \endcond */ /** \brief Store the URLs of the downloaded torrents on disk for later retrieval @@ -56,30 +56,39 @@ * save_state() stores the content of the torrent bucket list on disk so Automatic won't * download old torrents after a restart. */ -int save_state(const char* state_file, const simple_list const downloads) { - FILE *fp; - char tmp[MAX_LINE_LEN + 1]; - NODE *current = NULL; - - if(state_file) { - current = downloads; - dbg_printf(P_MSG, "Saving state (%d downloaded torrents) to disk", listCount(current)); - if((fp = fopen(state_file, "wb")) == NULL) { - dbg_printf(P_ERROR, "Error: Unable to open statefile '%s' for writing: %s", state_file, strerror(errno)); - return -1; - } - while (current != NULL && current->data != NULL) { - sprintf(tmp, "%s\n", (char*)current->data); - if(!fwrite(tmp, strlen(tmp), 1, fp)){ - dbg_printf(P_ERROR, "Error: Unable to write to statefile '%s': %s", state_file, strerror(errno)); - fclose(fp); - return -1; - } - current = current->next; - } - fclose(fp); - } - return 0; +int save_state(const char* state_file, const simple_list downloads) { + FILE *fp; + NODE *current = NULL; + int result; + + if(state_file) { + current = downloads; + dbg_printf(P_MSG, "Saving state (%d downloaded torrents) to disk", listCount(current)); + if((fp = fopen(state_file, "w")) == NULL) { + dbg_printf(P_ERROR, "Error: Unable to open statefile '%s' for writing: %s", state_file, strerror(errno)); + return -1; + } + + while (current != NULL && current->data != NULL) { + result = fputs((const char*)current->data, fp); + if(result != EOF) { + result = fputc('\n', fp); + } + + if(result == EOF) + { + dbg_printf(P_ERROR, "Error: Unable to write to statefile '%s': %s", state_file, strerror(errno)); + fclose(fp); + return -1; + } + + current = current->next; + } + + fclose(fp); + dbg_printf(P_INFO, "Done saving state"); + } + return 0; } /** \brief Load an old state from disk. @@ -91,24 +100,24 @@ int save_state(const char* state_file, const simple_list const downloads) { * This way Automatic won't download old torrents again after, e.g. a restart. */ int load_state(const char* state_file, NODE **head) { - FILE *fp; - int len; - char line[MAX_LINE_LEN]; - char *data; - - if((fp = fopen(state_file, "rb")) == NULL) { - dbg_printf(P_ERROR, "[load_state] Error: Unable to open statefile '%s' for reading: %s", state_file, strerror(errno)); - return -1; - } - while (fgets(line, MAX_LINE_LEN, fp)) { - len = strlen(line); - if(len > 20) { /* arbitrary threshold for the length of a URL */ - data = am_strndup(line, len-1); /* len-1 to get rid of the \n at the end of each line */ - addToTail(data, head); - } - } - fclose(fp); - dbg_printf(P_MSG, "Restored %d old entries", listCount(*head)); - return 0; + FILE *fp; + int len; + char line[MAX_LINE_LEN]; + char *data; + + if((fp = fopen(state_file, "r")) == NULL) { + dbg_printf(P_ERROR, "[load_state] Error: Unable to open statefile '%s' for reading: %s", state_file, strerror(errno)); + return -1; + } + + while (fgets(line, MAX_LINE_LEN, fp)) { + len = strlen(line); + data = am_strndup(line, len-1); /* len-1 to get rid of the \n at the end of each line */ + addToTail(data, head); + } + + fclose(fp); + dbg_printf(P_MSG, "Restored %d old entries", listCount(*head)); + return 0; } diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt new file mode 100644 index 0000000..32bf3b7 --- /dev/null +++ b/src/tests/CMakeLists.txt @@ -0,0 +1,77 @@ +set(common_srcs ${CMAKE_SOURCE_DIR}/src/output.c + ${CMAKE_SOURCE_DIR}/src/memwatch.c + ${CMAKE_SOURCE_DIR}/src/utils.c) + +set(common_includes "${CMAKE_SOURCE_DIR}/include" "${CMAKE_BINARY_DIR}") + +add_executable(list_test ${common_srcs} ${CMAKE_SOURCE_DIR}/src/list.c list_test.c) +target_include_directories(list_test PRIVATE PRIVATE ${common_includes}) +add_test(NAME list_test COMMAND list_test) + +add_executable(base64_test ${common_srcs} "${CMAKE_SOURCE_DIR}/src/base64.c" base64_test.c) +target_include_directories(base64_test PRIVATE ${common_includes}) +add_test(NAME base64_test COMMAND base64_test) + +add_executable(regex_test ${common_srcs} "${CMAKE_SOURCE_DIR}/src/regex.c" regex_test.c) +target_include_directories(regex_test PRIVATE ${common_includes}) +target_link_libraries(regex_test PRIVATE PCRE::PCRE) +add_test(NAME regex_test COMMAND regex_test) + +add_executable(http_test ${common_srcs} + "${CMAKE_SOURCE_DIR}/src/file.c" + "${CMAKE_SOURCE_DIR}/src/regex.c" + "${CMAKE_SOURCE_DIR}/src/urlcode.c" + "${CMAKE_SOURCE_DIR}/src/web.c" + http_test.c) +target_include_directories(http_test PRIVATE ${common_includes}) +target_link_libraries(http_test PRIVATE CURL::libcurl PCRE::PCRE) +add_test(NAME http_test COMMAND http_test) + +add_executable(json_test ${common_srcs} + "${CMAKE_SOURCE_DIR}/src/base64.c" + "${CMAKE_SOURCE_DIR}/src/json.c" + "${CMAKE_SOURCE_DIR}/src/regex.c" + json_test.c + ) +target_include_directories(json_test PRIVATE ${common_includes}) +target_link_libraries(json_test PRIVATE PCRE::PCRE) +add_test(NAME json_test COMMAND json_test) + +add_executable(parser_test ${common_srcs} + "${CMAKE_SOURCE_DIR}/src/config_parser.c" + "${CMAKE_SOURCE_DIR}/src/filters.c" + "${CMAKE_SOURCE_DIR}/src/list.c" + "${CMAKE_SOURCE_DIR}/src/regex.c" + "${CMAKE_SOURCE_DIR}/src/rss_feed.c" + parser_test.c + ) +target_include_directories(parser_test PRIVATE ${common_includes}) +target_link_libraries(parser_test PRIVATE PCRE::PCRE) +add_test(NAME parser_test COMMAND parser_test) + +add_executable(utils_test ${common_srcs} utils_test.c) +target_include_directories(utils_test PRIVATE ${common_includes}) +add_test(NAME utils_test COMMAND utils_test) + +add_executable(pushover_test ${common_srcs} + "${CMAKE_SOURCE_DIR}/src/pushover.c" + "${CMAKE_SOURCE_DIR}/src/regex.c" + "${CMAKE_SOURCE_DIR}/src/urlcode.c" + "${CMAKE_SOURCE_DIR}/src/web.c" + pushover_test.c + ) + +target_include_directories(pushover_test PRIVATE ${common_includes}) +target_link_libraries(pushover_test PRIVATE CURL::libcurl PCRE::PCRE) +add_test(NAME pushover_test COMMAND pushover_test) + +add_executable(prowl_test ${common_srcs} + "${CMAKE_SOURCE_DIR}/src/prowl.c" + "${CMAKE_SOURCE_DIR}/src/regex.c" + "${CMAKE_SOURCE_DIR}/src/urlcode.c" + "${CMAKE_SOURCE_DIR}/src/web.c" + prowl_test.c + ) +target_include_directories(prowl_test PRIVATE ${common_includes}) +target_link_libraries(prowl_test PRIVATE CURL::libcurl PCRE::PCRE) +add_test(NAME prowl_test COMMAND prowl_test) diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am old mode 100644 new mode 100755 index 9306bee..3abee47 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -1,6 +1,6 @@ -INCLUDES = -I$(top_srcdir)/include/ +AM_CPPFLAGS = -I$(top_srcdir)/include/ -check_PROGRAMS = list_test base64_test regex_test http_test json_test prowl_test parser_test +check_PROGRAMS = list_test base64_test regex_test http_test json_test prowl_test parser_test utils_test pushover_test TESTS = $(check_PROGRAMS) @@ -9,57 +9,69 @@ GLOBAL_SOURCES = \ $(top_srcdir)/src/memwatch.c \ $(top_srcdir)/src/utils.c - http_test_SOURCES = $(GLOBAL_SOURCES) \ - http_test.c \ - $(top_srcdir)/src/web.c \ + $(top_srcdir)/src/file.c \ $(top_srcdir)/src/regex.c \ $(top_srcdir)/src/urlcode.c \ - $(top_srcdir)/src/file.c + $(top_srcdir)/src/web.c \ + http_test.c list_test_SOURCES = $(GLOBAL_SOURCES) \ - $(top_srcdir)/src/list.c \ - list_test.c + $(top_srcdir)/src/list.c \ + list_test.c base64_test_SOURCES = $(GLOBAL_SOURCES) \ $(top_srcdir)/src/base64.c \ base64_test.c +utils_test_SOURCES = $(GLOBAL_SOURCES) \ + utils_test.c + regex_test_SOURCES = $(GLOBAL_SOURCES) \ - $(top_srcdir)/src/regex.c \ - regex_test.c + $(top_srcdir)/src/regex.c \ + regex_test.c json_test_SOURCES = $(GLOBAL_SOURCES) \ - $(top_srcdir)/src/json.c \ - $(top_srcdir)/src/base64.c \ - $(top_srcdir)/src/regex.c \ - json_test.c + $(top_srcdir)/src/base64.c \ + $(top_srcdir)/src/json.c \ + $(top_srcdir)/src/regex.c \ + json_test.c prowl_test_SOURCES = $(GLOBAL_SOURCES) \ - $(top_srcdir)/src/prowl.c \ - $(top_srcdir)/src/regex.c \ - $(top_srcdir)/src/web.c \ - prowl_test.c + $(top_srcdir)/src/prowl.c \ + $(top_srcdir)/src/regex.c \ + $(top_srcdir)/src/urlcode.c \ + $(top_srcdir)/src/web.c \ + prowl_test.c + +pushover_test_SOURCES = $(GLOBAL_SOURCES) \ + $(top_srcdir)/src/pushover.c \ + $(top_srcdir)/src/regex.c \ + $(top_srcdir)/src/urlcode.c \ + $(top_srcdir)/src/web.c \ + pushover_test.c parser_test_SOURCES = $(GLOBAL_SOURCES) \ - $(top_srcdir)/src/config_parser.c \ - $(top_srcdir)/src/list.c \ - $(top_srcdir)/src/rss_feed.c \ - parser_test.c + $(top_srcdir)/src/config_parser.c \ + $(top_srcdir)/src/filters.c \ + $(top_srcdir)/src/list.c \ + $(top_srcdir)/src/regex.c \ + $(top_srcdir)/src/rss_feed.c \ + parser_test.c noinst_HEADERS = \ - $(top_srcdir)/include/output.h \ $(top_srcdir)/include/base64.h \ $(top_srcdir)/include/config_parser.h \ + $(top_srcdir)/include/file.h \ + $(top_srcdir)/include/json.h \ $(top_srcdir)/include/list.h \ - $(top_srcdir)/include/utils.h \ - $(top_srcdir)/include/prowl.h \ $(top_srcdir)/include/memwatch.h \ - $(top_srcdir)/include/urlcode.h \ + $(top_srcdir)/include/output.h \ + $(top_srcdir)/include/prowl.h \ $(top_srcdir)/include/regex.h \ - $(top_srcdir)/include/json.h \ - $(top_srcdir)/include/web.h \ - $(top_srcdir)/include/file.h + $(top_srcdir)/include/urlcode.h \ + $(top_srcdir)/include/utils.h \ + $(top_srcdir)/include/web.h http_test_LDADD = $(LIBCURL_LIBS) $(PCRE_LIBS) http_test_CFLAGS = $(LIBCURL_CFLAGS) $(PCRE_CFLAGS) @@ -67,10 +79,16 @@ http_test_CFLAGS = $(LIBCURL_CFLAGS) $(PCRE_CFLAGS) prowl_test_LDADD = $(LIBCURL_LIBS) $(LIBXML_LIBS) $(PCRE_LIBS) prowl_test_CFLAGS = $(LIBCURL_CFLAGS) $(LIBXML_CFLAGS) $(PCRE_CFLAGS) +pushover_test_LDADD = $(LIBCURL_LIBS) $(LIBXML_LIBS) $(PCRE_LIBS) +pushover_test_CFLAGS = $(LIBCURL_CFLAGS) $(LIBXML_CFLAGS) $(PCRE_CFLAGS) + regex_test_LDADD = $(PCRE_LIBS) regex_test_CFLAGS = $(PCRE_CFLAGS) json_test_LDADD = $(PCRE_LIBS) json_test_CFLAGS = $(PCRE_CFLAGS) +parser_test_LDADD = $(PCRE_LIBS) +parser_test_CFLAGS = $(PCRE_CFLAGS) + CFLAGS = -g -O0 -DMEMWATCH -DDEBUG diff --git a/src/tests/base64_test.c b/src/tests/base64_test.c index 3121ca6..a42dda9 100644 --- a/src/tests/base64_test.c +++ b/src/tests/base64_test.c @@ -13,9 +13,34 @@ #include "output.h" #include "base64.h" - int8_t verbose = P_NONE; +#define VERBOSE 1 + +static int test = 0; + +#ifdef VERBOSE + #define check( A ) \ + { \ + ++test; \ + if( A ){ \ + fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + } else { \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#else + #define check( A ) \ + { \ + ++test; \ + if( !( A ) ){ \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#endif + int main(void) { const char *dec_str = "The quick brown fox jumps over the lazy dog."; @@ -25,14 +50,14 @@ int main(void) { uint32_t enc_len, dec_len; encode = base64_encode(NULL, 47, &enc_len); - assert(encode == NULL && enc_len == 0); + check(encode == NULL && enc_len == 0); encode = base64_encode(dec_str, strlen(dec_str), &enc_len); - assert(enc_len == strlen(enc_str)); - assert(strcmp(encode, enc_str) == 0); + check(enc_len == strlen(enc_str)); + check(strcmp(encode, enc_str) == 0); decode = base64_decode(encode, enc_len, &dec_len); - assert(dec_len == strlen(dec_str)); - assert(strcmp(decode, dec_str) == 0); + check(dec_len == strlen(dec_str)); + check(strcmp(decode, dec_str) == 0); am_free(encode); am_free(decode); return 0; diff --git a/src/tests/http_test.c b/src/tests/http_test.c index a54b498..ef0f3ed 100644 --- a/src/tests/http_test.c +++ b/src/tests/http_test.c @@ -15,31 +15,56 @@ int8_t verbose = P_NONE; -void testGetHTTP(void) { +#define VERBOSE 1 + +static int test = 0; + +#ifdef VERBOSE + #define check( A ) \ + { \ + ++test; \ + if( A ){ \ + fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + } else { \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#else + #define check( A ) \ + { \ + ++test; \ + if( !( A ) ){ \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#endif + +static int + testGetHTTP(void) { int ret = 1; HTTPResponse *response = NULL; - CURL *curl_session = NULL; + CURL *curl_session = NULL; //test invalid URL response = getHTTPData(NULL, NULL, &curl_session); - assert(response == NULL); + check(response == NULL); //test invalid URL 2 response = getHTTPData("http://thisurldoesntexist.co.ge", NULL, &curl_session); - assert(response); - assert(response->responseCode != 200); - assert(response->data == NULL); - HTTPResponse_free(response); + check(response == NULL); //test HTTP URL - response = getHTTPData("http://www.binsearch.info/?action=nzb&33455941=1", NULL, &curl_session); - assert(response && response->data); + response = getHTTPData("http://www.heise.de/", NULL, &curl_session); + check(response && response->data); HTTPResponse_free(response); closeCURLSession(curl_session); + + return 0; } int main(void) { - testGetHTTP(); - return 0; + return testGetHTTP(); } diff --git a/src/tests/json_test.c b/src/tests/json_test.c index 6314c66..c7c54ec 100644 --- a/src/tests/json_test.c +++ b/src/tests/json_test.c @@ -7,6 +7,7 @@ #include +#include #include #include #include "utils.h" @@ -21,21 +22,25 @@ int main(void) { uint32_t size; dbg_printf(P_INFO, "makeTorrentAddMetaInfoJSON(NULL, 0 , ...)"); - char* json = makeTorrentAddMetaInfoJSON(NULL, 0, 0, &size); + char* json = makeTorrentAddMetaInfoJSON(NULL, 0, 0, NULL, &size); assert(json == NULL && size == 0); dbg_printf(P_INFO, "makeTorrentAddMetaInfoJSON(NULL, 20, ...)"); - json = makeTorrentAddMetaInfoJSON(NULL, 20, 0, &size); + + json = makeTorrentAddMetaInfoJSON(NULL, 20, 0, NULL, &size); assert(json == NULL && size == 0); dbg_printf(P_INFO, "makeTorrentAddMetaInfoJSON(str, 0, ...)"); - json = makeTorrentAddMetaInfoJSON(str, 0, 0, &size); + + json = makeTorrentAddMetaInfoJSON(str, 0, 0, NULL, &size); assert(json == NULL && size == 0); dbg_printf(P_INFO, "makeTorrentAddMetaInfoJSON(str, strlen(str), 1, ...)"); - json = makeTorrentAddMetaInfoJSON(str, strlen(str), 1, &size); + + json = makeTorrentAddMetaInfoJSON(str, strlen(str), 1, NULL, &size); dbg_printf(P_INFO, "\n%s\n (%d)", json, size); assert(strlen(json) == size && size == 153); am_free(json); + dbg_printf(P_INFO, "makeTorrentAddMetaInfoJSON(str, strlen(str), 0, ...)"); - json = makeTorrentAddMetaInfoJSON(str, strlen(str), 0, &size); + json = makeTorrentAddMetaInfoJSON(str, strlen(str), 0, NULL, &size); assert(strlen(json) == size && size == 153); am_free(json); return 0; diff --git a/src/tests/list_test.c b/src/tests/list_test.c index 3cfcd75..58b1927 100644 --- a/src/tests/list_test.c +++ b/src/tests/list_test.c @@ -114,7 +114,7 @@ static int testStringList(void){ return 0; } -int main (int argc, char **argv) { +int main (void) { int ret = 0; ret += testIntegerList(); ret += testStringList(); diff --git a/src/tests/parser_test.c b/src/tests/parser_test.c index c6b5bb0..fffc042 100644 --- a/src/tests/parser_test.c +++ b/src/tests/parser_test.c @@ -1,5 +1,6 @@ #include #include +#include #include "utils.h" #include "output.h" diff --git a/src/tests/prowl_test.c b/src/tests/prowl_test.c index 79f524a..1d60053 100644 --- a/src/tests/prowl_test.c +++ b/src/tests/prowl_test.c @@ -1,5 +1,7 @@ #include #include +#include +#include #include "utils.h" #include "output.h" @@ -11,85 +13,126 @@ int8_t verbose = P_MSG; +#define VERBOSE 1 + +static int test = 0; + +#ifdef VERBOSE + #define check( A ) \ + { \ + ++test; \ + if( A ){ \ + fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + } else { \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#else + #define check( A ) \ + { \ + ++test; \ + if( !( A ) ){ \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#endif + const char* correct_key = ""; const char* wrong_key = "132ieosdsd"; -void testSendNotification(void) { - int ret = 0; +static int + testSendNotification(void) { + int ret = 0; ret = sendProwlNotification(NULL, NULL, NULL); - assert(ret == -1); + check(ret == -1); ret = sendProwlNotification(wrong_key, NULL, NULL); - assert(ret == -1); + check(ret == -1); ret = sendProwlNotification(wrong_key, "Event", NULL); - assert(ret == -401); + check(ret == -401); ret = sendProwlNotification(wrong_key, NULL, "Desc"); - assert(ret == -401); + check(ret == -401); ret = sendProwlNotification(wrong_key, "Event", "Desc"); - assert(ret == -401); + check(ret == -401); ret = sendProwlNotification(correct_key, NULL, NULL); - assert(ret == -1); + check(ret == -1); ret = sendProwlNotification(correct_key, "Event", NULL); - assert(ret == 1); + check(ret == 1); ret = sendProwlNotification(correct_key, NULL, "Desc"); - assert(ret == 1); + check(ret == 1); ret = sendProwlNotification(correct_key, "Event", "Desc"); - assert(ret == 1); + check(ret == 1); + return 0; } -void testVerifyAPIKey(void) { +static int +testVerifyAPIKey(void) { int ret = 0; ret = verifyProwlAPIKey(NULL); - assert(ret == -1); + check(ret == -1); ret = verifyProwlAPIKey(wrong_key); - assert(ret == -401); + check(ret == -401); ret = verifyProwlAPIKey(correct_key); - assert(ret == 1); + check(ret == 1); + return 0; } -void testSendNotification2(void) { - int ret = 0; +static int +testSendNotification2(void) { + int ret = 0; ret = prowl_sendNotification(0, NULL, NULL); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(0, NULL, "file"); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(0, wrong_key, NULL); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(0, wrong_key, "File"); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(0, correct_key, NULL); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(0, correct_key, "File"); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(PROWL_NEW_DOWNLOAD, wrong_key, NULL); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(PROWL_NEW_DOWNLOAD, wrong_key, "file"); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(PROWL_DOWNLOAD_FAILED, wrong_key, NULL); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(PROWL_DOWNLOAD_FAILED, wrong_key, "file"); - assert(ret == 0); + check(ret == 0); ret = prowl_sendNotification(PROWL_NEW_DOWNLOAD, correct_key, NULL); - assert(ret == 1); + check(ret == 1); ret = prowl_sendNotification(PROWL_NEW_DOWNLOAD, correct_key, "file"); - assert(ret == 1); + check(ret == 1); ret = prowl_sendNotification(PROWL_DOWNLOAD_FAILED, correct_key, NULL); - assert(ret == 1); + check(ret == 1); ret = prowl_sendNotification(PROWL_DOWNLOAD_FAILED, correct_key, "file"); - assert(ret == 1); + check(ret == 1); + return 0; } int main(void) { -// testVerifyAPIKey(); -// testSendNotification(); - testSendNotification2(); - return 0; + int i; + + i = testVerifyAPIKey(); + + if(!i) { + i = testSendNotification(); + } + + if(!i) { + i = testSendNotification2(); + } + + return i; } diff --git a/src/tests/pushover_test.c b/src/tests/pushover_test.c new file mode 100644 index 0000000..aec30a4 --- /dev/null +++ b/src/tests/pushover_test.c @@ -0,0 +1,118 @@ +#include +#include +#include +#include + +#include "utils.h" +#include "output.h" +#include "pushover.h" + +#ifdef MEMWATCH +#include "memwatch.h" +#endif + +int8_t verbose = P_MSG; + +#define VERBOSE 1 + +static int test = 0; + +#ifdef VERBOSE + #define check( A ) \ + { \ + ++test; \ + if( A ){ \ + fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + } else { \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#else + #define check( A ) \ + { \ + ++test; \ + if( !( A ) ){ \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#endif + +const char* correct_key = ""; +const char* wrong_key = "132ieosdsd"; + +static int +testSendNotification(void) { + int ret = 0; + + ret = sendPushoverNotification(NULL, NULL, NULL); + check(ret == -1); + ret = sendPushoverNotification(wrong_key, NULL, NULL); + check(ret == -1); + ret = sendPushoverNotification(wrong_key, "Event", NULL); + check(ret == -1); + ret = sendPushoverNotification(wrong_key, NULL, "Desc"); + check(ret == -400); + ret = sendPushoverNotification(wrong_key, "Event", "Desc"); + check(ret == -400); + ret = sendPushoverNotification(correct_key, NULL, NULL); + check(ret == -1); + ret = sendPushoverNotification(correct_key, "Event", NULL); + check(ret == -1); + ret = sendPushoverNotification(correct_key, NULL, "Desc"); + check(ret == 1); + ret = sendPushoverNotification(correct_key, "Event", "Desc"); + check(ret == 1); + return 0; +} + +static int +testSendNotification2(void) { + int ret = 0; + + ret = pushover_sendNotification(0, NULL, NULL); + check(ret == 0); + ret = pushover_sendNotification(0, NULL, "file"); + check(ret == 0); + ret = pushover_sendNotification(0, wrong_key, NULL); + check(ret == 0); + ret = pushover_sendNotification(0, wrong_key, "File"); + check(ret == 0); + ret = pushover_sendNotification(0, correct_key, NULL); + check(ret == 0); + ret = pushover_sendNotification(0, correct_key, "File"); + check(ret == 0); + ret = pushover_sendNotification(PUSHOVER_NEW_DOWNLOAD, wrong_key, NULL); + check(ret == 0); + ret = pushover_sendNotification(PUSHOVER_NEW_DOWNLOAD, wrong_key, "file"); + check(ret == 0); + ret = pushover_sendNotification(PUSHOVER_DOWNLOAD_FAILED, wrong_key, NULL); + check(ret == 0); + ret = pushover_sendNotification(PUSHOVER_DOWNLOAD_FAILED, wrong_key, "file"); + check(ret == 0); + + ret = pushover_sendNotification(PUSHOVER_NEW_DOWNLOAD, correct_key, NULL); + check(ret == 1); + ret = pushover_sendNotification(PUSHOVER_NEW_DOWNLOAD, correct_key, "file"); + check(ret == 1); + ret = pushover_sendNotification(PUSHOVER_DOWNLOAD_FAILED, correct_key, NULL); + check(ret == 1); + ret = pushover_sendNotification(PUSHOVER_DOWNLOAD_FAILED, correct_key, "file"); + check(ret == 1); + return 0; +} + + + +int main(void) { + int i; + + i = testSendNotification(); + + if(!i) { + i = testSendNotification2(); + } + + return i; +} diff --git a/src/tests/regex_test.c b/src/tests/regex_test.c index e8a91d0..f4b82f7 100644 --- a/src/tests/regex_test.c +++ b/src/tests/regex_test.c @@ -13,7 +13,6 @@ int8_t verbose = P_NONE; - #define VERBOSE 1 static int test = 0; @@ -40,7 +39,7 @@ static int test = 0; } #endif -void testIsRegexMatch(void) { +int testIsRegexMatch(void) { check(isRegExMatch(NULL, NULL) == 0); check(isRegExMatch(NULL, "test") == 0); check(isRegExMatch("test", NULL) == 0); @@ -57,10 +56,11 @@ void testIsRegexMatch(void) { check(isRegExMatch("def.*abc", "def xyz (ghi - rst)") == 0); check(isRegExMatch("def.*abc", "def xyz (abc - ghi - rst)") == 1); check(isRegExMatch("Ídy", "Ídy") == 1); + return 0; } -void testGetMatch(void) { +int testGetMatch(void) { const char* pattern1 = "Content-Disposition:\\s(inline|attachment);\\s*filename=\"?(.+?)\"?;?\\r?\\n?$"; const char* pattern2 = "\"result\":\\s\"(.+)\"\n"; const char* string1 = "Content-Disposition: inline; filename=\"this.is.a.test-file.torrent\""; @@ -88,7 +88,7 @@ void testGetMatch(void) { check(strcmp(res_str, "this.is.a.test-file.torrent") == 0); am_free(res_str); - res_str = getRegExMatch(pattern1, string2, 2); + res_str = getRegExMatch(pattern1, string3, 2); check(res_str == NULL); am_free(res_str); @@ -107,10 +107,11 @@ void testGetMatch(void) { res_str = getRegExMatch(pattern2, "\"result\": \"duplicate torrent\"", 1); check(strcmp(res_str, "duplicate torrent") == 0); am_free(res_str); + return 0; } -void testRegexReplace() { +int testRegexReplace() { const char* pattern1 = "Content-Disposition:\\s(inline|attachment);\\s*filename=\"?(.+?)\"?;?\\r?\\n?$"; const char* pattern2 = "abc"; const char* substitute1 = "abc\\a\\100xyz"; @@ -145,11 +146,21 @@ void testRegexReplace() { res_str = performRegexReplace(string1, pattern2, substitute3); check(res_str == NULL); am_free(res_str); + + return 0; } int main(void) { - testIsRegexMatch(); - testGetMatch(); - testRegexReplace(); - return 0; + int i; + i = testIsRegexMatch(); + + if(!i) { + i = testGetMatch(); + } + + if(!i) { + i = testRegexReplace(); + } + + return i; } diff --git a/src/tests/utils_test.c b/src/tests/utils_test.c new file mode 100644 index 0000000..1db1f16 --- /dev/null +++ b/src/tests/utils_test.c @@ -0,0 +1,108 @@ +/* + * utils_test.c + * + * Created on: Oct 20, 2008 + * Author: aurich + */ + + +#include +#include +#include +#include +#include "utils.h" +#include "output.h" + +int8_t verbose = P_NONE; + +#define VERBOSE 1 + +static int test = 0; + +#ifdef VERBOSE + #define check( A ) \ + { \ + ++test; \ + if( A ){ \ + fprintf( stderr, "PASS test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + } else { \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#else + #define check( A ) \ + { \ + ++test; \ + if( !( A ) ){ \ + fprintf( stderr, "FAIL test #%d (%s, %d)\n", test, __FILE__, __LINE__ ); \ + return test; \ + } \ + } +#endif + +static int +testStringReplace(void) { + char * ret = NULL; + + ret = am_replace_str(NULL, NULL, NULL); + check(ret == NULL); + + ret = am_replace_str("test", NULL, NULL); + check(ret == NULL); + + ret = am_replace_str(NULL, "test", NULL); + check(ret == NULL); + + ret = am_replace_str(NULL, NULL, "test"); + check(ret == NULL); + + ret = am_replace_str("test", "test2", NULL); + check(ret == NULL); + + ret = am_replace_str(NULL, "test", "test2"); + check(ret == NULL); + + ret = am_replace_str("test", NULL, "test2"); + check(ret == NULL); + + ret = am_replace_str("test", "test2", ""); + check(ret != NULL); + check(strcmp(ret, "test") == 0); + am_free(ret); + + ret = am_replace_str("test", "abc", ""); + check(ret != NULL); + check(strcmp(ret, "test") == 0); + am_free(ret); + + ret = am_replace_str("test", "es", ""); + check(ret != NULL); + check(strcmp(ret, "tt") == 0); + am_free(ret); + + ret = am_replace_str("test", "e", "oa"); + check(ret != NULL); + check(strcmp(ret, "toast") == 0); + am_free(ret); + + ret = am_replace_str("tester", "e", "oa"); + check(ret != NULL); + check(strcmp(ret, "toastoar") == 0); + am_free(ret); + + ret = am_replace_str("Planet\\ 9\\ From\\ Outer\\ Space", "\\ ", " "); + check(ret != NULL); + check(strcmp(ret, "Planet 9 From Outer Space") == 0); + am_free(ret); + return 0; +} + + +int main(void) { + int i; + + i = testStringReplace(); + + return i; +} diff --git a/src/torrent.c b/src/torrent.c index d1fc42f..ee36958 100644 --- a/src/torrent.c +++ b/src/torrent.c @@ -53,7 +53,7 @@ get_filename(char *path, const char *content_filename, const char* url, const ch if (content_filename) { dbg_printf(P_INFO, "Content-Filename: %s", content_filename); - strncpy(buf, content_filename, strlen(content_filename) + 1); + strcpy(buf, content_filename); } else { strcpy(tmp, url); p = strtok(tmp, "/"); @@ -82,6 +82,7 @@ changeUploadSpeed(const char* url, const char* auth, torrent_id_t id, uint16_t u res = sendHTTPData(url, auth, packet, packet_size); if(res != NULL && res->responseCode == 200) { response = parseResponse(res->data); + if(response) { if(!strncmp(response, "success", 7)) { dbg_printf(P_MSG, "%d: upload limit successfully changed to %dkB/s!", id, upspeed); @@ -89,12 +90,15 @@ changeUploadSpeed(const char* url, const char* auth, torrent_id_t id, uint16_t u } else { dbg_printf(P_ERROR, "Error changing upload speed for torrent #%d: %s", id, res); } + am_free((void*)response); } + HTTPResponse_free(res); } - am_free(packet); } + + am_free(packet); } return result; } @@ -129,38 +133,48 @@ uploadTorrent(const void *t_data, int t_size, const char *url, const char* auth, static torrent_id_t sendTransmissionRPC(const char* rpc_packet, uint32_t packet_size, const char *url, const char* auth) { - HTTPResponse *res = NULL; - const char *response = NULL; - torrent_id_t ret = -1; - - if(rpc_packet && packet_size > 0) { - /* send JSON package to Transmission via HTTP POST */ - res = sendHTTPData(url, auth, rpc_packet, packet_size); - if(res != NULL) { - if(res->responseCode == 200) { - response = parseResponse(res->data); - if(response != NULL) { - if(!strncmp(response, "success", 7)) { - dbg_printf(P_MSG, "Torrent upload successful!"); - ret = parseTorrentID(res->data); - } else if(!strncmp(response, "duplicate torrent", 17)) { - dbg_printf(P_MSG, "Torrent has already been added to Transmission"); - ret = 0; - } else { - dbg_printf(P_ERROR, "Error uploading torrent: %s", response); - ret = -1; - } - am_free((void*)response); - } else { - dbg_printf(P_ERROR, "parseResponse() failed!"); + HTTPResponse *res = NULL; + const char *response = NULL; + torrent_id_t ret = -1; + + assert(rpc_packet && packet_size > 0); + + /* send JSON package to Transmission via HTTP POST */ + res = sendHTTPData(url, auth, rpc_packet, packet_size); + if(res != NULL) { + if(res->responseCode == 200) { + response = parseResponse(res->data); + if(response != NULL) { + if(!strncmp(response, "success", 7)) { + dbg_printf(P_MSG, "Torrent upload successful!"); + ret = parseTorrentID(res->data); + } else if(!strncmp(response, "duplicate torrent", 17)) { + dbg_printf(P_MSG, "Torrent has already been added to Transmission"); + ret = 0; + } else { + dbg_printf(P_ERROR, "Error uploading torrent: %s", response); + ret = -1; + } + am_free((void*)response); + } else { + dbg_printf(P_ERROR, "parseResponse() failed!"); + } + } else { + switch(res->responseCode) { + case 401: + dbg_printf(P_ERROR, "Error: Sending RPC to Transmission failed: Bad authentication (error: %d)", res->responseCode); + break; + case 403: + dbg_printf(P_ERROR, "Error: Sending RPC to Transmission failed: Access denied (IP address not on whitelist?) (error: %d)", res->responseCode); + break; + default: + dbg_printf(P_ERROR, "Error: Sending RPC to Transmission failed (error: %d)", res->responseCode); } - HTTPResponse_free(res); - } else { - dbg_printf(P_ERROR, "sendHTTPData() failed! (Response Code: %d)", res->responseCode); - } - } else { - dbg_printf(P_ERROR, "sendHTTPData() failed! (resp == NULL)"); - } - } - return ret; + } + HTTPResponse_free(res); + } else { + dbg_printf(P_ERROR, "sendHTTPData() failed! (res == NULL)"); + } + + return ret; } diff --git a/src/transmission.c b/src/transmission.c index 51a02e8..71c2db2 100644 --- a/src/transmission.c +++ b/src/transmission.c @@ -105,7 +105,6 @@ int8_t call_external(const char *external_name, const char *filename) { } int8_t getRPCVersion(const char* host, uint16_t port, const char* auth) { - char url[MAX_URL_LEN]; int8_t result = 0; char *response = NULL; @@ -122,7 +121,7 @@ int8_t getRPCVersion(const char* host, uint16_t port, const char* auth) { snprintf( url, MAX_URL_LEN, "http://%s:%d/transmission/rpc", host, port); - res = sendHTTPData(url, auth, JSONstr, strlen(JSONstr)); + res = sendHTTPData(url, auth, JSONstr, strlen(JSONstr)); if(res != NULL && res->responseCode == 200) { dbg_printf(P_DBG, "[getRPCVersion] got response!"); response = parseResponse(res->data); diff --git a/src/utils.c b/src/utils.c index 6258c7f..180e730 100644 --- a/src/utils.c +++ b/src/utils.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "output.h" @@ -168,6 +169,7 @@ char* resolve_path(const char *path) { if(path[0] == '~' && path[1] == '/') { homedir = get_home_folder(); if(homedir) { + assert((strlen(homedir) + strlen(path)) < MAXPATHLEN); strcpy(new_dir, homedir); strcat(new_dir, ++path); am_free(homedir); @@ -188,13 +190,15 @@ char* get_tr_folder() { char buf[MAXPATHLEN]; char *home = NULL; - if(!path) { - home = get_home_folder(); - strcpy(buf, home); - strcat(buf, "/.config/transmission"); - path = am_strdup(buf); - am_free(home); - } + home = get_home_folder(); + + assert(home && *home && ((strlen(home) + 20) < MAXPATHLEN)); + + strcpy(buf, home); + strcat(buf, "/.config/transmission"); + path = am_strdup(buf); + am_free(home); + return path; } @@ -221,7 +225,7 @@ char* get_temp_folder(void) { ** licensed unter the GPL version 2. http://www.transmissionbt.com */ -char* strstrip( char * str ) { +char* am_strstrip( char * str ) { if( str && *str ) { size_t pos; @@ -242,3 +246,69 @@ char* strstrip( char * str ) { return str; } + +char* am_stringToLower(char *string) { + int i; + int len = strlen(string); + + for(i=0; i= 'A' && string[i] <= 'Z') { + string[i] += 32; + } + } + + return string; +} + +char *am_replace_str(const char *s, const char *pattern, const char *subst) +{ + char *ret; + int i, count = 0; + size_t substlen, patternlen; + + // No replacement possible if either the original string or the pattern is empty + if(s == NULL || *s == '\0' || pattern == NULL || *pattern == '\0' || subst == NULL ) { + return NULL; + } + + substlen = strlen(subst); + patternlen = strlen(pattern); + + // No replacement possible if the pattern is longer than the string. + if(patternlen > strlen(s)) { + return am_strdup(s); + } + + // No replacement possible if the pattern is not in the string + if(strstr(s, pattern) == NULL) { + return am_strdup(s); + } + + for (i = 0; s[i] != '\0'; i++) { + if (strstr(&s[i], pattern) == &s[i]) { + count++; + i += patternlen - 1; + } + } + + ret = am_malloc(i + 1 + count * (substlen - patternlen)); + + if (ret == NULL) { + return NULL; + } + + i = 0; + while (*s) { + if (strstr(s, pattern) == s) { + strcpy(&ret[i], subst); + i += substlen; + s += patternlen; + } else { + ret[i++] = *s++; + } + } + + ret[i] = '\0'; + + return ret; +} diff --git a/src/web.c b/src/web.c index 45c0fbb..20b2186 100644 --- a/src/web.c +++ b/src/web.c @@ -42,10 +42,10 @@ #include "regex.h" #include "urlcode.h" #include "utils.h" - +#include "version.h" /** \cond */ -#define DATA_BUFFER 1024 * 100 +#define DATA_BUFFER_SIZE 1024 * 100 #define HEADER_BUFFER 500 /** \endcond */ @@ -57,7 +57,8 @@ PRIVATE uint8_t gbGlobalInitDone = FALSE; typedef struct HTTPData { /** \{ */ char *data; /**< Stored data */ - size_t size; /**< Size of the stored data */ + size_t buffer_size; + size_t buffer_pos; /**< Size of the stored data */ /** \{ */ } HTTPData; @@ -68,7 +69,6 @@ typedef struct WebData { long responseCode; /**< HTTP response code */ size_t content_length; /**< size of the received data determined through header field "Content-Length" */ char *content_filename; /**< name of the downloaded file determined through header field "Content-Length" */ - //HTTPData *header; /**< complete header information in a HTTPData object */ HTTPData *response; /**< HTTP response in a HTTPData object */ /** \} */ } WebData; @@ -88,14 +88,16 @@ PRIVATE size_t write_header_callback(void *ptr, size_t size, size_t nmemb, void const char *content_pattern = "Content-Disposition:\\s(inline|attachment);\\s+filename=\"?(.+?)\"?;?\\r?\\n?$"; int content_length = 0; static uint8_t isMoveHeader = 0; - + /* check the header if it is a redirection header */ if(line_len >= 9 && !memcmp(line, "Location:", 9)) { isMoveHeader = 1; if(mem->response->data != NULL) { am_free(mem->response->data); + mem->response->data = NULL; + mem->response->buffer_size = 0; mem->content_length = 0; - } + } } else if(line_len >= 15 && !memcmp(line, "Content-Length:", 15)) { /* parse header for Content-Length to allocate correct size for data->response->data */ tmp = getRegExMatch("Content-Length:\\s(\\d+)", line, 1); @@ -104,13 +106,15 @@ PRIVATE size_t write_header_callback(void *ptr, size_t size, size_t nmemb, void content_length = atoi(tmp); if(content_length > 0 && !isMoveHeader) { mem->content_length = content_length; - mem->response->data = am_realloc(mem->response->data, content_length + 1); + mem->response->buffer_size = content_length + 1; + mem->response->data = am_realloc(mem->response->data, mem->response->buffer_size); } am_free(tmp); } - } else if(line_len >= 19 && !memcmp(line, "Content-Disposition", 19)) { + } else if(line_len >= 19 && !strncasecmp(line, "Content-Disposition:", 20)) { /* parse header for Content-Disposition to get correct filename */ filename = getRegExMatch(content_pattern, line, 2); + if(filename) { mem->content_filename = filename; dbg_printf(P_INFO2, "[write_header_callback] Found filename: %s", mem->content_filename); @@ -135,13 +139,13 @@ PRIVATE size_t parse_Transmission_response(void *ptr, size_t size, size_t nmemb, char *tmp = NULL; int content_length = 0; - if( (line_len >= key_len) && !memcmp(line, session_key, key_len) ) { const char * begin = line + key_len; const char * end = begin; while( !isspace( *end ) ) { ++end; } + am_free( gSessionID ); gSessionID = NULL; gSessionID = am_strndup( begin, end-begin ); @@ -153,8 +157,10 @@ PRIVATE size_t parse_Transmission_response(void *ptr, size_t size, size_t nmemb, content_length = atoi(tmp); if(content_length > 0) { mem->content_length = content_length; - mem->response->data = am_realloc(mem->response->data, content_length + 1); + mem->response->buffer_size = content_length + 1; + mem->response->data = am_realloc(mem->response->data, mem->response->buffer_size); } + am_free(tmp); } } @@ -174,18 +180,23 @@ PRIVATE size_t write_data_callback(void *ptr, size_t size, size_t nmemb, void *d * as a fallback, allocate a predefined size of memory and realloc if necessary **/ if(!mem->response->data) { - mem->response->data = (char*)am_malloc(DATA_BUFFER); - dbg_printf(P_INFO2, "[write_data_callback] allocated %d bytes for mem->response->data", DATA_BUFFER); + mem->response->buffer_size = DATA_BUFFER_SIZE; + mem->response->data = (char*)am_malloc(mem->response->buffer_size); + dbg_printf(P_INFO2, "[write_data_callback] allocated %d bytes for mem->response->data", mem->response->buffer_size); } - if(mem->response->size + line_len + 1 > DATA_BUFFER) { - mem->response->data = (char *)am_realloc(mem->response->data, mem->response->size + line_len + 1); + if(mem->response->buffer_pos + line_len + 1 > mem->response->buffer_size) { + do { + mem->response->buffer_size *= 2; + }while(mem->response->buffer_size < mem->response->buffer_pos + line_len + 1); + + mem->response->data = (char *)am_realloc(mem->response->data, mem->response->buffer_size); } - if (mem->response->data) { - memcpy(&(mem->response->data[mem->response->size]), ptr, line_len); - mem->response->size += line_len; - mem->response->data[mem->response->size] = 0; + if(mem->response->data) { + memcpy(&(mem->response->data[mem->response->buffer_pos]), ptr, line_len); + mem->response->buffer_pos += line_len; + mem->response->data[mem->response->buffer_pos] = 0; } return line_len; @@ -201,8 +212,10 @@ PRIVATE struct HTTPData* HTTPData_new(void) { if(!data) { return NULL; } + data->data = NULL; - data->size = 0; + data->buffer_size = 0; + data->buffer_pos = 0; return data; } @@ -211,10 +224,13 @@ PRIVATE struct HTTPData* HTTPData_new(void) { PRIVATE void HTTPData_free(HTTPData* data) { - if(data) + if(data) { am_free(data->data); + data->buffer_size = 0; + data->buffer_pos = 0; + } + am_free(data); - data = NULL; } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -229,7 +245,6 @@ PRIVATE void WebData_free(struct WebData *data) { if(data) { am_free(data->url); am_free(data->content_filename); - //HTTPData_free(data->header); HTTPData_free(data->response); am_free(data); data = NULL; @@ -255,19 +270,12 @@ PRIVATE struct WebData* WebData_new(const char *url) { data->url = NULL; data->content_filename = NULL; data->content_length = -1; - //data->header = NULL; data->response = NULL; if(url) { data->url = am_strdup((char*)url); } - //data->header = HTTPData_new(); - //if(!data->header) { - // WebData_free(data); - // return NULL; - //} - data->response = HTTPData_new(); if(!data->response) { WebData_free(data); @@ -284,16 +292,12 @@ PRIVATE void WebData_clear(struct WebData *data) { if(data) { am_free(data->content_filename); data->content_filename = NULL; - //if(data->header) { - // am_free(data->header->data); - // data->header->data = NULL; - // data->header->size = 0; - //} if(data->response) { am_free(data->response->data); data->response->data = NULL; - data->response->size = 0; + data->response->buffer_size = 0; + data->response->buffer_pos = 0; } } } @@ -340,11 +344,17 @@ PRIVATE CURL* am_curl_init(const char* auth, uint8_t isPost) { curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1); curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, 600L ); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L ); - //~ curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L ); - //curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L ); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "Automatic/" SHORT_VERSION_STRING ); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 5L ); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L ); + // The encoding option was renamed in curl 7.21.6 +#if LIBCURL_VERSION_NUM < 0x071506 + curl_easy_setopt(curl, CURLOPT_ENCODING, "" ); +#else + curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "" ); +#endif + if(auth && *auth) { dbg_printf(P_INFO2, "auth: %s", auth); curl_easy_setopt(curl, CURLOPT_USERPWD, auth); @@ -375,7 +385,7 @@ PUBLIC HTTPResponse* getHTTPData(const char *url, const char *cookies, CURL ** c char *escaped_url = NULL; WebData *data = NULL; HTTPResponse *resp = NULL; - int responseCode = -1; + long responseCode = -1; if(!url) { return NULL; @@ -428,7 +438,7 @@ PUBLIC HTTPResponse* getHTTPData(const char *url, const char *cookies, CURL ** c resp->responseCode = responseCode; //copy data if present if(data->response->data) { - resp->size = data->response->size; + resp->size = data->response->buffer_pos; resp->data = am_strndup(data->response->data, resp->size); } //copy filename if present @@ -489,11 +499,13 @@ PUBLIC HTTPResponse* sendHTTPData(const char *url, const char* auth, const void //Transmission-specific options for HTTP POST if(strstr(response_data->url, "transmission") != NULL) { curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, parse_Transmission_response ); - headers = curl_slist_append(headers, "Content-Type: application/json"); + headers = curl_slist_append(headers, "Content-Type: application/json"); + if( gSessionID ) { if((len = snprintf(sessionKey, MAXLEN, "X-Transmission-Session-Id: %s", gSessionID)) > 0) { sessionKey[len] = '\0'; } + headers = curl_slist_append(headers, sessionKey); } curl_easy_setopt( curl_handle, CURLOPT_HTTPHEADER, headers ); @@ -516,10 +528,11 @@ PUBLIC HTTPResponse* sendHTTPData(const char *url, const char* auth, const void dbg_printf(P_INFO2, "response code: %ld", rc); if(rc == 409) { if(gSessionID) { - dbg_printf(P_INFO2, "Error code 409, session ID: %s", gSessionID); + dbg_printf(P_DBG, "Error code 409, session ID: %s", gSessionID); } else { - dbg_printf(P_INFO2, "Error code 409, no session ID"); + dbg_printf(P_ERROR, "Error code 409, no session ID"); } + closeCURLSession( curl_handle ); curl_slist_free_all( headers ); headers = NULL; @@ -530,7 +543,7 @@ PUBLIC HTTPResponse* sendHTTPData(const char *url, const char* auth, const void //copy data if present if(response_data->response->data) { - resp->size = response_data->response->size; + resp->size = response_data->response->buffer_pos; resp->data = am_strndup(response_data->response->data, resp->size); } //copy filename if present diff --git a/src/xml_parser.c b/src/xml_parser.c index 0046720..5b1dd60 100644 --- a/src/xml_parser.c +++ b/src/xml_parser.c @@ -51,17 +51,24 @@ static int getNodeText(xmlNodePtr child, char **dest) { xmlChar * textNode; int result = 0; + assert(dest && *dest == NULL); + textNode = xmlNodeGetContent(child); *dest = am_strdup((char*) textNode); xmlFree(textNode); - if (*dest) + if (*dest) { result = 1; + } return result; } static rssNode* getNodeAttributes(xmlNodePtr child) { rssNode *tmp = am_malloc(sizeof(rssNode)); xmlAttrPtr attr = child->properties; + + tmp->url = NULL; + tmp->type = NULL; + while (attr) { if ((strcmp((char*) attr->name, "url") == 0)) { getNodeText(attr->children, &tmp->url); @@ -96,35 +103,41 @@ static simple_list extract_feed_items(xmlNodeSetPtr nodes) { item = newFeedItem(); while (child) { - if ((strcmp((char*) child->name, "title") == 0)) { + if (!name_set && (strcmp((char*) child->name, "title") == 0)) { name_set = getNodeText(child->children, &item->name); } else if ((strcmp((char*) child->name, "link") == 0)) { if (url_set == 0) { /* if "enclosure" was scanned before "link", use the former */ url_set = getNodeText(child->children, &item->url); } - } else if ((strcmp((char*) child->name, "category") == 0)) { + } else if ((strcmp((char*) child->name, "category") == 0) && !item->category) { getNodeText(child->children, &item->category); } else if ((strcmp((char*) child->name, "enclosure") == 0)) { enclosure = getNodeAttributes(child); - if ((strcmp(enclosure->type, "application/x-bittorrent") == 0)) { - if (enclosure->url) { + + if(enclosure) { + if ( (enclosure->url != NULL) && (enclosure->type != NULL) && (strcmp(enclosure->type, "application/x-bittorrent") == 0) ) + { am_free(item->url); item->url = am_strdup(enclosure->url); url_set = 1; - freeNode(enclosure); } + + freeNode(enclosure); } - } else if((strcmp((char*)child->name, "guid") == 0)) { + } else if((strcmp((char*)child->name, "guid") == 0) && !item->guid) { getNodeText(child->children, &item->guid); } - + child = child->next; } - + if (name_set && url_set) { addItem(item, &itemList); + } else { + dbg_printf(P_ERROR, "Node without name or URL! Processing skipped."); + freeFeedItem(item); } - + child = cur = NULL; } } else { @@ -170,7 +183,10 @@ simple_list parse_xmldata(const char* data, uint32_t size, uint32_t* item_count, } /* Load XML document */ - doc = xmlParseMemory(data, size); + if((doc = xmlParseMemory(data, size)) == NULL) { + doc = xmlRecoverMemory(data, size); + } + if (doc == NULL) { dbg_printf(P_ERROR, "Error: Unable to parse input data!"); return NULL; @@ -186,7 +202,7 @@ simple_list parse_xmldata(const char* data, uint32_t size, uint32_t* item_count, } /* check for time-to-live element in RSS feed */ - if (ttl == 0) { + if (ttl != 0) { xpathObj = xmlXPathEvalExpression(ttlExpr, xpathCtx); if (xpathObj != NULL) { ttlNode = xpathObj->nodesetval;