librelp-1.13.0/ 0000775 0001750 0001750 00000000000 15241057437 007000 5 librelp-1.13.0/README 0000644 0001750 0001750 00000000014 13273030644 007563 nothing yet
librelp-1.13.0/m4/ 0000775 0001750 0001750 00000000000 15241057436 007317 5 librelp-1.13.0/m4/lt~obsolete.m4 0000644 0001750 0001750 00000014007 15241057400 012042 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free
# Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
librelp-1.13.0/m4/ltsugar.m4 0000644 0001750 0001750 00000010453 15241057377 011167 # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59, which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])
librelp-1.13.0/m4/libtool.m4 0000644 0001750 0001750 00001131652 15241057377 011160 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
#
# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software
# Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
m4_define([_LT_COPYING], [dnl
# Copyright (C) 2014 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool 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 of the License, or
# (at your option) any later version.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program or library that is built
# using GNU Libtool, you may include this file under the same
# distribution terms that you use for the rest of that program.
#
# GNU Libtool 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, see .
])
# serial 59 LT_INIT
# LT_PREREQ(VERSION)
# ------------------
# Complain and exit if this libtool version is less that VERSION.
m4_defun([LT_PREREQ],
[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
[m4_default([$3],
[m4_fatal([Libtool version $1 or higher is required],
63)])],
[$2])])
# _LT_CHECK_BUILDDIR
# ------------------
# Complain if the absolute build directory name contains unusual characters
m4_defun([_LT_CHECK_BUILDDIR],
[case `pwd` in
*\ * | *\ *)
AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
esac
])
# LT_INIT([OPTIONS])
# ------------------
AC_DEFUN([LT_INIT],
[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
AC_BEFORE([$0], [LT_LANG])dnl
AC_BEFORE([$0], [LT_OUTPUT])dnl
AC_BEFORE([$0], [LTDL_INIT])dnl
m4_require([_LT_CHECK_BUILDDIR])dnl
dnl Autoconf doesn't catch unexpanded LT_ macros by default:
m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
dnl unless we require an AC_DEFUNed macro:
AC_REQUIRE([LTOPTIONS_VERSION])dnl
AC_REQUIRE([LTSUGAR_VERSION])dnl
AC_REQUIRE([LTVERSION_VERSION])dnl
AC_REQUIRE([LTOBSOLETE_VERSION])dnl
m4_require([_LT_PROG_LTMAIN])dnl
_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
dnl Parse OPTIONS
_LT_SET_OPTIONS([$0], [$1])
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS=$ltmain
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
_LT_SETUP
# Only expand once:
m4_define([LT_INIT])
])# LT_INIT
# Old names:
AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
# _LT_PREPARE_CC_BASENAME
# -----------------------
m4_defun([_LT_PREPARE_CC_BASENAME], [
# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
func_cc_basename ()
{
for cc_temp in @S|@*""; do
case $cc_temp in
compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
\-*) ;;
*) break;;
esac
done
func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
}
])# _LT_PREPARE_CC_BASENAME
# _LT_CC_BASENAME(CC)
# -------------------
# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME,
# but that macro is also expanded into generated libtool script, which
# arranges for $SED and $ECHO to be set by different means.
m4_defun([_LT_CC_BASENAME],
[m4_require([_LT_PREPARE_CC_BASENAME])dnl
AC_REQUIRE([_LT_DECL_SED])dnl
AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
func_cc_basename $1
cc_basename=$func_cc_basename_result
])
# _LT_FILEUTILS_DEFAULTS
# ----------------------
# It is okay to use these file commands and assume they have been set
# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'.
m4_defun([_LT_FILEUTILS_DEFAULTS],
[: ${CP="cp -f"}
: ${MV="mv -f"}
: ${RM="rm -f"}
])# _LT_FILEUTILS_DEFAULTS
# _LT_SETUP
# ---------
m4_defun([_LT_SETUP],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
dnl
_LT_DECL([], [host_alias], [0], [The host system])dnl
_LT_DECL([], [host], [0])dnl
_LT_DECL([], [host_os], [0])dnl
dnl
_LT_DECL([], [build_alias], [0], [The build system])dnl
_LT_DECL([], [build], [0])dnl
_LT_DECL([], [build_os], [0])dnl
dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([LT_PATH_LD])dnl
AC_REQUIRE([LT_PATH_NM])dnl
dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
test -z "$LN_S" && LN_S="ln -s"
_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
dnl
AC_REQUIRE([LT_CMD_MAX_LEN])dnl
_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_CHECK_SHELL_FEATURES])dnl
m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
m4_require([_LT_CMD_RELOAD])dnl
m4_require([_LT_DECL_FILECMD])dnl
m4_require([_LT_CHECK_MAGIC_METHOD])dnl
m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
m4_require([_LT_CMD_OLD_ARCHIVE])dnl
m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
m4_require([_LT_WITH_SYSROOT])dnl
m4_require([_LT_CMD_TRUNCATE])dnl
_LT_CONFIG_LIBTOOL_INIT([
# See if we are running on zsh, and set the options that allow our
# commands through without removal of \ escapes INIT.
if test -n "\${ZSH_VERSION+set}"; then
setopt NO_GLOB_SUBST
fi
])
if test -n "${ZSH_VERSION+set}"; then
setopt NO_GLOB_SUBST
fi
_LT_CHECK_OBJDIR
m4_require([_LT_TAG_COMPILER])dnl
case $host_os in
aix3*)
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test set != "${COLLECT_NAMES+set}"; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
;;
esac
# Global variables:
ofile=libtool
can_build_shared=yes
# All known linkers require a '.a' archive for static linking (except MSVC and
# ICC, which need '.lib').
libext=a
with_gnu_ld=$lt_cv_prog_gnu_ld
old_CC=$CC
old_CFLAGS=$CFLAGS
# Set sane defaults for various variables
test -z "$CC" && CC=cc
test -z "$LTCC" && LTCC=$CC
test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
test -z "$LD" && LD=ld
test -z "$ac_objext" && ac_objext=o
_LT_CC_BASENAME([$compiler])
# Only perform the check for file, if the check method requires it
test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
_LT_PATH_MAGIC
fi
;;
esac
# Use C for the default configuration in the libtool script
LT_SUPPORTED_TAG([CC])
_LT_LANG_C_CONFIG
_LT_LANG_DEFAULT_CONFIG
_LT_CONFIG_COMMANDS
])# _LT_SETUP
# _LT_PREPARE_SED_QUOTE_VARS
# --------------------------
# Define a few sed substitution that help us do robust quoting.
m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
[# Backslashify metacharacters that are still active within
# double-quoted strings.
sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\([["`\\]]\)/\\\1/g'
# Sed substitution to delay expansion of an escaped shell variable in a
# double_quote_subst'ed string.
delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
# Sed substitution to delay expansion of an escaped single quote.
delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
# Sed substitution to avoid accidental globbing in evaled expressions
no_glob_subst='s/\*/\\\*/g'
])
# _LT_PROG_LTMAIN
# ---------------
# Note that this code is called both from 'configure', and 'config.status'
# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
# 'config.status' has no value for ac_aux_dir unless we are using Automake,
# so we pass a copy along to make sure it has a sensible value anyway.
m4_defun([_LT_PROG_LTMAIN],
[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
ltmain=$ac_aux_dir/ltmain.sh
])# _LT_PROG_LTMAIN
## ------------------------------------- ##
## Accumulate code for creating libtool. ##
## ------------------------------------- ##
# So that we can recreate a full libtool script including additional
# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
# in macros and then make a single call at the end using the 'libtool'
# label.
# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
# ----------------------------------------
# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
m4_define([_LT_CONFIG_LIBTOOL_INIT],
[m4_ifval([$1],
[m4_append([_LT_OUTPUT_LIBTOOL_INIT],
[$1
])])])
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_INIT])
# _LT_CONFIG_LIBTOOL([COMMANDS])
# ------------------------------
# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
m4_define([_LT_CONFIG_LIBTOOL],
[m4_ifval([$1],
[m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
[$1
])])])
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
# -----------------------------------------------------
m4_defun([_LT_CONFIG_SAVE_COMMANDS],
[_LT_CONFIG_LIBTOOL([$1])
_LT_CONFIG_LIBTOOL_INIT([$2])
])
# _LT_FORMAT_COMMENT([COMMENT])
# -----------------------------
# Add leading comment marks to the start of each line, and a trailing
# full-stop to the whole comment if one is not present already.
m4_define([_LT_FORMAT_COMMENT],
[m4_ifval([$1], [
m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
[['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
)])
## ------------------------ ##
## FIXME: Eliminate VARNAME ##
## ------------------------ ##
# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
# -------------------------------------------------------------------
# CONFIGNAME is the name given to the value in the libtool script.
# VARNAME is the (base) name used in the configure script.
# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
# VARNAME. Any other value will be used directly.
m4_define([_LT_DECL],
[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
[lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
[m4_ifval([$1], [$1], [$2])])
lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
m4_ifval([$4],
[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
lt_dict_add_subkey([lt_decl_dict], [$2],
[tagged?], [m4_ifval([$5], [yes], [no])])])
])
# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
# --------------------------------------------------------
m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
# ------------------------------------------------
m4_define([lt_decl_tag_varnames],
[_lt_decl_filter([tagged?], [yes], $@)])
# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
# ---------------------------------------------------------
m4_define([_lt_decl_filter],
[m4_case([$#],
[0], [m4_fatal([$0: too few arguments: $#])],
[1], [m4_fatal([$0: too few arguments: $#: $1])],
[2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
[3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
[lt_dict_filter([lt_decl_dict], $@)])[]dnl
])
# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
# --------------------------------------------------
m4_define([lt_decl_quote_varnames],
[_lt_decl_filter([value], [1], $@)])
# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
# ---------------------------------------------------
m4_define([lt_decl_dquote_varnames],
[_lt_decl_filter([value], [2], $@)])
# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
# ---------------------------------------------------
m4_define([lt_decl_varnames_tagged],
[m4_assert([$# <= 2])dnl
_$0(m4_quote(m4_default([$1], [[, ]])),
m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
m4_define([_lt_decl_varnames_tagged],
[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
# ------------------------------------------------
m4_define([lt_decl_all_varnames],
[_$0(m4_quote(m4_default([$1], [[, ]])),
m4_if([$2], [],
m4_quote(lt_decl_varnames),
m4_quote(m4_shift($@))))[]dnl
])
m4_define([_lt_decl_all_varnames],
[lt_join($@, lt_decl_varnames_tagged([$1],
lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
])
# _LT_CONFIG_STATUS_DECLARE([VARNAME])
# ------------------------------------
# Quote a variable value, and forward it to 'config.status' so that its
# declaration there will have the same value as in 'configure'. VARNAME
# must have a single quote delimited value for this to work.
m4_define([_LT_CONFIG_STATUS_DECLARE],
[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
# _LT_CONFIG_STATUS_DECLARATIONS
# ------------------------------
# We delimit libtool config variables with single quotes, so when
# we write them to config.status, we have to be sure to quote all
# embedded single quotes properly. In configure, this macro expands
# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
#
# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`'
m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
[m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
# _LT_LIBTOOL_TAGS
# ----------------
# Output comment and list of tags supported by the script
m4_defun([_LT_LIBTOOL_TAGS],
[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
available_tags='_LT_TAGS'dnl
])
# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
# -----------------------------------
# Extract the dictionary values for VARNAME (optionally with TAG) and
# expand to a commented shell variable setting:
#
# # Some comment about what VAR is for.
# visible_name=$lt_internal_name
m4_define([_LT_LIBTOOL_DECLARE],
[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
[description])))[]dnl
m4_pushdef([_libtool_name],
m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
[0], [_libtool_name=[$]$1],
[1], [_libtool_name=$lt_[]$1],
[2], [_libtool_name=$lt_[]$1],
[_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
])
# _LT_LIBTOOL_CONFIG_VARS
# -----------------------
# Produce commented declarations of non-tagged libtool config variables
# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool'
# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
# section) are produced by _LT_LIBTOOL_TAG_VARS.
m4_defun([_LT_LIBTOOL_CONFIG_VARS],
[m4_foreach([_lt_var],
m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
[m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
# _LT_LIBTOOL_TAG_VARS(TAG)
# -------------------------
m4_define([_LT_LIBTOOL_TAG_VARS],
[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
[m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
# _LT_TAGVAR(VARNAME, [TAGNAME])
# ------------------------------
m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
# _LT_CONFIG_COMMANDS
# -------------------
# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
# variables for single and double quote escaping we saved from calls
# to _LT_DECL, we can put quote escaped variables declarations
# into 'config.status', and then the shell code to quote escape them in
# for loops in 'config.status'. Finally, any additional code accumulated
# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
m4_defun([_LT_CONFIG_COMMANDS],
[AC_PROVIDE_IFELSE([LT_OUTPUT],
dnl If the libtool generation code has been placed in $CONFIG_LT,
dnl instead of duplicating it all over again into config.status,
dnl then we will have config.status run $CONFIG_LT later, so it
dnl needs to know what name is stored there:
[AC_CONFIG_COMMANDS([libtool],
[$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
dnl If the libtool generation code is destined for config.status,
dnl expand the accumulated commands and init code now:
[AC_CONFIG_COMMANDS([libtool],
[_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
])#_LT_CONFIG_COMMANDS
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
[
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
sed_quote_subst='$sed_quote_subst'
double_quote_subst='$double_quote_subst'
delay_variable_subst='$delay_variable_subst'
_LT_CONFIG_STATUS_DECLARATIONS
LTCC='$LTCC'
LTCFLAGS='$LTCFLAGS'
compiler='$compiler_DEFAULT'
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
\$[]1
_LTECHO_EOF'
}
# Quote evaled strings.
for var in lt_decl_all_varnames([[ \
]], lt_decl_quote_varnames); do
case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
*[[\\\\\\\`\\"\\\$]]*)
eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
# Double-quote double-evaled strings.
for var in lt_decl_all_varnames([[ \
]], lt_decl_dquote_varnames); do
case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
*[[\\\\\\\`\\"\\\$]]*)
eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
_LT_OUTPUT_LIBTOOL_INIT
])
# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
# ------------------------------------
# Generate a child script FILE with all initialization necessary to
# reuse the environment learned by the parent script, and make the
# file executable. If COMMENT is supplied, it is inserted after the
# '#!' sequence but before initialization text begins. After this
# macro, additional text can be appended to FILE to form the body of
# the child script. The macro ends with non-zero status if the
# file could not be fully written (such as if the disk is full).
m4_ifdef([AS_INIT_GENERATED],
[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
[m4_defun([_LT_GENERATED_FILE_INIT],
[m4_require([AS_PREPARE])]dnl
[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
[lt_write_fail=0
cat >$1 <<_ASEOF || lt_write_fail=1
#! $SHELL
# Generated by $as_me.
$2
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$1 <<\_ASEOF || lt_write_fail=1
AS_SHELL_SANITIZE
_AS_PREPARE
exec AS_MESSAGE_FD>&1
_ASEOF
test 0 = "$lt_write_fail" && chmod +x $1[]dnl
m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
# LT_OUTPUT
# ---------
# This macro allows early generation of the libtool script (before
# AC_OUTPUT is called), incase it is used in configure for compilation
# tests.
AC_DEFUN([LT_OUTPUT],
[: ${CONFIG_LT=./config.lt}
AC_MSG_NOTICE([creating $CONFIG_LT])
_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
[# Run this file to recreate a libtool stub with the current configuration.])
cat >>"$CONFIG_LT" <<\_LTEOF
lt_cl_silent=false
exec AS_MESSAGE_LOG_FD>>config.log
{
echo
AS_BOX([Running $as_me.])
} >&AS_MESSAGE_LOG_FD
lt_cl_help="\
'$as_me' creates a local libtool stub from the current configuration,
for use in further configure time tests before the real libtool is
generated.
Usage: $[0] [[OPTIONS]]
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
Report bugs to ."
lt_cl_version="\
m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
configured by $[0], generated by m4_PACKAGE_STRING.
Copyright (C) 2011 Free Software Foundation, Inc.
This config.lt script is free software; the Free Software Foundation
gives unlimited permision to copy, distribute and modify it."
while test 0 != $[#]
do
case $[1] in
--version | --v* | -V )
echo "$lt_cl_version"; exit 0 ;;
--help | --h* | -h )
echo "$lt_cl_help"; exit 0 ;;
--debug | --d* | -d )
debug=: ;;
--quiet | --q* | --silent | --s* | -q )
lt_cl_silent=: ;;
-*) AC_MSG_ERROR([unrecognized option: $[1]
Try '$[0] --help' for more information.]) ;;
*) AC_MSG_ERROR([unrecognized argument: $[1]
Try '$[0] --help' for more information.]) ;;
esac
shift
done
if $lt_cl_silent; then
exec AS_MESSAGE_FD>/dev/null
fi
_LTEOF
cat >>"$CONFIG_LT" <<_LTEOF
_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
_LTEOF
cat >>"$CONFIG_LT" <<\_LTEOF
AC_MSG_NOTICE([creating $ofile])
_LT_OUTPUT_LIBTOOL_COMMANDS
AS_EXIT(0)
_LTEOF
chmod +x "$CONFIG_LT"
# configure is writing to config.log, but config.lt does its own redirection,
# appending to config.log, which fails on DOS, as config.log is still kept
# open by configure. Here we exec the FD to /dev/null, effectively closing
# config.log, so it can be properly (re)opened and appended to by config.lt.
lt_cl_success=:
test yes = "$silent" &&
lt_config_lt_args="$lt_config_lt_args --quiet"
exec AS_MESSAGE_LOG_FD>/dev/null
$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
exec AS_MESSAGE_LOG_FD>>config.log
$lt_cl_success || AS_EXIT(1)
])# LT_OUTPUT
# _LT_CONFIG(TAG)
# ---------------
# If TAG is the built-in tag, create an initial libtool script with a
# default configuration from the untagged config vars. Otherwise add code
# to config.status for appending the configuration named by TAG from the
# matching tagged config vars.
m4_defun([_LT_CONFIG],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
_LT_CONFIG_SAVE_COMMANDS([
m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
m4_if(_LT_TAG, [C], [
# See if we are running on zsh, and set the options that allow our
# commands through without removal of \ escapes.
if test -n "${ZSH_VERSION+set}"; then
setopt NO_GLOB_SUBST
fi
cfgfile=${ofile}T
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
$RM "$cfgfile"
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
# Generated automatically by $as_me ($PACKAGE) $VERSION
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
# Provide generalized library-building support services.
# Written by Gordon Matzigkeit, 1996
_LT_COPYING
_LT_LIBTOOL_TAGS
# Configured defaults for sys_lib_dlsearch_path munging.
: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
# ### BEGIN LIBTOOL CONFIG
_LT_LIBTOOL_CONFIG_VARS
_LT_LIBTOOL_TAG_VARS
# ### END LIBTOOL CONFIG
_LT_EOF
cat <<'_LT_EOF' >> "$cfgfile"
# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
_LT_PREPARE_MUNGE_PATH_LIST
_LT_PREPARE_CC_BASENAME
# ### END FUNCTIONS SHARED WITH CONFIGURE
_LT_EOF
case $host_os in
aix3*)
cat <<\_LT_EOF >> "$cfgfile"
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test set != "${COLLECT_NAMES+set}"; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
_LT_EOF
;;
esac
_LT_PROG_LTMAIN
# We use sed instead of cat because bash on DJGPP gets confused if
# if finds mixed CR/LF and LF-only lines. Since sed operates in
# text mode, it properly converts lines to CR/LF. This bash problem
# is reportedly fixed, but why not run on old versions too?
$SED '$q' "$ltmain" >> "$cfgfile" \
|| (rm -f "$cfgfile"; exit 1)
mv -f "$cfgfile" "$ofile" ||
(rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
chmod +x "$ofile"
],
[cat <<_LT_EOF >> "$ofile"
dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
dnl in a comment (ie after a #).
# ### BEGIN LIBTOOL TAG CONFIG: $1
_LT_LIBTOOL_TAG_VARS(_LT_TAG)
# ### END LIBTOOL TAG CONFIG: $1
_LT_EOF
])dnl /m4_if
],
[m4_if([$1], [], [
PACKAGE='$PACKAGE'
VERSION='$VERSION'
RM='$RM'
ofile='$ofile'], [])
])dnl /_LT_CONFIG_SAVE_COMMANDS
])# _LT_CONFIG
# LT_SUPPORTED_TAG(TAG)
# ---------------------
# Trace this macro to discover what tags are supported by the libtool
# --tag option, using:
# autoconf --trace 'LT_SUPPORTED_TAG:$1'
AC_DEFUN([LT_SUPPORTED_TAG], [])
# C support is built-in for now
m4_define([_LT_LANG_C_enabled], [])
m4_define([_LT_TAGS], [])
# LT_LANG(LANG)
# -------------
# Enable libtool support for the given language if not already enabled.
AC_DEFUN([LT_LANG],
[AC_BEFORE([$0], [LT_OUTPUT])dnl
m4_case([$1],
[C], [_LT_LANG(C)],
[C++], [_LT_LANG(CXX)],
[Go], [_LT_LANG(GO)],
[Java], [_LT_LANG(GCJ)],
[Fortran 77], [_LT_LANG(F77)],
[Fortran], [_LT_LANG(FC)],
[Windows Resource], [_LT_LANG(RC)],
[m4_ifdef([_LT_LANG_]$1[_CONFIG],
[_LT_LANG($1)],
[m4_fatal([$0: unsupported language: "$1"])])])dnl
])# LT_LANG
# _LT_LANG(LANGNAME)
# ------------------
m4_defun([_LT_LANG],
[m4_ifdef([_LT_LANG_]$1[_enabled], [],
[LT_SUPPORTED_TAG([$1])dnl
m4_append([_LT_TAGS], [$1 ])dnl
m4_define([_LT_LANG_]$1[_enabled], [])dnl
_LT_LANG_$1_CONFIG($1)])dnl
])# _LT_LANG
m4_ifndef([AC_PROG_GO], [
############################################################
# NOTE: This macro has been submitted for inclusion into #
# GNU Autoconf as AC_PROG_GO. When it is available in #
# a released version of Autoconf we should remove this #
# macro and use it instead. #
############################################################
m4_defun([AC_PROG_GO],
[AC_LANG_PUSH(Go)dnl
AC_ARG_VAR([GOC], [Go compiler command])dnl
AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
_AC_ARG_VAR_LDFLAGS()dnl
AC_CHECK_TOOL(GOC, gccgo)
if test -z "$GOC"; then
if test -n "$ac_tool_prefix"; then
AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
fi
fi
if test -z "$GOC"; then
AC_CHECK_PROG(GOC, gccgo, gccgo, false)
fi
])#m4_defun
])#m4_ifndef
# _LT_LANG_DEFAULT_CONFIG
# -----------------------
m4_defun([_LT_LANG_DEFAULT_CONFIG],
[AC_PROVIDE_IFELSE([AC_PROG_CXX],
[LT_LANG(CXX)],
[m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
AC_PROVIDE_IFELSE([AC_PROG_F77],
[LT_LANG(F77)],
[m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
AC_PROVIDE_IFELSE([AC_PROG_FC],
[LT_LANG(FC)],
[m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
dnl pulling things in needlessly.
AC_PROVIDE_IFELSE([AC_PROG_GCJ],
[LT_LANG(GCJ)],
[AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
[LT_LANG(GCJ)],
[AC_PROVIDE_IFELSE([LT_PROG_GCJ],
[LT_LANG(GCJ)],
[m4_ifdef([AC_PROG_GCJ],
[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
m4_ifdef([A][M_PROG_GCJ],
[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
m4_ifdef([LT_PROG_GCJ],
[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
AC_PROVIDE_IFELSE([AC_PROG_GO],
[LT_LANG(GO)],
[m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
AC_PROVIDE_IFELSE([LT_PROG_RC],
[LT_LANG(RC)],
[m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
])# _LT_LANG_DEFAULT_CONFIG
# Obsolete macros:
AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
dnl AC_DEFUN([AC_LIBTOOL_F77], [])
dnl AC_DEFUN([AC_LIBTOOL_FC], [])
dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
dnl AC_DEFUN([AC_LIBTOOL_RC], [])
# _LT_TAG_COMPILER
# ----------------
m4_defun([_LT_TAG_COMPILER],
[AC_REQUIRE([AC_PROG_CC])dnl
_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
# If no C compiler flags were specified, use CFLAGS.
LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
])# _LT_TAG_COMPILER
# _LT_COMPILER_BOILERPLATE
# ------------------------
# Check for compiler boilerplate output or warnings with
# the simple compiler test code.
m4_defun([_LT_COMPILER_BOILERPLATE],
[m4_require([_LT_DECL_SED])dnl
ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" >conftest.$ac_ext
eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_compiler_boilerplate=`cat conftest.err`
$RM conftest*
])# _LT_COMPILER_BOILERPLATE
# _LT_LINKER_BOILERPLATE
# ----------------------
# Check for linker boilerplate output or warnings with
# the simple link test code.
m4_defun([_LT_LINKER_BOILERPLATE],
[m4_require([_LT_DECL_SED])dnl
ac_outfile=conftest.$ac_objext
echo "$lt_simple_link_test_code" >conftest.$ac_ext
eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_linker_boilerplate=`cat conftest.err`
$RM -r conftest*
])# _LT_LINKER_BOILERPLATE
# _LT_REQUIRED_DARWIN_CHECKS
# -------------------------
m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
case $host_os in
rhapsody* | darwin*)
AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
AC_CHECK_TOOL([LIPO], [lipo], [:])
AC_CHECK_TOOL([OTOOL], [otool], [:])
AC_CHECK_TOOL([OTOOL64], [otool64], [:])
_LT_DECL([], [DSYMUTIL], [1],
[Tool to manipulate archived DWARF debug symbol files on Mac OS X])
_LT_DECL([], [NMEDIT], [1],
[Tool to change global to local symbols on Mac OS X])
_LT_DECL([], [LIPO], [1],
[Tool to manipulate fat objects and archives on Mac OS X])
_LT_DECL([], [OTOOL], [1],
[ldd/readelf like tool for Mach-O binaries on Mac OS X])
_LT_DECL([], [OTOOL64], [1],
[ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
[lt_cv_apple_cc_single_mod=no
if test -z "$LT_MULTI_MODULE"; then
# By default we will add the -single_module flag. You can override
# by either setting the environment variable LT_MULTI_MODULE
# non-empty at configure time, or by adding -multi_module to the
# link flags.
rm -rf libconftest.dylib*
echo "int foo(void){return 1;}" > conftest.c
echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c 2>conftest.err
_lt_result=$?
# If there is a non-empty error log, and "single_module"
# appears in it, assume the flag caused a linker warning
if test -s conftest.err && $GREP single_module conftest.err; then
cat conftest.err >&AS_MESSAGE_LOG_FD
# Otherwise, if the output was created with a 0 exit code from
# the compiler, it worked.
elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
lt_cv_apple_cc_single_mod=yes
else
cat conftest.err >&AS_MESSAGE_LOG_FD
fi
rm -rf libconftest.dylib*
rm -f conftest.*
fi])
AC_CACHE_CHECK([for -exported_symbols_list linker flag],
[lt_cv_ld_exported_symbols_list],
[lt_cv_ld_exported_symbols_list=no
save_LDFLAGS=$LDFLAGS
echo "_main" > conftest.sym
LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[lt_cv_ld_exported_symbols_list=yes],
[lt_cv_ld_exported_symbols_list=no])
LDFLAGS=$save_LDFLAGS
])
AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
[lt_cv_ld_force_load=no
cat > conftest.c << _LT_EOF
int forced_loaded() { return 2;}
_LT_EOF
echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
$AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
$RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
cat > conftest.c << _LT_EOF
int main() { return 0;}
_LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
_lt_result=$?
if test -s conftest.err && $GREP force_load conftest.err; then
cat conftest.err >&AS_MESSAGE_LOG_FD
elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
lt_cv_ld_force_load=yes
else
cat conftest.err >&AS_MESSAGE_LOG_FD
fi
rm -f conftest.err libconftest.a conftest conftest.c
rm -rf conftest.dSYM
])
case $host_os in
rhapsody* | darwin1.[[012]])
_lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
darwin*)
case $MACOSX_DEPLOYMENT_TARGET,$host in
10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
*)
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
if test yes = "$lt_cv_apple_cc_single_mod"; then
_lt_dar_single_mod='$single_module'
fi
if test yes = "$lt_cv_ld_exported_symbols_list"; then
_lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
else
_lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
fi
if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
_lt_dsymutil='~$DSYMUTIL $lib || :'
else
_lt_dsymutil=
fi
;;
esac
])
# _LT_DARWIN_LINKER_FEATURES([TAG])
# ---------------------------------
# Checks for linker and compiler features on darwin
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
if test yes = "$lt_cv_ld_force_load"; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
[FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=''
fi
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined
case $cc_basename in
ifort*|nagfor*) _lt_dar_can_shared=yes ;;
*) _lt_dar_can_shared=$GCC ;;
esac
if test yes = "$_lt_dar_can_shared"; then
output_verbose_link_cmd=func_echo_all
_LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
_LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
_LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
m4_if([$1], [CXX],
[ if test yes != "$lt_cv_apple_cc_single_mod"; then
_LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil"
_LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil"
fi
],[])
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
])
# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
# ----------------------------------
# Links a minimal program and checks the executable
# for the system default hardcoded library path. In most cases,
# this is /usr/lib:/lib, but when the MPI compilers are used
# the location of the communication and MPI libs are included too.
# If we don't find anything, use the default library path according
# to the aix ld manual.
# Store the results from the different compilers for each TAGNAME.
# Allow to override them for all tags through lt_cv_aix_libpath.
m4_defun([_LT_SYS_MODULE_PATH_AIX],
[m4_require([_LT_DECL_SED])dnl
if test set = "${lt_cv_aix_libpath+set}"; then
aix_libpath=$lt_cv_aix_libpath
else
AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
[AC_LINK_IFELSE([AC_LANG_PROGRAM],[
lt_aix_libpath_sed='[
/Import File Strings/,/^$/ {
/^0/ {
s/^0 *\([^ ]*\) *$/\1/
p
}
}]'
_LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
# Check for a 64-bit object if we didn't find anything.
if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
_LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi],[])
if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
_LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib
fi
])
aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
fi
])# _LT_SYS_MODULE_PATH_AIX
# _LT_SHELL_INIT(ARG)
# -------------------
m4_define([_LT_SHELL_INIT],
[m4_divert_text([M4SH-INIT], [$1
])])# _LT_SHELL_INIT
# _LT_PROG_ECHO_BACKSLASH
# -----------------------
# Find how we can fake an echo command that does not interpret backslash.
# In particular, with Autoconf 2.60 or later we add some code to the start
# of the generated configure script that will find a shell with a builtin
# printf (that we can use as an echo command).
m4_defun([_LT_PROG_ECHO_BACKSLASH],
[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
AC_MSG_CHECKING([how to print strings])
# Test print first, because it will be a builtin if present.
if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
ECHO='print -r --'
elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
ECHO='printf %s\n'
else
# Use this function as a fallback that always works.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
$[]1
_LTECHO_EOF'
}
ECHO='func_fallback_echo'
fi
# func_echo_all arg...
# Invoke $ECHO with all args, space-separated.
func_echo_all ()
{
$ECHO "$*"
}
case $ECHO in
printf*) AC_MSG_RESULT([printf]) ;;
print*) AC_MSG_RESULT([print -r]) ;;
*) AC_MSG_RESULT([cat]) ;;
esac
m4_ifdef([_AS_DETECT_SUGGESTED],
[_AS_DETECT_SUGGESTED([
test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
PATH=/empty FPATH=/empty; export PATH FPATH
test "X`printf %s $ECHO`" = "X$ECHO" \
|| test "X`print -r -- $ECHO`" = "X$ECHO" )])])
_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
])# _LT_PROG_ECHO_BACKSLASH
# _LT_WITH_SYSROOT
# ----------------
AC_DEFUN([_LT_WITH_SYSROOT],
[m4_require([_LT_DECL_SED])dnl
AC_MSG_CHECKING([for sysroot])
AC_ARG_WITH([sysroot],
[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
[Search for dependent libraries within DIR (or the compiler's sysroot
if not specified).])],
[], [with_sysroot=no])
dnl lt_sysroot will always be passed unquoted. We quote it here
dnl in case the user passed a directory name.
lt_sysroot=
case $with_sysroot in #(
yes)
if test yes = "$GCC"; then
lt_sysroot=`$CC --print-sysroot 2>/dev/null`
fi
;; #(
/*)
lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"`
;; #(
no|'')
;; #(
*)
AC_MSG_RESULT([$with_sysroot])
AC_MSG_ERROR([The sysroot must be an absolute path.])
;;
esac
AC_MSG_RESULT([${lt_sysroot:-no}])
_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
[dependent libraries, and where our libraries should be installed.])])
# _LT_ENABLE_LOCK
# ---------------
m4_defun([_LT_ENABLE_LOCK],
[AC_ARG_ENABLE([libtool-lock],
[AS_HELP_STRING([--disable-libtool-lock],
[avoid locking (might break parallel builds)])])
test no = "$enable_libtool_lock" || enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case $host in
ia64-*-hpux*)
# Find out what ABI is being produced by ac_compile, and set mode
# options accordingly.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `$FILECMD conftest.$ac_objext` in
*ELF-32*)
HPUX_IA64_MODE=32
;;
*ELF-64*)
HPUX_IA64_MODE=64
;;
esac
fi
rm -rf conftest*
;;
*-*-irix6*)
# Find out what ABI is being produced by ac_compile, and set linker
# options accordingly.
echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
if test yes = "$lt_cv_prog_gnu_ld"; then
case `$FILECMD conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -melf32bsmip"
;;
*N32*)
LD="${LD-ld} -melf32bmipn32"
;;
*64-bit*)
LD="${LD-ld} -melf64bmip"
;;
esac
else
case `$FILECMD conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
fi
rm -rf conftest*
;;
mips64*-*linux*)
# Find out what ABI is being produced by ac_compile, and set linker
# options accordingly.
echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
emul=elf
case `$FILECMD conftest.$ac_objext` in
*32-bit*)
emul="${emul}32"
;;
*64-bit*)
emul="${emul}64"
;;
esac
case `$FILECMD conftest.$ac_objext` in
*MSB*)
emul="${emul}btsmip"
;;
*LSB*)
emul="${emul}ltsmip"
;;
esac
case `$FILECMD conftest.$ac_objext` in
*N32*)
emul="${emul}n32"
;;
esac
LD="${LD-ld} -m $emul"
fi
rm -rf conftest*
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out what ABI is being produced by ac_compile, and set linker
# options accordingly. Note that the listed cases only cover the
# situations where additional linker options are needed (such as when
# doing 32-bit compilation for a host where ld defaults to 64-bit, or
# vice versa); the common cases where no linker options are needed do
# not appear in the list.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `$FILECMD conftest.o` in
*32-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
case `$FILECMD conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
;;
*)
LD="${LD-ld} -m elf_i386"
;;
esac
;;
powerpc64le-*linux*)
LD="${LD-ld} -m elf32lppclinux"
;;
powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf_s390"
;;
sparc64-*linux*)
LD="${LD-ld} -m elf32_sparc"
;;
esac
;;
*64-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
LD="${LD-ld} -m elf64lppc"
;;
powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64_s390"
;;
sparc*-*linux*)
LD="${LD-ld} -m elf64_sparc"
;;
esac
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_LANG_PUSH(C)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
AC_LANG_POP])
if test yes != "$lt_cv_cc_needs_belf"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS=$SAVE_CFLAGS
fi
;;
*-*solaris*)
# Find out what ABI is being produced by ac_compile, and set linker
# options accordingly.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `$FILECMD conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
yes*)
case $host in
i?86-*-solaris*|x86_64-*-solaris*)
LD="${LD-ld} -m elf_x86_64"
;;
sparc*-*-solaris*)
LD="${LD-ld} -m elf64_sparc"
;;
esac
# GNU ld 2.21 introduced _sol2 emulations. Use them if available.
if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
LD=${LD-ld}_sol2
fi
;;
*)
if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
LD="${LD-ld} -64"
fi
;;
esac
;;
esac
fi
rm -rf conftest*
;;
esac
need_locks=$enable_libtool_lock
])# _LT_ENABLE_LOCK
# _LT_PROG_AR
# -----------
m4_defun([_LT_PROG_AR],
[AC_CHECK_TOOLS(AR, [ar], false)
: ${AR=ar}
_LT_DECL([], [AR], [1], [The archiver])
# Use ARFLAGS variable as AR's operation code to sync the variable naming with
# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have
# higher priority because thats what people were doing historically (setting
# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS
# variable obsoleted/removed.
test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr}
lt_ar_flags=$AR_FLAGS
_LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)])
# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override
# by AR_FLAGS because that was never working and AR_FLAGS is about to die.
_LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}],
[Flags to create an archive])
AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
[lt_cv_ar_at_file=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
[echo conftest.$ac_objext > conftest.lst
lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
AC_TRY_EVAL([lt_ar_try])
if test 0 -eq "$ac_status"; then
# Ensure the archiver fails upon bogus file names.
rm -f conftest.$ac_objext libconftest.a
AC_TRY_EVAL([lt_ar_try])
if test 0 -ne "$ac_status"; then
lt_cv_ar_at_file=@
fi
fi
rm -f conftest.* libconftest.a
])
])
if test no = "$lt_cv_ar_at_file"; then
archiver_list_spec=
else
archiver_list_spec=$lt_cv_ar_at_file
fi
_LT_DECL([], [archiver_list_spec], [1],
[How to feed a file listing to the archiver])
])# _LT_PROG_AR
# _LT_CMD_OLD_ARCHIVE
# -------------------
m4_defun([_LT_CMD_OLD_ARCHIVE],
[_LT_PROG_AR
AC_CHECK_TOOL(STRIP, strip, :)
test -z "$STRIP" && STRIP=:
_LT_DECL([], [STRIP], [1], [A symbol stripping program])
AC_CHECK_TOOL(RANLIB, ranlib, :)
test -z "$RANLIB" && RANLIB=:
_LT_DECL([], [RANLIB], [1],
[Commands used to install an old-style archive])
# Determine commands to create old-style static archives.
old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
if test -n "$RANLIB"; then
case $host_os in
bitrig* | openbsd*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
;;
*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
;;
esac
old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
fi
case $host_os in
darwin*)
lock_old_archive_extraction=yes ;;
*)
lock_old_archive_extraction=no ;;
esac
_LT_DECL([], [old_postinstall_cmds], [2])
_LT_DECL([], [old_postuninstall_cmds], [2])
_LT_TAGDECL([], [old_archive_cmds], [2],
[Commands used to build an old-style archive])
_LT_DECL([], [lock_old_archive_extraction], [0],
[Whether to use a lock for old archive extraction])
])# _LT_CMD_OLD_ARCHIVE
# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------------------
# Check whether the given compiler option works
AC_DEFUN([_LT_COMPILER_OPTION],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_SED])dnl
AC_CACHE_CHECK([$1], [$2],
[$2=no
m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
# The option is referenced via a variable to avoid confusing sed.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&AS_MESSAGE_LOG_FD
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
fi
fi
$RM conftest*
])
if test yes = "[$]$2"; then
m4_if([$5], , :, [$5])
else
m4_if([$6], , :, [$6])
fi
])# _LT_COMPILER_OPTION
# Old name:
AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
# [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------
# Check whether the given linker option works
AC_DEFUN([_LT_LINKER_OPTION],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_SED])dnl
AC_CACHE_CHECK([$1], [$2],
[$2=no
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $3"
echo "$lt_simple_link_test_code" > conftest.$ac_ext
if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
# The linker can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
# Append any errors to the config.log.
cat conftest.err 1>&AS_MESSAGE_LOG_FD
$ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
fi
else
$2=yes
fi
fi
$RM -r conftest*
LDFLAGS=$save_LDFLAGS
])
if test yes = "[$]$2"; then
m4_if([$4], , :, [$4])
else
m4_if([$5], , :, [$5])
fi
])# _LT_LINKER_OPTION
# Old name:
AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
# LT_CMD_MAX_LEN
#---------------
AC_DEFUN([LT_CMD_MAX_LEN],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
# find the maximum length of command line arguments
AC_MSG_CHECKING([the maximum length of command line arguments])
AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
i=0
teststring=ABCD
case $build_os in
msdosdjgpp*)
# On DJGPP, this test can blow up pretty badly due to problems in libc
# (any single argument exceeding 2000 bytes causes a buffer overrun
# during glob expansion). Even if it were fixed, the result of this
# check would be larger than it should be.
lt_cv_sys_max_cmd_len=12288; # 12K is about right
;;
gnu*)
# Under GNU Hurd, this test is not required because there is
# no limit to the length of command line arguments.
# Libtool will interpret -1 as no limit whatsoever
lt_cv_sys_max_cmd_len=-1;
;;
cygwin* | mingw* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
# you end up with a "frozen" computer, even though with patience
# the test eventually succeeds (with a max line length of 256k).
# Instead, let's just punt: use the minimum linelength reported by
# all of the supported platforms: 8192 (on NT/2K/XP).
lt_cv_sys_max_cmd_len=8192;
;;
mint*)
# On MiNT this can take a long time and run out of memory.
lt_cv_sys_max_cmd_len=8192;
;;
amigaos*)
# On AmigaOS with pdksh, this test takes hours, literally.
# So we just punt and use a minimum line length of 8192.
lt_cv_sys_max_cmd_len=8192;
;;
bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*)
# This has been around since 386BSD, at least. Likely further.
if test -x /sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
elif test -x /usr/sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
else
lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
fi
# And add a safety zone
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
;;
interix*)
# We know the value 262144 and hardcode it with a safety zone (like BSD)
lt_cv_sys_max_cmd_len=196608
;;
os2*)
# The test takes a long time on OS/2.
lt_cv_sys_max_cmd_len=8192
;;
osf*)
# Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
# due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
# nice to cause kernel panics so lets avoid the loop below.
# First set a reasonable default.
lt_cv_sys_max_cmd_len=16384
#
if test -x /sbin/sysconfig; then
case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
*1*) lt_cv_sys_max_cmd_len=-1 ;;
esac
fi
;;
sco3.2v5*)
lt_cv_sys_max_cmd_len=102400
;;
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[[ ]]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len" && \
test undefined != "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
# Make teststring a little bigger before we do anything with it.
# a 1K string should be a reasonable start.
for i in 1 2 3 4 5 6 7 8; do
teststring=$teststring$teststring
done
SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
while { test X`env echo "$teststring$teststring" 2>/dev/null` \
= "X$teststring$teststring"; } >/dev/null 2>&1 &&
test 17 != "$i" # 1/2 MB should be enough
do
i=`expr $i + 1`
teststring=$teststring$teststring
done
# Only check the string length outside the loop.
lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
teststring=
# Add a significant safety factor because C++ compilers can tack on
# massive amounts of additional arguments before passing them to the
# linker. It appears as though 1/2 is a usable value.
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
fi
;;
esac
])
if test -n "$lt_cv_sys_max_cmd_len"; then
AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
else
AC_MSG_RESULT(none)
fi
max_cmd_len=$lt_cv_sys_max_cmd_len
_LT_DECL([], [max_cmd_len], [0],
[What is the maximum length of a command?])
])# LT_CMD_MAX_LEN
# Old name:
AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
# _LT_HEADER_DLFCN
# ----------------
m4_defun([_LT_HEADER_DLFCN],
[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
])# _LT_HEADER_DLFCN
# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
# ----------------------------------------------------------------
m4_defun([_LT_TRY_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
if test yes = "$cross_compiling"; then :
[$4]
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
[#line $LINENO "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
#include
#endif
#include
#ifdef RTLD_GLOBAL
# define LT_DLGLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_DLGLOBAL DL_GLOBAL
# else
# define LT_DLGLOBAL 0
# endif
#endif
/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LT_DLLAZY_OR_NOW
# ifdef RTLD_LAZY
# define LT_DLLAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LT_DLLAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LT_DLLAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LT_DLLAZY_OR_NOW DL_NOW
# else
# define LT_DLLAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
/* When -fvisibility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */
#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord () __attribute__((visibility("default")));
#endif
int fnord () { return 42; }
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown;
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
else
{
if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
else puts (dlerror ());
}
/* dlclose (self); */
}
else
puts (dlerror ());
return status;
}]
_LT_EOF
if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then
(./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
lt_status=$?
case x$lt_status in
x$lt_dlno_uscore) $1 ;;
x$lt_dlneed_uscore) $2 ;;
x$lt_dlunknown|x*) $3 ;;
esac
else :
# compilation failed
$3
fi
fi
rm -fr conftest*
])# _LT_TRY_DLOPEN_SELF
# LT_SYS_DLOPEN_SELF
# ------------------
AC_DEFUN([LT_SYS_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
if test yes != "$enable_dlopen"; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
else
lt_cv_dlopen=no
lt_cv_dlopen_libs=
case $host_os in
beos*)
lt_cv_dlopen=load_add_on
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
;;
mingw* | pw32* | cegcc*)
lt_cv_dlopen=LoadLibrary
lt_cv_dlopen_libs=
;;
cygwin*)
lt_cv_dlopen=dlopen
lt_cv_dlopen_libs=
;;
darwin*)
# if libdl is installed we need to link against it
AC_CHECK_LIB([dl], [dlopen],
[lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[
lt_cv_dlopen=dyld
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
])
;;
tpf*)
# Don't try to run any link tests for TPF. We know it's impossible
# because TPF is a cross-compiler, and we know how we open DSOs.
lt_cv_dlopen=dlopen
lt_cv_dlopen_libs=
lt_cv_dlopen_self=no
;;
*)
AC_CHECK_FUNC([shl_load],
[lt_cv_dlopen=shl_load],
[AC_CHECK_LIB([dld], [shl_load],
[lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld],
[AC_CHECK_FUNC([dlopen],
[lt_cv_dlopen=dlopen],
[AC_CHECK_LIB([dl], [dlopen],
[lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],
[AC_CHECK_LIB([svld], [dlopen],
[lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld],
[AC_CHECK_LIB([dld], [dld_link],
[lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld])
])
])
])
])
])
;;
esac
if test no = "$lt_cv_dlopen"; then
enable_dlopen=no
else
enable_dlopen=yes
fi
case $lt_cv_dlopen in
dlopen)
save_CPPFLAGS=$CPPFLAGS
test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
save_LDFLAGS=$LDFLAGS
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
save_LIBS=$LIBS
LIBS="$lt_cv_dlopen_libs $LIBS"
AC_CACHE_CHECK([whether a program can dlopen itself],
lt_cv_dlopen_self, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
])
if test yes = "$lt_cv_dlopen_self"; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
lt_cv_dlopen_self_static, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
])
fi
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
;;
esac
case $lt_cv_dlopen_self in
yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
*) enable_dlopen_self=unknown ;;
esac
case $lt_cv_dlopen_self_static in
yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
*) enable_dlopen_self_static=unknown ;;
esac
fi
_LT_DECL([dlopen_support], [enable_dlopen], [0],
[Whether dlopen is supported])
_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
[Whether dlopen of programs is supported])
_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
[Whether dlopen of statically linked programs is supported])
])# LT_SYS_DLOPEN_SELF
# Old name:
AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
# _LT_COMPILER_C_O([TAGNAME])
# ---------------------------
# Check to see if options -c and -o are simultaneously supported by compiler.
# This macro does not hard code the compiler like AC_PROG_CC_C_O.
m4_defun([_LT_COMPILER_C_O],
[m4_require([_LT_DECL_SED])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_TAG_COMPILER])dnl
AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
[_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
[_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
$RM -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&AS_MESSAGE_LOG_FD
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
$SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
fi
fi
chmod u+w . 2>&AS_MESSAGE_LOG_FD
$RM conftest*
# SGI C++ compiler will create directory out/ii_files/ for
# template instantiation
test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
$RM out/* && rmdir out
cd ..
$RM -r conftest
$RM conftest*
])
_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
[Does compiler simultaneously support -c and -o options?])
])# _LT_COMPILER_C_O
# _LT_COMPILER_FILE_LOCKS([TAGNAME])
# ----------------------------------
# Check to see if we can do hard links to lock some files if needed
m4_defun([_LT_COMPILER_FILE_LOCKS],
[m4_require([_LT_ENABLE_LOCK])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
_LT_COMPILER_C_O([$1])
hard_links=nottested
if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then
# do not overwrite the value of need_locks provided by the user
AC_MSG_CHECKING([if we can lock with hard links])
hard_links=yes
$RM conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
AC_MSG_RESULT([$hard_links])
if test no = "$hard_links"; then
AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe])
need_locks=warn
fi
else
need_locks=no
fi
_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
])# _LT_COMPILER_FILE_LOCKS
# _LT_CHECK_OBJDIR
# ----------------
m4_defun([_LT_CHECK_OBJDIR],
[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
[rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
lt_cv_objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
lt_cv_objdir=_libs
fi
rmdir .libs 2>/dev/null])
objdir=$lt_cv_objdir
_LT_DECL([], [objdir], [0],
[The name of the directory that contains temporary libtool files])dnl
m4_pattern_allow([LT_OBJDIR])dnl
AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/",
[Define to the sub-directory where libtool stores uninstalled libraries.])
])# _LT_CHECK_OBJDIR
# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
# --------------------------------------
# Check hardcoding attributes.
m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
[AC_MSG_CHECKING([how to hardcode library paths into programs])
_LT_TAGVAR(hardcode_action, $1)=
if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
test -n "$_LT_TAGVAR(runpath_var, $1)" ||
test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then
# We can hardcode non-existent directories.
if test no != "$_LT_TAGVAR(hardcode_direct, $1)" &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library
# when we should be linking with a yet-to-be-installed one
## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" &&
test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then
# Linking always hardcodes the temporary library directory.
_LT_TAGVAR(hardcode_action, $1)=relink
else
# We can link without hardcoding, and we can hardcode nonexisting dirs.
_LT_TAGVAR(hardcode_action, $1)=immediate
fi
else
# We cannot hardcode anything, or else we can only hardcode existing
# directories.
_LT_TAGVAR(hardcode_action, $1)=unsupported
fi
AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
if test relink = "$_LT_TAGVAR(hardcode_action, $1)" ||
test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then
# Fast installation is not supported
enable_fast_install=no
elif test yes = "$shlibpath_overrides_runpath" ||
test no = "$enable_shared"; then
# Fast installation is not necessary
enable_fast_install=needless
fi
_LT_TAGDECL([], [hardcode_action], [0],
[How to hardcode a shared library path into an executable])
])# _LT_LINKER_HARDCODE_LIBPATH
# _LT_CMD_STRIPLIB
# ----------------
m4_defun([_LT_CMD_STRIPLIB],
[m4_require([_LT_DECL_EGREP])
striplib=
old_striplib=
AC_MSG_CHECKING([whether stripping libraries is possible])
if test -z "$STRIP"; then
AC_MSG_RESULT([no])
else
if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
old_striplib="$STRIP --strip-debug"
striplib="$STRIP --strip-unneeded"
AC_MSG_RESULT([yes])
else
case $host_os in
darwin*)
# FIXME - insert some real tests, host_os isn't really good enough
striplib="$STRIP -x"
old_striplib="$STRIP -S"
AC_MSG_RESULT([yes])
;;
freebsd*)
if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then
old_striplib="$STRIP --strip-debug"
striplib="$STRIP --strip-unneeded"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
;;
*)
AC_MSG_RESULT([no])
;;
esac
fi
fi
_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
_LT_DECL([], [striplib], [1])
])# _LT_CMD_STRIPLIB
# _LT_PREPARE_MUNGE_PATH_LIST
# ---------------------------
# Make sure func_munge_path_list() is defined correctly.
m4_defun([_LT_PREPARE_MUNGE_PATH_LIST],
[[# func_munge_path_list VARIABLE PATH
# -----------------------------------
# VARIABLE is name of variable containing _space_ separated list of
# directories to be munged by the contents of PATH, which is string
# having a format:
# "DIR[:DIR]:"
# string "DIR[ DIR]" will be prepended to VARIABLE
# ":DIR[:DIR]"
# string "DIR[ DIR]" will be appended to VARIABLE
# "DIRP[:DIRP]::[DIRA:]DIRA"
# string "DIRP[ DIRP]" will be prepended to VARIABLE and string
# "DIRA[ DIRA]" will be appended to VARIABLE
# "DIR[:DIR]"
# VARIABLE will be replaced by "DIR[ DIR]"
func_munge_path_list ()
{
case x@S|@2 in
x)
;;
*:)
eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
;;
x:*)
eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
;;
*::*)
eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
;;
*)
eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
;;
esac
}
]])# _LT_PREPARE_PATH_LIST
# _LT_SYS_DYNAMIC_LINKER([TAG])
# -----------------------------
# PORTME Fill in your ld.so characteristics
m4_defun([_LT_SYS_DYNAMIC_LINKER],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_OBJDUMP])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_CHECK_SHELL_FEATURES])dnl
m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl
AC_MSG_CHECKING([dynamic linker characteristics])
m4_if([$1],
[], [
if test yes = "$GCC"; then
case $host_os in
darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
*) lt_awk_arg='/^libraries:/' ;;
esac
case $host_os in
mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
*) lt_sed_strip_eq='s|=/|/|g' ;;
esac
lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
case $lt_search_path_spec in
*\;*)
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
;;
*)
lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
;;
esac
# Ok, now we have the path, separated by spaces, we can step through it
# and add multilib dir if necessary...
lt_tmp_lt_search_path_spec=
lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
# ...but if some path component already ends with the multilib dir we assume
# that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
case "$lt_multi_os_dir; $lt_search_path_spec " in
"/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
lt_multi_os_dir=
;;
esac
for lt_sys_path in $lt_search_path_spec; do
if test -d "$lt_sys_path$lt_multi_os_dir"; then
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
elif test -n "$lt_multi_os_dir"; then
test -d "$lt_sys_path" && \
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
fi
done
lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
BEGIN {RS = " "; FS = "/|\n";} {
lt_foo = "";
lt_count = 0;
for (lt_i = NF; lt_i > 0; lt_i--) {
if ($lt_i != "" && $lt_i != ".") {
if ($lt_i == "..") {
lt_count++;
} else {
if (lt_count == 0) {
lt_foo = "/" $lt_i lt_foo;
} else {
lt_count--;
}
}
}
}
if (lt_foo != "") { lt_freq[[lt_foo]]++; }
if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
}'`
# AWK program above erroneously prepends '/' to C:/dos/paths
# for these hosts.
case $host_os in
mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
$SED 's|/\([[A-Za-z]]:\)|\1|g'` ;;
esac
sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi])
library_names_spec=
libname_spec='lib$name'
soname_spec=
shrext_cmds=.so
postinstall_cmds=
postuninstall_cmds=
finish_cmds=
finish_eval=
shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
need_lib_prefix=unknown
hardcode_into_libs=no
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
need_version=unknown
AC_ARG_VAR([LT_SYS_LIBRARY_PATH],
[User-defined run-time library search path.])
case $host_os in
aix3*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX 3 has no versioning support, so we append a major version to the name.
soname_spec='$libname$release$shared_ext$major'
;;
aix[[4-9]]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
if test ia64 = "$host_cpu"; then
# AIX 5 supports IA64
library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
shlibpath_var=LD_LIBRARY_PATH
else
# With GCC up to 2.95.x, collect2 would create an import file
# for dependence libraries. The import file would start with
# the line '#! .'. This would cause the generated library to
# depend on '.', always an invalid library. This was fixed in
# development snapshots of GCC prior to 3.0.
case $host_os in
aix4 | aix4.[[01]] | aix4.[[01]].*)
if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
echo ' yes '
echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
:
else
can_build_shared=no
fi
;;
esac
# Using Import Files as archive members, it is possible to support
# filename-based versioning of shared library archives on AIX. While
# this would work for both with and without runtime linking, it will
# prevent static linking of such archives. So we do filename-based
# shared library versioning with .so extension only, which is used
# when both runtime linking and shared linking is enabled.
# Unfortunately, runtime linking may impact performance, so we do
# not want this to be the default eventually. Also, we use the
# versioned .so libs for executables only if there is the -brtl
# linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
# To allow for filename-based versioning support, we need to create
# libNAME.so.V as an archive file, containing:
# *) an Import File, referring to the versioned filename of the
# archive as well as the shared archive member, telling the
# bitwidth (32 or 64) of that shared object, and providing the
# list of exported symbols of that shared object, eventually
# decorated with the 'weak' keyword
# *) the shared object with the F_LOADONLY flag set, to really avoid
# it being seen by the linker.
# At run time we better use the real file rather than another symlink,
# but for link time we create the symlink libNAME.so -> libNAME.so.V
case $with_aix_soname,$aix_use_runtimelinking in
# AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
# soname into executable. Probably we can add versioning support to
# collect2, so additional links can be useful in future.
aix,yes) # traditional libtool
dynamic_linker='AIX unversionable lib.so'
# If using run time linking (on AIX 4.2 or later) use lib.so
# instead of lib.a to let people know that these are not
# typical AIX shared libraries.
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
;;
aix,no) # traditional AIX only
dynamic_linker='AIX lib.a[(]lib.so.V[)]'
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.
library_names_spec='$libname$release.a $libname.a'
soname_spec='$libname$release$shared_ext$major'
;;
svr4,*) # full svr4 only
dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]"
library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
# We do not specify a path in Import Files, so LIBPATH fires.
shlibpath_overrides_runpath=yes
;;
*,yes) # both, prefer svr4
dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]"
library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
# unpreferred sharedlib libNAME.a needs extra handling
postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
# We do not specify a path in Import Files, so LIBPATH fires.
shlibpath_overrides_runpath=yes
;;
*,no) # both, prefer aix
dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]"
library_names_spec='$libname$release.a $libname.a'
soname_spec='$libname$release$shared_ext$major'
# unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
;;
esac
shlibpath_var=LIBPATH
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# Since July 2007 AmigaOS4 officially supports .so libraries.
# When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
;;
m68k)
library_names_spec='$libname.ixlibrary $libname.a'
# Create ${libname}_ixlibrary.a entries in /sys/libs.
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
;;
esac
;;
beos*)
library_names_spec='$libname$shared_ext'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
;;
bsdi[[45]]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
# the default ld.so.conf also contains /usr/contrib/lib and
# /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
# libtool to hard-code these into programs
;;
cygwin* | mingw* | pw32* | cegcc*)
version_type=windows
shrext_cmds=.dll
need_version=no
need_lib_prefix=no
case $GCC,$cc_basename in
yes,*)
# gcc
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \$file`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname~
chmod a+x \$dldir/$dlname~
if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
fi'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
shlibpath_overrides_runpath=yes
case $host_os in
cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
;;
mingw* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
;;
esac
dynamic_linker='Win32 ld.exe'
;;
*,cl* | *,icl*)
# Native MSVC or ICC
libname_spec='$name'
soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
library_names_spec='$libname.dll.lib'
case $build_os in
mingw*)
sys_lib_search_path_spec=
lt_save_ifs=$IFS
IFS=';'
for lt_path in $LIB
do
IFS=$lt_save_ifs
# Let DOS variable expansion print the short 8.3 style file name.
lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
done
IFS=$lt_save_ifs
# Convert to MSYS style.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
;;
cygwin*)
# Convert to unix form, then to dos form, then back to unix form
# but this time dos style (no spaces!) so that the unix form looks
# like /cygdrive/c/PROGRA~1:/cygdr...
sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
;;
*)
sys_lib_search_path_spec=$LIB
if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
# It is most probably a Windows format PATH.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
else
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
fi
# FIXME: find the short name or the path components, as spaces are
# common. (e.g. "Program Files" -> "PROGRA~1")
;;
esac
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \$file`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
shlibpath_overrides_runpath=yes
dynamic_linker='Win32 link.exe'
;;
*)
# Assume MSVC and ICC wrapper
library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib'
dynamic_linker='Win32 ld.exe'
;;
esac
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
darwin* | rhapsody*)
dynamic_linker="$host_os dyld"
version_type=darwin
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
soname_spec='$libname$release$major$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
dgux*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
shlibpath_var=LD_LIBRARY_PATH
;;
freebsd* | dragonfly* | midnightbsd*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
if test -x /usr/bin/objformat; then
objformat=`/usr/bin/objformat`
else
case $host_os in
freebsd[[23]].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
version_type=freebsd-$objformat
case $version_type in
freebsd-elf*)
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
need_version=yes
;;
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
*) # from 4.6 on, and DragonFly
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
esac
;;
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
dynamic_linker="$host_os runtime_loader"
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
shlibpath_var=LIBRARY_PATH
shlibpath_overrides_runpath=no
sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
hardcode_into_libs=yes
;;
hpux9* | hpux10* | hpux11*)
# Give a soname corresponding to the major version so that dld.sl refuses to
# link against other versions.
version_type=sunos
need_lib_prefix=no
need_version=no
case $host_cpu in
ia64*)
shrext_cmds='.so'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.so"
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
if test 32 = "$HPUX_IA64_MODE"; then
sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
sys_lib_dlsearch_path_spec=/usr/lib/hpux32
else
sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
sys_lib_dlsearch_path_spec=/usr/lib/hpux64
fi
;;
hppa*64*)
shrext_cmds='.sl'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.sl"
shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
*)
shrext_cmds='.sl'
dynamic_linker="$host_os dld.sl"
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
;;
esac
# HP-UX runs *really* slowly unless shared libraries are mode 555, ...
postinstall_cmds='chmod 555 $lib'
# or fails outright, so override atomically:
install_override_mode=555
;;
interix[[3-9]]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
irix5* | irix6* | nonstopux*)
case $host_os in
nonstopux*) version_type=nonstopux ;;
*)
if test yes = "$lt_cv_prog_gnu_ld"; then
version_type=linux # correct to gnu/linux during the next big refactor
else
version_type=irix
fi ;;
esac
need_lib_prefix=no
need_version=no
soname_spec='$libname$release$shared_ext$major'
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
case $host_os in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in # libtool.m4 will add one of these switches to LD
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
libsuff= shlibsuff= libmagic=32-bit;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
libsuff=32 shlibsuff=N32 libmagic=N32;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
libsuff=64 shlibsuff=64 libmagic=64-bit;;
*) libsuff= shlibsuff= libmagic=never-match;;
esac
;;
esac
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
shlibpath_overrides_runpath=no
sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
hardcode_into_libs=yes
;;
# No shared lib support for Linux oldld, aout, or coff.
linux*oldld* | linux*aout* | linux*coff*)
dynamic_linker=no
;;
linux*android*)
version_type=none # Android doesn't support versioned libraries.
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext'
soname_spec='$libname$release$shared_ext'
finish_cmds=
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
hardcode_into_libs=yes
dynamic_linker='Android linker'
# Don't embed -rpath directories since the linker doesn't support them.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
# Some binutils ld are patched to set DT_RUNPATH
AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
[lt_cv_shlibpath_overrides_runpath=no
save_LDFLAGS=$LDFLAGS
save_libdir=$libdir
eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
[lt_cv_shlibpath_overrides_runpath=yes])])
LDFLAGS=$save_LDFLAGS
libdir=$save_libdir
])
shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
hardcode_into_libs=yes
# Ideally, we could use ldconfig to report *all* directores which are
# searched for libraries, however this is still not possible. Aside from not
# being certain /sbin/ldconfig is available, command
# 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
# even though it is searched at run-time. Try to do the best guess by
# appending ld.so.conf contents (and includes) to the search path.
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
# most powerpc-linux boxes support dynamic linking these days and
# people can always --disable-shared, the test was removed, and we
# assume the GNU/Linux dynamic linker is in use.
dynamic_linker='GNU/Linux ld.so'
;;
netbsdelf*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='NetBSD ld.elf_so'
;;
netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
dynamic_linker='NetBSD ld.elf_so'
fi
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
newsos6)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
;;
*nto* | *qnx*)
version_type=qnx
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='ldqnx.so'
;;
openbsd* | bitrig*)
version_type=sunos
sys_lib_dlsearch_path_spec=/usr/lib
need_lib_prefix=no
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
need_version=no
else
need_version=yes
fi
library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
;;
os2*)
libname_spec='$name'
version_type=windows
shrext_cmds=.dll
need_version=no
need_lib_prefix=no
# OS/2 can only load a DLL with a base name of 8 characters or less.
soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
v=$($ECHO $release$versuffix | tr -d .-);
n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
$ECHO $n$v`$shared_ext'
library_names_spec='${libname}_dll.$libext'
dynamic_linker='OS/2 ld.exe'
shlibpath_var=BEGINLIBPATH
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
postinstall_cmds='base_file=`basename \$file`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname~
chmod a+x \$dldir/$dlname~
if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
fi'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
;;
osf3* | osf4* | osf5*)
version_type=osf
need_lib_prefix=no
need_version=no
soname_spec='$libname$release$shared_ext$major'
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
rdos*)
dynamic_linker=no
;;
solaris*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
;;
sunos4*)
version_type=sunos
library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
if test yes = "$with_gnu_ld"; then
need_lib_prefix=no
fi
need_version=yes
;;
sysv4 | sysv4.3*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
shlibpath_var=LD_LIBRARY_PATH
case $host_vendor in
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
runpath_var=LD_RUN_PATH
;;
siemens)
need_lib_prefix=no
;;
motorola)
need_lib_prefix=no
need_version=no
shlibpath_overrides_runpath=no
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
;;
esac
;;
sysv4*MP*)
if test -d /usr/nec; then
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
soname_spec='$libname$shared_ext.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
version_type=sco
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
if test yes = "$with_gnu_ld"; then
sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
;;
esac
fi
sys_lib_dlsearch_path_spec='/usr/lib'
;;
tpf*)
# TPF is a cross-target only. Preferred cross-host = GNU/Linux.
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
uts4*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
soname_spec='$libname$release$shared_ext$major'
shlibpath_var=LD_LIBRARY_PATH
;;
*)
dynamic_linker=no
;;
esac
AC_MSG_RESULT([$dynamic_linker])
test no = "$dynamic_linker" && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
if test yes = "$GCC"; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
fi
if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
fi
# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
_LT_DECL([], [variables_saved_for_relink], [1],
[Variables whose values should be saved in libtool wrapper scripts and
restored at link time])
_LT_DECL([], [need_lib_prefix], [0],
[Do we need the "lib" prefix for modules?])
_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
_LT_DECL([], [version_type], [0], [Library versioning type])
_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
_LT_DECL([], [shlibpath_overrides_runpath], [0],
[Is shlibpath searched before the hard-coded library search path?])
_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
_LT_DECL([], [library_names_spec], [1],
[[List of archive names. First name is the real one, the rest are links.
The last name is the one that the linker finds with -lNAME]])
_LT_DECL([], [soname_spec], [1],
[[The coded name of the library, if different from the real name]])
_LT_DECL([], [install_override_mode], [1],
[Permission mode override for installation of shared libraries])
_LT_DECL([], [postinstall_cmds], [2],
[Command to use after installation of a shared archive])
_LT_DECL([], [postuninstall_cmds], [2],
[Command to use after uninstallation of a shared archive])
_LT_DECL([], [finish_cmds], [2],
[Commands used to finish a libtool library installation in a directory])
_LT_DECL([], [finish_eval], [1],
[[As "finish_cmds", except a single script fragment to be evaled but
not shown]])
_LT_DECL([], [hardcode_into_libs], [0],
[Whether we should hardcode library paths into libraries])
_LT_DECL([], [sys_lib_search_path_spec], [2],
[Compile-time system search path for libraries])
_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2],
[Detected run-time system search path for libraries])
_LT_DECL([], [configure_time_lt_sys_library_path], [2],
[Explicit LT_SYS_LIBRARY_PATH set during ./configure time])
])# _LT_SYS_DYNAMIC_LINKER
# _LT_PATH_TOOL_PREFIX(TOOL)
# --------------------------
# find a file program that can recognize shared library
AC_DEFUN([_LT_PATH_TOOL_PREFIX],
[m4_require([_LT_DECL_EGREP])dnl
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
[case $MAGIC_CMD in
[[\\/*] | ?:[\\/]*])
lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
;;
*)
lt_save_MAGIC_CMD=$MAGIC_CMD
lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
dnl $ac_dummy forces splitting on constant user-supplied paths.
dnl POSIX.2 word splitting is done only on the output of word expansions,
dnl not every word. This closes a longstanding sh security hole.
ac_dummy="m4_if([$2], , $PATH, [$2])"
for ac_dir in $ac_dummy; do
IFS=$lt_save_ifs
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$1"; then
lt_cv_path_MAGIC_CMD=$ac_dir/"$1"
if test -n "$file_magic_test_file"; then
case $deplibs_check_method in
"file_magic "*)
file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
MAGIC_CMD=$lt_cv_path_MAGIC_CMD
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
$EGREP "$file_magic_regex" > /dev/null; then
:
else
cat <<_LT_EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
*** The result is that libtool may fail to recognize shared libraries
*** as such. This will affect the creation of libtool libraries that
*** depend on shared libraries, but programs linked with such libtool
*** libraries will work regardless of this problem. Nevertheless, you
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
_LT_EOF
fi ;;
esac
fi
break
fi
done
IFS=$lt_save_ifs
MAGIC_CMD=$lt_save_MAGIC_CMD
;;
esac])
MAGIC_CMD=$lt_cv_path_MAGIC_CMD
if test -n "$MAGIC_CMD"; then
AC_MSG_RESULT($MAGIC_CMD)
else
AC_MSG_RESULT(no)
fi
_LT_DECL([], [MAGIC_CMD], [0],
[Used to examine libraries when file_magic_cmd begins with "file"])dnl
])# _LT_PATH_TOOL_PREFIX
# Old name:
AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
# _LT_PATH_MAGIC
# --------------
# find a file program that can recognize a shared library
m4_defun([_LT_PATH_MAGIC],
[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
_LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
else
MAGIC_CMD=:
fi
fi
])# _LT_PATH_MAGIC
# LT_PATH_LD
# ----------
# find the pathname to the GNU or non-GNU linker
AC_DEFUN([LT_PATH_LD],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
AC_ARG_WITH([gnu-ld],
[AS_HELP_STRING([--with-gnu-ld],
[assume the C compiler uses GNU ld @<:@default=no@:>@])],
[test no = "$withval" || with_gnu_ld=yes],
[with_gnu_ld=no])dnl
ac_prog=ld
if test yes = "$GCC"; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by $CC])
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return, which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[[\\/]]* | ?:[[\\/]]*)
re_direlt='/[[^/]][[^/]]*/\.\./'
# Canonicalize the pathname of ld
ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
done
test -z "$LD" && LD=$ac_prog
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test yes = "$with_gnu_ld"; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(lt_cv_path_LD,
[if test -z "$LD"; then
lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
for ac_dir in $PATH; do
IFS=$lt_save_ifs
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
lt_cv_path_LD=$ac_dir/$ac_prog
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some variants of GNU ld only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i
cat conftest.i conftest.i >conftest2.i
: ${lt_DD:=$DD}
AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd],
[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then
cmp -s conftest.i conftest.out \
&& ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
fi])
rm -f conftest.i conftest2.i conftest.out])
])# _LT_PATH_DD
# _LT_CMD_TRUNCATE
# ----------------
# find command to truncate a binary pipe
m4_defun([_LT_CMD_TRUNCATE],
[m4_require([_LT_PATH_DD])
AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin],
[printf 0123456789abcdef0123456789abcdef >conftest.i
cat conftest.i conftest.i >conftest2.i
lt_cv_truncate_bin=
if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then
cmp -s conftest.i conftest.out \
&& lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
fi
rm -f conftest.i conftest2.i conftest.out
test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"])
_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1],
[Command to truncate a binary pipe])
])# _LT_CMD_TRUNCATE
# _LT_CHECK_MAGIC_METHOD
# ----------------------
# how to check for library dependencies
# -- PORTME fill in with the dynamic library characteristics
m4_defun([_LT_CHECK_MAGIC_METHOD],
[m4_require([_LT_DECL_EGREP])
m4_require([_LT_DECL_OBJDUMP])
AC_CACHE_CHECK([how to recognize dependent libraries],
lt_cv_deplibs_check_method,
[lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
lt_cv_deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
# 'none' -- dependencies not supported.
# 'unknown' -- same as none, but documents that we really don't know.
# 'pass_all' -- all dependencies passed with no checks.
# 'test_compile' -- check by making test program.
# 'file_magic [[regex]]' -- check by looking for files in library path
# that responds to the $file_magic_cmd with a given extended regex.
# If you have 'file' or equivalent on your system and you're not sure
# whether 'pass_all' will *always* work, you probably want this one.
case $host_os in
aix[[4-9]]*)
lt_cv_deplibs_check_method=pass_all
;;
beos*)
lt_cv_deplibs_check_method=pass_all
;;
bsdi[[45]]*)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
lt_cv_file_magic_cmd='$FILECMD -L'
lt_cv_file_magic_test_file=/shlib/libc.so
;;
cygwin*)
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
;;
mingw* | pw32*)
# Base MSYS/MinGW do not provide the 'file' command needed by
# func_win32_libid shell function, so use a weaker test based on 'objdump',
# unless we find 'file', for example because we are cross-compiling.
if ( file / ) >/dev/null 2>&1; then
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
# Keep this pattern in sync with the one in func_win32_libid.
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
cegcc*)
# use the weaker test based on 'objdump'. See mingw*.
lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
;;
darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
freebsd* | dragonfly* | midnightbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=$FILECMD
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
esac
else
lt_cv_deplibs_check_method=pass_all
fi
;;
haiku*)
lt_cv_deplibs_check_method=pass_all
;;
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=$FILECMD
case $host_cpu in
ia64*)
lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
;;
hppa*64*)
[lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
;;
*)
lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
lt_cv_file_magic_test_file=/usr/lib/libc.sl
;;
esac
;;
interix[[3-9]]*)
# PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
;;
irix5* | irix6* | nonstopux*)
case $LD in
*-32|*"-32 ") libmagic=32-bit;;
*-n32|*"-n32 ") libmagic=N32;;
*-64|*"-64 ") libmagic=64-bit;;
*) libmagic=never-match;;
esac
lt_cv_deplibs_check_method=pass_all
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
fi
;;
newos6*)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
lt_cv_file_magic_cmd=$FILECMD
lt_cv_file_magic_test_file=/usr/lib/libnls.so
;;
*nto* | *qnx*)
lt_cv_deplibs_check_method=pass_all
;;
openbsd* | bitrig*)
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
fi
;;
osf3* | osf4* | osf5*)
lt_cv_deplibs_check_method=pass_all
;;
rdos*)
lt_cv_deplibs_check_method=pass_all
;;
solaris*)
lt_cv_deplibs_check_method=pass_all
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
sysv4 | sysv4.3*)
case $host_vendor in
motorola)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
;;
ncr)
lt_cv_deplibs_check_method=pass_all
;;
sequent)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
;;
sni)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
lt_cv_file_magic_test_file=/lib/libc.so
;;
siemens)
lt_cv_deplibs_check_method=pass_all
;;
pc)
lt_cv_deplibs_check_method=pass_all
;;
esac
;;
tpf*)
lt_cv_deplibs_check_method=pass_all
;;
os2*)
lt_cv_deplibs_check_method=pass_all
;;
esac
])
file_magic_glob=
want_nocaseglob=no
if test "$build" = "$host"; then
case $host_os in
mingw* | pw32*)
if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
want_nocaseglob=yes
else
file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
fi
;;
esac
fi
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
_LT_DECL([], [deplibs_check_method], [1],
[Method to check whether dependent libraries are shared objects])
_LT_DECL([], [file_magic_cmd], [1],
[Command to use when deplibs_check_method = "file_magic"])
_LT_DECL([], [file_magic_glob], [1],
[How to find potential files when deplibs_check_method = "file_magic"])
_LT_DECL([], [want_nocaseglob], [1],
[Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
])# _LT_CHECK_MAGIC_METHOD
# LT_PATH_NM
# ----------
# find the pathname to a BSD- or MS-compatible name lister
AC_DEFUN([LT_PATH_NM],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
lt_cv_path_NM=$NM
else
lt_nm_to_check=${ac_tool_prefix}nm
if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
lt_nm_to_check="$lt_nm_to_check nm"
fi
for lt_tmp_nm in $lt_nm_to_check; do
lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
IFS=$lt_save_ifs
test -z "$ac_dir" && ac_dir=.
tmp_nm=$ac_dir/$lt_tmp_nm
if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the 'sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
# Tru64's nm complains that /dev/null is an invalid object file
# MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
case $build_os in
mingw*) lt_bad_file=conftest.nm/nofile ;;
*) lt_bad_file=/dev/null ;;
esac
case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in
*$lt_bad_file* | *'Invalid file or object type'*)
lt_cv_path_NM="$tmp_nm -B"
break 2
;;
*)
case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in
*/dev/null*)
lt_cv_path_NM="$tmp_nm -p"
break 2
;;
*)
lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
;;
esac
;;
esac
fi
done
IFS=$lt_save_ifs
done
: ${lt_cv_path_NM=no}
fi])
if test no != "$lt_cv_path_NM"; then
NM=$lt_cv_path_NM
else
# Didn't find any BSD compatible name lister, look for dumpbin.
if test -n "$DUMPBIN"; then :
# Let the user override the test.
else
AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in
*COFF*)
DUMPBIN="$DUMPBIN -symbols -headers"
;;
*)
DUMPBIN=:
;;
esac
fi
AC_SUBST([DUMPBIN])
if test : != "$DUMPBIN"; then
NM=$DUMPBIN
fi
fi
test -z "$NM" && NM=nm
AC_SUBST([NM])
_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
[lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&AS_MESSAGE_LOG_FD
(eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&AS_MESSAGE_LOG_FD
(eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
cat conftest.out >&AS_MESSAGE_LOG_FD
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
fi
rm -f conftest*])
])# LT_PATH_NM
# Old names:
AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_PROG_NM], [])
dnl AC_DEFUN([AC_PROG_NM], [])
# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
# --------------------------------
# how to determine the name of the shared library
# associated with a specific link library.
# -- PORTME fill in with the dynamic library characteristics
m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
[m4_require([_LT_DECL_EGREP])
m4_require([_LT_DECL_OBJDUMP])
m4_require([_LT_DECL_DLLTOOL])
AC_CACHE_CHECK([how to associate runtime and link libraries],
lt_cv_sharedlib_from_linklib_cmd,
[lt_cv_sharedlib_from_linklib_cmd='unknown'
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# two different shell functions defined in ltmain.sh;
# decide which one to use based on capabilities of $DLLTOOL
case `$DLLTOOL --help 2>&1` in
*--identify-strict*)
lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
;;
*)
lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
;;
esac
;;
*)
# fallback: assume linklib IS sharedlib
lt_cv_sharedlib_from_linklib_cmd=$ECHO
;;
esac
])
sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
[Command to associate shared and link libraries])
])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
# _LT_PATH_MANIFEST_TOOL
# ----------------------
# locate the manifest tool
m4_defun([_LT_PATH_MANIFEST_TOOL],
[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
[lt_cv_path_mainfest_tool=no
echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
$MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
cat conftest.err >&AS_MESSAGE_LOG_FD
if $GREP 'Manifest Tool' conftest.out > /dev/null; then
lt_cv_path_mainfest_tool=yes
fi
rm -f conftest*])
if test yes != "$lt_cv_path_mainfest_tool"; then
MANIFEST_TOOL=:
fi
_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
])# _LT_PATH_MANIFEST_TOOL
# _LT_DLL_DEF_P([FILE])
# ---------------------
# True iff FILE is a Windows DLL '.def' file.
# Keep in sync with func_dll_def_p in the libtool script
AC_DEFUN([_LT_DLL_DEF_P],
[dnl
test DEF = "`$SED -n dnl
-e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace
-e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments
-e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl
-e q dnl Only consider the first "real" line
$1`" dnl
])# _LT_DLL_DEF_P
# LT_LIB_M
# --------
# check for math library
AC_DEFUN([LT_LIB_M],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case $host in
*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
# These system don't have libm, or don't need it
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw)
AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, cos, LIBM=-lm)
;;
esac
AC_SUBST([LIBM])
])# LT_LIB_M
# Old name:
AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_CHECK_LIBM], [])
# _LT_COMPILER_NO_RTTI([TAGNAME])
# -------------------------------
m4_defun([_LT_COMPILER_NO_RTTI],
[m4_require([_LT_TAG_COMPILER])dnl
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
if test yes = "$GCC"; then
case $cc_basename in
nvcc*)
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
*)
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
esac
_LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
lt_cv_prog_compiler_rtti_exceptions,
[-fno-rtti -fno-exceptions], [],
[_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
fi
_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
[Compiler flag to turn off builtin functions])
])# _LT_COMPILER_NO_RTTI
# _LT_CMD_GLOBAL_SYMBOLS
# ----------------------
m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([LT_PATH_NM])dnl
AC_REQUIRE([LT_PATH_LD])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_TAG_COMPILER])dnl
# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output from $compiler object])
AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
[
# These are sane defaults that work on at least a few old systems.
# [They come from Ultrix. What could be older than Ultrix?!! ;)]
# Character class describing NM global symbol codes.
symcode='[[BCDEGRST]]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
# Define system-specific variables.
case $host_os in
aix*)
symcode='[[BCDT]]'
;;
cygwin* | mingw* | pw32* | cegcc*)
symcode='[[ABCDGISTW]]'
;;
hpux*)
if test ia64 = "$host_cpu"; then
symcode='[[ABCDEGRST]]'
fi
;;
irix* | nonstopux*)
symcode='[[BCDEGRST]]'
;;
osf*)
symcode='[[BCDEGQRST]]'
;;
solaris*)
symcode='[[BDRT]]'
;;
sco3.2v5*)
symcode='[[DT]]'
;;
sysv4.2uw2*)
symcode='[[DT]]'
;;
sysv5* | sco5v6* | unixware* | OpenUNIX*)
symcode='[[ABDT]]'
;;
sysv4)
symcode='[[DFNSTU]]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
case `$NM -V 2>&1` in
*GNU* | *'with BFD'*)
symcode='[[ABCDGIRSTW]]' ;;
esac
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Gets list of data symbols to import.
lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'"
# Adjust the below global symbol transforms to fixup imported variables.
lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'"
lt_c_name_lib_hook="\
-e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\
-e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'"
else
# Disable hooks by default.
lt_cv_sys_global_symbol_to_import=
lt_cdecl_hook=
lt_c_name_hook=
lt_c_name_lib_hook=
fi
# Transform an extracted symbol line into a proper C declaration.
# Some systems (esp. on ia64) link data and code symbols differently,
# so use this general approach.
lt_cv_sys_global_symbol_to_cdecl="$SED -n"\
$lt_cdecl_hook\
" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
# Transform an extracted symbol line into symbol name and symbol address
lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\
$lt_c_name_hook\
" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'"
# Transform an extracted symbol line into symbol name with lib prefix and
# symbol address.
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\
$lt_c_name_lib_hook\
" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\
" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'"
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
;;
esac
# Try without a prefix underscore, then with it.
for ac_symprfx in "" "_"; do
# Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
symxfrm="\\1 $ac_symprfx\\2 \\2"
# Write the raw and C identifiers.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Fake it for dumpbin and say T for any non-static function,
# D for any global variable and I for any imported variable.
# Also find C++ and __fastcall symbols from MSVC++ or ICC,
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK ['"\
" {last_section=section; section=\$ 3};"\
" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
" \$ 0!~/External *\|/{next};"\
" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
" {if(hide[section]) next};"\
" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx]"
else
lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'"
# Check to see that the pipe works correctly.
pipe_works=no
rm -f conftest*
cat > conftest.$ac_ext <<_LT_EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(void);
void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
nlist=conftest.nm
$ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD
if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
else
rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
cat <<_LT_EOF > conftest.$ac_ext
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs. */
# define LT@&t@_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data. */
# define LT@&t@_DLSYM_CONST
#else
# define LT@&t@_DLSYM_CONST const
#endif
#ifdef __cplusplus
extern "C" {
#endif
_LT_EOF
# Now generate the symbol file.
eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
cat <<_LT_EOF >> conftest.$ac_ext
/* The mapping between symbol names and symbols. */
LT@&t@_DLSYM_CONST struct {
const char *name;
void *address;
}
lt__PROGRAM__LTX_preloaded_symbols[[]] =
{
{ "@PROGRAM@", (void *) 0 },
_LT_EOF
$SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
cat <<\_LT_EOF >> conftest.$ac_ext
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt__PROGRAM__LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif
_LT_EOF
# Now try linking the two files.
mv conftest.$ac_objext conftstm.$ac_objext
lt_globsym_save_LIBS=$LIBS
lt_globsym_save_CFLAGS=$CFLAGS
LIBS=conftstm.$ac_objext
CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
pipe_works=yes
fi
LIBS=$lt_globsym_save_LIBS
CFLAGS=$lt_globsym_save_CFLAGS
else
echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
fi
else
echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
fi
else
echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
fi
else
echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
cat conftest.$ac_ext >&5
fi
rm -rf conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test yes = "$pipe_works"; then
break
else
lt_cv_sys_global_symbol_pipe=
fi
done
])
if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT(ok)
fi
# Response file support.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
nm_file_list_spec='@'
elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
nm_file_list_spec='@'
fi
_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
[Take the output of nm and produce a listing of raw symbols and C names])
_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
[Transform the output of nm in a proper C declaration])
_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1],
[Transform the output of nm into a list of symbols to manually relocate])
_LT_DECL([global_symbol_to_c_name_address],
[lt_cv_sys_global_symbol_to_c_name_address], [1],
[Transform the output of nm in a C name address pair])
_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
[lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
[Transform the output of nm in a C name address pair when lib prefix is needed])
_LT_DECL([nm_interface], [lt_cv_nm_interface], [1],
[The name lister interface])
_LT_DECL([], [nm_file_list_spec], [1],
[Specify filename containing input files for $NM])
]) # _LT_CMD_GLOBAL_SYMBOLS
# _LT_COMPILER_PIC([TAGNAME])
# ---------------------------
m4_defun([_LT_COMPILER_PIC],
[m4_require([_LT_TAG_COMPILER])dnl
_LT_TAGVAR(lt_prog_compiler_wl, $1)=
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)=
m4_if([$1], [CXX], [
# C++ specific cases for pic, static, wl, etc.
if test yes = "$GXX"; then
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test ia64 = "$host_cpu"; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the '-m68020' flag to GCC prevents building anything better,
# like '-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
case $host_os in
os2*)
_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
;;
esac
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
*djgpp*)
# DJGPP does not support shared libraries at all
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
;;
haiku*)
# PIC is the default for Haiku.
# The "-static" flag exists, but is broken.
_LT_TAGVAR(lt_prog_compiler_static, $1)=
;;
interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
hpux*)
# PIC is the default for 64-bit PA HP-UX, but not for 32-bit
# PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
# sets the default TLS model and affects inlining.
case $host_cpu in
hppa*64*)
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
else
case $host_os in
aix[[4-9]]*)
# All AIX code is PIC.
if test ia64 = "$host_cpu"; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
chorus*)
case $cc_basename in
cxch68*)
# Green Hills C++ Compiler
# _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
;;
esac
;;
mingw* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
dgux*)
case $cc_basename in
ec++*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
ghcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
esac
;;
freebsd* | dragonfly* | midnightbsd*)
# FreeBSD uses GNU C++
;;
hpux9* | hpux10* | hpux11*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
if test ia64 != "$host_cpu"; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
fi
;;
aCC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
;;
*)
;;
esac
;;
interix*)
# This is c89, which is MS Visual C++ (no shared libs)
# Anyone wants to do a port?
;;
irix5* | irix6* | nonstopux*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
# CC pic flag -KPIC is the default.
;;
*)
;;
esac
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# KAI C++ Compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
ecpc* )
# old Intel C++ for x86_64, which still supported -KPIC.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
icpc* )
# Intel C++, used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
pgCC* | pgcpp*)
# Portland Group C++ compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
cxx*)
# Compaq C++
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
# IBM XL 8.0, 9.0 on PPC and BlueGene
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | $SED 5q` in
*Sun\ C*)
# Sun C++ 5.9
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
esac
;;
esac
;;
lynxos*)
;;
m88k*)
;;
mvs*)
case $cc_basename in
cxx*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
;;
*)
;;
esac
;;
netbsd* | netbsdelf*-gnu)
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
;;
RCC*)
# Rational C++ 2.4.1
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
cxx*)
# Digital/Compaq C++
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
*)
;;
esac
;;
psos*)
;;
solaris*)
case $cc_basename in
CC* | sunCC*)
# Sun C++ 4.2, 5.x and Centerline C++
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
gcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
;;
*)
;;
esac
;;
sunos4*)
case $cc_basename in
CC*)
# Sun C++ 4.x
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
lcc*)
# Lucid
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
esac
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
esac
;;
tandem*)
case $cc_basename in
NCC*)
# NonStop-UX NCC 3.20
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
*)
;;
esac
;;
vxworks*)
;;
*)
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
],
[
if test yes = "$GCC"; then
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test ia64 = "$host_cpu"; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the '-m68020' flag to GCC prevents building anything better,
# like '-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
case $host_os in
os2*)
_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
;;
esac
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
haiku*)
# PIC is the default for Haiku.
# The "-static" flag exists, but is broken.
_LT_TAGVAR(lt_prog_compiler_static, $1)=
;;
hpux*)
# PIC is the default for 64-bit PA HP-UX, but not for 32-bit
# PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
# sets the default TLS model and affects inlining.
case $host_cpu in
hppa*64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
;;
interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
msdosdjgpp*)
# Just because we use GCC doesn't mean we suddenly get shared libraries
# on systems that don't support them.
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
enable_shared=no
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
case $cc_basename in
nvcc*) # Cuda Compiler Driver 2.2
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
fi
;;
esac
else
# PORTME Check for flag to pass linker flags through the system compiler.
case $host_os in
aix*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
if test ia64 = "$host_cpu"; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
case $cc_basename in
nagfor*)
# NAG Fortran compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
esac
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
case $host_os in
os2*)
_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
;;
esac
;;
hpux9* | hpux10* | hpux11*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
# Is there a better lt_prog_compiler_static that works with the bundled CC?
_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
;;
irix5* | irix6* | nonstopux*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC (with -KPIC) is the default.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
# old Intel for x86_64, which still supported -KPIC.
ecc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# flang / f18. f95 an alias for gfortran or flang on Debian
flang* | f18* | f95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# icc used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
icc* | ifort*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# Lahey Fortran 8.1.
lf95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
;;
nagfor*)
# NAG Fortran compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
tcc*)
# Fabrice Bellard et al's Tiny C Compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
ccc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All Alpha code is PIC.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
xl* | bgxl* | bgf* | mpixl*)
# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | $SED 5q` in
*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
# Sun Fortran 8.3 passes all unrecognized flags to the linker
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)=''
;;
*Sun\ F* | *Sun*Fortran*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
*Sun\ C*)
# Sun C 5.9
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
;;
*Intel*\ [[CF]]*Compiler*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
*Portland\ Group*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
esac
;;
esac
;;
newsos6)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
osf3* | osf4* | osf5*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All OSF/1 code is PIC.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
rdos*)
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
solaris*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
case $cc_basename in
f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
esac
;;
sunos4*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
unicos*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
uts4*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
*)
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
])
case $host_os in
# For platforms that do not support PIC, -DPIC is meaningless:
*djgpp*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
;;
esac
AC_CACHE_CHECK([for $compiler option to produce PIC],
[_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
[_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
#
# Check to make sure the PIC flag actually works.
#
if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
_LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
[_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
[$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
[case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
"" | " "*) ;;
*) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
esac],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
fi
_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
[Additional compiler flags for building library objects])
_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
[How to pass a linker flag through the compiler])
#
# Check to make sure the static flag actually works.
#
wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
_LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
$lt_tmp_static_flag,
[],
[_LT_TAGVAR(lt_prog_compiler_static, $1)=])
_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
# See if the linker supports building shared libraries.
m4_defun([_LT_LINKER_SHLIBS],
[AC_REQUIRE([LT_PATH_LD])dnl
AC_REQUIRE([LT_PATH_NM])dnl
m4_require([_LT_PATH_MANIFEST_TOOL])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
m4_require([_LT_TAG_COMPILER])dnl
AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
m4_if([$1], [CXX], [
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
case $host_os in
aix[[4-9]]*)
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to GNU nm, but means don't demangle to AIX nm.
# Without the "-l" option, or with the "-B" option, AIX nm treats
# weak defined symbols like other global defined symbols, whereas
# GNU nm marks them as "W".
# While the 'weak' keyword is ignored in the Export File, we need
# it in the Import File for the 'aix-soname' feature, so we have
# to replace the "-B" option with "-P" for AIX nm.
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
else
_LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
fi
;;
pw32*)
_LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
;;
cygwin* | mingw* | cegcc*)
case $cc_basename in
cl* | icl*)
_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
;;
esac
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
esac
], [
runpath_var=
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_cmds, $1)=
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(compiler_needs_object, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(old_archive_from_new_cmds, $1)=
_LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
_LT_TAGVAR(thread_safe_flag_spec, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
_LT_TAGVAR(include_expsyms, $1)=
# exclude_expsyms can be an extended regexp of symbols to exclude
# it will be wrapped by ' (' and ')$', so one must not match beginning or
# end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
# as well as any symbol that contains 'd'.
_LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
# Exclude shared library initialization/finalization symbols.
dnl Note also adjust exclude_expsyms for C++ above.
extract_expsyms_cmds=
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++ or Intel C++ Compiler.
if test yes != "$GCC"; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++ or ICC)
with_gnu_ld=yes
;;
openbsd* | bitrig*)
with_gnu_ld=no
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
# On some targets, GNU ld is compatible enough with the native linker
# that we're better off using the native interface for both.
lt_use_gnu_ld_interface=no
if test yes = "$with_gnu_ld"; then
case $host_os in
aix*)
# The AIX port of GNU ld has always aspired to compatibility
# with the native linker. However, as the warning in the GNU ld
# block says, versions before 2.19.5* couldn't really create working
# shared libraries, regardless of the interface used.
case `$LD -v 2>&1` in
*\ \(GNU\ Binutils\)\ 2.19.5*) ;;
*\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
*\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
*)
lt_use_gnu_ld_interface=yes
;;
esac
;;
*)
lt_use_gnu_ld_interface=yes
;;
esac
fi
if test yes = "$lt_use_gnu_ld_interface"; then
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='$wl'
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
runpath_var=LD_RUN_PATH
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
supports_anon_versioning=no
case `$LD -v | $SED -e 's/([[^)]]\+)\s\+//' 2>&1` in
*GNU\ gold*) supports_anon_versioning=yes ;;
*\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
# See if GNU ld supports shared libraries.
case $host_os in
aix[[3-9]]*)
# On AIX/PPC, the GNU linker is very broken
if test ia64 != "$host_cpu"; then
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: the GNU linker, at least up to release 2.19, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support. If you
*** really care for shared libraries, you may want to install binutils
*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
*** You will then need to restart the configuration process.
_LT_EOF
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
;;
beos*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file, use it as
# is; otherwise, prepend EXPORTS...
_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
haiku*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
os2*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
shrext_cmds=.dll
_LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
$ECHO EXPORTS >> $output_objdir/$libname.def~
emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
emximp -o $lib $output_objdir/$libname.def'
_LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
$ECHO EXPORTS >> $output_objdir/$libname.def~
prefix_cmds="$SED"~
if test EXPORTS = "`$SED 1q $export_symbols`"; then
prefix_cmds="$prefix_cmds -e 1d";
fi~
prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
emximp -o $lib $output_objdir/$libname.def'
_LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='@'
;;
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
tmp_diet=no
if test linux-dietlibc = "$host_os"; then
case $cc_basename in
diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
esac
fi
if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
&& test no = "$tmp_diet"
then
tmp_addflag=' $pic_flag'
tmp_sharedflag='-shared'
case $cc_basename,$host_cpu in
pgcc*) # Portland Group C compiler
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
pgf77* | pgf90* | pgf95* | pgfortran*)
# Portland Group f77 and f90 compilers
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
tmp_addflag=' -i_dynamic' ;;
efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
tmp_addflag=' -i_dynamic -nofor_main' ;;
ifc* | ifort*) # Intel Fortran compiler
tmp_addflag=' -nofor_main' ;;
lf95*) # Lahey Fortran 8.1
_LT_TAGVAR(whole_archive_flag_spec, $1)=
tmp_sharedflag='--shared' ;;
nagfor*) # NAGFOR 5.3
tmp_sharedflag='-Wl,-shared' ;;
xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
tmp_sharedflag='-qmkshrobj'
tmp_addflag= ;;
nvcc*) # Cuda Compiler Driver 2.2
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
;;
esac
case `$CC -V 2>&1 | $SED 5q` in
*Sun\ C*) # Sun C 5.9
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
esac
_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
if test yes = "$supports_anon_versioning"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
fi
case $cc_basename in
tcc*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic'
;;
xlf* | bgf* | bgxlf* | mpixlf*)
# IBM XL Fortran 10.1 on PPC cannot create shared libs itself
_LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
if test yes = "$supports_anon_versioning"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
fi
;;
esac
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
solaris*)
if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
*** reliably create shared libraries on SCO systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
;;
*)
# For security reasons, it is highly recommended that you always
# use absolute paths for naming shared libraries, and exclude the
# DT_RUNPATH tag from executables and libraries. But doing so
# requires that you compile everything twice, which is a pain.
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
sunos4*)
_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
wlarc=
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then
runpath_var=
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case $host_os in
aix3*)
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
_LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
_LT_TAGVAR(hardcode_direct, $1)=unsupported
fi
;;
aix[[4-9]]*)
if test ia64 = "$host_cpu"; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
exp_sym_flag='-Bexport'
no_entry_flag=
else
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to GNU nm, but means don't demangle to AIX nm.
# Without the "-l" option, or with the "-B" option, AIX nm treats
# weak defined symbols like other global defined symbols, whereas
# GNU nm marks them as "W".
# While the 'weak' keyword is ignored in the Export File, we need
# it in the Import File for the 'aix-soname' feature, so we have
# to replace the "-B" option with "-P" for AIX nm.
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
else
_LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# have runtime linking enabled, and use it for executables.
# For shared libraries, we enable/disable runtime linking
# depending on the kind of the shared library created -
# when "with_aix_soname,aix_use_runtimelinking" is:
# "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables
# "aix,yes" lib.so shared, rtl:yes, for executables
# lib.a static archive
# "both,no" lib.so.V(shr.o) shared, rtl:yes
# lib.a(lib.so.V) shared, rtl:no, for executables
# "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
# lib.a(lib.so.V) shared, rtl:no
# "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables
# lib.a static archive
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
aix_use_runtimelinking=yes
break
fi
done
if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
# With aix-soname=svr4, we create the lib.so.V shared archives only,
# so we don't have lib.a shared libs to link our executables.
# We have to force runtime linking in this case.
aix_use_runtimelinking=yes
LDFLAGS="$LDFLAGS -Wl,-brtl"
fi
;;
esac
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
_LT_TAGVAR(archive_cmds, $1)=''
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='$wl-f,'
case $with_aix_soname,$aix_use_runtimelinking in
aix,*) ;; # traditional, no import file
svr4,* | *,yes) # use import file
# The Import File defines what to hardcode.
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
;;
esac
if test yes = "$GCC"; then
case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`$CC -print-prog-name=collect2`
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
fi
;;
esac
shared_flag='-shared'
if test yes = "$aix_use_runtimelinking"; then
shared_flag="$shared_flag "'$wl-G'
fi
# Need to ensure runtime linking is disabled for the traditional
# shared library, or the linker may eventually find shared libraries
# /with/ Import File - we do not want to mix them.
shared_flag_aix='-shared'
shared_flag_svr4='-shared $wl-G'
else
# not using gcc
if test ia64 = "$host_cpu"; then
# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test yes = "$aix_use_runtimelinking"; then
shared_flag='$wl-G'
else
shared_flag='$wl-bM:SRE'
fi
shared_flag_aix='$wl-bM:SRE'
shared_flag_svr4='$wl-G'
fi
fi
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to export.
_LT_TAGVAR(always_export_symbols, $1)=yes
if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
# Determine the default libpath from the value encoded in an
# empty executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
else
if test ia64 = "$host_cpu"; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
# Warning - without using the other run time loading flags,
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
if test yes = "$with_gnu_ld"; then
# We only use this code for GNU lds that support --whole-archive.
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
else
# Exported symbols can be pulled into shared objects from archives
_LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
_LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
# -brtl affects multiple linker settings, -berok does not and is overridden later
compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
if test svr4 != "$with_aix_soname"; then
# This is similar to how AIX traditionally builds its shared libraries.
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
fi
if test aix != "$with_aix_soname"; then
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
else
# used by -dlpreopen to get the symbols
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
fi
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
fi
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
;;
bsdi[[45]]*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++ or Intel C++ Compiler.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
case $cc_basename in
cl* | icl*)
# Native MSVC or ICC
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='@'
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
cp "$export_symbols" "$output_objdir/$soname.def";
echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
else
$SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
fi~
$CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
# Don't use ranlib
_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
lt_tool_outputfile="@TOOL_OUTPUT@"~
case $lt_outputfile in
*.exe|*.EXE) ;;
*)
lt_outputfile=$lt_outputfile.exe
lt_tool_outputfile=$lt_tool_outputfile.exe
;;
esac~
if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
$MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
$RM "$lt_outputfile.manifest";
fi'
;;
*)
# Assume MSVC and ICC wrapper
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
# FIXME: Should let the user specify the lib program.
_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
esac
;;
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
;;
dgux*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2.*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly* | midnightbsd*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
hpux9*)
if test yes = "$GCC"; then
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
else
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_direct, $1)=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
;;
hpux10*)
if test yes,no = "$GCC,$with_gnu_ld"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
if test no = "$with_gnu_ld"; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
fi
;;
hpux11*)
if test yes,no = "$GCC,$with_gnu_ld"; then
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
m4_if($1, [], [
# Older versions of the 11.00 compiler do not understand -b yet
# (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
_LT_LINKER_OPTION([if $CC understands -b],
_LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
[_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
[_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
[_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
;;
esac
fi
if test no = "$with_gnu_ld"; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
case $host_cpu in
hppa*64*|ia64*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
if test yes = "$GCC"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
# Try to use the -exported_symbol ld option, if it does not
# work, assume that -exports_file does not work either and
# implicitly export all symbols.
# This should be the same for all languages, so no per-tag cache variable.
AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
[lt_cv_irix_exported_symbol],
[save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
AC_LINK_IFELSE(
[AC_LANG_SOURCE(
[AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
[C++], [[int foo (void) { return 0; }]],
[Fortran 77], [[
subroutine foo
end]],
[Fortran], [[
subroutine foo
end]])])],
[lt_cv_irix_exported_symbol=yes],
[lt_cv_irix_exported_symbol=no])
LDFLAGS=$save_LDFLAGS])
if test yes = "$lt_cv_irix_exported_symbol"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
fi
_LT_TAGVAR(link_all_deplibs, $1)=no
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(inherit_rpath, $1)=yes
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
linux*)
case $cc_basename in
tcc*)
# Fabrice Bellard et al's Tiny C Compiler
_LT_TAGVAR(ld_shlibs, $1)=yes
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
;;
esac
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
newsos6)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*nto* | *qnx*)
;;
openbsd* | bitrig*)
if test -f /usr/libexec/ld.so; then
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
fi
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
os2*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
shrext_cmds=.dll
_LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
$ECHO EXPORTS >> $output_objdir/$libname.def~
emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
emximp -o $lib $output_objdir/$libname.def'
_LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
$ECHO EXPORTS >> $output_objdir/$libname.def~
prefix_cmds="$SED"~
if test EXPORTS = "`$SED 1q $export_symbols`"; then
prefix_cmds="$prefix_cmds -e 1d";
fi~
prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
emximp -o $lib $output_objdir/$libname.def'
_LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='@'
;;
osf3*)
if test yes = "$GCC"; then
_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
else
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test yes = "$GCC"; then
_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
else
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
$CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
# Both c and cxx compiler support -rpath directly
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
;;
solaris*)
_LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
if test yes = "$GCC"; then
wlarc='$wl'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
else
case `$CC -V 2>&1` in
*"Compilers 5.0"*)
wlarc=''
_LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
;;
*)
wlarc='$wl'
_LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
;;
esac
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
# The compiler driver will combine and reorder linker options,
# but understands '-z linker_flag'. GCC discards it without '$wl',
# but is careful enough not to reorder.
# Supported since Solaris 2.6 (maybe 2.5.1?)
if test yes = "$GCC"; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
fi
;;
esac
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
sunos4*)
if test sequent = "$host_vendor"; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4)
case $host_vendor in
sni)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
;;
siemens)
## LD is ld it makes a PLAMLIB
## CC just makes a GrossModule.
_LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
_LT_TAGVAR(hardcode_direct, $1)=no
;;
motorola)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
;;
esac
runpath_var='LD_RUN_PATH'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4.3*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
_LT_TAGVAR(ld_shlibs, $1)=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
_LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var='LD_RUN_PATH'
if test yes = "$GCC"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We CANNOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
# always be unresolved, which means just about no library would
# ever link correctly. If we're not using GNU ld we use -z text
# though, which does catch some bad symbols but isn't as heavy-handed
# as -z defs.
_LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
_LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
runpath_var='LD_RUN_PATH'
if test yes = "$GCC"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
uts4*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
if test sni = "$host_vendor"; then
case $host in
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym'
;;
esac
fi
fi
])
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
_LT_DECL([], [extract_expsyms_cmds], [2],
[The commands to extract the exported symbol list from a shared archive])
#
# Do we need to explicitly link libc?
#
case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
x|xyes)
# Assume -lc should be added
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
if test yes,yes = "$GCC,$enable_shared"; then
case $_LT_TAGVAR(archive_cmds, $1) in
*'~'*)
# FIXME: we may have to deal with multi-command sequences.
;;
'$CC '*)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
AC_CACHE_CHECK([whether -lc should be explicitly linked in],
[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
[$RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
deplibs=
wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
compiler_flags=-v
linker_flags=-v
verstring=
output_objdir=.
libname=conftest
lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
_LT_TAGVAR(allow_undefined_flag, $1)=
if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
then
lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
else
lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
fi
_LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
else
cat conftest.err 1>&5
fi
$RM conftest*
])
_LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
;;
esac
fi
;;
esac
_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
[Whether or not to add -lc for building shared libraries])
_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
[enable_shared_with_static_runtimes], [0],
[Whether or not to disallow shared libs when runtime libs are static])
_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
[Compiler flag to allow reflexive dlopens])
_LT_TAGDECL([], [whole_archive_flag_spec], [1],
[Compiler flag to generate shared objects directly from archives])
_LT_TAGDECL([], [compiler_needs_object], [1],
[Whether the compiler copes with passing no objects directly])
_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
[Create an old-style archive from a shared archive])
_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
[Create a temporary old-style archive to link instead of a shared archive])
_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
_LT_TAGDECL([], [archive_expsym_cmds], [2])
_LT_TAGDECL([], [module_cmds], [2],
[Commands used to build a loadable module if different from building
a shared archive.])
_LT_TAGDECL([], [module_expsym_cmds], [2])
_LT_TAGDECL([], [with_gnu_ld], [1],
[Whether we are building with GNU ld or not])
_LT_TAGDECL([], [allow_undefined_flag], [1],
[Flag that allows shared libraries with undefined symbols to be built])
_LT_TAGDECL([], [no_undefined_flag], [1],
[Flag that enforces no undefined symbols])
_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
[Flag to hardcode $libdir into a binary during linking.
This must work even if $libdir does not exist])
_LT_TAGDECL([], [hardcode_libdir_separator], [1],
[Whether we need a single "-rpath" flag with a separated argument])
_LT_TAGDECL([], [hardcode_direct], [0],
[Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
DIR into the resulting binary])
_LT_TAGDECL([], [hardcode_direct_absolute], [0],
[Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
DIR into the resulting binary and the resulting library dependency is
"absolute", i.e impossible to change by setting $shlibpath_var if the
library is relocated])
_LT_TAGDECL([], [hardcode_minus_L], [0],
[Set to "yes" if using the -LDIR flag during linking hardcodes DIR
into the resulting binary])
_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
[Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
into the resulting binary])
_LT_TAGDECL([], [hardcode_automatic], [0],
[Set to "yes" if building a shared library automatically hardcodes DIR
into the library and all subsequent libraries and executables linked
against it])
_LT_TAGDECL([], [inherit_rpath], [0],
[Set to yes if linker adds runtime paths of dependent libraries
to runtime path list])
_LT_TAGDECL([], [link_all_deplibs], [0],
[Whether libtool must link a program against all its dependency libraries])
_LT_TAGDECL([], [always_export_symbols], [0],
[Set to "yes" if exported symbols are required])
_LT_TAGDECL([], [export_symbols_cmds], [2],
[The commands to list exported symbols])
_LT_TAGDECL([], [exclude_expsyms], [1],
[Symbols that should not be listed in the preloaded symbols])
_LT_TAGDECL([], [include_expsyms], [1],
[Symbols that must always be exported])
_LT_TAGDECL([], [prelink_cmds], [2],
[Commands necessary for linking programs (against libraries) with templates])
_LT_TAGDECL([], [postlink_cmds], [2],
[Commands necessary for finishing linking programs])
_LT_TAGDECL([], [file_list_spec], [1],
[Specify filename containing input files])
dnl FIXME: Not yet implemented
dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
dnl [Compiler flag to generate thread safe objects])
])# _LT_LINKER_SHLIBS
# _LT_LANG_C_CONFIG([TAG])
# ------------------------
# Ensure that the configuration variables for a C compiler are suitably
# defined. These variables are subsequently used by _LT_CONFIG to write
# the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_C_CONFIG],
[m4_require([_LT_DECL_EGREP])dnl
lt_save_CC=$CC
AC_LANG_PUSH(C)
# Source file extension for C test sources.
ac_ext=c
# Object file extension for compiled C test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(){return(0);}'
_LT_TAG_COMPILER
# Save the default compiler, since it gets overwritten when the other
# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
compiler_DEFAULT=$CC
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
LT_SYS_DLOPEN_SELF
_LT_CMD_STRIPLIB
# Report what library types will actually be built
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test no = "$can_build_shared" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test yes = "$enable_shared" && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test ia64 != "$host_cpu"; then
case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
yes,aix,yes) ;; # shared object as lib.so file only
yes,svr4,*) ;; # shared object as lib.so archive member only
yes,*) enable_static=no ;; # shared object in lib.a archive as well
esac
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test yes = "$enable_shared" || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_CONFIG($1)
fi
AC_LANG_POP
CC=$lt_save_CC
])# _LT_LANG_C_CONFIG
# _LT_LANG_CXX_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for a C++ compiler are suitably
# defined. These variables are subsequently used by _LT_CONFIG to write
# the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_CXX_CONFIG],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_PATH_MANIFEST_TOOL])dnl
if test -n "$CXX" && ( test no != "$CXX" &&
( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) ||
(test g++ != "$CXX"))); then
AC_PROG_CXXCPP
else
_lt_caught_CXX_error=yes
fi
AC_LANG_PUSH(C++)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(compiler_needs_object, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for C++ test sources.
ac_ext=cpp
# Object file extension for compiled C++ test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the CXX compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test yes != "$_lt_caught_CXX_error"; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_CFLAGS=$CFLAGS
lt_save_LD=$LD
lt_save_GCC=$GCC
GCC=$GXX
lt_save_with_gnu_ld=$with_gnu_ld
lt_save_path_LD=$lt_cv_path_LD
if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
else
$as_unset lt_cv_prog_gnu_ld
fi
if test -n "${lt_cv_path_LDCXX+set}"; then
lt_cv_path_LD=$lt_cv_path_LDCXX
else
$as_unset lt_cv_path_LD
fi
test -z "${LDCXX+set}" || LD=$LDCXX
CC=${CXX-"c++"}
CFLAGS=$CXXFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
if test -n "$compiler"; then
# We don't want -fno-exception when compiling C++ code, so set the
# no_builtin_flag separately
if test yes = "$GXX"; then
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
else
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
fi
if test yes = "$GXX"; then
# Set up default GNU C++ configuration
LT_PATH_LD
# Check if GNU C++ uses GNU ld as the underlying linker, since the
# archiving commands below assume that GNU ld is being used.
if test yes = "$with_gnu_ld"; then
_LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
# If archive_cmds runs LD, not CC, wlarc should be empty
# XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
# investigate it a little bit more. (MM)
wlarc='$wl'
# ancient GNU ld didn't support --whole-archive et. al.
if eval "`$CC -print-prog-name=ld` --help 2>&1" |
$GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
else
with_gnu_ld=no
wlarc=
# A generic and very simple default shared library creation
# command for GNU C++ for the case where it uses the native
# linker, instead of GNU ld. If possible, this setting should
# overridden to take advantage of the native linker features on
# the platform it is being used on.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
fi
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else
GXX=no
with_gnu_ld=no
wlarc=
fi
# PORTME: fill in a description of your system's C++ link characteristics
AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
_LT_TAGVAR(ld_shlibs, $1)=yes
case $host_os in
aix3*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aix[[4-9]]*)
if test ia64 = "$host_cpu"; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
exp_sym_flag='-Bexport'
no_entry_flag=
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# have runtime linking enabled, and use it for executables.
# For shared libraries, we enable/disable runtime linking
# depending on the kind of the shared library created -
# when "with_aix_soname,aix_use_runtimelinking" is:
# "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables
# "aix,yes" lib.so shared, rtl:yes, for executables
# lib.a static archive
# "both,no" lib.so.V(shr.o) shared, rtl:yes
# lib.a(lib.so.V) shared, rtl:no, for executables
# "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
# lib.a(lib.so.V) shared, rtl:no
# "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables
# lib.a static archive
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
case $ld_flag in
*-brtl*)
aix_use_runtimelinking=yes
break
;;
esac
done
if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
# With aix-soname=svr4, we create the lib.so.V shared archives only,
# so we don't have lib.a shared libs to link our executables.
# We have to force runtime linking in this case.
aix_use_runtimelinking=yes
LDFLAGS="$LDFLAGS -Wl,-brtl"
fi
;;
esac
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
_LT_TAGVAR(archive_cmds, $1)=''
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='$wl-f,'
case $with_aix_soname,$aix_use_runtimelinking in
aix,*) ;; # no import file
svr4,* | *,yes) # use import file
# The Import File defines what to hardcode.
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
;;
esac
if test yes = "$GXX"; then
case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`$CC -print-prog-name=collect2`
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
fi
esac
shared_flag='-shared'
if test yes = "$aix_use_runtimelinking"; then
shared_flag=$shared_flag' $wl-G'
fi
# Need to ensure runtime linking is disabled for the traditional
# shared library, or the linker may eventually find shared libraries
# /with/ Import File - we do not want to mix them.
shared_flag_aix='-shared'
shared_flag_svr4='-shared $wl-G'
else
# not using gcc
if test ia64 = "$host_cpu"; then
# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test yes = "$aix_use_runtimelinking"; then
shared_flag='$wl-G'
else
shared_flag='$wl-bM:SRE'
fi
shared_flag_aix='$wl-bM:SRE'
shared_flag_svr4='$wl-G'
fi
fi
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to
# export.
_LT_TAGVAR(always_export_symbols, $1)=yes
if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
# The "-G" linker flag allows undefined symbols.
_LT_TAGVAR(no_undefined_flag, $1)='-bernotok'
# Determine the default libpath from the value encoded in an empty
# executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
else
if test ia64 = "$host_cpu"; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
_LT_SYS_MODULE_PATH_AIX([$1])
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
# Warning - without using the other run time loading flags,
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
if test yes = "$with_gnu_ld"; then
# We only use this code for GNU lds that support --whole-archive.
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
else
# Exported symbols can be pulled into shared objects from archives
_LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
_LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
# -brtl affects multiple linker settings, -berok does not and is overridden later
compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
if test svr4 != "$with_aix_soname"; then
# This is similar to how AIX traditionally builds its shared
# libraries. Need -bnortl late, we may have -brtl in LDFLAGS.
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
fi
if test aix != "$with_aix_soname"; then
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
else
# used by -dlpreopen to get the symbols
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
fi
_LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
fi
fi
;;
beos*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
chorus*)
case $cc_basename in
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
cygwin* | mingw* | pw32* | cegcc*)
case $GXX,$cc_basename in
,cl* | no,cl* | ,icl* | no,icl*)
# Native MSVC or ICC
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='@'
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
cp "$export_symbols" "$output_objdir/$soname.def";
echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
else
$SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
fi~
$CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
# Don't use ranlib
_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
lt_tool_outputfile="@TOOL_OUTPUT@"~
case $lt_outputfile in
*.exe|*.EXE) ;;
*)
lt_outputfile=$lt_outputfile.exe
lt_tool_outputfile=$lt_tool_outputfile.exe
;;
esac~
func_to_tool_file "$lt_outputfile"~
if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
$MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
$RM "$lt_outputfile.manifest";
fi'
;;
*)
# g++
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file, use it as
# is; otherwise, prepend EXPORTS...
_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
$CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
;;
os2*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
shrext_cmds=.dll
_LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
$ECHO EXPORTS >> $output_objdir/$libname.def~
emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
emximp -o $lib $output_objdir/$libname.def'
_LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
$ECHO EXPORTS >> $output_objdir/$libname.def~
prefix_cmds="$SED"~
if test EXPORTS = "`$SED 1q $export_symbols`"; then
prefix_cmds="$prefix_cmds -e 1d";
fi~
prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
emximp -o $lib $output_objdir/$libname.def'
_LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='@'
;;
dgux*)
case $cc_basename in
ec++*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
ghcx*)
# Green Hills C++ Compiler
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
_LT_TAGVAR(ld_shlibs, $1)=no
;;
freebsd-elf*)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
;;
freebsd* | dragonfly* | midnightbsd*)
# FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
# conventions
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
haiku*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
hpux9*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
# but as the default
# location of the library.
case $cc_basename in
CC*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aCC*)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
hpux10*|hpux11*)
if test no = "$with_gnu_ld"; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
case $host_cpu in
hppa*64*|ia64*)
;;
*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
;;
esac
fi
case $host_cpu in
hppa*64*|ia64*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
# but as the default
# location of the library.
;;
esac
case $cc_basename in
CC*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aCC*)
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
esac
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
if test no = "$with_gnu_ld"; then
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
esac
fi
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
irix5* | irix6*)
case $cc_basename in
CC*)
# SGI C++
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
# Archives containing C++ object files must be created using
# "CC -ar", where "CC" is the IRIX C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
;;
*)
if test yes = "$GXX"; then
if test no = "$with_gnu_ld"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib'
fi
fi
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(inherit_rpath, $1)=yes
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
_LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
# Archives containing C++ object files must be created using
# "CC -Bstatic", where "CC" is the KAI C++ compiler.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
;;
icpc* | ecpc* )
# Intel C++
with_gnu_ld=yes
# version 8.0 and above of icpc choke on multiply defined symbols
# if we add $predep_objects and $postdep_objects, however 7.1 and
# earlier do not add the objects themselves.
case `$CC -V 2>&1` in
*"Version 7."*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
;;
*) # Version 8.0 or newer
tmp_idyn=
case $host_cpu in
ia64*) tmp_idyn=' -i_dynamic';;
esac
_LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
;;
esac
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
;;
pgCC* | pgcpp*)
# Portland Group C++ compiler
case `$CC -V` in
*pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
_LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
_LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
$RANLIB $oldlib'
_LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
;;
*) # Version 6 and above use weak symbols
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
;;
cxx*)
# Compaq C++
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols'
runpath_var=LD_RUN_PATH
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
;;
xl* | mpixl* | bgxl*)
# IBM XL 8.0 on PPC, with GNU ld
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
_LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
if test yes = "$supports_anon_versioning"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
fi
;;
*)
case `$CC -V 2>&1 | $SED 5q` in
*Sun\ C*)
# Sun C++ 5.9
_LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
_LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
# Not sure whether something based on
# $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
# would be better.
output_verbose_link_cmd='func_echo_all'
# Archives containing C++ object files must be created using
# "CC -xar", where "CC" is the Sun C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
;;
esac
;;
esac
;;
lynxos*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
m88k*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
mvs*)
case $cc_basename in
cxx*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
wlarc=
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
fi
# Workaround some broken pre-1.5 toolchains
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
;;
*nto* | *qnx*)
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
openbsd* | bitrig*)
if test -f /usr/libexec/ld.so; then
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
_LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
fi
output_verbose_link_cmd=func_echo_all
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
_LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Archives containing C++ object files must be created using
# the KAI C++ compiler.
case $host in
osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
esac
;;
RCC*)
# Rational C++ 2.4.1
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
cxx*)
case $host in
osf3*)
_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
;;
*)
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
echo "-hidden">> $lib.exp~
$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~
$RM $lib.exp'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
;;
esac
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes,no = "$GXX,$with_gnu_ld"; then
_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
case $host in
osf3*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
psos*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
sunos4*)
case $cc_basename in
CC*)
# Sun C++ 4.x
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
lcc*)
# Lucid
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
solaris*)
case $cc_basename in
CC* | sunCC*)
# Sun C++ 4.2, 5.x and Centerline C++
_LT_TAGVAR(archive_cmds_need_lc,$1)=yes
_LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
_LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
# The compiler driver will combine and reorder linker options,
# but understands '-z linker_flag'.
# Supported since Solaris 2.6 (maybe 2.5.1?)
_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
;;
esac
_LT_TAGVAR(link_all_deplibs, $1)=yes
output_verbose_link_cmd='func_echo_all'
# Archives containing C++ object files must be created using
# "CC -xar", where "CC" is the Sun C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
;;
gcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
# The C++ compiler must be used to create the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
;;
*)
# GNU C++ compiler with Solaris linker
if test yes,no = "$GXX,$with_gnu_ld"; then
_LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs'
if $CC --version | $GREP -v '^2\.7' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else
# g++ 2.7 appears to require '-G' NOT '-shared' on this
# platform.
_LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
_LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
;;
esac
fi
;;
esac
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
_LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var='LD_RUN_PATH'
case $cc_basename in
CC*)
_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We CANNOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
# always be unresolved, which means just about no library would
# ever link correctly. If we're not using GNU ld we use -z text
# though, which does catch some bad symbols but isn't as heavy-handed
# as -z defs.
_LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
_LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
runpath_var='LD_RUN_PATH'
case $cc_basename in
CC*)
_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
'"$_LT_TAGVAR(old_archive_cmds, $1)"
_LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
'"$_LT_TAGVAR(reload_cmds, $1)"
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
tandem*)
case $cc_basename in
NCC*)
# NonStop-UX NCC 3.20
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
vxworks*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
_LT_TAGVAR(GCC, $1)=$GXX
_LT_TAGVAR(LD, $1)=$LD
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_SYS_HIDDEN_LIBDEPS($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
LDCXX=$LD
LD=$lt_save_LD
GCC=$lt_save_GCC
with_gnu_ld=$lt_save_with_gnu_ld
lt_cv_path_LDCXX=$lt_cv_path_LD
lt_cv_path_LD=$lt_save_path_LD
lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
fi # test yes != "$_lt_caught_CXX_error"
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
# _LT_FUNC_STRIPNAME_CNF
# ----------------------
# func_stripname_cnf prefix suffix name
# strip PREFIX and SUFFIX off of NAME.
# PREFIX and SUFFIX must not contain globbing or regex special
# characters, hashes, percent signs, but SUFFIX may contain a leading
# dot (in which case that matches only a dot).
#
# This function is identical to the (non-XSI) version of func_stripname,
# except this one can be used by m4 code that may be executed by configure,
# rather than the libtool script.
m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
AC_REQUIRE([_LT_DECL_SED])
AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
func_stripname_cnf ()
{
case @S|@2 in
.*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;;
*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;;
esac
} # func_stripname_cnf
])# _LT_FUNC_STRIPNAME_CNF
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
# compiler output when linking a shared library.
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
# Dependencies to place before and after the object being linked:
_LT_TAGVAR(predep_objects, $1)=
_LT_TAGVAR(postdep_objects, $1)=
_LT_TAGVAR(predeps, $1)=
_LT_TAGVAR(postdeps, $1)=
_LT_TAGVAR(compiler_lib_search_path, $1)=
dnl we can't use the lt_simple_compile_test_code here,
dnl because it contains code intended for an executable,
dnl not a library. It's possible we should let each
dnl tag define a new lt_????_link_test_code variable,
dnl but it's only used here...
m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
int a;
void foo (void) { a = 0; }
_LT_EOF
], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
class Foo
{
public:
Foo (void) { a = 0; }
private:
int a;
};
_LT_EOF
], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
subroutine foo
implicit none
integer*4 a
a=0
return
end
_LT_EOF
], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
subroutine foo
implicit none
integer a
a=0
return
end
_LT_EOF
], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
public class foo {
private int a;
public void bar (void) {
a = 0;
}
};
_LT_EOF
], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
package foo
func foo() {
}
_LT_EOF
])
_lt_libdeps_save_CFLAGS=$CFLAGS
case "$CC $CFLAGS " in #(
*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
esac
dnl Parse the compiler output and extract the necessary
dnl objects, libraries and library flags.
if AC_TRY_EVAL(ac_compile); then
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
# Sentinel used to keep track of whether or not we are before
# the conftest object file.
pre_test_object_deps_done=no
for p in `eval "$output_verbose_link_cmd"`; do
case $prev$p in
-L* | -R* | -l*)
# Some compilers place space between "-{L,R}" and the path.
# Remove the space.
if test x-L = "$p" ||
test x-R = "$p"; then
prev=$p
continue
fi
# Expand the sysroot to ease extracting the directories later.
if test -z "$prev"; then
case $p in
-L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
esac
fi
case $p in
=*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
esac
if test no = "$pre_test_object_deps_done"; then
case $prev in
-L | -R)
# Internal compiler library paths should come after those
# provided the user. The postdeps already come after the
# user supplied libs so there is no need to process them.
if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
_LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p
else
_LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p"
fi
;;
# The "-l" case would never come before the object being
# linked, so don't bother handling this case.
esac
else
if test -z "$_LT_TAGVAR(postdeps, $1)"; then
_LT_TAGVAR(postdeps, $1)=$prev$p
else
_LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p"
fi
fi
prev=
;;
*.lto.$objext) ;; # Ignore GCC LTO objects
*.$objext)
# This assumes that the test object file only shows up
# once in the compiler output.
if test "$p" = "conftest.$objext"; then
pre_test_object_deps_done=yes
continue
fi
if test no = "$pre_test_object_deps_done"; then
if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
_LT_TAGVAR(predep_objects, $1)=$p
else
_LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
fi
else
if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
_LT_TAGVAR(postdep_objects, $1)=$p
else
_LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
fi
fi
;;
*) ;; # Ignore the rest.
esac
done
# Clean up.
rm -f a.out a.exe
else
echo "libtool.m4: error: problem compiling $1 test program"
fi
$RM -f confest.$objext
CFLAGS=$_lt_libdeps_save_CFLAGS
# PORTME: override above test on systems where it is broken
m4_if([$1], [CXX],
[case $host_os in
interix[[3-9]]*)
# Interix 3.5 installs completely hosed .la files for C++, so rather than
# hack all around it, let's just trust "g++" to DTRT.
_LT_TAGVAR(predep_objects,$1)=
_LT_TAGVAR(postdep_objects,$1)=
_LT_TAGVAR(postdeps,$1)=
;;
esac
])
case " $_LT_TAGVAR(postdeps, $1) " in
*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
esac
_LT_TAGVAR(compiler_lib_search_dirs, $1)=
if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
_LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'`
fi
_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
[The directories searched by this compiler when creating a shared library])
_LT_TAGDECL([], [predep_objects], [1],
[Dependencies to place before and after the objects being linked to
create a shared library])
_LT_TAGDECL([], [postdep_objects], [1])
_LT_TAGDECL([], [predeps], [1])
_LT_TAGDECL([], [postdeps], [1])
_LT_TAGDECL([], [compiler_lib_search_path], [1],
[The library search path used internally by the compiler when linking
a shared library])
])# _LT_SYS_HIDDEN_LIBDEPS
# _LT_LANG_F77_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for a Fortran 77 compiler are
# suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_F77_CONFIG],
[AC_LANG_PUSH(Fortran 77)
if test -z "$F77" || test no = "$F77"; then
_lt_disable_F77=yes
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for f77 test sources.
ac_ext=f
# Object file extension for compiled f77 test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the F77 compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test yes != "$_lt_disable_F77"; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="\
subroutine t
return
end
"
# Code to be used in simple link tests
lt_simple_link_test_code="\
program t
end
"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_GCC=$GCC
lt_save_CFLAGS=$CFLAGS
CC=${F77-"f77"}
CFLAGS=$FFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
GCC=$G77
if test -n "$compiler"; then
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test no = "$can_build_shared" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test yes = "$enable_shared" && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test ia64 != "$host_cpu"; then
case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
yes,aix,yes) ;; # shared object as lib.so file only
yes,svr4,*) ;; # shared object as lib.so archive member only
yes,*) enable_static=no ;; # shared object in lib.a archive as well
esac
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test yes = "$enable_shared" || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_TAGVAR(GCC, $1)=$G77
_LT_TAGVAR(LD, $1)=$LD
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
GCC=$lt_save_GCC
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
fi # test yes != "$_lt_disable_F77"
AC_LANG_POP
])# _LT_LANG_F77_CONFIG
# _LT_LANG_FC_CONFIG([TAG])
# -------------------------
# Ensure that the configuration variables for a Fortran compiler are
# suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_FC_CONFIG],
[AC_LANG_PUSH(Fortran)
if test -z "$FC" || test no = "$FC"; then
_lt_disable_FC=yes
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for fc test sources.
ac_ext=${ac_fc_srcext-f}
# Object file extension for compiled fc test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the FC compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test yes != "$_lt_disable_FC"; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="\
subroutine t
return
end
"
# Code to be used in simple link tests
lt_simple_link_test_code="\
program t
end
"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_GCC=$GCC
lt_save_CFLAGS=$CFLAGS
CC=${FC-"f95"}
CFLAGS=$FCFLAGS
compiler=$CC
GCC=$ac_cv_fc_compiler_gnu
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
if test -n "$compiler"; then
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test no = "$can_build_shared" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test yes = "$enable_shared" && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test ia64 != "$host_cpu"; then
case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
yes,aix,yes) ;; # shared object as lib.so file only
yes,svr4,*) ;; # shared object as lib.so archive member only
yes,*) enable_static=no ;; # shared object in lib.a archive as well
esac
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test yes = "$enable_shared" || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu
_LT_TAGVAR(LD, $1)=$LD
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_SYS_HIDDEN_LIBDEPS($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
GCC=$lt_save_GCC
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
fi # test yes != "$_lt_disable_FC"
AC_LANG_POP
])# _LT_LANG_FC_CONFIG
# _LT_LANG_GCJ_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for the GNU Java Compiler compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_GCJ_CONFIG],
[AC_REQUIRE([LT_PROG_GCJ])dnl
AC_LANG_SAVE
# Source file extension for Java test sources.
ac_ext=java
# Object file extension for compiled Java test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="class foo {}"
# Code to be used in simple link tests
lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_CFLAGS=$CFLAGS
lt_save_GCC=$GCC
GCC=yes
CC=${GCJ-"gcj"}
CFLAGS=$GCJFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_TAGVAR(LD, $1)=$LD
_LT_CC_BASENAME([$compiler])
# GCJ did not exist at the time GCC didn't implicitly link libc in.
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi
AC_LANG_RESTORE
GCC=$lt_save_GCC
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
])# _LT_LANG_GCJ_CONFIG
# _LT_LANG_GO_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for the GNU Go compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_GO_CONFIG],
[AC_REQUIRE([LT_PROG_GO])dnl
AC_LANG_SAVE
# Source file extension for Go test sources.
ac_ext=go
# Object file extension for compiled Go test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="package main; func main() { }"
# Code to be used in simple link tests
lt_simple_link_test_code='package main; func main() { }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_CFLAGS=$CFLAGS
lt_save_GCC=$GCC
GCC=yes
CC=${GOC-"gccgo"}
CFLAGS=$GOFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_TAGVAR(LD, $1)=$LD
_LT_CC_BASENAME([$compiler])
# Go did not exist at the time GCC didn't implicitly link libc in.
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
_LT_TAGVAR(reload_flag, $1)=$reload_flag
_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi
AC_LANG_RESTORE
GCC=$lt_save_GCC
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
])# _LT_LANG_GO_CONFIG
# _LT_LANG_RC_CONFIG([TAG])
# -------------------------
# Ensure that the configuration variables for the Windows resource compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to 'libtool'.
m4_defun([_LT_LANG_RC_CONFIG],
[AC_REQUIRE([LT_PROG_RC])dnl
AC_LANG_SAVE
# Source file extension for RC test sources.
ac_ext=rc
# Object file extension for compiled RC test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
# Code to be used in simple link tests
lt_simple_link_test_code=$lt_simple_compile_test_code
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
lt_save_CFLAGS=$CFLAGS
lt_save_GCC=$GCC
GCC=
CC=${RC-"windres"}
CFLAGS=
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
if test -n "$compiler"; then
:
_LT_CONFIG($1)
fi
GCC=$lt_save_GCC
AC_LANG_RESTORE
CC=$lt_save_CC
CFLAGS=$lt_save_CFLAGS
])# _LT_LANG_RC_CONFIG
# LT_PROG_GCJ
# -----------
AC_DEFUN([LT_PROG_GCJ],
[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
[m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
[AC_CHECK_TOOL(GCJ, gcj,)
test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2"
AC_SUBST(GCJFLAGS)])])[]dnl
])
# Old name:
AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
# LT_PROG_GO
# ----------
AC_DEFUN([LT_PROG_GO],
[AC_CHECK_TOOL(GOC, gccgo,)
])
# LT_PROG_RC
# ----------
AC_DEFUN([LT_PROG_RC],
[AC_CHECK_TOOL(RC, windres,)
])
# Old name:
AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_RC], [])
# _LT_DECL_EGREP
# --------------
# If we don't have a new enough Autoconf to choose the best grep
# available, choose the one first in the user's PATH.
m4_defun([_LT_DECL_EGREP],
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_REQUIRE([AC_PROG_FGREP])dnl
test -z "$GREP" && GREP=grep
_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
_LT_DECL([], [EGREP], [1], [An ERE matcher])
_LT_DECL([], [FGREP], [1], [A literal string matcher])
dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
AC_SUBST([GREP])
])
# _LT_DECL_OBJDUMP
# --------------
# If we don't have a new enough Autoconf to choose the best objdump
# available, choose the one first in the user's PATH.
m4_defun([_LT_DECL_OBJDUMP],
[AC_CHECK_TOOL(OBJDUMP, objdump, false)
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
AC_SUBST([OBJDUMP])
])
# _LT_DECL_DLLTOOL
# ----------------
# Ensure DLLTOOL variable is set.
m4_defun([_LT_DECL_DLLTOOL],
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
AC_SUBST([DLLTOOL])
])
# _LT_DECL_FILECMD
# ----------------
# Check for a file(cmd) program that can be used to detect file type and magic
m4_defun([_LT_DECL_FILECMD],
[AC_CHECK_TOOL([FILECMD], [file], [:])
_LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types])
])# _LD_DECL_FILECMD
# _LT_DECL_SED
# ------------
# Check for a fully-functional sed program, that truncates
# as few characters as possible. Prefer GNU sed if found.
m4_defun([_LT_DECL_SED],
[AC_PROG_SED
test -z "$SED" && SED=sed
Xsed="$SED -e 1s/^X//"
_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
[Sed that helps us avoid accidentally triggering echo(1) options like -n])
])# _LT_DECL_SED
m4_ifndef([AC_PROG_SED], [
############################################################
# NOTE: This macro has been submitted for inclusion into #
# GNU Autoconf as AC_PROG_SED. When it is available in #
# a released version of Autoconf we should remove this #
# macro and use it instead. #
############################################################
m4_defun([AC_PROG_SED],
[AC_MSG_CHECKING([for a sed that does not truncate output])
AC_CACHE_VAL(lt_cv_path_SED,
[# Loop through the user's path and test for sed and gsed.
# Then use that list of sed's as ones to test for truncation.
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for lt_ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
fi
done
done
done
IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
# along with /bin/sed that truncates output.
for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
test ! -f "$lt_ac_sed" && continue
cat /dev/null > conftest.in
lt_ac_count=0
echo $ECHO_N "0123456789$ECHO_C" >conftest.in
# Check for GNU sed and select it if it is found.
if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
lt_cv_path_SED=$lt_ac_sed
break
fi
while true; do
cat conftest.in conftest.in >conftest.tmp
mv conftest.tmp conftest.in
cp conftest.in conftest.nl
echo >>conftest.nl
$lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
cmp -s conftest.out conftest.nl || break
# 10000 chars as input seems more than enough
test 10 -lt "$lt_ac_count" && break
lt_ac_count=`expr $lt_ac_count + 1`
if test "$lt_ac_count" -gt "$lt_ac_max"; then
lt_ac_max=$lt_ac_count
lt_cv_path_SED=$lt_ac_sed
fi
done
done
])
SED=$lt_cv_path_SED
AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])#AC_PROG_SED
])#m4_ifndef
# Old name:
AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_SED], [])
# _LT_CHECK_SHELL_FEATURES
# ------------------------
# Find out whether the shell is Bourne or XSI compatible,
# or has some other useful features.
m4_defun([_LT_CHECK_SHELL_FEATURES],
[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
lt_unset=unset
else
lt_unset=false
fi
_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
# test EBCDIC or ASCII
case `echo X|tr X '\101'` in
A) # ASCII based system
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
lt_SP2NL='tr \040 \012'
lt_NL2SP='tr \015\012 \040\040'
;;
*) # EBCDIC based system
lt_SP2NL='tr \100 \n'
lt_NL2SP='tr \r\n \100\100'
;;
esac
_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
])# _LT_CHECK_SHELL_FEATURES
# _LT_PATH_CONVERSION_FUNCTIONS
# -----------------------------
# Determine what file name conversion functions should be used by
# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
# for certain cross-compile configurations and native mingw.
m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_MSG_CHECKING([how to convert $build file names to $host format])
AC_CACHE_VAL(lt_cv_to_host_file_cmd,
[case $host in
*-*-mingw* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
;;
*-*-cygwin* )
lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
;;
* ) # otherwise, assume *nix
lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
;;
esac
;;
*-*-cygwin* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
;;
*-*-cygwin* )
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
* ) # otherwise, assume *nix
lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
;;
esac
;;
* ) # unhandled hosts (and "normal" native builds)
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
esac
])
to_host_file_cmd=$lt_cv_to_host_file_cmd
AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
[0], [convert $build file names to $host format])dnl
AC_MSG_CHECKING([how to convert $build file names to toolchain format])
AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
[#assume ordinary cross tools, or native build.
lt_cv_to_tool_file_cmd=func_convert_file_noop
case $host in
*-*-mingw* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
;;
esac
;;
esac
])
to_tool_file_cmd=$lt_cv_to_tool_file_cmd
AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
[0], [convert $build files to toolchain format])dnl
])# _LT_PATH_CONVERSION_FUNCTIONS
librelp-1.13.0/m4/ltversion.m4 0000644 0001750 0001750 00000001312 15241057377 011525 # ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation,
# Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 4245 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.7])
m4_define([LT_PACKAGE_REVISION], [2.4.7])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.7'
macro_revision='2.4.7'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
librelp-1.13.0/m4/ltoptions.m4 0000644 0001750 0001750 00000034275 15241057377 011551 # Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free
# Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 8 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option '$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
[_LT_WITH_AIX_SONAME([aix])])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the 'shared' and
# 'disable-shared' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the 'static' and
# 'disable-static' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the 'fast-install'
# and 'disable-fast-install' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_AIX_SONAME([DEFAULT])
# ----------------------------------
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
m4_define([_LT_WITH_AIX_SONAME],
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
shared_archive_member_spec=
case $host,$enable_shared in
power*-*-aix[[5-9]]*,yes)
AC_MSG_CHECKING([which variant of shared library versioning to provide])
AC_ARG_WITH([aix-soname],
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
with_aix_soname=$lt_cv_with_aix_soname])
AC_MSG_RESULT([$with_aix_soname])
if test aix != "$with_aix_soname"; then
# For the AIX way of multilib, we name the shared archive member
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
# the AIX toolchain works better with OBJECT_MODE set (default 32).
if test 64 = "${OBJECT_MODE-32}"; then
shared_archive_member_spec=shr_64
else
shared_archive_member_spec=shr
fi
fi
;;
*)
with_aix_soname=aix
;;
esac
_LT_DECL([], [shared_archive_member_spec], [0],
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
])# _LT_WITH_AIX_SONAME
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[pic_mode=m4_default([$1], [default])])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])
librelp-1.13.0/test-driver 0000755 0001750 0001750 00000011417 15241057402 011110 #! /bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
#
# 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, 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, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to or send patches to
# .
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <"$log_file"
"$@" >>"$log_file" 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
tweaked_estatus=1
else
tweaked_estatus=$estatus
fi
case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>"$log_file"
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
librelp-1.13.0/relp.pc.in 0000644 0001750 0001750 00000000350 13273030644 010601 prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: relp
Description: Reliable Event Logging Protocol (RELP) library
Version: @VERSION@
Libs: -L${libdir} -lrelp @rt_libs@
Cflags: -I${includedir}
librelp-1.13.0/missing 0000755 0001750 0001750 00000015336 15241057402 010315 #! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard , 1996.
# 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, 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, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to ."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=https://www.perl.org/
flex_URL=https://github.com/westes/flex
gnu_software_URL=https://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
librelp-1.13.0/Makefile.am 0000664 0001750 0001750 00000000240 14346313077 010750 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src doc tests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = relp.pc
# Note: version-info is set in ./src/Makefile.am!
librelp-1.13.0/config.guess 0000755 0001750 0001750 00000140512 15241057402 011231 #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2022 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-01-09'
# This file 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 3 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, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
#
# Please send patches to .
# The "shellcheck disable" line above the timestamp inhibits complaints
# about features and limitations of the classic Bourne shell that were
# superseded or lifted in POSIX. However, this script identifies a wide
# variety of pre-POSIX systems that do not have POSIX shells at all, and
# even some reasonably current systems (Solaris 10 as case-in-point) still
# have a pre-POSIX /bin/sh.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
# Just in case it came from the environment.
GUESS=
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
tmp=
# shellcheck disable=SC2172
trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
set_cc_for_build() {
# prevent multiple calls if $tmp is already set
test "$tmp" && return 0
: "${TMPDIR=/tmp}"
# shellcheck disable=SC2039,SC3028
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
dummy=$tmp/dummy
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c"
for driver in cc gcc c89 c99 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=$driver
break
fi
done
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac
}
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case $UNAME_SYSTEM in
Linux|GNU|GNU/*)
LIBC=unknown
set_cc_for_build
cat <<-EOF > "$dummy.c"
#include
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#elif defined(__GLIBC__)
LIBC=gnu
#else
#include
/* First heuristic to detect musl libc. */
#ifdef __DEFINED_va_list
LIBC=musl
#endif
#endif
EOF
cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
eval "$cc_set_libc"
# Second heuristic to detect musl libc.
if [ "$LIBC" = unknown ] &&
command -v ldd >/dev/null &&
ldd --version 2>&1 | grep -q ^musl; then
LIBC=musl
fi
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
if [ "$LIBC" = unknown ]; then
LIBC=gnu
fi
;;
esac
# Note: order is significant - the case branches are not exclusive.
case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
/usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
echo unknown)`
case $UNAME_MACHINE_ARCH in
aarch64eb) machine=aarch64_be-unknown ;;
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=$UNAME_MACHINE_ARCH-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently (or will in the future) and ABI.
case $UNAME_MACHINE_ARCH in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# Determine ABI tags.
case $UNAME_MACHINE_ARCH in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case $UNAME_VERSION in
Debian*)
release='-gnu'
;;
*)
release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
GUESS=$machine-${os}${release}${abi-}
;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
;;
*:SecBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
;;
*:MidnightBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
;;
*:ekkoBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
;;
*:SolidBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
;;
*:OS108:*:*)
GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
;;
macppc:MirBSD:*:*)
GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
;;
*:MirBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
;;
*:Sortix:*:*)
GUESS=$UNAME_MACHINE-unknown-sortix
;;
*:Twizzler:*:*)
GUESS=$UNAME_MACHINE-unknown-twizzler
;;
*:Redox:*:*)
GUESS=$UNAME_MACHINE-unknown-redox
;;
mips:OSF1:*.*)
GUESS=mips-dec-osf1
;;
alpha:OSF1:*:*)
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
trap '' 0
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case $ALPHA_CPU_TYPE in
"EV4 (21064)")
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
UNAME_MACHINE=alpha ;;
"EV5 (21164)")
UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
;;
Amiga*:UNIX_System_V:4.0:*)
GUESS=m68k-unknown-sysv4
;;
*:[Aa]miga[Oo][Ss]:*:*)
GUESS=$UNAME_MACHINE-unknown-amigaos
;;
*:[Mm]orph[Oo][Ss]:*:*)
GUESS=$UNAME_MACHINE-unknown-morphos
;;
*:OS/390:*:*)
GUESS=i370-ibm-openedition
;;
*:z/VM:*:*)
GUESS=s390-ibm-zvmoe
;;
*:OS400:*:*)
GUESS=powerpc-ibm-os400
;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
GUESS=arm-acorn-riscix$UNAME_RELEASE
;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
GUESS=arm-unknown-riscos
;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
GUESS=hppa1.1-hitachi-hiuxmpp
;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
case `(/bin/universe) 2>/dev/null` in
att) GUESS=pyramid-pyramid-sysv3 ;;
*) GUESS=pyramid-pyramid-bsd ;;
esac
;;
NILE*:*:*:dcosx)
GUESS=pyramid-pyramid-svr4
;;
DRS?6000:unix:4.0:6*)
GUESS=sparc-icl-nx6
;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) GUESS=sparc-icl-nx7 ;;
esac
;;
s390x:SunOS:*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
;;
sun4H:SunOS:5.*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=sparc-hal-solaris2$SUN_REL
;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=sparc-sun-solaris2$SUN_REL
;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
GUESS=i386-pc-auroraux$UNAME_RELEASE
;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
set_cc_for_build
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH=x86_64
fi
fi
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=sparc-sun-solaris3$SUN_REL
;;
sun4*:SunOS:*:*)
case `/usr/bin/arch -k` in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
GUESS=sparc-sun-sunos$SUN_REL
;;
sun3*:SunOS:*:*)
GUESS=m68k-sun-sunos$UNAME_RELEASE
;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
case `/bin/arch` in
sun3)
GUESS=m68k-sun-sunos$UNAME_RELEASE
;;
sun4)
GUESS=sparc-sun-sunos$UNAME_RELEASE
;;
esac
;;
aushp:SunOS:*:*)
GUESS=sparc-auspex-sunos$UNAME_RELEASE
;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
GUESS=m68k-atari-mint$UNAME_RELEASE
;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
GUESS=m68k-atari-mint$UNAME_RELEASE
;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
GUESS=m68k-atari-mint$UNAME_RELEASE
;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
GUESS=m68k-milan-mint$UNAME_RELEASE
;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
GUESS=m68k-hades-mint$UNAME_RELEASE
;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
GUESS=m68k-unknown-mint$UNAME_RELEASE
;;
m68k:machten:*:*)
GUESS=m68k-apple-machten$UNAME_RELEASE
;;
powerpc:machten:*:*)
GUESS=powerpc-apple-machten$UNAME_RELEASE
;;
RISC*:Mach:*:*)
GUESS=mips-dec-mach_bsd4.3
;;
RISC*:ULTRIX:*:*)
GUESS=mips-dec-ultrix$UNAME_RELEASE
;;
VAX*:ULTRIX*:*:*)
GUESS=vax-dec-ultrix$UNAME_RELEASE
;;
2020:CLIX:*:* | 2430:CLIX:*:*)
GUESS=clipper-intergraph-clix$UNAME_RELEASE
;;
mips:*:*:UMIPS | mips:*:*:RISCos)
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
{ echo "$SYSTEM_NAME"; exit; }
GUESS=mips-mips-riscos$UNAME_RELEASE
;;
Motorola:PowerMAX_OS:*:*)
GUESS=powerpc-motorola-powermax
;;
Motorola:*:4.3:PL8-*)
GUESS=powerpc-harris-powermax
;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
GUESS=powerpc-harris-powermax
;;
Night_Hawk:Power_UNIX:*:*)
GUESS=powerpc-harris-powerunix
;;
m88k:CX/UX:7*:*)
GUESS=m88k-harris-cxux7
;;
m88k:*:4*:R4*)
GUESS=m88k-motorola-sysv4
;;
m88k:*:3*:R3*)
GUESS=m88k-motorola-sysv3
;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
then
if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
test "$TARGET_BINARY_INTERFACE"x = x
then
GUESS=m88k-dg-dgux$UNAME_RELEASE
else
GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
fi
else
GUESS=i586-dg-dgux$UNAME_RELEASE
fi
;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
GUESS=m88k-dolphin-sysv3
;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
GUESS=m88k-motorola-sysv3
;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
GUESS=m88k-tektronix-sysv3
;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
GUESS=m68k-tektronix-bsd
;;
*:IRIX*:*:*)
IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
GUESS=mips-sgi-irix$IRIX_REL
;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id
;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
GUESS=i386-ibm-aix
;;
ia64:AIX:*:*)
if test -x /usr/bin/oslevel ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
then
GUESS=$SYSTEM_NAME
else
GUESS=rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
GUESS=rs6000-ibm-aix3.2.4
else
GUESS=rs6000-ibm-aix3.2
fi
;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if test -x /usr/bin/lslpp ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
GUESS=$IBM_ARCH-ibm-aix$IBM_REV
;;
*:AIX:*:*)
GUESS=rs6000-ibm-aix
;;
ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
GUESS=romp-ibm-bsd4.4
;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to
;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
GUESS=rs6000-bull-bosx
;;
DPX/2?00:B.O.S.:*:*)
GUESS=m68k-bull-sysv3
;;
9000/[34]??:4.3bsd:1.*:*)
GUESS=m68k-hp-bsd
;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
GUESS=m68k-hp-bsd4.4
;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
case $UNAME_MACHINE in
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if test -x /usr/bin/getconf; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case $sc_cpu_version in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case $sc_kernel_bits in
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
if test "$HP_ARCH" = ""; then
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if test "$HP_ARCH" = hppa2.0w
then
set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH=hppa2.0w
else
HP_ARCH=hppa64
fi
fi
GUESS=$HP_ARCH-hp-hpux$HPUX_REV
;;
ia64:HP-UX:*:*)
HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
GUESS=ia64-hp-hpux$HPUX_REV
;;
3050*:HI-UX:*:*)
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
GUESS=unknown-hitachi-hiuxwe2
;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
GUESS=hppa1.1-hp-bsd
;;
9000/8??:4.3bsd:*:*)
GUESS=hppa1.0-hp-bsd
;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
GUESS=hppa1.0-hp-mpeix
;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
GUESS=hppa1.1-hp-osf
;;
hp8??:OSF1:*:*)
GUESS=hppa1.0-hp-osf
;;
i*86:OSF1:*:*)
if test -x /usr/sbin/sysversion ; then
GUESS=$UNAME_MACHINE-unknown-osf1mk
else
GUESS=$UNAME_MACHINE-unknown-osf1
fi
;;
parisc*:Lites*:*:*)
GUESS=hppa1.1-hp-lites
;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
GUESS=c1-convex-bsd
;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
GUESS=c34-convex-bsd
;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
GUESS=c38-convex-bsd
;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
GUESS=c4-convex-bsd
;;
CRAY*Y-MP:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=ymp-cray-unicos$CRAY_REL
;;
CRAY*[A-Z]90:*:*:*)
echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=t90-cray-unicos$CRAY_REL
;;
CRAY*T3E:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=alphaev5-cray-unicosmk$CRAY_REL
;;
CRAY*SV1:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=sv1-cray-unicos$CRAY_REL
;;
*:UNICOS/mp:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=craynv-cray-unicosmp$CRAY_REL
;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
;;
sparc*:BSD/OS:*:*)
GUESS=sparc-unknown-bsdi$UNAME_RELEASE
;;
*:BSD/OS:*:*)
GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
;;
arm:FreeBSD:*:*)
UNAME_PROCESSOR=`uname -p`
set_cc_for_build
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
else
FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
fi
;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case $UNAME_PROCESSOR in
amd64)
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
;;
i*:CYGWIN*:*)
GUESS=$UNAME_MACHINE-pc-cygwin
;;
*:MINGW64*:*)
GUESS=$UNAME_MACHINE-pc-mingw64
;;
*:MINGW*:*)
GUESS=$UNAME_MACHINE-pc-mingw32
;;
*:MSYS*:*)
GUESS=$UNAME_MACHINE-pc-msys
;;
i*:PW*:*)
GUESS=$UNAME_MACHINE-pc-pw32
;;
*:SerenityOS:*:*)
GUESS=$UNAME_MACHINE-pc-serenity
;;
*:Interix*:*)
case $UNAME_MACHINE in
x86)
GUESS=i586-pc-interix$UNAME_RELEASE
;;
authenticamd | genuineintel | EM64T)
GUESS=x86_64-unknown-interix$UNAME_RELEASE
;;
IA64)
GUESS=ia64-unknown-interix$UNAME_RELEASE
;;
esac ;;
i*:UWIN*:*)
GUESS=$UNAME_MACHINE-pc-uwin
;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
GUESS=x86_64-pc-cygwin
;;
prep*:SunOS:5.*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=powerpcle-unknown-solaris2$SUN_REL
;;
*:GNU:*:*)
# the GNU system
GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
;;
*:Minix:*:*)
GUESS=$UNAME_MACHINE-unknown-minix
;;
aarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
arm*:Linux:*:*)
set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
else
GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
fi
fi
;;
avr32*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
cris:Linux:*:*)
GUESS=$UNAME_MACHINE-axis-linux-$LIBC
;;
crisv32:Linux:*:*)
GUESS=$UNAME_MACHINE-axis-linux-$LIBC
;;
e2k:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
frv:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
hexagon:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
i*86:Linux:*:*)
GUESS=$UNAME_MACHINE-pc-linux-$LIBC
;;
ia64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
k1om:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
m32r*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
m68*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
mips:Linux:*:* | mips64:Linux:*:*)
set_cc_for_build
IS_GLIBC=0
test x"${LIBC}" = xgnu && IS_GLIBC=1
sed 's/^ //' << EOF > "$dummy.c"
#undef CPU
#undef mips
#undef mipsel
#undef mips64
#undef mips64el
#if ${IS_GLIBC} && defined(_ABI64)
LIBCABI=gnuabi64
#else
#if ${IS_GLIBC} && defined(_ABIN32)
LIBCABI=gnuabin32
#else
LIBCABI=${LIBC}
#endif
#endif
#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
CPU=mipsisa64r6
#else
#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
CPU=mipsisa32r6
#else
#if defined(__mips64)
CPU=mips64
#else
CPU=mips
#endif
#endif
#endif
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
MIPS_ENDIAN=el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
MIPS_ENDIAN=
#else
MIPS_ENDIAN=
#endif
#endif
EOF
cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
eval "$cc_set_vars"
test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;;
mips64el:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
openrisc*:Linux:*:*)
GUESS=or1k-unknown-linux-$LIBC
;;
or32:Linux:*:* | or1k*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
padre:Linux:*:*)
GUESS=sparc-unknown-linux-$LIBC
;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
GUESS=hppa64-unknown-linux-$LIBC
;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
*) GUESS=hppa-unknown-linux-$LIBC ;;
esac
;;
ppc64:Linux:*:*)
GUESS=powerpc64-unknown-linux-$LIBC
;;
ppc:Linux:*:*)
GUESS=powerpc-unknown-linux-$LIBC
;;
ppc64le:Linux:*:*)
GUESS=powerpc64le-unknown-linux-$LIBC
;;
ppcle:Linux:*:*)
GUESS=powerpcle-unknown-linux-$LIBC
;;
riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
s390:Linux:*:* | s390x:Linux:*:*)
GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
;;
sh64*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
sh*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
sparc:Linux:*:* | sparc64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
tile*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
vax:Linux:*:*)
GUESS=$UNAME_MACHINE-dec-linux-$LIBC
;;
x86_64:Linux:*:*)
set_cc_for_build
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_X32 >/dev/null
then
LIBCABI=${LIBC}x32
fi
fi
GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
;;
xtensa*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
GUESS=i386-sequent-sysv4
;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
GUESS=$UNAME_MACHINE-pc-os2-emx
;;
i*86:XTS-300:*:STOP)
GUESS=$UNAME_MACHINE-unknown-stop
;;
i*86:atheos:*:*)
GUESS=$UNAME_MACHINE-unknown-atheos
;;
i*86:syllable:*:*)
GUESS=$UNAME_MACHINE-pc-syllable
;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
GUESS=i386-unknown-lynxos$UNAME_RELEASE
;;
i*86:*DOS:*:*)
GUESS=$UNAME_MACHINE-pc-msdosdjgpp
;;
i*86:*:4.*:*)
UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
else
GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
fi
;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
else
GUESS=$UNAME_MACHINE-pc-sysv32
fi
;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
GUESS=i586-pc-msdosdjgpp
;;
Intel:Mach:3*:*)
GUESS=i386-pc-mach3
;;
paragon:*:*:*)
GUESS=i860-intel-osf1
;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4
fi
;;
mini*:CTIX:SYS*5:*)
# "miniframe"
GUESS=m68010-convergent-sysv
;;
mc68k:UNIX:SYSTEM5:3.51m)
GUESS=m68k-convergent-sysv
;;
M680?0:D-NIX:5.3:*)
GUESS=m68k-diab-dnix
;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
GUESS=m68k-unknown-lynxos$UNAME_RELEASE
;;
mc68030:UNIX_System_V:4.*:*)
GUESS=m68k-atari-sysv4
;;
TSUNAMI:LynxOS:2.*:*)
GUESS=sparc-unknown-lynxos$UNAME_RELEASE
;;
rs6000:LynxOS:2.*:*)
GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
;;
SM[BE]S:UNIX_SV:*:*)
GUESS=mips-dde-sysv$UNAME_RELEASE
;;
RM*:ReliantUNIX-*:*:*)
GUESS=mips-sni-sysv4
;;
RM*:SINIX-*:*:*)
GUESS=mips-sni-sysv4
;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
GUESS=$UNAME_MACHINE-sni-sysv4
else
GUESS=ns32k-sni-sysv
fi
;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
GUESS=i586-unisys-sysv4
;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
GUESS=hppa1.1-stratus-sysv4
;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
GUESS=i860-stratus-sysv4
;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
GUESS=$UNAME_MACHINE-stratus-vos
;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
GUESS=hppa1.1-stratus-vos
;;
mc68*:A/UX:*:*)
GUESS=m68k-apple-aux$UNAME_RELEASE
;;
news*:NEWS-OS:6*:*)
GUESS=mips-sony-newsos6
;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if test -d /usr/nec; then
GUESS=mips-nec-sysv$UNAME_RELEASE
else
GUESS=mips-unknown-sysv$UNAME_RELEASE
fi
;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
GUESS=powerpc-be-beos
;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
GUESS=powerpc-apple-beos
;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
GUESS=i586-pc-beos
;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
GUESS=i586-pc-haiku
;;
x86_64:Haiku:*:*)
GUESS=x86_64-unknown-haiku
;;
SX-4:SUPER-UX:*:*)
GUESS=sx4-nec-superux$UNAME_RELEASE
;;
SX-5:SUPER-UX:*:*)
GUESS=sx5-nec-superux$UNAME_RELEASE
;;
SX-6:SUPER-UX:*:*)
GUESS=sx6-nec-superux$UNAME_RELEASE
;;
SX-7:SUPER-UX:*:*)
GUESS=sx7-nec-superux$UNAME_RELEASE
;;
SX-8:SUPER-UX:*:*)
GUESS=sx8-nec-superux$UNAME_RELEASE
;;
SX-8R:SUPER-UX:*:*)
GUESS=sx8r-nec-superux$UNAME_RELEASE
;;
SX-ACE:SUPER-UX:*:*)
GUESS=sxace-nec-superux$UNAME_RELEASE
;;
Power*:Rhapsody:*:*)
GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
;;
*:Rhapsody:*:*)
GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
;;
arm64:Darwin:*:*)
GUESS=aarch64-apple-darwin$UNAME_RELEASE
;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p`
case $UNAME_PROCESSOR in
unknown) UNAME_PROCESSOR=powerpc ;;
esac
if command -v xcode-select > /dev/null 2> /dev/null && \
! xcode-select --print-path > /dev/null 2> /dev/null ; then
# Avoid executing cc if there is no toolchain installed as
# cc will be a stub that puts up a graphical alert
# prompting the user to install developer tools.
CC_FOR_BUILD=no_compiler_found
else
set_cc_for_build
fi
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_PPC >/dev/null
then
UNAME_PROCESSOR=powerpc
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# uname -m returns i386 or x86_64
UNAME_PROCESSOR=$UNAME_MACHINE
fi
GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
;;
*:QNX:*:4*)
GUESS=i386-pc-qnx
;;
NEO-*:NONSTOP_KERNEL:*:*)
GUESS=neo-tandem-nsk$UNAME_RELEASE
;;
NSE-*:NONSTOP_KERNEL:*:*)
GUESS=nse-tandem-nsk$UNAME_RELEASE
;;
NSR-*:NONSTOP_KERNEL:*:*)
GUESS=nsr-tandem-nsk$UNAME_RELEASE
;;
NSV-*:NONSTOP_KERNEL:*:*)
GUESS=nsv-tandem-nsk$UNAME_RELEASE
;;
NSX-*:NONSTOP_KERNEL:*:*)
GUESS=nsx-tandem-nsk$UNAME_RELEASE
;;
*:NonStop-UX:*:*)
GUESS=mips-compaq-nonstopux
;;
BS2000:POSIX*:*:*)
GUESS=bs2000-siemens-sysv
;;
DS/*:UNIX_System_V:*:*)
GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "${cputype-}" = 386; then
UNAME_MACHINE=i386
elif test "x${cputype-}" != x; then
UNAME_MACHINE=$cputype
fi
GUESS=$UNAME_MACHINE-unknown-plan9
;;
*:TOPS-10:*:*)
GUESS=pdp10-unknown-tops10
;;
*:TENEX:*:*)
GUESS=pdp10-unknown-tenex
;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
GUESS=pdp10-dec-tops20
;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
GUESS=pdp10-xkl-tops20
;;
*:TOPS-20:*:*)
GUESS=pdp10-unknown-tops20
;;
*:ITS:*:*)
GUESS=pdp10-unknown-its
;;
SEI:*:*:SEIUX)
GUESS=mips-sei-seiux$UNAME_RELEASE
;;
*:DragonFly:*:*)
DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case $UNAME_MACHINE in
A*) GUESS=alpha-dec-vms ;;
I*) GUESS=ia64-dec-vms ;;
V*) GUESS=vax-dec-vms ;;
esac ;;
*:XENIX:*:SysV)
GUESS=i386-pc-xenix
;;
i*86:skyos:*:*)
SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
;;
i*86:rdos:*:*)
GUESS=$UNAME_MACHINE-pc-rdos
;;
i*86:Fiwix:*:*)
GUESS=$UNAME_MACHINE-pc-fiwix
;;
*:AROS:*:*)
GUESS=$UNAME_MACHINE-unknown-aros
;;
x86_64:VMkernel:*:*)
GUESS=$UNAME_MACHINE-unknown-esx
;;
amd64:Isilon\ OneFS:*:*)
GUESS=x86_64-unknown-onefs
;;
*:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;;
esac
# Do we have a guess based on uname results?
if test "x$GUESS" != x; then
echo "$GUESS"
exit
fi
# No uname command or uname output not recognized.
set_cc_for_build
cat > "$dummy.c" <
#include
#endif
#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
#include
#if defined(_SIZE_T_) || defined(SIGLOST)
#include
#endif
#endif
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
#include
#if defined (BSD)
#if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
#else
#if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
#else
printf ("vax-dec-bsd\n"); exit (0);
#endif
#endif
#else
printf ("vax-dec-bsd\n"); exit (0);
#endif
#else
#if defined(_SIZE_T_) || defined(SIGLOST)
struct utsname un;
uname (&un);
printf ("vax-dec-ultrix%s\n", un.release); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#endif
#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
#if defined(_SIZE_T_) || defined(SIGLOST)
struct utsname *un;
uname (&un);
printf ("mips-dec-ultrix%s\n", un.release); exit (0);
#else
printf ("mips-dec-ultrix\n"); exit (0);
#endif
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
echo "$0: unable to guess system type" >&2
case $UNAME_MACHINE:$UNAME_SYSTEM in
mips:Linux | mips64:Linux)
# If we got here on MIPS GNU/Linux, output extra information.
cat >&2 <&2 <&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`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = "$UNAME_MACHINE"
UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF
fi
exit 1
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
librelp-1.13.0/install-sh 0000755 0001750 0001750 00000035776 15241057402 010734 #!/bin/sh
# install - install a program, script, or datafile
scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
librelp-1.13.0/NEWS 0000644 0001750 0001750 00000000077 13273030644 007413 This file has been superseeded by ChangeLog. Please see there.
librelp-1.13.0/COPYING 0000644 0001750 0001750 00000105163 13273030644 007751 librelp is available under the terms of the GNU GPL v3 or above (full
text below). If this license is too restrictive for your needs, you
may obtain a commercial license from Adiscon. For details, contact
sales@adiscon.com.
-----------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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 3 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, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
librelp-1.13.0/config.h.in 0000664 0001750 0001750 00000007615 15241057402 010744 /* config.h.in. Generated from configure.ac by autoheader. */
/* Defined if debug mode is enabled (it is easier to check in the code). */
#undef DEBUG
/* Defined if TLS support is enabled */
#undef ENABLE_TLS
/* Indicator that openssl is present */
#undef ENABLE_TLS_OPENSSL
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#undef HAVE_DECL_STRERROR_R
/* Define to 1 if you have the header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `epoll_create' function. */
#undef HAVE_EPOLL_CREATE
/* Define to 1 if you have the `epoll_create1' function. */
#undef HAVE_EPOLL_CREATE1
/* do we have gnutls_certificate_set_verify_function */
#undef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
/* Define to 1 if you have the header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if `sa_len' is a member of `struct sockaddr'. */
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_EPOLL_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_SELECT_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Defined if debug mode is disabled. */
#undef NDEBUG
/* Indicator for a AIX OS */
#undef OS_AIX
/* Indicator for APPLE OS */
#undef OS_APPLE
/* Indicator for a BSD OS */
#undef OS_BSD
/* Indicator for a Linux OS */
#undef OS_LINUX
/* Indicator for a Solaris OS */
#undef OS_SOLARIS
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* Define to the type of arg 1 for `select'. */
#undef SELECT_TYPE_ARG1
/* Define to the type of args 2, 3 and 4 for `select'. */
#undef SELECT_TYPE_ARG234
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Define to 1 if strerror_r returns char *. */
#undef STRERROR_R_CHAR_P
/* Version number of package */
#undef VERSION
/* Defined if TLS support is enabled */
#undef WITH_TLS
/* Use POSIX pthread semantics */
#undef _POSIX_PTHREAD_SEMANTICS
/* Use X/Open CAE Specification */
#undef _XOPEN_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `unsigned int' if does not define. */
#undef size_t
librelp-1.13.0/src/ 0000775 0001750 0001750 00000000000 15241057436 007566 5 librelp-1.13.0/src/sendbuf.c 0000644 0001750 0001750 00000014523 13734555715 011313 /* The relp send buffer object.
*
* Copyright 2008-2018 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include "relp.h"
#include "sendbuf.h"
/** Construct a RELP sendbuf instance
* This is the first thing that a caller must do before calling any
* RELP function. The relp sendbuf must only destructed after all RELP
* operations have been finished.
*/
relpRetVal
relpSendbufConstruct(relpSendbuf_t **ppThis, relpSess_t *pSess)
{
relpSendbuf_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpSendbuf_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Sendbuf);
pThis->pSess = pSess;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP sendbuf instance
*/
relpRetVal
relpSendbufDestruct(relpSendbuf_t **ppThis)
{
relpSendbuf_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Sendbuf);
if(pThis->pData != NULL)
free(pThis->pData);
/* done with de-init work, now free sendbuf object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/* Sends as much data from the send buffer as possible.
* This function tries to send as much data from the send buffer
* as possible. For partial writes, the sendbuffer is updated to
* contain the correct "already written" count.
* rgerhards, 2008-03-19
*/
relpRetVal
relpSendbufSend(relpSendbuf_t *pThis, relpTcp_t *pTcp)
{
ssize_t lenToWrite;
ssize_t lenWritten;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sendbuf);
RELPOBJ_assert(pTcp, Tcp);
lenToWrite = pThis->lenData - pThis->bufPtr;
lenWritten = lenToWrite;
//pTcp->pEngine->dbgprint((char*)"sendbuf len %d, still to write %d\n", (int) pThis->lenData, (int) lenToWrite);
CHKRet(relpTcpSend(pTcp, pThis->pData + (9 - pThis->lenTxnr) + pThis->bufPtr, &lenWritten));
if(lenWritten == 0) {
iRet = RELP_RET_EAGAIN;
} else if(lenWritten != lenToWrite) {
pThis->bufPtr += lenWritten;
iRet = RELP_RET_PARTIAL_WRITE;
}
finalize_it:
LEAVE_RELPFUNC;
}
/* This functions sends a complete sendbuf (a blocking call). It
* is intended for use by clients. Do NOT use it on servers as
* that will block other activity. bAddToUnacked specifies if the
* sendbuf should be linked to the unacked list (if 1). If it is 0
* this shall NOT happen. Mode 0 is used for session reestablishment,
* when the unacked list needs to be retransmitted.
* rgerhards, 2008-03-19
* The timeout handler may be one second off. This currently is good
* enough for our needs, but we may revisit this if we make larger
* changes to the lib. -- rgerhards, 2013-04-10
*/
relpRetVal
relpSendbufSendAll(relpSendbuf_t *pThis, relpSess_t *pSess, int bAddToUnacked)
{
ssize_t lenToWrite;
ssize_t lenWritten;
struct timespec tCurr; /* absolute timeout value */
struct timespec tTimeout; /* absolute timeout value */
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sendbuf);
RELPOBJ_assert(pSess, Sess);
clock_gettime(CLOCK_REALTIME, &tTimeout);
tTimeout.tv_sec += pSess->timeout;
lenToWrite = pThis->lenData - pThis->bufPtr;
/* we compute the absolute timeout, as we may need to use it multiple
* times in the loop below. Using the relative value would potentially
* prolong it for quite some time!
*/
while(lenToWrite != 0) {
lenWritten = lenToWrite;
CHKRet(relpTcpSend(pSess->pTcp, pThis->pData + (9 - pThis->lenTxnr) + pThis->bufPtr, &lenWritten));
if(lenWritten == -1) {
ABORT_FINALIZE(RELP_RET_IO_ERR);
} else if(lenWritten == 0) {
pSess->pEngine->dbgprint((char*)"relpSendbufSendAll() wrote 0 octets, waiting...\n");
if(relpTcpWaitWriteable(pSess->pTcp, &tTimeout) == 0) {
ABORT_FINALIZE(RELP_RET_IO_ERR); /* timed out! */
}
} else if(lenWritten == lenToWrite) {
lenToWrite = 0;
} else {
pThis->bufPtr += lenWritten;
lenToWrite = pThis->lenData - pThis->bufPtr;
}
if(lenToWrite != 0) {
clock_gettime(CLOCK_REALTIME, &tCurr);
if( (tCurr.tv_sec > tTimeout.tv_sec)
|| (tCurr.tv_sec == tTimeout.tv_sec && tCurr.tv_nsec >= tTimeout.tv_nsec)) {
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
}
}
/* ok, we now have sent the full buf. So we now need to add it to the unacked list, so that
* we know what to do when the "rsp" packet comes in. -- rgerhards, 2008-03-20
*/
if(bAddToUnacked) {
if((iRet = relpSessAddUnacked(pSess, pThis)) != RELP_RET_OK) {
relpSendbufDestruct(&pThis);
FINALIZE;
}
pSess->pEngine->dbgprint((char*)"sendbuf added to unacked list\n");
#if 0
{
relpSessUnacked_t *pUnackedEtry;
pUnackedEtry = pThis->pUnackedLstRoot;
if(pUnackedEtry != NULL) {
pThis->pEngine->dbgprint((char*)"resending frame '%s'\n",
pUnackedEtry->pSendbuf->pData + 9 - pUnackedEtry->pSendbuf->lenTxnr);
CHKRet(relpFrameRewriteTxnr(pUnackedEtry->pSendbuf, pThis->txnr));
pThis->txnr = relpEngineNextTXNR(pThis->txnr);
CHKRet(relpSendbufSendAll(pUnackedEtry->pSendbuf, pThis, 0));
pUnackedEtry = pUnackedEtry->pNext;
}
}
#endif
}
else pSess->pEngine->dbgprint((char*)"sendbuf NOT added to unacked list\n");
finalize_it:
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/tcp.h 0000664 0001750 0001750 00000022231 15241030422 010427 /* The mapping for relp over TCP.
*
* Copyright 2008-2025 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPTCP_H_INCLUDED
#define RELPTCP_H_INCLUDED
#include
#ifdef ENABLE_TLS
# include
#endif
#ifdef ENABLE_TLS_OPENSSL
# include
#endif
#include "relp.h"
typedef enum { relpTCP_RETRY_none = 0,
relpTCP_RETRY_handshake = 1,
relpTCP_RETRY_recv = 2,
relpTCP_RETRY_send = 3 } relpTcpRtryState_t;
#define RELP_SRV_CONN 0 /**< this conection is a server connection */
#define RELP_CLT_CONN 1 /**< this conection is a client connection */
/* The tcp module uses an extended version of the permittedPeers structure,
* as it finally needs to "compile" patters that contain wildcards. Doing
* that on the fly would not make sense from a performance PoV. Note that
* we do not use this exteded structure in highe layers, as it is not
* needed there and would at least make things lool much more complicated
* than they must be.
*/
/* if we have wildcards inside permitted peers, we need to maintain
* a separate linked list for the wildcard components.
*/
typedef struct tcpPermittedPeerWildcardComp_s {
char *pszDomainPart;
int16_t lenDomainPart;
enum {
tcpPEER_WILDCARD_NONE = 0, /**< no wildcard in this entry */
tcpPEER_WILDCARD_AT_START = 1, /**< wildcard at start of entry (*name) */
tcpPEER_WILDCARD_AT_END = 2, /**< wildcard at end of entry (name*) */
tcpPEER_WILDCARD_MATCH_ALL = 3, /**< only * wildcard, matches all values */
tcpPEER_WILDCARD_EMPTY_COMPONENT = 4/**< special case: domain component empty (e.g. "..") */
} wildcardType;
struct tcpPermittedPeerWildcardComp_s *pNext;
} tcpPermittedPeerWildcardComp_t;
typedef struct {
char *name;
tcpPermittedPeerWildcardComp_t *wildcardRoot;
tcpPermittedPeerWildcardComp_t *wildcardLast;
} tcpPermittedPeerEntry_t;
/* a structure to store permitted peer information (a type of ACL) */
typedef struct tcpPermittedPeers_s {
int nmemb;
tcpPermittedPeerEntry_t *peer;
} tcpPermittedPeers_t;
#ifdef ENABLE_TLS_OPENSSL
typedef enum {
osslRtry_None = 0, /**< no call needs to be retried */
osslRtry_handshake = 1,
osslRtry_recv = 2
} osslRtryCall_t; /**< IDs of calls that needs to be retried */
typedef enum {
osslServer = 0, /**< Server SSL Object */
osslClient = 1 /**< Client SSL Object */
} osslSslState_t;
BIO *relpTcpNewSocketBio_ossl(int sock);
#endif
/* the RELPTCP object
* rgerhards, 2008-03-16
*/
typedef struct relpTcp_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
void *pUsr; /**< user pointer for callbacks */
relpSrv_t *pSrv; /**< a pointer to our server object, if NULL, we belong to a client */
relpClt_t *pClt; /**< ptr to our client; only valid if pSrv == NULL */
unsigned char *pRemHostIP; /**< IP address of remote peer (currently used in server mode, only) */
unsigned char *pRemHostName; /**< host name of remote peer (currently used in server mode, only) */
unsigned char *pRemHostPort; /**< port of remote peer (currently used in server mode, only) */
int sock; /**< the socket we use for regular, single-socket, operations */
int *socks; /**< the socket(s) we use for listeners, element 0 has nbr of socks */
int iSessMax; /**< maximum number of sessions permitted */
/* variables for TLS support */
uint8_t bEnableTLS;
uint8_t bTLSActive; /**< is TLS actually active (properly activated) on this session? */
uint8_t bEnableTLSZip;
int dhBits; /**< number of bits for Diffie-Hellman key */
char *pristring; /**< priority string for GnuTLS */
relpAuthMode_t authmode;
int connTimeout;
tcpPermittedPeers_t permittedPeers;
#ifdef ENABLE_TLS
gnutls_anon_client_credentials_t anoncred; /**< client anon credentials */
gnutls_anon_server_credentials_t anoncredSrv; /**< server anon credentials */
/* GnuTLS certificat support */
gnutls_certificate_credentials_t xcred; /**< certificate credentials */
#endif
char *caCertFile;
char *ownCertFile;
char *privKeyFile;
char *tlsConfigCmd; /**< optional configuration command property for TLS libs **/
#ifdef ENABLE_TLS
gnutls_session_t session;
gnutls_dh_params_t dh_params; /**< server DH parameters for anon mode */
#endif
#ifdef ENABLE_TLS_OPENSSL
SSL *ssl; /* OpenSSL main SSL obj */
osslSslState_t sslState;/**< what must we retry? */
#endif
relpTcpRtryState_t rtryOp;
#ifdef ENABLE_TLS_OPENSSL
int rtryOsslErr; /**< store optional ssl error code into like SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE */
#endif
} relpTcp_t;
/* macros for quick member access */
#define relpTcpGetNumSocks(pThis) ((pThis)->socks[0])
#define relpTcpGetLstnSock(pThis, i) ((pThis)->socks[i])
#define relpTcpGetSock(pThis) ((pThis)->sock)
/* inlines (only for library-internal use!) */
static inline relpTcpRtryState_t
relpTcpRtryOp(relpTcp_t *pThis)
{
return pThis->rtryOp;
}
/* prototypes */
relpRetVal relpTcpConstruct(relpTcp_t **ppThis, relpEngine_t *pEngine, int connType, void *pParent);
relpRetVal relpTcpDestruct(relpTcp_t **ppThis);
relpRetVal relpTcpAbortDestruct(relpTcp_t **ppThis);
relpRetVal relpTcpLstnInit(relpTcp_t *pThis, unsigned char *pLstnPort, unsigned char *pLstnAddr, int ai_family);
relpRetVal relpTcpAcceptConnReq(relpTcp_t **ppThis, int sock, relpSrv_t *pSrv);
relpRetVal relpTcpRcv(relpTcp_t *pThis, relpOctet_t *pRcvBuf, ssize_t *pLenBuf);
relpRetVal relpTcpSend(relpTcp_t *pThis, relpOctet_t *pBuf, ssize_t *pLenBuf);
relpRetVal relpTcpConnect(relpTcp_t *pThis, int family, unsigned char *port,
unsigned char *host, unsigned char *clientIP);
relpRetVal relpTcpEnableTLS(relpTcp_t *pThis);
relpRetVal relpTcpEnableTLSZip(relpTcp_t *pThis);
relpRetVal relpTcpSetDHBits(relpTcp_t *pThis, int bits);
relpRetVal relpTcpSetGnuTLSPriString(relpTcp_t *pThis, char *pristr);
relpRetVal relpTcpSetCACert(relpTcp_t *pThis, char *cert);
relpRetVal relpTcpSetOwnCert(relpTcp_t *pThis, char *cert);
relpRetVal relpTcpSetPrivKey(relpTcp_t *pThis, char *cert);
relpRetVal relpTcpSetTlsConfigCmd(relpTcp_t *pThis, char *cfgcmd);
relpRetVal relpTcpSetPermittedPeers(relpTcp_t *pThis, relpPermittedPeers_t *pPeers);
relpRetVal LIBRELP_ATTR_NONNULL() relpTcpRtryHandshake(relpTcp_t *pThis);
relpRetVal relpTcpSetUsrPtr(relpTcp_t *pThis, void *pUsr);
relpRetVal relpTcpSetConnTimeout(relpTcp_t *pThis, int connTimeout);
relpRetVal relpTcpSetAuthMode(relpTcp_t *pThis, relpAuthMode_t authmode);
void relpTcpHintBurstBegin(relpTcp_t *pThis);
void relpTcpHintBurstEnd(relpTcp_t *pThis);
int LIBRELP_ATTR_NONNULL() relpTcpGetRtryDirection(relpTcp_t *pThis);
int relpTcpWaitWriteable(relpTcp_t *pThis, struct timespec *timeout);
void relpTcpExitTLS(void);
#ifdef ENABLE_TLS_OPENSSL
/*-----------------------------------------------------------------------------*/
#define MUTEX_TYPE pthread_mutex_t
#define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL)
#define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x))
#define MUTEX_LOCK(x) pthread_mutex_lock(&(x))
#define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x))
#define THREAD_ID pthread_self()
/* This array will store all of the mutexes available to OpenSSL. */
struct CRYPTO_dynlock_value
{
MUTEX_TYPE mutex;
};
void dyn_destroy_function(struct CRYPTO_dynlock_value *l,
__attribute__((unused)) const char *file, __attribute__((unused)) int line);
void dyn_lock_function(int mode, struct CRYPTO_dynlock_value *l,
__attribute__((unused)) const char *file, __attribute__((unused)) int line);
struct CRYPTO_dynlock_value * dyn_create_function(
__attribute__((unused)) const char *file, __attribute__((unused)) int line);
unsigned long id_function(void);
void locking_function(int mode, int n,
__attribute__((unused)) const char * file, __attribute__((unused)) int line);
int opensslh_THREAD_setup(void);
int opensslh_THREAD_cleanup(void);
void relpTcpLastSSLErrorMsg(int ret, relpTcp_t *const pThis, const char* pszCallSource);
int verify_callback(int status, X509_STORE_CTX *store);
/*-----------------------------------------------------------------------------*/
#endif
#endif /* #ifndef RELPTCP_H_INCLUDED */
librelp-1.13.0/src/sendq.c 0000644 0001750 0001750 00000016211 13720663520 010760 /* The relp sendqueue object.
*
* Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include "relp.h"
#include "sendq.h"
#include "dbllinklist.h"
/* handling for the sendq entries */
/** Construct a RELP sendq instance
* This is the first thing that a caller must do before calling any
* RELP function. The relp sendq must only destructed after all RELP
* operations have been finished.
*/
static relpRetVal
relpSendqeConstruct(relpSendqe_t **ppThis, relpEngine_t *pEngine)
{
relpSendqe_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpSendqe_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Sendqe);
pThis->pEngine = pEngine;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP sendq instance
*/
static relpRetVal
relpSendqeDestruct(relpSendqe_t **ppThis)
{
relpSendqe_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Sendqe);
relpSendbufDestruct(&pThis->pBuf);
/* done with de-init work, now free sendqe object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/* handling for the sendq itself */
/** Construct a RELP sendq instance
* This is the first thing that a caller must do before calling any
* RELP function. The relp sendq must only destructed after all RELP
* operations have been finished.
*/
relpRetVal
relpSendqConstruct(relpSendq_t **ppThis, relpEngine_t *pEngine)
{
relpSendq_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpSendq_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Sendq);
pThis->pEngine = pEngine;
pthread_mutex_init(&pThis->mut, NULL);
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP sendq instance
*/
relpRetVal
relpSendqDestruct(relpSendq_t **ppThis)
{
relpSendq_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Sendq);
pthread_mutex_destroy(&pThis->mut);
/* done with de-init work, now free sendq object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/* remove the sendbuffer at the top of the queue. The removed buffer is destructed.
* This must only be called if there is at least one send buffer inside the queue.
* rgerhards, 2008-03-17
*/
static relpRetVal
relpSendqDelFirstBuf(relpSendq_t *pThis)
{
relpSendqe_t *pEntry;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sendq);
RELPOBJ_assert(pThis->pRoot, Sendqe);
pthread_mutex_lock(&pThis->mut);
pEntry = pThis->pRoot;
DLL_Del(pEntry, pThis->pRoot, pThis->pLast);
pthread_mutex_unlock(&pThis->mut);
CHKRet(relpSendqeDestruct(&pEntry));
finalize_it:
LEAVE_RELPFUNC;
}
/* add a sendbuffer to the queue
* the send buffer object is handed over, caller must no longer access it after
* it has been passed into here.
* rgerhards, 2008-03-17
*/
relpRetVal
relpSendqAddBuf(relpSendq_t *pThis, relpSendbuf_t *pBuf, relpTcp_t *pTcp)
{
relpSendqe_t *pEntry = NULL;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sendq);
RELPOBJ_assert(pBuf, Sendbuf);
RELPOBJ_assert(pTcp, Tcp);
CHKRet(relpSendqeConstruct(&pEntry, pThis->pEngine));
pEntry->pBuf = pBuf;
pthread_mutex_lock(&pThis->mut);
DLL_Add(pEntry, pThis->pRoot, pThis->pLast);
pthread_mutex_unlock(&pThis->mut);
/* we now try to send it. We always have non-blocking sockets in the server
* so it doesn't hurt if that's not possible. But if it is, we save ourselvs
* one round of select() (and this is assumed to be the regular case!)
*/
iRet = relpSendqSend(pThis, pTcp);
if(iRet == RELP_RET_PARTIAL_WRITE)
iRet = RELP_RET_OK; /* this code is well ok! */
finalize_it:
if(iRet != RELP_RET_OK) {
/* Free memory if pEntry was initialized in relpSendqeConstruct using
* relpSendqDelFirstBuf()
*/
if (pEntry != NULL) {
relpSendqDelFirstBuf(pThis);
}
}
LEAVE_RELPFUNC;
}
/* Returns if the sendq is empty (boolean true) or not (0).
* Note the differet calling conventions - no relpRetVal but the
* boolen value. This is much more convenient, especially as nothing
* can go wrong with this simply object access method.
* Note that we must lock the mutex because an add operation may
* be in progress concurrently (TODO: revisit this once we are done
* with the complete implementation, all these mutex operations may
* not really be necessary).
* rgerhards, 2008-03-19
*/
int
relpSendqIsEmpty(relpSendq_t *pThis)
{
int ret;
/* TODO: an atomic operation would also do nicely... */
pthread_mutex_lock(&pThis->mut);
ret = pThis->pRoot == NULL;
pthread_mutex_unlock(&pThis->mut);
return ret;
}
/* Sends as much data from the top of the sendq as possible.
* This function tries to send as much data from the top of the queue
* as possible, destroying all sendbuf's that have been processed.
* Please note that if a sendbuf is too large to be sent in
* a single operation, a partial buffer may be sent.
* rgerhards, 2008-03-19
*/
relpRetVal
relpSendqSend(relpSendq_t *pThis, relpTcp_t *pTcp)
{
relpSendqe_t *pEntry;
relpRetVal localRet;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sendq);
RELPOBJ_assert(pTcp, Tcp);
pEntry = pThis->pRoot;
relpTcpHintBurstBegin(pTcp);
while(pEntry != NULL) {
RELPOBJ_assert(pEntry, Sendqe);
localRet = relpSendbufSend(pEntry->pBuf, pTcp);
if(localRet == RELP_RET_OK) {
/* in this case, the full buffer has been sent and we can
* destruct the sendbuf.
*/
CHKRet(relpSendqDelFirstBuf(pThis));
pEntry = pThis->pRoot; /* as we deleted from the root, the is our next entry */
} else if(localRet == RELP_RET_EAGAIN) {
/* The underlying socket is no longer accepting writes.
* Try again later (after select/epoll).
*/
break;
} else if(localRet != RELP_RET_PARTIAL_WRITE) {
ABORT_FINALIZE(localRet);
}
}
finalize_it:
relpTcpHintBurstEnd(pTcp);
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/sendq.h 0000644 0001750 0001750 00000004603 13403223446 010764 /* The RELPSENDQ object.
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPSENDQ_H_INCLUDED
#define RELPSENDQ_H_INCLUDED
#include
#include "sendbuf.h"
/* The relp sendq entry object.
* This is a doubly-linked list
* rgerhards, 2008-03-16
*/
typedef struct relpSendqe_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
struct relpSendqe_s *pNext;
struct relpSendqe_s *pPrev;
relpSendbuf_t *pBuf; /* our send buffer */
} relpSendqe_t;
/* the RELPSENDQ object
* This provides more or less just the root of the sendq entries.
* rgerhards, 2008-03-16
*/
typedef struct relpSendq_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
relpSendqe_t *pRoot;
relpSendqe_t *pLast;
pthread_mutex_t mut;
} relpSendq_t;
/* prototypes */
relpRetVal relpSendqConstruct(relpSendq_t **ppThis, relpEngine_t *pEngine);
relpRetVal relpSendqDestruct(relpSendq_t **ppThis);
relpRetVal relpSendqAddBuf(relpSendq_t *pThis, relpSendbuf_t *pBuf, relpTcp_t *pTcp);
relpRetVal relpSendqSend(relpSendq_t *pThis, relpTcp_t *pTcp);
int relpSendqIsEmpty(relpSendq_t *pThis);
#endif /* #ifndef RELPSENDQ_H_INCLUDED */
librelp-1.13.0/src/relpsrv.h 0000644 0001750 0001750 00000005557 13607304075 011364 /* The RELPSRV object.
*
* Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPSRV_H_INCLUDED
#define RELPSRV_H_INCLUDED
#include "relp.h"
#include "tcp.h"
/* the RELPSRV object
* rgerhards, 2008-03-17
*/
struct relpSrv_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
unsigned char *pLstnPort;
unsigned char *pLstnAddr;
int ai_family;
relpTcp_t *pTcp; /**< our tcp support object */
size_t maxDataSize; /**< maximum size of a DATA element */
int oversizeMode;
void *pUsr; /**< user pointer (passed back in to callback) */
int bKeepAlive; /* support keep-alive packets */
int iKeepAliveIntvl;
int iKeepAliveProbes;
int iKeepAliveTime;
int bEnableTLS; /* support for TLS */
int bEnableTLSZip;
int dhBits; /**< number of bits for Diffie-Hellman key */
char *pristring; /**< priority string for GnuTLS */
char *caCertFile;
char *ownCertFile;
char *privKey;
char *tlsConfigCmd; /**< optional configuration command property for TLS libs **/
relpAuthMode_t authmode;
relpPermittedPeers_t permittedPeers;
/* Status of commands as supported in this session. */
relpCmdEnaState_t stateCmdSyslog;
};
/* macros for quick memeber access */
#define relpSrvGetNumLstnSocks(pThis) (relpTcpGetNumSocks((pThis)->pTcp))
#define relpSrvGetLstnSock(pThis, i) (relpTcpGetLstnSock((pThis)->pTcp, i))
/* prototypes */
relpRetVal relpSrvConstruct(relpSrv_t **ppThis, relpEngine_t *pEngine);
relpRetVal relpSrvDestruct(relpSrv_t **ppThis);
relpRetVal relpSrvSetFamily(relpSrv_t *pThis, int ai_family);
relpRetVal relpSrvRun(relpSrv_t *pThis);
#endif /* #ifndef RELPSRV_H_INCLUDED */
librelp-1.13.0/src/Makefile.am 0000664 0001750 0001750 00000001776 14346313077 011556 if OS_SOLARIS
then
PTHREADS_CFLAGS = -pthread
else
if OS_AIX
PTHREADS_CFLAGS = -qthreaded
else
PTHREADS_CFLAGS = -mt
endif
endif
DEBUG = -g
# Uncomment for debugging
#CFLAGS += $(DEBUG)
AM_CFLAGS=-fvisibility=hidden
lib_LTLIBRARIES = librelp.la
EXTRA_DIST = librelp.h
librelp_la_SOURCES = \
librelp.h \
relp.c \
relp.h \
relpsess.c \
relpsess.h \
relpframe.c \
relpframe.h \
tcp.c \
tcp.h \
sendq.c \
sendq.h \
sendbuf.c \
sendbuf.h \
offers.c \
offers.h \
relpclt.c \
relpclt.h \
relpsrv.c \
relpsrv.h \
scsyslog.c \
scrsp.c \
copen.c \
cclose.c \
cserverclose.c \
dbllinklist.h \
cmdif.h \
compat/strndup.c
librelp_la_CPPFLAGS = $(AM_CLFAGS) $(PTHREADS_CFLAGS) $(GNUTLS_CFLAGS) $(OPENSSL_CFLAGS) $(WARN_CFLAGS)
librelp_la_LIBADD = $(rt_libs) $(GNUTLS_LIBS) $(OPENSSL_LIBS)
# info on version-info:
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
librelp_la_LDFLAGS = -version-info 5:1:5 -export-symbols-regex '^relp[^_]*$$'
include_HEADERS = librelp.h
librelp-1.13.0/src/relpclt.c 0000664 0001750 0001750 00000025401 15241057272 011317 /* The relp client.
*
* Copyright 2008-2020 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include "relp.h"
#include "relpsess.h"
#include "relpclt.h"
/** Construct a RELP clt instance
* This is the first thing that a caller must do before calling any
* RELP function. The relp clt must only destructed after all RELP
* operations have been finished.
*/
relpRetVal
relpCltConstruct(relpClt_t **ppThis, relpEngine_t *const pEngine)
{
relpClt_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpClt_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Clt);
pThis->pEngine = pEngine;
pThis->timeout = 90; /* 90-second timeout is the default */
pThis->connTimeout = 10;
pThis->pUsr = NULL;
pThis->authmode = eRelpAuthMode_None;
pThis->pristring = NULL;
pThis->caCertFile = NULL;
pThis->ownCertFile = NULL;
pThis->privKey = NULL;
pThis->tlsConfigCmd = NULL;
pThis->permittedPeers.nmemb = 0;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP clt instance
*/
relpRetVal
relpCltDestruct(relpClt_t **ppThis)
{
int i;
relpClt_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Clt);
if(pThis->pSess != NULL)
relpSessDestruct(&pThis->pSess);
free(pThis->clientIP);
free(pThis->pristring);
free(pThis->caCertFile);
free(pThis->ownCertFile);
free(pThis->privKey);
free(pThis->tlsConfigCmd);
for(i = 0 ; i < pThis->permittedPeers.nmemb ; ++i)
free(pThis->permittedPeers.name[i]);
free(pThis->permittedPeers.name);
pThis->permittedPeers.name = NULL;
pThis->permittedPeers.nmemb = 0;
/* done with de-init work, now free clt object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/** open a relp session to a remote peer
* remote servers parameters must already have been set.
* rgerhards, 2008-03-19
*/
PART_OF_API relpRetVal
relpCltConnect(relpClt_t *const pThis, int protFamily, unsigned char *port, unsigned char *host)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
CHKRet(relpSessConstruct(&pThis->pSess, pThis->pEngine, RELP_CLT_CONN, pThis, pThis->pUsr));
CHKRet(relpSessSetTimeout(pThis->pSess, pThis->timeout));
CHKRet(relpSessSetConnTimeout(pThis->pSess, pThis->connTimeout));
CHKRet(relpSessSetWindowSize(pThis->pSess, pThis->sizeWindow));
CHKRet(relpSessSetClientIP(pThis->pSess, pThis->clientIP));
if(pThis->bEnableTLS) {
CHKRet(relpSessEnableTLS(pThis->pSess));
if(pThis->bEnableTLSZip) {
CHKRet(relpSessEnableTLSZip(pThis->pSess));
}
CHKRet(relpSessSetGnuTLSPriString(pThis->pSess, pThis->pristring));
CHKRet(relpSessSetTlsConfigCmd(pThis->pSess, pThis->tlsConfigCmd));
CHKRet(relpSessSetCACert(pThis->pSess, pThis->caCertFile));
CHKRet(relpSessSetOwnCert(pThis->pSess, pThis->ownCertFile));
CHKRet(relpSessSetPrivKey(pThis->pSess, pThis->privKey));
CHKRet(relpSessSetAuthMode(pThis->pSess, pThis->authmode));
CHKRet(relpSessSetPermittedPeers(pThis->pSess, &pThis->permittedPeers));
}
CHKRet(relpSessConnect(pThis->pSess, protFamily, port, host));
finalize_it:
if(iRet != RELP_RET_OK) {
if(pThis->pSess != NULL) {
relpSessDestruct(&pThis->pSess);
}
}
LEAVE_RELPFUNC;
}
/** Try to reconnect a broken session to the remote
* server. The main difference to relpCltConnect() is that the
* session object is already existing and session parameters (like
* remote host) can not be changed.
* rgerhards, 2008-03-23
*/
PART_OF_API relpRetVal
relpCltReconnect(relpClt_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
RELPOBJ_assert(pThis->pSess, Sess);
CHKRet(relpSessTryReestablish(pThis->pSess));
finalize_it:
LEAVE_RELPFUNC;
}
/** Set the relp window size for this client. Value 0 means
* that the default value is to be used.
*/
PART_OF_API relpRetVal
relpCltSetWindowSize(relpClt_t *const pThis, int sizeWindow)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
if(sizeWindow < 0)
ABORT_FINALIZE(RELP_RET_ERR_INVAL);
if(sizeWindow != 0)
pThis->sizeWindow = sizeWindow;
finalize_it:
LEAVE_RELPFUNC;
}
/** Set the timeout value for this client. */
PART_OF_API relpRetVal
relpCltSetTimeout(relpClt_t *const pThis, unsigned timeout)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
pThis->timeout = timeout;
LEAVE_RELPFUNC;
}
/** Set the timeout value for this client socket connection. */
PART_OF_API relpRetVal
relpCltSetConnTimeout(relpClt_t *const pThis, int connTimeout)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
if (connTimeout < 0) {
ABORT_FINALIZE(RELP_RET_ERR_INVAL);
}
if (connTimeout != 0) {
pThis->connTimeout = connTimeout;
}
finalize_it:
LEAVE_RELPFUNC;
}
/** Set the local IP address to be used when acting as a client.
*/
PART_OF_API relpRetVal
relpCltSetClientIP(relpClt_t *const pThis, unsigned char *ipAddr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
free(pThis->clientIP);
pThis->clientIP = ipAddr == NULL ? NULL :
(unsigned char*)strdup((char*) ipAddr);
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpCltAddPermittedPeer(relpClt_t *const pThis, char *peer)
{
char **newName;
int newMemb;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
newMemb = pThis->permittedPeers.nmemb + 1;
newName = realloc(pThis->permittedPeers.name, sizeof(char*) * newMemb);
if(newName == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pThis->permittedPeers.name = newName;
if((newName[newMemb - 1] = strdup(peer)) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pThis->permittedPeers.nmemb = newMemb;
pThis->pEngine->dbgprint((char*)"librelp: CLT permitted peer added: '%s'\n", peer);
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpCltSetUsrPtr(relpClt_t *const pThis, void *pUsr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
pThis->pUsr = pUsr;
LEAVE_RELPFUNC;
}
/* Note: mode==NULL is valid and means "no change" */
PART_OF_API relpRetVal
relpCltSetAuthMode(relpClt_t *const pThis, char *mode)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
if(mode == NULL)
FINALIZE;
if(!strcasecmp(mode, "fingerprint"))
pThis->authmode = eRelpAuthMode_Fingerprint;
else if(!strcasecmp(mode, "name"))
pThis->authmode = eRelpAuthMode_Name;
else if(!strcasecmp(mode, "certvalid"))
pThis->authmode = eRelpAuthMode_CertValid;
else
ABORT_FINALIZE(RELP_RET_INVLD_AUTH_MD);
finalize_it:
LEAVE_RELPFUNC;
}
/* set the GnuTLS priority string. Providing NULL does re-set
* any previously set string. -- rgerhards, 2013-06-12
*/
PART_OF_API relpRetVal
relpCltSetGnuTLSPriString(relpClt_t *const pThis, char *pristr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
free(pThis->pristring);
if(pristr == NULL) {
pThis->pristring = NULL;
} else {
if((pThis->pristring = strdup(pristr)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpCltSetCACert(relpClt_t *const pThis, char *file)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
free(pThis->caCertFile);
if(file == NULL) {
pThis->caCertFile = NULL;
} else {
if((pThis->caCertFile = strdup(file)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpCltSetOwnCert(relpClt_t *const pThis, char *file)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
free(pThis->ownCertFile);
if(file == NULL) {
pThis->ownCertFile = NULL;
} else {
if((pThis->ownCertFile = strdup(file)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpCltSetPrivKey(relpClt_t *const pThis, char *file)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
free(pThis->privKey);
if(file == NULL) {
pThis->privKey = NULL;
} else {
if((pThis->privKey = strdup(file)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpCltSetTlsConfigCmd(relpClt_t *const pThis, char *cfgcmd)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
free(pThis->tlsConfigCmd);
if(cfgcmd == NULL) {
pThis->tlsConfigCmd = NULL;
} else {
if((pThis->tlsConfigCmd = strdup(cfgcmd)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Enable TLS mode. */
PART_OF_API relpRetVal
relpCltEnableTLS(relpClt_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
pThis->bEnableTLS = 1;
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpCltEnableTLSZip(relpClt_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Clt);
pThis->bEnableTLSZip = 1;
LEAVE_RELPFUNC;
}
/* this function is called to hint librelp that a "burst" of data is to be
* sent. librelp can than try to optimize it's handling.
* The function is intentionally void as it must operate in a way that
* does not interfere with normal operations.
*/
PART_OF_API void
relpCltHintBurstBegin(relpClt_t *const pThis)
{
relpTcpHintBurstBegin(pThis->pSess->pTcp);
}
/* this is the counterpart to relpCltHintBurstBegin -- see there for doc */
PART_OF_API void
relpCltHintBurstEnd(relpClt_t *const pThis)
{
relpTcpHintBurstEnd(pThis->pSess->pTcp);
}
/* Send a syslog message through RELP. The session must be established.
* The provided message buffer is not touched by this function. The caller
* must free it if it is no longer needed.
* rgerhards, 2008-03-20
*/
PART_OF_API relpRetVal
relpCltSendSyslog(relpClt_t *const pThis, unsigned char *const pMsg, const size_t lenMsg)
{
ENTER_RELPFUNC;
if(pThis == NULL || pThis->objID != eRelpObj_Clt)
ABORT_FINALIZE(RELP_RET_INVALID_HDL);
CHKRet(relpSessSendSyslog(pThis->pSess, pMsg, lenMsg));
finalize_it:
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/offers.h 0000644 0001750 0001750 00000005604 13403223446 011140 /* Support functionality for sending and receiving offers.
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPOFFERS_H_INCLUDED
#define RELPOFFERS_H_INCLUDED
#include "relp.h"
/* some max sizes, these are defined in the RELP spec! */
#define RELP_MAX_OFFER_FEATURENAME 32
#define RELP_MAX_OFFER_FEATUREVALUE 255
/* relp offer parameters
* rgerhards, 2008-03-24
*/
typedef struct relpOfferValue_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
struct relpOfferValue_s *pNext;
unsigned char szVal[RELP_MAX_OFFER_FEATUREVALUE+1];
int intVal; /* -1 if no integer is set, else this is an unsigened value! */
} relpOfferValue_t;
/* the RELPOFFER object
* rgerhards, 2008-03-24
*/
struct relpOffer_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
struct relpOffer_s *pNext;
relpOfferValue_t *pValueRoot;
unsigned char szName[RELP_MAX_OFFER_FEATURENAME+1];
};
/* The list of relpoffers.
* rgerhards, 2008-03-24
*/
struct relpOffers_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
relpOffer_t *pRoot;
};
/* prototypes */
relpRetVal relpOffersConstruct(relpOffers_t **ppThis, relpEngine_t *pEngine);
relpRetVal relpOffersDestruct(relpOffers_t **ppThis);
relpRetVal relpOffersConstructFromFrame(relpOffers_t **ppOffers, relpFrame_t *pFrame);
relpRetVal relpOfferValueAdd(unsigned char *pszVal, int intVal, relpOffer_t *pOffer);
relpRetVal relpOfferAdd(relpOffer_t **ppThis, unsigned char *pszName, relpOffers_t *pOffers);
relpRetVal relpOffersToString(relpOffers_t *pThis, unsigned char *pszHdr, size_t lenHdr,
unsigned char **ppszOffers, size_t *plenStr);
#endif /* #ifndef RELPOFFERS_H_INCLUDED */
librelp-1.13.0/src/sendbuf.h 0000644 0001750 0001750 00000005037 13734555715 011320 /* The RELPSENDBUF object.
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPSENDBUF_H_INCLUDED
#define RELPSENDBUF_H_INCLUDED
#include "relpsess.h"
/* the RELPSENDBUF object
* rgerhards, 2008-03-16
*/
struct relpSendbuf_s {
BEGIN_RELP_OBJ;
relpSess_t *pSess; /**< the session this buffer belongs to */
relpOctet_t *pData; /**< the buffer, as it can be put on the wire */
relpTxnr_t txnr; /**< our txnr in native form */
relpRetVal (*rspHdlr)(relpSess_t*, relpFrame_t*); /**< callback when response arrived */
size_t lenData;
size_t lenTxnr; /**< length of txnr - actual send buffer starts at offset (9 - lenTxnr)! */
size_t bufPtr; /**< multi-purpose, tracks sent octets when multi-send
send() calls are required and tracks consumption of response
buffer in a rsp frame. */
};
/* prototypes */
relpRetVal relpSendbufConstruct(relpSendbuf_t **ppThis, relpSess_t *pSess);
relpRetVal relpSendbufDestruct(relpSendbuf_t **ppThis);
relpRetVal relpSendbufSend(relpSendbuf_t *pThis, relpTcp_t *pTcp);
relpRetVal relpSendbufSendAll(relpSendbuf_t *pThis, relpSess_t *pSess, int bAddToUnacked);
relpRetVal relpSendbufSetData(relpSendbuf_t *pThis, relpOctet_t *pData, size_t lenData);
#endif /* #ifndef RELPSENDBUF_H_INCLUDED */
librelp-1.13.0/src/relpsrv.c 0000664 0001750 0001750 00000026504 15241057272 011354 /* The relp server.
*
* Copyright 2008-2018 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include "relp.h"
#include "relpsrv.h"
#include "tcp.h"
/** Construct a RELP srv instance
* This is the first thing that a caller must do before calling any
* RELP function. The relp srv must only destructed after all RELP
* operations have been finished.
*/
relpRetVal
relpSrvConstruct(relpSrv_t **ppThis, relpEngine_t *pEngine)
{
relpSrv_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpSrv_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Srv);
pThis->pEngine = pEngine;
pThis->stateCmdSyslog = pEngine->stateCmdSyslog;
pThis->ai_family = PF_UNSPEC;
pThis->dhBits = DEFAULT_DH_BITS;
pThis->pristring = NULL;
pThis->authmode = eRelpAuthMode_None;
pThis->caCertFile = NULL;
pThis->ownCertFile = NULL;
pThis->privKey = NULL;
pThis->tlsConfigCmd = NULL;
pThis->permittedPeers.nmemb = 0;
pThis->maxDataSize = RELP_DFLT_MAX_DATA_SIZE;
pThis->oversizeMode = RELP_DFLT_OVERSIZE_MODE;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP srv instance
*/
relpRetVal
relpSrvDestruct(relpSrv_t **ppThis)
{
relpSrv_t *pThis;
int i;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Srv);
if(pThis->pTcp != NULL)
relpTcpDestruct(&pThis->pTcp);
free(pThis->pLstnPort);
free(pThis->pLstnAddr);
free(pThis->pristring);
free(pThis->caCertFile);
free(pThis->ownCertFile);
free(pThis->privKey);
free(pThis->tlsConfigCmd);
for(i = 0 ; i < pThis->permittedPeers.nmemb ; ++i)
free(pThis->permittedPeers.name[i]);
free(pThis->permittedPeers.name);
pThis->permittedPeers.name = NULL;
pThis->permittedPeers.nmemb = 0;
/* done with de-init work, now free srv object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/** add a permitted peer to the current server object. As soon as the
* first permitted peer is set, anonymous access is no longer permitted.
* Note that currently once-set peers can never be removed. This is
* considered to be of no importance. We assume all peers are know
* at time of server construction. For the same reason, we do not guard
* the update operation. It is forbidden to add peers after the server
* has been started. In that case, races can happen.
* rgerhards, 2013-06-18
*/
PART_OF_API relpRetVal
relpSrvAddPermittedPeer(relpSrv_t *const pThis, char *peer)
{
char **newName;
int newMemb;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
newMemb = pThis->permittedPeers.nmemb + 1;
newName = realloc(pThis->permittedPeers.name, sizeof(char*) * newMemb);
if(newName == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pThis->permittedPeers.name = newName;
if((newName[newMemb - 1] = strdup(peer)) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pThis->permittedPeers.nmemb = newMemb;
pThis->pEngine->dbgprint((char*)"librelp: SRV permitted peer added: '%s'\n", peer);
finalize_it:
LEAVE_RELPFUNC;
}
/* set the user pointer. Whatever value the user provides is accepted.
* rgerhards, 2008-07-08
*/
PART_OF_API relpRetVal
relpSrvSetUsrPtr(relpSrv_t *const pThis, void *pUsr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
pThis->pUsr = pUsr;
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpSrvSetMaxDataSize(relpSrv_t *const pThis, size_t maxSize)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
pThis->maxDataSize = maxSize;
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal LIBRELP_ATTR_NONNULL()
relpSrvSetOversizeMode(relpSrv_t *const pThis, const int oversizeMode)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
if( oversizeMode != RELP_OVERSIZE_ABORT
&& oversizeMode != RELP_OVERSIZE_TRUNCATE
&& oversizeMode != RELP_OVERSIZE_ACCEPT) {
ABORT_FINALIZE(RELP_RET_PARAM_ERROR);
}
pThis->oversizeMode = oversizeMode;
finalize_it:
LEAVE_RELPFUNC;
}
/* set the listen port inside the relp server. If NULL is provided, the default port
* is used. The provided string is always copied, it is the caller's duty to
* free the passed-in string.
* rgerhards, 2008-03-17
*/
PART_OF_API relpRetVal
relpSrvSetLstnPort(relpSrv_t *const pThis, unsigned char *pLstnPort)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
/* first free old value */
free(pThis->pLstnPort);
pThis->pLstnPort = NULL;
if(pLstnPort != NULL) {
if((pThis->pLstnPort = (unsigned char*) strdup((char*)pLstnPort)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* set the address inside the relp server. If NULL is provided, the server
* will bind to all interfaces. The provided string is always copied, it is the caller's duty to
* free the passed-in string.
* perlei, 2018-04-19
*/
PART_OF_API relpRetVal
relpSrvSetLstnAddr(relpSrv_t *const pThis, unsigned char *pLstnAddr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
/* first free old value */
free(pThis->pLstnAddr);
pThis->pLstnAddr = NULL;
if(pLstnAddr != NULL) {
if((pThis->pLstnAddr = (unsigned char*) strdup((char*)pLstnAddr)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* mode==NULL is valid and means "no change" */
PART_OF_API relpRetVal
relpSrvSetAuthMode(relpSrv_t *const pThis, char *mode)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
if(mode == NULL)
FINALIZE;
if(!strcasecmp(mode, "fingerprint"))
pThis->authmode = eRelpAuthMode_Fingerprint;
else if(!strcasecmp(mode, "name"))
pThis->authmode = eRelpAuthMode_Name;
else if(!strcasecmp(mode, "certvalid"))
pThis->authmode = eRelpAuthMode_CertValid;
else
ABORT_FINALIZE(RELP_RET_INVLD_AUTH_MD);
finalize_it:
LEAVE_RELPFUNC;
}
/* set the IPv4/v6 type to be used. Default is both (PF_UNSPEC)
* rgerhards, 2013-03-15
*/
relpRetVal
relpSrvSetFamily(relpSrv_t *const pThis, int ai_family)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
pThis->ai_family = ai_family;
LEAVE_RELPFUNC;
}
/* set the GnuTLS priority string. Providing NULL does re-set
* any previously set string. -- rgerhards, 2013-06-12
*/
PART_OF_API relpRetVal
relpSrvSetGnuTLSPriString(relpSrv_t *const pThis, char *pristr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
free(pThis->pristring);
if(pristr == NULL) {
pThis->pristring = NULL;
} else {
if((pThis->pristring = strdup(pristr)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpSrvSetCACert(relpSrv_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
free(pThis->caCertFile);
if(cert == NULL) {
pThis->caCertFile = NULL;
} else {
if((pThis->caCertFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpSrvSetOwnCert(relpSrv_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
free(pThis->ownCertFile);
if(cert == NULL) {
pThis->ownCertFile = NULL;
} else {
if((pThis->ownCertFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpSrvSetPrivKey(relpSrv_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
free(pThis->privKey);
if(cert == NULL) {
pThis->privKey = NULL;
} else {
if((pThis->privKey = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpSrvSetTlsConfigCmd(relpSrv_t *const pThis, char *cfgcmd)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
free(pThis->tlsConfigCmd);
if(cfgcmd == NULL) {
pThis->tlsConfigCmd = NULL;
} else {
if((pThis->tlsConfigCmd = strdup(cfgcmd)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API void
relpSrvSetDHBits(relpSrv_t *const pThis, int bits)
{
pThis->dhBits = bits;
}
PART_OF_API relpRetVal
relpSrvEnableTLS2(relpSrv_t LIBRELP_ATTR_UNUSED *pThis)
{
ENTER_RELPFUNC;
#if defined(ENABLE_TLS) || defined(ENABLE_TLS_OPENSSL)
pThis->bEnableTLS = 1;
#else
iRet = RELP_RET_ERR_NO_TLS;
#endif /* #ifdef ENABLE_TLS | ENABLE_TLS_OPENSSL */
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpSrvEnableTLSZip2(relpSrv_t LIBRELP_ATTR_UNUSED *pThis)
{
ENTER_RELPFUNC;
#if defined(ENABLE_TLS) || defined(ENABLE_TLS_OPENSSL)
pThis->bEnableTLSZip = 1;
#else
iRet = RELP_RET_ERR_NO_TLS;
#endif /* #ifdef ENABLE_TLS | ENABLE_TLS_OPENSSL */
LEAVE_RELPFUNC;
}
PART_OF_API void
relpSrvEnableTLS(relpSrv_t *const pThis)
{
relpSrvEnableTLS2(pThis);
}
PART_OF_API void
relpSrvEnableTLSZip(relpSrv_t *const pThis)
{
relpSrvEnableTLSZip2(pThis);
}
PART_OF_API void
relpSrvSetKeepAlive(relpSrv_t *const pThis,
const int bEnabled,
const int iKeepAliveIntvl,
const int iKeepAliveProbes,
const int iKeepAliveTime)
{
pThis->bKeepAlive = bEnabled;
pThis->iKeepAliveIntvl = iKeepAliveIntvl;
pThis->iKeepAliveProbes = iKeepAliveProbes;
pThis->iKeepAliveTime = iKeepAliveTime;
}
/* start a relp server - the server object must have all properties set
* rgerhards, 2008-03-17
*/
relpRetVal
relpSrvRun(relpSrv_t *const pThis)
{
relpTcp_t *pTcp;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Srv);
CHKRet(relpTcpConstruct(&pTcp, pThis->pEngine, RELP_SRV_CONN, pThis));
relpTcpSetUsrPtr(pTcp, pThis->pUsr);
if(pThis->bEnableTLS) {
CHKRet(relpTcpEnableTLS(pTcp));
if(pThis->bEnableTLSZip) {
CHKRet(relpTcpEnableTLSZip(pTcp));
}
relpTcpSetDHBits(pTcp, pThis->dhBits);
CHKRet(relpTcpSetGnuTLSPriString(pTcp, pThis->pristring));
CHKRet(relpTcpSetTlsConfigCmd(pTcp, pThis->tlsConfigCmd));
CHKRet(relpTcpSetAuthMode(pTcp, pThis->authmode));
CHKRet(relpTcpSetCACert(pTcp, pThis->caCertFile));
CHKRet(relpTcpSetOwnCert(pTcp, pThis->ownCertFile));
CHKRet(relpTcpSetPrivKey(pTcp, pThis->privKey));
CHKRet(relpTcpSetPermittedPeers(pTcp, &(pThis->permittedPeers)));
}
CHKRet(relpTcpLstnInit(pTcp, (pThis->pLstnPort == NULL) ?
(unsigned char*) RELP_DFLT_PORT : pThis->pLstnPort,
(unsigned char*) pThis->pLstnAddr,
pThis->ai_family));
pThis->pTcp = pTcp;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pThis->pTcp != NULL)
relpTcpDestruct(&pTcp);
}
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/relp.h 0000664 0001750 0001750 00000021747 15241030422 010616 /* The RELP (reliable event logging protocol) core protocol library.
*
* Copyright 2008-2025 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELP_H_INCLUDED
#define RELP_H_INCLUDED
#if defined(WITH_TLS)
#define NOTLS_UNUSED
#else
#define NOTLS_UNUSED LIBRELP_ATTR_UNUSED
#endif
#define PART_OF_API __attribute__((visibility("default")))
#include
#if HAVE_SYS_EPOLL_H
# include
#endif
#include "librelp.h"
/* "config params" - these can be overridden by defining the
* respective constants at compile time.
*/
#ifndef DEFAULT_DH_BITS /* security param: default Diffie-Hellman bits to use */
# define DEFAULT_DH_BITS 1024
#endif
/* the following macro MUST be specified as the first member of each
* RELP object.
*/
#define BEGIN_RELP_OBJ relpObjID_t objID
/* the core intializer to call on top of each constructure (right after the calloc) */
#define RELP_CORE_CONSTRUCTOR(pObj, objType) \
(pObj)->objID = eRelpObj_##objType
/* a structure to store permitted peer information (a type of ACL) */
typedef struct relpPermittedPeers_s {
int nmemb;
char **name;
} relpPermittedPeers_t;
#if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
typedef struct epolld_s epolld_t;
#endif
/* a linked list entry for the list of relp servers (of this engine) */
typedef struct relpEngSrvLst_s {
struct relpEngSrvLst_s *pPrev;
struct relpEngSrvLst_s *pNext;
# if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
epolld_t **epevts;
# endif
struct relpSrv_s *pSrv;
} relpEngSrvLst_t;
#if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
/* type of object stored in epoll descriptor */
typedef enum {
epolld_lstn,
epolld_sess
} epolld_type_t;
/* an epoll descriptor. contains all information necessary to process
* the result of epoll.
*/
struct epolld_s {
epolld_type_t typ;
void *ptr;
int sock;
struct epoll_event ev;
};
#endif
/* a linked list entry for the list of relp sessions (of this engine) */
typedef struct relpEngSessLst_s {
struct relpEngSessLst_s *pPrev;
struct relpEngSessLst_s *pNext;
struct relpSess_s *pSess;
# if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
enum { epoll_wronly, epoll_rdonly, epoll_rdwr } epollState;
epolld_t *epevt;
# endif
} relpEngSessLst_t;
/* the RELP engine object
* Having a specific engine object enables multiple plugins to call the
* RELP engine at the same time. The core idea of librelp is to have no
* static data at all and everything stored in RELP engine objects. Every
* program/plugin should aquire a RELP engine once on startup (or first need)
* and release it only when it is fully done with RELP, which usually means
* on shutdown.
* rgerhards, 2008-03-16
*/
struct relpEngine_s {
BEGIN_RELP_OBJ;
void (*dbgprint)(char *fmt, ...) LIBRELP_ATTR_FORMAT(printf, 1, 2);
relpRetVal (*onSyslogRcv)(unsigned char*pHostname, unsigned char *pIP,
unsigned char *pMsg, size_t lenMsg); /**< callback for "syslog" cmd */
relpRetVal (*onSyslogRcv2)(void*, unsigned char*pHostname, unsigned char *pIP,
unsigned char *pMsg, size_t lenMsg); /**< callback for "syslog" cmd */
relpRetVal (*onSyslogRcv3)(void*, unsigned char*pHostname, unsigned char *pIP,
unsigned char *pPort, unsigned char *pMsg, size_t lenMsg); /**< callback for "syslog" cmd */
void (*onAuthErr)(void*pUsr, char *authinfo, char*errmsg, relpRetVal errcode);
void (*onErr)(void*pUsr, char *objinfo, char*errmsg, relpRetVal errcode);
void (*onGenericErr)(char *objinfo, char*errmsg, relpRetVal errcode);
void (*onSessOpen)(void*pUsr, const relpSess_t *pSess);
void (*onSessClose)(void*pUsr, const relpSess_t *pSess, relpRetVal reason);
void (*onSessOpenFail)(void*pUsr, const relpSess_t *pSess, relpRetVal reason);
int protocolVersion; /**< version of the relp protocol supported by this engine */
/* Flags */
int bEnableDns; /**< enabled DNS lookups 0 - no, 1 - yes */
int bAcceptSessFromMalDnsHost; /**< accept session from host with malicious DNS? (0-no, 1-yes) */
int ai_family; /**< to support IPv4/v6 modes */
/* default for enabled commands */
relpCmdEnaState_t stateCmdSyslog;
/* linked list of our servers */
relpEngSrvLst_t *pSrvLstRoot;
relpEngSrvLst_t *pSrvLstLast;
int lenSrvLst;
pthread_mutex_t mutSrvLst;
/* linked list of our sessions */
relpEngSessLst_t *pSessLstRoot;
relpEngSessLst_t *pSessLstLast;
int lenSessLst;
pthread_mutex_t mutSessLst;
# if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
int efd; /**< file descriptor for epoll */
# endif
int bStop; /* set to 1 to stop server after next select */
int *bShutdownImmdt; /* if non-NULL provides a kind of "external" */
/* bStop functionality. This is in support for rsyslog,
* whom's output interface is not capable of calling into
* librelp at time of stop request.
*/
int tls_lib; /* 0 - gnutls, 1 - openssl */
};
/* macro to assert we are dealing with the right relp object */
#ifdef NDEBUG
# define RELPOBJ_assert(obj, type)
#else /* debug case */
# define RELPOBJ_assert(pObj, type) \
assert((pObj) != NULL); \
assert((pObj)->objID == eRelpObj_##type)
#endif /* # ifdef NDEBUG */
#define RELP_CURR_PROTOCOL_VERSION 0
/* some defines that may also come from the config */
#ifndef RELP_DFLT_PORT
# define RELP_DFLT_PORT 20514
#endif
#ifndef RELP_DFLT_MAX_DATA_SIZE
# define RELP_DFLT_MAX_DATA_SIZE 128 * 1024 /* 128K should be sufficient for everything... */
#endif
#ifndef RELP_DFLT_WINDOW_SIZE
# define RELP_DFLT_WINDOW_SIZE 128 /* 128 unacked frames should be fairly good in most cases */
#endif
#ifndef RELP_DFLT_OVERSIZE_MODE
# define RELP_DFLT_OVERSIZE_MODE RELP_OVERSIZE_ABORT
#endif
/* set the default receive buffer size if none is externally configured
* NOTE: do not define to less than 1.5K or you'll probably see a severe
* performance hit!
*/
#ifndef RELP_RCV_BUF_SIZE
# define RELP_RCV_BUF_SIZE 32 * 1024 /* 32K */
#endif
/* some macros to work with librelp error codes */
#define CHKRet(code) if((iRet = code) != RELP_RET_OK) goto finalize_it
#define CHKmalloc(r) if((r) == NULL) { iRet = RELP_RET_OUT_OF_MEMORY; goto finalize_it; }
/* macro below is to be used if we need our own handling, eg for cleanup */
#define CHKRet_Hdlr(code) if((iRet = code) != RELP_RET_OK)
/* macro below is used in conjunction with CHKiRet_Hdlr, else use ABORT_FINALIZE */
#define FINALIZE goto finalize_it;
#define ENTER_RELPFUNC relpRetVal iRet = RELP_RET_OK
#define LEAVE_RELPFUNC return iRet
#define ABORT_FINALIZE(errCode) \
do { \
iRet = errCode; \
goto finalize_it; \
} while (0)
/* some macro-implemented functionality of the RELP engine */
#define relpEngineNextTXNR(txnr) \
((txnr > 999999999) ? 1 : txnr + 1)
static inline int relpEngineShouldStop(relpEngine_t *pThis) {
return pThis->bStop
|| (pThis->bShutdownImmdt != NULL && *pThis->bShutdownImmdt);
}
/* prototypes needed by library itself (rest is in librelp.h) */
relpRetVal relpEngineDispatchFrame(relpEngine_t *pThis, relpSess_t *pSess, relpFrame_t *pFrame);
void LIBRELP_ATTR_FORMAT(printf, 4, 5) relpEngineCallOnGenericErr(relpEngine_t *pThis,
const char *eobj, relpRetVal ecode, const char *fmt, ...);
const char * _relpEngine_strerror_r(const int errnum, char *buf, const size_t buflen);
/* here we add some stuff from the compatibility layer. A separate include
* would be cleaner, but would potentially require changes all over the
* place. So doing it here is better. The respective replacement
* functions should usually be found under ./compat -- rgerhards, 2015-05-20
* - Function copied from rsyslog -- alorbach, 2020-11-13
*/
#ifndef HAVE_STRNDUP
char * strndup(const char *s, size_t n);
#endif
#endif /* #ifndef RELP_H_INCLUDED */
librelp-1.13.0/src/offers.c 0000664 0001750 0001750 00000025415 14354536317 011151 /* Support functionality for sending and receiving offers.
*
* Copyright 2008-2018 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include "librelp.h"
#include "relp.h"
#include "relpframe.h"
#include "offers.h"
/** Construct a RELP offer value instance
* rgerhards, 2008-03-24
*/
static relpRetVal
relpOfferValueConstruct(relpOfferValue_t **ppThis, relpEngine_t *pEngine)
{
relpOfferValue_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpOfferValue_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, OfferValue);
pThis->pEngine = pEngine;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP offer value instance
* rgerhards, 2008-03-24
*/
static relpRetVal
relpOfferValueDestruct(relpOfferValue_t **ppThis)
{
relpOfferValue_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, OfferValue);
/* done with de-init work, now free offers object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/** Construct a RELP offer instance
* rgerhards, 2008-03-24
*/
static relpRetVal
relpOfferConstruct(relpOffer_t **ppThis, relpEngine_t *pEngine)
{
relpOffer_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpOffer_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Offer);
pThis->pEngine = pEngine;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP offer instance
* rgerhards, 2008-03-24
*/
static relpRetVal
relpOfferDestruct(relpOffer_t **ppThis)
{
relpOffer_t *pThis;
relpOfferValue_t *pOfferVal;
relpOfferValue_t *pOfferValToDel;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Offer);
pOfferVal = pThis->pValueRoot;
while(pOfferVal != NULL) {
pOfferValToDel = pOfferVal;
pOfferVal = pOfferVal->pNext;
relpOfferValueDestruct(&pOfferValToDel);
}
/* done with de-init work, now free offers object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/** Construct a RELP offers list instance
* rgerhards, 2008-03-24
*/
relpRetVal
relpOffersConstruct(relpOffers_t **ppThis, relpEngine_t *pEngine)
{
relpOffers_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpOffers_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Offers);
pThis->pEngine = pEngine;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP offers list
* rgerhards, 2008-03-24
*/
relpRetVal
relpOffersDestruct(relpOffers_t **ppThis)
{
relpOffers_t *pThis;
relpOffer_t *pOffer;
relpOffer_t *pOfferToDel;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Offers);
pOffer = pThis->pRoot;
while(pOffer != NULL) {
pOfferToDel = pOffer;
pOffer = pOffer->pNext;
relpOfferDestruct(&pOfferToDel);
}
/* done with de-init work, now free offers object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/* Construct a offer value with pszVal and add it to the offer value
* list. This function also checks if the value is an integer and, if so,
* sets the integer value. If no string pointer is provided, the integer
* value is added. The integer is ignored if a string pointer is present.
* rgerhards, 2008-03-24
*/
relpRetVal
relpOfferValueAdd(unsigned char *pszVal, int intVal, relpOffer_t *pOffer)
{
relpOfferValue_t *pThis = NULL;
int i;
int Val;
ENTER_RELPFUNC;
RELPOBJ_assert(pOffer, Offer);
CHKRet(relpOfferValueConstruct(&pThis, pOffer->pEngine));
/* check which value we need to use */
if(pszVal == NULL) {
snprintf((char*)pThis->szVal, sizeof(pThis->szVal), "%d", intVal);
pThis->szVal[RELP_MAX_OFFER_FEATUREVALUE] = '\0';
pThis->intVal = intVal;
} else {
strncpy((char*)pThis->szVal, (char*)pszVal, sizeof(pThis->szVal) - 1);
/* check if the string actually is an integer... */
Val = 0;
i = 0;
while(pszVal[i]) {
if(isdigit(pszVal[i]))
Val = Val * 10 + pszVal[i] - '0';
else
break;
++i;
}
if(pszVal[i] != '\0')
Val = -1; /* no (unsigned!) integer! */
pThis->intVal = Val;
}
pThis->pNext = pOffer->pValueRoot;
pOffer->pValueRoot = pThis;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pThis != NULL)
relpOfferValueDestruct(&pThis);
}
LEAVE_RELPFUNC;
}
/* Construct an offer with name pszName and add it to the offers list.
* The offer object is returned to the caller. It is read-only and MUST NOT
* be destructed.
* rgerhards, 2008-03-24
*/
relpRetVal
relpOfferAdd(relpOffer_t **ppThis, unsigned char *pszName, relpOffers_t *pOffers)
{
relpOffer_t *pThis = NULL;
ENTER_RELPFUNC;
assert(ppThis != NULL);
assert(pszName != NULL);
RELPOBJ_assert(pOffers, Offers);
CHKRet(relpOfferConstruct(&pThis, pOffers->pEngine));
strncpy((char*)pThis->szName, (char*)pszName, sizeof(pThis->szName));
pThis->szName[RELP_MAX_OFFER_FEATURENAME] = '\0';
pThis->pNext = pOffers->pRoot;
pOffers->pRoot = pThis;
*ppThis = pThis;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pThis != NULL)
relpOfferDestruct(&pThis);
}
LEAVE_RELPFUNC;
}
/* create as string with the complete offers. The string is dynamically
* allocated and passed to the caller. The caller is responsible for
* freeing it. This function always allocates a sufficiently large
* string (TODO: ensure that!). A string my be prepended to the offers
* block (this is for rsp status). If that is not desired, the param
* must be NULL, in which case its length is simply ignored (suggest to use
* 0 in that case).
* rgerhards, 2008-03-24
*/
relpRetVal
relpOffersToString(relpOffers_t *pThis, unsigned char *pszHdr, const size_t lenHdr,
unsigned char **ppszOffers, size_t *plenStr)
{
unsigned char *pszOffers = NULL;
unsigned char *pszOffersNew;
size_t iStr;
size_t currSize;
size_t iAlloc;
relpOffer_t *pOffer;
relpOfferValue_t *pOfferVal;
ENTER_RELPFUNC;
assert(ppszOffers != NULL);
RELPOBJ_assert(pThis, Offers);
if(pszHdr != NULL && lenHdr > 4096)
iAlloc = 4096 + lenHdr;
else
iAlloc = 4096;
if((pszOffers = malloc(iAlloc)) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
currSize = iAlloc;
iAlloc = 4096;
/* check if we need to prepend anything */
if(pszHdr == NULL) {
iStr = 0; /* no, start at the beginning */
} else {
memcpy((char*)pszOffers, (char*)pszHdr, lenHdr);
iStr = lenHdr;
}
for(pOffer = pThis->pRoot ; pOffer != NULL ; pOffer = pOffer->pNext) {
/* we use -3 in the realloc-guard ifs so that we have space for constants following! */
if(currSize - iStr - 3 < strlen((char*)pOffer->szName)) {
if((pszOffersNew = realloc(pszOffers, currSize + iAlloc)) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pszOffers = pszOffersNew;
currSize += iAlloc;
}
strcpy((char*)pszOffers+iStr, (char*)pOffer->szName);
iStr += strlen((char*)pOffer->szName);
pszOffers[iStr++] = '=';
for(pOfferVal = pOffer->pValueRoot ; pOfferVal != NULL ; pOfferVal = pOfferVal->pNext) {
if(currSize - iStr - 3 < strlen((char*)pOfferVal->szVal)) {
if((pszOffersNew = realloc(pszOffers, currSize + iAlloc)) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pszOffers = pszOffersNew;
currSize += iAlloc;
}
strcpy((char*)pszOffers+iStr, (char*)pOfferVal->szVal);
iStr += strlen((char*)pOfferVal->szVal);
if(pOfferVal->pNext != NULL)
pszOffers[iStr++] = ',';
}
if(pOffer->pNext != NULL)
pszOffers[iStr++] = '\n';
}
*ppszOffers = pszOffers;
*plenStr = iStr;
finalize_it:
if(iRet != RELP_RET_OK) {
free(pszOffers);
}
LEAVE_RELPFUNC;
}
/* construct an offers list from the offers contained in a frame. The frame's
* Read Next pointer must be positioned at the first character of the offer.
* rgerhards, 2008-03-25
*/
relpRetVal
relpOffersConstructFromFrame(relpOffers_t **ppOffers, relpFrame_t *pFrame)
{
relpOffers_t *pOffers = NULL;
relpOffer_t *pOffer;
relpRetVal localRet;
unsigned char c;
size_t iName;
size_t iVal;
unsigned char szFeatNam[RELP_MAX_OFFER_FEATURENAME+1];
unsigned char szFeatVal[RELP_MAX_OFFER_FEATUREVALUE+1];
ENTER_RELPFUNC;
assert(ppOffers != NULL);
RELPOBJ_assert(pFrame, Frame);
CHKRet(relpOffersConstruct(&pOffers, pFrame->pEngine));
/* now process the command data */
localRet = relpFrameGetNextC(pFrame, &c);
while(localRet == RELP_RET_OK) {
/* command name */
iName = 0;
while(iName < RELP_MAX_OFFER_FEATURENAME && c != '=' && localRet == RELP_RET_OK) {
szFeatNam[iName++] = c;
localRet = relpFrameGetNextC(pFrame, &c);
}
szFeatNam[iName] = '\0'; /* space is reserved for this! */
CHKRet(relpOfferAdd(&pOffer, szFeatNam, pOffers));
/* and now process the values (if any) */
while(localRet == RELP_RET_OK && c != '\n') {
localRet = relpFrameGetNextC(pFrame, &c); /* eat the "=" or "," */
iVal = 0;
while( iVal < RELP_MAX_OFFER_FEATUREVALUE && localRet == RELP_RET_OK
&& c != ',' && c != '\n' ) {
szFeatVal[iVal++] = c;
localRet = relpFrameGetNextC(pFrame, &c);
}
if(iVal > 0) { /* only set feature if one is actually given */
szFeatVal[iVal] = '\0'; /* space is reserved for this */
CHKRet(relpOfferValueAdd(szFeatVal, 0, pOffer));
}
}
if(localRet == RELP_RET_OK && c == '\n')
localRet = relpFrameGetNextC(pFrame, &c); /* eat '\n' */
}
if(localRet != RELP_RET_END_OF_DATA)
ABORT_FINALIZE(localRet);
*ppOffers = pOffers;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pOffers != NULL)
relpOffersDestruct(&pOffers);
}
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/scsyslog.c 0000664 0001750 0001750 00000007002 15111360423 011504 /* The command handler for server-based "syslog" (after reception)
*
* This command is used to transfer syslog messages.
*
* Copyright 2008-2025 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include "relp.h"
#include "cmdif.h"
/* as a quick hack, we provide our command handler prototypes here
* right in front of the dispatcher. This saves us many otherwise-unneeded
* header files (and will go away if we make them dynamically loadable).
* alorbach, 2020-09-09
*/
/* core (protocol) commands */
PROTOTYPEcommand(S, Syslog)
/* process the command
* rgerhards, 2008-03-17
*/
BEGINcommand(S, Syslog)
ENTER_RELPFUNC;
pSess->pEngine->dbgprint((char*)"in 'syslog' command handler\n");
if(pSess->stateCmdSyslog != eRelpCmdState_Enabled) {
relpSessSendResponse(pSess, pFrame->txnr, (unsigned char*) "500 command disabled", 20);
ABORT_FINALIZE(RELP_RET_CMD_DISABLED);
}
/* TODO: right now, the callbacks are called without checking the
* return code. I assume this should at least be optionally done.
* Consider implementing this. rgerhards, 2018-04-17
*/
/* only highest version callback is called */
if(pSess->pEngine->onSyslogRcv3 != NULL) {
pSess->pEngine->onSyslogRcv3(pSess->pSrv->pUsr, pSess->pTcp->pRemHostName,
pSess->pTcp->pRemHostIP, pSess->pTcp->pRemHostPort,
pFrame->pData, pFrame->lenData);
} else if(pSess->pEngine->onSyslogRcv2 != NULL) {
pSess->pEngine->onSyslogRcv2(pSess->pSrv->pUsr, pSess->pTcp->pRemHostName,
pSess->pTcp->pRemHostIP, pFrame->pData, pFrame->lenData);
} else if(pSess->pEngine->onSyslogRcv != NULL) {
pSess->pEngine->onSyslogRcv(pSess->pTcp->pRemHostName, pSess->pTcp->pRemHostIP,
pFrame->pData, pFrame->lenData);
} else {
pSess->pEngine->dbgprint((char*)"error: no syslog reception callback is set, nothing done\n");
}
/* send response */
iRet = relpSessSendResponse(pSess, pFrame->txnr, (unsigned char*) "200 OK", 6);
finalize_it:
ENDcommand
librelp-1.13.0/src/cclose.c 0000644 0001750 0001750 00000004162 13734555715 011133 /* The command handler for "close"
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some development funding.
*/
#include "config.h"
#include
#include
#include
#include "relp.h"
#include "cmdif.h"
/* as a quick hack, we provide our command handler prototypes here
* right in front of the dispatcher. This saves us many otherwise-unneeded
* header files (and will go away if we make them dynamically loadable).
* alorbach, 2020-09-09
*/
/* core (protocol) commands */
PROTOTYPEcommand(S, Close)
/* process the command
* rgerhards, 2008-03-21
*/
BEGINcommand(S, Close)
ENTER_RELPFUNC;
pSess->pEngine->dbgprint((char*)"in close command handler\n");
/* and send it... */
CHKRet(relpSessSendResponse(pSess, pFrame->txnr, (unsigned char*) "", 0));
iRet = RELP_RET_SESSION_CLOSED; /* indicate close condition */
finalize_it:
ENDcommand
librelp-1.13.0/src/relp.c 0000664 0001750 0001750 00000114726 15241030422 010611 /* The RELP (reliable event logging protocol) core protocol library.
*
* Copyright 2008-2025 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include "relp.h"
#include "relpsrv.h"
#include "relpclt.h"
#include "relpframe.h"
#include "relpsess.h"
#include "cmdif.h"
#include "sendq.h"
#include "dbllinklist.h"
/* ------------------------------ some internal functions ------------------------------ */
void LIBRELP_ATTR_FORMAT(printf, 4, 5)
relpEngineCallOnGenericErr(relpEngine_t *const pThis, const char *eobj, relpRetVal ecode, const char *fmt, ...)
{
va_list ap;
char emsg[1024];
va_start(ap, fmt);
vsnprintf(emsg, sizeof(emsg), fmt, ap);
emsg[sizeof(emsg)/sizeof(char) - 1] = '\0'; /* just to be on the safe side... */
va_end(ap);
pThis->dbgprint((char*)"librelp: generic error: ecode %d, eobj %s,"
"emsg '%s'\n", ecode, eobj, emsg);
if(pThis->onGenericErr != NULL) {
pThis->onGenericErr((char*)eobj, emsg, ecode);
}
}
const char *
_relpEngine_strerror_r(const int errnum, char *buf, const size_t buflen) {
#ifndef HAVE_STRERROR_R
char *p;
p = strerror(errnum);
strncpy(buf, p, buflen);
buf[buflen-1] = '\0';
#else
# ifdef STRERROR_R_CHAR_P
char *p;
p = strerror_r(errnum, buf, buflen);
if(p != buf) {
strncpy(buf, p, buflen);
buf[buflen - 1] = '\0';
}
# else
strerror_r(errnum, buf, buflen);
# endif
#endif
return buf;
}
#if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
static relpRetVal
addToEpollSet(relpEngine_t *const pThis, epolld_type_t typ, void *ptr, int sock, epolld_t **pepd)
{
epolld_t *epd = NULL;
ENTER_RELPFUNC;
CHKmalloc(epd = calloc(1, sizeof(epolld_t)));
epd->typ = typ;
epd->ptr = ptr;
epd->sock = sock;
epd->ev.events = EPOLLIN;
epd->ev.data.ptr = (void*) epd;
pThis->dbgprint((char*)"librelp: add socket %d to epoll set (ptr %p)\n", sock, ptr);
if(epoll_ctl(pThis->efd, EPOLL_CTL_ADD, sock, &epd->ev) != 0) {
char errStr[1024];
int eno = errno;
relpEngineCallOnGenericErr(pThis, "librelp", RELP_RET_ERR_EPOLL_CTL,
"os error (%d) during EPOLL_CTL_ADD: %s",
eno, _relpEngine_strerror_r(eno, errStr, sizeof(errStr)));
ABORT_FINALIZE(RELP_RET_ERR_EPOLL_CTL);
}
*pepd = epd;
finalize_it:
if(iRet != RELP_RET_OK) {
free(epd);
}
LEAVE_RELPFUNC;
}
/* we do not return error states, as we are unable to handle them intelligently
* in any case...
*/
static void
delFromEpollSet(relpEngine_t *const pThis, epolld_t *epd)
{
int r;
pThis->dbgprint((char*)"librelp: delete sock %d from epoll set\n", epd->sock);
if(pThis->efd != -1 && (r = epoll_ctl(pThis->efd, EPOLL_CTL_DEL, epd->sock, &epd->ev)) != 0) {
char errStr[1024];
int eno = errno;
relpEngineCallOnGenericErr(pThis, "librelp", RELP_RET_ERR_EPOLL_CTL,
"os error (%d) during EPOLL_CTL_DEL: %s",
eno, _relpEngine_strerror_r(eno, errStr, sizeof(errStr)));
}
free(epd);
}
static relpRetVal
addSessToEpoll(relpEngine_t *const pThis, relpEngSessLst_t *pSessLstEntry)
{
addToEpollSet(pThis, epolld_sess, pSessLstEntry,
relpSessGetSock(pSessLstEntry->pSess), &pSessLstEntry->epevt);
pSessLstEntry->epollState = epoll_rdonly;
return RELP_RET_OK;
}
static void
delSessFromEpoll(relpEngine_t *const pThis, relpEngSessLst_t *pSessEtry)
{
if(pSessEtry->epevt != NULL) {
if(pThis->efd != -1) {
delFromEpollSet(pThis, pSessEtry->epevt);
} else {
free(pSessEtry->epevt);
}
pSessEtry->epevt = NULL;
}
}
#endif
/* add an entry to our server list. The server object is handed over and must
* no longer be accessed by the caller.
* rgerhards, 2008-03-17
*/
static relpRetVal
relpEngineAddToSrvList(relpEngine_t *const pThis, relpSrv_t *pSrv)
{
relpEngSrvLst_t *pSrvLstEntry;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
RELPOBJ_assert(pSrv, Srv);
if((pSrvLstEntry = calloc(1, sizeof(relpEngSrvLst_t))) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
pSrvLstEntry->pSrv = pSrv;
pthread_mutex_lock(&pThis->mutSrvLst);
DLL_Add(pSrvLstEntry, pThis->pSrvLstRoot, pThis->pSrvLstLast);
++pThis->lenSrvLst;
pthread_mutex_unlock(&pThis->mutSrvLst);
finalize_it:
LEAVE_RELPFUNC;
}
/* add an entry to our session list. The session object is handed over and must
* no longer be accessed by the caller.
* rgerhards, 2008-03-17
*/
static relpRetVal
relpEngineAddToSess(relpEngine_t *const pThis, relpSess_t *pSess)
{
relpEngSessLst_t *pSessLstEntry;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
RELPOBJ_assert(pSess, Sess);
if((pSessLstEntry = calloc(1, sizeof(relpEngSessLst_t))) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
pSessLstEntry->pSess = pSess;
pthread_mutex_lock(&pThis->mutSessLst);
DLL_Add(pSessLstEntry, pThis->pSessLstRoot, pThis->pSessLstLast);
++pThis->lenSessLst;
pthread_mutex_unlock(&pThis->mutSessLst);
# if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
addSessToEpoll(pThis, pSessLstEntry);
# endif
finalize_it:
LEAVE_RELPFUNC;
}
/* Delete an entry from our session list. The session object is destructed.
* rgerhards, 2008-03-17
*/
static relpRetVal
relpEngineDelSess(relpEngine_t *const pThis, relpEngSessLst_t *pSessLstEntry, relpRetVal reason)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
assert(pSessLstEntry != NULL);
relpSess_t *const pSess = pSessLstEntry->pSess;
# if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
delSessFromEpoll(pThis, pSessLstEntry);
# endif
pthread_mutex_lock(&pThis->mutSessLst);
DLL_Del(pSessLstEntry, pThis->pSessLstRoot, pThis->pSessLstLast);
--pThis->lenSessLst;
pthread_mutex_unlock(&pThis->mutSessLst);
if(pThis->onSessClose != NULL) {
pThis->onSessClose(pSess->pUsr, pSess, reason);
}
relpSessDestruct(&pSessLstEntry->pSess);
free(pSessLstEntry);
LEAVE_RELPFUNC;
}
/* ------------------------------ end of internal functions ------------------------------ */
/** Construct a RELP engine instance
* This is the first thing that a caller must do before calling any
* RELP function. The relp engine must only destructed after all RELP
* operations have been finished.
*/
PART_OF_API relpRetVal
relpEngineConstruct(relpEngine_t **ppThis)
{
relpEngine_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpEngine_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Engine);
#if !defined(ENABLE_TLS) && defined(ENABLE_TLS_OPENSSL)
/* if we only have openssl, it's only sensible to use it by default ;-) */
pThis->tls_lib = RELP_USE_OPENSSL;
#else /* otherwise, use GnuTLS for max compatibility */
pThis->tls_lib = RELP_USE_GNUTLS;
#endif
pThis->protocolVersion = RELP_CURR_PROTOCOL_VERSION;
# if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
pThis->efd = -1;
# endif
pthread_mutex_init(&pThis->mutSrvLst, NULL);
pthread_mutex_init(&pThis->mutSessLst, NULL);
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP engine instance
* Should be called only a after all RELP functions have been terminated.
* Terminates librelp operations, no calls are permitted after engine
* destruction.
*/
PART_OF_API relpRetVal
relpEngineDestruct(relpEngine_t **ppThis)
{
relpEngine_t *pThis;
relpEngSrvLst_t *pSrvL, *pSrvLNxt;
relpEngSessLst_t *pSessL, *pSessLNxt;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Engine);
/* now destruct all currently existing sessions */
for(pSessL = pThis->pSessLstRoot ; pSessL != NULL ; pSessL = pSessLNxt) {
pSessLNxt = pSessL->pNext;
relpEngineDelSess(pThis, pSessL, RELP_RET_SESSION_CLOSED);
}
/* and now all existing servers... */
for(pSrvL = pThis->pSrvLstRoot ; pSrvL != NULL ; pSrvL = pSrvLNxt) {
pSrvLNxt = pSrvL->pNext;
relpSrvDestruct(&pSrvL->pSrv);
free(pSrvL);
}
/* destruct TLS structures */
relpTcpExitTLS();
pthread_mutex_destroy(&pThis->mutSrvLst);
pthread_mutex_destroy(&pThis->mutSessLst);
/* done with de-init work, now free engine object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
static void dbgprintDummy(char LIBRELP_ATTR_UNUSED *fmt, ...) {}
/* set a pointer to the debug function inside the engine. To reset a debug
* function that already has been set, provide a NULL function pointer.
* rgerhards, 2008-03-17
*/
PART_OF_API relpRetVal
relpEngineSetDbgprint(relpEngine_t *const pThis, void (*dbgprint)(char *fmt, ...) LIBRELP_ATTR_FORMAT(printf, 1, 2))
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->dbgprint = (dbgprint == NULL) ? dbgprintDummy : dbgprint;
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpEngineSetTLSLib(relpEngine_t *const pThis, NOTLS_UNUSED const int tls_lib)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
if(pThis == NULL) {
ABORT_FINALIZE(RELP_RET_PARAM_ERROR);
}
pThis->dbgprint((char*)"relpEngineSetTLSLib, req lib is %d\n", tls_lib);
#if defined(WITH_TLS)
if(tls_lib == RELP_USE_GNUTLS) {
#if defined(ENABLE_TLS)
pThis->tls_lib = RELP_USE_GNUTLS;
#else
ABORT_FINALIZE(RELP_RET_NOT_SUPPORTED);
#endif
} else if(tls_lib == RELP_USE_OPENSSL) {
#if defined(ENABLE_TLS_OPENSSL)
pThis->tls_lib = RELP_USE_OPENSSL;
#else
ABORT_FINALIZE(RELP_RET_NOT_SUPPORTED);
#endif
} else {
ABORT_FINALIZE(RELP_RET_PARAM_ERROR);
}
#else /* defined(WITH_TLS) */
pThis->dbgprint((char*)"relpEngineSetTLSLib, error, librelp not with TLS support\n");
ABORT_FINALIZE(RELP_RET_NOT_SUPPORTED);
#endif
finalize_it:
if (pThis)
pThis->dbgprint((char*)"relpEngineSetTLSLib, lib now %d, ret %d\n", pThis->tls_lib, iRet);
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpEngineSetTLSLibByName(relpEngine_t *const pThis, const char *const name)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
if(pThis == NULL || name == NULL) {
ABORT_FINALIZE(RELP_RET_PARAM_ERROR);
}
if(!strcasecmp(name, "gnutls")) {
CHKRet(relpEngineSetTLSLib(pThis, RELP_USE_GNUTLS));
}else if(!strcasecmp(name, "openssl")) {
CHKRet(relpEngineSetTLSLib(pThis, RELP_USE_OPENSSL));
} else {
relpEngineCallOnGenericErr(pThis, "librelp", RELP_RET_PARAM_ERROR,
"invalid tls lib '%s' requested; this version of "
"librelp only supports 'gnutls', 'openssl'", name);
ABORT_FINALIZE(RELP_RET_NOT_SUPPORTED);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* create a new listener to be added to the engine. This is the new-style
* calling convention, which permits us to set various properties before
* the listener is actually started. New callers should use it. Sequence
* is:
* * relpEngineListnerConstruct()
* * ... set properties ... (via relpSrv...() family)
* * relgEngineListnerConstructFinalize()
* rgerhards, 2013-05-14
*/
PART_OF_API relpRetVal
relpEngineListnerConstruct(relpEngine_t *const pThis, relpSrv_t **ppSrv)
{
relpSrv_t *pSrv;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
CHKRet(relpSrvConstruct(&pSrv, pThis));
CHKRet(relpSrvSetFamily(pSrv, pThis->ai_family));
*ppSrv = pSrv;
finalize_it:
LEAVE_RELPFUNC;
}
PART_OF_API relpRetVal
relpEngineListnerConstructFinalize(relpEngine_t *const pThis, relpSrv_t *pSrv)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
CHKRet(relpSrvRun(pSrv));
CHKRet(relpEngineAddToSrvList(pThis, pSrv));
finalize_it:
LEAVE_RELPFUNC;
}
/* unfortunately, we need to duplicate some functionality to support the <= 0.1.2
* callback interface (which did not contain a user pointer) and the >= 0.1.3
* callback interface. I have thought a lot about doing this smarter, but there
* is no better way the API offers. The functions ending in ...2() are the new
* interface. -- rgerhards, 2008-07-08
*/
/* a dummy for callbacks not set by the caller */
static relpRetVal relpSrvSyslogRcvDummy2(void LIBRELP_ATTR_UNUSED *pUsr,
unsigned char LIBRELP_ATTR_UNUSED *pHostName,
unsigned char LIBRELP_ATTR_UNUSED *pIP, unsigned char LIBRELP_ATTR_UNUSED *pMsg,
size_t LIBRELP_ATTR_UNUSED lenMsg)
{ return RELP_RET_NOT_IMPLEMENTED;
}
static relpRetVal relpSrvSyslogRcvDummy3(void LIBRELP_ATTR_UNUSED *pUsr,
unsigned char LIBRELP_ATTR_UNUSED *pHostName,
unsigned char LIBRELP_ATTR_UNUSED *pIP, unsigned char LIBRELP_ATTR_UNUSED *pPort,
unsigned char LIBRELP_ATTR_UNUSED *pMsg,
size_t LIBRELP_ATTR_UNUSED lenMsg)
{ return RELP_RET_NOT_IMPLEMENTED; }
/* set the syslog receive callback. If NULL is provided, it is set to the
* not implemented dummy.
*/
PART_OF_API relpRetVal
relpEngineSetSyslogRcv2(relpEngine_t *const pThis, relpRetVal (*pCB)(void *, unsigned char*,
unsigned char*, unsigned char*, size_t))
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onSyslogRcv = NULL;
pThis->onSyslogRcv3 = NULL;
pThis->onSyslogRcv2 = (pCB == NULL) ? relpSrvSyslogRcvDummy2 : pCB;
LEAVE_RELPFUNC;
}
/* set the syslog receive callback. If NULL is provided, it is set to the
* not implemented dummy.
*/
PART_OF_API relpRetVal
relpEngineSetSyslogRcv3(relpEngine_t *const pThis, relpRetVal (*pCB)(void *, unsigned char*,
unsigned char*, unsigned char*, unsigned char*, size_t))
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onSyslogRcv = NULL;
pThis->onSyslogRcv2 = NULL;
pThis->onSyslogRcv3 = (pCB == NULL) ? relpSrvSyslogRcvDummy3 : pCB;
LEAVE_RELPFUNC;
}
/**
* Set an event handler that shall receive information when authentication
* has been failed.
*
* Most importantly, this permits the caller to emit error messages on
* failed authentication. It is also suggested to output the credentials,
* so that the user knows what to do (e.g. add fingerprint for newly
* setup peer).
*
* This handler will only be called in a mode with authenticaton.
* Practically, this means when TLS support is enabled.
*
* Callback parameters:
*
* pUsr - the user pointer set
* authinfo - the credentials that have been used to authenticate
* the remote peer. This may be a fingerprint or something
* else, depending on authentication settings.
* errmsg - error message as far as librelp is concerned
* errcode - contains librelp error status that lead to the failed auth.
*/
PART_OF_API relpRetVal
relpEngineSetOnAuthErr(relpEngine_t *const pThis, void (*pCB)(void*pUsr, char *authinfo, char*errmsg, relpRetVal errcode) )
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onAuthErr = pCB;
LEAVE_RELPFUNC;
}
/**
* Set an event handler that shall receive information when some error
* occured for which no special handler exists. Note that even if the
* special handler (e.g. AuthErr) is not set, this handler here will
* not be called. This permits the lib-user to set fine-grained control
* on which error messages it intends to handle.
*
* Callback parameters:
*
* pUsr - the user pointer set
* objinfo - some information identifying the object in error; depends
* on the actual error case.
* errmsg - error message as far as librelp is concerned
* errcode - contains librelp error status
*/
PART_OF_API relpRetVal
relpEngineSetOnErr(relpEngine_t *const pThis, void (*pCB)(void*pUsr, char *objinfo, char*errmsg, relpRetVal errcode) )
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onErr = pCB;
LEAVE_RELPFUNC;
}
/**
* Set an event handler that shall receive information when some GENERIC
* error occured for which no special handler exists. A generic error is
* one that cannot be assigned to a specific listener or session.
* Callback parameters:
*
* objinfo - some information identifying the object in error; depends
* on the actual error case.
* errmsg - error message as far as librelp is concerned
* errcode - contains librelp error status
*/
PART_OF_API relpRetVal
relpEngineSetOnGenericErr(relpEngine_t *const pThis, void (*pCB)(char *objinfo, char*errmsg, relpRetVal errcode) )
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onGenericErr = pCB;
LEAVE_RELPFUNC;
}
relpRetVal PART_OF_API
relpEngineSetOnSessOpen(relpEngine_t *const pThis, void (*pCB)(void*pUsr, const relpSess_t *pSess) )
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onSessOpen = pCB;
LEAVE_RELPFUNC;
}
relpRetVal PART_OF_API
relpEngineSetOnSessClose(relpEngine_t *const pThis,
void (*pCB)(void*pUsr, const relpSess_t *pSess, relpRetVal reason) )
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onSessClose = pCB;
LEAVE_RELPFUNC;
}
relpRetVal PART_OF_API
relpEngineSetOnSessOpenFail(relpEngine_t *const pThis,
void (*pCB)(void*pUsr, const relpSess_t *pSess, relpRetVal reason) )
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onSessOpenFail = pCB;
LEAVE_RELPFUNC;
}
/* Deprecated, use relpEngineListnerConstruct() family of functions.
* See there for further information.
*/
PART_OF_API relpRetVal
relpEngineAddListner2(relpEngine_t *const pThis, unsigned char *pLstnPort, void *pUsr)
{
relpSrv_t *pSrv = NULL;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
CHKRet(relpEngineListnerConstruct(pThis, &pSrv));
CHKRet(relpSrvSetUsrPtr(pSrv, pUsr));
CHKRet(relpSrvSetLstnPort(pSrv, pLstnPort));
CHKRet(relpEngineListnerConstructFinalize(pThis, pSrv));
finalize_it:
if(iRet != RELP_RET_OK) {
if(pSrv != NULL) {
relpSrvDestruct(&pSrv);
}
}
LEAVE_RELPFUNC;
}
/* a dummy for callbacks not set by the caller */
static relpRetVal relpSrvSyslogRcvDummy(unsigned char LIBRELP_ATTR_UNUSED *pHostName,
unsigned char LIBRELP_ATTR_UNUSED *pIP, unsigned char LIBRELP_ATTR_UNUSED *pMsg,
size_t LIBRELP_ATTR_UNUSED lenMsg)
{ return RELP_RET_NOT_IMPLEMENTED;
}
/* set the syslog receive callback. If NULL is provided, it is set to the
* not implemented dummy.
*/
PART_OF_API relpRetVal
relpEngineSetSyslogRcv(relpEngine_t *const pThis, relpRetVal (*pCB)(unsigned char*, unsigned char*, unsigned char*, size_t))
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->onSyslogRcv = (pCB == NULL) ? relpSrvSyslogRcvDummy : pCB;
pThis->onSyslogRcv2 = NULL;
pThis->onSyslogRcv3 = NULL;
LEAVE_RELPFUNC;
}
/* Deprecated, use relpEngineListnerConstruct() family of functions.
* See there for further information.
*/
PART_OF_API relpRetVal
relpEngineAddListner(relpEngine_t *const pThis, unsigned char *pLstnPort)
{
relpSrv_t *pSrv = NULL;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
CHKRet(relpEngineListnerConstruct(pThis, &pSrv));
CHKRet(relpSrvSetLstnPort(pSrv, pLstnPort));
CHKRet(relpEngineListnerConstructFinalize(pThis, pSrv));
finalize_it:
if(iRet != RELP_RET_OK) {
if(pSrv != NULL) {
relpSrvDestruct(&pSrv);
}
}
LEAVE_RELPFUNC;
}
/* the setStop method sets a flag that stops the server after the next select.
* In order to interrupt the select(), it is suggested to send a signal. If no
* signal is sent, it may take rather long to stop the server (until another
* machine sends data).
*/
PART_OF_API relpRetVal
relpEngineSetStop(relpEngine_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->bStop = 1;
LEAVE_RELPFUNC;
}
/* set the socket family to use
*/
PART_OF_API relpRetVal
relpEngineSetFamily(relpEngine_t *const pThis, int ai_family)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->ai_family = ai_family;
LEAVE_RELPFUNC;
}
/* helper for relpEngineRun; receives data when it is time to
* do so. Includes all housekeeping, like closing the session.
*/
static relpRetVal
doRecv(relpEngine_t *const pThis, relpEngSessLst_t *pSessEtry, int sock)
{
relpRetVal localRet;
localRet = relpSessRcvData(pSessEtry->pSess); /* errors are handled there */
/* if we had an error during processing, we must shut down the session. This
* is part of the protocol specification: errors are recovered by aborting the
* session, which may eventually be followed by a new connect.
*/
if(localRet != RELP_RET_OK) {
pThis->dbgprint((char*)"relp session %d iRet %d, tearing it down\n",
sock, localRet);
relpEngineDelSess(pThis, pSessEtry, localRet);
}
return localRet;
}
/* helper for relpEngineRun; sends session data when it is time
* to send. Includes all housekeeping, like closing the session.
*/
static void
doSend(relpEngine_t *const pThis, relpEngSessLst_t *pSessEtry, int sock)
{
relpRetVal localRet;
localRet = relpSessSndData(pSessEtry->pSess); /* errors are handled there */
/* if we had an error during processing, we must shut down the session. This
* is part of the protocol specification: errors are recovered by aborting the
* session, which may eventually be followed by a new connect.
*/
if(localRet != RELP_RET_OK) {
pThis->dbgprint((char*)"relp session %d iRet %d during send, tearing it down\n",
sock, localRet);
relpEngineDelSess(pThis, pSessEtry, localRet);
}
}
static void
handleConnectionRequest(relpEngine_t *const pThis, relpSrv_t *pSrv, int sock)
{
relpRetVal localRet;
relpSess_t *pNewSess;
pThis->dbgprint((char*)"new connect on RELP socket #%d\n", sock);
localRet = relpSessAcceptAndConstruct(&pNewSess, pSrv, sock);
if(localRet == RELP_RET_OK) {
relpEngineAddToSess(pThis, pNewSess);
}
}
#if defined(HAVE_EPOLL_CREATE1) || defined(HAVE_EPOLL_CREATE)
static relpRetVal
epoll_set_events(relpEngine_t *const pThis, relpEngSessLst_t *pSessEtry, int sock, uint32_t events)
{
ENTER_RELPFUNC;
/* TODO: remove the status dbgprint's once we have some practice drill 2013-07-05 */
pThis->dbgprint((char*)"librelp: epoll_set_events sock %d, target bits %2.2x, current %2.2x\n",
sock, events, pSessEtry->epevt->ev.events);
if(pSessEtry->epevt->ev.events != events) {
pSessEtry->epevt->ev.events = events;
pThis->dbgprint((char*)"librelp: epoll_set_events sock %d, setting new bits\n", sock);
if(epoll_ctl(pThis->efd, EPOLL_CTL_MOD, sock, &pSessEtry->epevt->ev) != 0) {
char errStr[1024];
int eno = errno;
relpEngineCallOnGenericErr(pThis, "librelp", RELP_RET_ERR_EPOLL_CTL,
"os error (%d) during EPOLL_CTL_MOD: %s",
eno, _relpEngine_strerror_r(eno, errStr, sizeof(errStr)));
ABORT_FINALIZE(RELP_RET_ERR_EPOLL_CTL);
}
}
finalize_it:
LEAVE_RELPFUNC;
}
static relpRetVal
engineEventLoopInit(relpEngine_t LIBRELP_ATTR_UNUSED *pThis)
{
# define NUM_EPOLL_EVENTS 10
relpEngSrvLst_t *pSrvEtry;
int i;
int nLstn;
int sock;
ENTER_RELPFUNC;
#if defined(EPOLL_CLOEXEC) && defined(HAVE_EPOLL_CREATE1)
pThis->efd = epoll_create1(EPOLL_CLOEXEC);
if(pThis->efd < 0 && errno == ENOSYS)
#endif
{
pThis->efd = epoll_create(NUM_EPOLL_EVENTS);
}
if(pThis->efd < 0) {
pThis->dbgprint((char*)"epoll_create1() could not create fd\n");
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
/* Add the listen sockets to the epoll set. These
* never change, so we can do it just once in init.
*/
for(pSrvEtry = pThis->pSrvLstRoot ; pSrvEtry != NULL ; pSrvEtry = pSrvEtry->pNext) {
nLstn = relpSrvGetNumLstnSocks(pSrvEtry->pSrv);
const size_t allocsize = sizeof(epolld_t) * nLstn;
CHKmalloc(pSrvEtry->epevts = (epolld_t **)malloc(allocsize));
for(i = 0 ; i < nLstn ; ++i) {
sock = relpSrvGetLstnSock(pSrvEtry->pSrv, i+1);
addToEpollSet(pThis, epolld_lstn, pSrvEtry->pSrv, sock, &(pSrvEtry->epevts[i]));
}
}
finalize_it:
LEAVE_RELPFUNC;
}
static relpRetVal
engineEventLoopExit(relpEngine_t LIBRELP_ATTR_UNUSED *pThis)
{
relpEngSrvLst_t *pSrvEtry;
ENTER_RELPFUNC;
for(pSrvEtry = pThis->pSrvLstRoot ; pSrvEtry != NULL ; pSrvEtry = pSrvEtry->pNext) {
const int nLstn = relpSrvGetNumLstnSocks(pSrvEtry->pSrv);
for(int i = 0 ; i < nLstn ; ++i) {
delFromEpollSet(pThis, pSrvEtry->epevts[i]);
}
free(pSrvEtry->epevts);
}
if(pThis->efd != -1) {
close(pThis->efd);
pThis->efd = -1;
}
LEAVE_RELPFUNC;
}
static relpRetVal
handleSessIO(relpEngine_t *const pThis, epolld_t *epd)
{
relpEngSessLst_t *pSessEtry;
pSessEtry = (relpEngSessLst_t*) epd->ptr;
if(relpSessTcpRequiresRtry(pSessEtry->pSess)) {
relpTcp_t *const pTcp = pSessEtry->pSess->pTcp;
if(relpTcpRtryOp(pTcp) == relpTCP_RETRY_send) {
doSend(pThis, pSessEtry, epd->sock);
} else if(relpTcpRtryOp(pTcp) == relpTCP_RETRY_recv) {
doRecv(pThis, pSessEtry, epd->sock);
} else {
# if defined(ENABLE_TLS) || defined(ENABLE_TLS_OPENSSL)
const relpRetVal localRet = relpTcpRtryHandshake(pTcp);
if(localRet != RELP_RET_OK) {
pThis->dbgprint((char*)"relp session %d handshake iRet %d, tearing it down\n",
epd->sock, localRet);
relpEngineDelSess(pThis, pSessEtry, localRet);
}
# else
pThis->dbgprint((char*)"librelp error: handshake retry requested in "
"non-TLS mode");
# endif /* #ifdef ENABLE_TLS | ENABLE_TLS_OPENSSL*/
}
} else {
if(doRecv(pThis, pSessEtry, epd->sock) == RELP_RET_OK) {
if(epd->ev.events & EPOLLOUT) {
doSend(pThis, pSessEtry, epd->sock);
}
}
}
return RELP_RET_OK;
}
static relpRetVal
engineEventLoopRun(relpEngine_t *const pThis)
{
relpEngSessLst_t *pSessEtry;
int i;
int sock;
struct epoll_event events[128];
epolld_t *epd;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->bStop = 0;
while(!relpEngineShouldStop(pThis)) {
/* very naive implementation, O(n) - can change this once things work...
* But even the naive implementation is better than select, e.g. has no
* limit on the number of sockets.
*/
for(pSessEtry = pThis->pSessLstRoot ; pSessEtry != NULL ; pSessEtry = pSessEtry->pNext) {
sock = relpSessGetSock(pSessEtry->pSess);
# if defined(ENABLE_TLS) || defined(ENABLE_TLS_OPENSSL)
if(relpSessTcpRequiresRtry(pSessEtry->pSess)) {
pThis->dbgprint((char*)"librelp: retry op requested for sock %d\n", sock);
if(relpTcpGetRtryDirection(pSessEtry->pSess->pTcp) == 0) {
epoll_set_events(pThis, pSessEtry, sock, EPOLLIN);
} else {
epoll_set_events(pThis, pSessEtry, sock, EPOLLOUT);
}
} else
# endif /* #ifdef ENABLE_TLS | ENABLE_TLS_OPENSSL */
{
/* now check if a send request is outstanding and, if so, add it */
if(relpSendqIsEmpty(pSessEtry->pSess->pSendq)) {
epoll_set_events(pThis, pSessEtry, sock, EPOLLIN);
} else {
epoll_set_events(pThis, pSessEtry, sock, EPOLLIN | EPOLLOUT);
}
}
}
/* wait for io to become ready */
if(relpEngineShouldStop(pThis)) break;
pThis->dbgprint((char*)"librelp: doing epoll_wait\n");
const int nEvents = epoll_wait(pThis->efd, events, sizeof(events)/sizeof(struct epoll_event), -1);
pThis->dbgprint((char*)"librelp: done epoll_wait, nEvents:%d\n", nEvents);
if(relpEngineShouldStop(pThis)) break;
for(i = 0 ; i < nEvents ; ++i) {
if(relpEngineShouldStop(pThis)) break;
epd = (epolld_t*) events[i].data.ptr;
switch(epd->typ) {
case epolld_lstn:
handleConnectionRequest(pThis, epd->ptr, epd->sock);
break;
case epolld_sess:
handleSessIO(pThis, epd);
break;
default:
relpEngineCallOnGenericErr(pThis, "librelp", RELP_RET_ERR_INTERNAL,
"invalid epolld_type_t %d after epoll", epd->typ);
break;
}
}
}
LEAVE_RELPFUNC;
}
#else /* no epoll support available */
static inline relpRetVal engineEventLoopInit(relpEngine_t LIBRELP_ATTR_UNUSED *pThis) { return RELP_RET_OK; }
static inline relpRetVal engineEventLoopExit(relpEngine_t LIBRELP_ATTR_UNUSED *pThis) { return RELP_RET_OK; }
static relpRetVal
engineEventLoopRun(relpEngine_t *const pThis)
{
relpEngSrvLst_t *pSrvEtry;
relpEngSessLst_t *pSessEtry;
relpEngSessLst_t *pSessEtryNext;
relpTcp_t *pTcp;
relpRetVal localRet;
int iSocks;
int sock;
int nfds;
fd_set readfds;
fd_set writefds;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
pThis->bStop = 0;
while(!relpEngineShouldStop(pThis)) {
int maxfds = 0;
FD_ZERO(&readfds);
FD_ZERO(&writefds);
/* Add the listen sockets to the list of read descriptors. */
for(pSrvEtry = pThis->pSrvLstRoot ; pSrvEtry != NULL ; pSrvEtry = pSrvEtry->pNext) {
for(iSocks = 1 ; iSocks <= relpSrvGetNumLstnSocks(pSrvEtry->pSrv) ; ++iSocks) {
sock = relpSrvGetLstnSock(pSrvEtry->pSrv, iSocks);
FD_SET(sock, &readfds);
if(sock > maxfds) maxfds = sock;
}
}
/* Add all sessions for reception and sending (they all have just one socket) */
for(pSessEtry = pThis->pSessLstRoot ; pSessEtry != NULL ; pSessEtry = pSessEtry->pNext) {
sock = relpSessGetSock(pSessEtry->pSess);
# if defined(ENABLE_TLS) || defined(ENABLE_TLS_OPENSSL)
if(relpSessTcpRequiresRtry(pSessEtry->pSess)) {
pThis->dbgprint((char*)"librelp: retry op requested for sock %d\n", sock);
if(relpTcpGetRtryDirection(pSessEtry->pSess->pTcp) == 0) {
FD_SET(sock, &readfds);
} else {
FD_SET(sock, &writefds);
}
} else
# endif /* #ifdef ENABLE_TLS | ENABLE_TLS_OPENSSL*/
{
FD_SET(sock, &readfds);
/* now check if a send request is outstanding and, if so, add it */
if(!relpSendqIsEmpty(pSessEtry->pSess->pSendq)) {
FD_SET(sock, &writefds);
}
}
if(sock > maxfds) maxfds = sock;
}
/* done adding all sockets */
if(pThis->dbgprint != dbgprintDummy) {
pThis->dbgprint((char*)"librelp: calling select, active file descriptors (max %d): ", maxfds);
for(nfds = 0; nfds <= maxfds; ++nfds)
if(FD_ISSET(nfds, &readfds))
pThis->dbgprint((char*)"%d ", nfds);
pThis->dbgprint((char*)"\n");
}
/* wait for io to become ready */
if(relpEngineShouldStop(pThis)) break;
nfds = select(maxfds+1, (fd_set *) &readfds, &writefds, NULL, NULL);
pThis->dbgprint((char*)"relp select returns, nfds %d\n", nfds);
if(relpEngineShouldStop(pThis)) break;
if(nfds == -1) {
if(errno == EINTR) {
pThis->dbgprint((char*)"relp select interrupted\n");
} else {
pThis->dbgprint((char*)"relp select returned error %d\n", errno);
}
continue;
}
/* and then start again with the servers (new connection request) */
for(pSrvEtry = pThis->pSrvLstRoot ; nfds && pSrvEtry != NULL ; pSrvEtry = pSrvEtry->pNext) {
for(iSocks = 1 ; nfds && iSocks <= relpSrvGetNumLstnSocks(pSrvEtry->pSrv) ; ++iSocks) {
if(relpEngineShouldStop(pThis)) break;
sock = relpSrvGetLstnSock(pSrvEtry->pSrv, iSocks);
if(FD_ISSET(sock, &readfds)) {
handleConnectionRequest(pThis, pSrvEtry->pSrv, sock);
--nfds; /* indicate we have processed one */
}
}
}
/* now check if we have some action waiting for sessions */
for(pSessEtry = pThis->pSessLstRoot ; nfds && pSessEtry != NULL ; pSessEtry = pSessEtryNext) {
if(relpEngineShouldStop(pThis)) break;
pSessEtryNext = pSessEtry->pNext; /* we need to cache this as we may delete the entry! */
sock = relpSessGetSock(pSessEtry->pSess);
if(relpSessTcpRequiresRtry(pSessEtry->pSess)) {
pTcp = pSessEtry->pSess->pTcp;
if(FD_ISSET(sock, &readfds) || FD_ISSET(sock, &writefds)) {
if(relpTcpRtryOp(pTcp) == relpTCP_RETRY_send) {
doSend(pThis, pSessEtry, sock);
--nfds; /* indicate we have processed one */
} else if(relpTcpRtryOp(pTcp) == relpTCP_RETRY_recv) {
doRecv(pThis, pSessEtry, sock);
--nfds; /* indicate we have processed one */
} else {
# if defined(ENABLE_TLS) || defined(ENABLE_TLS_OPENSSL)
localRet = relpTcpRtryHandshake(pSessEtry->pSess->pTcp);
if(localRet != RELP_RET_OK) {
pThis->dbgprint((char*)"relp session %d handshake "
"iRet %d, tearing it down\n",
sock, localRet);
relpEngineDelSess(pThis, pSessEtry, localRet);
}
# else
pThis->dbgprint((char*)"librelp error: handshake retry "
"requested in non-TLS mode");
# endif /* #ifdef ENABLE_TLS | ENABLE_TLS_OPENSSL */
}
}
} else {
if(FD_ISSET(sock, &readfds)) {
if(doRecv(pThis, pSessEtry, sock) != RELP_RET_OK)
continue; /* else write may cause invld mem access! */
--nfds; /* indicate we have processed one */
}
if(FD_ISSET(sock, &writefds)) {
doSend(pThis, pSessEtry, sock);
--nfds; /* indicate we have processed one */
}
}
}
}
LEAVE_RELPFUNC;
}
#endif /* epoll/select support */
/* The "Run" method starts the relp engine. Most importantly, this means the engine begins
* to read and write data to its peers. This method must be called on its own thread as it
* will not return until the engine is finished. Note that the engine itself may (or may
* not ;)) spawn additional threads. This is an implementation detail not to be cared of by
* caller.
* Note that the engine MUST be running even if the caller intends to just SEND messages.
* This is necessary because relp is a full-duplex protcol where acks and commands (e.g.
* "abort" may be received at any time.
*
* This function is implemented as a select() server. I know that epoll() wold probably
* be much better, but I implement the first version as select() because of portability.
* Once everything has matured, we may begin to provide performance-optimized versions for
* the several flavours of enhanced OS APIs.
* rgerhards, 2008-03-17
*/
PART_OF_API relpRetVal
relpEngineRun(relpEngine_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
CHKRet(engineEventLoopInit(pThis));
engineEventLoopRun(pThis);
engineEventLoopExit(pThis);
finalize_it:
LEAVE_RELPFUNC;
}
/* as a quick hack, we provide our command handler prototypes here
* right in front of the dispatcher. This saves us many otherwise-unneeded
* header files (and will go away if we make them dynamically loadable).
* rgerhards, 2008-03-17
*/
/* core (protocol) commands */
PROTOTYPEcommand(S, Init)
PROTOTYPEcommand(S, Close)
PROTOTYPEcommand(C, Serverclose)
PROTOTYPEcommand(S, Rsp)
/* extension commands */
PROTOTYPEcommand(S, Syslog)
/* process an incoming command
* This function receives a RELP frame and dispatches it to the correct
* command handler. If the command is unknown, it responds with an error
* return state but does not process anything. The frame is NOT destructed
* by this function - this must be done by the caller.
* rgerhards, 2008-03-17
*/
relpRetVal
relpEngineDispatchFrame(relpEngine_t *const pThis, relpSess_t *pSess, relpFrame_t *pFrame)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
RELPOBJ_assert(pSess, Sess);
RELPOBJ_assert(pFrame, Frame);
pThis->dbgprint((char*)"relp engine is dispatching frame with command '%s'\n", pFrame->cmd);
/* currently, we hardcode the commands. Over time, they may be dynamically
* loaded and, when so, should come from a linked list.
* NOTE: the command handler are sorted so that most frequently used are
* at the top of the list!
*/
if(!strcmp((char*)pFrame->cmd, "syslog")) {
/* When processing Syslog frames, we ignore return code.
* Otherwise valid messages in the frame buffer will be
* discarded. And it's better to have duplicated messages
* instead of losing them.
*/
relpSCSyslog(pFrame, pSess);
} else if(!strcmp((char*)pFrame->cmd, "rsp")) {
CHKRet(relpSCRsp(pFrame, pSess));
} else if(!strcmp((char*)pFrame->cmd, "open")) {
CHKRet(relpSCInit(pFrame, pSess));
} else if(!strcmp((char*)pFrame->cmd, "close")) {
CHKRet(relpSCClose(pFrame, pSess));
} else if(!strcmp((char*)pFrame->cmd, "serverclose")) {
CHKRet(relpCCServerclose(pFrame, pSess));
} else {
pThis->dbgprint((char*)"invalid or not supported relp command '%s'\n", pFrame->cmd);
ABORT_FINALIZE(RELP_RET_INVALID_CMD);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* This relp engine function constructs a relp client and adds it to any
* necessary engine structures. As of now, there are no such structures to
* which it needs to be added, but that may change in the future. So librelp
* users should always call the client-generating functions inside the engine.
* rgerhards, 2008-03-19
*/
PART_OF_API relpRetVal
relpEngineCltConstruct(relpEngine_t *const pThis, relpClt_t **ppClt)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
assert(ppClt != NULL);
CHKRet(relpCltConstruct(ppClt, pThis));
pThis->dbgprint((char*)"relp engine created new client %p\n", (void*) *ppClt);
finalize_it:
LEAVE_RELPFUNC;
}
/* Destruct a relp client inside the engine. Counterpart to
* relpEngineCltConstruct(), see comment there for details.
* rgerhards, 2008-03-19
*/
PART_OF_API relpRetVal
relpEngineCltDestruct(relpEngine_t *const pThis, relpClt_t **ppClt)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
assert(ppClt != NULL);
RELPOBJ_assert(*ppClt, Clt);
pThis->dbgprint((char*)"relp engine destructing client %p\n", (void*) *ppClt);
CHKRet(relpCltDestruct(ppClt));
finalize_it:
LEAVE_RELPFUNC;
}
/* return a version string for librelp. This is also meant to be used during
* a configure library entry point check.
* rgerhards, 2008-03-25
*/
PART_OF_API const char *
relpEngineGetVersion(void)
{
# ifdef DEBUG
return (char*) (VERSION "(debug mode)");
# else
return (char*) (VERSION);
# endif
}
PART_OF_API void
relpEngineSetShutdownImmdtPtr(relpEngine_t *const pThis, int *ptr)
{
if(pThis->bShutdownImmdt != ptr)
pThis->bShutdownImmdt = ptr;
}
/* Enable or disable a command. Note that a command can not be enabled once
* it has been set to forbidden! There will be no error return state in this
* case. -- rgerhards, 2008-03-27
*/
PART_OF_API relpRetVal
relpEngineSetEnableCmd(relpEngine_t *const pThis, unsigned char *pszCmd, relpCmdEnaState_t stateCmd)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
assert(pszCmd != NULL);
if(!strcmp((char*)pszCmd, "syslog")) {
if(pThis->stateCmdSyslog != eRelpCmdState_Forbidden)
pThis->stateCmdSyslog = stateCmd;
} else {
pThis->dbgprint((char*)"tried to set unknown command '%s' to %d\n", pszCmd, stateCmd);
ABORT_FINALIZE(RELP_RET_UNKNOWN_CMD);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Enable (1) or Disable (0) DNS hostname resolution when accepting a remote
* session. If disabled, the IP address will be used as the hostname.
* rgerhards, 2008-03-31
*/
PART_OF_API relpRetVal
relpEngineSetDnsLookupMode(relpEngine_t *const pThis, const int iMode)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Engine);
if(iMode != 0 && iMode != 1)
ABORT_FINALIZE(RELP_RET_INVALID_PARAM);
pThis->bEnableDns = iMode;
finalize_it:
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/relpclt.h 0000644 0001750 0001750 00000005126 13607304075 011324 /* The RELPCLT object.
*
* Copyright 2008-2013 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPCLT_H_INCLUDED
#define RELPCLT_H_INCLUDED
/* the RELPCLT object
* rgerhards, 2008-03-16
*/
struct relpClt_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
relpSess_t *pSess; /**< our session (the one and only!) */
void *pUsr; /**< user pointer (opaque data) */
int bEnableTLS; /**< is TLS to be used? */
int bEnableTLSZip; /**< is compression to be used together with TLS? */
int sizeWindow; /**< size of our app-level communications window */
char *pristring; /**< priority string for GnuTLS */
relpAuthMode_t authmode;
char *caCertFile;
char *ownCertFile;
char *privKey;
char *tlsConfigCmd; /**< optional configuration command property for TLS libs **/
relpPermittedPeers_t permittedPeers;
int protFamily; /**< protocol family to connect over (IPv4, v6, ...) */
unsigned char *port; /**< server port to connect to */
unsigned char *host; /**< host(name) to connect to */
unsigned char *clientIP;/**< ip to bind to, or NULL if irrelevant */
unsigned timeout; /**< session timeout */
int connTimeout; /**< connection timeout */
};
/* prototypes */
relpRetVal relpCltConstruct(relpClt_t **ppThis, relpEngine_t *pEngine);
relpRetVal relpCltDestruct(relpClt_t **ppThis);
#endif /* #ifndef RELPCLT_H_INCLUDED */
librelp-1.13.0/src/compat/ 0000775 0001750 0001750 00000000000 15241057436 011051 5 librelp-1.13.0/src/compat/strndup.c 0000664 0001750 0001750 00000002376 15056535134 012644 /* compatibility file for systems without strndup.
*
* Copyright 2015 Rainer Gerhards and Adiscon
*
* This file is part of rsyslog.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* -or-
* see COPYING.ASL20 in the source distribution
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "config.h"
#ifndef HAVE_STRNDUP
#include
#include
extern char *strndup(const char *s, size_t n);
char *
strndup(const char *s, size_t n)
{
const size_t len = strlen(s);
char *new_s;
if(len <= n)
return strdup(s);
new_s = malloc(n+1);
if(new_s == NULL)
return NULL;
memcpy(new_s, s, n);
new_s[n] = '\0';
return new_s;
}
#else
/* ISO C forbids an empty translation unit */
static __attribute__((unused)) void dummystrndup(void) {}
#endif /* #ifndef HAVE_STRNDUP */
librelp-1.13.0/src/relpframe.c 0000664 0001750 0001750 00000032551 14354536317 011641 /* This module implements the relp frame object.
*
* Copyright 2008-2020 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include "relp.h"
#include "relpframe.h"
/** Construct a RELP frame instance
*/
static relpRetVal
relpFrameConstruct(relpFrame_t **ppThis, relpEngine_t *const pEngine)
{
relpFrame_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpFrame_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Frame);
pThis->pEngine = pEngine;
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
/** Destruct a RELP frame instance
*/
relpRetVal
relpFrameDestruct(relpFrame_t **ppThis)
{
relpFrame_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Frame);
if(pThis->pData != NULL)
free(pThis->pData);
/* done with de-init work, now free object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/* Process a received octet.
* This is a state machine. The transport driver needs to pass in octets received
* one after the other. This function builds frames and submits them for processing
* as need arises. Please note that the frame pointed to be ppThis may change during
* processing. It may be NULL after a frame has fully be processed. On Init, the
* caller can pass in a NULL pointer.
* rgerhards, 2008-03-16
*/
relpRetVal LIBRELP_ATTR_NONNULL()
relpFrameProcessOctetRcvd(relpFrame_t **const ppThis,
const relpOctet_t c,
relpSess_t *const pSess)
{
relpFrame_t *pThis;
int frame_alloced = 0;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
/* we allow NULL pointers, as we would not like to have unprocessed frame.
* Instead, a NULL frame pointer means that we have finished the previous frame
* (or did never before receive one) and so this character must be the first
* of a new frame. -- rgerhards, 2008-03-17
*/
if(pThis == NULL) {
CHKRet(relpFrameConstruct(&pThis, pSess->pEngine));
pThis->rcvState = eRelpFrameRcvState_BEGIN_FRAME;
frame_alloced = 1;
}
switch(pThis->rcvState) {
case eRelpFrameRcvState_BEGIN_FRAME:
if(!isdigit(c))
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
pThis->rcvState = eRelpFrameRcvState_IN_TXNR;
/* FALLTHROUGH */
case eRelpFrameRcvState_IN_TXNR:
if(isdigit(c)) {
if(pThis->iRcv++ == 9) { /* more than max permitted nbr of digits? */
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
}
pThis->txnr = pThis->txnr * 10 + c - '0';
} else if(c == ' ') { /* field terminator */
pThis->rcvState = eRelpFrameRcvState_IN_CMD;
pThis->iRcv = 0;
} else { /* oh, oh, invalid char! */
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
}
break;
case eRelpFrameRcvState_IN_CMD:
if(isalpha(c)) {
if(pThis->iRcv == 32) { /* more than max permitted nbr of digits? */
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
}
pThis->cmd[pThis->iRcv] = c;
++pThis->iRcv;
} else if(c == ' ') { /* field terminator */
pThis->cmd[pThis->iRcv] = '\0'; /* to make it suitable for strcmp() */
pThis->rcvState = eRelpFrameRcvState_IN_DATALEN;
pThis->iRcv = 0;
} else { /* oh, oh, invalid char! */
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
}
break;
case eRelpFrameRcvState_IN_DATALEN:
if(isdigit(c)) {
if(pThis->iRcv++ == 9) { /* more than max permitted nbr of digits? */
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
}
pThis->lenData = pThis->lenData * 10 + c - '0';
} else {
/* first check if we have no data, in which case
* we need to continue with the trailer check and skip
* the (non-present) data part. -- rgerhards, 2008-03-23
*/
if(pThis->lenData == 0) {
pThis->rcvState = eRelpFrameRcvState_IN_TRAILER;
pThis->iRcv = 0;
goto do_trailer; /* not very clean, but... */
}
/* ok, we have data, so now let's do the usual checks... */
if(c == ' ') { /* field terminator */
pSess->maxCharsStore = pThis->lenData;
if(pThis->lenData > pSess->maxDataSize) {
if(pSess->pSrv == NULL) {
/* we are a client */
relpEngineCallOnGenericErr(pSess->pEngine,
"librelp", RELP_RET_DATA_TOO_LONG,
"server response frame too long, size %zu, "
"configured max %zu -"
"session will be closed (aborted)",
pThis->lenData, pSess->maxDataSize);
ABORT_FINALIZE(RELP_RET_DATA_TOO_LONG);
}
if(pSess->pSrv->oversizeMode == RELP_OVERSIZE_ABORT) {
relpEngineCallOnGenericErr(pSess->pEngine,
"librelp", RELP_RET_DATA_TOO_LONG,
"frame too long, size %zu, configured max %zu -"
"session will be closed (aborted)",
pThis->lenData, pSess->maxDataSize);
ABORT_FINALIZE(RELP_RET_DATA_TOO_LONG);
} else if(pSess->pSrv->oversizeMode == RELP_OVERSIZE_TRUNCATE) {
relpEngineCallOnGenericErr(pSess->pEngine,
"librelp", RELP_RET_DATA_TOO_LONG,
"frame too long, size %zu, configured max %zu -"
"frame will be truncated, but session continues",
pThis->lenData, pSess->maxDataSize);
pSess->maxCharsStore = pSess->maxDataSize;
} else if(pSess->pSrv->oversizeMode == RELP_OVERSIZE_ACCEPT) {
relpEngineCallOnGenericErr(pSess->pEngine,
"librelp", RELP_RET_DATA_TOO_LONG,
"frame too long, size %zu, configured max %zu -"
"frame will still be accepted and session "
"continues. Note that this can be caused by an "
"attack on your system.",
pThis->lenData, pSess->maxDataSize);
} else {
relpEngineCallOnGenericErr(pSess->pEngine,
"librelp", RELP_RET_ERR_INTERNAL,
"librelp error: invalid oversizeMode in %s:%d "
"mode currently is %d - session aborted",
__FILE__, __LINE__, pSess->pSrv->oversizeMode);
assert(0); /* ensure termination in debug mode! */
}
}
/* we now can assign the buffer for our data */
if(pThis->lenData > 0) {
if((pThis->pData = malloc(pSess->maxCharsStore)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pThis->rcvState = eRelpFrameRcvState_IN_DATA;
pThis->iRcv = 0;
} else { /* oh, oh, invalid char! */
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
}
}
break;
case eRelpFrameRcvState_IN_DATA:
if(pThis->iRcv < pThis->lenData) {
if(pThis->iRcv < pSess->maxCharsStore) {
pThis->pData[pThis->iRcv] = c;
}
++pThis->iRcv;
break;
} else { /* end of data */
if(pSess->maxCharsStore < pThis->lenData) {
pThis->lenData = pSess->maxCharsStore;
}
pThis->rcvState = eRelpFrameRcvState_IN_TRAILER;
pThis->iRcv = 0;
}
/*FALLTHROUGH*/
case eRelpFrameRcvState_IN_TRAILER:
do_trailer:
if(c != '\n')
ABORT_FINALIZE(RELP_RET_INVALID_FRAME);
pThis->rcvState = eRelpFrameRcvState_FINISHED;
/* submit frame to processor */
/* NOTE: do not abort in any case, because we need to destruct the frame! */
if(pThis->txnr != 0 && pSess->sessType == eRelpSess_Server) {
if(pThis->txnr != pSess->txnr) {
iRet = RELP_RET_INVALID_TXNR;
} else {
pSess->txnr = relpEngineNextTXNR(pSess->txnr);
}
}
if(iRet == RELP_RET_OK) {
iRet = relpEngineDispatchFrame(pSess->pEngine, pSess, pThis);
}
relpFrameDestruct(&pThis);
break;
case eRelpFrameRcvState_FINISHED:
assert(0); /* this shall never happen */
break;
default:assert(0); /* make sure we die when debugging */
relpEngineCallOnGenericErr(pSess->pEngine,
"librelp", RELP_RET_ERR_INTERNAL,
"invalid FrameRcvState %d in %s:%d",
pThis->rcvState, __FILE__, __LINE__);
break;
}
*ppThis = pThis;
finalize_it:
// TODO:more cleanup
if(iRet != RELP_RET_OK) {
if(frame_alloced) {
relpFrameDestruct(&pThis);
}
}
LEAVE_RELPFUNC;
}
/* Update an already-existing Sendbuf with a new txnr. This function is needed
* during recovery of failed connections where a queue of unsent messages
* exists.
* rgerhards, 2008-03-23
*/
relpRetVal
relpFrameRewriteTxnr(relpSendbuf_t *pSendbuf, relpTxnr_t txnr)
{
char bufTxnr[16];
size_t lenTxnr;
relpOctet_t *ptrMembuf;
ENTER_RELPFUNC;
RELPOBJ_assert(pSendbuf, Sendbuf);
pSendbuf->txnr = txnr;
lenTxnr = snprintf(bufTxnr, sizeof(bufTxnr), "%d", (int) txnr);
if(lenTxnr > 9)
ABORT_FINALIZE(RELP_RET_INVALID_TXNR);
/* we have always enough space inside the frame to patch in the new
* txnr - it was reserved during initial frame creation. So now patch it...
*/
ptrMembuf = pSendbuf->pData + 9 - lenTxnr; /* set ptr to start of area we intend to write to */
pSendbuf->lenData = pSendbuf->lenData - pSendbuf->lenTxnr + lenTxnr;
pSendbuf->lenTxnr = lenTxnr;
memcpy(ptrMembuf, bufTxnr, lenTxnr);
/* the rest of the frame remains unchanged */
finalize_it:
LEAVE_RELPFUNC;
}
/* create a relpSendbuf_t with a valid relp frame. While this is a frame object
* function, it does not accept the frame object itself but rather the individual
* frame parameters. The reason is that we want to save the overhead of constructing
* and desructing a frame object in cases where the frame object itself is not
* needed (e.g. when sending a "rsp" frame). This method
* is meant to be invoked immediately before sending a frame. So the txnr must
* be passed in, as it is at the top of the frame. Note that it should only be called
* from within a mutex-protected region that ensures the txnr remains
* consistent. The sendbuf is allocated inside this function
* and a pointer to it passed to the caller. The caller is responsible
* for destructing it. -- rgerhards, 2008-03-19
*/
relpRetVal
relpFrameBuildSendbuf(relpSendbuf_t **ppSendbuf, relpTxnr_t txnr, unsigned char *pCmd, const size_t lenCmd,
relpOctet_t *pData, size_t lenData, relpSess_t *pSess,
relpRetVal (*rspHdlr)(relpSess_t*, relpFrame_t*))
{
char bufTxnr[16];
size_t lenTxnr;
char bufDatalen[16];
size_t lenDatalen;
relpSendbuf_t *pSendbuf = NULL;
relpOctet_t *ptrMembuf;
ENTER_RELPFUNC;
assert(ppSendbuf != NULL);
CHKRet(relpSendbufConstruct(&pSendbuf, pSess));
pSendbuf->txnr = txnr;
pSendbuf->rspHdlr = rspHdlr;
lenTxnr = snprintf(bufTxnr, sizeof(bufTxnr), "%d", (int) txnr);
if(lenTxnr > 9)
ABORT_FINALIZE(RELP_RET_INVALID_TXNR);
lenDatalen = snprintf(bufDatalen, sizeof(bufDatalen), "%d", (int) lenData);
if(lenDatalen > 9)
ABORT_FINALIZE(RELP_RET_INVALID_DATALEN);
/* we got everything, so now let's get our membuf [+1 for SP's and TRAILER]
* We do a trick in our calculation: we always assign 9 bytes for the txnr, even
* though it may be less than that. The reason is that on a sessin recovery case,
* we can put another, potentially longer, txnr into the frame. This saves us from
* copying the while frame just to adjust the txnr. -- rgerhards, 2008-03-23
*/
pSendbuf->lenData = lenTxnr + 1 + lenCmd + 1 + lenDatalen + 1;
if(lenData > 0)
pSendbuf->lenData += 1 + lenData;
if((pSendbuf->pData = malloc(pSendbuf->lenData + (9 - lenTxnr) + 1)) == NULL)
// remove +1 above (for debugging only!)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
ptrMembuf = pSendbuf->pData + 9 - lenTxnr; /* set ptr to start of area we intend to write to */
pSendbuf->lenTxnr = lenTxnr;
memcpy(ptrMembuf, bufTxnr, lenTxnr); ptrMembuf += lenTxnr;
*ptrMembuf++ = ' ';
memcpy(ptrMembuf, pCmd, lenCmd); ptrMembuf += lenCmd;
*ptrMembuf++ = ' ';
memcpy(ptrMembuf, bufDatalen, lenDatalen); ptrMembuf += lenDatalen;
if(lenData > 0) {
/* a data part (and its SP-delemiter) is only written if there is data... */
*ptrMembuf++ = ' ';
memcpy(ptrMembuf, pData, lenData); ptrMembuf += lenData;
}
*ptrMembuf = '\n';
*++ptrMembuf = '\0'; /* just for the dbgprint below */
*ppSendbuf = pSendbuf; /* save new buffer */
finalize_it:
if(iRet != RELP_RET_OK) {
if(pSendbuf != NULL)
relpSendbufDestruct(&pSendbuf);
}
LEAVE_RELPFUNC;
}
/* return the next character from the framebuf or indicate end of buffer (-1).
* rgerhards, 2008-03-24
*/
relpRetVal
relpFrameGetNextC(relpFrame_t *const pThis, unsigned char *const pC)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Frame);
assert(pC != NULL);
if(pThis->idxData >= pThis->lenData)
iRet = RELP_RET_END_OF_DATA;
else
*pC = pThis->pData[pThis->idxData++];
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/copen.c 0000664 0001750 0001750 00000015750 15241030422 010750 /* The command handler for server-based "open" (after reception)
*
* Copyright 2008-2018 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some development funding.
*/
#include "config.h"
#include
#include
#include
#include
#include "relp.h"
#include "offers.h"
#include "cmdif.h"
/* as a quick hack, we provide our command handler prototypes here
* right in front of the dispatcher. This saves us many otherwise-unneeded
* header files (and will go away if we make them dynamically loadable).
* alorbach, 2020-09-09
*/
/* core (protocol) commands */
PROTOTYPEcommand(S, Init)
/* Select which offers to use during a session. This takes the client offers
* and constructs a new server offers object based on it. This new object
* contains only what we support (and require, so we may actually add
* something to the offer).
* rgerhards, 2008-03-25
*/
static relpRetVal
selectOffers(relpSess_t *pSess, relpOffers_t *pCltOffers, relpOffers_t **ppSrvOffers)
{
relpEngine_t *pEngine;
relpOffer_t *pOffer;
relpOfferValue_t *pOfferVal;
ENTER_RELPFUNC;
assert(ppSrvOffers != NULL);
RELPOBJ_assert(pCltOffers, Offers);
RELPOBJ_assert(pSess, Sess);
pEngine = pSess->pEngine;
/* we loop through the offers and set session parameters */
for(pOffer = pCltOffers->pRoot ; pOffer != NULL ; pOffer = pOffer->pNext) {
pEngine->dbgprint((char*)"processing client offer '%s'\n", pOffer->szName);
if(!strcmp((char*)pOffer->szName, "relp_version")) {
if(pOffer->pValueRoot == NULL)
ABORT_FINALIZE(RELP_RET_INVALID_OFFER);
if(pOffer->pValueRoot->intVal == -1)
ABORT_FINALIZE(RELP_RET_INVALID_OFFER);
if(pOffer->pValueRoot->intVal > pEngine->protocolVersion)
relpSessSetProtocolVersion(pSess, pEngine->protocolVersion);
else
relpSessSetProtocolVersion(pSess, pOffer->pValueRoot->intVal);
} else if(!strcmp((char*)pOffer->szName, "commands")) {
for(pOfferVal = pOffer->pValueRoot ; pOfferVal != NULL ; pOfferVal = pOfferVal->pNext) {
pSess->pEngine->dbgprint((char*)"cmd syslog state in srv session: %d\n", pSess->stateCmdSyslog);
if( pSess->stateCmdSyslog == eRelpCmdState_Desired
|| pSess->stateCmdSyslog == eRelpCmdState_Required) {
/* we do not care about return code in this case */
relpSessSetEnableCmd(pSess, pOfferVal->szVal, eRelpCmdState_Enabled);
}
}
} else if(!strcmp((char*)pOffer->szName, "relp_software")) {
/* we know this parameter, but we do not do anything
* with it -- this may change if we need to emulate
* something based on known bad relp software behaviour.
*/
} else {
/* if we do not know an offer name, we ignore it - in this
* case, we may simply not support it (but the client does and
* must now live without it...)
*/
pEngine->dbgprint((char*)"ignoring unknown client offer '%s'\n", pOffer->szName);
}
}
/* now we have processed the client offers, so now we can check if it supports
* everything that we required. A required feature is detected by the "Required"
* state still being set. If the client would support it, it by now would have
* changed to "Enabled". Also, while we are at it, we change those feature to
* disabled which are still just "desired" - the client obviously had a different
* desire and so we can not use them ;) -- rgerhards, 2008-03-27
*/
if(pSess->stateCmdSyslog == eRelpCmdState_Required) {
ABORT_FINALIZE(RELP_RET_RQD_FEAT_MISSING);
}
if(pSess->stateCmdSyslog == eRelpCmdState_Desired) {
CHKRet(relpSessSetEnableCmd(pSess, (unsigned char *)"syslog", eRelpCmdState_Disabled));
}
/* We are happy with the client offers, so now we can construct
* our own offers based on what is set in the session parameters.
*/
CHKRet(relpSessConstructOffers(pSess, ppSrvOffers));
finalize_it:
LEAVE_RELPFUNC;
}
/* process the "open" command
* rgerhards, 2008-03-17
*/
BEGINcommand(S, Init)
relpOffers_t *pCltOffers = NULL;
relpOffers_t *pSrvOffers = NULL;
unsigned char *pszSrvOffers = NULL;
size_t lenSrvOffers;
char szErrMsg[80];
size_t lenErrMsg;
ENTER_RELPFUNC;
pSess->pEngine->dbgprint((char*)"in open command handler\n");
if(pSess->bServerConnOpen) {
if(pSess->pEngine->onErr) { // TODO: generalize!
pSess->pEngine->onErr(pSess->pUsr, (char*) "session", (char*) "received session open "
"request for already open session - aborting session",
RELP_RET_INVALID_FRAME);
}
unsigned char replymsg[] = "500 protocol error: connection already open";
relpSessSendResponse(pSess, pFrame->txnr, replymsg, sizeof(replymsg) - 1);
ABORT_FINALIZE(RELP_RET_SESSION_OPEN);
}
CHKRet(relpOffersConstructFromFrame(&pCltOffers, pFrame));
CHKRet(selectOffers(pSess, pCltOffers, &pSrvOffers));
/* we got our offers together, so we now can send the response */
CHKRet(relpOffersToString(pSrvOffers, (unsigned char*)"200 OK\n", 7, &pszSrvOffers, &lenSrvOffers));
CHKRet(relpSessSendResponse(pSess, pFrame->txnr, pszSrvOffers, lenSrvOffers));
pSess->bServerConnOpen = 1;
if(pSess->pEngine->onSessOpen != NULL) {
pSess->pEngine->onSessOpen(pSess->pUsr, pSess);
}
finalize_it:
if(pszSrvOffers != NULL)
free(pszSrvOffers);
if(pCltOffers != NULL)
relpOffersDestruct(&pCltOffers);
if(pSrvOffers != NULL)
relpOffersDestruct(&pSrvOffers);
if(iRet != RELP_RET_OK) {
if(!pSess->bServerConnOpen && pSess->pEngine->onSessOpenFail != NULL) {
pSess->pEngine->onSessOpenFail(pSess->pUsr, pSess, iRet);
}
if(iRet == RELP_RET_RQD_FEAT_MISSING) {
strncpy(szErrMsg, "500 required command not supported by client", sizeof(szErrMsg));
lenErrMsg = 44;
} else {
lenErrMsg = snprintf(szErrMsg, sizeof(szErrMsg), "500 error %d on connect", iRet);
}
if(lenErrMsg > sizeof(szErrMsg))
lenErrMsg = 80; /* truncate */
relpSessSendResponse(pSess, pFrame->txnr, (unsigned char*)szErrMsg, lenErrMsg);
}
ENDcommand
librelp-1.13.0/src/scrsp.c 0000644 0001750 0001750 00000010227 13734555715 011014 /* The command handler for the "rsp" command (done at the client).
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include "librelp.h"
#include "relp.h"
#include "cmdif.h"
/* as a quick hack, we provide our command handler prototypes here
* right in front of the dispatcher. This saves us many otherwise-unneeded
* header files (and will go away if we make them dynamically loadable).
* alorbach, 2020-09-09
*/
/* core (protocol) commands */
PROTOTYPEcommand(S, Rsp)
/* read the response header. The frame's pData read pointer is moved to the
* first byte of the response data buffer (if any).
* rgerhards, 2008-03-24
*/
static relpRetVal
readRspHdr(relpFrame_t *pFrame, int *pCode, unsigned char *pText)
{
int iText;
unsigned char c;
relpRetVal localRet;
ENTER_RELPFUNC;
/* code - it must be exactly three digits */
CHKRet(relpFrameGetNextC(pFrame, &c));
if(isdigit(c)) *pCode = c - '0'; else ABORT_FINALIZE(RELP_RET_INVALID_RSPHDR);
CHKRet(relpFrameGetNextC(pFrame, &c));
if(isdigit(c)) *pCode = *pCode * 10 + c - '0'; else ABORT_FINALIZE(RELP_RET_INVALID_RSPHDR);
CHKRet(relpFrameGetNextC(pFrame, &c));
if(isdigit(c)) *pCode = *pCode * 10 + c - '0'; else ABORT_FINALIZE(RELP_RET_INVALID_RSPHDR);
CHKRet(relpFrameGetNextC(pFrame, &c));
if(c != ' ') ABORT_FINALIZE(RELP_RET_INVALID_RSPHDR);
/* now come the message. It is terminated after 80 chars or when an LF
* is found (the LF is the delemiter to response data) or there is no
* more data.
*/
for(iText = 0 ; iText < 80 ; ++iText) {
localRet = relpFrameGetNextC(pFrame, &c);
if(localRet == RELP_RET_END_OF_DATA)
break;
else if(localRet != RELP_RET_OK)
ABORT_FINALIZE(localRet);
if(c == '\n')
break;
/* we got a regular char which we need to copy */
pText[iText] = c;
}
pText[iText] = '\0'; /* make it a C-string */
finalize_it:
LEAVE_RELPFUNC;
}
/* process a response
* rgerhards, 2008-03-17
*/
BEGINcommand(S, Rsp)
relpSendbuf_t *pSendbuf;
unsigned char bufText[81]; /* max 80 chars as of RELP spec! */
int rspCode;
ENTER_RELPFUNC;
CHKRet(readRspHdr(pFrame, &rspCode, bufText));
pSess->pEngine->dbgprint((char*)"in rsp command handler, txnr %d, code %d, text '%s'\n",
pFrame->txnr, rspCode, bufText);
CHKRet(relpSessGetUnacked(pSess, &pSendbuf, pFrame->txnr));
if(rspCode == 200) {
if(pSendbuf->rspHdlr != NULL) {
CHKRet(pSendbuf->rspHdlr(pSess, pFrame));
}
CHKRet(relpSendbufDestruct(&pSendbuf));
} else {
if(pSess->pEngine->onErr != NULL) {
pSess->pEngine->onErr(pSess->pUsr, (char*)"rsp command",
(char*)"peer sent error response", RELP_RET_RSP_STATE_ERR);
}
iRet = RELP_RET_RSP_STATE_ERR;
/* TODO: add a hock to a logger function of the caller */
relpSendbufDestruct(&pSendbuf); /* don't set error code */
}
finalize_it:
ENDcommand
librelp-1.13.0/src/dbllinklist.h 0000644 0001750 0001750 00000004642 13273030644 012171 /* Some support macros for doubly linked lists.
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef DBLLINKLIST_H_INCLUDED
#define DBLLINKLIST_H_INCLUDED
/* DLL means "doubly linked list". A class utilizing this macros
* must define a pNext and pPrev pointer inside the list elements and
* it must also define a root and last pointer. Please note that the
* macros are NOT thread-safe. If you intend to use them in a threaed
* environment, you must use proper synchronization.
* NOTE: the caller must free the unlinked object, this is NOT done
* in the macro!
*/
#define DLL_Del(pThis, pRoot, pLast) \
if(pThis->pPrev != NULL) \
pThis->pPrev->pNext = pThis->pNext; \
if(pThis->pNext != NULL) \
pThis->pNext->pPrev = pThis->pPrev; \
if(pThis == pRoot) \
pRoot = pThis->pNext; \
if(pThis == pLast) \
pLast = pThis->pPrev;
/* elements are always added to the tail of the list */
#define DLL_Add(pThis, pRoot, pLast) \
if(pRoot == NULL) { \
pRoot = pThis; \
pLast = pThis; \
} else { \
pThis->pPrev = pLast; \
pLast->pNext = pThis; \
pLast = pThis; \
}
#endif /* #ifndef DBLLINKLIST_H_INCLUDED */
librelp-1.13.0/src/cserverclose.c 0000644 0001750 0001750 00000004336 13734555715 012365 /* The command handler for "serverclose" hint.
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some development funding.
*/
#include "config.h"
#include
#include
#include
#include "relp.h"
#include "cmdif.h"
/* as a quick hack, we provide our command handler prototypes here
* right in front of the dispatcher. This saves us many otherwise-unneeded
* header files (and will go away if we make them dynamically loadable).
* alorbach, 2020-09-09
*/
/* core (protocol) commands */
PROTOTYPEcommand(C, Serverclose)
/* process the command
* Note: this is a hint, so we do not (and MUST NOT) send a response.
* rgerhards, 2008-03-31
*/
BEGINcommand(C, Serverclose)
ENTER_RELPFUNC;
pSess->pEngine->dbgprint((char*)"in serverclose command handler\n");
/* We use state "broken" so that our usual recovery can kick in */
relpSessSetSessState(pSess, eRelpSessState_BROKEN);
iRet = RELP_RET_SESSION_CLOSED; /* indicate close condition */
ENDcommand
librelp-1.13.0/src/tcp.c 0000664 0001750 0001750 00000356756 15241057272 010464 /* This implements the relp mapping onto TCP.
*
* Copyright 2008-2025 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Note: gnutls_certificate_set_verify_function is problematic, as it
* is not available in old GnuTLS versions, but rather important
* for verifying certificates correctly.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "relp.h"
#include "relpsrv.h"
#include "relpclt.h"
#include "relpsess.h"
#include "tcp.h"
#ifdef ENABLE_TLS
# include
# include
# if GNUTLS_VERSION_NUMBER <= 0x020b00
# include
GCRY_THREAD_OPTION_PTHREAD_IMPL;
# endif
static int called_gnutls_global_init = 0;
#endif
#ifdef ENABLE_TLS_OPENSSL
# include
# include
# include
# if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
# include
# endif
/* OpenSSL API differences */
# if OPENSSL_VERSION_NUMBER >= 0x10100000L
# define RSYSLOG_X509_NAME_oneline(X509CERT) X509_get_subject_name(X509CERT)
# define RSYSLOG_BIO_method_name(SSLBIO) BIO_method_name(SSLBIO)
# define RSYSLOG_BIO_number_read(SSLBIO) BIO_number_read(SSLBIO)
# define RSYSLOG_BIO_number_written(SSLBIO) BIO_number_written(SSLBIO)
# else
# include
# define RSYSLOG_X509_NAME_oneline(X509CERT) (X509CERT != NULL ? X509CERT->cert_info->subject : NULL)
# define RSYSLOG_BIO_method_name(SSLBIO) SSLBIO->method->name
# define RSYSLOG_BIO_number_read(SSLBIO) SSLBIO->num
# define RSYSLOG_BIO_number_written(SSLBIO) SSLBIO->num
# endif
#endif /* #ifdef ENABLE_TLS_OPENSSL */
#ifndef SOL_TCP
# define SOL_TCP (getprotobyname("tcp")->p_proto)
#endif
/* AIX: MSG_DONTWAIT not supported */
#if defined(_AIX) && !defined(MSG_DONTWAIT)
#define MSG_DONTWAIT MSG_NONBLOCK
#endif
static relpRetVal LIBRELP_ATTR_NONNULL() relpTcpAcceptConnReqInitTLS(NOTLS_UNUSED relpTcp_t *const pThis,
NOTLS_UNUSED relpSrv_t *const pSrv);
static relpRetVal relpTcpPermittedPeerWildcardCompile(tcpPermittedPeerEntry_t *pEtry);
static relpRetVal LIBRELP_ATTR_NONNULL() relpTcpLstnInitTLS(relpTcp_t *const pThis);
static relpRetVal LIBRELP_ATTR_NONNULL() relpTcpTLSSetPrio(relpTcp_t *const pThis);
/* helper to call onErr if set */
static void
callOnErr(const relpTcp_t *__restrict__ const pThis,
char *__restrict__ const emsg,
const relpRetVal ecode)
{
char objinfo[1024];
pThis->pEngine->dbgprint((char*)"librelp: generic error: ecode %d, "
"emsg '%s'\n", ecode, emsg);
if(pThis->pEngine->onErr != NULL) {
if(pThis->pSrv == NULL) { /* client */
snprintf(objinfo, sizeof(objinfo), "conn to srvr %s:%s",
pThis->pClt->pSess->srvAddr,
pThis->pClt->pSess->srvPort);
} else if(pThis->pRemHostIP == NULL) { /* server listener */
snprintf(objinfo, sizeof(objinfo), "lstn %s",
pThis->pSrv->pLstnPort);
} else { /* server connection to client */
snprintf(objinfo, sizeof(objinfo), "lstn %s: conn to clt %s/%s",
pThis->pSrv->pLstnPort, pThis->pRemHostIP,
pThis->pRemHostName);
}
objinfo[sizeof(objinfo)-1] = '\0';
pThis->pEngine->onErr(pThis->pUsr, objinfo, emsg, ecode);
}
}
#if defined(WITH_TLS)
/* forward definitions */
static int LIBRELP_ATTR_NONNULL() relpTcpGetCN(char *const namebuf, const size_t lenNamebuf, const char *const szDN);
#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
static int relpTcpVerifyCertificateCallback(gnutls_session_t session);
static int relpTcpChkPeerName(relpTcp_t *const pThis, void* cert);
#endif /* #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
#if defined(HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION) || defined(ENABLE_TLS_OPENSSL)
static void relpTcpChkOnePeerName(relpTcp_t *const pThis, char *peername, int *pbFoundPositiveMatch);
static int relpTcpAddToCertNamesBuffer(relpTcp_t *const pThis, char *const buf,
const size_t buflen, int *p_currIdx, const char *const certName);
#endif /* defined(HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION) || defined(ENABLE_TLS_OPENSSL) */
/* helper to free permittedPeer structure */
static inline void
relpTcpFreePermittedPeers(relpTcp_t *const pThis)
{
int i;
for(i = 0 ; i < pThis->permittedPeers.nmemb ; ++i) {
tcpPermittedPeerWildcardComp_t *pWildcard;
tcpPermittedPeerWildcardComp_t *pWildcardToDel;
free(pThis->permittedPeers.peer[i].name);
for(pWildcard = pThis->permittedPeers.peer[i].wildcardRoot ; pWildcard != NULL ; ) {
pWildcardToDel = pWildcard;
pWildcard = pWildcard->pNext;
free(pWildcardToDel->pszDomainPart);
free(pWildcardToDel);
}
}
pThis->permittedPeers.nmemb = 0;
free(pThis->permittedPeers.peer);
pThis->permittedPeers.peer = NULL;
}
/* helper to call onAuthErr if set */
static inline void
callOnAuthErr(relpTcp_t *const pThis, const char *authdata, const char *emsg, relpRetVal ecode)
{
pThis->pEngine->dbgprint((char*)"librelp: auth error: authdata:'%s', ecode %d, "
"emsg '%s'\n", authdata, ecode, emsg);
if(pThis->pEngine->onAuthErr != NULL) {
pThis->pEngine->onAuthErr(pThis->pUsr, (char*)authdata, (char*)emsg, ecode);
}
}
#endif /* #ifdef WITH_TLS */
#ifdef ENABLE_TLS_OPENSSL
/* Helper to detect when OpenSSL is initialized */
static int called_openssl_global_init = 0;
/* Main OpenSSL CTX pointer */
static SSL_CTX *ctx = NULL;
static pthread_mutex_t mutSsl;
/*--------------------------------------MT OpenSSL helpers ------------------------------------------*/
static MUTEX_TYPE *mutex_buf = NULL;
void locking_function(int mode, int n,
LIBRELP_ATTR_UNUSED const char * file, LIBRELP_ATTR_UNUSED int line)
{
if (mode & CRYPTO_LOCK)
MUTEX_LOCK(mutex_buf[n]);
else
MUTEX_UNLOCK(mutex_buf[n]);
}
unsigned long id_function(void)
{
return ((unsigned long)THREAD_ID);
}
struct CRYPTO_dynlock_value * dyn_create_function(
LIBRELP_ATTR_UNUSED const char *file, LIBRELP_ATTR_UNUSED int line)
{
struct CRYPTO_dynlock_value *value;
value = (struct CRYPTO_dynlock_value *)malloc(sizeof(struct CRYPTO_dynlock_value));
if (!value)
return NULL;
MUTEX_SETUP(value->mutex);
return value;
}
void dyn_lock_function(int mode, struct CRYPTO_dynlock_value *l,
LIBRELP_ATTR_UNUSED const char *file, LIBRELP_ATTR_UNUSED int line)
{
if (mode & CRYPTO_LOCK)
MUTEX_LOCK(l->mutex);
else
MUTEX_UNLOCK(l->mutex);
}
void dyn_destroy_function(struct CRYPTO_dynlock_value *l,
LIBRELP_ATTR_UNUSED const char *file, LIBRELP_ATTR_UNUSED int line)
{
MUTEX_CLEANUP(l->mutex);
free(l);
}
/* set up support functions for openssl multi-threading. This must
* be done at library initialisation. If the function fails,
* processing can not continue normally. On failure, 0 is
* returned, on success 1.
*/
int opensslh_THREAD_setup(void)
{
int i;
mutex_buf = (MUTEX_TYPE *)malloc(CRYPTO_num_locks( ) * sizeof(MUTEX_TYPE));
if (mutex_buf == NULL)
return 0;
for (i = 0; i < CRYPTO_num_locks( ); i++)
MUTEX_SETUP(mutex_buf[i]);
#if OPENSSL_VERSION_NUMBER < 0x10100000L
CRYPTO_set_id_callback(id_function);
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
CRYPTO_set_locking_callback(locking_function);
/* The following three CRYPTO_... functions are the OpenSSL functions
for registering the callbacks we implemented above */
CRYPTO_set_dynlock_create_callback(dyn_create_function);
CRYPTO_set_dynlock_lock_callback(dyn_lock_function);
CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function);
return 1;
}
/* shut down openssl - do this only when you are totally done
* with openssl.
*/
int opensslh_THREAD_cleanup(void)
{
int i;
if (!mutex_buf)
return 0;
#if OPENSSL_VERSION_NUMBER < 0x10100000L
CRYPTO_set_id_callback(NULL);
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
CRYPTO_set_locking_callback(NULL);
CRYPTO_set_dynlock_create_callback(NULL);
CRYPTO_set_dynlock_lock_callback(NULL);
CRYPTO_set_dynlock_destroy_callback(NULL);
for (i = 0; i < CRYPTO_num_locks( ); i++)
MUTEX_CLEANUP(mutex_buf[i]);
free(mutex_buf);
mutex_buf = NULL;
return 1;
}
/*--------------------------------------MT OpenSSL helpers ------------------------------------------*/
/* OpenSSL Helper functions */
/* OpenSSL implementation of TLS funtions.
* alorbach, 2018-06-11
*/
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
long BIO_debug_callback_ex(BIO *bio, int cmd, const char LIBRELP_ATTR_UNUSED *argp,
size_t LIBRELP_ATTR_UNUSED len, int argi, long LIBRELP_ATTR_UNUSED argl,
int ret, size_t LIBRELP_ATTR_UNUSED *processed)
#else
long BIO_debug_callback(BIO *bio, int cmd, const char LIBRELP_ATTR_UNUSED *argp,
int argi, long LIBRELP_ATTR_UNUSED argl, long ret)
#endif
{
long ret2 = ret; // Helper value to avoid printf compile errors long<>int
long r = 1;
relpTcp_t* pThis = (relpTcp_t*) (void *) BIO_get_callback_arg(bio);
if (BIO_CB_RETURN & cmd)
r = ret;
switch (cmd) {
case BIO_CB_FREE:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: Free - %s\n",
(void *)bio, RSYSLOG_BIO_method_name(bio));
break;
/* Disabled due API changes for OpenSSL 1.1.0+ */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
case BIO_CB_READ:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: read(%d,%lu) - %s fd=%d\n",
(void *)bio,
RSYSLOG_BIO_number_read(bio), (unsigned long)argi,
RSYSLOG_BIO_method_name(bio), RSYSLOG_BIO_number_read(bio));
else
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: read(%d,%lu) - %s\n",
(void *)bio,
RSYSLOG_BIO_number_read(bio), (unsigned long)argi, RSYSLOG_BIO_method_name(bio));
break;
case BIO_CB_WRITE:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: write(%d,%lu) - %s fd=%d\n",
(void *)bio,
RSYSLOG_BIO_number_written(bio), (unsigned long)argi,
RSYSLOG_BIO_method_name(bio), RSYSLOG_BIO_number_written(bio));
else
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: write(%d,%lu) - %s\n",
(void *)bio,
RSYSLOG_BIO_number_written(bio), (unsigned long)argi, RSYSLOG_BIO_method_name(bio));
break;
#else
case BIO_CB_READ:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: read %s\n",
(void *)bio,
RSYSLOG_BIO_method_name(bio));
break;
case BIO_CB_WRITE:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: write %s\n",
(void *)bio,
RSYSLOG_BIO_method_name(bio));
break;
#endif
case BIO_CB_PUTS:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: puts() - %s\n",
(void *)bio,
RSYSLOG_BIO_method_name(bio));
break;
case BIO_CB_GETS:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: gets(%lu) - %s\n",
(void *)bio,
(unsigned long)argi,
RSYSLOG_BIO_method_name(bio));
break;
case BIO_CB_CTRL:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: ctrl(%lu) - %s\n",
(void *)bio,
(unsigned long)argi,
RSYSLOG_BIO_method_name(bio));
break;
case BIO_CB_RETURN | BIO_CB_READ:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: read return %ld\n",
(void *)bio,
ret2);
break;
case BIO_CB_RETURN | BIO_CB_WRITE:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: write return %ld\n",
(void *)bio,
ret2);
break;
case BIO_CB_RETURN | BIO_CB_GETS:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: gets return %ld\n",
(void *)bio,
ret2);
break;
case BIO_CB_RETURN | BIO_CB_PUTS:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: puts return %ld\n",
(void *)bio,
ret2);
break;
case BIO_CB_RETURN | BIO_CB_CTRL:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: ctrl return %ld\n",
(void *)bio,
ret2);
break;
default:
pThis->pEngine->dbgprint((char*)"openssl debugmsg: BIO[%p]: bio callback - unknown type (%d)\n",
(void *)bio,
cmd);
break;
}
return (r);
}
void relpTcpLastSSLErrorMsg(int ret, relpTcp_t *const pThis, const char* pszCallSource)
{
unsigned long un_error = 0;
char psz[256];
char errstr[512];
char errmsg[1024];
/* Save errno */
int org_errno = errno;
if (pThis->ssl == NULL) {
/* Output Error Info*/
pThis->pEngine->dbgprint((char*)"relpTcpLastSSLErrorMsg: %s Error %d\n", pszCallSource, ret);
} else {
// Get Error details
long iSSLErr = SSL_get_error(pThis->ssl, ret);
ERR_error_string_n(iSSLErr, errstr, sizeof(errstr));
/* Output error message */
pThis->pEngine->dbgprint((char*)"relpTcpLastSSLErrorMsg: %s Error %s: %s(%ld) (ret=%d, errno=%d)\n",
pszCallSource,
(iSSLErr == SSL_ERROR_SSL ? "SSL_ERROR_SSL" :
(iSSLErr == SSL_ERROR_SYSCALL ? "SSL_ERROR_SYSCALL" : "SSL_ERROR_UNKNOWN")),
errstr, iSSLErr, ret, org_errno);
}
/* Loop through errors */
while ((un_error = ERR_get_error()) > 0){
ERR_error_string_n(un_error, psz, 256);
snprintf(errmsg, sizeof(errmsg),"relpTcpLastSSLErrorMsg: OpenSSL Error Stack: %s\n", psz);
callOnErr(pThis, errmsg, RELP_RET_ERR_TLS);
}
}
// TODO: openssl vs. gnutls?
/* Convert a fingerprint to printable data. The conversion is carried out
* according IETF I-D syslog-transport-tls-12. The fingerprint string is
*/
static relpRetVal
GenFingerprintStr_ossl(unsigned char *pFingerprint, size_t sizeFingerprint,
char * fpBuf,const size_t bufLen)
{
size_t iSrc, iDst;
ENTER_RELPFUNC;
if (bufLen <= 5) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
strncpy(fpBuf,"SHA1", bufLen);
iDst=4;
for(iSrc = 0; iSrc < sizeFingerprint && iSrc < bufLen; ++iSrc, iDst += 3) {
sprintf(fpBuf+iDst, ":%2.2X", (unsigned char) pFingerprint[iSrc]);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Check the peer's ID in fingerprint auth mode. */
static int
relpTcpChkPeerFingerprint_ossl(relpTcp_t *const pThis, X509* cert)
{
int i;
unsigned int n;
unsigned char fingerprint[20 /*EVP_MAX_MD_SIZE*/];
char fpPrintable[256];
size_t size;
int bFoundPositiveMatch;
const EVP_MD *fdig = EVP_sha1();
ENTER_RELPFUNC;
/* obtain the SHA1 fingerprint */
size = sizeof(fingerprint);
if (!X509_digest(cert,fdig,fingerprint,&n)) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerFingerprint: error X509cert is not valid!\n");
ABORT_FINALIZE(RELP_RET_ERR_TLS);
}
// TODO: fingerprint gtls vs ossl
GenFingerprintStr_ossl(fingerprint, size, fpPrintable,sizeof(fpPrintable));
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerFingerprint: "
"peer's certificate SHA1 fingerprint: %s\n", fpPrintable);
/* now search through the permitted peers to see if we can find a permitted one */
bFoundPositiveMatch = 0;
for(i = 0 ; i < pThis->permittedPeers.nmemb ; ++i)
{
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerFingerprint: checking peer '%s','%s'\n",
fpPrintable, pThis->permittedPeers.peer[i].name);
if(!strcmp(fpPrintable, pThis->permittedPeers.peer[i].name)) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerFingerprint: "
"peer's certificate MATCH found: %s\n",
pThis->permittedPeers.peer[i].name);
bFoundPositiveMatch = 1;
break;
}
}
if(!bFoundPositiveMatch) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerFingerprint: invalid peer fingerprint, "
"not permitted to talk to it\n");
callOnAuthErr(pThis, fpPrintable, "non-permited fingerprint", RELP_RET_AUTH_ERR_FP);
ABORT_FINALIZE(RELP_RET_AUTH_ERR_FP);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Check the peer's ID in name auth mode. */
static int
relpTcpChkPeerName_ossl(relpTcp_t *const pThis, void *vcert)
{
int r;
int bFoundPositiveMatch = 0;
char *x509name = NULL;
char allNames[32*1024]; /* work buffer */
int iAllNames = 0;
X509 *cert = (X509*)vcert;
/* Helpers for altName */
int iLoop;
int san_names_nb = -1;
GENERAL_NAMES *san_names = NULL;
GENERAL_NAME *gnDnsName;
int gtype;
ASN1_STRING *asDnsName;
const char *szAltName;
ENTER_RELPFUNC;
bFoundPositiveMatch = 0;
/* Obtain Namex509 name from subject */
x509name = X509_NAME_oneline(RSYSLOG_X509_NAME_oneline(cert), NULL, 0);
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_ossl: checking - peername '%s'\n", x509name);
if((r = relpTcpGetCN(allNames, sizeof(allNames), x509name)) == 0) {
relpTcpChkOnePeerName(pThis, allNames, &bFoundPositiveMatch);
} else {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_ossl: error %d extracting CN\n", r);
}
if(!bFoundPositiveMatch) {
/* Try to extract altname within the SAN extension from the certificate */
san_names = X509_get_ext_d2i((X509 *) cert, NID_subject_alt_name, NULL, NULL);
if (san_names == NULL) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_ossl: "
"X509_get_ext_d2i returned no ALTNAMES\n");
} else {
/* Loop through each name within the extension */
san_names_nb = sk_GENERAL_NAME_num(san_names);
for (iLoop=0; iLoop= 0x10100000L
szAltName = (const char *)ASN1_STRING_get0_data(asDnsName);
# else
szAltName = (const char *)ASN1_STRING_data(asDnsName);
# endif
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_ossl: checking - "
"altName: '%s'\n", szAltName);
/* Add to Names Buffer first */
if (relpTcpAddToCertNamesBuffer(pThis, allNames, sizeof(allNames),
&iAllNames, (char *)szAltName) != 0)
ABORT_FINALIZE(RELP_RET_AUTH_CERT_INVL);
/* Perform PeerName check on AltName */
relpTcpChkOnePeerName(pThis, (char *)szAltName, &bFoundPositiveMatch);
/* Stop if match was found */
if (bFoundPositiveMatch)
break;
}
}
}
if(!bFoundPositiveMatch) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_ossl: invalid peername, "
"not permitted to talk to it\n");
callOnAuthErr(pThis, allNames, "no permited name found", RELP_RET_AUTH_ERR_NAME);
ABORT_FINALIZE(RELP_RET_AUTH_ERR_NAME);
} else {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_ossl: permitted to talk!\n");
}
finalize_it:
/* Free mem */
if (x509name != NULL){
OPENSSL_free(x509name);
}
if (san_names != NULL){
GENERAL_NAMES_free(san_names);
}
LEAVE_RELPFUNC;
}
int verify_callback(int status, X509_STORE_CTX *store)
{
char szdbgdata1[256];
char szdbgdata2[256];
char szdberrmsg[1024];
/* Get current SSL object in order to obtain relpTcp_t obj */
SSL* ssl = X509_STORE_CTX_get_ex_data(store, SSL_get_ex_data_X509_STORE_CTX_idx());
relpTcp_t *pThis = (relpTcp_t *) SSL_get_ex_data(ssl, 0);
assert(pThis != NULL);
X509 *cert = X509_STORE_CTX_get_current_cert(store);
int depth = X509_STORE_CTX_get_error_depth(store);
int err = X509_STORE_CTX_get_error(store);
/* Already failed ? */
if(status == 0) {
pThis->pEngine->dbgprint((char*)"verify_callback: certificate validation failed!\n");
X509_NAME_oneline(X509_get_issuer_name(cert), szdbgdata1, sizeof(szdbgdata1));
X509_NAME_oneline(RSYSLOG_X509_NAME_oneline(cert), szdbgdata2, sizeof(szdbgdata2));
/* Log Warning only on EXPIRED */
if (err == X509_V_OK || err == X509_V_ERR_CERT_HAS_EXPIRED) {
snprintf(szdberrmsg, sizeof(szdberrmsg),
"Certificate expired in verify_callback at depth: %d \n\t"
"issuer = %s\n\t"
"subject = %s\n\t"
"err %d:%s\n",
depth, szdbgdata1, szdbgdata2, err, X509_verify_cert_error_string(err));
pThis->pEngine->dbgprint((char*)"verify_callback: %s", szdberrmsg);
callOnAuthErr(pThis, (char*)X509_verify_cert_error_string(err),
szdberrmsg, RELP_RET_AUTH_CERT_INVL);
/* Set Status to OK ?!*/
status = 1;
} else {
snprintf(szdberrmsg, sizeof(szdberrmsg),
"Certificate error in verify_callback at depth: %d \n\t"
"issuer = %s\n\t"
"subject = %s\n\t"
"err %d:%s\n",
depth, szdbgdata1, szdbgdata2, err, X509_verify_cert_error_string(err));
pThis->pEngine->dbgprint((char*)"verify_callback: %s", szdberrmsg);
callOnAuthErr(pThis, (char*)X509_verify_cert_error_string(err),
szdberrmsg, RELP_RET_AUTH_CERT_INVL);
}
} else {
pThis->pEngine->dbgprint((char*)"verify_callback: certificate validation success!\n");
}
return status;
}
#endif /* #ifdef ENABLE_TLS_OPENSSL */
/** Construct a RELP tcp instance
* This is the first thing that a caller must do before calling any
* RELP function. The relp tcp must only destructed after all RELP
* operations have been finished. Parameter pParent contains a pointer
* to the "parent" client or server object, depending on connType.
*/
relpRetVal
relpTcpConstruct(relpTcp_t **ppThis, relpEngine_t *const pEngine,
const int connType,
void *const pParent)
{
relpTcp_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(relpTcp_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Tcp);
if(connType == RELP_SRV_CONN) {
pThis->pSrv = (relpSrv_t*) pParent;
} else {
pThis->pClt = (relpClt_t*) pParent;
}
pThis->sock = -1;
pThis->pEngine = pEngine;
pThis->iSessMax = 500; /* default max nbr of sessions - TODO: make configurable -- rgerhards, 2008-03-17*/
pThis->bTLSActive = 0;
pThis->dhBits = DEFAULT_DH_BITS;
pThis->pristring = NULL;
pThis->authmode = eRelpAuthMode_None;
pThis->caCertFile = NULL;
pThis->ownCertFile = NULL;
pThis->privKeyFile = NULL;
pThis->tlsConfigCmd = NULL;
pThis->pUsr = NULL;
pThis->permittedPeers.nmemb = 0;
pThis->permittedPeers.peer = NULL;
#ifdef ENABLE_TLS
pThis->xcred = NULL;
#endif
*ppThis = pThis;
finalize_it:
LEAVE_RELPFUNC;
}
#if defined(ENABLE_TLS)
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpDestructTLS_gtls(relpTcp_t *pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
if(pThis->session != NULL) {
gnutls_deinit(pThis->session);
pThis->session = NULL;
}
if (pThis->xcred != NULL) {
gnutls_certificate_free_credentials(pThis->xcred);
pThis->xcred = NULL;
}
if(pThis->anoncred != NULL) {
gnutls_anon_free_client_credentials(pThis->anoncred);
pThis->anoncred = NULL;
}
if(pThis->anoncredSrv != NULL) {
gnutls_anon_free_server_credentials(pThis->anoncredSrv);
pThis->anoncredSrv = NULL;
}
if(pThis->dh_params != NULL) {
gnutls_dh_params_deinit(pThis->dh_params);
pThis->dh_params = NULL;
}
pThis->bTLSActive = 0;
LEAVE_RELPFUNC;
}
#endif /* defined(ENABLE_TLS) */
#if defined(ENABLE_TLS_OPENSSL)
BIO *
relpTcpNewSocketBio_ossl(const int sock)
{
/* relpTcp_t owns sock and closes it in relpTcpDestruct(). */
return BIO_new_socket(sock, BIO_NOCLOSE);
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpDestructTLS_ossl(relpTcp_t *pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
if(pThis->ssl != NULL) {
if(pThis->bTLSActive) {
pThis->pEngine->dbgprint((char*)"relpTcpDestruct_ossl: try "
"shutdown #1 for [%p]\n", (void *) pThis->ssl);
const int sslRet = SSL_shutdown(pThis->ssl);
if (sslRet <= 0) {
const int sslErr = SSL_get_error(pThis->ssl, sslRet);
pThis->pEngine->dbgprint((char*)"relpTcpDestruct_ossl: shutdown failed with err = %d, "
"forcing ssl shutdown!\n", sslErr);
/* ignore those SSL Errors on shutdown */
if( sslErr != SSL_ERROR_SYSCALL &&
sslErr != SSL_ERROR_ZERO_RETURN &&
sslErr != SSL_ERROR_WANT_READ &&
sslErr != SSL_ERROR_WANT_WRITE) {
/* Output Warning only */
relpTcpLastSSLErrorMsg(sslRet, pThis, "relpTcpDestruct_ossl");
}
pThis->pEngine->dbgprint((char*)"relpTcpDestruct_ossl: session closed (un)successfully \n");
} else {
pThis->pEngine->dbgprint((char*)"relpTcpDestruct_ossl: session closed successfully \n");
}
}
pThis->bTLSActive = 0;
SSL_free(pThis->ssl);
pThis->ssl = NULL;
}
LEAVE_RELPFUNC;
}
#endif /* defined(ENABLE_TLS_OPENSSL) */
/* TLS-part of RELP tcp instance destruction - brought to its own function
* to make things easier.
*/
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpDestructTLSBeforeSocketClose(NOTLS_UNUSED relpTcp_t *pThis,
const int sendCloseNotify)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
#if defined(ENABLE_TLS)
if(pThis->pEngine->tls_lib == 0 && sendCloseNotify && pThis->bTLSActive
&& pThis->session != NULL && pThis->sock != -1) {
int sslRet;
/* Do not retry EAGAIN: teardown must not block on a nonblocking socket. */
do {
sslRet = gnutls_bye(pThis->session, GNUTLS_SHUT_WR);
} while(sslRet == GNUTLS_E_INTERRUPTED);
}
#else
(void) pThis;
(void) sendCloseNotify;
#endif
#if defined(ENABLE_TLS_OPENSSL)
/* A partial SSL object can own a BIO that still refers to this socket. */
if(pThis->pEngine->tls_lib != 0 && pThis->ssl != NULL && !pThis->bTLSActive) {
relpTcpDestructTLS_ossl(pThis);
}
#endif
LEAVE_RELPFUNC;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpDestructTLSAfterSocketClose(NOTLS_UNUSED relpTcp_t *pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
#if defined(ENABLE_TLS)
if(pThis->pEngine->tls_lib == 0
&& (pThis->session != NULL || pThis->xcred != NULL || pThis->anoncred != NULL
|| pThis->anoncredSrv != NULL || pThis->dh_params != NULL)) {
relpTcpDestructTLS_gtls(pThis);
}
#endif
#if defined(ENABLE_TLS_OPENSSL)
if(pThis->pEngine->tls_lib != 0 && pThis->ssl != NULL && pThis->bTLSActive) {
relpTcpDestructTLS_ossl(pThis);
}
#endif
#if defined(WITH_TLS)
relpTcpFreePermittedPeers(pThis);
#endif
LEAVE_RELPFUNC;
}
static relpRetVal
relpTcpDestructInternal(relpTcp_t **ppThis, const int sendCloseNotify)
{
relpTcp_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
/* AVOID freeing pThis AGAIN! */
if (pThis != NULL) {
RELPOBJ_assert(pThis, Tcp);
// Only DEBUG if pThis is available
pThis->pEngine->dbgprint((char*)"relpTcpDestruct for %p\n", (void *) pThis);
/* GnuTLS needs a live transport to send close_notify. */
relpTcpDestructTLSBeforeSocketClose(pThis, sendCloseNotify);
if(pThis->sock != -1) {
shutdown(pThis->sock, SHUT_RDWR);
close(pThis->sock);
pThis->sock = -1;
}
if(pThis->socks != NULL) {
/* if we have some sockets at this stage, we need to close them */
for(int i = 1 ; i <= pThis->socks[0] ; ++i) {
shutdown(pThis->socks[i], SHUT_RDWR);
close(pThis->socks[i]);
}
free(pThis->socks);
}
relpTcpDestructTLSAfterSocketClose(pThis);
free(pThis->pRemHostIP);
free(pThis->pRemHostName);
free(pThis->pRemHostPort);
free(pThis->pristring);
free(pThis->caCertFile);
free(pThis->ownCertFile);
free(pThis->privKeyFile);
free(pThis->tlsConfigCmd);
/* done with de-init work, now free tcp object itself */
free(pThis);
*ppThis = NULL;
}
LEAVE_RELPFUNC;
}
/** Destruct a RELP tcp instance */
relpRetVal
relpTcpDestruct(relpTcp_t **ppThis)
{
return relpTcpDestructInternal(ppThis, 1);
}
#ifdef ENABLE_TLS
/* helper to call an error code handler if gnutls failed. If there is a failure,
* an error message is pulled form gnutls and the error message properly
* populated.
* Returns 1 if an error was detected, 0 otherwise. This can be used as a
* shortcut for error handling (safes doing it twice).
*/
static int
chkGnutlsCode(relpTcp_t *const pThis, const char *emsg, relpRetVal ecode, const int gnuRet)
{
int r;
if(gnuRet == GNUTLS_E_SUCCESS) {
r = 0;
} else {
char msgbuf[4096];
r = 1;
snprintf(msgbuf, sizeof(msgbuf), "%s [gnutls error %d: %s]",
emsg, gnuRet, gnutls_strerror(gnuRet));
msgbuf[sizeof(msgbuf)-1] = '\0';
callOnErr(pThis, msgbuf, ecode);
}
return r;
}
#endif /* #ifdef ENABLE_TLS */
/* abort a tcp connection. This is much like relpTcpDestruct(), but tries
* to discard any unsent data. -- rgerhards, 2008-03-24
*/
relpRetVal
relpTcpAbortDestruct(relpTcp_t **ppThis)
{
struct linger ling;
ENTER_RELPFUNC;
assert(ppThis != NULL);
RELPOBJ_assert((*ppThis), Tcp);
if((*ppThis)->sock != -1) {
ling.l_onoff = 1;
ling.l_linger = 0;
if(setsockopt((*ppThis)->sock, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)) < 0 ) {
(*ppThis)->pEngine->dbgprint((char*)"could not set SO_LINGER, errno %d\n", errno);
}
}
iRet = relpTcpDestructInternal(ppThis, 0);
LEAVE_RELPFUNC;
}
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
# define SALEN(sa) ((sa)->sa_len)
#else
static inline size_t SALEN(struct sockaddr *sa) {
switch (sa->sa_family) {
case AF_INET: return (sizeof(struct sockaddr_in));
case AF_INET6: return (sizeof(struct sockaddr_in6));
default: return 0;
}
}
#endif
/* we may later change the criteria, thus we encapsulate it
* into a function.
*/
static inline int8_t
isAnonAuth(relpTcp_t *const pThis)
{
return pThis->ownCertFile == NULL;
}
/* Set pRemHost based on the address provided. This is to be called upon accept()ing
* a connection request. It must be provided by the socket we received the
* message on as well as a NI_MAXHOST size large character buffer for the FQDN.
* Please see http://www.hmug.org/man/3/getnameinfo.php (under Caveats)
* for some explanation of the code found below. If we detect a malicious
* hostname, we return RELP_RET_MALICIOUS_HNAME and let the caller decide
* on how to deal with that.
* rgerhards, 2008-03-31
*/
static relpRetVal
relpTcpSetRemHost(relpTcp_t *const pThis, struct sockaddr *pAddr)
{
relpEngine_t *pEngine;
int error;
unsigned char szIP[NI_MAXHOST] = "";
unsigned char szHname[NI_MAXHOST+64] = ""; /* 64 extra bytes for message text */
unsigned char szPort[NI_MAXSERV] = "";
struct addrinfo hints, *res;
size_t len;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pEngine = pThis->pEngine;
assert(pAddr != NULL);
if((error = getnameinfo(pAddr, SALEN(pAddr), (char*)szIP, sizeof(szIP), (char*)szPort,
sizeof(szPort), NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
pThis->pEngine->dbgprint((char*)"Malformed from address %s\n", gai_strerror(error));
strcpy((char*)szHname, "???");
strcpy((char*)szIP, "???");
strcpy((char*)szPort, "???");
ABORT_FINALIZE(RELP_RET_INVALID_HNAME);
}
if(pEngine->bEnableDns) {
error = getnameinfo(pAddr, SALEN(pAddr), (char*)szHname, sizeof(szHname), NULL, 0, NI_NAMEREQD);
if(error == 0) {
memset (&hints, 0, sizeof (struct addrinfo));
hints.ai_flags = AI_NUMERICHOST;
hints.ai_socktype = SOCK_STREAM;
/* we now do a lookup once again. This one should fail,
* because we should not have obtained a non-numeric address. If
* we got a numeric one, someone messed with DNS!
*/
if(getaddrinfo((char*)szHname, NULL, &hints, &res) == 0) {
freeaddrinfo (res);
/* OK, we know we have evil, so let's indicate this to our caller */
snprintf((char*)szHname, sizeof(szHname), "[MALICIOUS:IP=%s]", szIP);
pEngine->dbgprint((char*)"Malicious PTR record, "
"IP = \"%s\" HOST = \"%s\"", szIP, szHname);
iRet = RELP_RET_MALICIOUS_HNAME;
}
} else {
strcpy((char*)szHname, (char*)szIP);
}
} else {
strcpy((char*)szHname, (char*)szIP);
}
/* We now have the names, so now let's allocate memory and store them permanently.
* (side note: we may hold on to these values for quite a while, thus we trim their
* memory consumption)
*/
len = strlen((char*)szIP) + 1; /* +1 for \0 byte */
if((pThis->pRemHostIP = malloc(len)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
memcpy(pThis->pRemHostIP, szIP, len);
len = strlen((char*)szHname) + 1; /* +1 for \0 byte */
if((pThis->pRemHostName = malloc(len)) == NULL) {
free(pThis->pRemHostIP); /* prevent leak */
pThis->pRemHostIP = NULL;
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
memcpy(pThis->pRemHostName, szHname, len);
len = strlen((char*)szPort) + 1; /* +1 for \0 byte */
if((pThis->pRemHostPort = malloc(len)) == NULL) {
free(pThis->pRemHostIP);
free(pThis->pRemHostName);
pThis->pRemHostIP = NULL;
pThis->pRemHostName = NULL;
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
memcpy(pThis->pRemHostPort, szPort, len);
finalize_it:
LEAVE_RELPFUNC;
}
/* this copies a *complete* permitted peers structure into the
* tcp object.
*/
relpRetVal
relpTcpSetPermittedPeers(relpTcp_t LIBRELP_ATTR_UNUSED *pThis,
relpPermittedPeers_t LIBRELP_ATTR_UNUSED *pPeers)
{
ENTER_RELPFUNC;
#if defined(WITH_TLS)
int i;
relpTcpFreePermittedPeers(pThis);
if(pPeers->nmemb != 0) {
if((pThis->permittedPeers.peer =
calloc(pPeers->nmemb, sizeof(tcpPermittedPeerEntry_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pThis->permittedPeers.nmemb = pPeers->nmemb;
for(i = 0 ; i < pPeers->nmemb ; ++i) {
if((pThis->permittedPeers.peer[i].name = strdup(pPeers->name[i])) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
CHKRet(relpTcpPermittedPeerWildcardCompile(&(pThis->permittedPeers.peer[i])));
}
}
#else
ABORT_FINALIZE(RELP_RET_ERR_NO_TLS);
#endif /* #ifdef WITH_TLS */
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetUsrPtr(relpTcp_t *const pThis, void *pUsr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pThis->pUsr = pUsr;
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetAuthMode(relpTcp_t *const pThis, relpAuthMode_t authmode)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pThis->authmode = authmode;
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetConnTimeout(relpTcp_t *const pThis, const int connTimeout)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pThis->connTimeout = connTimeout;
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetGnuTLSPriString(relpTcp_t *const pThis, char *pristr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
free(pThis->pristring);
if(pristr == NULL) {
pThis->pristring = NULL;
} else {
if((pThis->pristring = strdup(pristr)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetCACert(relpTcp_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
free(pThis->caCertFile);
if(cert == NULL) {
pThis->caCertFile = NULL;
} else {
if((pThis->caCertFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetOwnCert(relpTcp_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
free(pThis->ownCertFile);
if(cert == NULL) {
pThis->ownCertFile = NULL;
} else {
if((pThis->ownCertFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetPrivKey(relpTcp_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
free(pThis->privKeyFile);
if(cert == NULL) {
pThis->privKeyFile = NULL;
} else {
#if defined(HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION) || defined(ENABLE_TLS_OPENSSL)
if((pThis->privKeyFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
# else
ABORT_FINALIZE(RELP_RET_ERR_NO_TLS_AUTH);
# endif
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetTlsConfigCmd(relpTcp_t *const pThis, char *cfgcmd)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
free(pThis->tlsConfigCmd);
if(cfgcmd == NULL) {
pThis->tlsConfigCmd = NULL;
} else {
if((pThis->tlsConfigCmd = strdup(cfgcmd)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Enable TLS mode. */
relpRetVal
relpTcpEnableTLS(relpTcp_t LIBRELP_ATTR_UNUSED *pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
#if defined(WITH_TLS)
pThis->bEnableTLS = 1;
#else
iRet = RELP_RET_ERR_NO_TLS;
#endif /* #ifdef WITH_TLS */
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpEnableTLSZip(relpTcp_t LIBRELP_ATTR_UNUSED *pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
#if defined(ENABLE_TLS)
/* || defined(ENABLE_TLS_OPENSSL)*/
pThis->bEnableTLSZip = 1;
#else
iRet = RELP_RET_ERR_NO_TLS;
#endif /* #ifdef ENABLE_TLS */
LEAVE_RELPFUNC;
}
relpRetVal
relpTcpSetDHBits(relpTcp_t *const pThis, const int bits)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pThis->dhBits = bits;
LEAVE_RELPFUNC;
}
#if defined(ENABLE_TLS)
/* set TLS priority string, common code both for client and server */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpTLSSetPrio_gtls(relpTcp_t *const pThis)
{
int r;
char pristringBuf[4096];
char *pristring;
ENTER_RELPFUNC;
/* Set default priority string (in simple cases where the user does not care...) */
if(pThis->pristring == NULL) {
if (pThis->authmode == eRelpAuthMode_None) {
if(pThis->bEnableTLSZip) {
strncpy(pristringBuf, "NORMAL:+ANON-DH:+COMP-ALL", sizeof(pristringBuf));
} else {
strncpy(pristringBuf, "NORMAL:+ANON-DH:+COMP-NULL", sizeof(pristringBuf));
}
pristringBuf[sizeof(pristringBuf)-1] = '\0';
pristring = pristringBuf;
r = gnutls_priority_set_direct(pThis->session, pristring, NULL);
} else {
r = gnutls_set_default_priority(pThis->session);
strncpy(pristringBuf, "to recommended system default", sizeof(pristringBuf));
pristringBuf[sizeof(pristringBuf)-1] = '\0';
pristring = pristringBuf;
}
} else {
pristring = pThis->pristring;
r = gnutls_priority_set_direct(pThis->session, pristring, NULL);
}
if(r == GNUTLS_E_INVALID_REQUEST) {
ABORT_FINALIZE(RELP_RET_INVLD_TLS_PRIO);
} else if(r != GNUTLS_E_SUCCESS) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
finalize_it:
pThis->pEngine->dbgprint((char*)"relpTcpTLSSetPrio_gtls: Setting ciphers '%s' iRet=%d\n", pristring, iRet);
if(iRet != RELP_RET_OK) {
chkGnutlsCode(pThis, "Failed to set GnuTLS priority", iRet, r);
}
LEAVE_RELPFUNC;
}
#else /* #ifdef ENABLE_TLS */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpTLSSetPrio_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* defined(ENABLE_TLS)*/
#if defined(ENABLE_TLS_OPENSSL)
/* set TLS priority string, common code both for client and server */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpTLSSetPrio_ossl(relpTcp_t *const pThis)
{
char pristringBuf[4096];
char *pristring;
ENTER_RELPFUNC;
/* Compute priority string (in simple cases where the user does not care...) */
if(pThis->pristring == NULL) {
if (pThis->authmode == eRelpAuthMode_None) {
#if OPENSSL_VERSION_NUMBER >= 0x10100000L \
&& !defined(LIBRESSL_VERSION_NUMBER)
/* NOTE: do never use: +eNULL, it DISABLES encryption! */
strncpy(pristringBuf, "ALL:+COMPLEMENTOFDEFAULT:+ADH:+ECDH:+aNULL@SECLEVEL=0",
sizeof(pristringBuf));
#else
strncpy(pristringBuf, "ALL:+COMPLEMENTOFDEFAULT:+ADH:+ECDH:+aNULL",
sizeof(pristringBuf));
#endif
} else {
strncpy(pristringBuf, "DEFAULT", sizeof(pristringBuf));
}
pristringBuf[sizeof(pristringBuf)-1] = '\0';
pristring = pristringBuf;
} else {
/* We use custom CipherString if used sets it by SslConfCmd */
pristring = pThis->pristring;
}
if ( SSL_set_cipher_list(pThis->ssl, pristring) == 0 ){
pThis->pEngine->dbgprint((char*)"relpTcpTLSSetPrio_ossl: Error setting ciphers '%s'\n", pristring);
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
finalize_it:
pThis->pEngine->dbgprint((char*)"relpTcpTLSSetPrio_ossl: Setting ciphers '%s' iRet=%d\n", pristring, iRet);
LEAVE_RELPFUNC;
}
#else
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpTLSSetPrio_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* defined(ENABLE_TLS_OPENSSL)*/
#ifdef ENABLE_TLS
#ifndef _AIX
#pragma GCC diagnostic push
/* per https://lists.gnupg.org/pipermail/gnutls-help/2004-August/000154.html This is expected */
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
#endif
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpAcceptConnReqInitTLS_gtls(relpTcp_t *const pThis, relpSrv_t *const pSrv)
{
int r;
ENTER_RELPFUNC;
r = gnutls_init(&pThis->session, GNUTLS_SERVER);
if(chkGnutlsCode(pThis, "Failed to initialize GnuTLS", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
if(pSrv->pTcp->pristring != NULL)
pThis->pristring = strdup(pSrv->pTcp->pristring);
pThis->authmode = pSrv->pTcp->authmode;
pThis->pUsr = pSrv->pUsr;
CHKRet(relpTcpTLSSetPrio(pThis));
gnutls_session_set_ptr(pThis->session, pThis);
if(isAnonAuth(pSrv->pTcp)) {
r = gnutls_credentials_set(pThis->session, GNUTLS_CRD_ANON, pSrv->pTcp->anoncredSrv);
if(chkGnutlsCode(pThis, "Failed setting anonymous credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
} else { /* cert-based auth */
if(pSrv->pTcp->caCertFile == NULL) {
gnutls_certificate_send_x509_rdn_sequence(pThis->session, 0);
}
r = gnutls_credentials_set(pThis->session, GNUTLS_CRD_CERTIFICATE, pSrv->pTcp->xcred);
if(chkGnutlsCode(pThis, "Failed setting certificate credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
}
gnutls_dh_set_prime_bits(pThis->session, pThis->dhBits);
gnutls_certificate_server_set_request(pThis->session, GNUTLS_CERT_REQUEST);
gnutls_transport_set_ptr(pThis->session, (gnutls_transport_ptr_t) pThis->sock);
r = gnutls_handshake(pThis->session);
if(r == GNUTLS_E_INTERRUPTED || r == GNUTLS_E_AGAIN) {
pThis->pEngine->dbgprint((char*)"librelp: gnutls_handshake retry "
"necessary (this is OK and expected)\n");
pThis->rtryOp = relpTCP_RETRY_handshake;
} else if(r != GNUTLS_E_SUCCESS) {
chkGnutlsCode(pThis, "TLS handshake failed", RELP_RET_ERR_TLS_HANDS, r);
ABORT_FINALIZE(RELP_RET_ERR_TLS_HANDS);
}
pThis->bTLSActive = 1;
finalize_it:
LEAVE_RELPFUNC;
}
#ifndef _AIX
#pragma GCC diagnostic pop
#endif
#else /* #ifdef ENABLE_TLS */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpAcceptConnReqInitTLS_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpSrv_t *const pSrv)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* #ifdef ENABLE_TLS */
#ifdef ENABLE_TLS_OPENSSL
#ifndef _AIX
#pragma GCC diagnostic push
/* per https://lists.gnupg.org/pipermail/gnutls-help/2004-August/000154.html This is expected */
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
#endif
/* global init OpenSSL */
static relpRetVal
relpTcpInitTLS(relpTcp_t *const pThis)
{
ENTER_RELPFUNC;
pThis->pEngine->dbgprint((char*)"relpTcpInitTLS: Init OpenSSL library\n");
/* Setup OpenSSL library */
if((opensslh_THREAD_setup() == 0) || !SSL_library_init()) {
pThis->pEngine->dbgprint((char*)"relpTcpInitTLS: Error OpenSSL initialization failed\n");
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
/* Load readable error strings */
SSL_load_error_strings();
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
/*
* ERR_load_*(), ERR_func_error_string(), ERR_get_error_line(), ERR_get_error_line_data(), ERR_get_state()
* OpenSSL now loads error strings automatically so these functions are not needed.
* SEE FOR MORE:
* https://www.openssl.org/docs/manmaster/man7/migration_guide.html
*
*/
#else
/* Load error strings into mem*/
ERR_load_BIO_strings();
ERR_load_crypto_strings();
#endif
/* Create main CTX Object */
ctx = SSL_CTX_new(SSLv23_method());
/* Set CTX Options */
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2); /* Disable insecure SSLv2 Protocol */
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3); /* Disable insecure SSLv3 Protocol */
SSL_CTX_sess_set_cache_size(ctx,1024); /* TODO: make configurable? */
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
/* Enable Support for automatic EC temporary key parameter selection. */
SSL_CTX_set_ecdh_auto(ctx, 1);
#else
pThis->pEngine->dbgprint((char*)"relpTcpInitTLS: openssl to old, cannot use SSL_CTX_set_ecdh_auto."
"Using SSL_CTX_set_tmp_ecdh with NID_X9_62_prime256v1/() instead.\n");
SSL_CTX_set_tmp_ecdh(ctx, EC_KEY_new_by_curve_name(NID_X9_62_prime256v1));
#endif
SSL_CTX_set_timeout(ctx, 30); /* Default Session Timeout, TODO: Make configureable */
SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
/* After CA Cert Init, set default VERIFY Options for OpenSSL CTX - and CALLBACK */
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, verify_callback);
/* Init CA Certificate first */
if( pThis->caCertFile != NULL ) {
if (SSL_CTX_load_verify_locations(ctx, pThis->caCertFile, NULL) != 1) {
callOnErr(pThis, (char*)"relpTcpInitTLS: Error, CA certificate could not be accessed."
" Is the file at the right path? And do we have the permissions?\n",
RELP_RET_ERR_TLS_SETUP);
/* Output Additional OpenSSL output */
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpInitTLS");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
} else
pThis->pEngine->dbgprint((char*)"relpTcpInitTLS: Successfully initialized CA certificate #1\n");
} else {
/* Init CA from own Certificate */
if( pThis->ownCertFile != NULL ) {
if (SSL_CTX_load_verify_locations(ctx, pThis->ownCertFile, NULL) != 1) {
callOnErr(pThis, (char*)"relpTcpInitTLS: Error, Certificate could not be accessed."
" Is the file at the right path? And do we have the permissions?\n",
RELP_RET_ERR_TLS_SETUP);
/* Output Additional OpenSSL output */
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpInitTLS");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
} else
pThis->pEngine->dbgprint(
(char*)"relpTcpInitTLS: Successfully initialized CA Certificate #2\n");
}
// Init local System default certificate storage instead.
if (SSL_CTX_set_default_verify_paths(ctx) != 1) {
callOnErr(pThis, (char*)"relpTcpInitTLS: Error, CA default certificate storage "
"could not be set.", RELP_RET_ERR_TLS_SETUP);
/* Output Additional OpenSSL output */
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpInitTLS");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
} else
pThis->pEngine->dbgprint((char*)"relpTcpInitTLS: Successfully initialized default "
"CA certificate storage\n");
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Perform additional certificate name checks
*/
static relpRetVal
relpTcpChkPeerAuth(relpTcp_t *const pThis)
{
X509 *certpeer = NULL;
int r;
ENTER_RELPFUNC;
/* Get peer certificate from SSL */
certpeer = SSL_get_peer_certificate(pThis->ssl);
if ( certpeer == NULL ) {
if(pThis->authmode == eRelpAuthMode_None ) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerAuth: peer certificate for [%p] invalid, "
"but allowed in anon auth mode\n", (void *) pThis);
} else
ABORT_FINALIZE(RELP_RET_AUTH_NO_CERT);
} else {
/* verify client cert at first **/
r = SSL_get_verify_result(pThis->ssl);
if (r != X509_V_OK) {
if (r == X509_V_ERR_CERT_HAS_EXPIRED) {
callOnAuthErr(pThis, (char*) X509_verify_cert_error_string(r),
"certificate validation failed, certificate expired!",
RELP_RET_AUTH_CERT_INVL);
ABORT_FINALIZE(RELP_RET_AUTH_CERT_INVL);
} else {
callOnAuthErr(pThis, (char*) X509_verify_cert_error_string(r),
"certificate validation failed",
RELP_RET_AUTH_CERT_INVL);
ABORT_FINALIZE(RELP_RET_AUTH_CERT_INVL);
}
}
/* Now check for auth modes */
if(pThis->authmode == eRelpAuthMode_CertValid ) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerAuth: certvalid mode - success\n");
} else if(pThis->authmode == eRelpAuthMode_Name ) {
CHKRet(relpTcpChkPeerName_ossl(pThis, certpeer));
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerAuth: name mode - success\n");
} else if(pThis->authmode == eRelpAuthMode_Fingerprint) {
CHKRet(relpTcpChkPeerFingerprint_ossl(pThis, certpeer));
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerAuth: fingerprint mode - success\n");
} else {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerAuth: anon mode - success\n");
}
}
finalize_it:
if(certpeer != NULL)
X509_free(certpeer);
LEAVE_RELPFUNC;
}
/* Perform all necessary checks after Handshake
*/
static relpRetVal
relpTcpPostHandshakeCheck(relpTcp_t *const pThis)
{
ENTER_RELPFUNC;
char szDbg[255];
const SSL_CIPHER* sslCipher;
/* Some extra output for debugging openssl */
if (SSL_get_shared_ciphers(pThis->ssl,szDbg, sizeof szDbg) != NULL)
pThis->pEngine->dbgprint((char*)"relpTcpPostHandshakeCheck: Debug Shared ciphers = %s\n", szDbg);
sslCipher = (const SSL_CIPHER*) SSL_get_current_cipher(pThis->ssl);
if (sslCipher != NULL)
pThis->pEngine->dbgprint((char*)"relpTcpPostHandshakeCheck: Debug Version: %s Name: %s\n",
SSL_CIPHER_get_version(sslCipher), SSL_CIPHER_get_name(sslCipher));
FINALIZE;
finalize_it:
LEAVE_RELPFUNC;
}
/* Perform all necessary checks after Handshake
*/
static relpRetVal LIBRELP_ATTR_NONNULL(1)
relpTcpSslInitCerts(relpTcp_t *const pThis, char *ownCertFile, char *privKeyFile)
{
ENTER_RELPFUNC;
if( ownCertFile!= NULL ) {
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
if (SSL_use_certificate_chain_file(pThis->ssl, ownCertFile) != 1) {
#else
if (SSL_use_certificate_file(pThis->ssl, ownCertFile, SSL_FILETYPE_PEM) != 1) {
#endif
callOnErr(pThis, (char*)"relpTcpSslInitCerts: error, Certificate file could not be "
"accessed. Is the file at the right path? And do we have the "
"permissions?", RELP_RET_ERR_TLS_SETUP);
/* Output Additional OpenSSL output */
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpSslInitCerts");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
} else
pThis->pEngine->dbgprint((char*)"relpTcpSslInitCerts: Successfully "
"initialized certificate file\n");
} else
pThis->pEngine->dbgprint((char*)"relpTcpSslInitCerts: certificate file MISSING\n");
if( privKeyFile!= NULL ) {
if (SSL_use_PrivateKey_file(pThis->ssl, privKeyFile, SSL_FILETYPE_PEM) != 1) {
callOnErr(pThis, (char*)"relpTcpSslInitCerts: Error, Key file could not be accessed. "
"Is the file at the right path? And do we have the permissions?"
, RELP_RET_ERR_TLS_SETUP);
/* Output Additional OpenSSL output */
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpSslInitCerts");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
} else
pThis->pEngine->dbgprint((char*)"relpTcpSslInitCerts: Successfully initialized key file\n");
} else
pThis->pEngine->dbgprint((char*)"relpTcpSslInitCerts: key file MISSING\n");
FINALIZE;
finalize_it:
LEAVE_RELPFUNC;
}
/* return direction in which retry must be done. We maps openssl retry state to
* "0 if trying to read data, 1 if trying to write data."
*/
static int
relpTcpGetRtryDirection_ossl(relpTcp_t *const pThis)
{
if (pThis->rtryOp == relpTCP_RETRY_send)
return 1; /* try to write data */
else
return 0; /* try to read data = default */
}
/* Perform all necessary actions for Handshake
*/
static relpRetVal
relpTcpRtryHandshake_ossl(relpTcp_t *const pThis)
{
int res, resErr;
char errmsg[1024];
ENTER_RELPFUNC;
pThis->pEngine->dbgprint((char*)"relpTcpRtryHandshake: "
"Starting TLS Handshake for ssl[%p]\n", (void *)pThis->ssl);
if (pThis->sslState == osslServer) {
/* Handle Server SSL Object */
if((res = SSL_accept(pThis->ssl)) <= 0) {
/* Obtain SSL Error code */
resErr = SSL_get_error(pThis->ssl, res);
if( resErr == SSL_ERROR_WANT_READ ||
resErr == SSL_ERROR_WANT_WRITE) {
pThis->rtryOp = relpTCP_RETRY_handshake;
pThis->pEngine->dbgprint((char*)"relpTcpRtryHandshake: Server handshake does not "
"complete immediately - setting to retry (this is OK and normal)\n");
FINALIZE;
} else if(resErr == SSL_ERROR_SYSCALL) {
callOnErr(pThis, (char*)"relpTcpRtryHandshake_ossl: Server handshake failed with "
"SSL_ERROR_SYSCALL - Aborting handshake.", RELP_RET_ERR_TLS_SETUP);
relpTcpLastSSLErrorMsg(res, pThis, "relpTcpRtryHandshake Server");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
} else {
snprintf(errmsg, sizeof(errmsg),
"relpTcpRtryHandshake_ossl: Server handshake failed with %d - Aborting handshake.",
resErr);
callOnErr(pThis, errmsg, RELP_RET_ERR_TLS_SETUP);
relpTcpLastSSLErrorMsg(res, pThis, "relpTcpRtryHandshake Server");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
} else
pThis->pEngine->dbgprint((char*)"relpTcpRtryHandshake: Server handshake finished for ssl[%p]\n",
(void *)pThis->ssl);
} else {
/* Handle Client SSL Object */
if((res = SSL_do_handshake(pThis->ssl)) <= 0) {
/* Obtain SSL Error code */
resErr = SSL_get_error(pThis->ssl, res);
if( resErr == SSL_ERROR_WANT_READ ||
resErr == SSL_ERROR_WANT_WRITE) {
pThis->rtryOp = relpTCP_RETRY_handshake;
// pThis->rtryOsslErr = resErr; /* Store SSL ErrorCode into*/
pThis->pEngine->dbgprint((char*)"relpTcpRtryHandshake: "
"Client handshake does not complete immediately "
"- setting to retry (this is OK and normal)\n");
FINALIZE;
} else if(resErr == SSL_ERROR_SYSCALL) {
callOnErr(pThis, (char*)"relpTcpRtryHandshake_ossl: Client handshake failed with "
"SSL_ERROR_SYSCALL - Aborting handshake.", RELP_RET_ERR_TLS_SETUP);
relpTcpLastSSLErrorMsg(res, pThis, "relpTcpRtryHandshake Client");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP /*RS_RET_RETRY*/);
} else {
snprintf(errmsg, sizeof(errmsg),
"relpTcpRtryHandshake_ossl: Client handshake failed with %d - Aborting handshake.",
resErr);
callOnErr(pThis, errmsg, RELP_RET_ERR_TLS_SETUP);
relpTcpLastSSLErrorMsg(res, pThis, "relpTcpRtryHandshake Client");
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
} else
pThis->pEngine->dbgprint((char*)"relpTcpRtryHandshake: Client handshake finished for ssl[%p]\n",
(void *)pThis->ssl);
}
pThis->rtryOp = relpTCP_RETRY_none;
CHKRet(relpTcpPostHandshakeCheck(pThis));
CHKRet(relpTcpChkPeerAuth(pThis));
finalize_it:
LEAVE_RELPFUNC;
}
static relpRetVal
relpTcpSetSslConfCmd_ossl(relpTcp_t *const pThis, char *tlsConfigCmd)
{
ENTER_RELPFUNC;
/* Skip function if function is NULL tlsConfigCmd */
if (tlsConfigCmd == NULL) {
pThis->pEngine->dbgprint((char*)"relpTcpSetSslConfCmd_ossl: tlsConfigCmd is NULL\n");
LEAVE_RELPFUNC;
} else {
pThis->pEngine->dbgprint((char*)"relpTcpSetSslConfCmd_ossl: set to '%s'\n", tlsConfigCmd);
char errmsg[1424];
#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)
char *pCurrentPos;
char *pNextPos;
char *pszCmd;
char *pszValue;
int iConfErr;
/* Set working pointer */
pCurrentPos = tlsConfigCmd;
if (pCurrentPos != NULL && strlen(pCurrentPos) > 0) {
// Create CTX Config Helper
SSL_CONF_CTX *cctx;
cctx = SSL_CONF_CTX_new();
if (pThis->sslState == osslServer) {
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_SERVER);
} else {
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CLIENT);
}
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_FILE);
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_SHOW_ERRORS);
/* Apply connection-specific settings to the SSL object when it
* exists. Only listener setup has no SSL object yet and must
* configure the shared context. */
if (pThis->ssl != NULL) {
SSL_CONF_CTX_set_ssl(cctx, pThis->ssl);
} else {
SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
}
do
{
pNextPos = index(pCurrentPos, '=');
if (pNextPos != NULL) {
while ( *pCurrentPos != '\0' &&
(*pCurrentPos == ' ' || *pCurrentPos == '\t') )
pCurrentPos++;
pszCmd = strndup(pCurrentPos, pNextPos-pCurrentPos);
pCurrentPos = pNextPos+1;
pNextPos = index(pCurrentPos, '\n');
pNextPos = (pNextPos == NULL ? index(pCurrentPos, ';') : pNextPos);
pszValue = (pNextPos == NULL ?
strdup(pCurrentPos) :
strndup(pCurrentPos, pNextPos - pCurrentPos));
pCurrentPos = (pNextPos == NULL ? NULL : pNextPos+1);
/* Add SSL Conf Command */
iConfErr = SSL_CONF_cmd(cctx, pszCmd, pszValue);
if (iConfErr > 0) {
pThis->pEngine->dbgprint((char*)"relpTcpSetSslConfCmd_ossl: "
"Successfully added Command '%s':'%s'\n",
pszCmd, pszValue);
if(!strcmp(pszCmd, "CipherString")) {
relpTcpSetGnuTLSPriString(pThis,pszValue);
pThis->pEngine->dbgprint((char*)"relpTcpSetSslConfCmd_ossl: "
"Copy Custom CipherString '%s' to GnuTLSPriString\n",
pszValue);
}
}
else {
snprintf(errmsg, sizeof(errmsg),
"Failed to added Command: %s:'%s' "
"in relpTcpSetSslConfCmd_ossl with error '%d'",
pszCmd, pszValue, iConfErr);
callOnErr(pThis, errmsg, RELP_RET_ERR_TLS);
}
free(pszCmd);
free(pszValue);
} else {
/* Abort further parsing */
pCurrentPos = NULL;
}
}
while (pCurrentPos != NULL);
/* Finalize SSL Conf */
iConfErr = SSL_CONF_CTX_finish(cctx);
if (!iConfErr) {
snprintf(errmsg, sizeof(errmsg),
"Failed setting openssl command parameters: %s"
"Open ssl error info may follow in next messages",
tlsConfigCmd);
callOnErr(pThis, errmsg, RELP_RET_ERR_TLS);
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpSetSslConfCmd_ossl");
}
}
#else
snprintf(errmsg, sizeof(errmsg),
"Warning: OpenSSL Version too old to set tlsConfigCmd ('%s')"
"by SSL_CONF_cmd API.",
tlsConfigCmd);
callOnErr(pThis, errmsg, RELP_RET_ERR_TLS);
#endif
}
LEAVE_RELPFUNC;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpAcceptConnReqInitTLS_ossl(relpTcp_t *const pThis, relpSrv_t *const pSrv)
{
BIO *client = NULL;
ENTER_RELPFUNC;
pThis->pEngine->dbgprint((char*)"relpTcpAcceptConnReqInitTLS_ossl: "
"Accepting connection for [%p] ... \n", (void *)pThis);
if(!(pThis->ssl = SSL_new(ctx))) {
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpAcceptConnReqInitTLS_ossl");
}
// Set SSL_MODE_AUTO_RETRY to SSL obj
SSL_set_mode(pThis->ssl, SSL_MODE_AUTO_RETRY);
// Copy Properties from Server TCP obj over
pThis->authmode = pSrv->pTcp->authmode;
pThis->pUsr = pSrv->pUsr;
pThis->pristring = (pSrv->pTcp->pristring != NULL ? strdup(pSrv->pTcp->pristring) : NULL);
pThis->tlsConfigCmd = (pSrv->pTcp->tlsConfigCmd != NULL ? strdup(pSrv->pTcp->tlsConfigCmd) : NULL);
if(!isAnonAuth(pThis->pSrv->pTcp)) {
CHKRet(relpTcpSslInitCerts(pThis, pThis->pSrv->ownCertFile, pThis->pSrv->privKey));
} else
pThis->authmode = eRelpAuthMode_None;
/* Set TLS Options if configured */
CHKRet(relpTcpSetSslConfCmd_ossl(pThis, pThis->tlsConfigCmd));
/* Set TLS Priority Options */
CHKRet(relpTcpTLSSetPrio(pThis));
SSL_set_ex_data(pThis->ssl, 0, pThis);
if (pThis->authmode != eRelpAuthMode_None) {
pThis->pEngine->dbgprint((char*)"relpTcpAcceptConnReqInitTLS_ossl: enable certificate checking\n");
/* Enable certificate valid checking */
SSL_set_verify(pThis->ssl, SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_callback);
SSL_set_verify_depth(pThis->ssl, 4);
} else {
SSL_set_verify(pThis->ssl, SSL_VERIFY_NONE, verify_callback);
}
/*set Server state */
pThis->sslState = osslServer;
/* Create BIO from ptcp socket! */
client = relpTcpNewSocketBio_ossl(pThis->sock);
pThis->pEngine->dbgprint((char*)"relpTcpAcceptConnReqInitTLS_ossl: Init client BIO[%p] done\n", (void *)client);
/* Set debug Callback for client BIO as well! */
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
BIO_set_callback_ex(client, BIO_debug_callback_ex);
#else
BIO_set_callback(client, BIO_debug_callback);
#endif
BIO_set_callback_arg(client, (char *)pThis);
/* TODO: still needed? Set to NON blocking ! */
BIO_set_nbio( client, 1 );
SSL_set_bio(pThis->ssl, client, client);
SSL_set_accept_state(pThis->ssl); /* sets ssl to work in server mode. */
pThis->bTLSActive = 1;
/* We now do the handshake */
CHKRet(relpTcpRtryHandshake(pThis));
finalize_it:
/* Accept appears to be done here */
pThis->pEngine->dbgprint((char*)"relpTcpAcceptConnReqInitTLS_ossl: END iRet = %d, "
"pThis=[%p], pThis->rtryCall=%d\n",
iRet, (void *) pThis, pThis->rtryOp);
if(iRet != RELP_RET_OK) {
if (pThis->ssl != NULL) {
/* Client BIO is freed within SSL_free() */
SSL_free(pThis->ssl);
pThis->ssl = NULL;
}
}
LEAVE_RELPFUNC;
}
/* Wrapper function for openssl lib client init */
static relpRetVal
relpTcpConnectTLSInit_ossl(relpTcp_t *const pThis)
{
int sockflags;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit openssl\n");
/* SSL Objects */
BIO *conn = NULL;
/* We expect a non blocking socket to establish a tls session */
if((sockflags = fcntl(pThis->sock, F_GETFL)) != -1) {
sockflags &= ~O_NONBLOCK;
sockflags = fcntl(pThis->sock, F_SETFL, sockflags);
}
if(sockflags == -1) {
pThis->pEngine->dbgprint((char*)"error %d unsetting fcntl(O_NONBLOCK) on relp socket\n", errno);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
if(called_openssl_global_init == 0) {
MUTEX_SETUP(mutSsl);
MUTEX_LOCK(mutSsl);
/* Init OpenSSL lib */
CHKRet(relpTcpInitTLS(pThis));
called_openssl_global_init = 1;
MUTEX_UNLOCK(mutSsl);
} else {
MUTEX_LOCK(mutSsl);
/*Increment OpenSSL Usage by 1*/
called_openssl_global_init++;
MUTEX_UNLOCK(mutSsl);
}
/*if we reach this point we are in tls mode */
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit: TLS Mode\n");
/* set before relpTcpSetSslConfCmd_ossl: tlsConfigCmd may contain
* flag-restricted commands that require SSL_CONF_FLAG_CLIENT */
pThis->sslState = osslClient;
if(!(pThis->ssl = SSL_new(ctx))) {
relpTcpLastSSLErrorMsg(0, pThis, "relpTcpConnectTLSInit");
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
// Set SSL_MODE_AUTO_RETRY to SSL obj
SSL_set_mode(pThis->ssl, SSL_MODE_AUTO_RETRY);
/* Load certificate data into SSL object */
if(!isAnonAuth(pThis)) {
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit: Init Client Certs \n");
CHKRet(relpTcpSslInitCerts(pThis, pThis->ownCertFile, pThis->privKeyFile));
} else
pThis->authmode = eRelpAuthMode_None;
/* Set TLS Options if configured */
CHKRet(relpTcpSetSslConfCmd_ossl(pThis, pThis->tlsConfigCmd));
/* Set TLS Priority Options */
CHKRet(relpTcpTLSSetPrio(pThis));
SSL_set_ex_data(pThis->ssl, 0, (void*)pThis);
/* Create BIO from ptcp socket! */
conn = relpTcpNewSocketBio_ossl(pThis->sock);
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit: Init conn BIO[%p] done\n", (void *)conn);
/* Set debug Callback for client BIO as well! */
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
BIO_set_callback_ex(conn, BIO_debug_callback_ex);
#else
BIO_set_callback(conn, BIO_debug_callback);
#endif
BIO_set_callback_arg(conn, (char *)pThis);
/* TODO: still needed? Set to NON blocking ! */
BIO_set_nbio( conn, 1 );
SSL_set_bio(pThis->ssl, conn, conn);
conn = NULL; /* SSL owns the BIO after SSL_set_bio() */
SSL_set_connect_state(pThis->ssl); /*sets ssl to work in client mode.*/
/* Perform the TLS handshake */
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit: try handshake for [%p]\n", (void *)pThis);
CHKRet(relpTcpRtryHandshake(pThis));
/* set the socket to non-blocking IO (we do this on the recv() for non-TLS */
if((sockflags = fcntl(pThis->sock, F_GETFL)) != -1) {
sockflags |= O_NONBLOCK;
/* SETFL could fail too, so get it caught by the subsequent
* error check. */
if(fcntl(pThis->sock, F_SETFL, sockflags) == -1) {
callOnErr(pThis, (char*) "error setting socket to non-blocking",
RELP_RET_ERR_TLS_SETUP);
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
}
finalize_it:
/* Connect appears to be done here */
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit: END iRet = %d, pThis=[%p], pNsd->rtryOp=%d\n",
iRet, (void *) pThis, pThis->rtryOp);
if(iRet != RELP_RET_OK) {
if(pThis->ssl != NULL) {
/* SSL owns conn after SSL_set_bio(). */
SSL_free(pThis->ssl);
pThis->ssl = NULL;
} else if(conn != NULL) {
BIO_free(conn);
}
}
LEAVE_RELPFUNC;
}
/* Wrapper function for openssl lib server init */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpLstnInitTLS_ossl(relpTcp_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
if(called_openssl_global_init == 0) {
MUTEX_SETUP(mutSsl);
MUTEX_LOCK(mutSsl);
/* Init OpenSSL lib */
CHKRet(relpTcpInitTLS(pThis));
called_openssl_global_init = 1;
MUTEX_UNLOCK(mutSsl);
} else {
MUTEX_LOCK(mutSsl);
/*Increment OpenSSL Usage by 1*/
called_openssl_global_init++;
MUTEX_UNLOCK(mutSsl);
}
/* Set TLS Options if configured */
CHKRet(relpTcpSetSslConfCmd_ossl(pThis, pThis->tlsConfigCmd));
pThis->pEngine->dbgprint((char*)"relpTcpLstnInitTLS openssl init done \n");
finalize_it:
LEAVE_RELPFUNC;
}
static void
relpTcpExitTLS_ossl(void)
{
if(called_openssl_global_init == 1) {
MUTEX_LOCK(mutSsl);
if (ctx != NULL) {
SSL_CTX_free(ctx);
ctx = NULL;
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
ENGINE_cleanup();
#endif
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
/* Reset global init state*/
called_openssl_global_init = 0;
MUTEX_UNLOCK(mutSsl);
pthread_mutex_destroy(&mutSsl);
} else if (called_openssl_global_init > 0) {
MUTEX_LOCK(mutSsl);
/* OpenSSL library still in use */
called_openssl_global_init--;
MUTEX_UNLOCK(mutSsl);
}
}
#ifndef _AIX
#pragma GCC diagnostic pop
#endif
#else /* #ifdef ENABLE_TLS_OPENSSL*/
/* here follow stub functions to use when openssl is not enabled */
static int
relpTcpChkPeerName_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED void *vcert)
{
return RELP_RET_ERR_INTERNAL;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpGetRtryDirection_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRtryHandshake_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpLstnInitTLS_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpAcceptConnReqInitTLS_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpSrv_t *const pSrv)
{
return RELP_RET_ERR_INTERNAL;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpConnectTLSInit_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* #ifdef ENABLE_TLS_OPENSSL */
/* Enable KEEPALIVE handling on the socket. */
static void
EnableKeepAlive(const relpTcp_t *__restrict__ const pThis,
const relpSrv_t *__restrict__ const pSrv,
const int sock)
{
int ret;
int optval;
socklen_t optlen;
optval = 1;
optlen = sizeof(optval);
ret = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen);
if(ret < 0) {
pThis->pEngine->dbgprint((char*)"librelp: EnableKeepAlive socket call "
"returns error %d\n", ret);
goto done;
}
# if defined(TCP_KEEPCNT)
if(pSrv->iKeepAliveProbes > 0) {
optval = pSrv->iKeepAliveProbes;
optlen = sizeof(optval);
ret = setsockopt(sock, SOL_TCP, TCP_KEEPCNT, &optval, optlen);
} else {
ret = 0;
}
# else
ret = -1;
# endif
if(ret < 0) {
callOnErr(pThis, (char*) "librelp cannot set keepalive probes - ignored",
RELP_RET_WRN_NO_KEEPALIVE);
}
# if defined(TCP_KEEPCNT)
if(pSrv->iKeepAliveTime > 0) {
optval = pSrv->iKeepAliveTime;
optlen = sizeof(optval);
ret = setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, &optval, optlen);
} else {
ret = 0;
}
# else
ret = -1;
# endif
if(ret < 0) {
callOnErr(pThis, (char*) "librelp cannot set keepalive time - ignored",
RELP_RET_WRN_NO_KEEPALIVE);
}
# if defined(TCP_KEEPCNT)
if(pSrv->iKeepAliveIntvl > 0) {
optval = pSrv->iKeepAliveIntvl;
optlen = sizeof(optval);
ret = setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, &optval, optlen);
} else {
ret = 0;
}
# else
ret = -1;
# endif
if(ret < 0) {
callOnErr(pThis, (char*) "librelp cannot set keepalive intvl - ignored",
RELP_RET_WRN_NO_KEEPALIVE);
}
// pThis->pEngine->dbgprint((char*)"KEEPALIVE enabled for socket %d\n", sock);
done:
return;
}
/* a portable way to put the current thread asleep. Note that
* using the sleep() API family may result in the whole process
* to be put asleep on some platforms.
*/
static void
doSleep(int iSeconds, const int iuSeconds)
{
struct timeval tvSelectTimeout;
tvSelectTimeout.tv_sec = iSeconds;
tvSelectTimeout.tv_usec = iuSeconds; /* micro seconds */
select(0, NULL, NULL, NULL, &tvSelectTimeout);
}
/* accept an incoming connection request, sock provides the socket on which we can
* accept the new session.
* rgerhards, 2008-03-17
*/
relpRetVal
relpTcpAcceptConnReq(relpTcp_t **ppThis, const int sock, relpSrv_t *const pSrv)
{
relpTcp_t *pThis = NULL;
int sockflags;
struct sockaddr_storage addr;
socklen_t addrlen = sizeof(addr);
int iNewSock = -1;
relpEngine_t *pEngine = pSrv->pEngine;
ENTER_RELPFUNC;
assert(ppThis != NULL);
iNewSock = accept(sock, (struct sockaddr*) &addr, &addrlen);
if(iNewSock < 0) {
char errStr[1024];
_relpEngine_strerror_r(errno, errStr, sizeof(errStr));
pSrv->pEngine->dbgprint((char*)"error during accept, sleeping 20ms: %s\n", errStr);
doSleep(0, 20000);
pSrv->pEngine->dbgprint((char*)"END SLEEP\n");
ABORT_FINALIZE(RELP_RET_ACCEPT_ERR);
}
/* construct our object so that we can use it... */
CHKRet(relpTcpConstruct(&pThis, pEngine, RELP_SRV_CONN, pSrv));
pThis->pUsr = pSrv->pUsr;
if(pSrv->bKeepAlive)
EnableKeepAlive(pThis, pSrv, iNewSock);
/* TODO: obtain hostname, normalize (callback?), save it */
CHKRet(relpTcpSetRemHost(pThis, (struct sockaddr*) &addr));
pThis->pEngine->dbgprint((char*)"remote host is '%s', ip '%s'\n", pThis->pRemHostName, pThis->pRemHostIP);
/* set the new socket to non-blocking IO */
if((sockflags = fcntl(iNewSock, F_GETFL)) != -1) {
sockflags |= O_NONBLOCK;
/* SETFL could fail too, so get it caught by the subsequent
* error check.
*/
sockflags = fcntl(iNewSock, F_SETFL, sockflags);
}
if(sockflags == -1) {
pThis->pEngine->dbgprint((char*)"error %d setting fcntl(O_NONBLOCK) "
"on relp socket %d", errno, iNewSock);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
pThis->sock = iNewSock;
iNewSock = -1; /* ownership transferred to pThis */
CHKRet(relpTcpAcceptConnReqInitTLS(pThis, pSrv));
*ppThis = pThis;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pThis != NULL)
relpTcpDestruct(&pThis);
if(iNewSock >= 0)
close(iNewSock);
}
LEAVE_RELPFUNC;
}
#if defined(HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION) || defined(ENABLE_TLS_OPENSSL)
/* check a peer against a wildcard entry. This is a more lengthy
* operation.
*/
static void
relpTcpChkOnePeerWildcard(tcpPermittedPeerWildcardComp_t *pRoot,
const char *peername,
int *pbFoundPositiveMatch,
relpEngine_t *const pEngine)
{
tcpPermittedPeerWildcardComp_t *pWildcard;
const char *pC;
const char *pStart; /* start of current domain component */
int iWildcard, iName; /* work indexes for backward comparisons */
*pbFoundPositiveMatch = 0;
pWildcard = pRoot;
pC = peername;
while(*pC != '\0') {
if(pWildcard == NULL) {
/* we have more domain components than we have wildcards --> no match */
goto done;
}
pStart = pC;
while(*pC != '\0' && *pC != '.') {
++pC;
}
/* got the component, now do the match */
switch(pWildcard->wildcardType) {
case tcpPEER_WILDCARD_NONE:
if( pWildcard->lenDomainPart != pC - pStart
|| strncmp((char*)pStart, (char*)pWildcard->pszDomainPart, pC - pStart)) {
goto done;
}
break;
case tcpPEER_WILDCARD_AT_START:
/* we need to do the backwards-matching manually */
if(pWildcard->lenDomainPart > pC - pStart) {
goto done;
}
iName = (size_t) (pC - pStart) - pWildcard->lenDomainPart;
iWildcard = 0;
while(iWildcard < pWildcard->lenDomainPart) {
if(pWildcard->pszDomainPart[iWildcard] != pStart[iName]) {
goto done;
}
++iName;
++iWildcard;
}
break;
case tcpPEER_WILDCARD_AT_END:
if( pWildcard->lenDomainPart > pC - pStart
|| strncmp((char*)pStart, (char*)pWildcard->pszDomainPart,
pWildcard->lenDomainPart)) {
goto done;
}
break;
case tcpPEER_WILDCARD_MATCH_ALL:
/* everything is OK, just continue */
break;
case tcpPEER_WILDCARD_EMPTY_COMPONENT:
if(pC - pStart > 0) {
/* if it is not empty, it is no match... */
goto done;
}
break;
default:assert(0); /* make sure we die when debugging */
relpEngineCallOnGenericErr(pEngine,
"librelp", RELP_RET_ERR_INTERNAL,
"invalid wildcardType %d in %s:%d",
pWildcard->wildcardType, __FILE__, __LINE__);
break;
}
pWildcard = pWildcard->pNext; /* we processed this entry */
/* skip '.' if we had it and so prepare for next iteration */
if(*pC == '.')
++pC;
}
/* we need to adjust for a border case, that is if the last component is
* empty. That happens frequently if the domain root (e.g. "example.com.")
* is properly given.
*/
if(pWildcard != NULL && pWildcard->wildcardType == tcpPEER_WILDCARD_EMPTY_COMPONENT)
pWildcard = pWildcard->pNext;
if(pWildcard != NULL) {
/* we have more domain components than in the name to be
* checked. So this is no match.
*/
goto done;
}
*pbFoundPositiveMatch = 1;
done: return;
}
/* Perform a match on ONE peer name obtained from the certificate. This name
* is checked against the set of configured credentials. *pbFoundPositiveMatch is
* set to 1 if the ID matches. *pbFoundPositiveMatch must have been initialized
* to 0 by the caller (this is a performance enhancement as we expect to be
* called multiple times).
*/
static void
relpTcpChkOnePeerName(relpTcp_t *const pThis, char *peername, int *pbFoundPositiveMatch)
{
int i;
for(i = 0 ; i < pThis->permittedPeers.nmemb ; ++i) {
pThis->pEngine->dbgprint((char*)"relpTcpChkOnePeerName: compare peername "
"'%s' with permitted name '%s'\n",
peername, pThis->permittedPeers.peer[i].name);
if(pThis->permittedPeers.peer[i].wildcardRoot == NULL) {
/* simple string, only, no wildcards */
if(!strcmp(peername, pThis->permittedPeers.peer[i].name)) {
*pbFoundPositiveMatch = 1;
break;
}
} else {
relpTcpChkOnePeerWildcard(pThis->permittedPeers.peer[i].wildcardRoot,
peername, pbFoundPositiveMatch, pThis->pEngine);
if (*pbFoundPositiveMatch)
break;
}
}
}
/* helper to consistently add names to error message buffer */
static int
relpTcpAddToCertNamesBuffer(relpTcp_t *const pThis,
char *const buf,
const size_t buflen,
int *p_currIdx,
const char *const certName)
{
int r = 0;
assert(buf != NULL);
assert(p_currIdx != NULL);
const int currIdx = *p_currIdx;
const int n = snprintf(buf + currIdx, buflen - currIdx,
"DNSname: %s; ", certName);
if(n < 0 || n >= (int) (buflen - currIdx)) {
callOnAuthErr(pThis, "", "certificate validation failed, names "
"inside certificate are way too long (> 32KiB)",
RELP_RET_AUTH_CERT_INVL);
r = RELP_RET_PARAM_ERROR;
} else {
*p_currIdx += n;
}
return r;
}
#endif /* defined(HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION) || defined(ENABLE_TLS_OPENSSL) */
#if defined(WITH_TLS)
/* Obtain the CN from the DN field and hand it back to the caller
* (which is responsible for destructing it). We try to follow
* RFC2253 as far as it makes sense for our use-case. This function
* is considered a compromise providing good-enough correctness while
* limiting code size and complexity. If a problem occurs, we may enhance
* this function. A (pointer to a) certificate must be caller-provided.
* The buffer for the name (namebuf) must also be caller-provided. A
* size of 1024 is most probably sufficien. The
* function returns 0 if all went well, something else otherwise.
* Note that non-0 is also returned if no CN is found.
*/
static int LIBRELP_ATTR_NONNULL()
relpTcpGetCN(char *const namebuf, const size_t lenNamebuf, const char *const szDN)
{
int r;
size_t i,j;
int bFound;
/* now search for the CN part */
i = 0;
bFound = 0;
while(!bFound && szDN[i] != '\0') {
/* note that we do not overrun our string due to boolean shortcut
* operations. If we have '\0', the if does not match and evaluation
* stops. Order of checks is obviously important!
*/
if(szDN[i] == 'C' && szDN[i+1] == 'N' && szDN[i+2] == '=') {
bFound = 1;
i += 2;
}
i++;
}
if(!bFound) {
r = 1; goto done;
}
/* we found a common name, now extract it */
j = 0;
while(szDN[i] != '\0' && szDN[i] != ',' && szDN[i] != '/' && j < lenNamebuf-1) {
if(szDN[i] == '\\') {
/* hex escapes are not implemented */
r = 2; goto done;
} else {
namebuf[j++] = szDN[i];
}
++i; /* char processed */
}
namebuf[j] = '\0';
/* we got it - we ignore the rest of the DN string (if any). So we may
* not detect if it contains more than one CN
*/
r = 0;
done:
return r;
}
#endif /* WITH_TLS */
#if defined(ENABLE_TLS)
#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
/* Glue to use the right type of function depending of the version */
#if GNUTLS_VERSION_NUMBER < 0x030202
//gnutls_mac_algorithm_t and gnutls_digest_algorithm_t are aligned
//So we can use the result to get the fingerprint without trouble
typedef gnutls_mac_algorithm_t digest_id_t;
static digest_id_t digest_get_id(const char * name){return gnutls_mac_get_id (name);}
static const char* digest_get_name(digest_id_t id){return gnutls_mac_get_name (id);}
# define UNK_DIGEST GNUTLS_MAC_UNKNOWN
#else
typedef gnutls_digest_algorithm_t digest_id_t;
static digest_id_t digest_get_id(const char * name){return gnutls_digest_get_id (name);}
static const char* digest_get_name(digest_id_t id){return gnutls_digest_get_name (id);}
# define UNK_DIGEST GNUTLS_DIG_UNKNOWN
#endif
/* Convert a fingerprint to printable data. The function must be provided a
* sufficiently large buffer. 1024 bytes shall always do (for sha512 and future).
* To the size of the hexadecimal fingerprint, we must add the name of the fingerprint, and the separators.
* Warn : if the size of the buffer isn't sufficient, then the data is truncated.
*/
static void
GenFingerprintStr(const char *pFingerprint,const int sizeFingerprint,
char * fpBuf,const size_t bufLen,
const digest_id_t type,relpEngine_t * pEngine)
{
int iSrc, iDst;
size_t sizeTotal=0,sizeDigest=0;
//statically assigned char*, no free.
const char* digestType=digest_get_name(type);
if (NULL==digestType)
{
if (pEngine!=NULL)
pEngine->dbgprint((char*)"warn : the signature type %d is unknown\n",type);
digestType="0000";
}
sizeDigest=strlen(digestType);
//digestname + 3 char by byte (:xx) + last '\0'
sizeTotal=sizeDigest+(sizeFingerprint*3)+1;
if (sizeTotal =1){
if (pEngine!=NULL)
pEngine->dbgprint((char*)"warn: buffer overflow for %s signature\n",digestType);
fpBuf[0]='\0';//an empty string
}else{
if (pEngine!=NULL)
pEngine->dbgprint((char*)"warn: buffer empty, unable to print the signature\n");
}
}
#define MAX_DIGEST_PEER 10
static size_t ListDigestPeer(digest_id_t* listSigPeer,
tcpPermittedPeers_t* listPeers,relpEngine_t* pEngine)
{
int i;
int maxDigest=0;
//No signature name of more than 32 bytes.
//Most take 4. Some are slightly longer (SHA3_256, ...)
char digest[32];
if (NULL==listPeers || listPeers->nmemb<=0 )
{
if (pEngine!=NULL) pEngine->dbgprint((char*)"warn: no PermittedPeer listed\n");
return 0;
}
for (i=0; inmemb;++i)
{
if ((listPeers->peer[i].name)!=NULL)
{
char*eow=strchr(listPeers->peer[i].name,':');//The first separator
if (eow!=NULL)
{
int sizeDigest=(int)(eow-(listPeers->peer[i].name));
//31= sizeof(digest)-1;
sizeDigest = sizeDigest > 31 ? 31: sizeDigest;
strncpy(digest,listPeers->peer[i].name,sizeDigest);
digest[sizeDigest]='\0';
digest_id_t actualDigest=digest_get_id(digest);
if (actualDigest!=UNK_DIGEST)
{
int alreadyExist=0;
int j;
for (j=0;jdbgprint((char*)"DDDD: adding digest %s\n",
digest);
listSigPeer[maxDigest++]=actualDigest;
}
}
}
}
}
return maxDigest;
}
/* Check the peer's ID in fingerprint auth mode. */
static int
relpTcpChkPeerFingerprint(relpTcp_t *const pThis, gnutls_x509_crt_t cert)
{
int r = 0;
int i;
char fingerprint[126];
char fpPrintable[256];
digest_id_t listSigPeer[MAX_DIGEST_PEER];
size_t maxDigest,k;
size_t size;
int8_t found;
/* List which digest we have in our permittedPeer list. We verify only the first MAX_DIGEST_PEER.*/
maxDigest=ListDigestPeer(listSigPeer,&(pThis->permittedPeers),pThis->pEngine);
/* obtain the SHA1 fingerprint */
found = 0;
for(k=0; kpEngine);
pThis->pEngine->dbgprint((char*)"peer's certificate %s fingerprint: %s\n",
digest_get_name(digest), fpPrintable);
/* now search through the permitted peers to see if we can find a permitted one */
pThis->pEngine->dbgprint((char*)"n peers %d\n", pThis->permittedPeers.nmemb);
for(i = 0 ; i < pThis->permittedPeers.nmemb ; ++i) {
pThis->pEngine->dbgprint((char*)"checking peer '%s','%s'\n",
fpPrintable, pThis->permittedPeers.peer[i].name);
if(!strcmp(fpPrintable, pThis->permittedPeers.peer[i].name)) {
found = 1;
break;
}
}
}
if(!found) {
r = GNUTLS_E_CERTIFICATE_ERROR; goto done;
}
done:
if(r != 0) {
callOnAuthErr(pThis, fpPrintable, "non-permited fingerprint", RELP_RET_AUTH_ERR_FP);
}
return r;
}
#endif /* #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
#if defined(HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION)
/* Obtain the CN from the DN of the GnuTLS certificate.
*/
static int
relpTcpGetCNFromCert(relpTcp_t *const pThis, gnutls_x509_crt_t cert, char *namebuf, const size_t lenNamebuf)
{
int r;
int gnuRet;
size_t size;
char szDN[1024]; /* this should really be large enough for any non-malicious case... */
size = sizeof(szDN);
gnuRet = gnutls_x509_crt_get_dn(cert, (char*)szDN, &size);
if(chkGnutlsCode(pThis, "Failed to obtain DN from certificate", RELP_RET_ERR_TLS, gnuRet)) {
r = 1; goto done;
}
r = relpTcpGetCN(namebuf, lenNamebuf, szDN);
done:
return r;
}
/* Check the peer's ID in name auth mode. */
static int
relpTcpChkPeerName_gtls(relpTcp_t *const pThis, void *vcert)
{
int ret;
unsigned int status = 0;
char cnBuf[1024]; /* this is sufficient for the DNSNAME... */
char szAltName[1024]; /* this is sufficient for the DNSNAME... */
int iAltName;
char allNames[32*1024]; /* for error-reporting */
int iAllNames;
size_t szAltNameLen;
int bFoundPositiveMatch;
int gnuRet;
gnutls_x509_crt_t cert = (gnutls_x509_crt_t) vcert;
ENTER_RELPFUNC;
ret = gnutls_certificate_verify_peers2(pThis->session, &status);
if(ret < 0) {
callOnAuthErr(pThis, "", "certificate validation failed",
RELP_RET_AUTH_CERT_INVL);
ABORT_FINALIZE(GNUTLS_E_CERTIFICATE_ERROR);
}
if(status != 0) { /* Certificate is not trusted */
callOnAuthErr(pThis, "", "certificate validation failed",
RELP_RET_AUTH_CERT_INVL);
ABORT_FINALIZE(GNUTLS_E_CERTIFICATE_ERROR);
}
bFoundPositiveMatch = 0;
iAllNames = 0;
/* first search through the dNSName subject alt names */
iAltName = 0;
while(!bFoundPositiveMatch) { /* loop broken below */
szAltNameLen = sizeof(szAltName);
gnuRet = gnutls_x509_crt_get_subject_alt_name(cert, iAltName,
szAltName, &szAltNameLen, NULL);
if(gnuRet < 0)
break;
else if(gnuRet == GNUTLS_SAN_DNSNAME) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_gtls: subject alt dnsName: '%s'\n",
szAltName);
if (relpTcpAddToCertNamesBuffer(pThis, allNames, sizeof(allNames),
&iAllNames, szAltName) != 0) {
ABORT_FINALIZE(GNUTLS_E_CERTIFICATE_ERROR);
}
relpTcpChkOnePeerName(pThis, szAltName, &bFoundPositiveMatch);
/* do NOT break, because there may be multiple dNSName's! */
}
++iAltName;
}
if(!bFoundPositiveMatch) {
/* if we did not succeed so far, we try the CN part of the DN... */
if(relpTcpGetCNFromCert(pThis, cert, cnBuf, sizeof(cnBuf)) == 0) {
pThis->pEngine->dbgprint((char*)"relpTcpChkPeerName_gtls: relpTcp now "
"checking auth for CN '%s'\n", cnBuf);
if (relpTcpAddToCertNamesBuffer(pThis, allNames, sizeof(allNames), &iAllNames, cnBuf)) {
ABORT_FINALIZE(GNUTLS_E_CERTIFICATE_ERROR);
}
relpTcpChkOnePeerName(pThis, cnBuf, &bFoundPositiveMatch);
}
}
if(!bFoundPositiveMatch) {
callOnAuthErr(pThis, allNames, "no permited name found", RELP_RET_AUTH_ERR_NAME);
ABORT_FINALIZE(GNUTLS_E_CERTIFICATE_ERROR);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* This function will verify the peer's certificate, and check
* if the hostname matches, as well as the activation, expiration dates.
*/
static int
relpTcpVerifyCertificateCallback(gnutls_session_t session)
{
int r = 0;
const gnutls_datum_t *cert_list;
unsigned int list_size = 0;
gnutls_x509_crt_t cert;
int bMustDeinitCert = 0;
relpTcp_t *const pThis = (relpTcp_t*) gnutls_session_get_ptr(session);
/* This function only works for X.509 certificates. */
if(gnutls_certificate_type_get(session) != GNUTLS_CRT_X509) {
r = GNUTLS_E_CERTIFICATE_ERROR; goto done;
}
cert_list = gnutls_certificate_get_peers(pThis->session, &list_size);
if(list_size < 1) {
callOnAuthErr(pThis, "", "peer did not provide a certificate",
RELP_RET_AUTH_NO_CERT);
r = GNUTLS_E_CERTIFICATE_ERROR; goto done;
}
/* If we reach this point, we have at least one valid certificate.
* We always use only the first certificate. As of GnuTLS documentation, the
* first certificate always contains the remote peer's own certificate. All other
* certificates are issuer's certificates (up the chain). We are only interested
* in the first certificate, which is our peer. -- rgerhards, 2008-05-08
*/
gnutls_x509_crt_init(&cert);
bMustDeinitCert = 1; /* indicate cert is initialized and must be freed on exit */
gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER);
if(pThis->authmode == eRelpAuthMode_Fingerprint) {
r = relpTcpChkPeerFingerprint(pThis, cert);
} else if(pThis->authmode == eRelpAuthMode_Name){
r = relpTcpChkPeerName(pThis, (void*)cert);
}
if(r != 0) goto done;
/* notify gnutls to continue handshake normally */
r = 0;
done:
if(bMustDeinitCert)
gnutls_x509_crt_deinit(cert);
return r;
}
#endif /* #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
#if 0 /* enable if needed for debugging */
static void logFunction(int level, const char *msg)
{
fprintf(stdout, "DDDD: GnuTLS log msg, level %d: %s", level, msg);
fflush(stdout);
}
#endif
/* initialize the listener for TLS use */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpLstnInitTLS_gtls(relpTcp_t *const pThis)
{
int r;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* gcry_control must be called first, so that the thread system is correctly set up */
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
#endif
gnutls_global_init();
/* uncomment for (very intense) debug help
* gnutls_global_set_log_function(logFunction);
* gnutls_global_set_log_level(10); // 0 (no) to 9 (most), 10 everything
*/
if(isAnonAuth(pThis)) {
r = gnutls_dh_params_init(&pThis->dh_params);
if(chkGnutlsCode(pThis, "Failed to initialize dh_params", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
r = gnutls_dh_params_generate2(pThis->dh_params, pThis->dhBits);
if(chkGnutlsCode(pThis, "Failed to generate dh_params", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
r = gnutls_anon_allocate_server_credentials(&pThis->anoncredSrv);
if(chkGnutlsCode(pThis, "Failed to allocate server credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
gnutls_anon_set_server_dh_params(pThis->anoncredSrv, pThis->dh_params);
} else {
# ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
r = gnutls_certificate_allocate_credentials(&pThis->xcred);
if(chkGnutlsCode(pThis, "Failed to allocate certificate credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
if(pThis->caCertFile != NULL) {
r = gnutls_certificate_set_x509_trust_file(pThis->xcred,
pThis->caCertFile, GNUTLS_X509_FMT_PEM);
if(r < 0) {
chkGnutlsCode(pThis, "Failed to set certificate trust files",
RELP_RET_ERR_TLS_SETUP, r);
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
pThis->pEngine->dbgprint((char*)"librelp: obtained %d certificates from %s\n",
r, pThis->caCertFile);
}
r = gnutls_certificate_set_x509_key_file (pThis->xcred,
pThis->ownCertFile, pThis->privKeyFile, GNUTLS_X509_FMT_PEM);
if(chkGnutlsCode(pThis, "Failed to set certificate key files", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
if(pThis->authmode == eRelpAuthMode_None)
pThis->authmode = eRelpAuthMode_Fingerprint;
gnutls_certificate_set_verify_function(pThis->xcred, relpTcpVerifyCertificateCallback);
# else /* #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
ABORT_FINALIZE(RELP_RET_ERR_NO_TLS_AUTH);
# endif /* #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
}
finalize_it:
LEAVE_RELPFUNC;
}
#else /* #ifdef ENABLE_TLS */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpLstnInitTLS_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* defined(ENABLE_TLS)*/
/* add a wildcard entry to this permitted peer. Entries are always
* added at the tail of the list. pszStr and lenStr identify the wildcard
* entry to be added. Note that the string is NOT \0 terminated, so
* we must rely on lenStr for when it is finished.
* rgerhards, 2008-05-27
*/
static relpRetVal
AddPermittedPeerWildcard(tcpPermittedPeerEntry_t *pEtry, char* pszStr, const int lenStr)
{
tcpPermittedPeerWildcardComp_t *pNew = NULL;
int iSrc;
int iDst;
ENTER_RELPFUNC;
if((pNew = calloc(1, sizeof(tcpPermittedPeerWildcardComp_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
if(lenStr == 0) {
pNew->wildcardType = tcpPEER_WILDCARD_EMPTY_COMPONENT;
FINALIZE;
} else {
/* alloc memory for the domain component. We may waste a byte or
* two, but that's ok.
*/
if((pNew->pszDomainPart = malloc(lenStr +1 )) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
}
if(pszStr[0] == '*') {
pNew->wildcardType = tcpPEER_WILDCARD_AT_START;
iSrc = 1; /* skip '*' */
} else {
iSrc = 0;
}
for(iDst = 0 ; iSrc < lenStr && pszStr[iSrc] != '*' ; ++iSrc, ++iDst) {
pNew->pszDomainPart[iDst] = pszStr[iSrc];
}
if(iSrc < lenStr) {
if(iSrc + 1 == lenStr && pszStr[iSrc] == '*') {
if(pNew->wildcardType == tcpPEER_WILDCARD_AT_START) {
ABORT_FINALIZE(RELP_RET_INVLD_WILDCARD);
} else {
pNew->wildcardType = tcpPEER_WILDCARD_AT_END;
}
} else {
/* we have an invalid wildcard, something follows the asterisk! */
ABORT_FINALIZE(RELP_RET_INVLD_WILDCARD);
}
}
if(lenStr == 1 && pNew->wildcardType == tcpPEER_WILDCARD_AT_START) {
pNew->wildcardType = tcpPEER_WILDCARD_MATCH_ALL;
}
/* if we reach this point, we had a valid wildcard. We now need to
* properly terminate the domain component string.
*/
pNew->pszDomainPart[iDst] = '\0';
pNew->lenDomainPart = (int16_t) strlen((char*)pNew->pszDomainPart);
finalize_it:
if(iRet != RELP_RET_OK) {
if(pNew != NULL) {
if(pNew->pszDomainPart != NULL)
free(pNew->pszDomainPart);
free(pNew);
}
} else {
/* add the element to linked list */
if(pEtry->wildcardRoot == NULL) {
pEtry->wildcardRoot = pNew;
pEtry->wildcardLast = pNew;
} else {
pEtry->wildcardLast->pNext = pNew;
}
pEtry->wildcardLast = pNew;
}
LEAVE_RELPFUNC;
}
#if defined(WITH_TLS)
/* Compile a wildcard - must not yet be compiled */
static relpRetVal
relpTcpPermittedPeerWildcardCompile(tcpPermittedPeerEntry_t *pEtry)
{
char *pC;
char *pStart;
ENTER_RELPFUNC;
/* first check if we have a wildcard */
for(pC = pEtry->name ; *pC != '\0' && *pC != '*' ; ++pC)
/*EMPTY, just skip*/;
if(*pC == '\0') { /* no wildcard found, we are done */
FINALIZE;
}
/* if we reach this point, the string contains wildcards. So let's
* compile the structure. To do so, we must parse from dot to dot
* and create a wildcard entry for each domain component we find.
* We must also flag problems if we have an asterisk in the middle
* of the text (it is supported at the start or end only).
*/
pC = pEtry->name;
while(*pC) {
pStart = pC;
/* find end of domain component */
for( ; *pC != '\0' && *pC != '.' ; ++pC)
/*EMPTY, just skip*/;
CHKRet(AddPermittedPeerWildcard(pEtry, pStart, pC - pStart));
/* now check if we have an empty component at end of string */
if(*pC == '.' && *(pC + 1) == '\0') {
/* pStart is a dummy, it is not used if length is 0 */
CHKRet(AddPermittedPeerWildcard(pEtry, pStart, 0));
}
if(*pC != '\0')
++pC;
}
finalize_it:
LEAVE_RELPFUNC;
}
#endif /* defined(WITH_TLS) */
/* initialize the tcp socket for a listner
* pLstnPort is a pointer to a port name. NULL is not permitted.
* gerhards, 2008-03-17
* pLstnAddr is a pointer to a bind address. NULL is permitted.
* perlei, 2018-04-19
*/
relpRetVal
relpTcpLstnInit(relpTcp_t *const pThis, unsigned char *pLstnPort, unsigned char *pLstnAddr, int ai_family)
{
struct addrinfo hints, *res = NULL, *r;
int error, maxs, *s, on = 1;
int sockflags;
unsigned char *pLstnPt;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pLstnPt = pLstnPort;
assert(pLstnPt != NULL);
pThis->pEngine->dbgprint((char*)"creating relp tcp listen socket on port %s\n", pLstnPt);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE;
hints.ai_family = ai_family;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo((char*)pLstnAddr, (char*) pLstnPt, &hints, &res);
if(error) {
pThis->pEngine->dbgprint((char*)"error %d querying port '%s'\n", error, pLstnPt);
ABORT_FINALIZE(RELP_RET_INVALID_PORT);
}
/* Count max number of sockets we may open */
for(maxs = 0, r = res; r != NULL ; r = r->ai_next, maxs++)
/* EMPTY */;
pThis->socks = malloc((maxs+1) * sizeof(int));
if (pThis->socks == NULL) {
pThis->pEngine->dbgprint((char*)"couldn't allocate memory for TCP listen sockets, "
"suspending RELP message reception.\n");
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
*pThis->socks = 0; /* num of sockets counter at start of array */
s = pThis->socks + 1;
for(r = res; r != NULL ; r = r->ai_next) {
*s = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
if (*s < 0) {
if(!(r->ai_family == PF_INET6 && errno == EAFNOSUPPORT))
pThis->pEngine->dbgprint((char*)"creating relp tcp listen socket\n");
/* it is debatable if PF_INET with EAFNOSUPPORT should
* also be ignored...
*/
continue;
}
#ifdef IPV6_V6ONLY
if (r->ai_family == AF_INET6) {
int iOn = 1;
if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
(char *)&iOn, sizeof (iOn)) < 0) {
close(*s);
*s = -1;
continue;
}
}
#endif
if(setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) < 0 ) {
pThis->pEngine->dbgprint((char*)"error %d setting relp/tcp socket option\n", errno);
close(*s);
*s = -1;
continue;
}
/* We use non-blocking IO! */
if((sockflags = fcntl(*s, F_GETFL)) != -1) {
sockflags |= O_NONBLOCK;
/* SETFL could fail too, so get it caught by the subsequent
* error check.
*/
sockflags = fcntl(*s, F_SETFL, sockflags);
}
if(sockflags == -1) {
pThis->pEngine->dbgprint((char*)"error %d setting fcntl(O_NONBLOCK) on relp socket\n", errno);
close(*s);
*s = -1;
continue;
}
if( (bind(*s, r->ai_addr, r->ai_addrlen) < 0)
#ifndef IPV6_V6ONLY
&& (errno != EADDRINUSE)
#endif
) {
char msgbuf[4096];
snprintf(msgbuf, sizeof(msgbuf), "error while binding relp tcp socket "
"on port '%s'", pLstnPort);
msgbuf[sizeof(msgbuf)-1] = '\0';
callOnErr(pThis, msgbuf, errno);
close(*s);
*s = -1;
continue;
}
CHKRet(relpTcpLstnInitTLS(pThis));
if(listen(*s,pThis->iSessMax / 10 + 5) < 0) {
/* If the listen fails, it most probably fails because we ask
* for a too-large backlog. So in this case we first set back
* to a fixed, reasonable, limit that should work. Only if
* that fails, too, we give up.
*/
pThis->pEngine->dbgprint((char*)"listen with a backlog of %d failed - "
"retrying with default of 32.\n", pThis->iSessMax / 10 + 5);
if(listen(*s, 32) < 0) {
pThis->pEngine->dbgprint((char*)"relp listen error %d, suspending\n", errno);
close(*s);
*s = -1;
continue;
}
}
(*pThis->socks)++;
s++;
}
if(*pThis->socks != maxs)
pThis->pEngine->dbgprint((char*)"We could initialize %d RELP TCP listen sockets out of %d we received "
"- this may or may not be an error indication.\n", *pThis->socks, maxs);
if(*pThis->socks == 0) {
pThis->pEngine->dbgprint((char*)"No RELP TCP listen socket could successfully be initialized, "
"message reception via RELP disabled.\n");
/* free(pThis->socks);
* DONE IN relpTcpDestruct!
*/
ABORT_FINALIZE(RELP_RET_COULD_NOT_BIND);
}
finalize_it:
if(res != NULL)
freeaddrinfo(res);
LEAVE_RELPFUNC;
}
/* -- first TLS-lib specific versions -- */
#if defined(ENABLE_TLS)
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRcv_gtls(relpTcp_t *const pThis, relpOctet_t *const pRcvBuf, ssize_t *const pLenBuf)
{
ENTER_RELPFUNC;
int lenRcvd;
RELPOBJ_assert(pThis, Tcp);
lenRcvd = gnutls_record_recv(pThis->session, pRcvBuf, *pLenBuf);
if(lenRcvd > 0) {
*pLenBuf = lenRcvd;
pThis->pEngine->dbgprint((char*)"relpTcpRcv_gtls: gnutls_record_recv SUCCESS len %d\n", lenRcvd);
} else {
*pLenBuf = -1;
if(lenRcvd == GNUTLS_E_INTERRUPTED || lenRcvd == GNUTLS_E_AGAIN) {
pThis->pEngine->dbgprint((char*)"relpTcpRcv_gtls: gnutls_record_recv must be retried %d\n", lenRcvd);
pThis->rtryOp = relpTCP_RETRY_recv;
} else {
pThis->rtryOp = relpTCP_RETRY_none;
chkGnutlsCode(pThis, "TLS record reception failed", RELP_RET_IO_ERR, lenRcvd);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
}
finalize_it:
LEAVE_RELPFUNC;
}
#else
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRcv_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pRcvBuf,
LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* defined(ENABLE_TLS) */
#if defined(ENABLE_TLS_OPENSSL)
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRcv_ossl(relpTcp_t *const pThis, relpOctet_t *const pRcvBuf, ssize_t *const pLenBuf)
{
ENTER_RELPFUNC;
int lenRcvd;
RELPOBJ_assert(pThis, Tcp);
lenRcvd = SSL_read(pThis->ssl, pRcvBuf, *pLenBuf);
if(lenRcvd > 0) {
pThis->rtryOp = relpTCP_RETRY_none;
pThis->pEngine->dbgprint((char*)"relpTcpRcv_ossl: SSL_read SUCCESS len %d\n", lenRcvd);
*pLenBuf = lenRcvd;
} else {
*pLenBuf = -1;
int err = SSL_get_error(pThis->ssl, lenRcvd);
if( err == SSL_ERROR_ZERO_RETURN ) {
pThis->pEngine->dbgprint((char*)"relpTcpRcv_ossl: SSL_ERROR_ZERO_RETURN received, "
"connection may closed already\n");
pThis->rtryOp = relpTCP_RETRY_none;
ABORT_FINALIZE(RELP_RET_IO_ERR);
} else if(err != SSL_ERROR_WANT_READ &&
err != SSL_ERROR_WANT_WRITE) {
/* Output error and abort */
relpTcpLastSSLErrorMsg(lenRcvd, pThis, "relpTcpRcv_ossl");
pThis->rtryOp = relpTCP_RETRY_none;
ABORT_FINALIZE(RELP_RET_IO_ERR);
} else {
pThis->pEngine->dbgprint((char*)"relpTcpRcv_ossl: SSL_get_error = %d, setting RETRY \n", err);
pThis->rtryOp = relpTCP_RETRY_recv;
pThis->rtryOsslErr = err; /* Store SSL ErrorCode into*/
}
}
finalize_it:
LEAVE_RELPFUNC;
}
#else
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRcv_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pRcvBuf,
LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* defined(ENABLE_TLS_OPENSSL) */
/* receive data from a tcp socket
* The lenBuf parameter must contain the max buffer size on entry and contains
* the number of octets read (or -1 in case of error) on exit. This function
* never blocks, not even when called on a blocking socket. That is important
* for client sockets, which are set to block during send, but should not
* block when trying to read data. If *pLenBuf is -1, an error occured and
* errno holds the exact error cause.
* rgerhards, 2008-03-17
*/
relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRcv(relpTcp_t *const pThis, relpOctet_t *const pRcvBuf, ssize_t *const pLenBuf)
{
ENTER_RELPFUNC;
int lenRcvd = 0;
RELPOBJ_assert(pThis, Tcp);
if(pThis->bEnableTLS) {
if(pThis->pEngine->tls_lib == 0) {
relpTcpRcv_gtls(pThis, pRcvBuf, pLenBuf);
} else {
relpTcpRcv_ossl(pThis, pRcvBuf, pLenBuf);
}
} else {
*pLenBuf = lenRcvd = recv(pThis->sock, pRcvBuf, *pLenBuf, MSG_DONTWAIT);
if(lenRcvd > 0) {
pThis->pEngine->dbgprint((char*)"relpTcpRcv: read %zd bytes from sock %d\n",
*pLenBuf, pThis->sock);
} else if(lenRcvd == 0) {
pThis->pEngine->dbgprint((char*)"relpTcpRcv: read 0 bytes, invalidating closed socket\n");
} else {
// Handle for errno code
if(errno == EAGAIN) {
// Set mode to Retry
pThis->rtryOp = relpTCP_RETRY_recv;
} else if(errno == ECONNRESET) {
pThis->pEngine->dbgprint((char*)"relpTcpRcv: read failed with errno ECONNRESET!\n");
#if defined(_AIX)
} else if( errno == 0 ||
errno == EINTR) {
// Check alternative ERRNO codes for AIX 7.x
pThis->rtryOp = relpTCP_RETRY_recv;
#endif
} else {
pThis->pEngine->dbgprint((char*)"relpTcpRcv: read failed errno='%d'\n", errno);
}
}
}
pThis->pEngine->dbgprint((char*)"relpTcpRcv return. relptcp [%p], iRet %d, max %d, lenRcvd %d, pLenBuf %zd\n",
(void *) pThis, iRet, RELP_RCV_BUF_SIZE, lenRcvd, *pLenBuf);
LEAVE_RELPFUNC;
}
/* helper for CORK option manipulation. As this is not portable, the
* helper abstracts it. Note that it is a null-operation if no
* such option is available on the platform in question.
*/
static void
setCORKopt(const relpTcp_t *const pThis, const int onOff)
{
#if defined(TCP_CORK)
if(setsockopt(pThis->sock, SOL_TCP, TCP_CORK, &onOff, sizeof (onOff)) == -1) {
pThis->pEngine->dbgprint((char*)"relpTcp: setsockopt() TCP_CORK failed\n");
}
#elif defined(TCP_NOPUSH)
if(setsockopt(pThis->sock, IPPROTO_TCP, TCP_NOPUSH, &onOff, sizeof (onOff)) == -1) {
pThis->pEngine->dbgprint((char*)"relpTcp: setsockopt() TCP_NOPUSH failed\n");
}
#endif
}
/* this function is called to hint librelp that a "burst" of data is to be
* sent. librelp can than try to optimize it's handling. Right now, this
* means we turn on the CORK option and will turn it off when we are
* hinted that the burst is over.
* The function is intentionally void as it must operate in a way that
* does not interfere with normal operations.
*/
void
relpTcpHintBurstBegin(relpTcp_t *const pThis)
{
setCORKopt(pThis, 1);
}
/* this is the counterpart to relpTcpHintBurstBegin -- see there for doc */
void
relpTcpHintBurstEnd(relpTcp_t *const pThis)
{
setCORKopt(pThis, 0);
}
/* -- first TLS-lib specific versions -- */
#if defined(ENABLE_TLS)
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpSend_gtls(relpTcp_t *const pThis, relpOctet_t *const pBuf, ssize_t *const pLenBuf)
{
ssize_t written;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
written = gnutls_record_send(pThis->session, pBuf, *pLenBuf);
pThis->pEngine->dbgprint((char*)"relpTcpSend_gtls: TLS send returned %d\n", (int) written);
if(written == GNUTLS_E_AGAIN || written == GNUTLS_E_INTERRUPTED) {
pThis->rtryOp = relpTCP_RETRY_send;
written = 0;
} else {
pThis->rtryOp = relpTCP_RETRY_none;
if(written < 1) {
chkGnutlsCode(pThis, "TLS record write failed", RELP_RET_IO_ERR, written);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
}
*pLenBuf = written;
finalize_it:
LEAVE_RELPFUNC;
}
#else
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpSend_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pBuf,
LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* defined(ENABLE_TLS) */
#if defined(ENABLE_TLS_OPENSSL)
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpSend_ossl(relpTcp_t *const pThis, relpOctet_t *const pBuf, ssize_t *const pLenBuf)
{
ssize_t written;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
written = SSL_write(pThis->ssl, pBuf, *pLenBuf);
if(written > 0) {
pThis->rtryOp = relpTCP_RETRY_none;
pThis->pEngine->dbgprint((char*)"relpTcpSend_ossl: SSL_write SUCCESS\n");
} else {
const int err = SSL_get_error(pThis->ssl, written);
if( err == SSL_ERROR_ZERO_RETURN ) {
pThis->pEngine->dbgprint((char*)"relpTcpSend_ossl: SSL_ERROR_ZERO_RETURN received, "
"retry next time\n");
pThis->rtryOp = relpTCP_RETRY_send;
written = 0;
} else if(err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
/* Check for SSL Shutdown: simply abort then (is this right???) */
if(SSL_get_shutdown(pThis->ssl) == SSL_RECEIVED_SHUTDOWN) {
pThis->pEngine->dbgprint((char*)"relpTcpSend_ossl: received SSL_RECEIVED_SHUTDOWN!\n");
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
pThis->pEngine->dbgprint((char*)"relpTcpSend_ossl: openssl needs to %s - retry requested\n",
err == SSL_ERROR_WANT_READ ? "read" : "write");
relpTcpLastSSLErrorMsg( (int)written, pThis, "relpTcpSend_ossl UNEXPECTED");
pThis->rtryOp = relpTCP_RETRY_send;
written = 0;
} else {
/* Output error and abort */
relpTcpLastSSLErrorMsg( (int)written, pThis, "relpTcpSend_ossl");
pThis->rtryOsslErr = err; /* Store SSL ErrorCode into*/
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
}
*pLenBuf = written;
finalize_it:
LEAVE_RELPFUNC;
}
#else
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpSend_ossl(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis, LIBRELP_ATTR_UNUSED relpOctet_t *const pBuf,
LIBRELP_ATTR_UNUSED ssize_t *const pLenBuf)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* defined(ENABLE_TLS_OPENSSL) */
/* send a buffer via TCP.
* On entry, pLenBuf contains the number of octets to
* write. On exit, it contains the number of octets actually written.
* If this number is lower than on entry, only a partial buffer has
* been written.
* rgerhards, 2008-03-19
*/
relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpSend(relpTcp_t *const pThis, relpOctet_t *const pBuf, ssize_t *const pLenBuf)
{
ssize_t written;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
if(pThis->bEnableTLS) {
if(pThis->pEngine->tls_lib == 0) {
CHKRet(relpTcpSend_gtls(pThis, pBuf, pLenBuf));
} else {
CHKRet(relpTcpSend_ossl(pThis, pBuf, pLenBuf));
}
} else {
pThis->pEngine->dbgprint((char*)"relpTcpSend: send data: '%.*s'\n", (int) *pLenBuf, pBuf);
written = send(pThis->sock, pBuf, *pLenBuf, 0);
const int errno_save = errno;
pThis->pEngine->dbgprint((char*)"relpTcpSend: sock %d, lenbuf %zd, send returned %d [errno %d]\n",
(int)pThis->sock, *pLenBuf, (int) written, errno_save);
if(written == -1) {
switch(errno_save) {
case EAGAIN:
#if defined(_AIX)
// AIX Workarround handling other ERRNO codes
case 0:
case EINTR:
#endif
/* this is fine, just retry... */
written = 0;
break;
default: {
char msgbuf[900];
char errStr[800];
_relpEngine_strerror_r(errno, errStr, sizeof(errStr));
snprintf(msgbuf, sizeof(msgbuf), "error sending relp: %s", errStr);
msgbuf[sizeof(msgbuf)-1] = '\0';
callOnErr(pThis, msgbuf, RELP_RET_IO_ERR);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
break;
}
}
*pLenBuf = written;
}
finalize_it:
LEAVE_RELPFUNC;
}
#ifdef ENABLE_TLS
#ifndef _AIX
#pragma GCC diagnostic push /* we need to disable a warning below */
/* per https://lists.gnupg.org/pipermail/gnutls-help/2004-August/000154.html This is expected */
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
#endif
/* this is only called for client-initiated sessions */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpConnectTLSInit_gtls(relpTcp_t *const pThis)
{
int r;
int sockflags;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit_gnutls\n");
/* We expect a non blocking socket to establish a tls session */
if((sockflags = fcntl(pThis->sock, F_GETFL)) != -1) {
sockflags &= ~O_NONBLOCK;
sockflags = fcntl(pThis->sock, F_SETFL, sockflags);
}
if(sockflags == -1) {
pThis->pEngine->dbgprint((char*)"error %d unsetting fcntl(O_NONBLOCK) on relp socket", errno);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
if(!called_gnutls_global_init) {
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* gcry_control must be called first, so that the thread system is correctly set up */
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
#endif
gnutls_global_init();
/* uncomment for (very intense) debug help
* gnutls_global_set_log_function(logFunction);
* gnutls_global_set_log_level(10); // 0 (no) to 9 (most), 10 everything
*/
pThis->pEngine->dbgprint((char*)"DDDD: gnutls_global_init() called\n");
called_gnutls_global_init = 1;
}
r = gnutls_init(&pThis->session, GNUTLS_CLIENT);
if(chkGnutlsCode(pThis, "Failed to initialize GnuTLS", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
gnutls_session_set_ptr(pThis->session, pThis);
CHKRet(relpTcpTLSSetPrio(pThis));
if(isAnonAuth(pThis)) {
r = gnutls_anon_allocate_client_credentials(&pThis->anoncred);
if(chkGnutlsCode(pThis, "Failed to allocate client credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
/* put the anonymous credentials to the current session */
r = gnutls_credentials_set(pThis->session, GNUTLS_CRD_ANON, pThis->anoncred);
if(chkGnutlsCode(pThis, "Failed to set credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
} else {
#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
r = gnutls_certificate_allocate_credentials(&pThis->xcred);
if(chkGnutlsCode(pThis, "Failed to allocate certificate credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
if(pThis->caCertFile != NULL) {
r = gnutls_certificate_set_x509_trust_file(pThis->xcred,
pThis->caCertFile, GNUTLS_X509_FMT_PEM);
if(r < 0) {
chkGnutlsCode(pThis, "Failed to set certificate trust file", RELP_RET_ERR_TLS_SETUP, r);
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
pThis->pEngine->dbgprint((char*)"librelp: obtained %d certificates from %s\n",
r, pThis->caCertFile);
}
if(pThis->ownCertFile != NULL) {
r = gnutls_certificate_set_x509_key_file (pThis->xcred,
pThis->ownCertFile, pThis->privKeyFile, GNUTLS_X509_FMT_PEM);
if(chkGnutlsCode(pThis, "Failed to set certificate key file", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
}
r = gnutls_credentials_set(pThis->session, GNUTLS_CRD_CERTIFICATE, pThis->xcred);
if(chkGnutlsCode(pThis, "Failed to set credentials", RELP_RET_ERR_TLS_SETUP, r)) {
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
if(pThis->authmode == eRelpAuthMode_None)
pThis->authmode = eRelpAuthMode_Fingerprint;
gnutls_certificate_set_verify_function(pThis->xcred, relpTcpVerifyCertificateCallback);
# else /* #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
ABORT_FINALIZE(RELP_RET_ERR_NO_TLS_AUTH);
# endif /* #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
}
gnutls_transport_set_ptr(pThis->session, (gnutls_transport_ptr_t) pThis->sock);
//gnutls_handshake_set_timeout(pThis->session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
/* Perform the TLS handshake */
do {
r = gnutls_handshake(pThis->session);
pThis->pEngine->dbgprint((char*)"DDDD: gnutls_handshake: %d: %s\n", r, gnutls_strerror(r));
if(r == GNUTLS_E_INTERRUPTED || r == GNUTLS_E_AGAIN) {
pThis->pEngine->dbgprint((char*)"librelp: gnutls_handshake must be retried\n");
pThis->rtryOp = relpTCP_RETRY_handshake;
} else if(r != GNUTLS_E_SUCCESS) {
chkGnutlsCode(pThis, "TLS handshake failed", RELP_RET_ERR_TLS_SETUP, r);
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
}
while(0);
//while (r < 0 && gnutls_error_is_fatal(r) == 0);
/* set the socket to non-blocking IO (we do this on the recv() for non-TLS */
if((sockflags = fcntl(pThis->sock, F_GETFL)) != -1) {
sockflags |= O_NONBLOCK;
/* SETFL could fail too, so get it caught by the subsequent
* error check. */
if(fcntl(pThis->sock, F_SETFL, sockflags) == -1) {
callOnErr(pThis, (char*) "error setting socket to non-blocking",
RELP_RET_ERR_TLS_SETUP);
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
}
finalize_it:
LEAVE_RELPFUNC;
}
#ifndef _AIX
#pragma GCC diagnostic pop
#endif
#else /* #ifdef ENABLE_TLS */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpConnectTLSInit_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* #ifdef ENABLE_TLS */
/* GENERIC TLS SUPPORT LAYER ========================================
* abstracts TLS calls between various libs (no tls/gtls/ossl).
*/
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpConnectTLSInit(NOTLS_UNUSED relpTcp_t *const pThis)
{
ENTER_RELPFUNC;
#if defined(WITH_TLS)
if(pThis->bEnableTLS) {
// Only DEBUG this if TLS enabled!
pThis->pEngine->dbgprint((char*)"relpTcpConnectTLSInit: lib: %d\n", pThis->pEngine->tls_lib);
if(pThis->pEngine->tls_lib == 0) {
CHKRet(relpTcpConnectTLSInit_gtls(pThis));
} else {
CHKRet(relpTcpConnectTLSInit_ossl(pThis));
}
pThis->bTLSActive = 1;
}
finalize_it:
#endif /* #ifdef WITH_TLS*/
LEAVE_RELPFUNC;
}
#ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
static int
relpTcpChkPeerName(NOTLS_UNUSED relpTcp_t *const pThis, NOTLS_UNUSED void* cert)
{
ENTER_RELPFUNC;
#if defined(WITH_TLS)
if(pThis->pEngine->tls_lib == 0) {
iRet = (relpTcpChkPeerName_gtls(pThis, cert));
} else {
iRet = (relpTcpChkPeerName_ossl(pThis, cert));
}
#endif /* #ifdef WITH_TLS*/
LEAVE_RELPFUNC;
}
#endif
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpAcceptConnReqInitTLS(NOTLS_UNUSED relpTcp_t *const pThis, NOTLS_UNUSED relpSrv_t *const pSrv)
{
ENTER_RELPFUNC;
#if defined(WITH_TLS)
if(pSrv->pTcp->bEnableTLS) {
pThis->bEnableTLS = 1;
pThis->pSrv = pSrv;
CHKRet(relpTcpSetPermittedPeers(pThis, &(pSrv->permittedPeers)));
if(pSrv->pEngine->tls_lib == 0) {
CHKRet(relpTcpAcceptConnReqInitTLS_gtls(pThis, pSrv));
} else {
CHKRet(relpTcpAcceptConnReqInitTLS_ossl(pThis, pSrv));
}
}
finalize_it:
#endif /* #ifdef WITH_TLS*/
LEAVE_RELPFUNC;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpTLSSetPrio(NOTLS_UNUSED relpTcp_t *const pThis)
{
ENTER_RELPFUNC;
#if defined(WITH_TLS)
if(pThis->pEngine->tls_lib == 0) {
iRet = relpTcpTLSSetPrio_gtls(pThis);
} else {
iRet = relpTcpTLSSetPrio_ossl(pThis);
}
#endif /* #ifdef WITH_TLS*/
LEAVE_RELPFUNC;
}
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpLstnInitTLS(NOTLS_UNUSED relpTcp_t *const pThis)
{
ENTER_RELPFUNC;
#if defined(WITH_TLS)
if(pThis->bEnableTLS) {
if(pThis->pEngine->tls_lib == 0) {
iRet = relpTcpLstnInitTLS_gtls(pThis);
} else {
iRet = relpTcpLstnInitTLS_ossl(pThis);
}
}
#endif /* #ifdef WITH_TLS*/
LEAVE_RELPFUNC;
}
/* end GENERIC TLS SUPPORT LAYER ======================================== */
/* open a connection to a remote host (server).
* This is only use for client initiated connections.
* rgerhards, 2008-03-19
*/
relpRetVal
relpTcpConnect(relpTcp_t *const pThis,
const int family,
unsigned char *port,
unsigned char *host,
unsigned char *clientIP)
{
struct addrinfo *res = NULL;
struct addrinfo hints;
struct addrinfo *reslocal = NULL;
struct pollfd pfd;
char errmsg[1424];
int so_error;
socklen_t len = sizeof so_error;
int r;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Tcp);
assert(port != NULL);
assert(host != NULL);
assert(pThis->sock == -1);
memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
if(getaddrinfo((char*)host, (char*)port, &hints, &res) != 0) {
pThis->pEngine->dbgprint((char*)"error %d in getaddrinfo\n", errno);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
if((pThis->sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) {
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
if(clientIP != NULL) {
if(getaddrinfo((char*)clientIP, (char*)NULL, &hints, &reslocal) != 0) {
pThis->pEngine->dbgprint((char*)"error %d in getaddrinfo of clientIP\n", errno);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
if(bind(pThis->sock, reslocal->ai_addr, reslocal->ai_addrlen) != 0) {
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
}
if(fcntl(pThis->sock, F_SETFL, O_NONBLOCK) == -1) {
callOnErr(pThis, (char*) "error setting socket to non-blocking",
RELP_RET_IO_ERR);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
if(connect(pThis->sock, res->ai_addr, res->ai_addrlen) == -1) {
#if defined(_AIX)
// AIX Workarround handling other ERRNO codes
if( errno != 0 &&
errno != EINTR &&
errno != EINPROGRESS) {
#else
if( errno != EINPROGRESS) {
#endif
char errStr[1200];
_relpEngine_strerror_r(errno, errStr, sizeof(errStr));
snprintf(errmsg, sizeof(errmsg), "error connecting: '%s'", errStr);
callOnErr(pThis, errmsg, RELP_RET_IO_ERR);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
}
pfd.fd = pThis->sock;
pfd.events = POLLOUT;
if (poll(&pfd, 1, pThis->connTimeout * 1000) != 1) {
pThis->pEngine->dbgprint((char*)"connection timed out after %d seconds\n", pThis->connTimeout);
ABORT_FINALIZE(RELP_RET_TIMED_OUT);
}
r = getsockopt(pThis->sock, SOL_SOCKET, SO_ERROR, &so_error, &len);
if (r == -1 || so_error != 0) {
pThis->pEngine->dbgprint((char*)"socket has an error %d\n", so_error);
ABORT_FINALIZE(RELP_RET_IO_ERR);
}
CHKRet(relpTcpConnectTLSInit(pThis));
finalize_it:
if(res != NULL)
freeaddrinfo(res);
if(reslocal != NULL)
freeaddrinfo(reslocal);
if(iRet != RELP_RET_OK) {
if(pThis->sock != -1) {
close(pThis->sock);
pThis->sock = -1;
}
}
LEAVE_RELPFUNC;
}
#ifdef ENABLE_TLS
/* return direction in which retry must be done. We return the original
* gnutls code, which means:
* "0 if trying to read data, 1 if trying to write data."
*/
static int LIBRELP_ATTR_NONNULL()
relpTcpGetRtryDirection_gtls(relpTcp_t *const pThis)
{
return gnutls_record_get_direction(pThis->session);
}
#else /* #ifdef ENABLE_TLS */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpGetRtryDirection_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* #ifdef ENABLE_TLS */
#ifdef ENABLE_TLS
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRtryHandshake_gtls(relpTcp_t *const pThis)
{
int r;
ENTER_RELPFUNC;
r = gnutls_handshake(pThis->session);
if(r < 0) {
pThis->pEngine->dbgprint((char*)"librelp: state %d during retry handshake: %s\n",
r, gnutls_strerror(r));
}
if(r == GNUTLS_E_INTERRUPTED || r == GNUTLS_E_AGAIN) {
; /* nothing to do, just keep our status... */
} else if(r == 0) {
pThis->rtryOp = relpTCP_RETRY_none;
} else {
chkGnutlsCode(pThis, "TLS handshake failed", RELP_RET_ERR_TLS_SETUP, r);
ABORT_FINALIZE(RELP_RET_ERR_TLS_SETUP);
}
finalize_it:
LEAVE_RELPFUNC;
}
#else /* #ifdef ENABLE_TLS */
static relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRtryHandshake_gtls(LIBRELP_ATTR_UNUSED relpTcp_t *const pThis)
{
return RELP_RET_ERR_INTERNAL;
}
#endif /* #ifdef ENABLE_TLS */
/* wait until a socket is writable again. This is primarily for use in client cases.
* It does NOT take care of our regular event loop, and must not be used by parts
* of the code that are driven by this loop. Returns 0 if a timeout occured and 1
* otherwise.
*/
int
relpTcpWaitWriteable(relpTcp_t *const pThis, struct timespec *const tTimeout)
{
int r;
struct timespec tCurr; /* current time */
struct pollfd pfd;
clock_gettime(CLOCK_REALTIME, &tCurr);
const int timeout = (tTimeout->tv_sec - tCurr.tv_sec) * 1000
+ (tTimeout->tv_nsec - tCurr.tv_nsec) / 1000000000;
if(timeout < 0) {
r = 0; goto done;
}
pThis->pEngine->dbgprint((char*)"librelp: telpTcpWaitWritable doing poll() "
"on fd %d, timoeut %d\n", pThis->sock, timeout);
pfd.fd = pThis->sock;
pfd.events = POLLOUT;
r = poll(&pfd, 1, timeout);
done: return r;
}
relpRetVal LIBRELP_ATTR_NONNULL()
relpTcpRtryHandshake(NOTLS_UNUSED relpTcp_t *const pThis)
{
ENTER_RELPFUNC;
#if defined(WITH_TLS)
if(pThis->pEngine->tls_lib == 0) {
iRet = relpTcpRtryHandshake_gtls(pThis);
} else {
iRet = relpTcpRtryHandshake_ossl(pThis);
}
#endif /* #ifdef WITH_TLS*/
LEAVE_RELPFUNC;
}
int LIBRELP_ATTR_NONNULL()
relpTcpGetRtryDirection(NOTLS_UNUSED relpTcp_t *const pThis)
{
int r = 0;
#if defined(WITH_TLS)
if (pThis->bTLSActive == 1) {
if(pThis->pEngine->tls_lib == 0) {
r = relpTcpGetRtryDirection_gtls(pThis);
} else {
r = relpTcpGetRtryDirection_ossl(pThis);
}
}
#endif /* #ifdef WITH_TLS*/
return r;
}
void
relpTcpExitTLS(void) {
#ifdef ENABLE_TLS_OPENSSL
// Call OSSL exit!
relpTcpExitTLS_ossl();
#endif /* #ifdef ENABLE_TLS_OPENSSL */
return;
}
librelp-1.13.0/src/relpsess.h 0000664 0001750 0001750 00000016430 14354536317 011527 /* The RELPSESS object.
*
* Copyright 2008-2016 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPSESS_H_INCLUDED
#define RELPSESS_H_INCLUDED
#include
#include "relpsrv.h"
/* unacked msgs linked list */
typedef struct replSessUnacked_s {
struct replSessUnacked_s *pNext;
struct replSessUnacked_s *pPrev;
struct relpSendbuf_s *pSendbuf; /**< the unacked message */
} relpSessUnacked_t;
/* relp session state */
typedef enum relpSessState_e {
eRelpSessState_DISCONNECTED = 0, /* session is disconnected and must be destructed */
eRelpSessState_PRE_INIT = 1,
eRelpSessState_INIT_CMD_SENT = 2,
eRelpSessState_INIT_RSP_RCVD = 3,
eRelpSessState_READY_TO_SEND = 4,
eRelpSessState_WINDOW_FULL = 5,
eRelpSessState_CLOSE_CMD_SENT = 6, /* once we are in a close state, we can not send any */
eRelpSessState_CLOSE_RSP_RCVD = 7, /* other commands */
eRelpSessState_BROKEN = 9 /**< something went wrong, session must be dropped */
} relpSessState_t;
typedef enum relpSessType_e {
eRelpSess_Server = 0,
eRelpSess_Client = 1
} relpSessType_t; /* what type of session are we? */
/* the RELPSESS object
* rgerhards, 2008-03-16
*/
struct relpSess_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
relpSessType_t sessType; /**< session type: 0 - server, 1 - client */
int bServerConnOpen; /**< server part: is connection established? */
void *pUsr; /**< user provided pointer (opaque data) */
relpTcp_t *pTcp; /**< our sockt to the remote peer */
struct relpFrame_s *pCurrRcvFrame; /**< the current receive frame (a buffer) */
relpTxnr_t txnr; /**< next txnr expected when receiving or to be used when sending */
size_t maxDataSize; /**< maximum size of a DATA element */
size_t maxCharsStore; /**< maximum number of message chars to store - support for truncation mode */
pthread_mutex_t mutSend; /**< mutex for send operation (make sure txnr is correct) */
relpSrv_t *pSrv; /**< a pointer to our server object, if NULL, we belong to a client */
relpClt_t *pClt; /**< ptr to our client; only valid if pSrv == NULL */
/* connection parameters */
int protocolVersion; /* relp protocol version in use in this session */
/* Status of commands as supported in this session. */
relpCmdEnaState_t stateCmdSyslog;
int bEnableTLS;
int bEnableTLSZip;
char *pristring;
char *caCertFile;
char *ownCertFile;
char *privKeyFile;
char *tlsConfigCmd; /**< optional configuration command property for TLS libs **/
relpAuthMode_t authmode;
relpPermittedPeers_t permittedPeers;
/* save the following for auto-reconnect case */
int protFamily;
unsigned char *srvPort;
unsigned char *srvAddr;
unsigned char *clientIP; /* ar */
/* properties needed for server operation */
struct relpSendq_s *pSendq; /**< our send queue */
/* properties needed for client operation */
int sizeWindow; /**< size of our app-level communications window */
unsigned timeout; /**< timeout after which session is to be considered broken */
int connTimeout; /**< connection timeout */
relpSessState_t sessState; /**< state of our session */
/* linked list of frames with outstanding "rsp" */
relpSessUnacked_t *pUnackedLstRoot;
relpSessUnacked_t *pUnackedLstLast;
int lenUnackedLst;
};
/* macros for quick member access */
#define relpSessGetSock(pThis) (relpTcpGetSock((pThis)->pTcp))
#define relpSessGetSessState(pThis) ((pThis)->sessState)
#define relpSessSetSessState(pThis, state) ((pThis)->sessState = (state))
#include "relpframe.h" /* this needs to be done after relpSess_t is defined! */
#include "sendbuf.h"
#include "sendq.h"
/* inlines */
static inline int
relpSessTcpRequiresRtry(relpSess_t *pThis)
{
return pThis->pTcp->rtryOp != relpTCP_RETRY_none;
}
/* prototypes */
relpRetVal relpSessConstruct(relpSess_t **ppThis, relpEngine_t *pEngine, int connType, void *pParent, void*pUsr);
relpRetVal relpSessDestruct(relpSess_t **ppThis);
relpRetVal relpSessAcceptAndConstruct(relpSess_t **ppThis, relpSrv_t *pSrv, int sock);
relpRetVal relpSessRcvData(relpSess_t *pThis);
relpRetVal relpSessSendFrame(relpSess_t *pThis, relpFrame_t *pFrame);
relpRetVal relpSessSendResponse(relpSess_t *pThis, relpTxnr_t txnr, unsigned char *pData, size_t lenData);
relpRetVal relpSessSndData(relpSess_t *pThis);
relpRetVal relpSessSendCommand(relpSess_t *pThis, unsigned char *pCmd, size_t lenCmd,
unsigned char *pData, size_t lenData, relpRetVal (*rspHdlr)(relpSess_t*,relpFrame_t*));
relpRetVal relpSessConnect(relpSess_t *pThis, int protFamily, unsigned char *port, unsigned char *host);
relpRetVal relpSessAddUnacked(relpSess_t *pThis, relpSendbuf_t *pSendbuf);
relpRetVal relpSessGetUnacked(relpSess_t *pThis, relpSendbuf_t **ppSendbuf, relpTxnr_t txnr);
relpRetVal relpSessTryReestablish(relpSess_t *pThis);
relpRetVal relpSessSetProtocolVersion(relpSess_t *pThis, int protocolVersion);
relpRetVal relpSessSetTimeout(relpSess_t *pThis, unsigned timeout);
relpRetVal relpSessSetConnTimeout(relpSess_t *pThis, int connTimeout);
relpRetVal relpSessSetWindowSize(relpSess_t *pThis, int sizeWindow);
relpRetVal relpSessSetClientIP(relpSess_t *pThis, unsigned char *ip);
relpRetVal relpSessEnableTLS(relpSess_t *pThis);
relpRetVal relpSessEnableTLSZip(relpSess_t *pThis);
relpRetVal relpSessSetAuthMode(relpSess_t *pThis, relpAuthMode_t authmode);
relpRetVal relpSessSetGnuTLSPriString(relpSess_t *pThis, char *pristr);
relpRetVal relpSessSetCACert(relpSess_t *pThis, char *cert);
relpRetVal relpSessSetOwnCert(relpSess_t *pThis, char *cert);
relpRetVal relpSessSetPrivKey(relpSess_t *pThis, char *cert);
relpRetVal relpSessSetTlsConfigCmd(relpSess_t *pThis, char *cfgcmd);
relpRetVal relpSessConstructOffers(relpSess_t *pThis, relpOffers_t **ppOffers);
relpRetVal relpSessSetPermittedPeers(relpSess_t *pThis, relpPermittedPeers_t *pPeers);
relpRetVal relpSessSetUsrPtr(relpSess_t *pThis, void *pUsr);
relpRetVal relpSessSendSyslog(relpSess_t *pThis, unsigned char *pMsg, size_t lenMsg);
relpRetVal relpSessSetEnableCmd(relpSess_t *pThis, unsigned char *pszCmd, relpCmdEnaState_t stateCmd);
relpRetVal relpSessSetMaxDataSize(relpSess_t *pThis, size_t maxSize);
#endif /* #ifndef RELPSESS_H_INCLUDED */
librelp-1.13.0/src/librelp.h 0000664 0001750 0001750 00000041120 15241030422 011270 /* The RELP (reliable event logging protocol) core protocol library.
*
* This file is meant to be included by applications using the relp library.
* For relp library files themselves, include "relp.h".
*
* Copyright 2008-2025 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef LIBRELP_H_INCLUDED
#define LIBRELP_H_INCLUDED
#if defined(__GNUC__)
#define LIBRELP_ATTR_NORETURN __attribute__ ((noreturn))
#define LIBRELP_ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
#define LIBRELP_ATTR_UNUSED __attribute__((unused))
#define LIBRELP_ATTR_DEPRECATED __attribute__((deprecated))
#define LIBRELP_ATTR_FORMAT(fmttype, n, m) __attribute__((format(fmttype, n, m)))
#else
#define LIBRELP_ATTR_NORETURN
#define LIBRELP_ATTR_NONNULL(...)
#define LIBRELP_ATTR_UNUSED
#define LIBRELP_ATTR_DEPRECATED
#define LIBRELP_ATTR_FORMAT(fmttype, n, m)
#endif
/* define some of our types that a caller must know about */
typedef unsigned char relpOctet_t;
typedef int relpTxnr_t;
typedef int relpRetVal;
/* our objects (forward definitions) */
typedef struct relpEngine_s relpEngine_t;
typedef struct relpClt_s relpClt_t;
typedef struct relpSrv_s relpSrv_t;
typedef struct relpSess_s relpSess_t;
typedef struct relpFrame_s relpFrame_t;
typedef struct relpSendbuf_s relpSendbuf_t;
typedef struct relpOffers_s relpOffers_t;
typedef struct relpOffer_s relpOffer_t;
/* IDs of librelp objects */
typedef enum relpObjID_e {
eRelpObj_Invalid = 0, /**< invalid object, must be zero to detect unitilized value */
eRelpObj_Engine = 1,
eRelpObj_Sess = 2,
eRelpObj_Frame = 3,
eRelpObj_Clt = 4,
eRelpObj_Srv = 5,
eRelpObj_Sendq = 6,
eRelpObj_Sendqe = 7,
eRelpObj_Sendbuf = 8,
eRelpObj_Tcp = 9,
eRelpObj_Offers = 10,
eRelpObj_Offer = 11,
eRelpObj_OfferValue = 12
} relpObjID_t;
/** authentication modes for TLS */
typedef enum relpAuthMode_e {
eRelpAuthMode_None = 0,
eRelpAuthMode_Fingerprint = 1,
eRelpAuthMode_Name = 2,
eRelpAuthMode_CertValid = 3
} relpAuthMode_t;
enum relpCmdEnaState_e { /* command enabled state - what are we permitted to do/request? */
eRelpCmdState_Unset = 0, /**< calloc default, not desired, not forbidden */
eRelpCmdState_Forbidden = 1, /**< command is not permitted to be used */
eRelpCmdState_Desired = 2, /**< client/server intends to use this feature */
eRelpCmdState_Required = 3, /**< client/server requires the use of this feature */
eRelpCmdState_Enabled = 4, /**< feature can be used (set during open handshake) */
eRelpCmdState_Disabled = 5 /**< feature can NOT be used (set during open handshake) */
};
typedef enum relpCmdEnaState_e relpCmdEnaState_t;
/* macro to assert we are dealing with the right relp object */
#ifdef NDEBUG
# define RELPOBJ_assert(obj, type)
#else /* debug case */
# define RELPOBJ_assert(pObj, type) \
assert((pObj) != NULL); \
assert((pObj)->objID == eRelpObj_##type)
#endif /* # ifdef NDEBUG */
/* now define our externally-visible error codes */
#ifndef RELPERR_BASE
/* provide a basis for error numbers if not configured */
# define RELPERR_BASE 10000
#endif
/* we may argue if RELP_RET_OK should also be relative to RELPERR_BASE. I have deciced against it,
* because if it is 0, we can use it together with other project's iRet mechanisms, which is quite
* useful. -- rgerhards, 2008-03-17
*/
#define RELP_RET_OK 0 /**< everything went well, no error */
#define RELP_RET_OUT_OF_MEMORY RELPERR_BASE + 1 /**< out of memory occured */
#define RELP_RET_INVALID_FRAME RELPERR_BASE + 2 /**< relp frame received is invalid */
#define RELP_RET_PARAM_ERROR RELPERR_BASE + 3 /**< an (API) calling parameer is in error */
#define RELP_RET_INVALID_PORT RELPERR_BASE + 4 /**< invalid port value */
#define RELP_RET_COULD_NOT_BIND RELPERR_BASE + 5 /**< could not bind socket, defunct */
#define RELP_RET_ACCEPT_ERR RELPERR_BASE + 6 /**< error during accept() system call */
#define RELP_RET_SESSION_BROKEN RELPERR_BASE + 7 /**< the RELP session is broken */
#define RELP_RET_SESSION_CLOSED RELPERR_BASE + 8 /**< the RELP session was closed (not an error) */
#define RELP_RET_INVALID_CMD RELPERR_BASE + 9 /**< the command contained in a RELP frame was unknown */
#define RELP_RET_DATA_TOO_LONG RELPERR_BASE + 10 /**< DATALEN exceeds permitted length */
#define RELP_RET_INVALID_TXNR RELPERR_BASE + 11 /**< a txnr is invalid (probably code error) */
#define RELP_RET_INVALID_DATALEN RELPERR_BASE + 12 /**< DATALEN field is invalid (probably code error) */
#define RELP_RET_PARTIAL_WRITE RELPERR_BASE + 13 /**< only partial data written (state, not an error) */
#define RELP_RET_IO_ERR RELPERR_BASE + 14 /**< IO error occured */
#define RELP_RET_TIMED_OUT RELPERR_BASE + 15 /**< timeout occured */
#define RELP_RET_NOT_FOUND RELPERR_BASE + 16 /**< searched entity not found */
#define RELP_RET_NOT_IMPLEMENTED RELPERR_BASE + 17 /**< functionality not implemented */
#define RELP_RET_INVALID_RSPHDR RELPERR_BASE + 18 /**< "rsp" packet header is invalid */
#define RELP_RET_END_OF_DATA RELPERR_BASE + 19 /**< no more data available */
#define RELP_RET_RSP_STATE_ERR RELPERR_BASE + 20 /**< error status in relp rsp frame */
#define RELP_RET_INVALID_OFFER RELPERR_BASE + 21 /**< invalid offer (e.g. malformed) during open */
#define RELP_RET_UNKNOWN_CMD RELPERR_BASE + 22 /**< command is unknown (e.g. not in this version) */
#define RELP_RET_CMD_DISABLED RELPERR_BASE + 23 /**< tried to use a cmd that is disabled in this session */
#define RELP_RET_INVALID_HDL RELPERR_BASE + 24 /**< invalid object handle (pointer) provided by caller */
#define RELP_RET_INCOMPAT_OFFERS RELPERR_BASE + 25 /**< client and server offers are incompatible */
#define RELP_RET_RQD_FEAT_MISSING RELPERR_BASE + 26 /**< the remote peer does not support a required feature */
#define RELP_RET_MALICIOUS_HNAME RELPERR_BASE + 27 /**< remote peer is trying malicious things with its hostname */
#define RELP_RET_INVALID_HNAME RELPERR_BASE + 28 /**< remote peer's hostname invalid or unobtainable */
#define RELP_RET_ADDR_UNKNOWN RELPERR_BASE + 29 /**< remote peer's IP address could not be obtained */
#define RELP_RET_INVALID_PARAM RELPERR_BASE + 30 /**< librelp API called with wrong parameter */
#define RELP_RET_ERR_TLS_SETUP RELPERR_BASE + 31 /**< problem during TLS setup */
#define RELP_RET_INVLD_TLS_PRIO RELPERR_BASE + 32 /**< TLS setup used invalid TLS priority string */
#define RELP_RET_AUTH_ERR_FP RELPERR_BASE + 33 /**< auth failed: non-permitted peer fingerprint */
#define RELP_RET_AUTH_ERR_NAME RELPERR_BASE + 34 /**< auth failed: no permitted peer name found */
#define RELP_RET_AUTH_NO_CERT RELPERR_BASE + 35 /**< auth failed: peer did not present a certificate */
#define RELP_RET_AUTH_CERT_INVL RELPERR_BASE + 36 /**< auth failed: peer certificate invalid
(did not pass validation) */
#define RELP_RET_INVLD_AUTH_MD RELPERR_BASE + 37 /**< lib user tried to set invalid auth mode */
#define RELP_RET_INVLD_WILDCARD RELPERR_BASE + 38 /**< invalid wildcard given in permitted peer name */
#define RELP_RET_ERR_TLS_HANDS RELPERR_BASE + 39 /**< TLS handshake failed */
#define RELP_RET_ERR_TLS RELPERR_BASE + 40 /**< generic TLS error */
#define RELP_RET_ERR_INVAL RELPERR_BASE + 41 /**< some parameter is invalid (like EINVAL) */
#define RELP_RET_ERR_EPOLL_CTL RELPERR_BASE + 42 /**< epoll_ctl() failed */
#define RELP_RET_ERR_INTERNAL RELPERR_BASE + 43 /**< internal error in librelp (bug) */
#define RELP_RET_WRN_NO_KEEPALIVE RELPERR_BASE + 44 /**< KEEPALIVE cannot be enabled */
#define RELP_RET_ERR_NO_TLS RELPERR_BASE + 45 /**< librelp compiled without TLS support */
#define RELP_RET_ERR_NO_TLS_AUTH RELPERR_BASE + 46 /**< platform does not provide TLS auth support */
#define RELP_RET_SESSION_OPEN RELPERR_BASE + 47 /**< RELP session is (already) open */
#define RELP_RET_EAGAIN RELPERR_BASE + 48 /**< I/O operation would block; try again later */
#define RELP_RET_NOT_SUPPORTED RELPERR_BASE + 49 /**< requested feature/param not supported */
/* relp frame oversize modes */
#define RELP_OVERSIZE_ABORT 0 /**< abort connection on oversize frame */
#define RELP_OVERSIZE_TRUNCATE 1 /**< truncate oversize frame, keep connection active */
#define RELP_OVERSIZE_ACCEPT 2 /**< accept oversize frame irrespective of risk */
/* TLS library selection */
#define RELP_USE_GNUTLS 0
#define RELP_USE_OPENSSL 1
/* some macros to work with librelp error codes */
#define CHKRet(code) if((iRet = code) != RELP_RET_OK) goto finalize_it
/* macro below is to be used if we need our own handling, eg for cleanup */
#define CHKRet_Hdlr(code) if((iRet = code) != RELP_RET_OK)
/* prototypes needed by library users */
const char *relpEngineGetVersion(void); /* use this entry point for configure check */
void relpEngineSetShutdownImmdtPtr(relpEngine_t *pThis, int *ptr);
relpRetVal relpEngineConstruct(relpEngine_t **ppThis);
relpRetVal relpEngineDestruct(relpEngine_t **ppThis);
relpRetVal relpEngineSetTLSLib(relpEngine_t *pThis, int tls_lib);
relpRetVal relpEngineSetTLSLibByName(relpEngine_t *pThis, const char *name);
relpRetVal relpEngineSetDbgprint(relpEngine_t *pThis,
void (*dbgprint)(char *fmt, ...) LIBRELP_ATTR_FORMAT(printf, 1, 2));
relpRetVal relpEngineAddListner(relpEngine_t *pThis, unsigned char *pLstnPort) LIBRELP_ATTR_DEPRECATED;
relpRetVal relpEngineAddListner2(relpEngine_t *pThis, unsigned char *pLstnPort, void*) LIBRELP_ATTR_DEPRECATED;
relpRetVal relpEngineListnerConstruct(relpEngine_t *pThis, relpSrv_t **ppSrv);
relpRetVal relpEngineListnerConstructFinalize(relpEngine_t *pThis, relpSrv_t *pSrv);
relpRetVal relpEngineSetStop(relpEngine_t *pThis);
relpRetVal relpEngineSetFamily(relpEngine_t *pThis, int ai_family);
relpRetVal relpEngineRun(relpEngine_t *pThis);
relpRetVal relpEngineCltDestruct(relpEngine_t *pThis, relpClt_t **ppClt);
relpRetVal relpEngineCltConstruct(relpEngine_t *pThis, relpClt_t **ppClt);
relpRetVal relpEngineSetSyslogRcv(relpEngine_t *pThis,
relpRetVal (*pCB)(unsigned char*, unsigned char*, unsigned char*, size_t));
relpRetVal relpEngineSetSyslogRcv2(relpEngine_t *pThis,
relpRetVal (*pCB)(void*, unsigned char*, unsigned char*, unsigned char*, size_t));
relpRetVal relpEngineSetSyslogRcv3(relpEngine_t *pThis,
relpRetVal (*pCB)(void*, unsigned char*, unsigned char*, unsigned char*, unsigned char*, size_t));
relpRetVal relpEngineSetEnableCmd(relpEngine_t *pThis, unsigned char *pszCmd, relpCmdEnaState_t stateCmd);
relpRetVal relpEngineSetDnsLookupMode(relpEngine_t *pThis, int iMode);
relpRetVal relpEngineSetOnAuthErr(relpEngine_t *pThis,
void (*pCB)(void*pUsr, char *authinfo, char*errmsg, relpRetVal errcode) );
relpRetVal relpEngineSetOnErr(relpEngine_t *pThis,
void (*pCB)(void*pUsr, char *objinfo, char*errmsg, relpRetVal errcode) );
relpRetVal relpEngineSetOnGenericErr(relpEngine_t *pThis,
void (*pCB)(char *objinfo, char*errmsg, relpRetVal errcode) );
/**
* Set a session-open callback.
*
* Callback signature:
* void cb(void *pUsr, const relpSess_t *pSess)
*
* The callback is invoked after a server-side RELP session successfully
* completes the open handshake and is ready for traffic. The callback runs
* on the relpEngineRun() thread. The relpSess_t pointer is only valid for the
* duration of the callback and must not be retained.
*
* Callback parameters:
*
* pUsr - user pointer from relpSrvSetUsrPtr()
* pSess - session being opened (read-only, ephemeral)
*/
relpRetVal relpEngineSetOnSessOpen(relpEngine_t *pThis,
void (*pCB)(void*pUsr, const relpSess_t *pSess) );
/**
* Set a session-close callback.
*
* Callback signature:
* void cb(void *pUsr, const relpSess_t *pSess, relpRetVal reason)
*
* The callback fires when a session is removed from the engine, regardless
* of the close cause (protocol close, I/O error, or engine shutdown). The
* reason parameter contains the relpRetVal that triggered teardown; engine
* shutdown uses RELP_RET_SESSION_CLOSED. The callback may run from
* relpEngineRun() or relpEngineDestruct(); pSess is valid only during the
* callback.
*
* Callback parameters:
*
* pUsr - user pointer from relpSrvSetUsrPtr()
* pSess - session being closed (read-only, ephemeral)
* reason - relpRetVal that caused teardown
*/
relpRetVal relpEngineSetOnSessClose(relpEngine_t *pThis,
void (*pCB)(void*pUsr, const relpSess_t *pSess, relpRetVal reason) );
/**
* Set a session-open-failed callback.
*
* Callback signature:
* void cb(void *pUsr, const relpSess_t *pSess, relpRetVal reason)
*
* The callback fires when the server-side open handshake fails. It is
* invoked before the error response is sent. The callback runs on the
* relpEngineRun() thread and pSess is valid only during the callback.
*
* Callback parameters:
*
* pUsr - user pointer from relpSrvSetUsrPtr()
* pSess - session that failed to open (read-only, ephemeral)
* reason - relpRetVal describing the failure
*/
relpRetVal relpEngineSetOnSessOpenFail(relpEngine_t *pThis,
void (*pCB)(void*pUsr, const relpSess_t *pSess, relpRetVal reason) );
/* exposed server property set functions */
relpRetVal relpSrvSetLstnPort(relpSrv_t *pThis, unsigned char *pLstnPort);
relpRetVal relpSrvSetLstnAddr(relpSrv_t *pThis, unsigned char *pLstnAddr);
relpRetVal relpSrvSetUsrPtr(relpSrv_t *pThis, void *pUsr);
void relpSrvEnableTLS(relpSrv_t *pThis) LIBRELP_ATTR_DEPRECATED;
void relpSrvEnableTLSZip(relpSrv_t *pThis) LIBRELP_ATTR_DEPRECATED;
relpRetVal relpSrvEnableTLS2(relpSrv_t *pThis);
relpRetVal relpSrvEnableTLSZip2(relpSrv_t *pThis);
void relpSrvSetDHBits(relpSrv_t *pThis, int bits);
void relpSrvSetKeepAlive(relpSrv_t *pThis, const int bEnabled, const int iKeepAliveIntvl,
const int iKeepAliveProbes, const int iKeepAliveTime);
relpRetVal relpSrvSetGnuTLSPriString(relpSrv_t *pThis, char *pristr);
relpRetVal relpSrvSetOwnCert(relpSrv_t *pThis, char *cert);
relpRetVal relpSrvSetTlsConfigCmd(relpSrv_t *pThis, char *cfgcmd);
relpRetVal relpSrvSetCACert(relpSrv_t *pThis, char *cert);
relpRetVal relpSrvSetPrivKey(relpSrv_t *pThis, char *cert);
relpRetVal relpSrvSetAuthMode(relpSrv_t *pThis, char *mode);
relpRetVal relpSrvAddPermittedPeer(relpSrv_t *pThis, char *peer);
relpRetVal relpSrvSetMaxDataSize(relpSrv_t *pThis, size_t maxSize);
relpRetVal relpSrvSetOversizeMode(relpSrv_t *const pThis, const int oversizeMode);
/* exposed relp client functions */
relpRetVal relpCltConnect(relpClt_t *pThis, int protFamily, unsigned char *port, unsigned char *host);
relpRetVal relpCltSendSyslog(relpClt_t *pThis, unsigned char *pMsg, size_t lenMsg);
relpRetVal relpCltSetTimeout(relpClt_t *pThis, unsigned timeout);
relpRetVal relpCltSetConnTimeout(relpClt_t *pThis, int connTimeout);
relpRetVal relpCltSetWindowSize(relpClt_t *pThis, int sizeWindow);
relpRetVal relpCltSetClientIP(relpClt_t *pThis, unsigned char *ipAddr);
relpRetVal relpCltEnableTLS(relpClt_t *pThis);
relpRetVal relpCltEnableTLSZip(relpClt_t *pThis);
relpRetVal relpCltSetGnuTLSPriString(relpClt_t *pThis, char *pristr);
relpRetVal relpCltSetCACert(relpClt_t *pThis, char *file);
relpRetVal relpCltSetOwnCert(relpClt_t *pThis, char *file);
relpRetVal relpCltSetPrivKey(relpClt_t *pThis, char *file);
relpRetVal relpCltSetTlsConfigCmd(relpClt_t *pThis, char *cfgcmd);
relpRetVal relpCltSetAuthMode(relpClt_t *pThis, char *mode);
relpRetVal relpCltAddPermittedPeer(relpClt_t *pThis, char *peer);
relpRetVal relpCltSetUsrPtr(relpClt_t *pThis, void *pUsr);
relpRetVal relpCltReconnect(relpClt_t *pThis);
void relpCltHintBurstBegin(relpClt_t *pThis);
void relpCltHintBurstEnd(relpClt_t *pThis);
#endif /* #ifndef RELP_H_INCLUDED */
librelp-1.13.0/src/Makefile.in 0000664 0001750 0001750 00000123577 15241057402 011563 # Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
librelp_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am__dirstamp = $(am__leading_dot)dirstamp
am_librelp_la_OBJECTS = librelp_la-relp.lo librelp_la-relpsess.lo \
librelp_la-relpframe.lo librelp_la-tcp.lo librelp_la-sendq.lo \
librelp_la-sendbuf.lo librelp_la-offers.lo \
librelp_la-relpclt.lo librelp_la-relpsrv.lo \
librelp_la-scsyslog.lo librelp_la-scrsp.lo librelp_la-copen.lo \
librelp_la-cclose.lo librelp_la-cserverclose.lo \
compat/librelp_la-strndup.lo
librelp_la_OBJECTS = $(am_librelp_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
librelp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(librelp_la_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/librelp_la-cclose.Plo \
./$(DEPDIR)/librelp_la-copen.Plo \
./$(DEPDIR)/librelp_la-cserverclose.Plo \
./$(DEPDIR)/librelp_la-offers.Plo \
./$(DEPDIR)/librelp_la-relp.Plo \
./$(DEPDIR)/librelp_la-relpclt.Plo \
./$(DEPDIR)/librelp_la-relpframe.Plo \
./$(DEPDIR)/librelp_la-relpsess.Plo \
./$(DEPDIR)/librelp_la-relpsrv.Plo \
./$(DEPDIR)/librelp_la-scrsp.Plo \
./$(DEPDIR)/librelp_la-scsyslog.Plo \
./$(DEPDIR)/librelp_la-sendbuf.Plo \
./$(DEPDIR)/librelp_la-sendq.Plo \
./$(DEPDIR)/librelp_la-tcp.Plo \
compat/$(DEPDIR)/librelp_la-strndup.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(librelp_la_SOURCES)
DIST_SOURCES = $(librelp_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
HEADERS = $(include_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOL_LIBS = @SOL_LIBS@
STRIP = @STRIP@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
WARN_LDFLAGS = @WARN_LDFLAGS@
WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pthread_libs = @pthread_libs@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
rt_libs = @rt_libs@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
socket_libs = @socket_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
DEBUG = -g
# Uncomment for debugging
#CFLAGS += $(DEBUG)
AM_CFLAGS = -fvisibility=hidden
lib_LTLIBRARIES = librelp.la
EXTRA_DIST = librelp.h
librelp_la_SOURCES = \
librelp.h \
relp.c \
relp.h \
relpsess.c \
relpsess.h \
relpframe.c \
relpframe.h \
tcp.c \
tcp.h \
sendq.c \
sendq.h \
sendbuf.c \
sendbuf.h \
offers.c \
offers.h \
relpclt.c \
relpclt.h \
relpsrv.c \
relpsrv.h \
scsyslog.c \
scrsp.c \
copen.c \
cclose.c \
cserverclose.c \
dbllinklist.h \
cmdif.h \
compat/strndup.c
librelp_la_CPPFLAGS = $(AM_CLFAGS) $(PTHREADS_CFLAGS) $(GNUTLS_CFLAGS) $(OPENSSL_CFLAGS) $(WARN_CFLAGS)
librelp_la_LIBADD = $(rt_libs) $(GNUTLS_LIBS) $(OPENSSL_LIBS)
# info on version-info:
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
librelp_la_LDFLAGS = -version-info 5:1:5 -export-symbols-regex '^relp[^_]*$$'
include_HEADERS = librelp.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
compat/$(am__dirstamp):
@$(MKDIR_P) compat
@: > compat/$(am__dirstamp)
compat/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) compat/$(DEPDIR)
@: > compat/$(DEPDIR)/$(am__dirstamp)
compat/librelp_la-strndup.lo: compat/$(am__dirstamp) \
compat/$(DEPDIR)/$(am__dirstamp)
librelp.la: $(librelp_la_OBJECTS) $(librelp_la_DEPENDENCIES) $(EXTRA_librelp_la_DEPENDENCIES)
$(AM_V_CCLD)$(librelp_la_LINK) -rpath $(libdir) $(librelp_la_OBJECTS) $(librelp_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
-rm -f compat/*.$(OBJEXT)
-rm -f compat/*.lo
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-cclose.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-copen.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-cserverclose.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-offers.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-relp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-relpclt.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-relpframe.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-relpsess.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-relpsrv.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-scrsp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-scsyslog.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-sendbuf.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-sendq.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librelp_la-tcp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@compat/$(DEPDIR)/librelp_la-strndup.Plo@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
librelp_la-relp.lo: relp.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-relp.lo -MD -MP -MF $(DEPDIR)/librelp_la-relp.Tpo -c -o librelp_la-relp.lo `test -f 'relp.c' || echo '$(srcdir)/'`relp.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-relp.Tpo $(DEPDIR)/librelp_la-relp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='relp.c' object='librelp_la-relp.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-relp.lo `test -f 'relp.c' || echo '$(srcdir)/'`relp.c
librelp_la-relpsess.lo: relpsess.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-relpsess.lo -MD -MP -MF $(DEPDIR)/librelp_la-relpsess.Tpo -c -o librelp_la-relpsess.lo `test -f 'relpsess.c' || echo '$(srcdir)/'`relpsess.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-relpsess.Tpo $(DEPDIR)/librelp_la-relpsess.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='relpsess.c' object='librelp_la-relpsess.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-relpsess.lo `test -f 'relpsess.c' || echo '$(srcdir)/'`relpsess.c
librelp_la-relpframe.lo: relpframe.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-relpframe.lo -MD -MP -MF $(DEPDIR)/librelp_la-relpframe.Tpo -c -o librelp_la-relpframe.lo `test -f 'relpframe.c' || echo '$(srcdir)/'`relpframe.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-relpframe.Tpo $(DEPDIR)/librelp_la-relpframe.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='relpframe.c' object='librelp_la-relpframe.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-relpframe.lo `test -f 'relpframe.c' || echo '$(srcdir)/'`relpframe.c
librelp_la-tcp.lo: tcp.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-tcp.lo -MD -MP -MF $(DEPDIR)/librelp_la-tcp.Tpo -c -o librelp_la-tcp.lo `test -f 'tcp.c' || echo '$(srcdir)/'`tcp.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-tcp.Tpo $(DEPDIR)/librelp_la-tcp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tcp.c' object='librelp_la-tcp.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-tcp.lo `test -f 'tcp.c' || echo '$(srcdir)/'`tcp.c
librelp_la-sendq.lo: sendq.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-sendq.lo -MD -MP -MF $(DEPDIR)/librelp_la-sendq.Tpo -c -o librelp_la-sendq.lo `test -f 'sendq.c' || echo '$(srcdir)/'`sendq.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-sendq.Tpo $(DEPDIR)/librelp_la-sendq.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sendq.c' object='librelp_la-sendq.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-sendq.lo `test -f 'sendq.c' || echo '$(srcdir)/'`sendq.c
librelp_la-sendbuf.lo: sendbuf.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-sendbuf.lo -MD -MP -MF $(DEPDIR)/librelp_la-sendbuf.Tpo -c -o librelp_la-sendbuf.lo `test -f 'sendbuf.c' || echo '$(srcdir)/'`sendbuf.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-sendbuf.Tpo $(DEPDIR)/librelp_la-sendbuf.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sendbuf.c' object='librelp_la-sendbuf.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-sendbuf.lo `test -f 'sendbuf.c' || echo '$(srcdir)/'`sendbuf.c
librelp_la-offers.lo: offers.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-offers.lo -MD -MP -MF $(DEPDIR)/librelp_la-offers.Tpo -c -o librelp_la-offers.lo `test -f 'offers.c' || echo '$(srcdir)/'`offers.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-offers.Tpo $(DEPDIR)/librelp_la-offers.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='offers.c' object='librelp_la-offers.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-offers.lo `test -f 'offers.c' || echo '$(srcdir)/'`offers.c
librelp_la-relpclt.lo: relpclt.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-relpclt.lo -MD -MP -MF $(DEPDIR)/librelp_la-relpclt.Tpo -c -o librelp_la-relpclt.lo `test -f 'relpclt.c' || echo '$(srcdir)/'`relpclt.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-relpclt.Tpo $(DEPDIR)/librelp_la-relpclt.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='relpclt.c' object='librelp_la-relpclt.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-relpclt.lo `test -f 'relpclt.c' || echo '$(srcdir)/'`relpclt.c
librelp_la-relpsrv.lo: relpsrv.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-relpsrv.lo -MD -MP -MF $(DEPDIR)/librelp_la-relpsrv.Tpo -c -o librelp_la-relpsrv.lo `test -f 'relpsrv.c' || echo '$(srcdir)/'`relpsrv.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-relpsrv.Tpo $(DEPDIR)/librelp_la-relpsrv.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='relpsrv.c' object='librelp_la-relpsrv.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-relpsrv.lo `test -f 'relpsrv.c' || echo '$(srcdir)/'`relpsrv.c
librelp_la-scsyslog.lo: scsyslog.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-scsyslog.lo -MD -MP -MF $(DEPDIR)/librelp_la-scsyslog.Tpo -c -o librelp_la-scsyslog.lo `test -f 'scsyslog.c' || echo '$(srcdir)/'`scsyslog.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-scsyslog.Tpo $(DEPDIR)/librelp_la-scsyslog.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scsyslog.c' object='librelp_la-scsyslog.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-scsyslog.lo `test -f 'scsyslog.c' || echo '$(srcdir)/'`scsyslog.c
librelp_la-scrsp.lo: scrsp.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-scrsp.lo -MD -MP -MF $(DEPDIR)/librelp_la-scrsp.Tpo -c -o librelp_la-scrsp.lo `test -f 'scrsp.c' || echo '$(srcdir)/'`scrsp.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-scrsp.Tpo $(DEPDIR)/librelp_la-scrsp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scrsp.c' object='librelp_la-scrsp.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-scrsp.lo `test -f 'scrsp.c' || echo '$(srcdir)/'`scrsp.c
librelp_la-copen.lo: copen.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-copen.lo -MD -MP -MF $(DEPDIR)/librelp_la-copen.Tpo -c -o librelp_la-copen.lo `test -f 'copen.c' || echo '$(srcdir)/'`copen.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-copen.Tpo $(DEPDIR)/librelp_la-copen.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='copen.c' object='librelp_la-copen.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-copen.lo `test -f 'copen.c' || echo '$(srcdir)/'`copen.c
librelp_la-cclose.lo: cclose.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-cclose.lo -MD -MP -MF $(DEPDIR)/librelp_la-cclose.Tpo -c -o librelp_la-cclose.lo `test -f 'cclose.c' || echo '$(srcdir)/'`cclose.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-cclose.Tpo $(DEPDIR)/librelp_la-cclose.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cclose.c' object='librelp_la-cclose.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-cclose.lo `test -f 'cclose.c' || echo '$(srcdir)/'`cclose.c
librelp_la-cserverclose.lo: cserverclose.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT librelp_la-cserverclose.lo -MD -MP -MF $(DEPDIR)/librelp_la-cserverclose.Tpo -c -o librelp_la-cserverclose.lo `test -f 'cserverclose.c' || echo '$(srcdir)/'`cserverclose.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/librelp_la-cserverclose.Tpo $(DEPDIR)/librelp_la-cserverclose.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cserverclose.c' object='librelp_la-cserverclose.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o librelp_la-cserverclose.lo `test -f 'cserverclose.c' || echo '$(srcdir)/'`cserverclose.c
compat/librelp_la-strndup.lo: compat/strndup.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT compat/librelp_la-strndup.lo -MD -MP -MF compat/$(DEPDIR)/librelp_la-strndup.Tpo -c -o compat/librelp_la-strndup.lo `test -f 'compat/strndup.c' || echo '$(srcdir)/'`compat/strndup.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) compat/$(DEPDIR)/librelp_la-strndup.Tpo compat/$(DEPDIR)/librelp_la-strndup.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compat/strndup.c' object='compat/librelp_la-strndup.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librelp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o compat/librelp_la-strndup.lo `test -f 'compat/strndup.c' || echo '$(srcdir)/'`compat/strndup.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
-rm -rf compat/.libs compat/_libs
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-rm -f compat/$(DEPDIR)/$(am__dirstamp)
-rm -f compat/$(am__dirstamp)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/librelp_la-cclose.Plo
-rm -f ./$(DEPDIR)/librelp_la-copen.Plo
-rm -f ./$(DEPDIR)/librelp_la-cserverclose.Plo
-rm -f ./$(DEPDIR)/librelp_la-offers.Plo
-rm -f ./$(DEPDIR)/librelp_la-relp.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpclt.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpframe.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpsess.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpsrv.Plo
-rm -f ./$(DEPDIR)/librelp_la-scrsp.Plo
-rm -f ./$(DEPDIR)/librelp_la-scsyslog.Plo
-rm -f ./$(DEPDIR)/librelp_la-sendbuf.Plo
-rm -f ./$(DEPDIR)/librelp_la-sendq.Plo
-rm -f ./$(DEPDIR)/librelp_la-tcp.Plo
-rm -f compat/$(DEPDIR)/librelp_la-strndup.Plo
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/librelp_la-cclose.Plo
-rm -f ./$(DEPDIR)/librelp_la-copen.Plo
-rm -f ./$(DEPDIR)/librelp_la-cserverclose.Plo
-rm -f ./$(DEPDIR)/librelp_la-offers.Plo
-rm -f ./$(DEPDIR)/librelp_la-relp.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpclt.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpframe.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpsess.Plo
-rm -f ./$(DEPDIR)/librelp_la-relpsrv.Plo
-rm -f ./$(DEPDIR)/librelp_la-scrsp.Plo
-rm -f ./$(DEPDIR)/librelp_la-scsyslog.Plo
-rm -f ./$(DEPDIR)/librelp_la-sendbuf.Plo
-rm -f ./$(DEPDIR)/librelp_la-sendq.Plo
-rm -f ./$(DEPDIR)/librelp_la-tcp.Plo
-rm -f compat/$(DEPDIR)/librelp_la-strndup.Plo
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLTLIBRARIES
.PRECIOUS: Makefile
@OS_SOLARIS_TRUE@then
@OS_SOLARIS_TRUE@ PTHREADS_CFLAGS = -pthread
@OS_AIX_TRUE@@OS_SOLARIS_FALSE@ PTHREADS_CFLAGS = -qthreaded
@OS_AIX_FALSE@@OS_SOLARIS_FALSE@ PTHREADS_CFLAGS = -mt
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
librelp-1.13.0/src/relpsess.c 0000664 0001750 0001750 00000120257 15241057272 011517 /* This module implements the relp sess object.
*
* Copyright 2008-2020 by Rainer Gerhards and Adiscon GmbH.
*
* To clarify on session handling: There is no upper limit of the number
* of sessions, except for system ressources. Some left-over comment
* suggest there has been a session limit at least in planning, but
* none exists. Sessions objects are allocated off the heap and kept in
* a linked list. Note, however, that performance may become worse if
* a very large number of sessions exists, due to the current O(n)
* algo for polling the sessions for activity.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 Librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "relp.h"
#include "relpsess.h"
#include "relpframe.h"
#include "relpclt.h"
#include "sendq.h"
#include "offers.h"
#include "dbllinklist.h"
/* forward definitions */
static relpRetVal relpSessCltDoDisconnect(relpSess_t *const pThis);
static relpRetVal relpSessFixCmdStates(relpSess_t *const pThis);
static relpRetVal relpSessSrvDoDisconnect(relpSess_t *const pThis);
/* helper to call onErr if set */
static void
callOnErr(const relpSess_t *__restrict__ const pThis,
char *__restrict__ const emsg,
const relpRetVal ecode)
{
relpTcp_t *const pTcp = pThis->pTcp;
//pThis->pEngine->dbgprint((char*)"librelp: generic error: ecode %d, "
//"emsg '%s'\n", ecode, emsg);
if(pThis->pEngine->onErr != NULL) {
char objinfo[1024];
if(pTcp->pSrv == NULL) { /* client */
snprintf(objinfo, sizeof(objinfo), "conn to srvr %s:%s",
pTcp->pClt->pSess->srvAddr,
pTcp->pClt->pSess->srvPort);
} else if(pTcp->pRemHostIP == NULL) { /* server listener */
snprintf(objinfo, sizeof(objinfo), "lstn %s",
pTcp->pSrv->pLstnPort);
} else { /* server connection to client */
snprintf(objinfo, sizeof(objinfo), "lstn %s: conn to clt %s/%s",
pTcp->pSrv->pLstnPort, pTcp->pRemHostIP,
pTcp->pRemHostName);
}
objinfo[sizeof(objinfo)-1] = '\0';
pThis->pEngine->onErr(pThis->pUsr, objinfo, emsg, ecode);
}
}
static int
relpSessCltCanGracefullyDisconnect(const relpSess_t *const pThis)
{
return pThis->sessState == eRelpSessState_READY_TO_SEND
|| pThis->sessState == eRelpSessState_WINDOW_FULL;
}
/* helper to free permittedPeer structure */
static inline void
relpSessFreePermittedPeers(relpSess_t *const pThis)
{
int i;
for(i = 0 ; i < pThis->permittedPeers.nmemb ; ++i)
free(pThis->permittedPeers.name[i]);
free(pThis->permittedPeers.name);
pThis->permittedPeers.name = NULL;
pThis->permittedPeers.nmemb = 0;
}
/** Construct a RELP sess instance
* the pSrv parameter may be set to NULL if the session object is for a client.
*/
relpRetVal
relpSessConstruct(relpSess_t **ppThis, relpEngine_t *pEngine, int connType, void *pParent, void *pUsr)
{
relpSess_t *pThis;
ENTER_RELPFUNC;
assert(ppThis != NULL);
RELPOBJ_assert(pEngine, Engine);
if((pThis = calloc(1, sizeof(relpSess_t))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
RELP_CORE_CONSTRUCTOR(pThis, Sess);
pThis->pUsr = pUsr;
pThis->pEngine = pEngine;
/* use Engine's command enablement states as default */
pThis->stateCmdSyslog = pEngine->stateCmdSyslog;
if(connType == RELP_SRV_CONN) {
pThis->pSrv = (relpSrv_t*) pParent;
} else {
pThis->pClt = (relpClt_t*) pParent;
}
pThis->txnr = 1; /* txnr start at 1 according to spec */
pThis->timeout = 90;
pThis->sizeWindow = RELP_DFLT_WINDOW_SIZE;
pThis->maxDataSize = RELP_DFLT_MAX_DATA_SIZE;
pThis->authmode = eRelpAuthMode_None;
pThis->pristring = NULL;
pThis->caCertFile = NULL;
pThis->ownCertFile = NULL;
pThis->privKeyFile = NULL;
pThis->tlsConfigCmd = NULL;
pThis->permittedPeers.nmemb = 0;
CHKRet(relpSendqConstruct(&pThis->pSendq, pThis->pEngine));
pthread_mutex_init(&pThis->mutSend, NULL);
*ppThis = pThis;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pThis != NULL) {
relpSessDestruct(&pThis);
}
}
LEAVE_RELPFUNC;
}
/** Destruct a RELP sess instance
*/
relpRetVal
relpSessDestruct(relpSess_t **ppThis)
{
relpSess_t *pThis;
relpSessUnacked_t *pUnacked;
relpSessUnacked_t *pUnackedToDel;
ENTER_RELPFUNC;
assert(ppThis != NULL);
pThis = *ppThis;
RELPOBJ_assert(pThis, Sess);
/* pTcp may be NULL if we run into the destructor due to an error that occured
* during construction.
*/
if(pThis->pTcp != NULL) {
if(pThis->pSrv != NULL) {
/* we are at the server side of the connection */
if( pThis->sessState != eRelpSessState_BROKEN) {
relpSessSrvDoDisconnect(pThis);
}
} else {
/* we are at the client side of the connection */
if(relpSessCltCanGracefullyDisconnect(pThis)) {
relpSessCltDoDisconnect(pThis);
}
}
}
if(pThis->pSendq != NULL)
relpSendqDestruct(&pThis->pSendq);
if(pThis->pTcp != NULL)
relpTcpDestruct(&pThis->pTcp);
/* unacked list */
for(pUnacked = pThis->pUnackedLstRoot ; pUnacked != NULL ; ) {
pUnackedToDel = pUnacked;
pUnacked = pUnacked->pNext;
relpSendbufDestruct(&pUnackedToDel->pSendbuf);
free(pUnackedToDel);
}
if(pThis->pCurrRcvFrame != NULL)
relpFrameDestruct(&pThis->pCurrRcvFrame);
free(pThis->srvPort);
free(pThis->srvAddr);
free(pThis->clientIP);
free(pThis->pristring);
free(pThis->caCertFile);
free(pThis->ownCertFile);
free(pThis->privKeyFile);
free(pThis->tlsConfigCmd);
relpSessFreePermittedPeers(pThis);
pthread_mutex_destroy(&pThis->mutSend);
/* done with de-init work, now free object itself */
free(pThis);
*ppThis = NULL;
LEAVE_RELPFUNC;
}
/* This accepts a new session, and, if all goes well, constructs a new
* session object and adds it to the engine's list of sessions.
* rgerhards, 2008-03-17
*/
relpRetVal
relpSessAcceptAndConstruct(relpSess_t **ppThis, relpSrv_t *const pSrv, const int sock)
{
relpSess_t *pThis = NULL;
ENTER_RELPFUNC;
assert(ppThis != NULL);
RELPOBJ_assert(pSrv, Srv);
assert(sock >= 0);
CHKRet(relpSessConstruct(&pThis, pSrv->pEngine, RELP_SRV_CONN, pSrv, pSrv->pUsr));
CHKRet(relpTcpAcceptConnReq(&pThis->pTcp, sock, pSrv));
CHKRet(relpSessSetMaxDataSize(pThis, pSrv->maxDataSize));
*ppThis = pThis;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pThis != NULL)
relpSessDestruct(&pThis);
}
LEAVE_RELPFUNC;
}
/* receive data from a socket
* The following function is called when the relp engine has detected
* that data is available on the socket. This function reads the available
* data and submits it for processing.
* rgerhards, 2008-03-17
*/
relpRetVal
relpSessRcvData(relpSess_t *const pThis)
{
relpOctet_t rcvBuf[RELP_RCV_BUF_SIZE+1];
ssize_t lenBuf;
ssize_t i;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
lenBuf = RELP_RCV_BUF_SIZE;
rcvBuf[lenBuf] = '\0';
CHKRet(relpTcpRcv(pThis->pTcp, rcvBuf, &lenBuf));
if(lenBuf == 0) {
callOnErr(pThis, (char*) "server closed relp session, session broken", RELP_RET_SESSION_BROKEN);
pThis->pEngine->dbgprint((char*)"server closed relp session %p, session broken\n", (void*)pThis);
/* even though we had a "normal" close, it is unexpected at this
* stage. Consequently, we consider the session to be broken, because
* the recovery action is the same no matter how it is broken.
*/
pThis->sessState = eRelpSessState_BROKEN;
ABORT_FINALIZE(RELP_RET_SESSION_BROKEN);
} else if ((int) lenBuf == -1) {
if(pThis->pTcp->rtryOp != relpTCP_RETRY_recv) {
callOnErr(pThis, (char*) "error when receiving data, session broken", RELP_RET_SESSION_BROKEN);
pThis->pEngine->dbgprint((char*)"errno %d during relp session %p, session broken\n",
errno, (void*)pThis);
pThis->sessState = eRelpSessState_BROKEN;
ABORT_FINALIZE(RELP_RET_SESSION_BROKEN);
} else {
pThis->pEngine->dbgprint((char*)"relp session %p read did not return any DATA, RETRY later\n",
(void*)pThis);
}
} else {
/* Terminate buffer and output received data to debug*/
rcvBuf[lenBuf] = '\0';
pThis->pEngine->dbgprint((char*)"relp session read %d octets, buf '%s'\n", (int) lenBuf, rcvBuf);
/* we have regular data, which we now can process */
for(i = 0 ; i < lenBuf ; ++i) {
if(relpEngineShouldStop(pThis->pEngine)) {
pThis->pEngine->dbgprint((char*)"imrelp is instructed to shut down, thus "
"breaking session %p\n", (void*) pThis);
ABORT_FINALIZE(RELP_RET_SESSION_BROKEN);
}
CHKRet(relpFrameProcessOctetRcvd(&pThis->pCurrRcvFrame, rcvBuf[i], pThis));
}
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Send a response to the client.
* rgerhards, 2008-03-19
*/
relpRetVal
relpSessSendResponse(relpSess_t *const pThis, relpTxnr_t txnr, unsigned char *pData, size_t lenData)
{
relpSendbuf_t *pSendbuf;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
CHKRet(relpFrameBuildSendbuf(&pSendbuf, txnr, (unsigned char*)"rsp", 3,
pData, lenData, pThis, NULL));
/* now enqueue it to the sendq (which means "send it" ;)) */
CHKRet(relpSendqAddBuf(pThis->pSendq, pSendbuf, pThis->pTcp));
finalize_it:
if(iRet != RELP_RET_OK) {
if(iRet == RELP_RET_IO_ERR) {
callOnErr(pThis, (char*) "io error, session broken", RELP_RET_SESSION_BROKEN);
pThis->pEngine->dbgprint((char*)"relp session %p is broken, io error\n", (void*)pThis);
pThis->sessState = eRelpSessState_BROKEN;
} else {
/* alorbach, 2020-04-08:
* Only free sendbuf if error is not RELP_RET_IO_ERR!
* otherwise the buffer is double freed in relpSendbufDestruct() (sendbuf.c)
*/
if(pSendbuf != NULL)
relpSendbufDestruct(&pSendbuf);
}
}
LEAVE_RELPFUNC;
}
/* actually send to the remote peer
* This function takes data from the sendq and sends as much as
* possible to the remote peer.
* rgerhards, 2008-03-19
*/
relpRetVal
relpSessSndData(relpSess_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
if (pThis->sessState != eRelpSessState_BROKEN) {
CHKRet(relpSendqSend(pThis->pSendq, pThis->pTcp));
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Send a command hint to the remote peer. This function works for the
* server-side of the connection. A modified version must be used for the
* client side (because we have different ways of sending the data). We do
* not yet need the client side. If we do, way should think about a generic
* approach, eg by using function pointers for the send function.
* rgerhards, 2008-03-31
*/
static relpRetVal
relpSessSrvSendHint(relpSess_t *const pThis, unsigned char *pHint, size_t lenHint,
unsigned char *pData, size_t lenData)
{
relpSendbuf_t *pSendbuf = NULL;
ENTER_RELPFUNC;
assert(pHint != NULL);
assert(lenHint != 0);
RELPOBJ_assert(pThis, Sess);
CHKRet(relpFrameBuildSendbuf(&pSendbuf, 0, pHint, lenHint, pData, lenData, pThis, NULL));
/* now send it */
pThis->pEngine->dbgprint((char*)"hint-frame to send: '%s'\n", pSendbuf->pData + (9 - pSendbuf->lenTxnr));
CHKRet(relpSendbufSend(pSendbuf, pThis->pTcp));
finalize_it:
if(pSendbuf != NULL)
relpSendbufDestruct(&pSendbuf);
LEAVE_RELPFUNC;
}
/* Disconnect from the client. After disconnect, the session object
* is destructed. This is the server-side disconnect and must be called
* for server sessions only.
* rgerhards, 2008-03-31
*/
static relpRetVal
relpSessSrvDoDisconnect(relpSess_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
/* Try to hint the client that we are closing the session. If the hint does
* not make it through to the client, that's ok, too. Then, it'll notice when it
* tries to use the connection. In any case, it can handle that (but obviously its
* better if the client is able to receive the hint, as this cleans up things a bit
* faster).
*/
CHKRet(relpSessSrvSendHint(pThis, (unsigned char*)"serverclose", 11, (unsigned char*)"", 0));
finalize_it:
LEAVE_RELPFUNC;
}
/* ------------------------------ client based code ------------------------------ */
/* add an entry to our unacked frame list. The sendbuf object is handed over and must
* no longer be accessed by the caller.
* NOTE: we do not need mutex locks. This changes when we have a background transfer
* thread (which we currently do not have).
* rgerhards, 2008-03-20
*/
relpRetVal
relpSessAddUnacked(relpSess_t *const pThis, relpSendbuf_t *pSendbuf)
{
relpSessUnacked_t *pUnackedLstEntry;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
RELPOBJ_assert(pSendbuf, Sendbuf);
if((pUnackedLstEntry = calloc(1, sizeof(relpSessUnacked_t))) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
pUnackedLstEntry->pSendbuf = pSendbuf;
DLL_Add(pUnackedLstEntry, pThis->pUnackedLstRoot, pThis->pUnackedLstLast);
++pThis->lenUnackedLst;
if(pThis->lenUnackedLst >= pThis->sizeWindow) {
/* in theory, we would need to check if the session is initialized, as
* we would mess up session state in that case. However, as the init
* process is just one frame, we can never run into the situation that
* the window is exhausted during init, so we do not check it.
*/
relpSessSetSessState(pThis, eRelpSessState_WINDOW_FULL);
if(pThis->lenUnackedLst >= pThis->sizeWindow)
pThis->pEngine->dbgprint((char*)"Warning: exceeding window size, max %d, curr %d\n",
pThis->lenUnackedLst, pThis->sizeWindow);
}
pThis->pEngine->dbgprint((char*)"ADD sess %p unacked %d, sessState %d\n",
(void*)pThis, pThis->lenUnackedLst, pThis->sessState);
finalize_it:
LEAVE_RELPFUNC;
}
/* Delete an entry from our unacked list. The list entry is destructed, but
* the sendbuf not.
* rgerhards, 2008-03-20
*/
static relpRetVal
relpSessDelUnacked(relpSess_t *const pThis, relpSessUnacked_t *pUnackedLstEntry)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
assert(pUnackedLstEntry != NULL);
DLL_Del(pUnackedLstEntry, pThis->pUnackedLstRoot, pThis->pUnackedLstLast);
--pThis->lenUnackedLst;
if( pThis->lenUnackedLst < pThis->sizeWindow
&& relpSessGetSessState(pThis) == eRelpSessState_WINDOW_FULL) {
/* here, we need to check if we had WINDOW_FULL condition. The reason is that
* we otherwise mess up the session init handling - contrary to ...AddUnacked(),
* we run into the situation of a session state change on init. So we
* need to make sure it works.
*/
relpSessSetSessState(pThis, eRelpSessState_READY_TO_SEND);
}
free(pUnackedLstEntry);
pThis->pEngine->dbgprint((char*)"DEL sess %p unacked %d, sessState %d\n",
(void*)pThis, pThis->lenUnackedLst, pThis->sessState);
LEAVE_RELPFUNC;
}
/* find an entry in the unacked list and provide it to the caller. The entry is handed
* over to the caller and removed from the queue of unacked entries. It is the caller's
* duty to destruct the sendbuf when it is done with it.
* rgerhards, 20080-03-20
*/
relpRetVal
relpSessGetUnacked(relpSess_t *const pThis, relpSendbuf_t **ppSendbuf, relpTxnr_t txnr)
{
relpSessUnacked_t *pUnackedEtry;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
assert(ppSendbuf != NULL);
for( pUnackedEtry = pThis->pUnackedLstRoot
; pUnackedEtry != NULL && pUnackedEtry->pSendbuf->txnr != txnr
; pUnackedEtry = pUnackedEtry->pNext)
/*JUST SKIP*/;
if(pUnackedEtry == NULL)
ABORT_FINALIZE(RELP_RET_NOT_FOUND);
*ppSendbuf = pUnackedEtry->pSendbuf;
relpSessDelUnacked(pThis, pUnackedEtry);
finalize_it:
LEAVE_RELPFUNC;
}
/* Wait for a specific state of the relp session. This function blocks
* until the session is in that state, but runs a receive loop to get hold
* of server responses (because otherwise the state would probably never change ;)).
* If a timeout occurs, the session is considered broken and control returned to
* the caller. Caller must check if the session state has changed to "BROKEN" and
* in this case drop the session. The timeout value is in seconds. This function
* may be called if the session already has the desired state. In that case, it
* returns, but still tries to see if we received anything from the server. If so,
* this data is received. The suggested use is to call the function before any
* send operation, so that will keep our receive capability alive without
* resorting to multi-threading.
* rgerhards, 2008-03-20
*/
static relpRetVal
relpSessWaitState(relpSess_t *const pThis, const relpSessState_t stateExpected, const int timeout)
{
struct pollfd pfd;
int sock;
int nfds;
struct timespec tCurr; /* current time */
struct timespec tTimeout; /* absolute timeout value */
relpRetVal localRet;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
/* first read any outstanding data and process the packets. Note that this
* call DOES NOT block.
*/
localRet = relpSessRcvData(pThis);
if(localRet != RELP_RET_OK) {
pThis->pEngine->dbgprint((char*)"relpSessWaitRsp error initial rcv: %d\n", localRet);
ABORT_FINALIZE(localRet);
}
/* check if we are already in the desired state. If so, we can immediately
* return. That saves us doing a costly clock call to set the timeout. As a
* side-effect, the timeout is actually applied without the time needed for
* above reception. I think is is OK, even a bit logical ;)
*/
if(pThis->sessState == stateExpected) {
FINALIZE;
}
/* ok, looks like we actually need to do a wait... */
clock_gettime(CLOCK_REALTIME, &tCurr);
memcpy(&tTimeout, &tCurr, sizeof(struct timespec));
tTimeout.tv_sec += timeout;
while(!relpEngineShouldStop(pThis->pEngine)) {
sock = relpSessGetSock(pThis);
if(tCurr.tv_sec >= tTimeout.tv_sec) {
ABORT_FINALIZE(RELP_RET_TIMED_OUT);
}
pfd.fd = sock;
pfd.events = POLLIN;
pThis->pEngine->dbgprint((char*)"relpSessWaitRsp waiting for data on "
"fd %d, timeout %d, state expected %d\n", sock, timeout, stateExpected);
nfds = poll(&pfd, 1, timeout*1000);
if(nfds == -1) {
if(errno == EINTR) {
pThis->pEngine->dbgprint((char*)"relpSessWaitRsp select interrupted, continue\n");
} else {
pThis->pEngine->dbgprint((char*)"relpSessWaitRsp select returned error %d\n", errno);
ABORT_FINALIZE(RELP_RET_SESSION_BROKEN);
}
}
else
pThis->pEngine->dbgprint((char*)"relpSessWaitRsp poll returns, "
"nfds %d, errno %d\n", nfds, errno);
if(relpEngineShouldStop(pThis->pEngine))
break;
/* we don't check if we had a timeout-we give it one last chance*/
CHKRet(relpSessRcvData(pThis));
pThis->pEngine->dbgprint((char*)"iRet after relpSessRcvData %d\n", iRet);
if( pThis->sessState == stateExpected
|| pThis->sessState == eRelpSessState_BROKEN) {
FINALIZE;
}
clock_gettime(CLOCK_REALTIME, &tCurr);
}
finalize_it:
pThis->pEngine->dbgprint((char*)"relpSessWaitState returns %d\n", iRet);
if(pThis->sessState != eRelpSessState_BROKEN
&& (iRet == RELP_RET_TIMED_OUT || iRet == RELP_RET_SESSION_BROKEN
|| relpEngineShouldStop(pThis->pEngine))) {
/* the session is broken! */
callOnErr(pThis, (char*) "error waiting on required session state, session broken",
RELP_RET_SESSION_BROKEN);
pThis->sessState = eRelpSessState_BROKEN;
}
LEAVE_RELPFUNC;
}
/* Send a command to the server.
* This is a "raw" send function that just sends the command but does not
* care about the receive loop or session state. This has been put into its
* own function as some functionality (most importantly session init!) requires
* handling that is other than the regular command/response mode.
* rgerhards, 2008-03-19
*/
static relpRetVal
relpSessRawSendCommand(relpSess_t *const pThis, unsigned char *pCmd, size_t lenCmd,
unsigned char *pData, size_t lenData, relpRetVal (*rspHdlr)(relpSess_t*,relpFrame_t*))
{
relpSendbuf_t *pSendbuf;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
CHKRet(relpFrameBuildSendbuf(&pSendbuf, pThis->txnr, pCmd, lenCmd, pData, lenData, pThis, rspHdlr));
pThis->txnr = relpEngineNextTXNR(pThis->txnr);
/* now send it */
pThis->pEngine->dbgprint((char*)"frame to send: '%s'\n", pSendbuf->pData + (9 - pSendbuf->lenTxnr));
iRet = relpSendbufSendAll(pSendbuf, pThis, 1);
if(iRet == RELP_RET_IO_ERR) {
pThis->pEngine->dbgprint((char*)"relp session %p flagged as broken, IO error\n", (void*)pThis);
callOnErr(pThis, (char*) "io error in RawSendCommand, session broken", RELP_RET_SESSION_BROKEN);
pThis->sessState = eRelpSessState_BROKEN;
ABORT_FINALIZE(RELP_RET_SESSION_BROKEN);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Send a command to the server.
* The is the "regular" function which ensures that server messages are received
* and messages are only sent when we have space left in our window. This function
* must only be called after the session is fully initialized. Calling it before
* initialization is finished will probably hang the client.
* rgerhards, 2008-03-19
*/
relpRetVal
relpSessSendCommand(relpSess_t *const pThis, unsigned char *pCmd, size_t lenCmd,
unsigned char *pData, size_t lenData, relpRetVal (*rspHdlr)(relpSess_t*,relpFrame_t*))
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
/* this both reads server responses as well as makes sure we have space
* left in our window.
*/
CHKRet(relpSessWaitState(pThis, eRelpSessState_READY_TO_SEND,
pThis->timeout));
/* then send our data */
if(pThis->sessState == eRelpSessState_BROKEN)
ABORT_FINALIZE(RELP_RET_SESSION_BROKEN);
CHKRet(relpSessRawSendCommand(pThis, pCmd, lenCmd, pData, lenData, rspHdlr));
finalize_it:
LEAVE_RELPFUNC;
}
/* Try to restablish a broken session. A single try is made and the result
* reported back. RELP_RET_OK if we could get a new session, a RELP error state
* otherwise (e.g. RELP_RET_SESSION_BROKEN, but could also be a more precise
* error code). If the session can be re-established, any unsent frames are
* resent. The function returns only after that happened.
* rgerhards, 2008-03-22
*/
relpRetVal
relpSessTryReestablish(relpSess_t *const pThis)
{
relpSessUnacked_t *pUnackedEtry;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
assert(pThis->sessState == eRelpSessState_BROKEN);
CHKRet(relpTcpAbortDestruct(&pThis->pTcp));
CHKRet(relpSessConnect(pThis, pThis->protFamily, pThis->srvPort, pThis->srvAddr));
/* if we reach this point, we could re-establish the session. We now
* need to resend any unacked data. Note that we need to patch in new txnr's
* into the existing frames. We need to do a special send command, as the usual
* one would maintain the unacked list, what we can not do right now (because
* it is not to be modified.
*/
pUnackedEtry = pThis->pUnackedLstRoot;
if(pUnackedEtry != NULL)
pThis->pEngine->dbgprint((char*)"relp session %p reestablished, state %d, "
"now resending %d unacked frames\n",
(void*)pThis, pThis->sessState, pThis->lenUnackedLst);
assert(pThis->sessState != eRelpSessState_BROKEN);
while(pUnackedEtry != NULL) {
pThis->pEngine->dbgprint((char*)"resending frame '%s'\n", pUnackedEtry->pSendbuf->pData + 9
- pUnackedEtry->pSendbuf->lenTxnr);
CHKRet(relpFrameRewriteTxnr(pUnackedEtry->pSendbuf, pThis->txnr));
pThis->txnr = relpEngineNextTXNR(pThis->txnr);
/* Sometimes only part of large buffer is sent before
* connection was closed and bufPtr is set to non-zero value,
* resulting in partial transfer. We always want to send full
* buffer in new connection hence this bufPtr value reset. */
pUnackedEtry->pSendbuf->bufPtr = 0;
CHKRet(relpSendbufSendAll(pUnackedEtry->pSendbuf, pThis, 0));
pUnackedEtry = pUnackedEtry->pNext;
}
finalize_it:
pThis->pEngine->dbgprint((char*)"after TryReestablish, sess state %d\n", pThis->sessState);
LEAVE_RELPFUNC;
}
/* callback when the "open" command has been processed
* Most importantly, this function needs to check if we are
* compatible with the server-provided offers and terminate if
* not. If we are, we must set our own parameters to match the
* server-provided ones. Please note that the offer processing here
* is the last and final. So the ultimate decision is made and if we
* are unhappy with something that we can not ignore, we must
* terminate with an error status.
* In such cases, we flag the session as broken, as theoretically
* it is possible to fix it by restarting the server with a set
* of different parameters. The question remains, though, if that's
* the smartest route to take...
* Note that offer-processing is very similiar to offer-processing
* at the server end (copen.c). We may be able to combine some of
* it in the future (or may not, depending on the subtly different
* needs both parts have. For now I leave this to a ... TODO ;)).
* rgerhards, 2008-03-25
*/
static relpRetVal
relpSessCBrspOpen(relpSess_t *const pThis, relpFrame_t *pFrame)
{
relpEngine_t *pEngine;
relpOffers_t *pOffers = NULL;
relpOffer_t *pOffer;
relpOfferValue_t *pOfferVal;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
RELPOBJ_assert(pFrame, Frame);
pEngine = pThis->pEngine;
/* first get the offers list from the server response */
CHKRet(relpOffersConstructFromFrame(&pOffers, pFrame));
/* we loop through the offers and set session parameters. If we find
* something truely unacceptable, we break the session.
*/
for(pOffer = pOffers->pRoot ; pOffer != NULL ; pOffer = pOffer->pNext) {
pEngine->dbgprint((char*)"processing server offer '%s'\n", pOffer->szName);
if(!strcmp((char*)pOffer->szName, "relp_version")) {
if(pOffer->pValueRoot == NULL)
ABORT_FINALIZE(RELP_RET_INVALID_OFFER);
if(pOffer->pValueRoot->intVal == -1)
ABORT_FINALIZE(RELP_RET_INVALID_OFFER);
if(pOffer->pValueRoot->intVal > pEngine->protocolVersion)
ABORT_FINALIZE(RELP_RET_INCOMPAT_OFFERS);
/* Once we support multiple versions, we may need to check what we
* are compatible with. For now, we accept anything, because there is
* nothing else yet ;)
*/
relpSessSetProtocolVersion(pThis, pOffer->pValueRoot->intVal);
} else if(!strcmp((char*)pOffer->szName, "commands")) {
for(pOfferVal = pOffer->pValueRoot ; pOfferVal != NULL ; pOfferVal = pOfferVal->pNext) {
/* we do not care about return code in this case */
relpSessSetEnableCmd(pThis, pOfferVal->szVal, eRelpCmdState_Enabled);
pEngine->dbgprint((char*)"enabled command '%s'\n", pOfferVal->szVal);
}
} else if(!strcmp((char*)pOffer->szName, "relp_software")) {
/* we know this parameter, but we do not do anything
* with it -- this may change if we need to emulate
* something based on known bad relp software behaviour.
*/
} else {
/* if we do not know an offer name, we ignore it - in this
* case, we may simply not support it (but the client does and
* must now live without it...)
*/
pEngine->dbgprint((char*)"ignoring unknown server offer '%s'\n", pOffer->szName);
}
}
relpSessSetSessState(pThis, eRelpSessState_INIT_RSP_RCVD);
finalize_it:
if(pOffers != NULL)
relpOffersDestruct(&pOffers);
LEAVE_RELPFUNC;
}
/* Check if the set of offers inclulded in our session is compatible with
* what we need. By now, all session parameters should be set to enabled. If
* there are some left as "Required", they are not supported by the server,
* in which case we can not open the session. -- rgerhards, 2008-03-27
*/
static relpRetVal
relpSessCltConnChkOffers(relpSess_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
if(pThis->stateCmdSyslog == eRelpCmdState_Required)
ABORT_FINALIZE(RELP_RET_RQD_FEAT_MISSING);
finalize_it:
if(iRet != RELP_RET_OK) {
callOnErr(pThis, (char*) "error in CltConnChkOffers, session broken", RELP_RET_SESSION_BROKEN);
pThis->sessState = eRelpSessState_BROKEN;
}
LEAVE_RELPFUNC;
}
/* Connect to the server. All session parameters (like remote address) must
* already have been set.
* rgerhards, 2008-03-19
*/
relpRetVal
relpSessConnect(relpSess_t *const pThis, int protFamily, unsigned char *port, unsigned char *host)
{
relpOffers_t *pOffers;
unsigned char *pszOffers = NULL;
size_t lenOffers;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
CHKRet(relpSessFixCmdStates(pThis));
if(pThis->srvAddr == NULL) { /* initial connect, need to save params */
pThis->protFamily = protFamily;
if((pThis->srvPort = (unsigned char*) strdup((char*)port)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
if (host != NULL) { // host can be the same pointer as pThis->srvAddr, so check for NULL!
if((pThis->srvAddr = (unsigned char*) strdup((char*)host)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
}
if (pThis->pCurrRcvFrame != NULL) {
relpFrameDestruct(&pThis->pCurrRcvFrame);
}
/* (re-)init some counters */
pThis->txnr = 1;
pThis->sessType = eRelpSess_Client; /* indicate we have a client session */
CHKRet(relpTcpConstruct(&pThis->pTcp, pThis->pEngine, RELP_CLT_CONN, pThis->pClt));
CHKRet(relpTcpSetUsrPtr(pThis->pTcp, pThis->pUsr));
CHKRet(relpTcpSetConnTimeout(pThis->pTcp, pThis->connTimeout));
if(pThis->bEnableTLS) {
CHKRet(relpTcpEnableTLS(pThis->pTcp));
if(pThis->bEnableTLSZip) {
CHKRet(relpTcpEnableTLSZip(pThis->pTcp));
}
CHKRet(relpTcpSetGnuTLSPriString(pThis->pTcp, pThis->pristring));
CHKRet(relpTcpSetTlsConfigCmd(pThis->pTcp, pThis->tlsConfigCmd));
CHKRet(relpTcpSetCACert(pThis->pTcp, pThis->caCertFile));
CHKRet(relpTcpSetOwnCert(pThis->pTcp, pThis->ownCertFile));
CHKRet(relpTcpSetPrivKey(pThis->pTcp, pThis->privKeyFile));
CHKRet(relpTcpSetAuthMode(pThis->pTcp, pThis->authmode));
CHKRet(relpTcpSetPermittedPeers(pThis->pTcp, &pThis->permittedPeers));
}
CHKRet(relpTcpConnect(pThis->pTcp, protFamily, port, host, pThis->clientIP));
relpSessSetSessState(pThis, eRelpSessState_PRE_INIT);
/* create offers */
CHKRet(relpSessConstructOffers(pThis, &pOffers));
CHKRet(relpOffersToString(pOffers, NULL, 0, &pszOffers, &lenOffers));
CHKRet(relpOffersDestruct(&pOffers));
CHKRet(relpSessRawSendCommand(pThis, (unsigned char*)"open", 4, pszOffers, lenOffers,
relpSessCBrspOpen));
relpSessSetSessState(pThis, eRelpSessState_INIT_CMD_SENT);
CHKRet(relpSessWaitState(pThis, eRelpSessState_INIT_RSP_RCVD, pThis->timeout));
/* we now have received the server's response. Now is a good time to check if the offers
* received back are compatible with what we need - and, if not, terminate the session...
*/
CHKRet(relpSessCltConnChkOffers(pThis));
/* TODO: flag sesssion as broken if we did not succeed? */
/* if we reach this point, we have a valid relp session */
relpSessSetSessState(pThis, eRelpSessState_READY_TO_SEND); /* indicate session startup */
finalize_it:
free(pszOffers);
if(iRet != RELP_RET_OK) {
callOnErr(pThis, (char*) "error opening connection to remote peer", iRet);
if((pThis->pUnackedLstLast != NULL) &&
!strncmp((char*)pThis->pUnackedLstLast->pSendbuf->pData + 9, " open ", 6)) {
pThis->pEngine->dbgprint((char*)"relpSessConnect remove 'open' from unacked list\n");
relpSessUnacked_t *pDel = pThis->pUnackedLstLast;
DLL_Del(pDel, pThis->pUnackedLstRoot, pThis->pUnackedLstLast);
--pThis->lenUnackedLst;
relpSendbufDestruct(&pDel->pSendbuf);
free(pDel);
}
}
LEAVE_RELPFUNC;
}
/* callback when the "close" command has been processed
* rgerhars, 2008-03-21
*/
static relpRetVal
relpSessCBrspClose(relpSess_t *const pThis, relpFrame_t LIBRELP_ATTR_UNUSED *pFrame)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
relpSessSetSessState(pThis, eRelpSessState_CLOSE_RSP_RCVD);
LEAVE_RELPFUNC;
}
/* Disconnect from the server. After disconnect, the session object
* is destructed. This is the client-side disconnect and must be called
* for client sessions only.
* rgerhards, 2008-03-21
*/
static relpRetVal
relpSessCltDoDisconnect(relpSess_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
/* first wait to be permitted to send, this time a bit more impatient (after all,
* we may be terminated if we take too long). We do not care about the return state.
* Even if we are outside of the window, we still send the close request, because
* everything else is even worse. So let's try to be polite...
*/
relpSessWaitState(pThis, eRelpSessState_READY_TO_SEND, 1);
CHKRet(relpSessRawSendCommand(pThis, (unsigned char*)"close", 5, (unsigned char*)"", 0,
relpSessCBrspClose));
relpSessSetSessState(pThis, eRelpSessState_CLOSE_CMD_SENT);
CHKRet(relpSessWaitState(pThis, eRelpSessState_CLOSE_RSP_RCVD, pThis->timeout));
relpSessSetSessState(pThis, eRelpSessState_DISCONNECTED); /* indicate session startup */
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetWindowSize(relpSess_t *const pThis, int sizeWindow)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
if(sizeWindow > 1)
pThis->sizeWindow = sizeWindow;
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetTimeout(relpSess_t *const pThis, unsigned timeout)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->timeout = timeout;
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetConnTimeout(relpSess_t *const pThis, int connTimeout)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->connTimeout = connTimeout;
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetClientIP(relpSess_t *const pThis, unsigned char *ip)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
free(pThis->clientIP);
if(ip == NULL)
pThis->clientIP = NULL;
else
pThis->clientIP = (unsigned char*) strdup((char*) ip);
LEAVE_RELPFUNC;
}
/* this copies a *complete* permitted peers structure into the
* session object.
*/
relpRetVal
relpSessSetPermittedPeers(relpSess_t *const pThis, relpPermittedPeers_t *pPeers)
{
ENTER_RELPFUNC;
int i;
RELPOBJ_assert(pThis, Sess);
relpSessFreePermittedPeers(pThis);
if(pPeers->nmemb != 0) {
if((pThis->permittedPeers.name =
calloc(pPeers->nmemb, sizeof(char*))) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
pThis->permittedPeers.nmemb = pPeers->nmemb;
for(i = 0 ; i < pPeers->nmemb ; ++i) {
if((pThis->permittedPeers.name[i] = strdup(pPeers->name[i])) == NULL) {
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
}
}
finalize_it:
LEAVE_RELPFUNC;
}
/* Enable TLS mode. */
relpRetVal
relpSessEnableTLS(relpSess_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->bEnableTLS = 1;
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetUsrPtr(relpSess_t *const pThis, void *pUsr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->pUsr = pUsr;
LEAVE_RELPFUNC;
}
relpRetVal relpSessSetMaxDataSize(relpSess_t *const pThis, size_t maxSize) {
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->maxDataSize = maxSize;
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetAuthMode(relpSess_t *const pThis, relpAuthMode_t authmode)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->authmode = authmode;
LEAVE_RELPFUNC;
}
/* Enable TLS Zip mode. */
relpRetVal
relpSessEnableTLSZip(relpSess_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->bEnableTLSZip = 1;
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetGnuTLSPriString(relpSess_t *const pThis, char *pristr)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
free(pThis->pristring);
if(pristr == NULL) {
pThis->pristring = NULL;
} else {
if((pThis->pristring = strdup(pristr)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetCACert(relpSess_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
free(pThis->caCertFile);
if(cert == NULL) {
pThis->caCertFile = NULL;
} else {
if((pThis->caCertFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetOwnCert(relpSess_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
free(pThis->ownCertFile);
if(cert == NULL) {
pThis->ownCertFile = NULL;
} else {
if((pThis->ownCertFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetPrivKey(relpSess_t *const pThis, char *cert)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
free(pThis->privKeyFile);
if(cert == NULL) {
pThis->privKeyFile = NULL;
} else {
if((pThis->privKeyFile = strdup(cert)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
relpRetVal
relpSessSetTlsConfigCmd(relpSess_t *const pThis, char *cfgcmd)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
free(pThis->tlsConfigCmd);
if(cfgcmd == NULL) {
pThis->tlsConfigCmd = NULL;
} else {
if((pThis->tlsConfigCmd = strdup(cfgcmd)) == NULL)
ABORT_FINALIZE(RELP_RET_OUT_OF_MEMORY);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* set the protocol version to be used by this session
* rgerhards, 2008-03-25
*/
relpRetVal
relpSessSetProtocolVersion(relpSess_t *const pThis, int protocolVersion)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
pThis->protocolVersion = protocolVersion;
LEAVE_RELPFUNC;
}
/* Enable or disable a command. Note that a command can not be enabled once
* it has been set to forbidden! There will be no error return state in this
* case.
* rgerhards, 2008-03-25
*/
relpRetVal
relpSessSetEnableCmd(relpSess_t *const pThis, unsigned char *pszCmd, relpCmdEnaState_t stateCmd)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
assert(pszCmd != NULL);
if(!strcmp((char*)pszCmd, "syslog")) {
if(pThis->stateCmdSyslog != eRelpCmdState_Forbidden)
pThis->stateCmdSyslog = stateCmd;
} else {
pThis->pEngine->dbgprint((char*)"tried to set unknown command '%s' to %d\n", pszCmd, stateCmd);
ABORT_FINALIZE(RELP_RET_UNKNOWN_CMD);
}
finalize_it:
LEAVE_RELPFUNC;
}
/* create an offers object based on the current session parameters we have.
* rgerhards, 2008-03-25
*/
relpRetVal
relpSessConstructOffers(relpSess_t *const pThis, relpOffers_t **ppOffers)
{
relpOffers_t *pOffers;
relpOffer_t *pOffer;
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
assert(ppOffers != NULL);
CHKRet(relpOffersConstruct(&pOffers, pThis->pEngine));
/* now do the supported commands. Note that we must only send commands that
* are explicitely enabled or desired.
*/
CHKRet(relpOfferAdd(&pOffer, (unsigned char*) "commands", pOffers));
if( pThis->stateCmdSyslog == eRelpCmdState_Enabled
|| pThis->stateCmdSyslog == eRelpCmdState_Desired
|| pThis->stateCmdSyslog == eRelpCmdState_Required)
CHKRet(relpOfferValueAdd((unsigned char*)"syslog", 0, pOffer));
CHKRet(relpOfferAdd(&pOffer, (unsigned char*) "relp_software", pOffers));
CHKRet(relpOfferValueAdd((unsigned char*) "http://librelp.adiscon.com", pThis->protocolVersion, pOffer));
CHKRet(relpOfferValueAdd((unsigned char*) relpEngineGetVersion(), pThis->protocolVersion, pOffer));
CHKRet(relpOfferValueAdd((unsigned char*) "librelp", pThis->protocolVersion, pOffer));
/* just for cosmetic reasons: do relp_version last, so that it shows up
* at the top of the string.
*/
CHKRet(relpOfferAdd(&pOffer, (unsigned char*) "relp_version", pOffers));
CHKRet(relpOfferValueAdd(NULL, pThis->protocolVersion, pOffer));
*ppOffers = pOffers;
finalize_it:
if(iRet != RELP_RET_OK) {
if(pOffers != NULL)
relpOffersDestruct(&pOffers);
}
LEAVE_RELPFUNC;
}
/* Convert unknown cmd state to forbidden.
* This function mut be called after all command states have been set. Those
* that have not expressively been set to desired or forbidden or now changed to
* forbidden, so that they may not be selected by a peer.
* rgerhards, 2008-03-25
*/
static relpRetVal
relpSessFixCmdStates(relpSess_t *const pThis)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
if(pThis->stateCmdSyslog == eRelpCmdState_Unset)
pThis->stateCmdSyslog = eRelpCmdState_Forbidden;
LEAVE_RELPFUNC;
}
/* ------------------------------ command handlers ------------------------------ */
/* Send a syslog command.
* rgerhards, 2008-03-25
*/
relpRetVal
relpSessSendSyslog(relpSess_t *const pThis, unsigned char *pMsg, const size_t lenMsg)
{
ENTER_RELPFUNC;
RELPOBJ_assert(pThis, Sess);
if(pThis->stateCmdSyslog != eRelpCmdState_Enabled)
ABORT_FINALIZE(RELP_RET_CMD_DISABLED);
CHKRet(relpSessSendCommand(pThis, (unsigned char*)"syslog", 6, pMsg, lenMsg, NULL));
finalize_it:
LEAVE_RELPFUNC;
}
librelp-1.13.0/src/cmdif.h 0000644 0001750 0001750 00000004751 13437164712 010747 /* This header defines the interface between the relp engine
* and relp commands. A consistent interface is used to dispatch
* commands to the respective command handlers. All handlers shall
* use the macros provided in this file. This is especially important
* as the interface may evolve in the future and the macros most
* probably will hide the details.
*
* Please note that for each command there is a server- and a client
* based handler. They, as well as all commands, are provided in separate
* source files so that we can get to a nice granularity inside our
* library (just in case if a resource-constrained caller needs to pull
* just the bare essentials into its binary).
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some develoment funding.
*/
#ifndef RELP_CMDIF_H_INCLUDED
#define RELP_CMDIF_H_INCLUDED
#include "relpframe.h"
#define PROTOTYPEcommand(type, cmd) \
relpRetVal relp##type##C##cmd(relpFrame_t *pFrame, relpSess_t *pSess);
#define BEGINcommand(type, cmd) \
relpRetVal relp##type##C##cmd(relpFrame_t LIBRELP_ATTR_UNUSED *pFrame, relpSess_t *pSess) \
{ \
RELPOBJ_assert(pFrame, Frame); \
RELPOBJ_assert(pSess, Sess);
#define ENDcommand \
LEAVE_RELPFUNC; \
}
#endif /* #ifndef RELP_CMDIF_H_INCLUDED */
librelp-1.13.0/src/relpframe.h 0000644 0001750 0001750 00000006063 13734555715 011647 /* The RELPFRAME object.
*
* Copyright 2008 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of librelp.
*
* Librelp 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 3 of the License, or
* (at your option) any later version.
*
* Librelp 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 librelp. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*
* If the terms of the GPL are unsuitable for your needs, you may obtain
* a commercial license from Adiscon. Contact sales@adiscon.com for further
* details.
*
* ALL CONTRIBUTORS PLEASE NOTE that by sending contributions, you assign
* your copyright to Adiscon GmbH, Germany. This is necessary to permit the
* dual-licensing set forth here. Our apologies for this inconvenience, but
* we sincerely believe that the dual-licensing model helps us provide great
* free software while at the same time obtaining some funding for further
* development.
*/
#ifndef RELPFRAME_H_INCLUDED
#define RELPFRAME_H_INCLUDED
/* state the relpframe may have during reception of messages */
typedef enum relpFrameRcvStates_e {
eRelpFrameRcvState_BEGIN_FRAME = 0,
eRelpFrameRcvState_IN_TXNR = 1,
eRelpFrameRcvState_IN_CMD = 2,
eRelpFrameRcvState_IN_DATALEN = 3,
eRelpFrameRcvState_IN_DATA = 4,
eRelpFrameRcvState_IN_TRAILER = 5,
eRelpFrameRcvState_FINISHED = 6 /**< the frame is fully received and ready for processing */
} relpFrameRcvState_t;
/* the RELPFRAME object
* rgerhards, 2008-03-16
*/
struct relpFrame_s {
BEGIN_RELP_OBJ;
relpEngine_t *pEngine;
relpFrameRcvState_t rcvState;
size_t iRcv; /**< a multi-purpose field index used during frame reception */
relpTxnr_t txnr; /**< the current transaction (sequence) number */
relpOctet_t cmd[32+1]; /**< the current command (+1 for C string terminator) */
size_t lenData; /**< length of data part of frame */
relpOctet_t *pData; /**< frame data part */
size_t idxData; /**< keeps track of processed chars when reading pData bytewise */
};
#include "relpsess.h" /* this needs to be done after relpFrame_t is defined! */
#include "sendbuf.h"
/* prototypes */
relpRetVal relpFrameProcessOctetRcvd(relpFrame_t **ppThis, relpOctet_t c, relpSess_t *pSess);
relpRetVal relpFrameDestruct(relpFrame_t **ppThis);
relpRetVal relpFrameBuildSendbuf(relpSendbuf_t **ppSendbuf, relpTxnr_t txnr, unsigned char *pCmd, size_t lenCmd,
relpOctet_t *pData, size_t lenData, relpSess_t *pSess, relpRetVal (*rspHdlr)(relpSess_t*,relpFrame_t*));
relpRetVal relpFrameRewriteTxnr(relpSendbuf_t *pSendbuf, relpTxnr_t txnr);
relpRetVal relpFrameGetNextC(relpFrame_t *pThis, unsigned char *pC);
#endif /* #ifndef RELPFRAME_H_INCLUDED */
librelp-1.13.0/aclocal.m4 0000664 0001750 0001750 00000311267 15241057401 010561 # generated automatically by aclocal 1.16.5 -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
[m4_warning([this file was generated for autoconf 2.71.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# ============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
# ============================================================================
#
# SYNOPSIS
#
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
# flag. If it does, the flag is added FLAGS-VARIABLE
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. During the check the flag is always added to the
# current language's flags.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: This macro depends on the AX_APPEND_FLAG and
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
# AX_APPEND_LINK_FLAGS.
#
# LICENSE
#
# Copyright (c) 2011 Maarten Bosmans
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
done
])dnl AX_APPEND_COMPILE_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
# added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim
# Copyright (c) 2011 Maarten Bosmans
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 8
AC_DEFUN([AX_APPEND_FLAG],
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
AS_VAR_APPEND(FLAGS,[" $1"])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# For every FLAG1, FLAG2 it is checked whether the linker works with the
# flag. If it does, the flag is added FLAGS-VARIABLE
#
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
# used. During the check the flag is always added to the linker's flags.
#
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
# when the check is done. The check is thus made with the flags: "LDFLAGS
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
#
# LICENSE
#
# Copyright (c) 2011 Maarten Bosmans
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
AC_DEFUN([AX_APPEND_LINK_FLAGS],
[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
done
])dnl AX_APPEND_LINK_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim
# Copyright (c) 2011 Maarten Bosmans
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the linker or gives an error.
# (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
# when the check is done. The check is thus made with the flags: "LDFLAGS
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_LINK_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim
# Copyright (c) 2011 Maarten Bosmans
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AC_DEFUN([AX_CHECK_LINK_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
ax_check_save_flags=$LDFLAGS
LDFLAGS="$LDFLAGS $4 $1"
AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
LDFLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_LINK_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPILER_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [IS-RELEASE], [EXTRA-BASE-CFLAGS], [EXTRA-YES-CFLAGS], [UNUSED], [UNUSED], [UNUSED], [EXTRA-BASE-LDFLAGS], [EXTRA-YES-LDFLAGS], [UNUSED], [UNUSED], [UNUSED])
#
# DESCRIPTION
#
# Check for the presence of an --enable-compile-warnings option to
# configure, defaulting to "error" in normal operation, or "yes" if
# IS-RELEASE is equal to "yes". Return the value in the variable
# $ax_enable_compile_warnings.
#
# Depending on the value of --enable-compile-warnings, different compiler
# warnings are checked to see if they work with the current compiler and,
# if so, are appended to CFLAGS-VARIABLE and LDFLAGS-VARIABLE. This
# allows a consistent set of baseline compiler warnings to be used across
# a code base, irrespective of any warnings enabled locally by individual
# developers. By standardising the warnings used by all developers of a
# project, the project can commit to a zero-warnings policy, using -Werror
# to prevent compilation if new warnings are introduced. This makes
# catching bugs which are flagged by warnings a lot easier.
#
# By providing a consistent --enable-compile-warnings argument across all
# projects using this macro, continuous integration systems can easily be
# configured the same for all projects. Automated systems or build
# systems aimed at beginners may want to pass the --disable-Werror
# argument to unconditionally prevent warnings being fatal.
#
# --enable-compile-warnings can take the values:
#
# * no: Base compiler warnings only; not even -Wall.
# * yes: The above, plus a broad range of useful warnings.
# * error: The above, plus -Werror so that all warnings are fatal.
# Use --disable-Werror to override this and disable fatal
# warnings.
#
# The set of base and enabled flags can be augmented using the
# EXTRA-*-CFLAGS and EXTRA-*-LDFLAGS variables, which are tested and
# appended to the output variable if --enable-compile-warnings is not
# "no". Flags should not be disabled using these arguments, as the entire
# point of AX_COMPILER_FLAGS is to enforce a consistent set of useful
# compiler warnings on code, using warnings which have been chosen for low
# false positive rates. If a compiler emits false positives for a
# warning, a #pragma should be used in the code to disable the warning
# locally. See:
#
# https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
#
# The EXTRA-* variables should only be used to supply extra warning flags,
# and not general purpose compiler flags, as they are controlled by
# configure options such as --disable-Werror.
#
# IS-RELEASE can be used to disable -Werror when making a release, which
# is useful for those hairy moments when you just want to get the release
# done as quickly as possible. Set it to "yes" to disable -Werror. By
# default, it uses the value of $ax_is_release, so if you are using the
# AX_IS_RELEASE macro, there is no need to pass this parameter. For
# example:
#
# AX_IS_RELEASE([git-directory])
# AX_COMPILER_FLAGS()
#
# CFLAGS-VARIABLE defaults to WARN_CFLAGS, and LDFLAGS-VARIABLE defaults
# to WARN_LDFLAGS. Both variables are AC_SUBST-ed by this macro, but must
# be manually added to the CFLAGS and LDFLAGS variables for each target in
# the code base.
#
# If C++ language support is enabled with AC_PROG_CXX, which must occur
# before this macro in configure.ac, warning flags for the C++ compiler
# are AC_SUBST-ed as WARN_CXXFLAGS, and must be manually added to the
# CXXFLAGS variables for each target in the code base. EXTRA-*-CFLAGS can
# be used to augment the base and enabled flags.
#
# Warning flags for g-ir-scanner (from GObject Introspection) are
# AC_SUBST-ed as WARN_SCANNERFLAGS. This variable must be manually added
# to the SCANNERFLAGS variable for each GIR target in the code base. If
# extra g-ir-scanner flags need to be enabled, the AX_COMPILER_FLAGS_GIR
# macro must be invoked manually.
#
# AX_COMPILER_FLAGS may add support for other tools in future, in addition
# to the compiler and linker. No extra EXTRA-* variables will be added
# for those tools, and all extra support will still use the single
# --enable-compile-warnings configure option. For finer grained control
# over the flags for individual tools, use AX_COMPILER_FLAGS_CFLAGS,
# AX_COMPILER_FLAGS_LDFLAGS and AX_COMPILER_FLAGS_* for new tools.
#
# The UNUSED variables date from a previous version of this macro, and are
# automatically appended to the preceding non-UNUSED variable. They should
# be left empty in new uses of the macro.
#
# LICENSE
#
# Copyright (c) 2014, 2015 Philip Withnall
# Copyright (c) 2015 David King
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 14
# _AX_COMPILER_FLAGS_LANG([LANGNAME])
m4_defun([_AX_COMPILER_FLAGS_LANG],
[m4_ifdef([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [],
[m4_define([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [])dnl
AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_]$1[FLAGS])])dnl
])
AC_DEFUN([AX_COMPILER_FLAGS],[
# C support is enabled by default.
_AX_COMPILER_FLAGS_LANG([C])
# Only enable C++ support if AC_PROG_CXX is called. The redefinition of
# AC_PROG_CXX is so that a fatal error is emitted if this macro is called
# before AC_PROG_CXX, which would otherwise cause no C++ warnings to be
# checked.
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AX_COMPILER_FLAGS_LANG([CXX])],
[m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AX_COMPILER_FLAGS_LANG([CXX])])])
AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_LDFLAGS])
# Default value for IS-RELEASE is $ax_is_release
ax_compiler_flags_is_release=m4_tolower(m4_normalize(ifelse([$3],,
[$ax_is_release],
[$3])))
AC_ARG_ENABLE([compile-warnings],
AS_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@],
[Enable compiler warnings and errors]),,
[AS_IF([test "$ax_compiler_flags_is_release" = "yes"],
[enable_compile_warnings="yes"],
[enable_compile_warnings="error"])])
AC_ARG_ENABLE([Werror],
AS_HELP_STRING([--disable-Werror],
[Unconditionally make all compiler warnings non-fatal]),,
[enable_Werror=maybe])
# Return the user's chosen warning level
AS_IF([test "$enable_Werror" = "no" -a \
"$enable_compile_warnings" = "error"],[
enable_compile_warnings="yes"
])
ax_enable_compile_warnings=$enable_compile_warnings
AX_COMPILER_FLAGS_CFLAGS([$1],[$ax_compiler_flags_is_release],
[$4],[$5 $6 $7 $8])
m4_ifdef([_AX_COMPILER_FLAGS_LANG_CXX_enabled],
[AX_COMPILER_FLAGS_CXXFLAGS([WARN_CXXFLAGS],
[$ax_compiler_flags_is_release],
[$4],[$5 $6 $7 $8])])
AX_COMPILER_FLAGS_LDFLAGS([$2],[$ax_compiler_flags_is_release],
[$9],[$10 $11 $12 $13])
AX_COMPILER_FLAGS_GIR([WARN_SCANNERFLAGS],[$ax_compiler_flags_is_release])
])dnl AX_COMPILER_FLAGS
# =============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html
# =============================================================================
#
# SYNOPSIS
#
# AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
#
# DESCRIPTION
#
# Add warning flags for the C compiler to VARIABLE, which defaults to
# WARN_CFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
# manually added to the CFLAGS variable for each target in the code base.
#
# This macro depends on the environment set up by AX_COMPILER_FLAGS.
# Specifically, it uses the value of $ax_enable_compile_warnings to decide
# which flags to enable.
#
# LICENSE
#
# Copyright (c) 2014, 2015 Philip Withnall
# Copyright (c) 2017, 2018 Reini Urban
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 17
AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
AC_REQUIRE([AC_PROG_SED])
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
# Variable names
m4_define([ax_warn_cflags_variable],
[m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))])
AC_LANG_PUSH([C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#ifndef __cplusplus
#error "no C++"
#endif]])],
[ax_compiler_cxx=yes;],
[ax_compiler_cxx=no;])
# Always pass -Werror=unknown-warning-option to get Clang to fail on bad
# flags, otherwise they are always appended to the warn_cflags variable, and
# Clang warns on them for every compilation unit.
# If this is passed to GCC, it will explode, so the flag must be enabled
# conditionally.
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
ax_compiler_flags_test="-Werror=unknown-warning-option"
],[
ax_compiler_flags_test=""
])
# Check that -Wno-suggest-attribute=format is supported
AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[
ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format"
],[
ax_compiler_no_suggest_attribute_flags=""
])
# Base flags
AX_APPEND_COMPILE_FLAGS([ dnl
-fno-strict-aliasing dnl
$3 dnl
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
if test "$ax_compiler_cxx" = "no" ; then
# C-only flags. Warn in C++
AX_APPEND_COMPILE_FLAGS([ dnl
-Wnested-externs dnl
-Wmissing-prototypes dnl
-Wstrict-prototypes dnl
-Wdeclaration-after-statement dnl
-Wimplicit-function-declaration dnl
-Wold-style-definition dnl
-Wjump-misses-init dnl
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
fi
# "yes" flags
AX_APPEND_COMPILE_FLAGS([ dnl
-Wall dnl
-Wextra dnl
-Wundef dnl
-Wwrite-strings dnl
-Wpointer-arith dnl
-Wmissing-declarations dnl
-Wredundant-decls dnl
-Wno-unused-parameter dnl
-Wno-missing-field-initializers dnl
-Wformat=2 dnl
-Wcast-align dnl
-Wformat-nonliteral dnl
-Wformat-security dnl
-Wsign-compare dnl
-Wstrict-aliasing dnl
-Wshadow dnl
-Winline dnl
-Wpacked dnl
-Wmissing-format-attribute dnl
-Wmissing-noreturn dnl
-Winit-self dnl
-Wredundant-decls dnl
-Wmissing-include-dirs dnl
-Wunused-but-set-variable dnl
-Warray-bounds dnl
-Wreturn-type dnl
-Wswitch-enum dnl
-Wswitch-default dnl
-Wduplicated-cond dnl
-Wduplicated-branches dnl
-Wlogical-op dnl
-Wrestrict dnl
-Wnull-dereference dnl
-Wdouble-promotion dnl
$4 dnl
$5 dnl
$6 dnl
$7 dnl
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
])
AS_IF([test "$ax_enable_compile_warnings" = "error"],[
# "error" flags; -Werror has to be appended unconditionally because
# it's not possible to test for
#
# suggest-attribute=format is disabled because it gives too many false
# positives
AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable)
AX_APPEND_COMPILE_FLAGS([ dnl
[$ax_compiler_no_suggest_attribute_flags] dnl
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
])
# In the flags below, when disabling specific flags, always add *both*
# -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
# we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
# which effectively turns that flag back on again as an error.
for flag in $ax_warn_cflags_variable; do
AS_CASE([$flag],
[-Wno-*=*],[],
[-Wno-*],[
AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')],
ax_warn_cflags_variable,
[$ax_compiler_flags_test])
])
done
AC_LANG_POP([C])
# Substitute the variables
AC_SUBST(ax_warn_cflags_variable)
])dnl AX_COMPILER_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
#
# DESCRIPTION
#
# Add warning flags for the g-ir-scanner (from GObject Introspection) to
# VARIABLE, which defaults to WARN_SCANNERFLAGS. VARIABLE is AC_SUBST-ed
# by this macro, but must be manually added to the SCANNERFLAGS variable
# for each GIR target in the code base.
#
# This macro depends on the environment set up by AX_COMPILER_FLAGS.
# Specifically, it uses the value of $ax_enable_compile_warnings to decide
# which flags to enable.
#
# LICENSE
#
# Copyright (c) 2015 Philip Withnall
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AC_DEFUN([AX_COMPILER_FLAGS_GIR],[
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
# Variable names
m4_define([ax_warn_scannerflags_variable],
[m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))])
# Base flags
AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable)
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
# "yes" flags
AX_APPEND_FLAG([ dnl
--warn-all dnl
$4 dnl
$5 dnl
$6 dnl
$7 dnl
],ax_warn_scannerflags_variable)
])
AS_IF([test "$ax_enable_compile_warnings" = "error"],[
# "error" flags
AX_APPEND_FLAG([ dnl
--warn-error dnl
],ax_warn_scannerflags_variable)
])
# Substitute the variables
AC_SUBST(ax_warn_scannerflags_variable)
])dnl AX_COMPILER_FLAGS
# ==============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_ldflags.html
# ==============================================================================
#
# SYNOPSIS
#
# AX_COMPILER_FLAGS_LDFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
#
# DESCRIPTION
#
# Add warning flags for the linker to VARIABLE, which defaults to
# WARN_LDFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
# manually added to the LDFLAGS variable for each target in the code base.
#
# This macro depends on the environment set up by AX_COMPILER_FLAGS.
# Specifically, it uses the value of $ax_enable_compile_warnings to decide
# which flags to enable.
#
# LICENSE
#
# Copyright (c) 2014, 2015 Philip Withnall
# Copyright (c) 2017, 2018 Reini Urban
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 9
AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
# Variable names
m4_define([ax_warn_ldflags_variable],
[m4_normalize(ifelse([$1],,[WARN_LDFLAGS],[$1]))])
# Always pass -Werror=unknown-warning-option to get Clang to fail on bad
# flags, otherwise they are always appended to the warn_ldflags variable,
# and Clang warns on them for every compilation unit.
# If this is passed to GCC, it will explode, so the flag must be enabled
# conditionally.
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
ax_compiler_flags_test="-Werror=unknown-warning-option"
],[
ax_compiler_flags_test=""
])
AX_CHECK_LINK_FLAG([-Wl,--as-needed], [
AX_APPEND_LINK_FLAGS([-Wl,--as-needed],
[AM_LDFLAGS],[$ax_compiler_flags_test])
])
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [
AX_APPEND_LINK_FLAGS([-Wl,-z,relro],
[AM_LDFLAGS],[$ax_compiler_flags_test])
])
AX_CHECK_LINK_FLAG([-Wl,-z,now], [
AX_APPEND_LINK_FLAGS([-Wl,-z,now],
[AM_LDFLAGS],[$ax_compiler_flags_test])
])
AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [
AX_APPEND_LINK_FLAGS([-Wl,-z,noexecstack],
[AM_LDFLAGS],[$ax_compiler_flags_test])
])
# textonly, retpolineplt not yet
# macOS and cygwin linker do not have --as-needed
AX_CHECK_LINK_FLAG([-Wl,--no-as-needed], [
ax_compiler_flags_as_needed_option="-Wl,--no-as-needed"
], [
ax_compiler_flags_as_needed_option=""
])
# macOS linker speaks with a different accent
ax_compiler_flags_fatal_warnings_option=""
AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings], [
ax_compiler_flags_fatal_warnings_option="-Wl,--fatal-warnings"
])
AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings], [
ax_compiler_flags_fatal_warnings_option="-Wl,-fatal_warnings"
])
# Base flags
AX_APPEND_LINK_FLAGS([ dnl
$ax_compiler_flags_as_needed_option dnl
$3 dnl
],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
# "yes" flags
AX_APPEND_LINK_FLAGS([$4 $5 $6 $7],
ax_warn_ldflags_variable,
[$ax_compiler_flags_test])
])
AS_IF([test "$ax_enable_compile_warnings" = "error"],[
# "error" flags; -Werror has to be appended unconditionally because
# it's not possible to test for
#
# suggest-attribute=format is disabled because it gives too many false
# positives
AX_APPEND_LINK_FLAGS([ dnl
$ax_compiler_flags_fatal_warnings_option dnl
],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
])
# Substitute the variables
AC_SUBST(ax_warn_ldflags_variable)
])dnl AX_COMPILER_FLAGS
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_is_release.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_IS_RELEASE(POLICY)
#
# DESCRIPTION
#
# Determine whether the code is being configured as a release, or from
# git. Set the ax_is_release variable to 'yes' or 'no'.
#
# If building a release version, it is recommended that the configure
# script disable compiler errors and debug features, by conditionalising
# them on the ax_is_release variable. If building from git, these
# features should be enabled.
#
# The POLICY parameter specifies how ax_is_release is determined. It can
# take the following values:
#
# * git-directory: ax_is_release will be 'no' if a '.git'
# directory or git worktree exists
# * minor-version: ax_is_release will be 'no' if the minor version number
# in $PACKAGE_VERSION is odd; this assumes
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
# * micro-version: ax_is_release will be 'no' if the micro version number
# in $PACKAGE_VERSION is odd; this assumes
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
# * dash-version: ax_is_release will be 'no' if there is a dash '-'
# in $PACKAGE_VERSION, for example 1.2-pre3, 1.2.42-a8b9
# or 2.0-dirty (in particular this is suitable for use
# with git-version-gen)
# * always: ax_is_release will always be 'yes'
# * never: ax_is_release will always be 'no'
#
# Other policies may be added in future.
#
# LICENSE
#
# Copyright (c) 2015 Philip Withnall
# Copyright (c) 2016 Collabora Ltd.
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
#serial 8
AC_DEFUN([AX_IS_RELEASE],[
AC_BEFORE([AC_INIT],[$0])
m4_case([$1],
[git-directory],[
# $is_release = (.git directory does not exist)
AS_IF([test -d ${srcdir}/.git || (test -f ${srcdir}/.git && grep \.git/worktrees ${srcdir}/.git)],[ax_is_release=no],[ax_is_release=yes])
],
[minor-version],[
# $is_release = ($minor_version is even)
minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
AS_IF([test "$(( $minor_version % 2 ))" -ne 0],
[ax_is_release=no],[ax_is_release=yes])
],
[micro-version],[
# $is_release = ($micro_version is even)
micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'`
AS_IF([test "$(( $micro_version % 2 ))" -ne 0],
[ax_is_release=no],[ax_is_release=yes])
],
[dash-version],[
# $is_release = ($PACKAGE_VERSION has a dash)
AS_CASE([$PACKAGE_VERSION],
[*-*], [ax_is_release=no],
[*], [ax_is_release=yes])
],
[always],[ax_is_release=yes],
[never],[ax_is_release=no],
[
AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version, micro-version, dash-version, always, never.])
])
])
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_REQUIRE_DEFINED(MACRO)
#
# DESCRIPTION
#
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
# been defined and thus are available for use. This avoids random issues
# where a macro isn't expanded. Instead the configure script emits a
# non-fatal:
#
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
#
# It's like AC_REQUIRE except it doesn't expand the required macro.
#
# Here's an example:
#
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
#
# LICENSE
#
# Copyright (c) 2014 Mike Frysinger
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 2
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
])dnl AX_REQUIRE_DEFINED
# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant .
dnl Copyright © 2012-2015 Dan Nicholson
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl As a special exception to the GNU General Public License, if you
dnl distribute this file as part of a program that contains a
dnl configuration script generated by Autoconf, you may include it under
dnl the same distribution terms that you use for the rest of that
dnl program.
dnl PKG_PREREQ(MIN-VERSION)
dnl -----------------------
dnl Since: 0.29
dnl
dnl Verify that the version of the pkg-config macros are at least
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
dnl installed version of pkg-config, this checks the developer's version
dnl of pkg.m4 when generating configure.
dnl
dnl To ensure that this macro is defined, also add:
dnl m4_ifndef([PKG_PREREQ],
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])dnl PKG_PROG_PKG_CONFIG
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------------
dnl Since: 0.18
dnl
dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
dnl only at the first occurrence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
dnl ---------------------------------------------
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])dnl _PKG_CONFIG
dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl ---------------------------
dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl --------------------------------------------------------------
dnl Since: 0.4.0
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[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.
_PKG_TEXT
To get pkg-config, see .])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])dnl PKG_CHECK_MODULES
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl ---------------------------------------------------------------------
dnl Since: 0.29
dnl
dnl Checks for existence of MODULES and gathers its build flags with
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
dnl and VARIABLE-PREFIX_LIBS from --libs.
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
dnl configure.ac.
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
_save_PKG_CONFIG=$PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES($@)
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
])dnl PKG_CHECK_MODULES_STATIC
dnl PKG_INSTALLDIR([DIRECTORY])
dnl -------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable pkgconfigdir as the location where a module
dnl should install pkg-config .pc files. By default the directory is
dnl $libdir/pkgconfig, but the default can be changed by passing
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
dnl parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_INSTALLDIR
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
dnl --------------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
dnl module should install arch-independent pkg-config .pc files. By
dnl default the directory is $datadir/pkgconfig, but the default can be
dnl changed by passing DIRECTORY. The user can override through the
dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_NOARCH_INSTALLDIR
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------
dnl Since: 0.28
dnl
dnl Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
dnl [DESCRIPTION], [DEFAULT])
dnl ------------------------------------------
dnl
dnl Prepare a "--with-" configure option using the lowercase
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
dnl PKG_CHECK_MODULES in a single macro.
AC_DEFUN([PKG_WITH_MODULES],
[
m4_pushdef([with_arg], m4_tolower([$1]))
m4_pushdef([description],
[m4_default([$5], [build with ]with_arg[ support])])
m4_pushdef([def_arg], [m4_default([$6], [auto])])
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
m4_case(def_arg,
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
[m4_pushdef([with_without],[--with-]with_arg)])
AC_ARG_WITH(with_arg,
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
[AS_TR_SH([with_]with_arg)=def_arg])
AS_CASE([$AS_TR_SH([with_]with_arg)],
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
[auto],[PKG_CHECK_MODULES([$1],[$2],
[m4_n([def_action_if_found]) $3],
[m4_n([def_action_if_not_found]) $4])])
m4_popdef([with_arg])
m4_popdef([description])
m4_popdef([def_arg])
])dnl PKG_WITH_MODULES
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
dnl [DESCRIPTION], [DEFAULT])
dnl -----------------------------------------------
dnl
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
dnl check._[VARIABLE-PREFIX] is exported as make variable.
AC_DEFUN([PKG_HAVE_WITH_MODULES],
[
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
AM_CONDITIONAL([HAVE_][$1],
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
])dnl PKG_HAVE_WITH_MODULES
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
dnl [DESCRIPTION], [DEFAULT])
dnl ------------------------------------------------------
dnl
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
dnl and preprocessor variable.
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
[
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
])dnl PKG_HAVE_DEFINE_WITH_MODULES
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.5], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.5])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ([2.52])dnl
m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
[$1], [CXX], [depcc="$CXX" am_compiler_list=],
[$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
[$1], [UPC], [depcc="$UPC" am_compiler_list=],
[$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[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".
rm -rf conftest.dir
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_$1_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
m4_case([$1], [CC],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac],
[CXX],
[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 10 /bin/sh.
echo '/* dummy */' > 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
;;
msvc7 | msvc7msys | 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_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE([dependency-tracking], [dnl
AS_HELP_STRING(
[--enable-dependency-tracking],
[do not reject slow dependency extractors])
AS_HELP_STRING(
[--disable-dependency-tracking],
[speeds up one-time build])])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
# Older Autoconf 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.
# TODO: see whether this extra hack can be removed once we start
# requiring Autoconf 2.70 or later.
AS_CASE([$CONFIG_FILES],
[*\'*], [eval set x "$CONFIG_FILES"],
[*], [set x $CONFIG_FILES])
shift
# Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do
# Strip MF so we end up with the name of the file.
am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile which includes
# dependency-tracking related rules and includes.
# Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|| continue
am_dirpart=`AS_DIRNAME(["$am_mf"])`
am_filepart=`AS_BASENAME(["$am_mf"])`
AM_RUN_LOG([cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles]) || am_rc=$?
done
if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE="gmake" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).])
fi
AS_UNSET([am_dirpart])
AS_UNSET([am_filepart])
AS_UNSET([am_mf])
AS_UNSET([am_rc])
rm -f conftest-deps.mk
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking is enabled.
# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
# order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])
[_AM_PROG_CC_C_O
])
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
m4_ifdef([_$0_ALREADY_INIT],
[m4_fatal([$0 expanded multiple times
]m4_defn([_$0_ALREADY_INIT]))],
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
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
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[AC_DIAGNOSE([obsolete],
[$0: two- and three-arguments forms are deprecated.])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
AM_MISSING_PROG([AUTOCONF], [autoconf])
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
AM_MISSING_PROG([AUTOHEADER], [autoheader])
AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
#
#
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES([CC])],
[m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES([CXX])],
[m4_define([AC_PROG_CXX],
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES([OBJC])],
[m4_define([AC_PROG_OBJC],
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[_AM_DEPENDENCIES([OBJCXX])],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
# Variables for tags utilities; see am/tags.am
if test -z "$CTAGS"; then
CTAGS=ctags
fi
AC_SUBST([CTAGS])
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
if test -z "$CSCOPE"; then
CSCOPE=cscope
fi
AC_SUBST([CSCOPE])
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard:
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: .
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi
dnl The trailing newline in this macro's definition is deliberate, for
dnl backward compatibility and to allow trailing 'dnl'-style comments
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh+set}" != 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
AC_SUBST([install_sh])])
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[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
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MAKE_INCLUDE()
# -----------------
# Check whether make has an 'include' directive that can support all
# the idioms we need for our automatic dependency tracking code.
AC_DEFUN([AM_MAKE_INCLUDE],
[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
cat > confinc.mk << 'END'
am__doit:
@echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
am__include="#"
am__quote=
# BSD make does it like this.
echo '.include "confinc.mk" # ignored' > confmf.BSD
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
echo 'include confinc.mk # ignored' > confmf.GNU
_am_result=no
for s in GNU BSD; do
AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
AS_CASE([$?:`cat confinc.out 2>/dev/null`],
['0:this is the am__doit target'],
[AS_CASE([$s],
[BSD], [am__include='.include' am__quote='"'],
[am__include='include' am__quote=''])])
if test "$am__include" != "#"; then
_am_result="yes ($s style)"
break
fi
done
rm -f confinc.* confmf.*
AC_MSG_RESULT([${_am_result}])
AC_SUBST([am__include])])
AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it is modern enough.
# If it is, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
MISSING="\${SHELL} '$am_aux_dir/missing'"
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
AC_MSG_WARN(['missing' script is too old or missing])
fi
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_CC_C_O
# ---------------
# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
# to automatically call this.
AC_DEFUN([_AM_PROG_CC_C_O],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
AC_LANG_PUSH([C])dnl
AC_CACHE_CHECK(
[whether $CC understands -c and -o together],
[am_cv_prog_cc_c_o],
[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
# Make sure it works both with $CC and with simple cc.
# Following AC_PROG_CC_C_O, we do the test twice because some
# compilers refuse to overwrite an existing .o file with -o,
# though they will create one.
am_cv_prog_cc_c_o=yes
for am_i in 1 2; do
if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
&& test -f conftest2.$ac_objext; then
: OK
else
am_cv_prog_cc_c_o=no
break
fi
done
rm -f core conftest*
unset am_i])
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# ---------------------------------------------------------------------------
# Adds support for distributing Python modules and packages. To
# install modules, copy them to $(pythondir), using the python_PYTHON
# automake variable. To install a package with the same name as the
# automake package, install to $(pkgpythondir), or use the
# pkgpython_PYTHON automake variable.
#
# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
# locations to install python extension modules (shared libraries).
# Another macro is required to find the appropriate flags to compile
# extension modules.
#
# If your package is configured with a different prefix to python,
# users will have to add the install directory to the PYTHONPATH
# environment variable, or create a .pth file (see the python
# documentation for details).
#
# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
# cause an error if the version of python installed on the system
# doesn't meet the requirement. MINIMUM-VERSION should consist of
# numbers and dots only.
AC_DEFUN([AM_PATH_PYTHON],
[
dnl Find a Python interpreter. Python versions prior to 2.0 are not
dnl supported. (2.0 was released on October 16, 2000).
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
[python python2 python3 dnl
python3.11 python3.10 dnl
python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
python3.2 python3.1 python3.0 dnl
python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
python2.0])
AC_ARG_VAR([PYTHON], [the Python interpreter])
m4_if([$1],[],[
dnl No version check is needed.
# Find any Python interpreter.
if test -z "$PYTHON"; then
AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
fi
am_display_PYTHON=python
], [
dnl A version check is needed.
if test -n "$PYTHON"; then
# If the user set $PYTHON, use it and don't search something else.
AC_MSG_CHECKING([whether $PYTHON version is >= $1])
AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Python interpreter is too old])])
am_display_PYTHON=$PYTHON
else
# Otherwise, try each interpreter until we find one that satisfies
# VERSION.
AC_CACHE_CHECK([for a Python interpreter with version >= $1],
[am_cv_pathless_PYTHON],[
for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
test "$am_cv_pathless_PYTHON" = none && break
AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
done])
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
if test "$am_cv_pathless_PYTHON" = none; then
PYTHON=:
else
AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
fi
am_display_PYTHON=$am_cv_pathless_PYTHON
fi
])
if test "$PYTHON" = :; then
dnl Run any user-specified action, or abort.
m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
else
dnl Query Python for its version number. Although site.py simply uses
dnl sys.version[:3], printing that failed with Python 3.10, since the
dnl trailing zero was eliminated. So now we output just the major
dnl and minor version numbers, as numbers. Apparently the tertiary
dnl version is not of interest.
dnl
AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
[am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`])
AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
dnl At times, e.g., when building shared libraries, you may want
dnl to know which OS platform Python thinks this is.
dnl
AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
[am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
dnl emacs-page
dnl If --with-python-sys-prefix is given, use the values of sys.prefix
dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX
dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and
dnl ${exec_prefix} variables.
dnl
dnl The two are made distinct variables so they can be overridden if
dnl need be, although general consensus is that you shouldn't need
dnl this separation.
dnl
dnl Also allow directly setting the prefixes via configure options,
dnl overriding any default.
dnl
if test "x$prefix" = xNONE; then
am__usable_prefix=$ac_default_prefix
else
am__usable_prefix=$prefix
fi
# Allow user to request using sys.* values from Python,
# instead of the GNU $prefix values.
AC_ARG_WITH([python-sys-prefix],
[AS_HELP_STRING([--with-python-sys-prefix],
[use Python's sys.prefix and sys.exec_prefix values])],
[am_use_python_sys=:],
[am_use_python_sys=false])
# Allow user to override whatever the default Python prefix is.
AC_ARG_WITH([python_prefix],
[AS_HELP_STRING([--with-python_prefix],
[override the default PYTHON_PREFIX])],
[am_python_prefix_subst=$withval
am_cv_python_prefix=$withval
AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix])
AC_MSG_RESULT([$am_cv_python_prefix])],
[
if $am_use_python_sys; then
# using python sys.prefix value, not GNU
AC_CACHE_CHECK([for python default $am_display_PYTHON prefix],
[am_cv_python_prefix],
[am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`])
dnl If sys.prefix is a subdir of $prefix, replace the literal value of
dnl $prefix with a variable reference so it can be overridden.
case $am_cv_python_prefix in
$am__usable_prefix*)
am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'`
am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"`
;;
*)
am_python_prefix_subst=$am_cv_python_prefix
;;
esac
else # using GNU prefix value, not python sys.prefix
am_python_prefix_subst='${prefix}'
am_python_prefix=$am_python_prefix_subst
AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix])
AC_MSG_RESULT([$am_python_prefix])
fi])
# Substituting python_prefix_subst value.
AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst])
# emacs-page Now do it all over again for Python exec_prefix, but with yet
# another conditional: fall back to regular prefix if that was specified.
AC_ARG_WITH([python_exec_prefix],
[AS_HELP_STRING([--with-python_exec_prefix],
[override the default PYTHON_EXEC_PREFIX])],
[am_python_exec_prefix_subst=$withval
am_cv_python_exec_prefix=$withval
AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix])
AC_MSG_RESULT([$am_cv_python_exec_prefix])],
[
# no explicit --with-python_exec_prefix, but if
# --with-python_prefix was given, use its value for python_exec_prefix too.
AS_IF([test -n "$with_python_prefix"],
[am_python_exec_prefix_subst=$with_python_prefix
am_cv_python_exec_prefix=$with_python_prefix
AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix])
AC_MSG_RESULT([$am_cv_python_exec_prefix])],
[
# Set am__usable_exec_prefix whether using GNU or Python values,
# since we use that variable for pyexecdir.
if test "x$exec_prefix" = xNONE; then
am__usable_exec_prefix=$am__usable_prefix
else
am__usable_exec_prefix=$exec_prefix
fi
#
if $am_use_python_sys; then # using python sys.exec_prefix, not GNU
AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix],
[am_cv_python_exec_prefix],
[am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`])
dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the
dnl literal value of $exec_prefix with a variable reference so it can
dnl be overridden.
case $am_cv_python_exec_prefix in
$am__usable_exec_prefix*)
am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'`
am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"`
;;
*)
am_python_exec_prefix_subst=$am_cv_python_exec_prefix
;;
esac
else # using GNU $exec_prefix, not python sys.exec_prefix
am_python_exec_prefix_subst='${exec_prefix}'
am_python_exec_prefix=$am_python_exec_prefix_subst
AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix])
AC_MSG_RESULT([$am_python_exec_prefix])
fi])])
# Substituting python_exec_prefix_subst.
AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst])
# Factor out some code duplication into this shell variable.
am_python_setup_sysconfig="\
import sys
# Prefer sysconfig over distutils.sysconfig, for better compatibility
# with python 3.x. See automake bug#10227.
try:
import sysconfig
except ImportError:
can_use_sysconfig = 0
else:
can_use_sysconfig = 1
# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
#
try:
from platform import python_implementation
if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
can_use_sysconfig = 0
except ImportError:
pass"
dnl emacs-page Set up 4 directories:
dnl 1. pythondir: where to install python scripts. This is the
dnl site-packages directory, not the python standard library
dnl directory like in previous automake betas. This behavior
dnl is more consistent with lispdir.m4 for example.
dnl Query distutils for this directory.
dnl
AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)],
[am_cv_python_pythondir],
[if test "x$am_cv_python_prefix" = x; then
am_py_prefix=$am__usable_prefix
else
am_py_prefix=$am_cv_python_prefix
fi
am_cv_python_pythondir=`$PYTHON -c "
$am_python_setup_sysconfig
if can_use_sysconfig:
if hasattr(sysconfig, 'get_default_scheme'):
scheme = sysconfig.get_default_scheme()
else:
scheme = sysconfig._get_default_scheme()
if scheme == 'posix_local':
# Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
scheme = 'posix_prefix'
sitedir = sysconfig.get_path('purelib', scheme, vars={'base':'$am_py_prefix'})
else:
from distutils import sysconfig
sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
sys.stdout.write(sitedir)"`
#
case $am_cv_python_pythondir in
$am_py_prefix*)
am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"`
;;
*)
case $am_py_prefix in
/usr|/System*) ;;
*) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
;;
esac
;;
esac
])
AC_SUBST([pythondir], [$am_cv_python_pythondir])
dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was
dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
dnl more consistent with the rest of automake.
dnl
AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
dnl 3. pyexecdir: directory for installing python extension modules
dnl (shared libraries).
dnl Query distutils for this directory.
dnl
AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)],
[am_cv_python_pyexecdir],
[if test "x$am_cv_python_exec_prefix" = x; then
am_py_exec_prefix=$am__usable_exec_prefix
else
am_py_exec_prefix=$am_cv_python_exec_prefix
fi
am_cv_python_pyexecdir=`$PYTHON -c "
$am_python_setup_sysconfig
if can_use_sysconfig:
if hasattr(sysconfig, 'get_default_scheme'):
scheme = sysconfig.get_default_scheme()
else:
scheme = sysconfig._get_default_scheme()
if scheme == 'posix_local':
# Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
scheme = 'posix_prefix'
sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase':'$am_py_exec_prefix'})
else:
from distutils import sysconfig
sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
sys.stdout.write(sitedir)"`
#
case $am_cv_python_pyexecdir in
$am_py_exec_prefix*)
am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"`
;;
*)
case $am_py_exec_prefix in
/usr|/System*) ;;
*) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
;;
esac
;;
esac
])
AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE)
dnl
AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
dnl Run any user-specified action.
$2
fi
])
# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
# ---------------------------------------------------------------------------
# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
# Run ACTION-IF-FALSE otherwise.
# This test uses sys.hexversion instead of the string equivalent (first
# word of sys.version), in order to cope with versions such as 2.2c1.
# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
AC_DEFUN([AM_PYTHON_CHECK_VERSION],
[prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
# map returns an iterator in Python 3.0 and a list in 2.x
minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
minverhex = 0
# xrange is not present in Python 3.0 and range returns an iterator
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
sys.exit(sys.hexversion < minverhex)"
AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
AC_DEFUN([AM_RUN_LOG],
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
(exit $ac_status); }])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# 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]]*)
AC_MSG_ERROR([unsafe absolute working directory name]);;
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
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 (
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
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
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".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
AC_MSG_RESULT([done])])
rm -f conftest.file
])
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Enable less verbose build rules; with the default set to DEFAULT
# ("yes" being less verbose, "no" or empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
[--enable-silent-rules],
[less verbose build output (undo: "make V=1")])
AS_HELP_STRING(
[--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl
])
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
dnl See automake bug#9928 and bug#10237.
am_make=${MAKE-make}
AC_CACHE_CHECK([whether $am_make supports nested variables],
[am_cv_make_support_nested_variables],
[if AS_ECHO([['TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi])
if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# 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.
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of 'v7', 'ustar', or 'pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
#
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
m4_if([$1], [v7],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1],
[ustar],
[# The POSIX 1988 'ustar' format is defined with fixed-size fields.
# There is notably a 21 bits limit for the UID and the GID. In fact,
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
# and bug#13588).
am_max_uid=2097151 # 2^21 - 1
am_max_gid=$am_max_uid
# The $UID and $GID variables are not portable, so we need to resort
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
# below are definitely unexpected, so allow the users to see them
# (that is, avoid stderr redirection).
am_uid=`id -u || echo unknown`
am_gid=`id -g || echo unknown`
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
if test $am_uid -le $am_max_uid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
if test $am_gid -le $am_max_gid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi],
[pax],
[],
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Go ahead even if we have the value already cached. We do so because we
# need to set the values for the 'am__tar' and 'am__untar' variables.
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
for _am_tool in $_am_tools; do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar; do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works.
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar /dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
librelp-1.13.0/tests/ 0000775 0001750 0001750 00000000000 15241057437 010142 5 librelp-1.13.0/tests/tls-basic-realistic.sh 0000775 0001750 0001750 00000001410 14354536317 014256 #!/bin/bash
# added 2018-11-15 by Rainer Gerhards, released under ASL 2.0
# a more relastic test which actually sends a bit larger number
# of messages
. ${srcdir:=$(pwd)}/test-framework.sh
NUMMESSAGES=10000
function actual_test() {
startup_receiver -l $TEST_TLS_LIB -T -a "name" -x ${srcdir}/tls-certs/ca.pem \
-y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem \
-P 'testbench.rsyslog.com' -e error.out.log
./send -l $TEST_TLS_LIB -t 127.0.0.1 -p $TESTPORT -n$NUMMESSAGES -T -a "name" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P 'testbench.rsyslog.com' $OPT_VERBOSE
./msleep 1000
stop_receiver
check_msg_count
printf 'END SUBTEST lib %s SUCCESS\n' $TEST_TLS_LIB
}
do_tls_subtests
terminate
librelp-1.13.0/tests/truncate-oversize-msg.sh 0000755 0001750 0001750 00000001115 13734555715 014701 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
startup_receiver -o truncate -m 144 -e $TESTDIR/$errorlog
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" -d 154 1>>client.err.log 2>&1
stop_receiver
# ^-sign symbolizes the beginning of the message and $-sign the expected end.
check_output "^testmessage0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012$"
check_output "error.*frame too long" $TESTDIR/$errorlog
cat ${OUTFILE}
terminate
librelp-1.13.0/tests/permitted-peer-lifetime.sh 0000775 0001750 0001750 00000000046 15241057272 015140 #!/bin/bash
./permitted_peer_lifetime
librelp-1.13.0/tests/tls-basic-certvalid.sh 0000775 0001750 0001750 00000001131 14354536317 014254 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
function actual_test() {
startup_receiver -l $TEST_TLS_LIB -T -a "certvalid" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem -e "${TESTDIR}/${errorlog}"
echo 'Send Message...'
./send -l $TEST_TLS_LIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "certvalid" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem $OPT_VERBOSE 1>>${OUTFILE} 2>&1
stop_receiver
check_output "testmessage"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/tls-missing-param-receiver.sh 0000775 0001750 0001750 00000000656 14354536317 015604 #!/bin/bash
# This is a self test for the testbench! It does NOT test Relp.
echo 'Start Receiver...'
. ${srcdir:=$(pwd)}/test-framework.sh
function actual_test() {
# NOT USING startup_receiver!
./receive -l $TEST_TLS_LIB -p $TESTPORT -T -a "name" \
-y ${srcdir}/tls-certs/cert.pem -P "rsyslog" \
2> $OUTFILE
check_output "receive:.*parameter missing; certificates and permittedPeer required"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/chkseq.c 0000644 0001750 0001750 00000014564 13403223761 011505 /* Checks if a file consists of line of strictly monotonically
* increasing numbers. An expected start and end number may
* be set.
*
* Params
* -f file to process, if not given stdin is processed.
* -s -e
* default for s is 0. -e should be given (else it is also 0)
* -d may be specified, in which case duplicate messages are permitted.
* -m number of messages permitted to be missing without triggering a
* failure. This is necessary for some failover tests, where it is
* impossible to totally guard against messagt loss. By default, NO
* message is permitted to be lost.
* -T anticipate truncation (which means specified payload length may be
* more than actual payload (which may have been truncated)
* -i increment between messages (default: 1). Can be used for tests which
* intentionally leave consistent gaps in the message numbering.
*
* Part of the testbench for rsyslog.
*
* Copyright 2009-2018 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
* Rsyslog 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 3 of the License, or
* (at your option) any later version.
*
* Rsyslog 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 Rsyslog. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*/
#include "config.h"
#include
#include
#include
#if defined(_AIX)
#include
#else
#include
#endif
int main(int argc, char *argv[])
{
FILE *fp;
int val;
int i;
int ret = 0;
int scanfOK;
int verbose = 0;
int bHaveExtraData = 0;
int bAnticipateTruncation = 0;
int dupsPermitted = 0;
int start = 0, end = 0;
int opt;
int lostok = 0; /* how many messages are OK to be lost? */
int nDups = 0;
int increment = 1;
int reachedEOF;
int edLen; /* length of extra data */
static char edBuf[500*1024]; /* buffer for extra data (pretty large to be on the save side...) */
static char ioBuf[sizeof(edBuf)+1024];
char *file = NULL;
while((opt = getopt(argc, argv, "i:e:f:ds:vm:ET")) != EOF) {
switch((char)opt) {
case 'f':
file = optarg;
break;
case 'd':
dupsPermitted = 1;
break;
case 'i':
increment = atoi(optarg);
break;
case 'e':
end = atoi(optarg);
break;
case 's':
start = atoi(optarg);
break;
case 'v':
++verbose;
break;
case 'm':
lostok = atoi(optarg);
break;
case 'E':
bHaveExtraData = 1;
break;
case 'T':
bAnticipateTruncation = 1;
break;
default:printf("Invalid call of chkseq, optchar='%c'\n", opt);
printf("Usage: chkseq file -sstart -eend -d -E\n");
exit(1);
}
}
if(start > end) {
printf("start must be less than or equal end!\n");
exit(1);
}
if(verbose) {
printf("chkseq: start %d, end %d\n", start, end);
}
/* read file */
if(file == NULL) {
fp = stdin;
} else {
fp = fopen(file, "r");
}
if(fp == NULL) {
printf("error opening file '%s'\n", file);
perror(file);
exit(1);
}
for(i = start ; i < end+1 ; i += increment) {
if(bHaveExtraData) {
if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
scanfOK = 0;
} else {
scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0;
}
if(edLen != (int) strlen(edBuf)) {
if (bAnticipateTruncation == 1) {
if (edLen < (int) strlen(edBuf)) {
printf("extra data length specified %d, but actually is %ld in"
" record %d (truncation was anticipated, but payload should"
" have been smaller than data-length, not larger)\n",
edLen, (long) strlen(edBuf), i);
exit(1);
}
} else {
printf("extra data length specified %d, but actually is %ld in record %d\n",
edLen, (long) strlen(edBuf), i);
exit(1);
}
}
} else {
if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
scanfOK = 0;
} else {
scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0;
}
}
if(!scanfOK) {
printf("scanf error in index i=%d\n", i);
exit(1);
}
while(val > i && lostok > 0) {
--lostok;
printf("message %d missing (ok due to -m [now %d])\n", i, lostok);
++i;
}
if(val != i) {
if(val == i - 1 && dupsPermitted) {
--i;
++nDups;
} else {
printf("read value %d, but expected value %d\n", val, i);
exit(1);
}
}
}
if(i - 1 != end) {
printf("only %d records in file, expected %d\n", i - 1, end);
exit(1);
}
int c = getc(fp);
if(c == EOF) {
reachedEOF = 1;
} else {
ungetc(c, fp);
/* if duplicates are permitted, we need to do a final check if we have duplicates at the
* end of file.
*/
if(dupsPermitted) {
i = end;
while(!feof(fp)) {
if(bHaveExtraData) {
if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
scanfOK = 0;
} else {
scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val,
&edLen, edBuf) == 3 ? 1 : 0;
}
if(edLen != (int) strlen(edBuf)) {
if (bAnticipateTruncation == 1) {
if (edLen < (int) strlen(edBuf)) {
printf("extra data length specified %d, but "
"actually is %ld in record %d (truncation was"
" anticipated, but payload should have been "
"smaller than data-length, not larger)\n",
edLen, (long) strlen(edBuf), i);
exit(1);
}
} else {
printf("extra data length specified %d, but actually "
"is %ld in record %d\n",
edLen, (long) strlen(edBuf), i);
exit(1);
}
}
} else {
if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) {
scanfOK = 0;
} else {
scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0;
}
}
if(val != i) {
reachedEOF = 0;
goto breakIF;
}
}
reachedEOF = feof(fp) ? 1 : 0;
} else {
reachedEOF = 0;
}
}
breakIF:
if(nDups != 0)
printf("info: had %d duplicates (this is no error)\n", nDups);
if(!reachedEOF) {
printf("end of processing, but NOT end of file! First line of extra data is:\n");
for(c = fgetc(fp) ; c != '\n' && c != EOF ; c = fgetc(fp))
putchar(c);
putchar('\n');
exit(1);
}
exit(ret);
}
librelp-1.13.0/tests/oversize-msg-accept-errmsg.sh 0000755 0001750 0001750 00000001160 13734555715 015610 #!/bin/bash
# Check if oversize message error is generated by receiver
# and message is accepted correctly.
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
startup_receiver -m 140 -o "accept" -e $TESTDIR/$errorlog
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage1" -d 150 1>>client.err.log 2>&1
stop_receiver
check_output "error.*frame too long.*will still be accepted" $TESTDIR/$errorlog
check_output "^testmessage1012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567$"
terminate
librelp-1.13.0/tests/tls-gtls-lifecycle.sh 0000775 0001750 0001750 00000000041 15241030422 014103 #!/bin/bash
./tls_gtls_lifecycle
librelp-1.13.0/tests/selftest_receive_usage.sh 0000755 0001750 0001750 00000000201 13437164712 015127 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
./receive &>${OUTFILE}
cat ${OUTFILE}
check_output "Port is missing"
terminate
librelp-1.13.0/tests/receiver-abort.sh 0000775 0001750 0001750 00000001346 14354536317 013341 #!/bin/bash
# added 2018-11-15 by Rainer Gerhards, released under ASL 2.0
# check that receiver abort is handled gracefully
# of messages
. ${srcdir:=$(pwd)}/test-framework.sh
# export OPT_VERBOSE=-v # uncomment for debugging
export errorlog="error.$LIBRELP_DYN.log"
export NUMMESSAGES=10000
check_command_available timeout
startup_receiver -e ${TESTDIR}/${errorlog}
./send -t 127.0.0.1 -p $TESTPORT -n$NUMMESSAGES -N -K 2000 -I $RECEIVE_PID $OPT_VERBOSE &
SENDER_PID=$!
for i in {1..3}; do
sleep 2
timeout 10s $PYTHON ${srcdir}/dummyserver.py $TESTPORT
done
sleep 2 # make sure client goes into retry
startup_receiver --append-outfile
wait $SENDER_PID
printf 'wait on sender retured %d\n' $?
stop_receiver
check_msg_count
terminate
librelp-1.13.0/tests/Makefile.am 0000664 0001750 0001750 00000012270 15241057272 012115 TEST_EXTENSIONS=.sh
check_PROGRAMS=receive send chkseq have_tlslib msleep
if ENABLE_TLS_OPENSSL
if BUILD_STATIC
# This white-box test needs internal symbols that are not exported by librelp.
check_PROGRAMS+=tls_ossl_fd_reuse
tls_ossl_fd_reuse_SOURCES=tls-ossl-fd-reuse.c
tls_ossl_fd_reuse_LDADD=../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
tls_ossl_fd_reuse_CFLAGS=$(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
if OS_SOLARIS_WRAP
else
check_PROGRAMS+=tls_ossl_retry_state
tls_ossl_retry_state_SOURCES=tls-ossl-retry-state.c
tls_ossl_retry_state_LDADD=../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
tls_ossl_retry_state_LDFLAGS=-Wl,--wrap=SSL_write -Wl,--wrap=SSL_read -Wl,--wrap=SSL_get_error
tls_ossl_retry_state_CFLAGS=$(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
endif
endif
endif
if ENABLE_TLS
if BUILD_STATIC
check_PROGRAMS+=permitted_peer_lifetime
permitted_peer_lifetime_SOURCES=permitted-peer-lifetime.c
permitted_peer_lifetime_LDADD=../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
permitted_peer_lifetime_CFLAGS=$(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
# These white-box fixtures use GNU ld --wrap interposition. Solaris Studio
# accepts the option but does not provide compatible runtime interposition.
if OS_SOLARIS_WRAP
else
check_PROGRAMS+=tcp_accept_fd_reuse tls_gtls_lifecycle
tcp_accept_fd_reuse_SOURCES=tcp-accept-fd-reuse.c
tcp_accept_fd_reuse_LDADD=../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
tcp_accept_fd_reuse_LDFLAGS=-Wl,--wrap=accept -Wl,--wrap=close
tcp_accept_fd_reuse_CFLAGS=$(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
tls_gtls_lifecycle_SOURCES=tls-gtls-lifecycle.c
tls_gtls_lifecycle_LDADD=../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
tls_gtls_lifecycle_LDFLAGS=-Wl,--wrap=gnutls_bye -Wl,--wrap=gnutls_deinit \
-Wl,--wrap=gnutls_certificate_free_credentials \
-Wl,--wrap=gnutls_anon_free_client_credentials \
-Wl,--wrap=gnutls_anon_free_server_credentials \
-Wl,--wrap=gnutls_dh_params_deinit
tls_gtls_lifecycle_CFLAGS=$(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
endif
endif
endif
receive_SOURCES=receive.c
receive_LDADD=../src/.libs/librelp.la
receive_CFLAGS=$(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
send_SOURCES=send.c
send_LDADD=../src/.libs/librelp.la
send_CFLAGS=$(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
msleep_SOURCES = msleep.c
chkseq_SOURCES=chkseq.c
have_tlslib_SOURCES=have_tlslib.c
VALGRIND_TESTS= \
duplicate-receiver-vg.sh \
basic-sessionbreak-vg.sh
# TLS tests that work both with gnutls and openssl
TLS_TESTS= \
tls-basic.sh \
tls-basic-realistic.sh \
tls-basic-anon.sh \
tls-basic-certvalid.sh \
tls-basic-fingerprint.sh \
tls-basic-wildcard.sh \
tls-basic-tlscommand.sh \
tls-basic-tlscommand-ciphers.sh \
tls-basic-certchain.sh \
tls-basic-certvalid-mixed.sh \
tls-receiver-abort.sh \
tls-missing-param-sender.sh \
tls-missing-param-receiver.sh
TLS_VALGRIND_TESTS= \
tls-basic-vg.sh \
tls-ossl-connect-failure-vg.sh
# static tests specific to GnuTLS
GTLS_STATIC_TESTS= \
tcp-accept-fd-reuse.sh \
tls-gtls-lifecycle.sh
TLS_STATIC_TESTS= \
permitted-peer-lifetime.sh
# test specific to openssl
OSSL_TESTS= \
tls-wrong-permittedPeer.sh \
tls-wrong-authname.sh \
tls-wrong-signedcert.sh
OSSL_STATIC_TESTS= \
tls-ossl-fd-reuse.sh
OSSL_WRAP_STATIC_TESTS= \
tls-ossl-retry-state.sh
# reenable tests when stable
# tls-basic-brokencert.sh
TESTS= selftest_receive_watchdog.sh \
selftest_receive_usage.sh \
basic.sh \
basic-realistic.sh \
session-callbacks.sh \
receiver-abort.sh \
long-msg.sh \
oversize-msg-abort-errmsg.sh \
oversize-msg-accept-errmsg.sh \
truncate-oversize-msg.sh \
send-noconnect.sh \
send-dummyserver-no-waitstate-errmsg.sh \
receive-emptyconnect.sh
if ENABLE_TLS_GENERIC
TESTS+=$(TLS_TESTS)
endif
if ENABLE_TLS
if BUILD_STATIC
TESTS+=$(TLS_STATIC_TESTS)
if OS_SOLARIS_WRAP
else
TESTS+=$(GTLS_STATIC_TESTS)
endif
endif
endif
if ENABLE_TLS_OPENSSL
TESTS+=$(OSSL_TESTS)
if BUILD_STATIC
TESTS+=$(OSSL_STATIC_TESTS)
if OS_SOLARIS_WRAP
else
TESTS+=$(OSSL_WRAP_STATIC_TESTS)
endif
endif
endif
if HAVE_VALGRIND
TESTS+=$(VALGRIND_TESTS)
if ENABLE_TLS_GENERIC
TESTS+=$(TLS_VALGRIND_TESTS)
endif # ENABLE_TLS_GENERIC
endif # HAVE_VALGRIND
EXTRA_DIST=$(TESTS) \
$(TLS_TESTS) \
$(GTLS_STATIC_TESTS) \
$(OSSL_TESTS) \
$(OSSL_STATIC_TESTS) \
$(OSSL_WRAP_STATIC_TESTS) \
$(TLS_VALGRIND_TESTS) \
$(VALGRIND_TESTS) \
set-envvars.in \
dummyclient.py \
dummyserver.py \
invalid-open.py \
session-callbacks.sh \
test-framework.sh \
receive.c \
send.c \
tls-ossl-fd-reuse.c \
tls-ossl-retry-state.c \
tcp-accept-fd-reuse.c \
tls-gtls-lifecycle.c \
permitted-peer-lifetime.c \
tls-certs/ca.pem \
tls-certs/cert.pem \
tls-certs/key.pem \
tls-certs/certchain.pem \
tls-certs/ossl-ca.pem \
tls-certs/ossl-ca-key.pem \
tls-certs/ossl-client-cert.pem \
tls-certs/ossl-client-key.pem \
tls-certs/ossl-client-certchain.pem \
tls-certs/ossl-clientbrok-cert.pem \
tls-certs/ossl-clientbrok-key.pem \
tls-certs/ossl-server-cert.pem \
tls-certs/ossl-server-key.pem \
tls-certs/ossl-server-certchain.pem
librelp-1.13.0/tests/tls-missing-param-sender.sh 0000755 0001750 0001750 00000000540 13720663520 015237 #!/bin/bash
# This is a self test for the testbench! It does NOT test Relp.
. ${srcdir:=$(pwd)}/test-framework.sh
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "name" -y ${srcdir}/tls-certs/cert.pem -P "rsyslog" > ${OUTFILE}
check_output "send:.*parameter missing; certificates and permittedPeer required"
terminate
librelp-1.13.0/tests/have_tlslib.c 0000644 0001750 0001750 00000001111 13437164712 012512 /* a simple program to check which TLs libs are available in
* the current build. Returns 0 if available, 1 if not, 2 if error.
* Written 2018-11-23 by Rainer Gerhards, released under ASL 2.0
*/
#include "config.h"
#include
#include
#include
int
main(int argc, char *argv[])
{
if(argc != 2) {
fprintf(stderr, "usage: have_tlslib \n");
exit(2);
}
#if defined(ENABLE_TLS)
if(!strcasecmp(argv[1], "gnutls"))
exit(0);
#endif
#if defined(ENABLE_TLS_OPENSSL)
if(!strcasecmp(argv[1], "openssl"))
exit(0);
#endif
return 1;
}
librelp-1.13.0/tests/selftest_receive_watchdog.sh 0000775 0001750 0001750 00000000432 14354536317 015636 #!/bin/bash
# written 2018-11-28 by Rainer Gerhards, released under ASL 2.0
. ${srcdir:=$(pwd)}/test-framework.sh
printf 'starting receive, waiting for watchdog timeout to occur\n'
./receive -W 2 -p $TESTPORT &> $OUTFILE
cat $OUTFILE
check_output "watchdog timer expired"
terminate
librelp-1.13.0/tests/tls-ossl-retry-state.sh 0000775 0001750 0001750 00000000043 15241030422 014440 #!/bin/bash
./tls_ossl_retry_state
librelp-1.13.0/tests/dummyserver.py 0000755 0001750 0001750 00000001531 13734555715 013026 #!/usr/bin/env python
# a very simple "dummy" server for testing purposes
# written 2018-11-19 by Rainer Gerhards, released under ASL 2.0
import socket
import sys
import datetime
port = int(sys.argv[1])
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("127.0.0.1", port))
sock.listen(1)
print (datetime.datetime.now().strftime("%H:%M:%S"), "DUMMYSERVER: listening on port", port)
conn, addr = sock.accept()
print (datetime.datetime.now().strftime("%H:%M:%S"), "DUMMYSERVER: got connection request")
data = conn.recv(1024)
print (datetime.datetime.now().strftime("%H:%M:%S"), "DUMMYSERVER: done receive")
conn.shutdown(socket.SHUT_RDWR)
sock.shutdown(socket.SHUT_RDWR)
conn.close()
sock.close()
print (datetime.datetime.now().strftime("%H:%M:%S"), "DUMMYSERVER: shutting down")
librelp-1.13.0/tests/tls-basic-fingerprint.sh 0000775 0001750 0001750 00000001264 14354536317 014635 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
function actual_test() {
startup_receiver -l $TEST_TLS_LIB -T -a "fingerprint" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem -P 'SHA1:5C:C6:62:D5:9D:25:9F:BC:F3:CB:61:FA:D2:B3:8B:61:88:D7:06:C3' -e error.out.log
echo 'Send Message...'
./send -l $TEST_TLS_LIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "fingerprint" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem -P 'SHA1:5C:C6:62:D5:9D:25:9F:BC:F3:CB:61:FA:D2:B3:8B:61:88:D7:06:C3' $OPT_VERBOSE 1>>${OUTFILE} 2>&1
stop_receiver
check_output "testmessage"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/basic.sh 0000755 0001750 0001750 00000000333 13403223761 011470 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
startup_receiver $OPT_VERBOSE
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" $OPT_VERBOSE
stop_receiver
check_output "testmessage"
terminate
librelp-1.13.0/tests/tls-basic-certchain.sh 0000775 0001750 0001750 00000001042 14354536317 014240 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
function actual_test() {
startup_receiver -l $TEST_TLS_LIB -T -a "certvalid" -y ${srcdir}/tls-certs/ossl-server-certchain.pem -z ${srcdir}/tls-certs/ossl-server-key.pem -e error.out.log
echo 'Send Message...'
./send -l $TEST_TLS_LIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "certvalid" -y ${srcdir}/tls-certs/ossl-client-certchain.pem -z ${srcdir}/tls-certs/ossl-client-key.pem $OPT_VERBOSE 1>>${OUTFILE} 2>&1
stop_receiver
check_output "testmessage"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/tls-ossl-fd-reuse.c 0000664 0001750 0001750 00000011213 15241030422 013475 /*
* Deterministic reproducer for OpenSSL BIO socket ownership.
*
* librelp closes pTcp->sock before freeing its SSL object. The callback below
* reuses the descriptor between those two operations. The SSL socket BIO must
* not close the replacement descriptor when SSL_free() destroys the BIO.
*/
#include "config.h"
#if defined(ENABLE_TLS_OPENSSL)
#include
#include
#include
#include
#include
#include
#include
#include
#include "librelp.h"
#include "tcp.h"
static int watched_fd = -1;
static int replacement_fd = -1;
static int replacement_installed;
static int callback_error;
static void
discard_debug(char *const fmt __attribute__((unused)), ...)
{
}
static long
reuse_closed_fd(BIO *const bio __attribute__((unused)), const int operation,
const char *const argp __attribute__((unused)),
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
const size_t len __attribute__((unused)),
#endif
const int argi __attribute__((unused)), const long argl __attribute__((unused)),
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
const int ret, size_t *const processed __attribute__((unused)))
#else
const long ret)
#endif
{
if((operation & ~BIO_CB_RETURN) == BIO_CB_FREE && !replacement_installed) {
errno = 0;
if(fcntl(watched_fd, F_GETFD) == -1 && errno == EBADF) {
if(dup2(replacement_fd, watched_fd) == -1)
callback_error = errno;
else
replacement_installed = 1;
}
}
return ret;
}
static void
close_if_open(const int fd)
{
if(fd >= 0)
(void) close(fd);
}
int
main(void)
{
relpEngine_t *engine = NULL;
relpTcp_t *tcp = NULL;
SSL_CTX *ssl_ctx = NULL;
SSL *ssl = NULL;
BIO *bio = NULL;
int connection[2] = {-1, -1};
int replacement[2] = {-1, -1};
int rc = EXIT_FAILURE;
if(relpEngineConstruct(&engine) != RELP_RET_OK
|| relpEngineSetDbgprint(engine, discard_debug) != RELP_RET_OK
|| relpEngineSetTLSLibByName(engine, "openssl") != RELP_RET_OK
|| relpTcpConstruct(&tcp, engine, RELP_CLT_CONN, NULL) != RELP_RET_OK) {
fprintf(stderr, "failed to construct librelp test objects\n");
goto done;
}
if(socketpair(AF_UNIX, SOCK_STREAM, 0, replacement) != 0
|| socketpair(AF_UNIX, SOCK_STREAM, 0, connection) != 0) {
perror("socketpair");
goto done;
}
if(!SSL_library_init()) {
fprintf(stderr, "failed to initialize OpenSSL\n");
goto done;
}
ssl_ctx = SSL_CTX_new(SSLv23_method());
ssl = ssl_ctx == NULL ? NULL : SSL_new(ssl_ctx);
if(ssl == NULL) {
fprintf(stderr, "failed to construct OpenSSL test objects\n");
goto done;
}
tcp->sock = connection[0];
connection[0] = -1; /* tcp owns this descriptor from here on */
tcp->ssl = ssl;
ssl = NULL; /* tcp owns the SSL object from here on */
tcp->bTLSActive = 1;
tcp->sslState = osslClient;
bio = relpTcpNewSocketBio_ossl(tcp->sock);
if(bio == NULL) {
fprintf(stderr, "failed to construct OpenSSL socket BIO\n");
goto done;
}
SSL_set_bio(tcp->ssl, bio, bio);
SSL_set_connect_state(tcp->ssl);
SSL_set_shutdown(tcp->ssl, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);
watched_fd = tcp->sock;
replacement_fd = replacement[0];
#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
BIO_set_callback_ex(bio, reuse_closed_fd);
#else
BIO_set_callback(bio, reuse_closed_fd);
#endif
if(relpTcpDestruct(&tcp) != RELP_RET_OK) {
fprintf(stderr, "relpTcpDestruct failed\n");
goto done;
}
if(callback_error != 0) {
errno = callback_error;
perror("could not reuse manually closed descriptor");
goto done;
}
if(!replacement_installed) {
fprintf(stderr, "descriptor was not reusable before BIO destruction\n");
goto done;
}
errno = 0;
if(fcntl(watched_fd, F_GETFD) == -1 && errno == EBADF) {
fprintf(stderr, "SSL_free closed a descriptor reused after librelp's manual close\n");
goto done;
}
if(relpTcpConstruct(&tcp, engine, RELP_CLT_CONN, NULL) != RELP_RET_OK) {
fprintf(stderr, "failed to construct partial OpenSSL test object\n");
goto done;
}
tcp->ssl = SSL_new(ssl_ctx);
if(tcp->ssl == NULL || relpTcpDestruct(&tcp) != RELP_RET_OK) {
fprintf(stderr, "failed to destruct partial OpenSSL session\n");
goto done;
}
printf("replacement descriptor remained open after SSL destruction\n");
rc = EXIT_SUCCESS;
done:
if(tcp != NULL)
(void) relpTcpDestruct(&tcp);
SSL_free(ssl);
SSL_CTX_free(ssl_ctx);
if(engine != NULL)
(void) relpEngineDestruct(&engine);
close_if_open(watched_fd);
close_if_open(connection[0]);
close_if_open(connection[1]);
close_if_open(replacement[0]);
close_if_open(replacement[1]);
return rc;
}
#else
int
main(void)
{
return 77;
}
#endif
librelp-1.13.0/tests/tcp-accept-fd-reuse.sh 0000775 0001750 0001750 00000000042 15241030422 014131 #!/bin/bash
./tcp_accept_fd_reuse
librelp-1.13.0/tests/long-msg.sh 0000755 0001750 0001750 00000000313 13403223761 012130 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
startup_receiver
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" -d 131072
stop_receiver
check_output "testmessage"
terminate
librelp-1.13.0/tests/tls-ossl-connect-failure-vg.sh 0000775 0001750 0001750 00000002564 15241030422 015657 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
check_command_available valgrind
if [ "$VALGRIND" == "NO" ] ; then
echo "valgrind tests are not permitted by environment config"
exit 77
fi
if ! ./have_tlslib "openssl"; then
echo "OpenSSL support is not available"
exit 77
fi
export errorlog="error.$LIBRELP_DYN.log"
export TLSLIB="-l openssl"
export valgrind_log="$TESTDIR/valgrind.log"
export valgrind="$valgrind --leak-check=full --show-leak-kinds=definite --log-file=$valgrind_log"
startup_receiver -T -a "name" -x ${srcdir}/tls-certs/ossl-ca.pem \
-y ${srcdir}/tls-certs/ossl-server-cert.pem -z ${srcdir}/tls-certs/ossl-server-key.pem \
-P "client.testbench.rsyslog.com" -e $TESTDIR/$errorlog
${srcdir}/../libtool --mode=execute $valgrind ./send $TLSLIB -t 127.0.0.1 -p $TESTPORT \
-m "testmessage" -T -a "name" -x ${srcdir}/tls-certs/ca.pem \
-y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem \
-P "server.testbench.rsyslog.com" -e $TESTDIR/$errorlog $OPT_VERBOSE
sender_status=$?
stop_receiver
if [ $sender_status -ne 1 ]; then
echo "unexpected sender exit status $sender_status (expected authentication failure)"
exit 1
fi
if grep -q "SSL_new" $valgrind_log; then
echo "failed outbound TLS setup retained an SSL object"
cat $valgrind_log
exit 1
fi
check_output "authentication error.*signed certificate in certificate chain" $TESTDIR/$errorlog -z
terminate
librelp-1.13.0/tests/tls-basic-certvalid-mixed.sh 0000775 0001750 0001750 00000002203 14354536317 015361 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
# export OPT_VERBOSE=-v # uncomment for debugging
export errorlog="error.$LIBRELP_DYN.log"
if ! ./have_tlslib "gnutls"; then
echo 'Skipping test, missing supported for gnutls in this build'
exit;
fi
if ! ./have_tlslib "openssl"; then
echo 'Skipping test, missing supported for openssl in this build'
exit;
fi
startup_receiver -l openssl -T -a "certvalid" -e "${TESTDIR}/${errorlog}" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem
echo 'Send Message...'
./send -l gnutls -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "certvalid" -e "${TESTDIR}/${errorlog}" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem $OPT_VERBOSE 1>>${OUTFILE} 2>&1
stop_receiver
if test -f $TESTDIR/$errorlog; then
# Check for "handshake failed"
check_output --check-only "handshake failed" $TESTDIR/$errorlog
ret=$?
if [ $ret == 0 ]; then
echo "SKIP: Handshake failed, TLS Version most likely to old!"
exit 77
else
echo $TESTDIR/$errorlog
cat $TESTDIR/$errorlog
fi
fi
check_output "testmessage"
terminate
librelp-1.13.0/tests/tls-basic.sh 0000775 0001750 0001750 00000001065 14354536317 012307 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
function actual_test() {
startup_receiver -l $TEST_TLS_LIB -T -a "name" -x ${srcdir}/tls-certs/ca.pem \
-y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem \
-P 'testbench.rsyslog.com' -e error.out.log
./send -l $TEST_TLS_LIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "name" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P 'testbench.rsyslog.com' $OPT_VERBOSE
stop_receiver
check_output "testmessage"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/tls-wrong-permittedPeer.sh 0000775 0001750 0001750 00000001221 14354536317 015163 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
export TLSLIB="-l openssl"
startup_receiver -T -a "name" -x ${srcdir}/tls-certs/ca.pem \
-y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem \
-P "wrong name" -e $TESTDIR/$errorlog
echo 'Send Message...'
./send $TLSLIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "name" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P "wrong name" -e $TESTDIR/$errorlog $OPT_VERBOSE
stop_receiver
check_output "authentication error.*no permited name found.*testbench.rsyslog.com" $TESTDIR/$errorlog
terminate
librelp-1.13.0/tests/tls-certs/ 0000775 0001750 0001750 00000000000 15241057437 012062 5 librelp-1.13.0/tests/tls-certs/cert.pem 0000644 0001750 0001750 00000003567 13403223446 013444 -----BEGIN CERTIFICATE-----
MIIFVzCCA7+gAwIBAgIIWxfNMhQmuncwDQYJKoZIhvcNAQELBQAwgYsxEzARBgNV
BAMTCnJzeXNsb2cgY2ExEDAOBgNVBAsTB0FkaXNjb24xFTATBgNVBAoTDEFkaXNj
b24gR21iSDEYMBYGA1UEBxMPR3Jvc3NyaW5kZXJmZWxkMQswCQYDVQQIEwJCVzEL
MAkGA1UEBhMCREUxFzAVBgoJkiaJk/IsZAEZFgdyc3lzbG9nMCAXDTE4MDYwNjEy
MDE1NVoYDzIxMTgwNTEzMTIwMjAxWjCBmDEXMBUGA1UEAxMOcnN5c2xvZy1jbGll
bnQxFTATBgNVBAsTDEFkaXNjb24gR21iSDEVMBMGA1UEChMMQWRpc2NvbiBHbWJI
MRgwFgYDVQQHEw9Hcm9zc3JpbmRlcmZlbGQxCzAJBgNVBAgTAkJXMQswCQYDVQQG
EwJERTEbMBkGCgmSJomT8ixkARkWC3JzeXNsb2cuY29tMIIBojANBgkqhkiG9w0B
AQEFAAOCAY8AMIIBigKCAYEA8nNWVoZwi7fYKSYxm+lidTbMQEHh9pLXV8P1N2FD
wqhNc6Z71VqQw6gIDyzxBjZf3ldyPb6xAcxikvk2XCxVGqDaP7E1rfnCDSqxcgLG
r1/TlRH3fFMFPqzMgs0GbDoKi7WuhcNMH1yIRk4uPVSUY3IclcE9sNvMpNVY77c9
tYeLyoLgG8A2ljlSjbHXDmR8E1C+WcOvjFKQunpv29zIOvfp3Wuw0g3C6E26RyvY
OnNNq6bmDHXdyIkxYNPwxyfBDGq/WhnrFqQTyEqulVLVVIpK+3fIdtmH/4OpOwxz
KM0q2k9CzL+AI1JqlFoePeIKYQYAOssUBwB0VBDbhyo8f7txBs6OB1phPcmbkAo2
bJfL01UT315omqlGWjvvDRjDEeRAfXnWu/UVLIs1MNn09l2+fKwgZyOZIQEk5gGg
b+xO7pZp5W1IuLxB1DMatQjYK1L1MG8KUebovTyumAj8kOaCJaqa+EWcPvsH2wJb
zp7JZV7xAMnNQGLHHccY9Iv9AgMBAAGjga0wgaowDAYDVR0TAQH/BAIwADAnBgNV
HSUEIDAeBggrBgEFBQcDAgYIKwYBBQUHAwEGCCsGAQUFBwMRMCAGA1UdEQQZMBeC
FXRlc3RiZW5jaC5yc3lzbG9nLmNvbTAPBgNVHQ8BAf8EBQMDB6AAMB0GA1UdDgQW
BBTFQ9rF9eWMeqNtrDMOGb1fZ54EYTAfBgNVHSMEGDAWgBQMETadsJwFRGSslyZA
wChTI52OmjANBgkqhkiG9w0BAQsFAAOCAYEAG9hahjpm74U85pP7/zngEJ5P5nnM
3aC8u4lDM7kodtnxJWoisbv/EBr6SihpDtfWA6+bAJGGu+4UBUaMyUg8w/FjylHc
INtljbalRuu7YguL2uLdlDNCxQa1XkWugYMObR6r6OvTPUwK0QakTsZuibRbWBDz
lWKOoM7ZSxZi9DaeChe3yNSGxJSC9xHZbYYBOP5RjChXTZTKtYZemF2wx6EtWRtc
vXK3TbnJtDy7SPm60EoFnLXUyywmo5mCUSlx85HinS1DzYo7I1yksWQgdW4XgWId
9RgwPtP0iZSjrZ1TwKqcvo5jvn96LNCoob+JyhpL+9mFvPc6C3vLOxyG7JZOb7Dn
IpJf52KeBnLRUoIpp+x1XYptoy1ti7r8YqPYn5EHmPxCDVoujskRSX7ncP3SV1qY
eEgr94Tw/l8GyiaGyixVl2pAMbzYJtgrzQ9UvZurhSPjApGlm87X5KHHXN/CJTY5
8t59+qvjESRJk74JNpm1L6X/N7HpAsqcsYjP
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ossl-client-cert.pem 0000644 0001750 0001750 00000003203 13720663520 015664 -----BEGIN CERTIFICATE-----
MIIEoTCCAwmgAwIBAgIIXBeg0SlsiUswDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMCAXDTE4MTIxNzEzMTI1MFoYDzIxMTgxMTIzMTMxMjUzWjBY
MRcwFQYDVQQDEw5yc3lzbG9nIGNsaWVudDERMA8GA1UECxMIU29tZVVuaXQxEDAO
BgNVBAoTB1NvbWVPcmcxCzAJBgNVBAgTAkNBMQswCQYDVQQGEwJVUzCCAaIwDQYJ
KoZIhvcNAQEBBQADggGPADCCAYoCggGBAJ2R2tguPZ2uhcPFp/akZvjIkZG4cCDc
7egjylP3uFJD86fr+9+KOyywE/pi06FTpFFxH2jZ/bw5SvvJat/ziISwgLzA9RtC
EfZMGtgsYgtdUGQwmtPbwdV/OVPkvegeBJ3JEuDkVykpAbnx5bx0pudLYeZnXGxO
7u4iDBsUbegMb+7uw7jd3xXtepZbzIXl41DEziu/tjfmIPxuRX4JvYR6rwcn9Jkj
Qd822CkxoJaEL/1FLtS0+frcjyPA4AatrQpy2vQ7ocvWpjvsRsSV8nGlrQgf5wYY
DtuAUZa6JPZkAmvT8HYBNDpyAunL0KpiUQyPg77AR5nSknLtU6VJBdTJofRN3hKd
GsgXhPOifGdHgkuGHnOG4iYmEJSjmZsImXidPTNdhcJGZZSrcLQ7wSaLEbZmJ4gi
hAO1CEUyjIEjvmLcb6CqXp8D96f1A3A8eAnQhESMGa9295P8r8b929lMyyB5RHHL
5lVhqXqvC6Om7empEa/6o12sl+fvK7aoNwIDAQABo4GAMH4wDAYDVR0TAQH/BAIw
ADAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDwYDVR0PAQH/BAUDAweg
ADAdBgNVHQ4EFgQUlBeunSFXuHvBrhB7CKkhvKEUAIswHwYDVR0jBBgwFoAUsJ9n
MyyIiIkfRGJ0nSX/wAYTXdYwDQYJKoZIhvcNAQELBQADggGBAEk9KaiQ6NzNHf7M
kvPosgCu9Tm1jgRg4qjdMHxtzDxFQZWOtMuDxqqrNEC9FEF5zpEB8Z4VtubIeVK7
6i6BdSMbI5zlnlxffPD1Gz8AKXe9BNb6UlLvlEC+58D4CJmrxDuKZXaBzy3xh2TP
Al/s5XkPBuXKc7l0qQdDkt67LfDCrwpGfseOFXNUHDREBOulwX4LJzilVqLMsp03
qMHK0f4kOxc0oJrH+2+jCgpu1QPoFOLl/6shbRw3qls/f/coWnnS5kd2NOPUf0pe
j5lBt5ThhnLQIGwJucLa6cHVx+R4BWtTz4/v8hCwWr1cUbNEkxTyBErl0l8KkpCQ
d0NCuZe2u2AJYEKdNilSiBr33ERZ70peE/ATfk6hv9ysWepeGYJiuybWXMrDtLbw
X9wzwtdetIvvMxXiNAT5RpsZtFrdBD9ZwCHhJ+xjEycRDQKdnL/H4WbpAfvB9zcJ
WCJ50FBFjNoHSYrwmhQULOYa8AjVxxrX/27g2mN3P3sDLG6bzw==
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ca.pem 0000644 0001750 0001750 00000003365 13403223446 013066 -----BEGIN CERTIFICATE-----
MIIE9jCCA16gAwIBAgIIWxfM+RyuD1EwDQYJKoZIhvcNAQELBQAwgYsxEzARBgNV
BAMTCnJzeXNsb2cgY2ExEDAOBgNVBAsTB0FkaXNjb24xFTATBgNVBAoTDEFkaXNj
b24gR21iSDEYMBYGA1UEBxMPR3Jvc3NyaW5kZXJmZWxkMQswCQYDVQQIEwJCVzEL
MAkGA1UEBhMCREUxFzAVBgoJkiaJk/IsZAEZFgdyc3lzbG9nMCAXDTE4MDYwNjEy
MDA1OFoYDzIxMTgwNTEzMTIwMTA1WjCBizETMBEGA1UEAxMKcnN5c2xvZyBjYTEQ
MA4GA1UECxMHQWRpc2NvbjEVMBMGA1UEChMMQWRpc2NvbiBHbWJIMRgwFgYDVQQH
Ew9Hcm9zc3JpbmRlcmZlbGQxCzAJBgNVBAgTAkJXMQswCQYDVQQGEwJERTEXMBUG
CgmSJomT8ixkARkWB3JzeXNsb2cwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGK
AoIBgQDHA1CeNI30en7OKGJ/pWyNSH9rnw8z6egDxdTjtOIichA2/LVPaGZYecI0
GH/UtkRgM69kFuo6dRaWvr0yp+XPfGlAcFcPg6cYKEoYyb18HsTReyuAcdBcYQYg
2ZdmAqtqeHAqcb7wSEB8XuXLdD2Flsco3GaT3zFNv7t7QFDW1b2tT/92w+QGtI1T
r5LCMVbISRGSQzhCv29l3UtWt4SKA9W8yhg5zMJkMExaUJVtViRFlAFzKrUVKFqZ
8sszy2yXIcTLskJJc5if8o5cpWCrbcXSb5TsHA+4FHOB6ou0z7/s3LwYjof056Zy
ixj0LM4sTYIEttDuLERRvYTIhtLhlA2BWfAfuW9bGuog0C9xGpt99vniHJlKmMms
qz5hEDLYziUEfj5qzSxKMcA2VCeO1DgajSedh13VN/sWUyk5aKA71i40Cnp4oK/u
zeYW7vWl/ttCEFc6x8pzeMdoBjv1Jd9hC0Z2UgttC/KnMTKX3y6NR1PVFjDQ3MIA
7Bhxj50CAwEAAaNaMFgwDwYDVR0TAQH/BAUwAwEB/zAVBgNVHREEDjAMggpyc3lz
bG9nIGNhMA8GA1UdDwEB/wQFAwMHBAAwHQYDVR0OBBYEFAwRNp2wnAVEZKyXJkDA
KFMjnY6aMA0GCSqGSIb3DQEBCwUAA4IBgQCOv2kyg8vZ3jncZuZ4i2k0QbXztZoO
jMDNqFX2935lK6WrVZ6u1InZzsaqrXXOJions3EvmmAqrdTBW6dyw6V2/lic1gGz
MhlafAPe0DyQCaXp9iFCH91Hzo94YhuPbne1qdga9jrVTiQIHdIKqVtbiUv7i7mN
43GssOm4a1guf+Qs5rkuHG4YwiJZhjzhmixfXCerHXykJkpSvBUb6EeKA+p5/w+I
Wjm9sAkJgqcvrNvOwwBZInU1I56zmM0ZwWucSydf0hgOImpgO5F6KGVQRoZsO9IA
Iju2RQ1y9qVTNp8evVjIMuqXh5ZtU9ti/buZrjr5Zb601jFLZCMrpDVUcVyHUfOB
rb3nkUFDcFcrKlfovwp/fvlISKM0bp6pFas5X0FXg3sVVI+iIokmHsmqRUHhjdLX
t27+/TYpyEkjF1cH3acd7MOcw33KxE/4+qUHT2QU9COPkGu7oPS24qDYnmGPLkev
ZSmpz4jLTmbCBSRcoOB0Q4K36WnegzVtvd8=
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ossl-clientbrok-cert.pem 0000644 0001750 0001750 00000002771 13720663520 016553 -----BEGIN CERTIFICATE-----
MIIEPTCCAqWgAwIBAgIIXBEoYTa7GecwDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMB4XDTE4MTIxMjE1MjUyMloXDTE4MTIxMzE1MjUyM1owdjEL
MAkGA1UEAxMCVVMxEDAOBgNVBAsTB1NvbWVPcmgxDzANBgNVBAoTBlNvbWVPVTES
MBAGA1UEBxMJU29tZXdoZXJlMQswCQYDVQQGEwJDQTEjMCEGCgmSJomT8ixkARkW
E21hY2hpbmUuZXhhbXBsZS5uZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQC24qsJF2yax7Ja4xsPQ7lDtkEMx3ni6k0xh7VrzZiRFpegdz1CVerV8bAs
voTzn1aTWE1lELRO7i4QTAU2sn/kyB34oNuQWd8R1D7J3FJsIE36RM15XmcQ4biX
H6m9Kx5uEAfdHVSPLgwuQlQM6IshmxV5AS+QrqLK7scZCFpBEb379G4JeJJGdkXR
p7VYXUo079YSA60TqhWH01dlJdvRmY6sBpYahAOag3f3d7L8eYd9Jv3S6pHxzf/5
/TqMbYr7m4iPH+cXg/sDNMll66rax9Ei2dk/Za1GKQ1AUvlfto0qKaRg/2FUKhqP
DGV5uJDbYxlZjD+2s8HSrlSPS70FAgMBAAGjgYAwfjAMBgNVHRMBAf8EAjAAMB0G
A1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAPBgNVHQ8BAf8EBQMDB6AAMB0G
A1UdDgQWBBTKFNJvJb22tIrAxnqkVRDvFqukcTAfBgNVHSMEGDAWgBSwn2czLIiI
iR9EYnSdJf/ABhNd1jANBgkqhkiG9w0BAQsFAAOCAYEAXV+3oTx+/LEL8yHUbRS2
wQ+kuXuuGJT4nkOFD+m5vNWtM1jGoj1trV/MxC697JlKB4wmBebKvIXcdKTVy2CB
MqPoKTHSJ4vqfAWYAP9i0nNrxcvi0mHVxlRqPnizPLUkcPCYvnPtnSOCELmWk0mC
i9K2QUy9e9HulRayaVU8KdPwopy6aJJQyl981T/h/m+q0FcKOIC27nn0VW0ZGHtl
1PnUTVOP479HNhMg6zmPKxV0Y/WVQDB0Cpok3uuo0V1I9BuQk7Rn6DQqSnNI7/vH
Ot/5fPEk/SU4OitCH7yV8XnkrPfAhpPrsUrVUd54PQg/KZu9qVTfMAM+j55aDCs7
HlfrkSB+Jv4YOdlgrSMnstG45WIAYGD32sCPog5F9mJl6BFREcgscQ1BF7Tr/LX2
d8PaePwRfdHuRDsY4Ydq+F89cP23QNIlxf9r8ODe13v1mfCXpzxksZ8zhxEzPm46
efGuPdwdb+u6ZRiOqoaAavV9raKCEX5CrvqKeDnZ66WA
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/certchain.pem 0000644 0001750 0001750 00000007154 13720663520 014446 -----BEGIN CERTIFICATE-----
MIIFVzCCA7+gAwIBAgIIWxfNMhQmuncwDQYJKoZIhvcNAQELBQAwgYsxEzARBgNV
BAMTCnJzeXNsb2cgY2ExEDAOBgNVBAsTB0FkaXNjb24xFTATBgNVBAoTDEFkaXNj
b24gR21iSDEYMBYGA1UEBxMPR3Jvc3NyaW5kZXJmZWxkMQswCQYDVQQIEwJCVzEL
MAkGA1UEBhMCREUxFzAVBgoJkiaJk/IsZAEZFgdyc3lzbG9nMCAXDTE4MDYwNjEy
MDE1NVoYDzIxMTgwNTEzMTIwMjAxWjCBmDEXMBUGA1UEAxMOcnN5c2xvZy1jbGll
bnQxFTATBgNVBAsTDEFkaXNjb24gR21iSDEVMBMGA1UEChMMQWRpc2NvbiBHbWJI
MRgwFgYDVQQHEw9Hcm9zc3JpbmRlcmZlbGQxCzAJBgNVBAgTAkJXMQswCQYDVQQG
EwJERTEbMBkGCgmSJomT8ixkARkWC3JzeXNsb2cuY29tMIIBojANBgkqhkiG9w0B
AQEFAAOCAY8AMIIBigKCAYEA8nNWVoZwi7fYKSYxm+lidTbMQEHh9pLXV8P1N2FD
wqhNc6Z71VqQw6gIDyzxBjZf3ldyPb6xAcxikvk2XCxVGqDaP7E1rfnCDSqxcgLG
r1/TlRH3fFMFPqzMgs0GbDoKi7WuhcNMH1yIRk4uPVSUY3IclcE9sNvMpNVY77c9
tYeLyoLgG8A2ljlSjbHXDmR8E1C+WcOvjFKQunpv29zIOvfp3Wuw0g3C6E26RyvY
OnNNq6bmDHXdyIkxYNPwxyfBDGq/WhnrFqQTyEqulVLVVIpK+3fIdtmH/4OpOwxz
KM0q2k9CzL+AI1JqlFoePeIKYQYAOssUBwB0VBDbhyo8f7txBs6OB1phPcmbkAo2
bJfL01UT315omqlGWjvvDRjDEeRAfXnWu/UVLIs1MNn09l2+fKwgZyOZIQEk5gGg
b+xO7pZp5W1IuLxB1DMatQjYK1L1MG8KUebovTyumAj8kOaCJaqa+EWcPvsH2wJb
zp7JZV7xAMnNQGLHHccY9Iv9AgMBAAGjga0wgaowDAYDVR0TAQH/BAIwADAnBgNV
HSUEIDAeBggrBgEFBQcDAgYIKwYBBQUHAwEGCCsGAQUFBwMRMCAGA1UdEQQZMBeC
FXRlc3RiZW5jaC5yc3lzbG9nLmNvbTAPBgNVHQ8BAf8EBQMDB6AAMB0GA1UdDgQW
BBTFQ9rF9eWMeqNtrDMOGb1fZ54EYTAfBgNVHSMEGDAWgBQMETadsJwFRGSslyZA
wChTI52OmjANBgkqhkiG9w0BAQsFAAOCAYEAG9hahjpm74U85pP7/zngEJ5P5nnM
3aC8u4lDM7kodtnxJWoisbv/EBr6SihpDtfWA6+bAJGGu+4UBUaMyUg8w/FjylHc
INtljbalRuu7YguL2uLdlDNCxQa1XkWugYMObR6r6OvTPUwK0QakTsZuibRbWBDz
lWKOoM7ZSxZi9DaeChe3yNSGxJSC9xHZbYYBOP5RjChXTZTKtYZemF2wx6EtWRtc
vXK3TbnJtDy7SPm60EoFnLXUyywmo5mCUSlx85HinS1DzYo7I1yksWQgdW4XgWId
9RgwPtP0iZSjrZ1TwKqcvo5jvn96LNCoob+JyhpL+9mFvPc6C3vLOxyG7JZOb7Dn
IpJf52KeBnLRUoIpp+x1XYptoy1ti7r8YqPYn5EHmPxCDVoujskRSX7ncP3SV1qY
eEgr94Tw/l8GyiaGyixVl2pAMbzYJtgrzQ9UvZurhSPjApGlm87X5KHHXN/CJTY5
8t59+qvjESRJk74JNpm1L6X/N7HpAsqcsYjP
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIE9jCCA16gAwIBAgIIWxfM+RyuD1EwDQYJKoZIhvcNAQELBQAwgYsxEzARBgNV
BAMTCnJzeXNsb2cgY2ExEDAOBgNVBAsTB0FkaXNjb24xFTATBgNVBAoTDEFkaXNj
b24gR21iSDEYMBYGA1UEBxMPR3Jvc3NyaW5kZXJmZWxkMQswCQYDVQQIEwJCVzEL
MAkGA1UEBhMCREUxFzAVBgoJkiaJk/IsZAEZFgdyc3lzbG9nMCAXDTE4MDYwNjEy
MDA1OFoYDzIxMTgwNTEzMTIwMTA1WjCBizETMBEGA1UEAxMKcnN5c2xvZyBjYTEQ
MA4GA1UECxMHQWRpc2NvbjEVMBMGA1UEChMMQWRpc2NvbiBHbWJIMRgwFgYDVQQH
Ew9Hcm9zc3JpbmRlcmZlbGQxCzAJBgNVBAgTAkJXMQswCQYDVQQGEwJERTEXMBUG
CgmSJomT8ixkARkWB3JzeXNsb2cwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGK
AoIBgQDHA1CeNI30en7OKGJ/pWyNSH9rnw8z6egDxdTjtOIichA2/LVPaGZYecI0
GH/UtkRgM69kFuo6dRaWvr0yp+XPfGlAcFcPg6cYKEoYyb18HsTReyuAcdBcYQYg
2ZdmAqtqeHAqcb7wSEB8XuXLdD2Flsco3GaT3zFNv7t7QFDW1b2tT/92w+QGtI1T
r5LCMVbISRGSQzhCv29l3UtWt4SKA9W8yhg5zMJkMExaUJVtViRFlAFzKrUVKFqZ
8sszy2yXIcTLskJJc5if8o5cpWCrbcXSb5TsHA+4FHOB6ou0z7/s3LwYjof056Zy
ixj0LM4sTYIEttDuLERRvYTIhtLhlA2BWfAfuW9bGuog0C9xGpt99vniHJlKmMms
qz5hEDLYziUEfj5qzSxKMcA2VCeO1DgajSedh13VN/sWUyk5aKA71i40Cnp4oK/u
zeYW7vWl/ttCEFc6x8pzeMdoBjv1Jd9hC0Z2UgttC/KnMTKX3y6NR1PVFjDQ3MIA
7Bhxj50CAwEAAaNaMFgwDwYDVR0TAQH/BAUwAwEB/zAVBgNVHREEDjAMggpyc3lz
bG9nIGNhMA8GA1UdDwEB/wQFAwMHBAAwHQYDVR0OBBYEFAwRNp2wnAVEZKyXJkDA
KFMjnY6aMA0GCSqGSIb3DQEBCwUAA4IBgQCOv2kyg8vZ3jncZuZ4i2k0QbXztZoO
jMDNqFX2935lK6WrVZ6u1InZzsaqrXXOJions3EvmmAqrdTBW6dyw6V2/lic1gGz
MhlafAPe0DyQCaXp9iFCH91Hzo94YhuPbne1qdga9jrVTiQIHdIKqVtbiUv7i7mN
43GssOm4a1guf+Qs5rkuHG4YwiJZhjzhmixfXCerHXykJkpSvBUb6EeKA+p5/w+I
Wjm9sAkJgqcvrNvOwwBZInU1I56zmM0ZwWucSydf0hgOImpgO5F6KGVQRoZsO9IA
Iju2RQ1y9qVTNp8evVjIMuqXh5ZtU9ti/buZrjr5Zb601jFLZCMrpDVUcVyHUfOB
rb3nkUFDcFcrKlfovwp/fvlISKM0bp6pFas5X0FXg3sVVI+iIokmHsmqRUHhjdLX
t27+/TYpyEkjF1cH3acd7MOcw33KxE/4+qUHT2QU9COPkGu7oPS24qDYnmGPLkev
ZSmpz4jLTmbCBSRcoOB0Q4K36WnegzVtvd8=
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ossl-clientbrok-key.pem 0000644 0001750 0001750 00000012771 13720663520 016407 Public Key Info:
Public Key Algorithm: RSA
Key Security Level: Medium (2048 bits)
modulus:
00:b6:e2:ab:09:17:6c:9a:c7:b2:5a:e3:1b:0f:43:b9
43:b6:41:0c:c7:79:e2:ea:4d:31:87:b5:6b:cd:98:91
16:97:a0:77:3d:42:55:ea:d5:f1:b0:2c:be:84:f3:9f
56:93:58:4d:65:10:b4:4e:ee:2e:10:4c:05:36:b2:7f
e4:c8:1d:f8:a0:db:90:59:df:11:d4:3e:c9:dc:52:6c
20:4d:fa:44:cd:79:5e:67:10:e1:b8:97:1f:a9:bd:2b
1e:6e:10:07:dd:1d:54:8f:2e:0c:2e:42:54:0c:e8:8b
21:9b:15:79:01:2f:90:ae:a2:ca:ee:c7:19:08:5a:41
11:bd:fb:f4:6e:09:78:92:46:76:45:d1:a7:b5:58:5d
4a:34:ef:d6:12:03:ad:13:aa:15:87:d3:57:65:25:db
d1:99:8e:ac:06:96:1a:84:03:9a:83:77:f7:77:b2:fc
79:87:7d:26:fd:d2:ea:91:f1:cd:ff:f9:fd:3a:8c:6d
8a:fb:9b:88:8f:1f:e7:17:83:fb:03:34:c9:65:eb:aa
da:c7:d1:22:d9:d9:3f:65:ad:46:29:0d:40:52:f9:5f
b6:8d:2a:29:a4:60:ff:61:54:2a:1a:8f:0c:65:79:b8
90:db:63:19:59:8c:3f:b6:b3:c1:d2:ae:54:8f:4b:bd
05:
public exponent:
01:00:01:
private exponent:
43:a8:45:67:fe:9f:71:ff:50:af:28:f7:58:c5:50:23
89:a8:35:07:12:c3:6c:b4:94:0f:45:81:95:34:cc:f0
13:b6:0c:86:c0:24:b2:d4:e5:2d:ac:cf:ea:b5:8a:0b
e8:44:b1:95:23:01:e1:75:61:db:2b:94:7e:30:b8:f9
b5:42:c9:39:11:21:2c:ee:46:55:43:c9:3f:d5:ca:24
85:54:81:e1:95:f5:e3:a1:2e:30:30:d0:48:e6:2f:ae
79:3f:3a:f9:85:21:44:3a:df:cc:b9:43:08:e7:7a:99
3b:1b:4d:81:af:cc:11:9f:2d:fd:f9:ef:fb:d4:0f:df
d4:fe:65:70:c9:d2:3c:08:7b:ad:d5:34:af:c6:13:cf
15:b5:82:31:02:52:d2:73:a9:e5:d1:5f:67:c1:a5:72
e1:e4:4f:14:c6:fb:70:db:b8:43:ba:25:ea:4a:57:d6
30:ec:e4:c0:8c:24:c5:83:d7:68:9b:96:e1:7c:57:1f
4c:2f:e3:76:9b:bb:b8:e6:86:52:87:fe:d2:a3:b3:bd
30:c0:0e:f6:d2:fe:6d:e9:5b:24:5c:f4:b8:ba:da:d4
47:eb:d5:30:da:3b:1d:03:1f:ad:49:a2:05:34:f0:a1
a8:a2:08:e2:ed:ba:03:1c:60:4a:ea:fa:08:4c:88:5d
prime1:
00:ca:bc:76:2f:11:58:28:51:bf:a2:a0:23:43:b3:25
1a:56:2c:2e:56:05:24:a7:4b:e0:75:d3:ba:e7:31:20
2b:a2:fc:91:13:6b:b6:5b:c6:21:71:2d:6d:aa:d7:1f
b8:d9:86:ea:00:49:19:e7:d0:c1:2e:43:50:83:fd:b9
a3:1d:51:c7:ee:45:0b:a9:c0:26:70:da:a6:3b:ea:d8
2f:dc:98:ce:f7:95:84:24:a3:d8:54:57:90:64:63:f3
f7:9f:75:02:d8:c7:4e:9f:7d:60:f3:dc:b1:83:bc:42
08:ae:5f:ac:94:b1:74:bf:57:fc:96:0a:44:14:7b:f5
d3:
prime2:
00:e6:ef:17:e0:2d:ef:36:07:c3:c2:42:44:d0:fb:e6
d6:f5:7d:c4:5d:54:17:e0:ec:1d:6c:84:52:cf:90:a4
aa:a5:d0:7c:c6:e6:f0:56:aa:73:27:5c:c1:91:4d:d5
60:7d:9c:a3:96:1a:cb:b1:e7:8e:cb:53:52:2e:35:53
74:46:e9:ff:67:fb:93:5b:94:78:b0:0f:b9:a7:2f:08
fe:84:d3:f5:3e:f0:b7:02:a8:41:4e:9c:65:d7:f8:95
7e:82:ef:5f:3c:60:12:2e:6f:3f:a8:df:b3:bf:3b:ed
ac:07:ef:0f:d7:35:c7:81:30:a2:18:05:14:72:6c:02
c7:
coefficient:
60:35:5f:cb:5b:40:75:b3:57:b8:61:d8:5a:40:c1:91
01:3a:c1:17:35:94:4b:81:06:e9:75:56:8c:97:e3:bb
5a:7d:f5:f1:ac:f8:6f:d0:a2:6c:89:a4:8a:0d:23:78
8a:92:b6:3f:7c:42:00:65:c8:d7:b4:77:19:fd:2f:75
e8:99:c4:60:c5:48:f5:74:4d:09:63:a2:b5:cd:01:0e
70:8d:69:03:f0:58:e6:7c:47:93:40:f3:53:9f:d5:97
3a:13:2e:10:aa:17:77:74:67:82:2a:20:5b:fa:96:51
cf:58:c8:a4:c4:58:f4:5a:88:42:49:4a:ad:5c:6e:00
exp1:
57:8a:b7:91:ad:70:9e:c0:65:fa:88:21:92:1b:2a:1b
4c:38:79:ad:a5:3c:e5:8c:8b:18:f5:db:4f:f7:53:87
e4:32:21:46:fc:8c:da:e6:1c:0c:ad:ec:1c:08:16:67
90:6e:84:5e:a9:32:29:7a:67:e0:5d:2a:c8:43:e8:43
f9:e6:15:69:da:a0:a5:a5:16:34:47:05:de:fb:92:6c
60:5a:0f:8c:b3:20:43:5e:08:8c:aa:de:eb:aa:89:6f
54:88:87:39:2a:1e:d6:19:a2:a2:ca:9a:50:63:1b:34
7a:6f:4f:ab:49:51:3b:4a:78:04:25:dc:ad:e7:b5:07
exp2:
19:ee:59:10:fc:37:73:2a:b6:09:97:25:61:0e:18:22
a5:18:45:37:71:9c:e8:cd:ba:94:17:db:b0:a0:fe:4c
87:27:fd:0a:dc:9d:ba:2d:93:96:a4:ec:bb:63:31:05
8f:b5:4a:0d:2d:df:17:8f:f7:d1:ce:fe:58:5f:f6:8a
04:f8:7b:8c:72:8c:5e:69:32:90:1a:83:ef:48:f1:ca
9a:a1:ae:55:2d:f4:6e:e0:f3:cc:5e:f5:74:a5:de:2b
81:8a:5d:78:4b:15:5f:8f:70:67:87:0f:08:f7:32:bd
f1:7a:1f:9e:3b:d4:b6:25:fe:dd:91:9c:75:28:b9:bb
Public Key PIN:
pin-sha256:ixzIAak4pRfFjtaG95FtWd+Iu8vB5m6nknYP5EGaAqg=
Public Key ID:
sha256:8b1cc801a938a517c58ed686f7916d59df88bbcbc1e66ea792760fe4419a02a8
sha1:ca14d26f25bdb6b48ac0c67aa45510ef16aba471
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAtuKrCRdsmseyWuMbD0O5Q7ZBDMd54upNMYe1a82YkRaXoHc9
QlXq1fGwLL6E859Wk1hNZRC0Tu4uEEwFNrJ/5Mgd+KDbkFnfEdQ+ydxSbCBN+kTN
eV5nEOG4lx+pvSsebhAH3R1Ujy4MLkJUDOiLIZsVeQEvkK6iyu7HGQhaQRG9+/Ru
CXiSRnZF0ae1WF1KNO/WEgOtE6oVh9NXZSXb0ZmOrAaWGoQDmoN393ey/HmHfSb9
0uqR8c3/+f06jG2K+5uIjx/nF4P7AzTJZeuq2sfRItnZP2WtRikNQFL5X7aNKimk
YP9hVCoajwxlebiQ22MZWYw/trPB0q5Uj0u9BQIDAQABAoIBAEOoRWf+n3H/UK8o
91jFUCOJqDUHEsNstJQPRYGVNMzwE7YMhsAkstTlLazP6rWKC+hEsZUjAeF1Ydsr
lH4wuPm1Qsk5ESEs7kZVQ8k/1cokhVSB4ZX146EuMDDQSOYvrnk/OvmFIUQ638y5
Qwjnepk7G02Br8wRny39+e/71A/f1P5lcMnSPAh7rdU0r8YTzxW1gjECUtJzqeXR
X2fBpXLh5E8Uxvtw27hDuiXqSlfWMOzkwIwkxYPXaJuW4XxXH0wv43abu7jmhlKH
/tKjs70wwA720v5t6VskXPS4utrUR+vVMNo7HQMfrUmiBTTwoaiiCOLtugMcYErq
+ghMiF0CgYEAyrx2LxFYKFG/oqAjQ7MlGlYsLlYFJKdL4HXTuucxICui/JETa7Zb
xiFxLW2q1x+42YbqAEkZ59DBLkNQg/25ox1Rx+5FC6nAJnDapjvq2C/cmM73lYQk
o9hUV5BkY/P3n3UC2MdOn31g89yxg7xCCK5frJSxdL9X/JYKRBR79dMCgYEA5u8X
4C3vNgfDwkJE0Pvm1vV9xF1UF+DsHWyEUs+QpKql0HzG5vBWqnMnXMGRTdVgfZyj
lhrLseeOy1NSLjVTdEbp/2f7k1uUeLAPuacvCP6E0/U+8LcCqEFOnGXX+JV+gu9f
PGASLm8/qN+zvzvtrAfvD9c1x4EwohgFFHJsAscCgYBXireRrXCewGX6iCGSGyob
TDh5raU85YyLGPXbT/dTh+QyIUb8jNrmHAyt7BwIFmeQboReqTIpemfgXSrIQ+hD
+eYVadqgpaUWNEcF3vuSbGBaD4yzIENeCIyq3uuqiW9UiIc5Kh7WGaKiyppQYxs0
em9Pq0lRO0p4BCXcree1BwKBgBnuWRD8N3MqtgmXJWEOGCKlGEU3cZzozbqUF9uw
oP5Mhyf9Ctydui2TlqTsu2MxBY+1Sg0t3xeP99HO/lhf9ooE+HuMcoxeaTKQGoPv
SPHKmqGuVS30buDzzF71dKXeK4GKXXhLFV+PcGeHDwj3Mr3xeh+eO9S2Jf7dkZx1
KLm7AoGAYDVfy1tAdbNXuGHYWkDBkQE6wRc1lEuBBul1VoyX47taffXxrPhv0KJs
iaSKDSN4ipK2P3xCAGXI17R3Gf0vdeiZxGDFSPV0TQljorXNAQ5wjWkD8FjmfEeT
QPNTn9WXOhMuEKoXd3RngiogW/qWUc9YyKTEWPRaiEJJSq1cbgA=
-----END RSA PRIVATE KEY-----
librelp-1.13.0/tests/tls-certs/ossl-client-key.pem 0000644 0001750 0001750 00000017764 13720663520 015540 Public Key Info:
Public Key Algorithm: RSA
Key Security Level: High (3072 bits)
modulus:
00:9d:91:da:d8:2e:3d:9d:ae:85:c3:c5:a7:f6:a4:66
f8:c8:91:91:b8:70:20:dc:ed:e8:23:ca:53:f7:b8:52
43:f3:a7:eb:fb:df:8a:3b:2c:b0:13:fa:62:d3:a1:53
a4:51:71:1f:68:d9:fd:bc:39:4a:fb:c9:6a:df:f3:88
84:b0:80:bc:c0:f5:1b:42:11:f6:4c:1a:d8:2c:62:0b
5d:50:64:30:9a:d3:db:c1:d5:7f:39:53:e4:bd:e8:1e
04:9d:c9:12:e0:e4:57:29:29:01:b9:f1:e5:bc:74:a6
e7:4b:61:e6:67:5c:6c:4e:ee:ee:22:0c:1b:14:6d:e8
0c:6f:ee:ee:c3:b8:dd:df:15:ed:7a:96:5b:cc:85:e5
e3:50:c4:ce:2b:bf:b6:37:e6:20:fc:6e:45:7e:09:bd
84:7a:af:07:27:f4:99:23:41:df:36:d8:29:31:a0:96
84:2f:fd:45:2e:d4:b4:f9:fa:dc:8f:23:c0:e0:06:ad
ad:0a:72:da:f4:3b:a1:cb:d6:a6:3b:ec:46:c4:95:f2
71:a5:ad:08:1f:e7:06:18:0e:db:80:51:96:ba:24:f6
64:02:6b:d3:f0:76:01:34:3a:72:02:e9:cb:d0:aa:62
51:0c:8f:83:be:c0:47:99:d2:92:72:ed:53:a5:49:05
d4:c9:a1:f4:4d:de:12:9d:1a:c8:17:84:f3:a2:7c:67
47:82:4b:86:1e:73:86:e2:26:26:10:94:a3:99:9b:08
99:78:9d:3d:33:5d:85:c2:46:65:94:ab:70:b4:3b:c1
26:8b:11:b6:66:27:88:22:84:03:b5:08:45:32:8c:81
23:be:62:dc:6f:a0:aa:5e:9f:03:f7:a7:f5:03:70:3c
78:09:d0:84:44:8c:19:af:76:f7:93:fc:af:c6:fd:db
d9:4c:cb:20:79:44:71:cb:e6:55:61:a9:7a:af:0b:a3
a6:ed:e9:a9:11:af:fa:a3:5d:ac:97:e7:ef:2b:b6:a8
37:
public exponent:
01:00:01:
private exponent:
60:cd:c5:dc:80:74:1c:56:a7:19:82:6a:51:6d:e9:51
38:af:ae:0d:d8:dd:67:bd:c5:9b:8f:67:0c:ce:b1:c3
cb:82:c3:c9:27:29:9e:77:32:e9:e3:2f:2a:03:78:06
80:7e:76:24:8d:a0:84:2d:d2:b2:63:a9:04:53:72:f0
ca:1b:1d:5b:92:7a:1f:9a:37:6d:c4:24:41:08:2f:21
32:0d:8b:8a:e3:53:a4:7f:0c:bd:64:9c:28:4b:dd:7d
4a:8e:c8:c9:5f:9f:68:cb:27:a3:5c:48:9f:02:2f:b3
f3:ac:fe:c7:4b:91:c2:e0:a9:6e:43:6f:b3:9a:5e:30
9d:e7:f5:ca:4a:de:0c:7b:45:3d:c5:f8:39:eb:9d:33
8d:60:8b:a5:77:0f:74:c2:2e:4b:c7:57:6c:3a:81:b3
4d:48:10:a6:6c:70:54:a7:d8:81:b2:45:84:96:bb:42
14:d5:8d:d6:5a:99:a0:e6:8c:f0:67:af:cc:32:6e:29
e5:4d:73:ec:4b:14:2e:a6:91:27:9e:d4:45:62:52:33
66:94:c8:29:29:4d:bd:62:7b:f7:67:ed:26:02:33:f4
70:79:43:ff:ec:0f:92:80:b2:a4:f0:a2:91:00:f9:0e
51:22:53:f5:51:e2:97:e8:18:be:36:34:d2:c8:cd:0e
3c:66:8e:2c:a8:4f:46:66:5e:01:4f:1e:03:6e:e0:63
d4:15:f5:28:59:e4:e0:47:df:57:20:d0:39:09:d8:65
1c:3d:c9:2f:69:77:5c:4c:4f:90:ea:07:fc:51:0c:2b
0c:f9:85:06:f8:08:04:37:86:45:ee:58:c9:4c:2b:ba
00:bf:c2:a0:92:f7:c2:31:82:43:52:0f:63:4d:96:82
1c:60:70:63:ac:72:db:ea:b8:4a:b3:a7:15:7a:c4:71
4a:dd:7e:8b:40:b7:b1:78:7f:14:60:d1:89:cf:6a:41
58:b5:cf:80:58:63:ad:fe:1f:15:bb:b2:10:db:07:41
prime1:
00:d0:04:9a:29:56:25:fd:9b:53:c0:a0:2f:ee:a8:49
b0:a3:f4:33:a7:f3:29:5f:63:2c:05:5e:75:16:b4:62
2a:64:ea:e0:a6:64:aa:ce:aa:49:9d:10:1b:e5:56:c5
60:a9:54:87:3b:f7:55:49:c0:58:65:fd:32:73:b3:e7
79:ad:d4:49:27:b3:bd:0f:00:11:60:6a:c1:98:3b:71
c7:83:7c:59:a6:61:c5:29:da:4d:8a:e5:be:a7:76:71
ce:0d:2d:99:07:80:ac:df:42:29:6d:19:93:f2:5f:6d
27:6d:31:db:2c:6a:38:ab:3e:39:db:5d:d6:b8:b7:34
eb:0b:9c:a7:7f:9d:52:75:4a:53:25:de:df:0f:64:18
01:8b:b5:20:c3:7d:52:b3:1f:b8:95:0f:18:b3:ca:50
5e:89:b7:ae:61:40:24:74:84:29:e1:9d:34:94:aa:f1
f2:d4:d8:ce:73:cd:ee:c1:c7:80:f1:75:60:2f:c8:6e
21:
prime2:
00:c1:ea:4c:cf:a8:a0:55:cb:e0:82:81:ec:ba:f7:41
a0:33:27:e2:42:85:8f:94:51:c5:a2:07:23:19:ea:87
87:af:4e:fc:11:9c:e8:d0:e6:83:8d:1d:e5:09:b3:e0
30:13:92:23:37:27:bc:2c:90:09:e0:ff:31:27:1e:8a
0c:fe:ca:d2:a1:d2:a4:74:ae:21:db:f7:63:7f:38:44
b9:97:59:9f:31:bf:55:80:97:fe:72:e6:6c:b0:1b:35
3c:18:76:5a:53:75:16:da:f1:97:f7:29:39:e5:70:df
1c:fc:91:0b:e8:3a:20:d3:b4:61:3a:c8:81:f2:6c:49
1f:ba:07:cb:a8:0c:17:15:0f:8f:be:c7:5e:f3:0e:42
cb:1a:11:ec:3e:25:25:fc:ce:c0:dd:99:49:c7:10:1a
d1:7c:5f:ca:d2:f3:d2:6f:ad:4b:7b:92:8a:55:ce:dc
b7:dc:b8:1e:1e:e5:d7:93:85:9e:a0:58:53:6e:03:db
57:
coefficient:
00:ce:59:bc:fc:f2:13:ba:d7:78:e2:d3:ec:10:28:ff
9c:af:d1:8d:a0:d8:f3:ed:62:8d:15:b0:69:80:e8:ba
8f:bc:34:ce:36:35:a1:16:18:f2:46:0f:64:a4:d6:3b
5a:0c:0c:a0:2e:bf:c6:f2:75:1d:83:93:be:5c:14:8c
02:32:84:7e:24:ea:7b:d3:52:74:1c:63:75:00:c1:04
44:bf:76:e3:67:34:ce:fe:e5:c3:7c:f1:59:c3:48:4b
2f:b2:24:60:0c:7e:e1:f7:b1:af:f5:07:ed:81:08:ac
4c:e0:d3:98:c3:fb:20:24:5d:88:6c:2e:dd:4b:b9:9d
ef:56:76:42:83:22:95:e2:23:e4:5a:b5:08:f7:02:e5
b5:69:99:da:be:5f:1a:24:49:b4:5d:37:22:39:f6:23
ed:66:40:de:50:9e:f4:6d:38:41:75:46:14:a3:35:51
2e:5e:84:db:1d:94:8c:df:47:83:02:cf:ec:21:4a:d5
48:
exp1:
00:c3:aa:f0:8f:dd:77:12:dc:9e:a5:5c:88:79:c7:56
b9:8f:1f:4f:cf:b5:4c:bf:6a:fb:a7:79:38:4e:49:12
e5:a9:d3:bd:c9:06:7c:1c:b5:d5:54:a6:28:77:4b:6d
92:04:f5:7b:d7:8e:49:6d:7c:3e:2a:81:46:89:cb:39
fb:1c:e5:c8:82:4d:f1:92:40:90:17:cf:93:96:ec:a3
93:f6:3c:6b:df:b3:ab:d0:38:86:24:17:03:85:66:46
9a:79:8e:e0:99:4c:12:50:57:5d:bc:40:09:08:3d:76
e1:55:37:46:60:ba:f1:df:32:43:1d:f3:60:dc:93:88
75:67:90:cd:85:9e:a8:47:a7:c8:1a:a1:4f:d4:9c:64
70:5f:c7:da:af:c8:1c:98:5d:48:34:fd:e4:50:8a:07
9b:45:93:bf:b5:be:ae:0b:e3:9d:b9:99:34:32:7b:b1
e6:a7:0b:e0:f6:d1:48:ba:82:3c:e9:e3:6c:bc:c5:9d
c1:
exp2:
00:a4:7e:05:24:4e:0d:9c:59:f2:9b:a2:6c:d6:f8:b1
41:9c:c3:63:6a:3c:73:dc:44:35:5a:c9:a5:1b:f1:d7
7f:e0:d5:26:7c:26:57:54:05:86:68:29:88:c5:5f:41
78:66:d1:9b:6f:c9:14:15:d5:25:9c:27:bd:61:4a:c5
9e:5a:70:60:96:86:e1:9c:5c:ae:3a:32:b3:c3:12:4f
32:03:d2:31:79:78:ad:a6:04:c9:02:5c:b6:ab:f8:98
82:de:d9:5e:ab:d6:f2:49:4d:91:34:47:53:66:6f:05
c4:47:f7:1e:5b:a3:1b:7f:9a:4e:b4:17:ac:2b:a1:71
b2:29:13:3d:cd:d2:5b:ae:30:e2:25:da:67:8f:d4:74
12:67:8d:f6:91:8c:df:99:81:25:17:95:55:81:38:07
17:d6:e2:47:62:05:14:68:49:5f:73:76:8e:44:55:d2
e3:60:a7:0a:5d:f9:68:92:2a:51:b2:00:da:dc:c3:06
c7:
Public Key PIN:
pin-sha256:aKORpr08YK1r+ZlFwE2Jr4IWb89uVOwdRatfTSZzcZ8=
Public Key ID:
sha256:68a391a6bd3c60ad6bf99945c04d89af82166fcf6e54ec1d45ab5f4d2673719f
sha1:9417ae9d2157b87bc1ae107b08a921bca114008b
-----BEGIN RSA PRIVATE KEY-----
MIIG5QIBAAKCAYEAnZHa2C49na6Fw8Wn9qRm+MiRkbhwINzt6CPKU/e4UkPzp+v7
34o7LLAT+mLToVOkUXEfaNn9vDlK+8lq3/OIhLCAvMD1G0IR9kwa2CxiC11QZDCa
09vB1X85U+S96B4EnckS4ORXKSkBufHlvHSm50th5mdcbE7u7iIMGxRt6Axv7u7D
uN3fFe16llvMheXjUMTOK7+2N+Yg/G5Ffgm9hHqvByf0mSNB3zbYKTGgloQv/UUu
1LT5+tyPI8DgBq2tCnLa9Duhy9amO+xGxJXycaWtCB/nBhgO24BRlrok9mQCa9Pw
dgE0OnIC6cvQqmJRDI+DvsBHmdKScu1TpUkF1Mmh9E3eEp0ayBeE86J8Z0eCS4Ye
c4biJiYQlKOZmwiZeJ09M12FwkZllKtwtDvBJosRtmYniCKEA7UIRTKMgSO+Ytxv
oKpenwP3p/UDcDx4CdCERIwZr3b3k/yvxv3b2UzLIHlEccvmVWGpeq8Lo6bt6akR
r/qjXayX5+8rtqg3AgMBAAECggGAYM3F3IB0HFanGYJqUW3pUTivrg3Y3We9xZuP
ZwzOscPLgsPJJymedzLp4y8qA3gGgH52JI2ghC3SsmOpBFNy8MobHVuSeh+aN23E
JEEILyEyDYuK41Okfwy9ZJwoS919So7IyV+faMsno1xInwIvs/Os/sdLkcLgqW5D
b7OaXjCd5/XKSt4Me0U9xfg5650zjWCLpXcPdMIuS8dXbDqBs01IEKZscFSn2IGy
RYSWu0IU1Y3WWpmg5ozwZ6/MMm4p5U1z7EsULqaRJ57URWJSM2aUyCkpTb1ie/dn
7SYCM/RweUP/7A+SgLKk8KKRAPkOUSJT9VHil+gYvjY00sjNDjxmjiyoT0ZmXgFP
HgNu4GPUFfUoWeTgR99XINA5CdhlHD3JL2l3XExPkOoH/FEMKwz5hQb4CAQ3hkXu
WMlMK7oAv8KgkvfCMYJDUg9jTZaCHGBwY6xy2+q4SrOnFXrEcUrdfotAt7F4fxRg
0YnPakFYtc+AWGOt/h8Vu7IQ2wdBAoHBANAEmilWJf2bU8CgL+6oSbCj9DOn8ylf
YywFXnUWtGIqZOrgpmSqzqpJnRAb5VbFYKlUhzv3VUnAWGX9MnOz53mt1Ekns70P
ABFgasGYO3HHg3xZpmHFKdpNiuW+p3Zxzg0tmQeArN9CKW0Zk/JfbSdtMdssajir
PjnbXda4tzTrC5ynf51SdUpTJd7fD2QYAYu1IMN9UrMfuJUPGLPKUF6Jt65hQCR0
hCnhnTSUqvHy1NjOc83uwceA8XVgL8huIQKBwQDB6kzPqKBVy+CCgey690GgMyfi
QoWPlFHFogcjGeqHh69O/BGc6NDmg40d5Qmz4DATkiM3J7wskAng/zEnHooM/srS
odKkdK4h2/djfzhEuZdZnzG/VYCX/nLmbLAbNTwYdlpTdRba8Zf3KTnlcN8c/JEL
6Dog07RhOsiB8mxJH7oHy6gMFxUPj77HXvMOQssaEew+JSX8zsDdmUnHEBrRfF/K
0vPSb61Le5KKVc7ct9y4Hh7l15OFnqBYU24D21cCgcEAw6rwj913EtyepVyIecdW
uY8fT8+1TL9q+6d5OE5JEuWp073JBnwctdVUpih3S22SBPV7145JbXw+KoFGics5
+xzlyIJN8ZJAkBfPk5bso5P2PGvfs6vQOIYkFwOFZkaaeY7gmUwSUFddvEAJCD12
4VU3RmC68d8yQx3zYNyTiHVnkM2FnqhHp8gaoU/UnGRwX8far8gcmF1INP3kUIoH
m0WTv7W+rgvjnbmZNDJ7seanC+D20Ui6gjzp42y8xZ3BAoHBAKR+BSRODZxZ8pui
bNb4sUGcw2NqPHPcRDVayaUb8dd/4NUmfCZXVAWGaCmIxV9BeGbRm2/JFBXVJZwn
vWFKxZ5acGCWhuGcXK46MrPDEk8yA9IxeXitpgTJAly2q/iYgt7ZXqvW8klNkTRH
U2ZvBcRH9x5boxt/mk60F6wroXGyKRM9zdJbrjDiJdpnj9R0EmeN9pGM35mBJReV
VYE4BxfW4kdiBRRoSV9zdo5EVdLjYKcKXflokipRsgDa3MMGxwKBwQDOWbz88hO6
13ji0+wQKP+cr9GNoNjz7WKNFbBpgOi6j7w0zjY1oRYY8kYPZKTWO1oMDKAuv8by
dR2Dk75cFIwCMoR+JOp701J0HGN1AMEERL9242c0zv7lw3zxWcNISy+yJGAMfuH3
sa/1B+2BCKxM4NOYw/sgJF2IbC7dS7md71Z2QoMileIj5Fq1CPcC5bVpmdq+Xxok
SbRdNyI59iPtZkDeUJ70bThBdUYUozVRLl6E2x2UjN9HgwLP7CFK1Ug=
-----END RSA PRIVATE KEY-----
librelp-1.13.0/tests/tls-certs/key.pem 0000644 0001750 0001750 00000020144 13403223446 013265 Public Key Info:
Public Key Algorithm: RSA
Key Security Level: High (3072 bits)
modulus:
00:f2:73:56:56:86:70:8b:b7:d8:29:26:31:9b:e9:62
75:36:cc:40:41:e1:f6:92:d7:57:c3:f5:37:61:43:c2
a8:4d:73:a6:7b:d5:5a:90:c3:a8:08:0f:2c:f1:06:36
5f:de:57:72:3d:be:b1:01:cc:62:92:f9:36:5c:2c:55
1a:a0:da:3f:b1:35:ad:f9:c2:0d:2a:b1:72:02:c6:af
5f:d3:95:11:f7:7c:53:05:3e:ac:cc:82:cd:06:6c:3a
0a:8b:b5:ae:85:c3:4c:1f:5c:88:46:4e:2e:3d:54:94
63:72:1c:95:c1:3d:b0:db:cc:a4:d5:58:ef:b7:3d:b5
87:8b:ca:82:e0:1b:c0:36:96:39:52:8d:b1:d7:0e:64
7c:13:50:be:59:c3:af:8c:52:90:ba:7a:6f:db:dc:c8
3a:f7:e9:dd:6b:b0:d2:0d:c2:e8:4d:ba:47:2b:d8:3a
73:4d:ab:a6:e6:0c:75:dd:c8:89:31:60:d3:f0:c7:27
c1:0c:6a:bf:5a:19:eb:16:a4:13:c8:4a:ae:95:52:d5
54:8a:4a:fb:77:c8:76:d9:87:ff:83:a9:3b:0c:73:28
cd:2a:da:4f:42:cc:bf:80:23:52:6a:94:5a:1e:3d:e2
0a:61:06:00:3a:cb:14:07:00:74:54:10:db:87:2a:3c
7f:bb:71:06:ce:8e:07:5a:61:3d:c9:9b:90:0a:36:6c
97:cb:d3:55:13:df:5e:68:9a:a9:46:5a:3b:ef:0d:18
c3:11:e4:40:7d:79:d6:bb:f5:15:2c:8b:35:30:d9:f4
f6:5d:be:7c:ac:20:67:23:99:21:01:24:e6:01:a0:6f
ec:4e:ee:96:69:e5:6d:48:b8:bc:41:d4:33:1a:b5:08
d8:2b:52:f5:30:6f:0a:51:e6:e8:bd:3c:ae:98:08:fc
90:e6:82:25:aa:9a:f8:45:9c:3e:fb:07:db:02:5b:ce
9e:c9:65:5e:f1:00:c9:cd:40:62:c7:1d:c7:18:f4:8b
fd:
public exponent:
01:00:01:
private exponent:
63:aa:b0:3a:5f:87:d2:97:df:df:82:98:f0:2b:ef:d2
99:95:3b:71:19:ef:e0:0b:70:43:d9:01:4c:15:ab:e6
bd:f8:25:df:50:24:ab:d0:12:ba:45:6a:c7:26:33:a2
13:67:c5:49:c6:a3:43:46:fe:da:c6:61:e7:60:3e:17
f5:39:e2:e6:f9:57:2c:8d:ee:15:b7:de:53:6f:d3:d6
43:c7:4b:1c:7e:da:2e:14:c6:ba:47:a6:fa:d5:f0:c2
37:0e:97:d0:db:28:e6:d7:86:19:c8:b7:cf:74:7e:8f
a6:f0:43:4b:ae:0d:8f:3d:c0:21:08:2f:7b:17:7e:11
5b:91:03:5e:17:6a:5b:c6:43:88:41:41:73:53:b2:51
23:2b:95:24:97:82:09:e0:43:28:b5:7e:58:56:99:65
4c:56:b2:34:3b:fb:0d:b7:2b:02:10:ea:83:06:9f:78
98:dc:50:7e:cf:6e:80:9e:98:6f:59:0b:a7:36:67:8b
72:ad:75:96:9c:13:a4:8e:17:07:6d:45:30:b1:55:03
81:65:6b:02:e1:30:fe:9c:6b:63:80:ae:9d:47:b1:33
ea:b6:1c:6d:14:2f:ff:29:71:e2:9c:dd:40:62:34:04
44:3d:8d:71:6b:d1:ea:8d:46:63:37:12:26:8f:94:1c
f5:6a:d1:66:7f:a9:d6:dd:59:27:79:ce:ea:ad:b3:47
62:b9:f6:1c:36:0a:c0:fe:f3:f6:e1:c2:86:12:97:f9
f2:7e:62:b4:33:3e:ad:43:05:95:1d:14:fe:be:76:c6
44:38:80:a4:25:08:5b:5c:76:4e:a9:bd:aa:7f:f1:05
8b:49:81:a0:40:4b:1a:98:d1:c9:cf:98:e1:ba:71:12
fc:1f:53:aa:57:5c:65:3a:e0:72:24:d5:8f:27:21:9c
fc:b6:d6:f7:c8:07:5c:c2:42:5d:cb:ba:bf:0d:f2:13
9b:07:6b:73:ae:1b:f0:b7:1a:6a:fd:20:cf:b2:72:01
prime1:
00:fe:14:cf:31:a0:d8:e0:f5:49:35:22:2c:14:13:aa
55:d6:26:92:c2:fa:63:02:72:dd:d1:05:d1:0f:b0:a4
ae:e4:0e:99:a0:35:e3:84:24:06:aa:27:4d:ce:6f:33
6d:8a:96:3e:54:bd:51:92:e9:3f:9b:f2:6e:9d:7d:1e
2f:e1:11:bc:db:34:c8:2f:ab:07:ee:4a:5d:96:05:54
1c:48:f0:3c:83:99:3a:9f:5d:fe:31:48:0c:b3:0c:ab
e3:5c:2d:e7:06:43:91:5c:62:21:76:0a:4f:00:ec:a3
95:85:b0:fe:3b:61:8b:07:c7:21:bb:b4:ef:0d:d1:67
01:dd:bd:9b:e8:56:eb:ca:22:83:c1:e8:89:3b:fa:17
23:e9:de:fd:62:04:73:1f:2a:89:66:d7:d1:16:99:7f
98:a0:e0:c2:9b:11:22:23:b9:55:cb:a0:4b:eb:81:a4
a8:82:5d:e0:0a:cb:19:fd:18:5d:e2:17:cc:13:2b:19
81:
prime2:
00:f4:48:0b:16:38:e8:d9:94:7e:38:29:71:d4:2a:fa
7c:cd:d8:b5:d2:db:d1:a6:3f:1f:3f:39:2f:f2:af:3d
ae:8c:c9:fd:01:32:83:cf:48:f4:f5:25:95:3f:0a:83
90:21:75:60:52:01:9a:5e:95:d2:ed:4c:6e:8c:f9:93
9a:40:24:b5:91:eb:e6:b4:96:6a:6a:51:1b:9b:18:fd
24:c8:c3:68:52:e3:55:f5:23:e0:97:4d:4b:4b:cd:83
04:b9:e1:70:b6:4c:42:a6:a0:0c:2e:0d:f0:a1:c0:04
08:57:0f:da:0e:0e:ee:32:7c:20:e6:03:ee:35:41:22
01:b0:f3:6e:ee:0d:d7:91:1d:ed:98:d4:ef:e6:03:f1
39:96:dd:a0:1f:6c:3a:3d:d9:d2:ac:f0:13:73:31:cf
b1:fb:13:d3:55:55:1b:6c:bd:39:49:e0:7a:b7:ef:ec
3d:5c:dd:7d:bf:a0:11:69:8f:66:fc:45:29:b3:05:18
7d:
coefficient:
00:9b:0b:66:d7:fe:dd:69:d2:9a:5b:d5:4e:36:f0:c8
67:4e:68:ff:d5:21:a1:92:50:27:97:47:6e:82:3d:b3
c5:87:d2:c0:15:09:c1:9e:dc:2d:74:5a:cc:2b:ca:82
0a:5d:3b:82:93:31:ce:12:bd:5b:7d:54:87:c0:8a:0e
df:86:d6:6f:62:ca:4a:41:5f:6c:8e:cb:ac:6e:37:c0
b8:26:20:c3:59:37:ce:1f:e7:eb:a5:08:8a:b0:96:f3
e0:3d:fc:66:c4:6b:66:14:91:76:2c:22:e4:6a:56:20
41:51:6a:77:f1:bf:4c:5b:e8:fa:af:41:09:a8:77:5a
6a:66:6d:12:83:54:c1:e8:ff:b7:3a:db:9f:46:e2:ce
d8:60:a8:03:23:78:41:5f:fb:ea:16:62:20:24:8d:8b
49:64:e4:cb:ca:83:e8:c4:60:97:fb:bf:e7:dc:2c:10
ba:03:67:76:ea:4d:00:6c:06:f8:d2:83:fb:26:fe:dc
e1:
exp1:
00:db:9c:94:f1:ea:7b:4b:05:f8:3e:ea:c8:7a:99:fc
d2:b0:85:2a:b9:48:be:a7:71:2d:74:eb:b8:25:fd:a2
7a:60:38:96:64:b9:ef:6b:59:d0:40:e6:34:04:48:6d
85:33:12:65:d1:cc:c9:63:58:24:58:e0:94:e7:9f:2b
a6:6a:bd:70:25:70:5b:cf:87:df:15:02:46:1d:d3:81
3d:e9:75:6c:78:ba:ca:c6:d0:f1:53:1b:59:8e:b1:57
28:ef:95:e5:67:ae:a3:47:dc:b1:db:5b:51:aa:14:df
d7:ef:74:6a:6a:5d:07:54:b3:b3:de:90:a7:47:a4:45
8a:81:64:d0:0b:64:85:ed:73:23:bb:49:08:c5:44:87
17:cd:9f:a6:17:40:8d:58:d4:e5:6a:75:04:0e:aa:a2
75:04:29:01:4c:12:e5:15:47:ae:76:90:98:ce:78:82
1f:fc:7e:b3:95:e0:b3:17:e6:25:cf:b4:8d:f9:cb:79
01:
exp2:
00:ad:d1:a9:99:e9:6a:be:8f:ab:f4:78:81:17:90:71
66:66:ee:a2:0a:65:01:db:c2:a4:90:4f:37:ef:fe:83
ec:75:1f:b1:18:ae:02:1e:77:f2:5d:91:9d:8e:1b:04
1c:85:c2:48:84:71:c1:8f:36:1a:bd:61:9a:74:53:8e
94:be:b9:a0:3d:31:d7:9a:7e:41:40:5f:70:3e:3f:5c
b9:54:e5:be:90:e4:54:a0:b7:23:b3:65:7b:83:77:bb
97:9c:50:6e:ec:38:7d:60:a5:17:a5:99:a3:b4:e4:b5
b9:dd:81:59:0e:91:cf:2a:3b:2b:09:a0:98:5a:6a:7b
31:2a:e1:3c:f8:c4:fe:b3:b2:d1:02:e3:d9:c4:18:e0
07:b3:73:05:e1:f6:17:c7:34:fc:74:b3:eb:93:17:49
8b:82:75:cb:f5:b7:36:69:7c:87:8c:2a:e0:07:8b:ff
d4:76:04:e0:da:7e:a2:85:33:55:fb:81:97:37:5c:13
dd:
Public Key ID: C5:43:DA:C5:F5:E5:8C:7A:A3:6D:AC:33:0E:19:BD:5F:67:9E:04:61
Public key's random art:
+--[ RSA 3072]----+
| ..... .|
| = .. =.|
| . = E. +|
| . o... |
| S . o.o |
| o *.. |
| o o +.+|
| .o+.+o|
| .oo...|
+-----------------+
-----BEGIN RSA PRIVATE KEY-----
MIIG5QIBAAKCAYEA8nNWVoZwi7fYKSYxm+lidTbMQEHh9pLXV8P1N2FDwqhNc6Z7
1VqQw6gIDyzxBjZf3ldyPb6xAcxikvk2XCxVGqDaP7E1rfnCDSqxcgLGr1/TlRH3
fFMFPqzMgs0GbDoKi7WuhcNMH1yIRk4uPVSUY3IclcE9sNvMpNVY77c9tYeLyoLg
G8A2ljlSjbHXDmR8E1C+WcOvjFKQunpv29zIOvfp3Wuw0g3C6E26RyvYOnNNq6bm
DHXdyIkxYNPwxyfBDGq/WhnrFqQTyEqulVLVVIpK+3fIdtmH/4OpOwxzKM0q2k9C
zL+AI1JqlFoePeIKYQYAOssUBwB0VBDbhyo8f7txBs6OB1phPcmbkAo2bJfL01UT
315omqlGWjvvDRjDEeRAfXnWu/UVLIs1MNn09l2+fKwgZyOZIQEk5gGgb+xO7pZp
5W1IuLxB1DMatQjYK1L1MG8KUebovTyumAj8kOaCJaqa+EWcPvsH2wJbzp7JZV7x
AMnNQGLHHccY9Iv9AgMBAAECggGAY6qwOl+H0pff34KY8Cvv0pmVO3EZ7+ALcEPZ
AUwVq+a9+CXfUCSr0BK6RWrHJjOiE2fFScajQ0b+2sZh52A+F/U54ub5VyyN7hW3
3lNv09ZDx0scftouFMa6R6b61fDCNw6X0Nso5teGGci3z3R+j6bwQ0uuDY89wCEI
L3sXfhFbkQNeF2pbxkOIQUFzU7JRIyuVJJeCCeBDKLV+WFaZZUxWsjQ7+w23KwIQ
6oMGn3iY3FB+z26AnphvWQunNmeLcq11lpwTpI4XB21FMLFVA4FlawLhMP6ca2OA
rp1HsTPqthxtFC//KXHinN1AYjQERD2NcWvR6o1GYzcSJo+UHPVq0WZ/qdbdWSd5
zuqts0diufYcNgrA/vP24cKGEpf58n5itDM+rUMFlR0U/r52xkQ4gKQlCFtcdk6p
vap/8QWLSYGgQEsamNHJz5jhunES/B9TqldcZTrgciTVjychnPy21vfIB1zCQl3L
ur8N8hObB2tzrhvwtxpq/SDPsnIBAoHBAP4UzzGg2OD1STUiLBQTqlXWJpLC+mMC
ct3RBdEPsKSu5A6ZoDXjhCQGqidNzm8zbYqWPlS9UZLpP5vybp19Hi/hEbzbNMgv
qwfuSl2WBVQcSPA8g5k6n13+MUgMswyr41wt5wZDkVxiIXYKTwDso5WFsP47YYsH
xyG7tO8N0WcB3b2b6FbryiKDweiJO/oXI+ne/WIEcx8qiWbX0RaZf5ig4MKbESIj
uVXLoEvrgaSogl3gCssZ/Rhd4hfMEysZgQKBwQD0SAsWOOjZlH44KXHUKvp8zdi1
0tvRpj8fPzkv8q89rozJ/QEyg89I9PUllT8Kg5AhdWBSAZpeldLtTG6M+ZOaQCS1
kevmtJZqalEbmxj9JMjDaFLjVfUj4JdNS0vNgwS54XC2TEKmoAwuDfChwAQIVw/a
Dg7uMnwg5gPuNUEiAbDzbu4N15Ed7ZjU7+YD8TmW3aAfbDo92dKs8BNzMc+x+xPT
VVUbbL05SeB6t+/sPVzdfb+gEWmPZvxFKbMFGH0CgcEA25yU8ep7SwX4PurIepn8
0rCFKrlIvqdxLXTruCX9onpgOJZkue9rWdBA5jQESG2FMxJl0czJY1gkWOCU558r
pmq9cCVwW8+H3xUCRh3TgT3pdWx4usrG0PFTG1mOsVco75XlZ66jR9yx21tRqhTf
1+90ampdB1Szs96Qp0ekRYqBZNALZIXtcyO7SQjFRIcXzZ+mF0CNWNTlanUEDqqi
dQQpAUwS5RVHrnaQmM54gh/8frOV4LMX5iXPtI35y3kBAoHBAK3RqZnpar6Pq/R4
gReQcWZm7qIKZQHbwqSQTzfv/oPsdR+xGK4CHnfyXZGdjhsEHIXCSIRxwY82Gr1h
mnRTjpS+uaA9MdeafkFAX3A+P1y5VOW+kORUoLcjs2V7g3e7l5xQbuw4fWClF6WZ
o7TktbndgVkOkc8qOysJoJhaansxKuE8+MT+s7LRAuPZxBjgB7NzBeH2F8c0/HSz
65MXSYuCdcv1tzZpfIeMKuAHi//UdgTg2n6ihTNV+4GXN1wT3QKBwQCbC2bX/t1p
0ppb1U428MhnTmj/1SGhklAnl0dugj2zxYfSwBUJwZ7cLXRazCvKggpdO4KTMc4S
vVt9VIfAig7fhtZvYspKQV9sjsusbjfAuCYgw1k3zh/n66UIirCW8+A9/GbEa2YU
kXYsIuRqViBBUWp38b9MW+j6r0EJqHdaamZtEoNUwej/tzrbn0bizthgqAMjeEFf
++oWYiAkjYtJZOTLyoPoxGCX+7/n3CwQugNndupNAGwG+NKD+yb+3OE=
-----END RSA PRIVATE KEY-----
librelp-1.13.0/tests/tls-certs/ossl-server-key.pem 0000644 0001750 0001750 00000017752 13720663520 015565 Public Key Info:
Public Key Algorithm: RSA
Key Security Level: High (3072 bits)
modulus:
00:bd:88:59:0d:27:4f:73:10:60:8c:5f:ac:81:06:75
d1:83:ee:21:72:33:a2:2a:b8:1b:de:37:38:61:57:11
d3:1c:d2:47:5a:55:07:02:2a:44:78:ad:a3:cc:47:4c
0a:b3:9e:da:92:98:8d:e4:2a:d4:d4:7b:e4:c1:86:5b
4c:d0:7f:06:9c:a1:52:e6:67:c7:6a:a3:4d:1c:8e:a4
1e:f5:93:ad:b3:ec:73:f7:28:02:3f:19:87:c4:31:7e
43:34:f4:b4:5f:70:7b:72:19:00:4f:84:a4:d5:77:67
dd:68:d6:dc:15:6d:dc:62:b8:5d:d5:a6:1b:63:34:72
6b:18:68:5b:e2:8c:52:43:8b:a1:6c:f1:fc:bf:e6:c1
b6:c7:e5:81:c1:cb:75:2a:df:07:9e:37:d1:fa:78:74
d1:88:60:8a:a3:9d:5f:58:ce:ac:33:76:f5:71:e4:9f
81:88:12:6f:c1:45:04:50:d3:f3:e8:39:ae:95:58:65
55:c6:ef:bc:b1:f9:8c:ec:82:7c:90:2e:7f:40:82:37
3c:56:42:a6:5a:8f:9f:11:58:77:70:b4:59:ae:af:6a
ef:ad:62:2b:09:f4:1e:42:07:f7:e7:f5:aa:ec:ec:7e
a7:14:c7:35:0f:7f:06:fe:c5:64:b2:97:49:ac:5b:85
6d:02:c4:96:41:fb:c9:dc:41:64:1b:f7:3b:e7:e5:22
89:9a:bf:ff:89:2f:53:e2:34:71:6d:5f:1a:06:b1:33
8f:1c:71:4a:6e:a6:ae:c4:bb:93:6e:ff:41:e4:3d:6d
3b:f3:1a:c4:e0:53:b7:d3:15:33:1f:2b:0e:95:41:cb
4b:29:2a:17:d6:73:12:7f:d0:78:1e:ec:6f:57:ac:51
a9:37:88:e8:04:f1:cf:32:08:4c:f1:08:d2:f7:f1:0b
f2:bf:7c:9b:c3:cd:42:4e:8e:20:6f:53:35:e4:02:83
38:25:40:85:77:2b:ea:e1:17:04:de:7b:27:ad:c4:3a
33:
public exponent:
01:00:01:
private exponent:
19:dd:b1:c9:89:c3:de:00:2e:2c:fa:21:a0:ba:30:fa
16:f7:38:b9:4d:32:a4:81:db:cb:c7:dd:79:eb:58:13
67:ab:8a:f1:59:09:4b:d2:58:e5:df:4c:ab:64:4f:8c
66:57:17:9d:4a:14:93:3f:05:2c:ba:7b:cd:ad:78:68
53:4c:02:aa:fd:99:42:b8:87:0e:96:9a:bf:7a:f8:0b
01:98:d5:eb:e8:29:2b:61:da:6c:a2:1f:55:37:2b:f4
20:16:05:47:c1:22:17:c0:31:ba:a8:6f:96:72:65:4a
62:34:70:74:bc:39:87:7f:81:ce:d6:8c:86:4d:72:10
0b:94:b2:75:88:90:f1:86:ec:d0:e1:75:8c:fb:01:14
e0:d3:01:92:61:21:ec:67:e3:b2:44:0b:f4:12:dc:5e
7c:2e:30:bd:83:8c:af:a2:04:fe:41:0d:de:2d:45:57
78:2a:8b:f5:e4:65:62:62:8a:b6:f6:a8:4c:d9:73:7a
b5:15:d0:91:c7:89:a9:45:94:00:0c:1d:69:f0:48:f7
26:83:50:bd:b3:e7:7e:70:8b:21:bf:99:fd:04:d2:8a
d2:b1:be:9e:4b:a7:f1:57:8f:34:c0:b9:f0:22:d8:bf
3f:fa:8c:77:47:7d:62:d4:5c:d8:08:1b:dd:3c:a2:c3
60:25:84:be:02:a2:79:00:e4:06:c8:48:49:43:ac:9f
45:78:c9:46:0a:9a:1f:5b:70:d1:da:b6:e6:f1:fc:af
a5:85:c6:7b:78:f0:5c:2c:91:1b:ba:36:62:f8:31:ed
21:87:15:49:3c:c1:bf:53:a4:11:9a:19:91:51:aa:49
ea:d8:b3:a4:66:76:2a:ad:8e:61:38:f5:7a:ba:59:bb
2e:48:f3:fc:14:a1:42:18:e7:c6:c6:41:03:d4:ca:d6
85:14:cc:8b:1d:57:38:6f:ef:9e:14:34:85:38:92:ab
f8:24:f4:5b:14:6b:6a:3c:22:29:bb:36:51:68:43:81
prime1:
00:cd:49:91:cb:0a:37:19:fe:50:c0:9a:a0:c3:53:9b
fb:3c:e0:dc:2d:55:69:0e:cd:ea:e7:0c:a5:c1:34:a0
b5:8d:72:45:da:9c:56:15:8b:31:3f:fb:93:d7:b0:81
de:d1:9f:d8:c4:c1:ff:5a:d6:a8:15:c1:b6:c5:11:39
4f:e9:16:06:fb:be:90:d4:a2:9d:23:0a:b3:52:81:07
d5:ae:2c:f5:bb:7e:32:62:59:f9:65:1f:ab:9b:3c:67
94:b7:e2:49:69:3d:c6:98:e4:3e:56:f9:0f:02:e1:6c
c2:da:10:3b:9d:39:e7:55:40:6d:ae:46:f6:b8:cc:30
2c:26:02:4f:65:a8:7c:38:47:9c:d8:96:ce:31:89:a4
07:91:de:4d:46:35:b0:8e:01:fd:ca:11:c2:c8:8e:71
32:eb:a0:61:da:10:db:8b:4d:ac:29:73:d2:b1:7c:d4
d3:0d:ce:a2:88:ef:3b:d0:b4:2b:50:1f:62:c8:e6:d2
7d:
prime2:
00:ec:5a:71:35:ee:17:84:3a:0f:41:9b:44:e6:1e:f3
e2:c6:31:09:cd:d6:af:4d:6a:ac:fc:c1:03:40:67:91
73:38:4e:a7:d1:2a:b9:25:a1:da:e9:77:9b:dd:e9:c2
1a:72:0b:11:97:90:04:23:a7:4d:e3:ad:29:6b:65:c6
63:8b:00:65:0a:7e:3d:46:b8:f7:4b:eb:a4:ee:cf:19
3e:a0:52:80:72:e7:9f:9c:8b:b1:d0:0b:e3:9c:34:1e
d2:7c:ac:e2:c2:90:69:2b:78:9c:c1:9a:84:7a:5b:dc
99:83:a0:18:22:fc:30:c6:7e:1e:97:de:bc:66:71:26
ec:f2:98:06:ce:62:53:d7:af:86:21:07:95:98:2c:2a
f4:4e:fe:58:a7:97:19:de:5a:4a:94:ee:98:d3:a0:77
9e:db:52:55:64:a4:fa:84:c3:a8:89:8a:97:22:93:a6
f0:00:85:38:91:7a:52:98:2f:34:10:7e:92:9d:76:ae
6f:
coefficient:
00:94:fa:06:8f:7e:8a:1d:be:16:55:80:93:01:0d:ab
77:4b:d3:a5:14:37:ef:04:28:b3:91:d9:5f:df:e8:56
d5:1d:bd:c1:25:e8:bf:69:49:04:2f:c1:73:73:27:64
66:3e:61:20:d5:25:db:ad:da:3d:e8:a3:a5:20:16:38
6b:28:18:83:97:07:67:6a:16:4b:7f:2b:da:6a:a5:1b
ec:9a:c3:2a:4f:5d:9e:7e:9b:05:a5:a8:bb:ab:76:27
1a:07:27:be:c8:65:94:e8:54:41:ba:1f:b3:91:5d:b1
5a:13:2b:b3:11:60:52:26:47:35:a7:46:bd:16:f9:e5
1e:4b:e9:48:33:aa:33:30:77:8e:71:e4:88:1c:1a:57
af:17:77:76:65:d2:2b:a3:33:b8:ec:34:f8:23:03:5b
90:cb:eb:a4:c0:ee:98:0f:9c:5e:73:11:bd:9e:01:99
79:4f:98:1e:12:25:62:88:3a:65:12:8f:67:45:40:af
4b:
exp1:
30:f9:93:39:a0:47:43:01:44:1c:9f:07:29:72:41:ed
2f:39:e9:ed:3a:ca:24:89:05:b8:77:70:f7:e5:e9:4d
46:e0:73:3f:d3:3a:4a:4b:79:c5:6c:ec:79:71:97:9a
23:e2:81:a1:77:32:c7:66:1c:95:8c:30:61:55:59:99
f1:de:9a:6d:e6:a9:c0:c0:c6:c2:3c:64:49:93:94:dd
ea:7e:b9:65:30:97:2e:95:8e:85:0c:88:31:31:b8:f8
66:e2:2a:67:5c:20:8c:0b:2f:c0:2a:0c:e5:c0:07:e5
78:86:94:e2:4e:95:1c:e6:91:04:19:d3:f4:84:6a:1d
ae:37:b0:df:6c:d1:ad:cf:8f:e0:b0:21:a2:f9:d6:53
23:fe:a7:ea:cf:16:3e:da:c4:c4:37:76:83:c8:4f:c3
39:29:7b:0e:be:24:d2:58:06:71:a1:3b:2b:b2:bf:47
56:ac:ec:63:c4:c7:3d:64:2e:4d:20:1f:be:14:2b:35
exp2:
11:dd:bc:55:11:4c:61:c8:69:c2:d1:d3:e1:79:51:82
40:ed:10:0a:a9:41:d3:1e:4f:39:43:f5:d4:f6:7f:3e
30:71:71:aa:14:0a:ae:d7:8f:4e:ba:a5:e3:9e:79:f7
b9:cb:30:67:3e:91:b1:88:42:11:05:d3:ed:b4:61:cc
c0:83:25:20:27:ee:c5:db:d1:85:c1:a8:54:0c:ff:a1
86:48:f6:40:b9:55:8d:65:d9:e9:1a:1c:f8:7f:d0:1c
a5:24:04:78:24:a6:6e:8c:cd:7c:ad:0b:7a:9c:5b:0e
97:ae:90:64:84:9f:c3:41:61:5a:a5:91:a4:44:c5:66
7f:e8:12:0b:a3:cf:26:ac:b3:fc:e7:2f:dd:b2:e9:04
52:bc:53:43:47:de:c2:ba:1c:8d:29:84:0f:eb:3f:5f
98:c0:9e:87:df:18:b8:d4:79:76:fc:2c:f4:86:28:c6
57:a3:ba:64:f4:d4:2d:80:d3:f4:b3:3c:ad:fe:7c:ad
Public Key PIN:
pin-sha256:P26XjPq8H830hYvKjSgxiVfBDOiZNDGexDfrJkKWi9o=
Public Key ID:
sha256:3f6e978cfabc1fcdf4858bca8d28318957c10ce89934319ec437eb2642968bda
sha1:37ac3abfda460e16c90c0f4947146fa0d848ffdb
-----BEGIN RSA PRIVATE KEY-----
MIIG4wIBAAKCAYEAvYhZDSdPcxBgjF+sgQZ10YPuIXIzoiq4G943OGFXEdMc0kda
VQcCKkR4raPMR0wKs57akpiN5CrU1HvkwYZbTNB/BpyhUuZnx2qjTRyOpB71k62z
7HP3KAI/GYfEMX5DNPS0X3B7chkAT4Sk1Xdn3WjW3BVt3GK4XdWmG2M0cmsYaFvi
jFJDi6Fs8fy/5sG2x+WBwct1Kt8HnjfR+nh00YhgiqOdX1jOrDN29XHkn4GIEm/B
RQRQ0/PoOa6VWGVVxu+8sfmM7IJ8kC5/QII3PFZCplqPnxFYd3C0Wa6vau+tYisJ
9B5CB/fn9ars7H6nFMc1D38G/sVkspdJrFuFbQLElkH7ydxBZBv3O+flIomav/+J
L1PiNHFtXxoGsTOPHHFKbqauxLuTbv9B5D1tO/MaxOBTt9MVMx8rDpVBy0spKhfW
cxJ/0Hge7G9XrFGpN4joBPHPMghM8QjS9/EL8r98m8PNQk6OIG9TNeQCgzglQIV3
K+rhFwTeeyetxDozAgMBAAECggGAGd2xyYnD3gAuLPohoLow+hb3OLlNMqSB28vH
3XnrWBNnq4rxWQlL0ljl30yrZE+MZlcXnUoUkz8FLLp7za14aFNMAqr9mUK4hw6W
mr96+AsBmNXr6CkrYdpsoh9VNyv0IBYFR8EiF8AxuqhvlnJlSmI0cHS8OYd/gc7W
jIZNchALlLJ1iJDxhuzQ4XWM+wEU4NMBkmEh7GfjskQL9BLcXnwuML2DjK+iBP5B
Dd4tRVd4Kov15GViYoq29qhM2XN6tRXQkceJqUWUAAwdafBI9yaDUL2z535wiyG/
mf0E0orSsb6eS6fxV480wLnwIti/P/qMd0d9YtRc2Agb3Tyiw2AlhL4ConkA5AbI
SElDrJ9FeMlGCpofW3DR2rbm8fyvpYXGe3jwXCyRG7o2Yvgx7SGHFUk8wb9TpBGa
GZFRqknq2LOkZnYqrY5hOPV6ulm7Lkjz/BShQhjnxsZBA9TK1oUUzIsdVzhv754U
NIU4kqv4JPRbFGtqPCIpuzZRaEOBAoHBAM1JkcsKNxn+UMCaoMNTm/s84NwtVWkO
zernDKXBNKC1jXJF2pxWFYsxP/uT17CB3tGf2MTB/1rWqBXBtsUROU/pFgb7vpDU
op0jCrNSgQfVriz1u34yYln5ZR+rmzxnlLfiSWk9xpjkPlb5DwLhbMLaEDudOedV
QG2uRva4zDAsJgJPZah8OEec2JbOMYmkB5HeTUY1sI4B/coRwsiOcTLroGHaENuL
Tawpc9KxfNTTDc6iiO870LQrUB9iyObSfQKBwQDsWnE17heEOg9Bm0TmHvPixjEJ
zdavTWqs/MEDQGeRczhOp9EquSWh2ul3m93pwhpyCxGXkAQjp03jrSlrZcZjiwBl
Cn49Rrj3S+uk7s8ZPqBSgHLnn5yLsdAL45w0HtJ8rOLCkGkreJzBmoR6W9yZg6AY
Ivwwxn4el968ZnEm7PKYBs5iU9evhiEHlZgsKvRO/linlxneWkqU7pjToHee21JV
ZKT6hMOoiYqXIpOm8ACFOJF6UpgvNBB+kp12rm8CgcAw+ZM5oEdDAUQcnwcpckHt
Lznp7TrKJIkFuHdw9+XpTUbgcz/TOkpLecVs7Hlxl5oj4oGhdzLHZhyVjDBhVVmZ
8d6abeapwMDGwjxkSZOU3ep+uWUwly6VjoUMiDExuPhm4ipnXCCMCy/AKgzlwAfl
eIaU4k6VHOaRBBnT9IRqHa43sN9s0a3Pj+CwIaL51lMj/qfqzxY+2sTEN3aDyE/D
OSl7Dr4k0lgGcaE7K7K/R1as7GPExz1kLk0gH74UKzUCgcAR3bxVEUxhyGnC0dPh
eVGCQO0QCqlB0x5POUP11PZ/PjBxcaoUCq7Xj066peOeefe5yzBnPpGxiEIRBdPt
tGHMwIMlICfuxdvRhcGoVAz/oYZI9kC5VY1l2ekaHPh/0BylJAR4JKZujM18rQt6
nFsOl66QZISfw0FhWqWRpETFZn/oEgujzyass/znL92y6QRSvFNDR97CuhyNKYQP
6z9fmMCeh98YuNR5dvws9IYoxlejumT01C2A0/SzPK3+fK0CgcEAlPoGj36KHb4W
VYCTAQ2rd0vTpRQ37wQos5HZX9/oVtUdvcEl6L9pSQQvwXNzJ2RmPmEg1SXbrdo9
6KOlIBY4aygYg5cHZ2oWS38r2mqlG+yawypPXZ5+mwWlqLurdicaBye+yGWU6FRB
uh+zkV2xWhMrsxFgUiZHNadGvRb55R5L6UgzqjMwd45x5IgcGlevF3d2ZdIrozO4
7DT4IwNbkMvrpMDumA+cXnMRvZ4BmXlPmB4SJWKIOmUSj2dFQK9L
-----END RSA PRIVATE KEY-----
librelp-1.13.0/tests/tls-certs/ossl-ca.pem 0000644 0001750 0001750 00000003137 13720663520 014044 -----BEGIN CERTIFICATE-----
MIIEiDCCAvCgAwIBAgIIXBeb1iWItcgwDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMCAXDTE4MTIxNzEyNTEzNVoYDzIxMTgxMTIzMTI1MTUwWjBE
MREwDwYDVQQDEwhzb21lTmFtZTEQMA4GA1UECxMHcnN5c2xvZzEQMA4GA1UEChMH
U29tZU9yZzELMAkGA1UEBhMCVVMwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGK
AoIBgQChCwzkraL2v9SFAY3WD1au6cRCSaqrgC/5cecwzGBum0njlO4kmUkI5G4g
1cwTtXqcmTh17EKaHlBFougnH5JZdDFmKpOIp4odACl5uuT5J1lRh6lsOyVq9X0h
qp9qfjn1rrn7XfLk9i9+or0/iLK2megmU5ZUX6pNpoKaGeLBl4CeiiiqdaUeyGK8
YKQksx/0zdeWb04Yp+zHIddcGoGAx88zf94onJQESsVOn1yG3sGM7rhfvOHDLGJ4
flE+1ww8D6rZZci6D4bYhfA1bpiRwsU3UILginUVpfbMn+W6f2s+Cq0dbiQza0lf
+S2rK+7cH+4z9ltqA054B2/JPuNKbwf3lLoabGNWu47TCfyzaDUb7Y70CFRrYfkN
4pD5y+Z838IH87RKJioh5q2ceVX5pyNv8XmkMuvWYDrnjVTnX7Q0fN/T6h8fVTIp
lojlgV8z2tPcrJE0M4Y67nSAgYX7v2AtmcoBPML5Sairzq5apiljb0Wm5KSNwXZ2
eAz9nTsCAwEAAaN8MHowDwYDVR0TAQH/BAUwAwEB/zBIBgNVHREEQTA/ghNzb21l
b25lQGV4YW1wbGUubmV0ghNzb21lb25lQGV4YW1wbGUubmV0gRNzb21lb25lQGV4
YW1wbGUubmV0MB0GA1UdDgQWBBSwn2czLIiIiR9EYnSdJf/ABhNd1jANBgkqhkiG
9w0BAQsFAAOCAYEAl6nIgBHMX8rnAC054xx/aQcXazrv89KyEp0ydzBwJQOTei7I
UGWQIRkSLL+CtrGhcLPQpTzAQn5NDo4ayinAtlPtP8MYcMBv13ZBJXLSqRfrTM04
wkEbsWuCp+c/fU14E+QYSk4AwpoUdQeqmdM60KAoHNn+BaHGJRhRGOY9A8hfQQ5L
S2TpJ+suJuHafNjr9vvhlqTSefCfENV40Ie1nwHCbqNZdDZel1iQBmdI7WJG7uTI
OrSOPepYzOAYKQ+PWKMvZuzBc6ei/lcIpPHksWxK7nY35izSHjepMLGqH0/XZ51i
wN55slw9agg5eCq/zL/+Ebu7+yub8JhA9D4pgT5nBp8LtQPOIKnkVlFookjfyO8/
dWsjGnhT9RNbDUQg7Y7spTWPT7wqOmQchEvQt+x96BHq4SLe88HnTpBk2Cb370jq
QQFW6s9vwo9PjOafOkyqYsiBuuCFxT80GegBlaipDNqLYhJ1fJAdQtRtFgogqpeS
thWJZzNJeHyZSpah
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ossl-server-cert.pem 0000644 0001750 0001750 00000003167 13720663520 015725 -----BEGIN CERTIFICATE-----
MIIEmjCCAwKgAwIBAgIIXBegQDWsgowwDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMCAXDTE4MTIxNzEzMTAyNloYDzIxMTgxMTIzMTMxMDI4WjBR
MQ8wDQYDVQQLEwZTb21lT1UxEDAOBgNVBAoTB1NvbWVPcmcxEjAQBgNVBAcTCVNv
bWV3aGVyZTELMAkGA1UECBMCQ0ExCzAJBgNVBAYTAlVTMIIBojANBgkqhkiG9w0B
AQEFAAOCAY8AMIIBigKCAYEAvYhZDSdPcxBgjF+sgQZ10YPuIXIzoiq4G943OGFX
EdMc0kdaVQcCKkR4raPMR0wKs57akpiN5CrU1HvkwYZbTNB/BpyhUuZnx2qjTRyO
pB71k62z7HP3KAI/GYfEMX5DNPS0X3B7chkAT4Sk1Xdn3WjW3BVt3GK4XdWmG2M0
cmsYaFvijFJDi6Fs8fy/5sG2x+WBwct1Kt8HnjfR+nh00YhgiqOdX1jOrDN29XHk
n4GIEm/BRQRQ0/PoOa6VWGVVxu+8sfmM7IJ8kC5/QII3PFZCplqPnxFYd3C0Wa6v
au+tYisJ9B5CB/fn9ars7H6nFMc1D38G/sVkspdJrFuFbQLElkH7ydxBZBv3O+fl
Iomav/+JL1PiNHFtXxoGsTOPHHFKbqauxLuTbv9B5D1tO/MaxOBTt9MVMx8rDpVB
y0spKhfWcxJ/0Hge7G9XrFGpN4joBPHPMghM8QjS9/EL8r98m8PNQk6OIG9TNeQC
gzglQIV3K+rhFwTeeyetxDozAgMBAAGjgYAwfjAMBgNVHRMBAf8EAjAAMB0GA1Ud
JQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAPBgNVHQ8BAf8EBQMDB6AAMB0GA1Ud
DgQWBBQ3rDq/2kYOFskMD0lHFG+g2Ej/2zAfBgNVHSMEGDAWgBSwn2czLIiIiR9E
YnSdJf/ABhNd1jANBgkqhkiG9w0BAQsFAAOCAYEARbJDuWZiqwA/CU9Eh99POTOk
fnWdog8tLaOPLFS5mCiLNDmTXX14syAAjhbRrJ+43j1HWXbgovzDqzFtQzbztCMB
qpxQy3d3R9nUKv6NpNT/IO84OcYuiMtRGr/AaVqc2PZlFirBqlQkxFUxiDc2pIhy
h2orOJrPu3jSQdWI1PDT6oWKCwHdU+obqh+NmRWwjetpmeJ5r/kgAlZJ1krlNPJU
V3U/J9WTdOYMhLcn4RcNOTAyrmxOoTEIOcqkXzJOypbkMcZic+OHCaDohUsfdOkB
Xxz+6nP4xqnOcyHBLNTjVVrnr+wyqsWA18HoyLiCluf946S6mVoXcxwvWHzz7VVm
qHVppLVD/iOJxtl4bm8YEYjO4C1IPxWOCszG4N71Reyo/+p1UJ8Ww6IAgJj0jX2l
L7pqCwZKXhd8+LT05dZr7YJV/EjmGV/pL6IU3RAk6s2BqgtTkvy5nnmSPjBFuxG/
gUBfaglsXC6w6R1aMVr9m3E1ht4vOPu9Qx7E21oG
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ossl-server-certchain.pem 0000644 0001750 0001750 00000006326 13720663520 016730 -----BEGIN CERTIFICATE-----
MIIEmjCCAwKgAwIBAgIIXBegQDWsgowwDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMCAXDTE4MTIxNzEzMTAyNloYDzIxMTgxMTIzMTMxMDI4WjBR
MQ8wDQYDVQQLEwZTb21lT1UxEDAOBgNVBAoTB1NvbWVPcmcxEjAQBgNVBAcTCVNv
bWV3aGVyZTELMAkGA1UECBMCQ0ExCzAJBgNVBAYTAlVTMIIBojANBgkqhkiG9w0B
AQEFAAOCAY8AMIIBigKCAYEAvYhZDSdPcxBgjF+sgQZ10YPuIXIzoiq4G943OGFX
EdMc0kdaVQcCKkR4raPMR0wKs57akpiN5CrU1HvkwYZbTNB/BpyhUuZnx2qjTRyO
pB71k62z7HP3KAI/GYfEMX5DNPS0X3B7chkAT4Sk1Xdn3WjW3BVt3GK4XdWmG2M0
cmsYaFvijFJDi6Fs8fy/5sG2x+WBwct1Kt8HnjfR+nh00YhgiqOdX1jOrDN29XHk
n4GIEm/BRQRQ0/PoOa6VWGVVxu+8sfmM7IJ8kC5/QII3PFZCplqPnxFYd3C0Wa6v
au+tYisJ9B5CB/fn9ars7H6nFMc1D38G/sVkspdJrFuFbQLElkH7ydxBZBv3O+fl
Iomav/+JL1PiNHFtXxoGsTOPHHFKbqauxLuTbv9B5D1tO/MaxOBTt9MVMx8rDpVB
y0spKhfWcxJ/0Hge7G9XrFGpN4joBPHPMghM8QjS9/EL8r98m8PNQk6OIG9TNeQC
gzglQIV3K+rhFwTeeyetxDozAgMBAAGjgYAwfjAMBgNVHRMBAf8EAjAAMB0GA1Ud
JQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAPBgNVHQ8BAf8EBQMDB6AAMB0GA1Ud
DgQWBBQ3rDq/2kYOFskMD0lHFG+g2Ej/2zAfBgNVHSMEGDAWgBSwn2czLIiIiR9E
YnSdJf/ABhNd1jANBgkqhkiG9w0BAQsFAAOCAYEARbJDuWZiqwA/CU9Eh99POTOk
fnWdog8tLaOPLFS5mCiLNDmTXX14syAAjhbRrJ+43j1HWXbgovzDqzFtQzbztCMB
qpxQy3d3R9nUKv6NpNT/IO84OcYuiMtRGr/AaVqc2PZlFirBqlQkxFUxiDc2pIhy
h2orOJrPu3jSQdWI1PDT6oWKCwHdU+obqh+NmRWwjetpmeJ5r/kgAlZJ1krlNPJU
V3U/J9WTdOYMhLcn4RcNOTAyrmxOoTEIOcqkXzJOypbkMcZic+OHCaDohUsfdOkB
Xxz+6nP4xqnOcyHBLNTjVVrnr+wyqsWA18HoyLiCluf946S6mVoXcxwvWHzz7VVm
qHVppLVD/iOJxtl4bm8YEYjO4C1IPxWOCszG4N71Reyo/+p1UJ8Ww6IAgJj0jX2l
L7pqCwZKXhd8+LT05dZr7YJV/EjmGV/pL6IU3RAk6s2BqgtTkvy5nnmSPjBFuxG/
gUBfaglsXC6w6R1aMVr9m3E1ht4vOPu9Qx7E21oG
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEiDCCAvCgAwIBAgIIXBeb1iWItcgwDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMCAXDTE4MTIxNzEyNTEzNVoYDzIxMTgxMTIzMTI1MTUwWjBE
MREwDwYDVQQDEwhzb21lTmFtZTEQMA4GA1UECxMHcnN5c2xvZzEQMA4GA1UEChMH
U29tZU9yZzELMAkGA1UEBhMCVVMwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGK
AoIBgQChCwzkraL2v9SFAY3WD1au6cRCSaqrgC/5cecwzGBum0njlO4kmUkI5G4g
1cwTtXqcmTh17EKaHlBFougnH5JZdDFmKpOIp4odACl5uuT5J1lRh6lsOyVq9X0h
qp9qfjn1rrn7XfLk9i9+or0/iLK2megmU5ZUX6pNpoKaGeLBl4CeiiiqdaUeyGK8
YKQksx/0zdeWb04Yp+zHIddcGoGAx88zf94onJQESsVOn1yG3sGM7rhfvOHDLGJ4
flE+1ww8D6rZZci6D4bYhfA1bpiRwsU3UILginUVpfbMn+W6f2s+Cq0dbiQza0lf
+S2rK+7cH+4z9ltqA054B2/JPuNKbwf3lLoabGNWu47TCfyzaDUb7Y70CFRrYfkN
4pD5y+Z838IH87RKJioh5q2ceVX5pyNv8XmkMuvWYDrnjVTnX7Q0fN/T6h8fVTIp
lojlgV8z2tPcrJE0M4Y67nSAgYX7v2AtmcoBPML5Sairzq5apiljb0Wm5KSNwXZ2
eAz9nTsCAwEAAaN8MHowDwYDVR0TAQH/BAUwAwEB/zBIBgNVHREEQTA/ghNzb21l
b25lQGV4YW1wbGUubmV0ghNzb21lb25lQGV4YW1wbGUubmV0gRNzb21lb25lQGV4
YW1wbGUubmV0MB0GA1UdDgQWBBSwn2czLIiIiR9EYnSdJf/ABhNd1jANBgkqhkiG
9w0BAQsFAAOCAYEAl6nIgBHMX8rnAC054xx/aQcXazrv89KyEp0ydzBwJQOTei7I
UGWQIRkSLL+CtrGhcLPQpTzAQn5NDo4ayinAtlPtP8MYcMBv13ZBJXLSqRfrTM04
wkEbsWuCp+c/fU14E+QYSk4AwpoUdQeqmdM60KAoHNn+BaHGJRhRGOY9A8hfQQ5L
S2TpJ+suJuHafNjr9vvhlqTSefCfENV40Ie1nwHCbqNZdDZel1iQBmdI7WJG7uTI
OrSOPepYzOAYKQ+PWKMvZuzBc6ei/lcIpPHksWxK7nY35izSHjepMLGqH0/XZ51i
wN55slw9agg5eCq/zL/+Ebu7+yub8JhA9D4pgT5nBp8LtQPOIKnkVlFookjfyO8/
dWsjGnhT9RNbDUQg7Y7spTWPT7wqOmQchEvQt+x96BHq4SLe88HnTpBk2Cb370jq
QQFW6s9vwo9PjOafOkyqYsiBuuCFxT80GegBlaipDNqLYhJ1fJAdQtRtFgogqpeS
thWJZzNJeHyZSpah
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ossl-client-certchain.pem 0000644 0001750 0001750 00000006342 13720663520 016676 -----BEGIN CERTIFICATE-----
MIIEoTCCAwmgAwIBAgIIXBeg0SlsiUswDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMCAXDTE4MTIxNzEzMTI1MFoYDzIxMTgxMTIzMTMxMjUzWjBY
MRcwFQYDVQQDEw5yc3lzbG9nIGNsaWVudDERMA8GA1UECxMIU29tZVVuaXQxEDAO
BgNVBAoTB1NvbWVPcmcxCzAJBgNVBAgTAkNBMQswCQYDVQQGEwJVUzCCAaIwDQYJ
KoZIhvcNAQEBBQADggGPADCCAYoCggGBAJ2R2tguPZ2uhcPFp/akZvjIkZG4cCDc
7egjylP3uFJD86fr+9+KOyywE/pi06FTpFFxH2jZ/bw5SvvJat/ziISwgLzA9RtC
EfZMGtgsYgtdUGQwmtPbwdV/OVPkvegeBJ3JEuDkVykpAbnx5bx0pudLYeZnXGxO
7u4iDBsUbegMb+7uw7jd3xXtepZbzIXl41DEziu/tjfmIPxuRX4JvYR6rwcn9Jkj
Qd822CkxoJaEL/1FLtS0+frcjyPA4AatrQpy2vQ7ocvWpjvsRsSV8nGlrQgf5wYY
DtuAUZa6JPZkAmvT8HYBNDpyAunL0KpiUQyPg77AR5nSknLtU6VJBdTJofRN3hKd
GsgXhPOifGdHgkuGHnOG4iYmEJSjmZsImXidPTNdhcJGZZSrcLQ7wSaLEbZmJ4gi
hAO1CEUyjIEjvmLcb6CqXp8D96f1A3A8eAnQhESMGa9295P8r8b929lMyyB5RHHL
5lVhqXqvC6Om7empEa/6o12sl+fvK7aoNwIDAQABo4GAMH4wDAYDVR0TAQH/BAIw
ADAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDwYDVR0PAQH/BAUDAweg
ADAdBgNVHQ4EFgQUlBeunSFXuHvBrhB7CKkhvKEUAIswHwYDVR0jBBgwFoAUsJ9n
MyyIiIkfRGJ0nSX/wAYTXdYwDQYJKoZIhvcNAQELBQADggGBAEk9KaiQ6NzNHf7M
kvPosgCu9Tm1jgRg4qjdMHxtzDxFQZWOtMuDxqqrNEC9FEF5zpEB8Z4VtubIeVK7
6i6BdSMbI5zlnlxffPD1Gz8AKXe9BNb6UlLvlEC+58D4CJmrxDuKZXaBzy3xh2TP
Al/s5XkPBuXKc7l0qQdDkt67LfDCrwpGfseOFXNUHDREBOulwX4LJzilVqLMsp03
qMHK0f4kOxc0oJrH+2+jCgpu1QPoFOLl/6shbRw3qls/f/coWnnS5kd2NOPUf0pe
j5lBt5ThhnLQIGwJucLa6cHVx+R4BWtTz4/v8hCwWr1cUbNEkxTyBErl0l8KkpCQ
d0NCuZe2u2AJYEKdNilSiBr33ERZ70peE/ATfk6hv9ysWepeGYJiuybWXMrDtLbw
X9wzwtdetIvvMxXiNAT5RpsZtFrdBD9ZwCHhJ+xjEycRDQKdnL/H4WbpAfvB9zcJ
WCJ50FBFjNoHSYrwmhQULOYa8AjVxxrX/27g2mN3P3sDLG6bzw==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEiDCCAvCgAwIBAgIIXBeb1iWItcgwDQYJKoZIhvcNAQELBQAwRDERMA8GA1UE
AxMIc29tZU5hbWUxEDAOBgNVBAsTB3JzeXNsb2cxEDAOBgNVBAoTB1NvbWVPcmcx
CzAJBgNVBAYTAlVTMCAXDTE4MTIxNzEyNTEzNVoYDzIxMTgxMTIzMTI1MTUwWjBE
MREwDwYDVQQDEwhzb21lTmFtZTEQMA4GA1UECxMHcnN5c2xvZzEQMA4GA1UEChMH
U29tZU9yZzELMAkGA1UEBhMCVVMwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGK
AoIBgQChCwzkraL2v9SFAY3WD1au6cRCSaqrgC/5cecwzGBum0njlO4kmUkI5G4g
1cwTtXqcmTh17EKaHlBFougnH5JZdDFmKpOIp4odACl5uuT5J1lRh6lsOyVq9X0h
qp9qfjn1rrn7XfLk9i9+or0/iLK2megmU5ZUX6pNpoKaGeLBl4CeiiiqdaUeyGK8
YKQksx/0zdeWb04Yp+zHIddcGoGAx88zf94onJQESsVOn1yG3sGM7rhfvOHDLGJ4
flE+1ww8D6rZZci6D4bYhfA1bpiRwsU3UILginUVpfbMn+W6f2s+Cq0dbiQza0lf
+S2rK+7cH+4z9ltqA054B2/JPuNKbwf3lLoabGNWu47TCfyzaDUb7Y70CFRrYfkN
4pD5y+Z838IH87RKJioh5q2ceVX5pyNv8XmkMuvWYDrnjVTnX7Q0fN/T6h8fVTIp
lojlgV8z2tPcrJE0M4Y67nSAgYX7v2AtmcoBPML5Sairzq5apiljb0Wm5KSNwXZ2
eAz9nTsCAwEAAaN8MHowDwYDVR0TAQH/BAUwAwEB/zBIBgNVHREEQTA/ghNzb21l
b25lQGV4YW1wbGUubmV0ghNzb21lb25lQGV4YW1wbGUubmV0gRNzb21lb25lQGV4
YW1wbGUubmV0MB0GA1UdDgQWBBSwn2czLIiIiR9EYnSdJf/ABhNd1jANBgkqhkiG
9w0BAQsFAAOCAYEAl6nIgBHMX8rnAC054xx/aQcXazrv89KyEp0ydzBwJQOTei7I
UGWQIRkSLL+CtrGhcLPQpTzAQn5NDo4ayinAtlPtP8MYcMBv13ZBJXLSqRfrTM04
wkEbsWuCp+c/fU14E+QYSk4AwpoUdQeqmdM60KAoHNn+BaHGJRhRGOY9A8hfQQ5L
S2TpJ+suJuHafNjr9vvhlqTSefCfENV40Ie1nwHCbqNZdDZel1iQBmdI7WJG7uTI
OrSOPepYzOAYKQ+PWKMvZuzBc6ei/lcIpPHksWxK7nY35izSHjepMLGqH0/XZ51i
wN55slw9agg5eCq/zL/+Ebu7+yub8JhA9D4pgT5nBp8LtQPOIKnkVlFookjfyO8/
dWsjGnhT9RNbDUQg7Y7spTWPT7wqOmQchEvQt+x96BHq4SLe88HnTpBk2Cb370jq
QQFW6s9vwo9PjOafOkyqYsiBuuCFxT80GegBlaipDNqLYhJ1fJAdQtRtFgogqpeS
thWJZzNJeHyZSpah
-----END CERTIFICATE-----
librelp-1.13.0/tests/tls-certs/ossl-ca-key.pem 0000644 0001750 0001750 00000017752 13720663520 014642 Public Key Info:
Public Key Algorithm: RSA
Key Security Level: High (3072 bits)
modulus:
00:a1:0b:0c:e4:ad:a2:f6:bf:d4:85:01:8d:d6:0f:56
ae:e9:c4:42:49:aa:ab:80:2f:f9:71:e7:30:cc:60:6e
9b:49:e3:94:ee:24:99:49:08:e4:6e:20:d5:cc:13:b5
7a:9c:99:38:75:ec:42:9a:1e:50:45:a2:e8:27:1f:92
59:74:31:66:2a:93:88:a7:8a:1d:00:29:79:ba:e4:f9
27:59:51:87:a9:6c:3b:25:6a:f5:7d:21:aa:9f:6a:7e
39:f5:ae:b9:fb:5d:f2:e4:f6:2f:7e:a2:bd:3f:88:b2
b6:99:e8:26:53:96:54:5f:aa:4d:a6:82:9a:19:e2:c1
97:80:9e:8a:28:aa:75:a5:1e:c8:62:bc:60:a4:24:b3
1f:f4:cd:d7:96:6f:4e:18:a7:ec:c7:21:d7:5c:1a:81
80:c7:cf:33:7f:de:28:9c:94:04:4a:c5:4e:9f:5c:86
de:c1:8c:ee:b8:5f:bc:e1:c3:2c:62:78:7e:51:3e:d7
0c:3c:0f:aa:d9:65:c8:ba:0f:86:d8:85:f0:35:6e:98
91:c2:c5:37:50:82:e0:8a:75:15:a5:f6:cc:9f:e5:ba
7f:6b:3e:0a:ad:1d:6e:24:33:6b:49:5f:f9:2d:ab:2b
ee:dc:1f:ee:33:f6:5b:6a:03:4e:78:07:6f:c9:3e:e3
4a:6f:07:f7:94:ba:1a:6c:63:56:bb:8e:d3:09:fc:b3
68:35:1b:ed:8e:f4:08:54:6b:61:f9:0d:e2:90:f9:cb
e6:7c:df:c2:07:f3:b4:4a:26:2a:21:e6:ad:9c:79:55
f9:a7:23:6f:f1:79:a4:32:eb:d6:60:3a:e7:8d:54:e7
5f:b4:34:7c:df:d3:ea:1f:1f:55:32:29:96:88:e5:81
5f:33:da:d3:dc:ac:91:34:33:86:3a:ee:74:80:81:85
fb:bf:60:2d:99:ca:01:3c:c2:f9:49:a8:ab:ce:ae:5a
a6:29:63:6f:45:a6:e4:a4:8d:c1:76:76:78:0c:fd:9d
3b:
public exponent:
01:00:01:
private exponent:
00:89:fd:ca:02:78:b6:56:f0:70:cd:b7:53:2d:c4:de
e5:e9:f0:fd:4b:da:2e:32:1c:e9:85:2c:30:a8:2f:49
17:4e:ec:ef:44:4f:9f:f8:f0:e1:ab:6b:ff:46:6a:ec
ea:2f:1d:2b:40:00:3d:e1:89:70:06:fb:5c:29:89:e8
01:36:8a:cd:9c:55:e6:96:88:c5:e8:c9:a1:40:ff:ca
6e:69:1e:6f:3c:41:3d:3d:06:b5:6b:8f:59:80:57:e3
e9:0e:17:b5:cd:29:e7:63:41:7f:d8:e6:e1:7a:7b:4b
87:23:c1:c4:75:83:2e:b0:fa:60:a6:f8:e9:ca:9c:7e
7d:ae:fc:2a:2e:46:41:a0:47:0c:35:6e:6c:f0:b9:71
b3:44:34:cd:32:5e:15:71:13:12:d4:5e:af:06:80:bf
ce:f5:67:1a:1d:ca:e2:c9:a8:1b:35:66:73:c4:21:a8
7f:5f:21:bf:bb:c4:6d:38:95:e0:86:4f:f1:0c:f4:e7
96:7b:da:9e:95:7f:93:ca:96:ea:07:4f:13:52:5d:39
99:42:44:b5:a3:11:af:6e:62:a1:c9:43:6d:24:69:13
8a:62:ea:76:ae:7e:29:ef:c1:7e:a3:6e:b1:a8:71:9d
3e:1a:40:03:16:b8:a5:a5:df:b3:c0:6b:d1:7b:fd:91
e0:5b:30:d3:22:49:74:c3:ee:ca:b1:85:c9:9a:c5:8b
45:3e:c3:75:f9:0c:ee:41:2d:12:f6:98:41:d4:ea:dd
d3:89:d4:7f:01:b0:19:3b:34:30:16:16:03:d9:74:9f
4a:ba:71:59:1f:9b:7e:ee:ed:5f:c1:ec:11:38:bb:04
a6:5e:b8:e3:0f:61:e7:92:39:e3:a9:5f:ab:31:f5:2d
0c:55:f2:70:c4:25:75:ba:98:50:26:82:4e:e8:94:db
21:2c:6c:31:5c:e6:e5:65:8c:31:48:cb:98:73:1a:61
96:a2:dd:27:f8:30:54:6a:9e:19:26:77:13:be:ca:d3
a1:
prime1:
00:d4:9d:19:0c:c4:68:92:2c:4f:ab:ab:04:d0:4b:6c
3c:b3:df:59:26:f6:28:e8:85:27:2b:b9:0a:7b:d7:52
ab:90:d9:3d:bc:38:34:ad:e6:b6:e9:1a:f8:a4:ab:cf
4f:94:92:6c:a9:38:c3:ee:19:1f:4c:95:e8:80:c3:50
1d:bb:1a:41:20:03:1a:c1:e9:7a:ff:e3:f7:1d:3f:12
da:09:99:de:50:33:8c:ee:37:6e:c9:e3:aa:ec:9d:e0
84:5f:97:1b:48:cf:b3:d1:99:91:97:05:69:b5:47:20
fa:43:d8:01:bb:dc:95:a8:3b:77:d3:5d:25:31:cd:9b
01:90:22:1c:92:c6:e5:e2:09:51:42:7d:0c:70:08:25
c5:9c:b7:71:1e:96:f1:df:c9:f0:aa:e2:52:4f:32:e1
f7:76:ca:fb:6c:6a:c7:c1:22:54:45:c9:6f:3c:a7:b5
f6:7d:c7:f7:e0:09:c8:36:59:d2:a8:09:7b:11:b6:3c
af:
prime2:
00:c1:e7:eb:18:5e:4d:3c:7f:b9:16:bf:d8:ce:9f:b7
c3:6a:a0:fa:0b:64:68:20:c5:18:d1:c8:13:d5:82:24
8f:b7:5c:50:64:64:3a:8c:25:cc:71:21:79:ba:74:34
16:56:6c:3d:4b:60:1e:2c:83:88:51:d4:76:61:57:5a
12:83:3c:67:6e:09:c5:74:27:fd:64:af:46:a2:09:41
9c:95:a1:cd:9d:86:14:29:69:28:a6:88:c3:71:9b:ac
a9:94:1e:df:10:78:f1:ec:30:46:95:9c:58:bf:7f:1e
55:a6:3c:14:24:8f:9f:d3:97:3a:b8:cb:82:8c:c7:a9
49:5b:20:5a:ae:f3:20:b3:e5:e7:2e:e1:17:02:57:c5
f9:bf:68:10:74:6c:69:7b:55:ad:6b:58:f8:13:33:d1
85:96:e0:96:d8:e3:6f:79:77:f3:17:b0:7a:02:81:16
6e:55:23:65:10:90:90:0b:6e:5b:cb:3b:cc:6e:83:03
35:
coefficient:
46:d5:f1:79:c7:d6:70:c2:eb:9b:fd:12:0a:53:b9:54
60:14:e0:33:3b:ab:41:71:ac:2a:51:12:b3:87:ad:98
9e:a9:ac:b4:6d:b5:02:4d:1e:b2:e5:fe:76:e5:8c:c1
cb:60:0e:f3:76:77:be:e1:51:86:f1:9e:ae:c0:d9:78
3c:7a:c0:b6:02:75:dc:21:cf:d0:bc:fe:fa:34:33:a1
1a:a6:cf:7d:27:cc:d7:46:46:f0:8f:9d:31:4d:cf:78
ec:15:6a:6f:64:18:24:04:65:b7:bc:58:0d:1c:35:3c
16:e3:2d:f5:e0:13:64:a2:44:8c:4a:34:54:ab:23:4e
fd:01:3c:01:7d:87:5b:5a:16:ce:c8:b8:05:bf:74:ea
b5:94:77:23:1b:2d:33:55:c3:a2:e0:b7:a4:28:be:81
ac:f0:63:d3:28:b7:01:b9:4c:03:aa:d1:d1:d1:36:2a
99:1d:93:ac:ea:da:66:fb:7e:97:d3:bf:d2:b0:92:a0
exp1:
7f:2e:76:44:97:dc:c1:cb:b5:e0:c7:cd:7a:58:13:a8
00:25:13:ac:65:c5:b4:c9:a9:d3:d2:bd:bd:b4:e1:23
f5:e2:ad:b6:40:9c:ea:85:bf:56:93:a6:b6:c2:7b:a1
6c:0b:66:ea:97:25:44:f1:4c:32:c0:dd:b2:e0:a2:b5
16:2e:2f:54:d9:e6:90:a6:7c:c8:43:72:97:d1:1a:12
c9:79:7c:6d:d7:58:6f:4b:43:7f:8b:2b:bc:9c:f8:27
d7:12:89:e4:b5:32:28:a8:47:59:e2:88:08:43:43:2b
d1:97:8d:f9:f5:8a:a4:76:e6:47:ce:49:28:90:88:2f
98:2b:7f:92:21:5e:74:27:04:af:d4:23:b3:84:7c:2b
c8:82:47:2d:78:37:b9:99:8f:d8:78:c7:a9:ce:93:33
37:a1:56:62:d5:41:26:7b:c5:93:75:5a:90:1a:f6:93
3b:4c:7a:2f:4f:4a:af:90:6d:9d:cd:06:0c:63:49:cb
exp2:
4e:2c:e8:55:7c:bf:7a:e2:ab:86:86:76:2c:67:ac:38
b6:e6:8b:a8:c8:24:4b:01:eb:8d:b8:32:76:e3:ef:45
99:d1:38:00:21:80:91:3c:33:fe:70:56:99:5b:7c:1c
7d:5f:4a:1e:f7:73:72:d2:dc:c4:d0:f9:a1:29:0c:81
66:33:96:27:80:fd:00:65:96:fd:5e:c5:05:52:e2:06
f5:34:b4:a7:0b:85:59:64:b2:24:e2:02:99:ec:ff:61
a6:fc:03:46:aa:dc:2e:33:10:62:05:14:aa:af:df:54
fc:9e:40:28:b5:56:e4:81:96:05:26:d7:4d:56:b9:e3
7f:3f:be:0f:c6:a9:aa:9d:c7:e4:d8:8e:e4:3c:ea:ee
53:c2:ea:cf:65:5d:e9:81:93:57:32:19:61:f4:84:46
6d:9b:c2:75:52:cc:80:96:61:85:6d:7a:e3:43:93:fd
8b:89:a7:97:54:11:1e:ea:b1:4b:70:a2:6c:f3:98:f9
Public Key PIN:
pin-sha256:3cQAkiO2zLPAa/Tawzz/iqD5XAly2f+6m0f1OwppO8w=
Public Key ID:
sha256:ddc4009223b6ccb3c06bf4dac33cff8aa0f95c0972d9ffba9b47f53b0a693bcc
sha1:b09f67332c8888891f4462749d25ffc006135dd6
-----BEGIN RSA PRIVATE KEY-----
MIIG4wIBAAKCAYEAoQsM5K2i9r/UhQGN1g9WrunEQkmqq4Av+XHnMMxgbptJ45Tu
JJlJCORuINXME7V6nJk4dexCmh5QRaLoJx+SWXQxZiqTiKeKHQApebrk+SdZUYep
bDslavV9Iaqfan459a65+13y5PYvfqK9P4iytpnoJlOWVF+qTaaCmhniwZeAnooo
qnWlHshivGCkJLMf9M3Xlm9OGKfsxyHXXBqBgMfPM3/eKJyUBErFTp9cht7BjO64
X7zhwyxieH5RPtcMPA+q2WXIug+G2IXwNW6YkcLFN1CC4Ip1FaX2zJ/lun9rPgqt
HW4kM2tJX/ktqyvu3B/uM/ZbagNOeAdvyT7jSm8H95S6GmxjVruO0wn8s2g1G+2O
9AhUa2H5DeKQ+cvmfN/CB/O0SiYqIeatnHlV+acjb/F5pDLr1mA6541U51+0NHzf
0+ofH1UyKZaI5YFfM9rT3KyRNDOGOu50gIGF+79gLZnKATzC+Umoq86uWqYpY29F
puSkjcF2dngM/Z07AgMBAAECggGBAIn9ygJ4tlbwcM23Uy3E3uXp8P1L2i4yHOmF
LDCoL0kXTuzvRE+f+PDhq2v/Rmrs6i8dK0AAPeGJcAb7XCmJ6AE2is2cVeaWiMXo
yaFA/8puaR5vPEE9PQa1a49ZgFfj6Q4Xtc0p52NBf9jm4Xp7S4cjwcR1gy6w+mCm
+OnKnH59rvwqLkZBoEcMNW5s8Llxs0Q0zTJeFXETEtRerwaAv871ZxodyuLJqBs1
ZnPEIah/XyG/u8RtOJXghk/xDPTnlnvanpV/k8qW6gdPE1JdOZlCRLWjEa9uYqHJ
Q20kaROKYup2rn4p78F+o26xqHGdPhpAAxa4paXfs8Br0Xv9keBbMNMiSXTD7sqx
hcmaxYtFPsN1+QzuQS0S9phB1Ord04nUfwGwGTs0MBYWA9l0n0q6cVkfm37u7V/B
7BE4uwSmXrjjD2HnkjnjqV+rMfUtDFXycMQldbqYUCaCTuiU2yEsbDFc5uVljDFI
y5hzGmGWot0n+DBUap4ZJncTvsrToQKBwQDUnRkMxGiSLE+rqwTQS2w8s99ZJvYo
6IUnK7kKe9dSq5DZPbw4NK3mtuka+KSrz0+UkmypOMPuGR9MleiAw1AduxpBIAMa
wel6/+P3HT8S2gmZ3lAzjO43bsnjquyd4IRflxtIz7PRmZGXBWm1RyD6Q9gBu9yV
qDt3010lMc2bAZAiHJLG5eIJUUJ9DHAIJcWct3EelvHfyfCq4lJPMuH3dsr7bGrH
wSJURclvPKe19n3H9+AJyDZZ0qgJexG2PK8CgcEAwefrGF5NPH+5Fr/Yzp+3w2qg
+gtkaCDFGNHIE9WCJI+3XFBkZDqMJcxxIXm6dDQWVmw9S2AeLIOIUdR2YVdaEoM8
Z24JxXQn/WSvRqIJQZyVoc2dhhQpaSimiMNxm6yplB7fEHjx7DBGlZxYv38eVaY8
FCSPn9OXOrjLgozHqUlbIFqu8yCz5ecu4RcCV8X5v2gQdGxpe1Wta1j4EzPRhZbg
ltjjb3l38xewegKBFm5VI2UQkJALblvLO8xugwM1AoHAfy52RJfcwcu14MfNelgT
qAAlE6xlxbTJqdPSvb204SP14q22QJzqhb9Wk6a2wnuhbAtm6pclRPFMMsDdsuCi
tRYuL1TZ5pCmfMhDcpfRGhLJeXxt11hvS0N/iyu8nPgn1xKJ5LUyKKhHWeKICEND
K9GXjfn1iqR25kfOSSiQiC+YK3+SIV50JwSv1COzhHwryIJHLXg3uZmP2HjHqc6T
MzehVmLVQSZ7xZN1WpAa9pM7THovT0qvkG2dzQYMY0nLAoHATizoVXy/euKrhoZ2
LGesOLbmi6jIJEsB6424Mnbj70WZ0TgAIYCRPDP+cFaZW3wcfV9KHvdzctLcxND5
oSkMgWYzlieA/QBllv1exQVS4gb1NLSnC4VZZLIk4gKZ7P9hpvwDRqrcLjMQYgUU
qq/fVPyeQCi1VuSBlgUm101WueN/P74Pxqmqncfk2I7kPOruU8Lqz2Vd6YGTVzIZ
YfSERm2bwnVSzICWYYVteuNDk/2LiaeXVBEe6rFLcKJs85j5AoHARtXxecfWcMLr
m/0SClO5VGAU4DM7q0FxrCpRErOHrZieqay0bbUCTR6y5f525YzBy2AO83Z3vuFR
hvGersDZeDx6wLYCddwhz9C8/vo0M6Eaps99J8zXRkbwj50xTc947BVqb2QYJARl
t7xYDRw1PBbjLfXgE2SiRIxKNFSrI079ATwBfYdbWhbOyLgFv3TqtZR3IxstM1XD
ouC3pCi+gazwY9MotwG5TAOq0dHRNiqZHZOs6tpm+36X07/SsJKg
-----END RSA PRIVATE KEY-----
librelp-1.13.0/tests/receive.c 0000664 0001750 0001750 00000034240 15241030422 011634 /* A RELP receiver for testing.
*
* Copyright 2014 Mathias Nyman
* Copyright 2018 Adiscon GmbH
*
* See getopt() call below for command line options. There is a brief
* (buf hopefully sufficient) comment describing what each option does.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include
#include
#include
#include
#include
#if defined(_AIX)
# include
#else
# include
#endif
#include
#include
#include
#include
#include
#include "librelp.h"
#define TRY(f) { const int TRY_r = f; if(TRY_r != RELP_RET_OK) { \
fprintf(stderr, "receive: FAILURE %d in '%s'\n", TRY_r, #f); ret = 1; goto done; }\
}
static FILE *errFile = NULL;
static FILE *outFile = NULL;
static FILE *sessFile = NULL;
static char *pidFileName = NULL;
static int immediate_exit = 0; /* if set to 1, force-exit as soon as possible */
static relpEngine_t *pRelpEngine;
#define USR_MAGIC 0x1234FFee
struct usrdata { /* used for testing user pointer pass-back */
int magic;
char *progname;
};
struct usrdata *userdata = NULL;
/* a portable way to put the current thread asleep. Note that
* we cannot use sleep() as we need alarm() and both together
* are NOT guaranteed to work.
*/
static void
doSleep(int iSeconds, const int iuSeconds)
{
struct timeval tvSelectTimeout;
tvSelectTimeout.tv_sec = iSeconds;
tvSelectTimeout.tv_usec = iuSeconds; /* micro seconds */
select(0, NULL, NULL, NULL, &tvSelectTimeout);
}
static void
hdlr_enable(int sig, void (*hdlr)(const int))
{
struct sigaction sigAct;
memset(&sigAct, 0, sizeof (sigAct));
sigemptyset(&sigAct.sa_mask);
sigAct.sa_handler = hdlr;
sigaction(sig, &sigAct, NULL);
}
static void
terminate(LIBRELP_ATTR_UNUSED const int sig)
{
relpEngineSetStop(pRelpEngine);
}
/* This guards us against leaving hanging instances in testbench runs.
* This method is to be "called" via ALARM after more time has expired
* then "ever possible" - so we are sure we just need to cleanup.
*/
static void LIBRELP_ATTR_NORETURN
watchdog_expired(LIBRELP_ATTR_UNUSED const int sig)
{
fprintf(stderr, "receive: watchdog timer expired, assuming we hang - "
"force terminating run\n");
fflush(stderr);
exit(100);
}
/* handler for unexpected signals. */
static void LIBRELP_ATTR_NORETURN
do_signal(const int sig)
{
fprintf(stderr, "receive: UNEXPECTED SIGNAL %d%s- terminating\n", sig,
sig == SIGPIPE ? " [SIGPIPE]" : "");
fflush(stderr);
exit(100);
}
/* handler to unconditionally exit the code - required for test where
* server must "suddenly" abort.
*/
static void
do_exit(LIBRELP_ATTR_UNUSED const int sig)
{
immediate_exit = 1;
}
static void LIBRELP_ATTR_FORMAT(printf, 1, 2)
dbgprintf(char *fmt, ...)
{
va_list ap;
char pszWriteBuf[32*1024+1];
va_start(ap, fmt);
vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap);
va_end(ap);
fprintf(stderr, "receive: %s", pszWriteBuf);
fflush(stderr);
}
static relpRetVal onSyslogRcv(unsigned char *pHostname LIBRELP_ATTR_UNUSED,
unsigned char *pIP LIBRELP_ATTR_UNUSED, unsigned char *msg,
size_t lenMsg)
{
char *pMsg;
pMsg = (char *) malloc((int)lenMsg+1);
memset(pMsg, '\0', lenMsg+1);
memcpy(pMsg, msg, lenMsg);
fprintf(outFile, "%s\n", pMsg);
fflush(outFile);
free(pMsg);
if(immediate_exit) {
fprintf(stderr, "receive: force-exit %lld by user request\n", (long long) getpid());
exit(1);
}
return RELP_RET_OK;
}
static void print_usage(void)
{
printf("Usage: ./receive -p \n");
}
static void
onErr(void *pUsr, char *objinfo, char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
{
struct usrdata *pThis = (struct usrdata*) pUsr;
if(pUsr != NULL) {
if(pUsr != userdata) {
fprintf(stderr, "receive: pUsr %p NOT pointing to userdata %p!\n", pUsr, (void*)userdata);
}
if(pThis->magic != USR_MAGIC) {
fprintf(stderr, "receive: pUsr magic incorrect in onErr, magic %8.8x "
"pUsr %p\n", pThis->magic, (void*) pThis);
}
fprintf(stderr, "%s: error '%s', object '%s'\n", pThis->progname, errmesg, objinfo);
} else {
fprintf(stderr, "receive: [pUsr==NULL] error '%s', object '%s'\n", errmesg, objinfo);
}
if(errFile != NULL) {
fprintf(errFile, "receive: error '%s', object '%s'\n", errmesg, objinfo);
}
}
static void
onGenericErr(char *objinfo, char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
{
fprintf(stderr, "receive: librelp error '%s', object '%s'\n", errmesg, objinfo);
if(errFile != NULL) {
fprintf(errFile, "receive: librelp error '%s', object '%s'\n", errmesg, objinfo);
}
}
static void
onAuthErr(LIBRELP_ATTR_UNUSED void *pUsr, char *authinfo,
char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
{
fprintf(stderr, "receive: authentication error '%s', object '%s'\n", errmesg, authinfo);
if(errFile != NULL) {
fprintf(errFile, "receive: authentication error '%s', object '%s'\n", errmesg, authinfo);
}
}
static void
onSessOpen(void *pUsr, LIBRELP_ATTR_UNUSED const relpSess_t *pSess)
{
if(sessFile == NULL) {
return;
}
if(pUsr != NULL && pUsr != userdata) {
fprintf(sessFile, "receive: session opened with unexpected pUsr %p\n", pUsr);
} else {
fprintf(sessFile, "receive: session opened\n");
}
fflush(sessFile);
}
static void
onSessClose(void *pUsr, LIBRELP_ATTR_UNUSED const relpSess_t *pSess, relpRetVal reason)
{
if(sessFile == NULL) {
return;
}
if(pUsr != NULL && pUsr != userdata) {
fprintf(sessFile, "receive: session closed reason=%d unexpected pUsr %p\n", reason, pUsr);
} else {
fprintf(sessFile, "receive: session closed reason=%d\n", reason);
}
fflush(sessFile);
}
static void
onSessOpenFail(void *pUsr, LIBRELP_ATTR_UNUSED const relpSess_t *pSess, relpRetVal reason)
{
if(sessFile == NULL) {
return;
}
if(pUsr != NULL && pUsr != userdata) {
fprintf(sessFile, "receive: session open failed reason=%d unexpected pUsr %p\n", reason, pUsr);
} else {
fprintf(sessFile, "receive: session open failed reason=%d\n", reason);
}
fflush(sessFile);
}
static void
exit_hdlr(void)
{
fprintf(stderr, "receive: EXIT HDLR\n");
if(userdata != NULL) {
free(userdata->progname);
free(userdata);
}
if(errFile != NULL) {
fclose(errFile);
}
if(outFile != NULL) {
fclose(outFile);
}
if(sessFile != NULL) {
fclose(sessFile);
}
if(pidFileName != NULL) {
unlink(pidFileName);
}
}
int main(int argc, char *argv[]) {
int c;
int option_index = 0;
unsigned char *port = NULL;
int verbose = 0;
int protFamily = 2; /* IPv4=2, IPv6=10 */
relpSrv_t *pRelpSrv;
int bEnableTLS = 0;
char *caCertFile = NULL;
char *myCertFile = NULL;
char *myPrivKeyFile = NULL;
char *tlsConfigCmd = NULL;
char *permittedPeer = NULL;
char *authMode = NULL;
int maxDataSize = 0;
int oversizeMode = 0;
int ret = 0;
int append_outfile = 0;
int watchdog_timeout = 60; /* one seconds looks like a good default */
int no_exit_on_err = 0;
int i = 0;
const char *tlslib = NULL;
const char* outfile_name = NULL;
#if defined(_AIX)
while((c = getopt(argc, argv, "a:c:Ae:F:l:m:No:O:P:p:TvW:C:x:y:z:")) != EOF) {
#else
static struct option long_options[] =
{
{"ca", required_argument, 0, 'x'},
{"cert", required_argument, 0, 'y'},
{"key", required_argument, 0, 'z'},
{"peer", required_argument, 0, 'P'},
{"authmode", required_argument, 0, 'a'},
{"pidfile", required_argument, 0, 'F'},
{"errorfile", required_argument, 0, 'e'},
{"sessfile", required_argument, 0, 'C'},
{"outfile", required_argument, 0, 'O'},
{"append-outfile", no_argument, 0, 'A'},
{"tls-lib", required_argument, 0, 'l'},
{"tlsconfcmd", required_argument, 0, 'c'},
{"watchdog-timeout", required_argument, 0, 'W'},
{"no-exit-on-error", no_argument, 0, 'N'},
{0, 0, 0, 0}
};
while((c = getopt_long(argc, argv, "a:c:Ae:F:l:m:No:O:P:p:TvW:C:x:y:z:", long_options, &option_index)) != -1) {
#endif
switch(c) {
case 'a':
authMode = optarg;
break;
case 'A':
append_outfile = 1;
break;
case 'c':
tlsConfigCmd = optarg;
break;
case 'C':
if((sessFile = fopen((char*) optarg, "w")) == NULL) {
perror(optarg);
fprintf(stderr, "receive: error opening session callback file\n");
exit(1);
}
break;
case 'e':
if((errFile = fopen((char*) optarg, "w")) == NULL) {
perror(optarg);
fprintf(stderr, "receive: error opening error file\n");
exit(1);
}
break;
case 'v':
verbose = 1;
break;
case 'F': /* pid file name */
pidFileName = optarg;
break;
case 'l': /* tls lib */
tlslib = optarg;
break;
case 'm': /* message size */
maxDataSize = atoi(optarg);
if(maxDataSize < 128) {
printf("maxMessageSize tried to set to %d, "
"but cannot be less than 128 - set "
"to 128 instead\n", maxDataSize);
maxDataSize = 128;
} else if(maxDataSize > INT_MAX) {
printf("maxMessageSize tried to set to %d, "
"but cannot be more than INT_MAX - set "
"to INT_MAX instead\n", maxDataSize);
maxDataSize = INT_MAX;
}
break;
case 'O': /* output file */
outfile_name = optarg;
break;
case 'o': /* oversize mode */
if(strcmp("truncate", optarg) == 0) {
oversizeMode = RELP_OVERSIZE_TRUNCATE;
} else if(strcmp("abort", optarg) == 0) {
oversizeMode = RELP_OVERSIZE_ABORT;
} else if(strcmp("accept", optarg) == 0) {
oversizeMode = RELP_OVERSIZE_ACCEPT;
} else {
printf("Wrong oversizeMode, default used.\n");
}
break;
case 'P':
permittedPeer = optarg;
break;
case 'p':
port = (unsigned char*)optarg;
break;
case 'W':
watchdog_timeout = atoi(optarg);
printf("receive: watchdog timeout is %d seconds\n", watchdog_timeout);
break;
case 'T':
bEnableTLS = 1;
break;
case 'x':
caCertFile = optarg;
break;
case 'y':
myCertFile = optarg;
break;
case 'z':
myPrivKeyFile = optarg;
break;
case 'N':
no_exit_on_err = 1;
break;
default:
print_usage();
return -1;
}
}
atexit(exit_hdlr);
if(outFile == NULL) {
outFile = stdout;
}
if(port == NULL) {
printf("Port is missing\n");
print_usage();
goto done;
}
if(authMode != NULL) {
if( (strcasecmp(authMode, "certvalid") != 0 && permittedPeer == NULL) ||
myCertFile == NULL || myPrivKeyFile == NULL) {
fprintf(stderr, "receive: mode '%s' parameter missing; certificates and "
"permittedPeer required\n", authMode);
goto done;
}
}
if(caCertFile != NULL || myCertFile != NULL || myPrivKeyFile != NULL) {
if(bEnableTLS == 0) {
fprintf(stderr, "receive: Certificates were specified, but TLS was "
"not enabled! Will continue without TLS. To enable "
"it use parameter \"-T\"\n");
goto done;
}
}
if(tlsConfigCmd != NULL) {
if(bEnableTLS == 0) {
fprintf(stderr, "receive: tls config command were specified, but TLS was "
"not enabled! Will continue without TLS. To enable "
"it use parameter \"-T\"\n");
goto done;
}
}
if (no_exit_on_err == 0) {
hdlr_enable(SIGPIPE, do_signal);
} else {
signal(SIGPIPE, SIG_IGN);
}
hdlr_enable(SIGUSR1, do_exit);
hdlr_enable(SIGTERM, terminate);
hdlr_enable(SIGALRM, watchdog_expired);
if(outfile_name != NULL) {
if((outFile = fopen(outfile_name, append_outfile ? "a" : "w")) == NULL) {
perror(outfile_name);
fprintf(stderr, "receive: error opening output file\n");
exit(1);
}
}
alarm(watchdog_timeout);
TRY(relpEngineConstruct(&pRelpEngine));
TRY(relpEngineSetDbgprint(pRelpEngine, verbose ? dbgprintf : NULL));
TRY(relpEngineSetOnErr(pRelpEngine, onErr));
TRY(relpEngineSetOnGenericErr(pRelpEngine, onGenericErr));
TRY(relpEngineSetOnAuthErr(pRelpEngine, onAuthErr));
TRY(relpEngineSetOnSessOpen(pRelpEngine, onSessOpen));
TRY(relpEngineSetOnSessClose(pRelpEngine, onSessClose));
TRY(relpEngineSetOnSessOpenFail(pRelpEngine, onSessOpenFail));
if(tlslib != NULL) {
TRY(relpEngineSetTLSLibByName(pRelpEngine, tlslib));
}
TRY(relpEngineSetEnableCmd(pRelpEngine, (unsigned char*) "syslog", eRelpCmdState_Required));
TRY(relpEngineSetFamily(pRelpEngine, protFamily));
TRY(relpEngineSetSyslogRcv(pRelpEngine, onSyslogRcv));
TRY(relpEngineSetDnsLookupMode(pRelpEngine, 0)); /* 0=disable */
TRY(relpEngineListnerConstruct(pRelpEngine, &pRelpSrv));
// Create userdata pointer as soon as possible for error callbacks
userdata = calloc(1, sizeof(struct usrdata));
userdata->magic = USR_MAGIC;
userdata->progname = strdup("receive");
relpSrvSetUsrPtr(pRelpSrv, userdata);
TRY(relpSrvSetLstnPort(pRelpSrv, port));
if(maxDataSize != 0) {
TRY(relpSrvSetMaxDataSize(pRelpSrv, maxDataSize));
}
if(oversizeMode != 0) {
TRY(relpSrvSetOversizeMode(pRelpSrv, oversizeMode));
}
if(bEnableTLS) {
TRY(relpSrvEnableTLS2(pRelpSrv));
TRY(relpSrvSetTlsConfigCmd(pRelpSrv, tlsConfigCmd));
if(authMode != NULL) {
TRY(relpSrvSetAuthMode(pRelpSrv, authMode));
TRY(relpSrvSetCACert(pRelpSrv, caCertFile));
TRY(relpSrvSetOwnCert(pRelpSrv, myCertFile));
TRY(relpSrvSetPrivKey(pRelpSrv, myPrivKeyFile));
if (permittedPeer != NULL) {
TRY(relpSrvAddPermittedPeer(pRelpSrv, permittedPeer));
}
}
}
TRY(relpEngineListnerConstructFinalize(pRelpEngine, pRelpSrv));
if(pidFileName != NULL) {
FILE *fp;
if((fp = fopen((char*) pidFileName, "w")) == NULL) {
fprintf(stderr, "receive: couldn't open PidFile\n");
if(errFile != NULL) {
fprintf(errFile, "receive: couldn't open PidFile\n");
}
ret = 1;
goto done;
}
if(fprintf(fp, "%d", getpid()) < 0) {
fprintf(stderr, "receive: couldn't write to PidFile\n");
if(errFile != NULL) {
fprintf(errFile, "receive: couldn't write to PidFile\n");
}
ret = 1;
goto done;
}
fclose(fp);
}
while(relpEngineRun(pRelpEngine) != RELP_RET_OK) {
fprintf(stderr, "receive: error starting relp engine, try %d\n", i);
++i;
if(i >= 10) {
fprintf(stderr, "receive: giving up starting relp engine\n");
break;
}
doSleep(1, 0);
}
TRY(relpEngineDestruct(&pRelpEngine));
done:
return ret;
}
librelp-1.13.0/tests/tls-basic-vg.sh 0000775 0001750 0001750 00000002151 15241030422 012674 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
check_command_available valgrind
if [ "$VALGRIND" == "NO" ] ; then
echo "valgrind tests are not permitted by environment config"
exit 77
fi
export valgrind="$valgrind --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite --error-exitcode=10"
if [ $(uname) = "SunOS" ] ; then
echo "This test currently does not work on all flavors of Solaris."
exit 77
fi
if [ $(uname) = "FreeBSD" ] ; then
echo "This test currently does not work on FreeBSD."
exit 77
fi
function actual_test() {
startup_receiver_valgrind -l $TEST_TLS_LIB -T -a "name" -e error.out.log -O $OUTFILE \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P "rsyslog-client"
echo 'Send Message...'
libtool --mode=execute $valgrind \
./send -l $TEST_TLS_LIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T \
-a "name" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P "rsyslog-client" $OPT_VERBOSE
stop_receiver
check_output "testmessage"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/tls-ossl-fd-reuse.sh 0000775 0001750 0001750 00000000040 15241030422 013664 #!/bin/bash
./tls_ossl_fd_reuse
librelp-1.13.0/tests/test-framework.sh 0000664 0001750 0001750 00000015632 14354536317 013402 #!/bin/bash
# This file contains the test framework, that is common code
# used by all tests.
# Copyright (C) 2018 by Rainer Gerhards
# "config settings" for the testbench
TB_TIMEOUT_STARTUP=400 # 40 seconds - Solaris sometimes needs this...
export LIBRELP_DYN="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head --bytes 4)"
export valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1"
# **** use the line below for very hard to find leaks! *****
# export valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1 --leak-check=full --show-leak-kinds=all"
# export OPT_VERBOSE=-v # uncomment for debugging
source set-envvars
######################################################################
# functions
######################################################################
# finds a free port that we can bind a listener to
# Obviously, any solution is race as another process could start
# just after us and grab the same port. However, in practice it seems
# to work pretty well. In any case, we should probably call this as
# late as possible before the usage of the port.
get_free_port() {
$PYTHON -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'
}
# check if command $1 is available - will exit 77 when not OK
check_command_available() {
have_cmd=0
if [ "$1" == "timeout" ]; then
if timeout --version &>/dev/null ; then
have_cmd=1
fi
else
if command -v $1 ; then
have_cmd=1
fi
fi
if [ $have_cmd -eq 0 ] ; then
printf 'Testbench requires unavailable command: %s\n' "$1"
exit 77 # do NOT error_exit here!
fi
}
# $1 is name of pidfile to wait for
wait_process_startup_via_pidfile() {
i=0
while test ! -f $1 ; do
./msleep 100
(( i++ ))
if test $i -gt $TB_TIMEOUT_STARTUP
then
printf "ABORT! Timeout waiting on startup, pid file $1\n"
exit 1
fi
done
printf "program started up, pidfile $1 contains $(cat $1)\n"
}
# start receiver WITH valgrind, add receiver command line parameters after function name
startup_receiver_valgrind() {
libtool &> /dev/null
if [ $? == 127 ]; then
printf 'libtool command not available, cannot run under valgrind\n'
exit 77
fi
printf 'Starting Receiver...\n'
libtool --mode=execute $valgrind ./receive $TLSLIB -p $TESTPORT -O $OUTFILE.2 -F $RECEIVE_PIDFILE $OPT_VERBOSE $* &
export RECEIVE_PID=$!
printf "got $RECEIVE_PID $RECEIVE_PIDFILE\n"
wait_process_startup_via_pidfile $RECEIVE_PIDFILE
printf 'Receiver running\n'
}
# start receiver, add receiver command line parameters after function name
startup_receiver() {
printf 'Starting Receiver...\n'
./receive $TLSLIB -p $TESTPORT -F $RECEIVE_PIDFILE -O $OUTFILE $OPT_VERBOSE $* &
export RECEIVE_PID=$!
printf "got $RECEIVE_PID $RECEIVE_PIDFILE\n"
wait_process_startup_via_pidfile $RECEIVE_PIDFILE
printf 'Receiver running\n'
}
stop_receiver() {
if [ "$RECEIVE_PID" == "" ]; then
printf 'oops - receiver pid not found in stop_receiver\n'
return
fi
kill $RECEIVE_PID &> /dev/null
wait $RECEIVE_PID
export RECEIVE_EXIT=$?
printf 'receiver %d stopped\n' $RECEIVE_PID
}
abort_receiver() {
if [ "$RECEIVE_PID" == "" ]; then
printf 'oops - receiver pid not found in abort_receiver\n'
return
fi
set -x; set +v
printf 'stopping receiver %d via abort method\n' $RECEIVE_PID
kill -USR1 $RECEIVE_PID # &> /dev/null
wait $RECEIVE_PID
printf 'receiver %d stopped via abort method\n' $RECEIVE_PID
set +x; set +v
}
# $1 is the value to check for
# $2 (optinal) is the file to check
check_output() {
if [ "$1" == "--check-only" ]; then
check_only="yes"
shift
else
check_only="no"
fi
EXPECTED="$1"
if [ "$2" == "" ] ; then
FILE_TO_CHECK="$OUTFILE"
else
FILE_TO_CHECK="$2"
fi
grep $3 "$EXPECTED" $FILE_TO_CHECK > /dev/null
if [ $? -ne 0 ]; then
if [ "$check_only" == "yes" ]; then
printf 'check_output did not yet succeed for "%s" in "%s" (check_only set)\n', "$EXPECTED", "$FILE_TO_CHECK"
return 1
fi
printf "\nFAIL: expected message not found. Expected:\n"
printf "%s\n" "$EXPECTED"
printf "\n$FILE_TO_CHECK actually is:\n"
cat $FILE_TO_CHECK
exit 1
fi
if [ "$check_only" == "yes" ]; then
return 0
fi
}
# wait until $TESTPORT is no longer bound, e.g. for session closure
# TODO: evaluate if this function is really used and, if not,
# TODO: remove again - 2018-11-19 rgerhards
wait_testport_available() {
while true; do
printf 'checking NETSTAT\n'
if ! netstat -tp | grep -q $TESTPORT; then
break
fi
./msleep 1000
done
}
# $1 is the value to check for
# $2 (optinal) is the file to check
check_output_only() {
EXPECTED="$1"
if [ "$2" == "" ] ; then
FILE_TO_CHECK="$OUTFILE"
else
FILE_TO_CHECK="$2"
fi
# printf "\ncheck_output_only on $FILE_TO_CHECK with '$EXPECTED'\n"
grep -q "$EXPECTED" $FILE_TO_CHECK;
if [ $? -ne 0 ]; then
# False
# printf "\ncheck_output_only FALSE \n";
return 1;
else
# true
# printf "\ncheck_output_only TRUE \n";
return 0;
fi
}
# cleanup temporary
# note: on solaris,
# get full command line: /usr/ucb/ps awwx
# find who listens on port:
# netstat -an | grep $TESTPORT
# ./CI/solaris-findport.sh $TESTPORT
cleanup() {
if [ "$(uname)" == "SunOS" ] ; then
pkill -x receive
echo pkill result $?
fi
if [ -f $RECEIVE_PID ]; then
kill -9 $RECEIVE_PID &> /dev/null
fi
rm -f -- $DYNNAME* *.err.log error.*.log
rm -rf $TESTDIR
}
# cleanup at end of regular test run
terminate() {
cleanup
printf "%s %s SUCCESS\n" "$(date +%H:%M:%S)" "$0"
}
# check that the output file contains correct number of messages
# Works on $OUTFILE
# TODO: check sequence, so that we do not have duplicates...
check_msg_count() {
printf 'We have %s lines in %s\n' $(wc -l < $OUTFILE) $OUTFILE
if ! ./chkseq -s1 -e$NUMMESSAGES -f$OUTFILE -d ; then
exit 1
fi
return
lines=$(wc -l < $OUTFILE)
if [ "$lines" -ne $NUMMESSAGES ]; then
printf 'FAIL: message count not correct for %s\n' $OUTFILE
printf 'Have %s lines, expected %d\n' "$lines" $NUMMESSAGES
exit 1
fi
}
# execute tls tests with currently enabled TLS libraries
# the actual test to be carried out must be defined as "actual_test"
# the tlslib is passed the to it via env var TEST_TLS_LIB
do_tls_subtests() {
export TEST_TLS_LIB
for TEST_TLS_LIB in "gnutls" "openssl"; do
if ./have_tlslib $TEST_TLS_LIB; then
printf '\nBEGIN SUBTEST using TLS lib: %s\n' $TEST_TLS_LIB
actual_test
else
printf '\nskipping %s lib, not supported in this build\n' $TEST_TLS_LIB
fi
done
}
######################################################################
# testbench initialization code - do this LAST here in the file
######################################################################
printf "============================================================\n"
printf "%s: Test: $0\n" "$(date +%H:%M:%S)"
printf "============================================================\n"
export TESTPORT=$(get_free_port)
export DYNNAME=lrtb_${TESTPORT}.
export TESTDIR=lrtb_${TESTPORT}
mkdir $TESTDIR
export OUTFILE=${TESTDIR}/librelp.out.log
export RECEIVE_PIDFILE=${DYNNAME}receive.pid
librelp-1.13.0/tests/set-envvars.in 0000644 0001750 0001750 00000000027 13734555715 012673 export PYTHON=@PYTHON@
librelp-1.13.0/tests/msleep.c 0000664 0001750 0001750 00000003164 14354536317 011522 /* sleeps for the specified number of MILLIseconds.
* Primarily meant as a portable tool available everywhere for the
* testbench (sleep 0.1 does not work on all platforms).
*
* Part of the testbench for rsyslog.
*
* Copyright 2010 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
* Rsyslog 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 3 of the License, or
* (at your option) any later version.
*
* Rsyslog 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 Rsyslog. If not, see .
*
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*/
#include "config.h"
#include
#include
#if defined(__FreeBSD__)
#include
#else
#include
#endif
#if defined(HAVE_SYS_SELECT_H)
#include
#endif
int main(int argc, char *argv[])
{
struct timeval tvSelectTimeout;
long sleepTime;
if(argc != 2) {
fprintf(stderr, "usage: msleep \n");
exit(1);
}
sleepTime = atoi(argv[1]);
tvSelectTimeout.tv_sec = sleepTime / 1000;
tvSelectTimeout.tv_usec = (sleepTime % 1000) * 1000; /* micro seconds */
if(select(0, NULL, NULL, NULL, &tvSelectTimeout) == -1) {
perror("select");
exit(1);
}
return 0;
}
librelp-1.13.0/tests/permitted-peer-lifetime.c 0000664 0001750 0001750 00000003745 15241057272 014756 /*
* Verify that every permitted-peer owner releases its copied entries and
* pointer array, including TCP wildcard compilation state.
*/
#include "config.h"
#if defined(WITH_TLS)
#include
#include
#include "librelp.h"
#include "relp.h"
#include "relpclt.h"
#include "relpsess.h"
#include "relpsrv.h"
#include "tcp.h"
static void
discard_debug(char *const fmt __attribute__((unused)), ...)
{
}
int
main(void)
{
relpEngine_t *engine = NULL;
relpSrv_t *server = NULL;
relpClt_t *client = NULL;
relpSess_t *session = NULL;
relpTcp_t *tcp = NULL;
char *peerNames[] = {(char*)"*.example.com", (char*)"relay.example.org"};
relpPermittedPeers_t peers = {2, peerNames};
int rc = EXIT_FAILURE;
if(relpEngineConstruct(&engine) != RELP_RET_OK
|| relpEngineSetDbgprint(engine, discard_debug) != RELP_RET_OK
|| relpSrvConstruct(&server, engine) != RELP_RET_OK
|| relpSrvAddPermittedPeer(server, peerNames[0]) != RELP_RET_OK
|| relpSrvAddPermittedPeer(server, peerNames[1]) != RELP_RET_OK
|| relpCltConstruct(&client, engine) != RELP_RET_OK
|| relpCltAddPermittedPeer(client, peerNames[0]) != RELP_RET_OK
|| relpCltAddPermittedPeer(client, peerNames[1]) != RELP_RET_OK
|| relpSessConstruct(&session, engine, RELP_CLT_CONN, client, NULL) != RELP_RET_OK
|| relpSessSetPermittedPeers(session, &peers) != RELP_RET_OK
|| relpTcpConstruct(&tcp, engine, RELP_CLT_CONN, client) != RELP_RET_OK
|| relpTcpSetPermittedPeers(tcp, &peers) != RELP_RET_OK) {
fprintf(stderr, "failed to construct permitted-peer test objects\n");
goto done;
}
printf("permitted-peer ownership cleanup verified\n");
rc = EXIT_SUCCESS;
done:
if(tcp != NULL)
(void) relpTcpDestruct(&tcp);
if(session != NULL)
(void) relpSessDestruct(&session);
if(client != NULL)
(void) relpCltDestruct(&client);
if(server != NULL)
(void) relpSrvDestruct(&server);
if(engine != NULL)
(void) relpEngineDestruct(&engine);
return rc;
}
#else
int
main(void)
{
return 77;
}
#endif
librelp-1.13.0/tests/receive-emptyconnect.sh 0000775 0001750 0001750 00000001237 14354536317 014557 #!/bin/bash
# checks if server handles connection request by clients which are immediately
# closed (without sending data) validly. This also means an error message must
# be emitted. This situation can frequently happen in Proxy configurations.
# written 2018-11-20 by Rainer Gerhards, released under ASL 2.0
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
check_command_available timeout
startup_receiver -e $TESTDIR/$errorlog
timeout 10s $PYTHON ${srcdir}/dummyclient.py
sleep 1
stop_receiver
# TODO: we should word the error message clearer, then also change here
check_output "server closed relp session" $TESTDIR/$errorlog
terminate
librelp-1.13.0/tests/tls-wrong-signedcert.sh 0000775 0001750 0001750 00000001344 14354536317 014507 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
export TLSLIB="-l openssl"
startup_receiver -T -a "name" -x ${srcdir}/tls-certs/ossl-ca.pem -y ${srcdir}/tls-certs/ossl-server-cert.pem -z ${srcdir}/tls-certs/ossl-server-key.pem -P 'client.testbench.rsyslog.com' -e $TESTDIR/$errorlog
echo 'Send Message...'
./send $TLSLIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "name" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem -P 'server.testbench.rsyslog.com' -e $TESTDIR/$errorlog $OPT_VERBOSE
stop_receiver
# Perform multiline GREP with -z
check_output "authentication error.*signed certificate in certificate chain" $TESTDIR/$errorlog -z
terminate
librelp-1.13.0/tests/tls-receiver-abort.sh 0000775 0001750 0001750 00000001243 14354536317 014135 #!/bin/bash
# added 2018-11-15 by Rainer Gerhards, released under ASL 2.0
# check that receiver abort is handled gracefully
# of messages
. ${srcdir:=$(pwd)}/test-framework.sh
check_command_available timeout
export NUMMESSAGES=10000
actual_test() {
startup_receiver
./send -t 127.0.0.1 -p $TESTPORT -n$NUMMESSAGES -N \
-K 2000 -I$RECEIVE_PID $OPT_VERBOSE &
SENDER_PID=$!
for i in {1..3}; do
sleep 2
timeout 10s $PYTHON ${srcdir}/dummyserver.py $TESTPORT
done
sleep 2 # make sure client goes into retry
startup_receiver --append-outfile
wait $SENDER_PID
printf 'wait on sender retured %d\n' $?
stop_receiver
check_msg_count
}
do_tls_subtests
terminate
librelp-1.13.0/tests/tls-gtls-lifecycle.c 0000664 0001750 0001750 00000015141 15241057272 013733 /*
* Verify GnuTLS shutdown ordering and partial-session cleanup.
*/
#include "config.h"
#if defined(ENABLE_TLS)
#include
#include
#include
#include
#include
#include
#include "librelp.h"
#include "tcp.h"
static int watched_fd = -1;
static int fd_open_during_bye;
static unsigned int bye_calls;
static unsigned int bye_count;
static unsigned int deinit_count;
static unsigned int cert_free_count;
static unsigned int anon_client_free_count;
static unsigned int anon_server_free_count;
static unsigned int dh_free_count;
enum bye_mode {
bye_success,
bye_interrupted_once,
bye_again
};
static enum bye_mode bye_mode;
int __wrap_gnutls_bye(gnutls_session_t session, gnutls_close_request_t how);
void __real_gnutls_deinit(gnutls_session_t session);
void __wrap_gnutls_deinit(gnutls_session_t session);
void __real_gnutls_certificate_free_credentials(gnutls_certificate_credentials_t credentials);
void __wrap_gnutls_certificate_free_credentials(gnutls_certificate_credentials_t credentials);
void __real_gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t credentials);
void __wrap_gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t credentials);
void __real_gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t credentials);
void __wrap_gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t credentials);
void __real_gnutls_dh_params_deinit(gnutls_dh_params_t params);
void __wrap_gnutls_dh_params_deinit(gnutls_dh_params_t params);
int
__wrap_gnutls_bye(gnutls_session_t session __attribute__((unused)),
gnutls_close_request_t how __attribute__((unused)))
{
++bye_count;
++bye_calls;
fd_open_during_bye = fcntl(watched_fd, F_GETFD) != -1;
if(bye_mode == bye_interrupted_once && bye_calls == 1)
return GNUTLS_E_INTERRUPTED;
if(bye_mode == bye_again && bye_calls == 1)
return GNUTLS_E_AGAIN;
return GNUTLS_E_SUCCESS;
}
void
__wrap_gnutls_deinit(gnutls_session_t session)
{
++deinit_count;
__real_gnutls_deinit(session);
}
void
__wrap_gnutls_certificate_free_credentials(gnutls_certificate_credentials_t credentials)
{
++cert_free_count;
__real_gnutls_certificate_free_credentials(credentials);
}
void
__wrap_gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t credentials)
{
++anon_client_free_count;
__real_gnutls_anon_free_client_credentials(credentials);
}
void
__wrap_gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t credentials)
{
++anon_server_free_count;
__real_gnutls_anon_free_server_credentials(credentials);
}
void
__wrap_gnutls_dh_params_deinit(gnutls_dh_params_t params)
{
++dh_free_count;
__real_gnutls_dh_params_deinit(params);
}
static void
discard_debug(char *const fmt __attribute__((unused)), ...)
{
}
static int
construct_tcp(relpEngine_t *const engine, relpTcp_t **const tcp)
{
if(relpTcpConstruct(tcp, engine, RELP_CLT_CONN, NULL) != RELP_RET_OK
|| gnutls_init(&(*tcp)->session, GNUTLS_CLIENT) != GNUTLS_E_SUCCESS) {
return -1;
}
(*tcp)->bEnableTLS = 1;
return 0;
}
int
main(void)
{
relpEngine_t *engine = NULL;
relpTcp_t *tcp = NULL;
int again_connection[2] = {-1, -1};
int abort_connection[2] = {-1, -1};
int connection[2] = {-1, -1};
int rc = EXIT_FAILURE;
if(relpEngineConstruct(&engine) != RELP_RET_OK
|| relpEngineSetDbgprint(engine, discard_debug) != RELP_RET_OK
|| relpEngineSetTLSLibByName(engine, "gnutls") != RELP_RET_OK
|| construct_tcp(engine, &tcp) != 0
|| socketpair(AF_UNIX, SOCK_STREAM, 0, connection) != 0) {
fprintf(stderr, "failed to construct active GnuTLS test objects\n");
goto done;
}
tcp->sock = connection[0];
connection[0] = -1;
tcp->bTLSActive = 1;
watched_fd = tcp->sock;
bye_mode = bye_interrupted_once;
bye_calls = 0;
if(relpTcpDestruct(&tcp) != RELP_RET_OK) {
fprintf(stderr, "failed to destruct active GnuTLS session\n");
goto done;
}
if(bye_count != 2 || bye_calls != 2 || !fd_open_during_bye || deinit_count != 1) {
fprintf(stderr, "active session teardown order is incorrect\n");
goto done;
}
if(construct_tcp(engine, &tcp) != 0
|| socketpair(AF_UNIX, SOCK_STREAM, 0, abort_connection) != 0) {
fprintf(stderr, "failed to construct abort GnuTLS test objects\n");
goto done;
}
tcp->sock = abort_connection[0];
abort_connection[0] = -1;
tcp->bTLSActive = 1;
if(relpTcpAbortDestruct(&tcp) != RELP_RET_OK) {
fprintf(stderr, "failed to abort-destruct active GnuTLS session\n");
goto done;
}
if(bye_count != 2 || deinit_count != 2) {
fprintf(stderr, "abort teardown sent close_notify\n");
goto done;
}
if(construct_tcp(engine, &tcp) != 0
|| socketpair(AF_UNIX, SOCK_STREAM, 0, again_connection) != 0) {
fprintf(stderr, "failed to construct EAGAIN GnuTLS test objects\n");
goto done;
}
tcp->sock = again_connection[0];
again_connection[0] = -1;
tcp->bTLSActive = 1;
watched_fd = tcp->sock;
bye_mode = bye_again;
bye_calls = 0;
if(relpTcpDestruct(&tcp) != RELP_RET_OK) {
fprintf(stderr, "failed to destruct EAGAIN GnuTLS session\n");
goto done;
}
if(bye_count != 3 || bye_calls != 1 || deinit_count != 3) {
fprintf(stderr, "EAGAIN teardown was retried\n");
goto done;
}
watched_fd = -1;
bye_mode = bye_success;
if(construct_tcp(engine, &tcp) != 0
|| gnutls_certificate_allocate_credentials(&tcp->xcred) != GNUTLS_E_SUCCESS
|| gnutls_anon_allocate_client_credentials(&tcp->anoncred) != GNUTLS_E_SUCCESS
|| gnutls_anon_allocate_server_credentials(&tcp->anoncredSrv) != GNUTLS_E_SUCCESS
|| gnutls_dh_params_init(&tcp->dh_params) != GNUTLS_E_SUCCESS) {
fprintf(stderr, "failed to construct partial GnuTLS test objects\n");
goto done;
}
if(relpTcpDestruct(&tcp) != RELP_RET_OK) {
fprintf(stderr, "failed to destruct inactive partial GnuTLS session\n");
goto done;
}
if(bye_count != 3 || deinit_count != 4 || cert_free_count != 1
|| anon_client_free_count != 1 || anon_server_free_count != 1 || dh_free_count != 1) {
fprintf(stderr, "inactive partial GnuTLS resources were not released\n");
goto done;
}
printf("GnuTLS lifecycle ordering and cleanup verified\n");
rc = EXIT_SUCCESS;
done:
if(tcp != NULL)
(void) relpTcpDestruct(&tcp);
if(engine != NULL)
(void) relpEngineDestruct(&engine);
if(connection[0] >= 0)
(void) close(connection[0]);
if(connection[1] >= 0)
(void) close(connection[1]);
if(abort_connection[0] >= 0)
(void) close(abort_connection[0]);
if(abort_connection[1] >= 0)
(void) close(abort_connection[1]);
if(again_connection[0] >= 0)
(void) close(again_connection[0]);
if(again_connection[1] >= 0)
(void) close(again_connection[1]);
return rc;
}
#else
int
main(void)
{
return 77;
}
#endif
librelp-1.13.0/tests/tls-basic-wildcard.sh 0000775 0001750 0001750 00000001055 14354536317 014075 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
function actual_test() {
startup_receiver -l $TEST_TLS_LIB -T -a "name" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem -P '*.rsyslog.com' -e error.out.log
echo 'Send Message...'
./send -t 127.0.0.1 -l $TEST_TLS_LIB -p $TESTPORT -m "testmessage" -T -a "name" -x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem -P '*.rsyslog.com' $OPT_VERBOSE
stop_receiver
check_output "testmessage"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/basic-sessionbreak-vg.sh 0000775 0001750 0001750 00000002576 14354536317 014617 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
check_command_available valgrind
if [ "$VALGRIND" == "NO" ] ; then
echo "valgrind tests are not permitted by environment config"
exit 77
fi
if [ $(uname) = "SunOS" ] ; then
echo "This test currently does not work on all flavors of Solaris."
exit 77
fi
if [ $(uname) = "FreeBSD" ] ; then
echo "This test currently does not work on FreeBSD."
exit 77
fi
export NUMMESSAGES=100000
export NUMLOOPS=2
#export valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1"
export valgrind="valgrind --malloc-fill=ff --free-fill=fe --leak-check=full --log-fd=1 --error-exitcode=10 --gen-suppressions=all --suppressions=$srcdir/known_issues.supp"
startup_receiver_valgrind -N -e error.out.log -O $OUTFILE
echo 'Send Message(s)...'
for i in $(seq 1 $NUMLOOPS); do
# How many times tcpflood runs in each threads
libtool --mode=execute ./send -N -t 127.0.0.1 -p $TESTPORT -m "testmessage" -n $NUMMESSAGES $OPT_VERBOSE &
send_pid=$!
echo "started send instance $i (PID $send_pid)"
# Give it time to actually connect
sleep 1;
kill -9 $send_pid # >/dev/null 2>&1;
echo "killed send instance $i (PID $send_pid)"
done;
stop_receiver
if [ "$RECEIVE_EXIT" -eq "10" ]; then
cleanup
printf 'valgrind run FAILED with exceptions\n'
printf "%s %s FAIL\n" "$(date +%H:%M:%S)" "$0"
exit 1
fi
# check_output "testmessage"
terminate
librelp-1.13.0/tests/tls-wrong-authname.sh 0000755 0001750 0001750 00000001356 13734555715 014167 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
# NOT USING startup_receiver here!
ls -ld $TESTDIR
echo outfile: $OUTFILE
./receive -p $TESTPORT -T -a "anon" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem \
-P "rsyslog" $OPT_VERBOSE $* 1>>${OUTFILE} 2>&1
check_output "relpSrvSetAuthMode(pRelpSrv, authMode)"
printf 'Server check OK\n'
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "anon" \
2> $TESTDIR/$errorlog \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P "rsyslog" $OPT_VERBOSE
check_output "relpCltSetAuthMode(pRelpClt, authMode)" $TESTDIR/$errorlog
terminate
librelp-1.13.0/tests/oversize-msg-abort-errmsg.sh 0000755 0001750 0001750 00000000664 13734555715 015470 #!/bin/bash
# check if oversize message error is generated by receiver
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
startup_receiver -e $TESTDIR/$errorlog
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage1" -d 150000
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage2"
stop_receiver
check_output "error.*frame too long" $TESTDIR/$errorlog
check_output "testmessage2"
terminate
librelp-1.13.0/tests/send-dummyserver-no-waitstate-errmsg.sh 0000775 0001750 0001750 00000001720 15241030422 017625 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
ERROR_FILE=${TESTDIR}/dummyserver-error.log
timeout 10s $PYTHON -u ${srcdir}/dummyserver.py $TESTPORT >${TESTDIR}/dummyserver.log 2>&1 &
DUMMYSERVER_PID=$!
for i in $(seq 1 100); do
if check_output_only "DUMMYSERVER: listening" ${TESTDIR}/dummyserver.log; then
break
fi
./msleep 10
done
check_output "DUMMYSERVER: listening" ${TESTDIR}/dummyserver.log
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" -e ${ERROR_FILE} >${TESTDIR}/send.log 2>&1 || true
wait $DUMMYSERVER_PID || true
check_output "send: FAILURE in 'relpCltConnect'" ${TESTDIR}/send.log
check_output "send: error 'server closed relp session, session broken'" ${ERROR_FILE}
check_output "send: error 'error opening connection to remote peer'" ${ERROR_FILE}
if check_output_only "error waiting on required session state" ${ERROR_FILE}; then
printf 'FAIL: unexpected wait-state error in %s\n' "${ERROR_FILE}"
cat "${ERROR_FILE}"
exit 1
fi
terminate
librelp-1.13.0/tests/tls-ossl-retry-state.c 0000664 0001750 0001750 00000006612 15241030422 014255 /*
* Deterministic reproducer for stale OpenSSL retry state.
*
* The production reproducer fills a TLS receiver's send window until
* SSL_write() returns WANT_WRITE. Once the connection becomes writable, the
* retry succeeds but the old state remained set, pinning the event loop to
* EPOLLOUT and making it spin over an empty send queue. The wrappers below
* reproduce that exact WANT-to-success transition without timing or load.
*/
#include "config.h"
#if defined(ENABLE_TLS_OPENSSL)
#include
#include
#include
#include "librelp.h"
#include "tcp.h"
enum operation {
OP_SEND_WANT,
OP_SEND_SUCCESS,
OP_RECV_WANT,
OP_RECV_SUCCESS
};
static enum operation current_operation;
int __wrap_SSL_write(SSL *ssl, const void *buf, int num);
int __wrap_SSL_read(SSL *ssl, void *buf, int num);
int __wrap_SSL_get_error(const SSL *ssl, int ret);
int
__wrap_SSL_write(SSL *const ssl __attribute__((unused)), const void *const buf __attribute__((unused)), const int num)
{
return current_operation == OP_SEND_WANT ? -1 : num;
}
int
__wrap_SSL_read(SSL *const ssl __attribute__((unused)), void *const buf, const int num)
{
if(current_operation == OP_RECV_WANT)
return -1;
if(num > 0)
((unsigned char *) buf)[0] = 'x';
return num > 0 ? 1 : 0;
}
int
__wrap_SSL_get_error(const SSL *const ssl __attribute__((unused)), const int ret __attribute__((unused)))
{
return current_operation == OP_SEND_WANT ? SSL_ERROR_WANT_WRITE : SSL_ERROR_WANT_READ;
}
static void
discard_debug(char *const fmt __attribute__((unused)), ...)
{
}
int
main(void)
{
relpEngine_t *engine = NULL;
relpTcp_t *tcp = NULL;
relpOctet_t data[8] = {0};
ssize_t len;
int rc = EXIT_FAILURE;
if(relpEngineConstruct(&engine) != RELP_RET_OK
|| relpEngineSetDbgprint(engine, discard_debug) != RELP_RET_OK
|| relpEngineSetTLSLibByName(engine, "openssl") != RELP_RET_OK
|| relpTcpConstruct(&tcp, engine, RELP_CLT_CONN, NULL) != RELP_RET_OK) {
fprintf(stderr, "failed to construct librelp test objects\n");
goto done;
}
tcp->bEnableTLS = 1;
tcp->ssl = (SSL *) tcp; /* wrappers do not dereference the test token */
current_operation = OP_SEND_WANT;
len = sizeof(data);
if(relpTcpSend(tcp, data, &len) != RELP_RET_OK || len != 0
|| tcp->rtryOp != relpTCP_RETRY_send) {
fprintf(stderr, "SSL WANT_WRITE did not establish send retry state\n");
goto done;
}
current_operation = OP_SEND_SUCCESS;
len = sizeof(data);
if(relpTcpSend(tcp, data, &len) != RELP_RET_OK || len != (ssize_t) sizeof(data)
|| tcp->rtryOp != relpTCP_RETRY_none) {
fprintf(stderr, "successful SSL_write left stale send retry state\n");
goto done;
}
current_operation = OP_RECV_WANT;
len = sizeof(data);
if(relpTcpRcv(tcp, data, &len) != RELP_RET_OK || len != -1
|| tcp->rtryOp != relpTCP_RETRY_recv) {
fprintf(stderr, "SSL WANT_READ did not establish receive retry state\n");
goto done;
}
current_operation = OP_RECV_SUCCESS;
len = sizeof(data);
if(relpTcpRcv(tcp, data, &len) != RELP_RET_OK || len != 1
|| tcp->rtryOp != relpTCP_RETRY_none) {
fprintf(stderr, "successful SSL_read left stale receive retry state\n");
goto done;
}
printf("OpenSSL retry state cleared after successful I/O\n");
rc = EXIT_SUCCESS;
done:
if(tcp != NULL) {
tcp->ssl = NULL;
(void) relpTcpDestruct(&tcp);
}
if(engine != NULL)
(void) relpEngineDestruct(&engine);
return rc;
}
#else
int
main(void)
{
return 77;
}
#endif
librelp-1.13.0/tests/basic-realistic.sh 0000755 0001750 0001750 00000000506 13403223761 013447 #!/bin/bash
# added 2018-11-15 by Rainer Gerhards, released under ASL 2.0
# a more relastic test which actually sends a bit larger number
# of messages
. ${srcdir:=$(pwd)}/test-framework.sh
NUMMESSAGES=50000
startup_receiver
./send -t 127.0.0.1 -p $TESTPORT -n$NUMMESSAGES $OPT_VERBOSE
stop_receiver
check_msg_count
terminate
librelp-1.13.0/tests/invalid-open.py 0000664 0001750 0001750 00000000701 15241030422 013000 #!/usr/bin/env python3
import os
import socket
import time
def main():
port = int(os.environ["TESTPORT"])
frame = b"1 open 12 relp_version\n"
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(2)
sock.connect(("127.0.0.1", port))
sock.sendall(frame)
try:
sock.recv(1024)
except socket.timeout:
pass
time.sleep(0.1)
sock.close()
if __name__ == "__main__":
main()
librelp-1.13.0/tests/session-callbacks.sh 0000775 0001750 0001750 00000001217 15241030422 014003 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
CALLBACK_FILE=${TESTDIR}/session-callbacks.log
startup_receiver -C ${CALLBACK_FILE} $OPT_VERBOSE
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" $OPT_VERBOSE
$PYTHON ${srcdir}/invalid-open.py
for i in $(seq 1 100); do
if check_output_only "session open failed reason=" ${CALLBACK_FILE}; then
break
fi
./msleep 10
done
check_output "session open failed reason=" ${CALLBACK_FILE}
stop_receiver
check_output "testmessage"
check_output "session opened" ${CALLBACK_FILE}
check_output "session closed reason=" ${CALLBACK_FILE}
check_output "session open failed reason=" ${CALLBACK_FILE}
terminate
librelp-1.13.0/tests/send-noconnect.sh 0000755 0001750 0001750 00000000513 13437164712 013333 #!/bin/bash
# check that failed connect to receiver is gracefully handled and error
# message emitted.
# written 2018-11-20 by Rainer Gerhards, released under ASL 2.0
. ${srcdir:=$(pwd)}/test-framework.sh
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage" $OPT_VERBOSE &> $OUTFILE
check_output "error opening connection"
terminate
librelp-1.13.0/tests/tls-basic-tlscommand-ciphers.sh 0000775 0001750 0001750 00000003053 14354536317 016100 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
export TLSLIB="-l openssl"
# export OPT_VERBOSE=-v # uncomment for debugging
function actual_test() {
# Test only supported for OpenSSL
if [ "$TEST_TLS_LIB" == "openssl" ]; then
startup_receiver -T -a "name" -x ${srcdir}/tls-certs/ca.pem \
-y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem \
-P 'testbench.rsyslog.com' \
-e $TESTDIR/$errorlog \
-c "Protocol=ALL,-SSLv2,-SSLv3,-TLSv1,-TLSv1.1;CipherString=ECDHE-RSA-AES256-GCM-SHA384;MinProtocol=TLSv1.2;MaxProtocol=TLSv1.2;Ciphersuites=TLS_AES_256_GCM_SHA384"
echo 'Send Message...'
./send $TLSLIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "name" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P 'testbench.rsyslog.com' \
-c "CipherString=ECDHE-RSA-AES128-GCM-SHA256;Ciphersuites=TLS_AES_128_GCM_SHA256" \
-e $TESTDIR/$errorlog \
$OPT_VERBOSE
stop_receiver
if test -f $TESTDIR/$errorlog; then
check_output --check-only "OpenSSL Version too old" $TESTDIR/$errorlog
ret=$?
if [ $ret == 0 ]; then
echo "SKIP: OpenSSL Version too old"
exit 77
else
# Try "handshake failed" first
check_output --check-only "handshake fail" $TESTDIR/$errorlog
ret=$?
if [ $ret != 0 ]; then
check_output "wrong version number" $TESTDIR/$errorlog
fi
fi
else
echo "SKIP: $TESTDIR/$errorlog was not created"
exit 77
fi
else
echo "SKIP: For $TEST_TLS_LIB"
fi
}
do_tls_subtests
terminate
librelp-1.13.0/tests/tls-basic-anon.sh 0000775 0001750 0001750 00000001270 14354536317 013236 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
function actual_test() {
startup_receiver -l $TEST_TLS_LIB -T -e error.out.log
echo 'Send Message...'
./send -l $TEST_TLS_LIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T $OPT_VERBOSE 1>>${OUTFILE} 2>&1
# "relpTcpLastSSLErrorMsg: Errorstack: error:1417A0C1:SSL routines:tls_post_process_client_hello:no shared cipher"
stop_receiver
if check_output_only "relpTcpLastSSLErrorMsg\: Errorstack\: error\:.*\:no shared cipher"; then
printf "\nSKIP: openssl reported 'no shared cipher'\n"
printf "\nDEBUG: content of ${OUTFILE}\n"
cat $FILE_TO_CHECK
terminate
exit 77;
fi
check_output "testmessage"
}
do_tls_subtests
terminate
librelp-1.13.0/tests/tls-basic-tlscommand.sh 0000775 0001750 0001750 00000003231 14354536317 014443 #!/bin/bash
. ${srcdir:=$(pwd)}/test-framework.sh
export errorlog="error.$LIBRELP_DYN.log"
export TLSLIB="-l openssl"
# export OPT_VERBOSE=-v # uncomment for debugging
function actual_test() {
# Test only supported for OpenSSL
if [ "$TEST_TLS_LIB" == "openssl" ]; then
startup_receiver -T -a "name" -x ${srcdir}/tls-certs/ca.pem \
-y ${srcdir}/tls-certs/cert.pem -z ${srcdir}/tls-certs/key.pem \
-P 'testbench.rsyslog.com' \
-e $TESTDIR/$errorlog \
-c "Protocol=ALL,-SSLv2,-SSLv3,-TLSv1,-TLSv1.2;CipherString=ECDHE-RSA-AES256-GCM-SHA384;Protocol=ALL,-SSLv2,-SSLv3,-TLSv1,-TLSv1.2,-TLSv1.3;MinProtocol=TLSv1.2;MaxProtocol=TLSv1.2"
echo 'Send Message...'
./send $TLSLIB -t 127.0.0.1 -p $TESTPORT -m "testmessage" -T -a "name" \
-x ${srcdir}/tls-certs/ca.pem -y ${srcdir}/tls-certs/cert.pem \
-z ${srcdir}/tls-certs/key.pem -P 'testbench.rsyslog.com' \
-c "Protocol=ALL,-SSLv2,-SSLv3,-TLSv1.1,-TLSv1.2;CipherString=DHE-RSA-AES256-SHA;Protocol=ALL,-SSLv2,-SSLv3,-TLSv1.1,-TLSv1.2,-TLSv1.3;MinProtocol=TLSv1.1;MaxProtocol=TLSv1.1" \
-e $TESTDIR/$errorlog \
$OPT_VERBOSE
stop_receiver
if test -f $TESTDIR/$errorlog; then
check_output --check-only "OpenSSL Version too old" $TESTDIR/$errorlog
ret=$?
if [ $ret == 0 ]; then
echo "SKIP: OpenSSL Version too old"
exit 77
else
# Try "handshake failed" first
check_output --check-only "handshake fail" $TESTDIR/$errorlog
ret=$?
if [ $ret != 0 ]; then
check_output "wrong version number" $TESTDIR/$errorlog
fi
fi
else
echo "SKIP: $TESTDIR/$errorlog was not created"
exit 77
fi
else
echo "SKIP: For $TEST_TLS_LIB"
fi
}
do_tls_subtests
terminate
librelp-1.13.0/tests/Makefile.in 0000664 0001750 0001750 00000200154 15241057402 012121 # Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = receive$(EXEEXT) send$(EXEEXT) chkseq$(EXEEXT) \
have_tlslib$(EXEEXT) msleep$(EXEEXT) $(am__EXEEXT_1) \
$(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4)
# This white-box test needs internal symbols that are not exported by librelp.
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@am__append_1 = tls_ossl_fd_reuse
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@am__append_2 = tls_ossl_retry_state
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@am__append_3 = permitted_peer_lifetime
# These white-box fixtures use GNU ld --wrap interposition. Solaris Studio
# accepts the option but does not provide compatible runtime interposition.
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@am__append_4 = tcp_accept_fd_reuse tls_gtls_lifecycle
@ENABLE_TLS_GENERIC_TRUE@am__append_5 = $(TLS_TESTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@am__append_6 = $(TLS_STATIC_TESTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@am__append_7 = $(GTLS_STATIC_TESTS)
@ENABLE_TLS_OPENSSL_TRUE@am__append_8 = $(OSSL_TESTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@am__append_9 = $(OSSL_STATIC_TESTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@am__append_10 = $(OSSL_WRAP_STATIC_TESTS)
@HAVE_VALGRIND_TRUE@am__append_11 = $(VALGRIND_TESTS)
@ENABLE_TLS_GENERIC_TRUE@@HAVE_VALGRIND_TRUE@am__append_12 = $(TLS_VALGRIND_TESTS)
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = set-envvars
CONFIG_CLEAN_VPATH_FILES =
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@am__EXEEXT_1 = tls_ossl_fd_reuse$(EXEEXT)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@am__EXEEXT_2 = tls_ossl_retry_state$(EXEEXT)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@am__EXEEXT_3 = permitted_peer_lifetime$(EXEEXT)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@am__EXEEXT_4 = tcp_accept_fd_reuse$(EXEEXT) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ tls_gtls_lifecycle$(EXEEXT)
am_chkseq_OBJECTS = chkseq.$(OBJEXT)
chkseq_OBJECTS = $(am_chkseq_OBJECTS)
chkseq_LDADD = $(LDADD)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
am_have_tlslib_OBJECTS = have_tlslib.$(OBJEXT)
have_tlslib_OBJECTS = $(am_have_tlslib_OBJECTS)
have_tlslib_LDADD = $(LDADD)
am_msleep_OBJECTS = msleep.$(OBJEXT)
msleep_OBJECTS = $(am_msleep_OBJECTS)
msleep_LDADD = $(LDADD)
am__permitted_peer_lifetime_SOURCES_DIST = permitted-peer-lifetime.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@am_permitted_peer_lifetime_OBJECTS = permitted_peer_lifetime-permitted-peer-lifetime.$(OBJEXT)
permitted_peer_lifetime_OBJECTS = \
$(am_permitted_peer_lifetime_OBJECTS)
am__DEPENDENCIES_1 =
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@permitted_peer_lifetime_DEPENDENCIES = \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@ ../src/.libs/librelp.a \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@ $(am__DEPENDENCIES_1)
permitted_peer_lifetime_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(permitted_peer_lifetime_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
am_receive_OBJECTS = receive-receive.$(OBJEXT)
receive_OBJECTS = $(am_receive_OBJECTS)
receive_DEPENDENCIES = ../src/.libs/librelp.la
receive_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(receive_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_send_OBJECTS = send-send.$(OBJEXT)
send_OBJECTS = $(am_send_OBJECTS)
send_DEPENDENCIES = ../src/.libs/librelp.la
send_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(send_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
am__tcp_accept_fd_reuse_SOURCES_DIST = tcp-accept-fd-reuse.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@am_tcp_accept_fd_reuse_OBJECTS = tcp_accept_fd_reuse-tcp-accept-fd-reuse.$(OBJEXT)
tcp_accept_fd_reuse_OBJECTS = $(am_tcp_accept_fd_reuse_OBJECTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tcp_accept_fd_reuse_DEPENDENCIES = ../src/.libs/librelp.a \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1)
tcp_accept_fd_reuse_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(tcp_accept_fd_reuse_CFLAGS) $(CFLAGS) \
$(tcp_accept_fd_reuse_LDFLAGS) $(LDFLAGS) -o $@
am__tls_gtls_lifecycle_SOURCES_DIST = tls-gtls-lifecycle.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@am_tls_gtls_lifecycle_OBJECTS = tls_gtls_lifecycle-tls-gtls-lifecycle.$(OBJEXT)
tls_gtls_lifecycle_OBJECTS = $(am_tls_gtls_lifecycle_OBJECTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_gtls_lifecycle_DEPENDENCIES = ../src/.libs/librelp.a \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1)
tls_gtls_lifecycle_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(tls_gtls_lifecycle_CFLAGS) $(CFLAGS) \
$(tls_gtls_lifecycle_LDFLAGS) $(LDFLAGS) -o $@
am__tls_ossl_fd_reuse_SOURCES_DIST = tls-ossl-fd-reuse.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@am_tls_ossl_fd_reuse_OBJECTS = tls_ossl_fd_reuse-tls-ossl-fd-reuse.$(OBJEXT)
tls_ossl_fd_reuse_OBJECTS = $(am_tls_ossl_fd_reuse_OBJECTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@tls_ossl_fd_reuse_DEPENDENCIES = ../src/.libs/librelp.a \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@ $(am__DEPENDENCIES_1)
tls_ossl_fd_reuse_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(tls_ossl_fd_reuse_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
am__tls_ossl_retry_state_SOURCES_DIST = tls-ossl-retry-state.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@am_tls_ossl_retry_state_OBJECTS = tls_ossl_retry_state-tls-ossl-retry-state.$(OBJEXT)
tls_ossl_retry_state_OBJECTS = $(am_tls_ossl_retry_state_OBJECTS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_ossl_retry_state_DEPENDENCIES = ../src/.libs/librelp.a \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1) \
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@ $(am__DEPENDENCIES_1)
tls_ossl_retry_state_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(tls_ossl_retry_state_CFLAGS) $(CFLAGS) \
$(tls_ossl_retry_state_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/chkseq.Po ./$(DEPDIR)/have_tlslib.Po \
./$(DEPDIR)/msleep.Po \
./$(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Po \
./$(DEPDIR)/receive-receive.Po ./$(DEPDIR)/send-send.Po \
./$(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Po \
./$(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Po \
./$(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Po \
./$(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(chkseq_SOURCES) $(have_tlslib_SOURCES) $(msleep_SOURCES) \
$(permitted_peer_lifetime_SOURCES) $(receive_SOURCES) \
$(send_SOURCES) $(tcp_accept_fd_reuse_SOURCES) \
$(tls_gtls_lifecycle_SOURCES) $(tls_ossl_fd_reuse_SOURCES) \
$(tls_ossl_retry_state_SOURCES)
DIST_SOURCES = $(chkseq_SOURCES) $(have_tlslib_SOURCES) \
$(msleep_SOURCES) $(am__permitted_peer_lifetime_SOURCES_DIST) \
$(receive_SOURCES) $(send_SOURCES) \
$(am__tcp_accept_fd_reuse_SOURCES_DIST) \
$(am__tls_gtls_lifecycle_SOURCES_DIST) \
$(am__tls_ossl_fd_reuse_SOURCES_DIST) \
$(am__tls_ossl_retry_state_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__tty_colors_dummy = \
mgn= red= grn= lgn= blu= brg= std=; \
am__color_tests=no
am__tty_colors = { \
$(am__tty_colors_dummy); \
if test "X$(AM_COLOR_TESTS)" = Xno; then \
am__color_tests=no; \
elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
am__color_tests=yes; \
elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
am__color_tests=yes; \
fi; \
if test $$am__color_tests = yes; then \
red='[0;31m'; \
grn='[0;32m'; \
lgn='[1;32m'; \
blu='[1;34m'; \
mgn='[0;35m'; \
brg='[1m'; \
std='[m'; \
fi; \
}
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__recheck_rx = ^[ ]*:recheck:[ ]*
am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
# A command that, given a newline-separated list of test names on the
# standard input, print the name of the tests that are to be re-run
# upon "make recheck".
am__list_recheck_tests = $(AWK) '{ \
recheck = 1; \
while ((rc = (getline line < ($$0 ".trs"))) != 0) \
{ \
if (rc < 0) \
{ \
if ((getline line2 < ($$0 ".log")) < 0) \
recheck = 0; \
break; \
} \
else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
{ \
recheck = 0; \
break; \
} \
else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
{ \
break; \
} \
}; \
if (recheck) \
print $$0; \
close ($$0 ".trs"); \
close ($$0 ".log"); \
}'
# A command that, given a newline-separated list of test names on the
# standard input, create the global log from their .trs and .log files.
am__create_global_log = $(AWK) ' \
function fatal(msg) \
{ \
print "fatal: making $@: " msg | "cat >&2"; \
exit 1; \
} \
function rst_section(header) \
{ \
print header; \
len = length(header); \
for (i = 1; i <= len; i = i + 1) \
printf "="; \
printf "\n\n"; \
} \
{ \
copy_in_global_log = 1; \
global_test_result = "RUN"; \
while ((rc = (getline line < ($$0 ".trs"))) != 0) \
{ \
if (rc < 0) \
fatal("failed to read from " $$0 ".trs"); \
if (line ~ /$(am__global_test_result_rx)/) \
{ \
sub("$(am__global_test_result_rx)", "", line); \
sub("[ ]*$$", "", line); \
global_test_result = line; \
} \
else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
copy_in_global_log = 0; \
}; \
if (copy_in_global_log) \
{ \
rst_section(global_test_result ": " $$0); \
while ((rc = (getline line < ($$0 ".log"))) != 0) \
{ \
if (rc < 0) \
fatal("failed to read from " $$0 ".log"); \
print line; \
}; \
printf "\n"; \
}; \
close ($$0 ".trs"); \
close ($$0 ".log"); \
}'
# Restructured Text title.
am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
# Solaris 10 'make', and several other traditional 'make' implementations,
# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
# by disabling -e (using the XSI extension "set +e") if it's set.
am__sh_e_setup = case $$- in *e*) set +e;; esac
# Default flags passed to test drivers.
am__common_driver_flags = \
--color-tests "$$am__color_tests" \
--enable-hard-errors "$$am__enable_hard_errors" \
--expect-failure "$$am__expect_failure"
# To be inserted before the command running the test. Creates the
# directory for the log if needed. Stores in $dir the directory
# containing $f, in $tst the test, in $log the log. Executes the
# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
# will run the test scripts (or their associated LOG_COMPILER, if
# thy have one).
am__check_pre = \
$(am__sh_e_setup); \
$(am__vpath_adj_setup) $(am__vpath_adj) \
$(am__tty_colors); \
srcdir=$(srcdir); export srcdir; \
case "$@" in \
*/*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
*) am__odir=.;; \
esac; \
test "x$$am__odir" = x"." || test -d "$$am__odir" \
|| $(MKDIR_P) "$$am__odir" || exit $$?; \
if test -f "./$$f"; then dir=./; \
elif test -f "$$f"; then dir=; \
else dir="$(srcdir)/"; fi; \
tst=$$dir$$f; log='$@'; \
if test -n '$(DISABLE_HARD_ERRORS)'; then \
am__enable_hard_errors=no; \
else \
am__enable_hard_errors=yes; \
fi; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
am__expect_failure=yes;; \
*) \
am__expect_failure=no;; \
esac; \
$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
# A shell command to get the names of the tests scripts with any registered
# extension removed (i.e., equivalently, the names of the test logs, with
# the '.log' extension removed). The result is saved in the shell variable
# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
# since that might cause problem with VPATH rewrites for suffix-less tests.
# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
am__set_TESTS_bases = \
bases='$(TEST_LOGS)'; \
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
bases=`echo $$bases`
AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check recheck
TEST_SUITE_LOG = test-suite.log
am__test_logs1 = $(TESTS:=.log)
am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
TEST_LOGS = $(am__test_logs2:.sh.log=.log)
SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
am__set_b = \
case '$@' in \
*/*) \
case '$*' in \
*/*) b='$*';; \
*) b=`echo '$@' | sed 's/\.log$$//'`; \
esac;; \
*) \
b='$*';; \
esac
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/set-envvars.in \
$(top_srcdir)/depcomp $(top_srcdir)/test-driver
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOL_LIBS = @SOL_LIBS@
STRIP = @STRIP@
VALGRIND = @VALGRIND@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
WARN_LDFLAGS = @WARN_LDFLAGS@
WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pthread_libs = @pthread_libs@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
rt_libs = @rt_libs@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
socket_libs = @socket_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
TEST_EXTENSIONS = .sh
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@tls_ossl_fd_reuse_SOURCES = tls-ossl-fd-reuse.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@tls_ossl_fd_reuse_LDADD = ../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@tls_ossl_fd_reuse_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_ossl_retry_state_SOURCES = tls-ossl-retry-state.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_ossl_retry_state_LDADD = ../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_ossl_retry_state_LDFLAGS = -Wl,--wrap=SSL_write -Wl,--wrap=SSL_read -Wl,--wrap=SSL_get_error
@BUILD_STATIC_TRUE@@ENABLE_TLS_OPENSSL_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_ossl_retry_state_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@permitted_peer_lifetime_SOURCES = permitted-peer-lifetime.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@permitted_peer_lifetime_LDADD = ../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@permitted_peer_lifetime_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tcp_accept_fd_reuse_SOURCES = tcp-accept-fd-reuse.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tcp_accept_fd_reuse_LDADD = ../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tcp_accept_fd_reuse_LDFLAGS = -Wl,--wrap=accept -Wl,--wrap=close
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tcp_accept_fd_reuse_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_gtls_lifecycle_SOURCES = tls-gtls-lifecycle.c
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_gtls_lifecycle_LDADD = ../src/.libs/librelp.a $(GNUTLS_LIBS) $(OPENSSL_LIBS) $(rt_libs) $(socket_libs) $(pthread_libs)
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_gtls_lifecycle_LDFLAGS = -Wl,--wrap=gnutls_bye -Wl,--wrap=gnutls_deinit \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ -Wl,--wrap=gnutls_certificate_free_credentials \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ -Wl,--wrap=gnutls_anon_free_client_credentials \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ -Wl,--wrap=gnutls_anon_free_server_credentials \
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@ -Wl,--wrap=gnutls_dh_params_deinit
@BUILD_STATIC_TRUE@@ENABLE_TLS_TRUE@@OS_SOLARIS_WRAP_FALSE@tls_gtls_lifecycle_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
receive_SOURCES = receive.c
receive_LDADD = ../src/.libs/librelp.la
receive_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
send_SOURCES = send.c
send_LDADD = ../src/.libs/librelp.la
send_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/src $(WARN_CFLAGS)
msleep_SOURCES = msleep.c
chkseq_SOURCES = chkseq.c
have_tlslib_SOURCES = have_tlslib.c
VALGRIND_TESTS = \
duplicate-receiver-vg.sh \
basic-sessionbreak-vg.sh
# TLS tests that work both with gnutls and openssl
TLS_TESTS = \
tls-basic.sh \
tls-basic-realistic.sh \
tls-basic-anon.sh \
tls-basic-certvalid.sh \
tls-basic-fingerprint.sh \
tls-basic-wildcard.sh \
tls-basic-tlscommand.sh \
tls-basic-tlscommand-ciphers.sh \
tls-basic-certchain.sh \
tls-basic-certvalid-mixed.sh \
tls-receiver-abort.sh \
tls-missing-param-sender.sh \
tls-missing-param-receiver.sh
TLS_VALGRIND_TESTS = \
tls-basic-vg.sh \
tls-ossl-connect-failure-vg.sh
# static tests specific to GnuTLS
GTLS_STATIC_TESTS = \
tcp-accept-fd-reuse.sh \
tls-gtls-lifecycle.sh
TLS_STATIC_TESTS = \
permitted-peer-lifetime.sh
# test specific to openssl
OSSL_TESTS = \
tls-wrong-permittedPeer.sh \
tls-wrong-authname.sh \
tls-wrong-signedcert.sh
OSSL_STATIC_TESTS = \
tls-ossl-fd-reuse.sh
OSSL_WRAP_STATIC_TESTS = \
tls-ossl-retry-state.sh
# reenable tests when stable
# tls-basic-brokencert.sh
TESTS = selftest_receive_watchdog.sh selftest_receive_usage.sh \
basic.sh basic-realistic.sh session-callbacks.sh \
receiver-abort.sh long-msg.sh oversize-msg-abort-errmsg.sh \
oversize-msg-accept-errmsg.sh truncate-oversize-msg.sh \
send-noconnect.sh send-dummyserver-no-waitstate-errmsg.sh \
receive-emptyconnect.sh $(am__append_5) $(am__append_6) \
$(am__append_7) $(am__append_8) $(am__append_9) \
$(am__append_10) $(am__append_11) $(am__append_12)
EXTRA_DIST = $(TESTS) \
$(TLS_TESTS) \
$(GTLS_STATIC_TESTS) \
$(OSSL_TESTS) \
$(OSSL_STATIC_TESTS) \
$(OSSL_WRAP_STATIC_TESTS) \
$(TLS_VALGRIND_TESTS) \
$(VALGRIND_TESTS) \
set-envvars.in \
dummyclient.py \
dummyserver.py \
invalid-open.py \
session-callbacks.sh \
test-framework.sh \
receive.c \
send.c \
tls-ossl-fd-reuse.c \
tls-ossl-retry-state.c \
tcp-accept-fd-reuse.c \
tls-gtls-lifecycle.c \
permitted-peer-lifetime.c \
tls-certs/ca.pem \
tls-certs/cert.pem \
tls-certs/key.pem \
tls-certs/certchain.pem \
tls-certs/ossl-ca.pem \
tls-certs/ossl-ca-key.pem \
tls-certs/ossl-client-cert.pem \
tls-certs/ossl-client-key.pem \
tls-certs/ossl-client-certchain.pem \
tls-certs/ossl-clientbrok-cert.pem \
tls-certs/ossl-clientbrok-key.pem \
tls-certs/ossl-server-cert.pem \
tls-certs/ossl-server-key.pem \
tls-certs/ossl-server-certchain.pem
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .log .o .obj .sh .sh$(EXEEXT) .trs
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu tests/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
set-envvars: $(top_builddir)/config.status $(srcdir)/set-envvars.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
chkseq$(EXEEXT): $(chkseq_OBJECTS) $(chkseq_DEPENDENCIES) $(EXTRA_chkseq_DEPENDENCIES)
@rm -f chkseq$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(chkseq_OBJECTS) $(chkseq_LDADD) $(LIBS)
have_tlslib$(EXEEXT): $(have_tlslib_OBJECTS) $(have_tlslib_DEPENDENCIES) $(EXTRA_have_tlslib_DEPENDENCIES)
@rm -f have_tlslib$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(have_tlslib_OBJECTS) $(have_tlslib_LDADD) $(LIBS)
msleep$(EXEEXT): $(msleep_OBJECTS) $(msleep_DEPENDENCIES) $(EXTRA_msleep_DEPENDENCIES)
@rm -f msleep$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(msleep_OBJECTS) $(msleep_LDADD) $(LIBS)
permitted_peer_lifetime$(EXEEXT): $(permitted_peer_lifetime_OBJECTS) $(permitted_peer_lifetime_DEPENDENCIES) $(EXTRA_permitted_peer_lifetime_DEPENDENCIES)
@rm -f permitted_peer_lifetime$(EXEEXT)
$(AM_V_CCLD)$(permitted_peer_lifetime_LINK) $(permitted_peer_lifetime_OBJECTS) $(permitted_peer_lifetime_LDADD) $(LIBS)
receive$(EXEEXT): $(receive_OBJECTS) $(receive_DEPENDENCIES) $(EXTRA_receive_DEPENDENCIES)
@rm -f receive$(EXEEXT)
$(AM_V_CCLD)$(receive_LINK) $(receive_OBJECTS) $(receive_LDADD) $(LIBS)
send$(EXEEXT): $(send_OBJECTS) $(send_DEPENDENCIES) $(EXTRA_send_DEPENDENCIES)
@rm -f send$(EXEEXT)
$(AM_V_CCLD)$(send_LINK) $(send_OBJECTS) $(send_LDADD) $(LIBS)
tcp_accept_fd_reuse$(EXEEXT): $(tcp_accept_fd_reuse_OBJECTS) $(tcp_accept_fd_reuse_DEPENDENCIES) $(EXTRA_tcp_accept_fd_reuse_DEPENDENCIES)
@rm -f tcp_accept_fd_reuse$(EXEEXT)
$(AM_V_CCLD)$(tcp_accept_fd_reuse_LINK) $(tcp_accept_fd_reuse_OBJECTS) $(tcp_accept_fd_reuse_LDADD) $(LIBS)
tls_gtls_lifecycle$(EXEEXT): $(tls_gtls_lifecycle_OBJECTS) $(tls_gtls_lifecycle_DEPENDENCIES) $(EXTRA_tls_gtls_lifecycle_DEPENDENCIES)
@rm -f tls_gtls_lifecycle$(EXEEXT)
$(AM_V_CCLD)$(tls_gtls_lifecycle_LINK) $(tls_gtls_lifecycle_OBJECTS) $(tls_gtls_lifecycle_LDADD) $(LIBS)
tls_ossl_fd_reuse$(EXEEXT): $(tls_ossl_fd_reuse_OBJECTS) $(tls_ossl_fd_reuse_DEPENDENCIES) $(EXTRA_tls_ossl_fd_reuse_DEPENDENCIES)
@rm -f tls_ossl_fd_reuse$(EXEEXT)
$(AM_V_CCLD)$(tls_ossl_fd_reuse_LINK) $(tls_ossl_fd_reuse_OBJECTS) $(tls_ossl_fd_reuse_LDADD) $(LIBS)
tls_ossl_retry_state$(EXEEXT): $(tls_ossl_retry_state_OBJECTS) $(tls_ossl_retry_state_DEPENDENCIES) $(EXTRA_tls_ossl_retry_state_DEPENDENCIES)
@rm -f tls_ossl_retry_state$(EXEEXT)
$(AM_V_CCLD)$(tls_ossl_retry_state_LINK) $(tls_ossl_retry_state_OBJECTS) $(tls_ossl_retry_state_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkseq.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/have_tlslib.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msleep.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/receive-receive.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send-send.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
permitted_peer_lifetime-permitted-peer-lifetime.o: permitted-peer-lifetime.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(permitted_peer_lifetime_CFLAGS) $(CFLAGS) -MT permitted_peer_lifetime-permitted-peer-lifetime.o -MD -MP -MF $(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Tpo -c -o permitted_peer_lifetime-permitted-peer-lifetime.o `test -f 'permitted-peer-lifetime.c' || echo '$(srcdir)/'`permitted-peer-lifetime.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Tpo $(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='permitted-peer-lifetime.c' object='permitted_peer_lifetime-permitted-peer-lifetime.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(permitted_peer_lifetime_CFLAGS) $(CFLAGS) -c -o permitted_peer_lifetime-permitted-peer-lifetime.o `test -f 'permitted-peer-lifetime.c' || echo '$(srcdir)/'`permitted-peer-lifetime.c
permitted_peer_lifetime-permitted-peer-lifetime.obj: permitted-peer-lifetime.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(permitted_peer_lifetime_CFLAGS) $(CFLAGS) -MT permitted_peer_lifetime-permitted-peer-lifetime.obj -MD -MP -MF $(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Tpo -c -o permitted_peer_lifetime-permitted-peer-lifetime.obj `if test -f 'permitted-peer-lifetime.c'; then $(CYGPATH_W) 'permitted-peer-lifetime.c'; else $(CYGPATH_W) '$(srcdir)/permitted-peer-lifetime.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Tpo $(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='permitted-peer-lifetime.c' object='permitted_peer_lifetime-permitted-peer-lifetime.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(permitted_peer_lifetime_CFLAGS) $(CFLAGS) -c -o permitted_peer_lifetime-permitted-peer-lifetime.obj `if test -f 'permitted-peer-lifetime.c'; then $(CYGPATH_W) 'permitted-peer-lifetime.c'; else $(CYGPATH_W) '$(srcdir)/permitted-peer-lifetime.c'; fi`
receive-receive.o: receive.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(receive_CFLAGS) $(CFLAGS) -MT receive-receive.o -MD -MP -MF $(DEPDIR)/receive-receive.Tpo -c -o receive-receive.o `test -f 'receive.c' || echo '$(srcdir)/'`receive.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/receive-receive.Tpo $(DEPDIR)/receive-receive.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='receive.c' object='receive-receive.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(receive_CFLAGS) $(CFLAGS) -c -o receive-receive.o `test -f 'receive.c' || echo '$(srcdir)/'`receive.c
receive-receive.obj: receive.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(receive_CFLAGS) $(CFLAGS) -MT receive-receive.obj -MD -MP -MF $(DEPDIR)/receive-receive.Tpo -c -o receive-receive.obj `if test -f 'receive.c'; then $(CYGPATH_W) 'receive.c'; else $(CYGPATH_W) '$(srcdir)/receive.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/receive-receive.Tpo $(DEPDIR)/receive-receive.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='receive.c' object='receive-receive.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(receive_CFLAGS) $(CFLAGS) -c -o receive-receive.obj `if test -f 'receive.c'; then $(CYGPATH_W) 'receive.c'; else $(CYGPATH_W) '$(srcdir)/receive.c'; fi`
send-send.o: send.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(send_CFLAGS) $(CFLAGS) -MT send-send.o -MD -MP -MF $(DEPDIR)/send-send.Tpo -c -o send-send.o `test -f 'send.c' || echo '$(srcdir)/'`send.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/send-send.Tpo $(DEPDIR)/send-send.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='send.c' object='send-send.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(send_CFLAGS) $(CFLAGS) -c -o send-send.o `test -f 'send.c' || echo '$(srcdir)/'`send.c
send-send.obj: send.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(send_CFLAGS) $(CFLAGS) -MT send-send.obj -MD -MP -MF $(DEPDIR)/send-send.Tpo -c -o send-send.obj `if test -f 'send.c'; then $(CYGPATH_W) 'send.c'; else $(CYGPATH_W) '$(srcdir)/send.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/send-send.Tpo $(DEPDIR)/send-send.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='send.c' object='send-send.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(send_CFLAGS) $(CFLAGS) -c -o send-send.obj `if test -f 'send.c'; then $(CYGPATH_W) 'send.c'; else $(CYGPATH_W) '$(srcdir)/send.c'; fi`
tcp_accept_fd_reuse-tcp-accept-fd-reuse.o: tcp-accept-fd-reuse.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcp_accept_fd_reuse_CFLAGS) $(CFLAGS) -MT tcp_accept_fd_reuse-tcp-accept-fd-reuse.o -MD -MP -MF $(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Tpo -c -o tcp_accept_fd_reuse-tcp-accept-fd-reuse.o `test -f 'tcp-accept-fd-reuse.c' || echo '$(srcdir)/'`tcp-accept-fd-reuse.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Tpo $(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tcp-accept-fd-reuse.c' object='tcp_accept_fd_reuse-tcp-accept-fd-reuse.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcp_accept_fd_reuse_CFLAGS) $(CFLAGS) -c -o tcp_accept_fd_reuse-tcp-accept-fd-reuse.o `test -f 'tcp-accept-fd-reuse.c' || echo '$(srcdir)/'`tcp-accept-fd-reuse.c
tcp_accept_fd_reuse-tcp-accept-fd-reuse.obj: tcp-accept-fd-reuse.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcp_accept_fd_reuse_CFLAGS) $(CFLAGS) -MT tcp_accept_fd_reuse-tcp-accept-fd-reuse.obj -MD -MP -MF $(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Tpo -c -o tcp_accept_fd_reuse-tcp-accept-fd-reuse.obj `if test -f 'tcp-accept-fd-reuse.c'; then $(CYGPATH_W) 'tcp-accept-fd-reuse.c'; else $(CYGPATH_W) '$(srcdir)/tcp-accept-fd-reuse.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Tpo $(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tcp-accept-fd-reuse.c' object='tcp_accept_fd_reuse-tcp-accept-fd-reuse.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcp_accept_fd_reuse_CFLAGS) $(CFLAGS) -c -o tcp_accept_fd_reuse-tcp-accept-fd-reuse.obj `if test -f 'tcp-accept-fd-reuse.c'; then $(CYGPATH_W) 'tcp-accept-fd-reuse.c'; else $(CYGPATH_W) '$(srcdir)/tcp-accept-fd-reuse.c'; fi`
tls_gtls_lifecycle-tls-gtls-lifecycle.o: tls-gtls-lifecycle.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_gtls_lifecycle_CFLAGS) $(CFLAGS) -MT tls_gtls_lifecycle-tls-gtls-lifecycle.o -MD -MP -MF $(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Tpo -c -o tls_gtls_lifecycle-tls-gtls-lifecycle.o `test -f 'tls-gtls-lifecycle.c' || echo '$(srcdir)/'`tls-gtls-lifecycle.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Tpo $(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls-gtls-lifecycle.c' object='tls_gtls_lifecycle-tls-gtls-lifecycle.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_gtls_lifecycle_CFLAGS) $(CFLAGS) -c -o tls_gtls_lifecycle-tls-gtls-lifecycle.o `test -f 'tls-gtls-lifecycle.c' || echo '$(srcdir)/'`tls-gtls-lifecycle.c
tls_gtls_lifecycle-tls-gtls-lifecycle.obj: tls-gtls-lifecycle.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_gtls_lifecycle_CFLAGS) $(CFLAGS) -MT tls_gtls_lifecycle-tls-gtls-lifecycle.obj -MD -MP -MF $(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Tpo -c -o tls_gtls_lifecycle-tls-gtls-lifecycle.obj `if test -f 'tls-gtls-lifecycle.c'; then $(CYGPATH_W) 'tls-gtls-lifecycle.c'; else $(CYGPATH_W) '$(srcdir)/tls-gtls-lifecycle.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Tpo $(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls-gtls-lifecycle.c' object='tls_gtls_lifecycle-tls-gtls-lifecycle.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_gtls_lifecycle_CFLAGS) $(CFLAGS) -c -o tls_gtls_lifecycle-tls-gtls-lifecycle.obj `if test -f 'tls-gtls-lifecycle.c'; then $(CYGPATH_W) 'tls-gtls-lifecycle.c'; else $(CYGPATH_W) '$(srcdir)/tls-gtls-lifecycle.c'; fi`
tls_ossl_fd_reuse-tls-ossl-fd-reuse.o: tls-ossl-fd-reuse.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_fd_reuse_CFLAGS) $(CFLAGS) -MT tls_ossl_fd_reuse-tls-ossl-fd-reuse.o -MD -MP -MF $(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Tpo -c -o tls_ossl_fd_reuse-tls-ossl-fd-reuse.o `test -f 'tls-ossl-fd-reuse.c' || echo '$(srcdir)/'`tls-ossl-fd-reuse.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Tpo $(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls-ossl-fd-reuse.c' object='tls_ossl_fd_reuse-tls-ossl-fd-reuse.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_fd_reuse_CFLAGS) $(CFLAGS) -c -o tls_ossl_fd_reuse-tls-ossl-fd-reuse.o `test -f 'tls-ossl-fd-reuse.c' || echo '$(srcdir)/'`tls-ossl-fd-reuse.c
tls_ossl_fd_reuse-tls-ossl-fd-reuse.obj: tls-ossl-fd-reuse.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_fd_reuse_CFLAGS) $(CFLAGS) -MT tls_ossl_fd_reuse-tls-ossl-fd-reuse.obj -MD -MP -MF $(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Tpo -c -o tls_ossl_fd_reuse-tls-ossl-fd-reuse.obj `if test -f 'tls-ossl-fd-reuse.c'; then $(CYGPATH_W) 'tls-ossl-fd-reuse.c'; else $(CYGPATH_W) '$(srcdir)/tls-ossl-fd-reuse.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Tpo $(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls-ossl-fd-reuse.c' object='tls_ossl_fd_reuse-tls-ossl-fd-reuse.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_fd_reuse_CFLAGS) $(CFLAGS) -c -o tls_ossl_fd_reuse-tls-ossl-fd-reuse.obj `if test -f 'tls-ossl-fd-reuse.c'; then $(CYGPATH_W) 'tls-ossl-fd-reuse.c'; else $(CYGPATH_W) '$(srcdir)/tls-ossl-fd-reuse.c'; fi`
tls_ossl_retry_state-tls-ossl-retry-state.o: tls-ossl-retry-state.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_retry_state_CFLAGS) $(CFLAGS) -MT tls_ossl_retry_state-tls-ossl-retry-state.o -MD -MP -MF $(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Tpo -c -o tls_ossl_retry_state-tls-ossl-retry-state.o `test -f 'tls-ossl-retry-state.c' || echo '$(srcdir)/'`tls-ossl-retry-state.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Tpo $(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls-ossl-retry-state.c' object='tls_ossl_retry_state-tls-ossl-retry-state.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_retry_state_CFLAGS) $(CFLAGS) -c -o tls_ossl_retry_state-tls-ossl-retry-state.o `test -f 'tls-ossl-retry-state.c' || echo '$(srcdir)/'`tls-ossl-retry-state.c
tls_ossl_retry_state-tls-ossl-retry-state.obj: tls-ossl-retry-state.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_retry_state_CFLAGS) $(CFLAGS) -MT tls_ossl_retry_state-tls-ossl-retry-state.obj -MD -MP -MF $(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Tpo -c -o tls_ossl_retry_state-tls-ossl-retry-state.obj `if test -f 'tls-ossl-retry-state.c'; then $(CYGPATH_W) 'tls-ossl-retry-state.c'; else $(CYGPATH_W) '$(srcdir)/tls-ossl-retry-state.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Tpo $(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls-ossl-retry-state.c' object='tls_ossl_retry_state-tls-ossl-retry-state.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tls_ossl_retry_state_CFLAGS) $(CFLAGS) -c -o tls_ossl_retry_state-tls-ossl-retry-state.obj `if test -f 'tls-ossl-retry-state.c'; then $(CYGPATH_W) 'tls-ossl-retry-state.c'; else $(CYGPATH_W) '$(srcdir)/tls-ossl-retry-state.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
# Recover from deleted '.trs' file; this should ensure that
# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
# to avoid problems with "make -n".
.log.trs:
rm -f $< $@
$(MAKE) $(AM_MAKEFLAGS) $<
# Leading 'am--fnord' is there to ensure the list of targets does not
# expand to empty, as could happen e.g. with make check TESTS=''.
am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
am--force-recheck:
@:
$(TEST_SUITE_LOG): $(TEST_LOGS)
@$(am__set_TESTS_bases); \
am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
redo_bases=`for i in $$bases; do \
am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
done`; \
if test -n "$$redo_bases"; then \
redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
if $(am__make_dryrun); then :; else \
rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
fi; \
fi; \
if test -n "$$am__remaking_logs"; then \
echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
"recursion detected" >&2; \
elif test -n "$$redo_logs"; then \
am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
fi; \
if $(am__make_dryrun); then :; else \
st=0; \
errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
for i in $$redo_bases; do \
test -f $$i.trs && test -r $$i.trs \
|| { echo "$$errmsg $$i.trs" >&2; st=1; }; \
test -f $$i.log && test -r $$i.log \
|| { echo "$$errmsg $$i.log" >&2; st=1; }; \
done; \
test $$st -eq 0 || exit 1; \
fi
@$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
ws='[ ]'; \
results=`for b in $$bases; do echo $$b.trs; done`; \
test -n "$$results" || results=/dev/null; \
all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
if test `expr $$fail + $$xpass + $$error` -eq 0; then \
success=true; \
else \
success=false; \
fi; \
br='==================='; br=$$br$$br$$br$$br; \
result_count () \
{ \
if test x"$$1" = x"--maybe-color"; then \
maybe_colorize=yes; \
elif test x"$$1" = x"--no-color"; then \
maybe_colorize=no; \
else \
echo "$@: invalid 'result_count' usage" >&2; exit 4; \
fi; \
shift; \
desc=$$1 count=$$2; \
if test $$maybe_colorize = yes && test $$count -gt 0; then \
color_start=$$3 color_end=$$std; \
else \
color_start= color_end=; \
fi; \
echo "$${color_start}# $$desc $$count$${color_end}"; \
}; \
create_testsuite_report () \
{ \
result_count $$1 "TOTAL:" $$all "$$brg"; \
result_count $$1 "PASS: " $$pass "$$grn"; \
result_count $$1 "SKIP: " $$skip "$$blu"; \
result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
result_count $$1 "FAIL: " $$fail "$$red"; \
result_count $$1 "XPASS:" $$xpass "$$red"; \
result_count $$1 "ERROR:" $$error "$$mgn"; \
}; \
{ \
echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
$(am__rst_title); \
create_testsuite_report --no-color; \
echo; \
echo ".. contents:: :depth: 2"; \
echo; \
for b in $$bases; do echo $$b; done \
| $(am__create_global_log); \
} >$(TEST_SUITE_LOG).tmp || exit 1; \
mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
if $$success; then \
col="$$grn"; \
else \
col="$$red"; \
test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
fi; \
echo "$${col}$$br$${std}"; \
echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
echo "$${col}$$br$${std}"; \
create_testsuite_report --maybe-color; \
echo "$$col$$br$$std"; \
if $$success; then :; else \
echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
if test -n "$(PACKAGE_BUGREPORT)"; then \
echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
fi; \
echo "$$col$$br$$std"; \
fi; \
$$success || exit 1
check-TESTS: $(check_PROGRAMS)
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set +e; $(am__set_TESTS_bases); \
log_list=`for i in $$bases; do echo $$i.log; done`; \
trs_list=`for i in $$bases; do echo $$i.trs; done`; \
log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
exit $$?;
recheck: all $(check_PROGRAMS)
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set +e; $(am__set_TESTS_bases); \
bases=`for i in $$bases; do echo $$i; done \
| $(am__list_recheck_tests)` || exit 1; \
log_list=`for i in $$bases; do echo $$i.log; done`; \
log_list=`echo $$log_list`; \
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
am__force_recheck=am--force-recheck \
TEST_LOGS="$$log_list"; \
exit $$?
.sh.log:
@p='$<'; \
$(am__set_b); \
$(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
@am__EXEEXT_TRUE@.sh$(EXEEXT).log:
@am__EXEEXT_TRUE@ @p='$<'; \
@am__EXEEXT_TRUE@ $(am__set_b); \
@am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
-test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
-test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
-test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/chkseq.Po
-rm -f ./$(DEPDIR)/have_tlslib.Po
-rm -f ./$(DEPDIR)/msleep.Po
-rm -f ./$(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Po
-rm -f ./$(DEPDIR)/receive-receive.Po
-rm -f ./$(DEPDIR)/send-send.Po
-rm -f ./$(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Po
-rm -f ./$(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Po
-rm -f ./$(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Po
-rm -f ./$(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/chkseq.Po
-rm -f ./$(DEPDIR)/have_tlslib.Po
-rm -f ./$(DEPDIR)/msleep.Po
-rm -f ./$(DEPDIR)/permitted_peer_lifetime-permitted-peer-lifetime.Po
-rm -f ./$(DEPDIR)/receive-receive.Po
-rm -f ./$(DEPDIR)/send-send.Po
-rm -f ./$(DEPDIR)/tcp_accept_fd_reuse-tcp-accept-fd-reuse.Po
-rm -f ./$(DEPDIR)/tls_gtls_lifecycle-tls-gtls-lifecycle.Po
-rm -f ./$(DEPDIR)/tls_ossl_fd_reuse-tls-ossl-fd-reuse.Po
-rm -f ./$(DEPDIR)/tls_ossl_retry_state-tls-ossl-retry-state.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
cscopelist-am ctags ctags-am distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
recheck tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
librelp-1.13.0/tests/send.c 0000664 0001750 0001750 00000030365 15111360423 011152 /* A RELP sender for the testbench.
*
* Copyright 2018 Adiscon GmbH
* Copyright 2014 Mathias Nyman
*
* See getopt() call below for command line options. There is a brief
* (buf hopefully sufficient) comment describing what each option does.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include
#include
#include
#include
#include
#if defined(_AIX)
# include
#else
# include
#endif
#include
#include
#include
#include "librelp.h"
#define TRY(f) if(f != RELP_RET_OK) { fprintf(stderr, "send: FAILURE in '%s'\n", #f); ret = 1; goto done; }
static const char *under_ci = NULL; /* if non-null, we run under CI, so be even more sparse with stdout */
static FILE *errFile = NULL;
static FILE *dbgFile = NULL;
static relpEngine_t *pRelpEngine;
static size_t msgDataLen = 0;
static int num_messages = 0;
static size_t lenMsg = 0;
static relpClt_t *pRelpClt = NULL;
static int kill_on_msg = 0; /* 0 - do not kill, else exact message */
static int kill_signal = SIGUSR1; /* signal to use when we kill */
static pid_t kill_pid = 0;
static int connect_retries = 15; /* how many retries on connect failure? */
#define USR_MAGIC 0x1234FFee
struct usrdata { /* used for testing user pointer pass-back */
int magic;
char *progname;
};
struct usrdata *userdata = NULL;
static void
hdlr_enable(int sig, void (*hdlr)(const int))
{
struct sigaction sigAct;
memset(&sigAct, 0, sizeof (sigAct));
sigemptyset(&sigAct.sa_mask);
sigAct.sa_handler = hdlr;
sigaction(sig, &sigAct, NULL);
}
/* handler for unexpected signals. */
static void LIBRELP_ATTR_NORETURN
do_signal(const int sig)
{
fprintf(stderr, "send: UNEXPECTED SIGNAL %d%s- terminating\n", sig,
sig == SIGPIPE ? " [SIGPIPE]" : "");
fflush(stderr);
exit(100);
}
static void LIBRELP_ATTR_FORMAT(printf, 1, 2)
dbgprintf(char *fmt, ...)
{
va_list ap;
char pszWriteBuf[32*1024+1];
va_start(ap, fmt);
vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap);
va_end(ap);
fprintf(dbgFile, "send.c: %s", pszWriteBuf);
}
static void print_usage(void)
{
printf("Usage: send -t -p -m \n");
}
static void
onErr(void *pUsr, char *objinfo, char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
{
struct usrdata *pThis = (struct usrdata*) pUsr;
if(pUsr != NULL) {
if(pUsr != userdata) {
fprintf(stderr, "send: pUsr %p NOT pointing to userdata %p!\n", pUsr, (void*)userdata);
}
if(pThis->magic != USR_MAGIC) {
fprintf(stderr, "send: pUsr magic incorrect in onErr, magic %8.8x "
"pUsr %p\n", pThis->magic, (void*) pThis);
}
fprintf(stderr, "%s: error '%s', object '%s'\n", pThis->progname, errmesg, objinfo);
} else {
fprintf(stderr, "send: [pUsr==NULL] error '%s', object '%s'\n", errmesg, objinfo);
}
if(errFile != NULL) {
fprintf(errFile, "send: error '%s', object '%s'\n", errmesg, objinfo);
}
}
static void
onGenericErr(char *objinfo, char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
{
fprintf(stderr, "send: librelp error '%s', object '%s'\n", errmesg, objinfo);
if(errFile != NULL) {
fprintf(errFile, "send: librelp error '%s', object '%s'\n", errmesg, objinfo);
}
}
static void
onAuthErr( LIBRELP_ATTR_UNUSED void *pUsr, char *authinfo,
char* errmesg, LIBRELP_ATTR_UNUSED relpRetVal errcode)
{
fprintf(stderr, "send: authentication error '%s', object '%s'\n", errmesg, authinfo);
if(errFile != NULL) {
fprintf(errFile, "send: authentication error '%s', object '%s'\n", errmesg, authinfo);
}
}
static void
exit_hdlr(void)
{
if(userdata != NULL) {
free(userdata->progname);
free(userdata);
}
if(errFile != NULL) {
fclose(errFile);
}
if(dbgFile != NULL) {
fclose(dbgFile);
}
}
static void
retry_connect(void)
{
relpRetVal ret;
int try = 0;
while(try++ < connect_retries) {
relpEngineSetDbgprint(pRelpEngine, dbgprintf);
fprintf(stderr, "send: doing retry %d\n", try);
ret = relpCltReconnect(pRelpClt);
fprintf(stderr, "send: after retry ret %d\n", ret);
if(ret == RELP_RET_OK) {
relpEngineSetDbgprint(pRelpEngine, NULL);
fprintf(stderr, "send: receiver up again in retry %d\n", try);
return;
}
sleep(1);
}
fprintf(stderr, "send: send giving up after max retries\n");
fflush(stderr);
exit(1);
}
static void
send_msgs_counter(void)
{
char buf[10];
relpRetVal r;
for(int i = 1 ; i <= num_messages ; ++i) {
const ssize_t len = snprintf(buf, sizeof(buf), "%8.8d", i);
if(len < 0 || len >= (ssize_t) sizeof(buf)) {
fprintf(stderr, "send: ERROR: snprintf failed with %lld\n", (long long) len);
exit(1);
}
if(!under_ci && (i % 1000 == 0)) {
printf("\r%8.8d msgs sent", i);
}
r = relpCltSendSyslog(pRelpClt, (unsigned char*)buf, len);
if(r != RELP_RET_OK) {
fprintf(stderr, "send: failure %d in relpCltSendSyslog, msg %d\n", r, i);
if(dbgFile != NULL)
fprintf(dbgFile, "\n\nfailure %d in relpCltSendSyslog, msg %d\n\n\n", r, i);
retry_connect();
--i; /* we need to-resend the failed message */
}
if(kill_on_msg == i) {
kill_on_msg = 0; /* do this only once, even in retry mode */
fprintf(stderr, " sending signal %d to %lld\n", kill_signal, (long long) kill_pid);
if(kill(kill_pid, kill_signal) != 0) {
perror("kill process");
}
}
}
printf("\r%8.8d msgs sent\n", num_messages);
}
static int
send_msgs_single(const char *pMsg)
{
int ret = 0;
char *msgData = NULL;
if(msgDataLen != 0) {
msgData = malloc(msgDataLen+1);
strcpy(msgData, pMsg);
/* fill with 01234567890123... digit sequence */
size_t i;
for(i=0; i < (msgDataLen-lenMsg); i++) {
*(msgData+lenMsg+i) = i%10 + '0';
}
msgData[msgDataLen] = '\0';
pMsg = msgData;
lenMsg = msgDataLen;
}
TRY(relpCltSendSyslog(pRelpClt, (unsigned char *)pMsg, lenMsg));
if(msgDataLen != 0) {
free((void *)pMsg);
}
done: return ret;
}
int main(int argc, char *argv[]) {
int c;
int option_index = 0;
unsigned char *port = NULL;
unsigned char *target = NULL;
const char *pMsg = NULL;
unsigned timeout = 90;
int verbose = 0;
int protFamily = 2; /* IPv4=2, IPv6=10 */
int bEnableTLS = 0;
int no_exit_on_err = 0;
char *caCertFile = NULL;
char *myCertFile = NULL;
char *myPrivKeyFile = NULL;
char *tlsConfigCmd = NULL;
char *permittedPeer = NULL;
char *authMode = NULL;
const char *tlslib = NULL;
int len = 0;
int ret = 0;
under_ci = getenv("UNDER_CI");
dbgFile = stdout;
#define KILL_ON_MSG 'K'
#define KILL_SIGNAL 'S'
#define KILL_PID 'I'
#define DBGFILE 'D'
#define CONNECT_RETRIES 'R'
#if defined(_AIX)
while((c = getopt(argc, argv, "a:c:e:d:D:I:K:l:m:n:NP:p:R:S:Tt:vx:y:z:")) != EOF) {
#else
static struct option long_options[] =
{
{"ca", required_argument, 0, 'x'},
{"cert", required_argument, 0, 'y'},
{"key", required_argument, 0, 'z'},
{"peer", required_argument, 0, 'P'},
{"authmode", required_argument, 0, 'a'},
{"errorfile", required_argument, 0, 'e'},
{"tls-lib", required_argument, 0, 'l'},
{"tlsconfcmd", required_argument, 0, 'c'},
{"debugfile", required_argument, 0, DBGFILE},
{"num-messages", required_argument, 0, 'n'},
{"kill-on-msg", required_argument, 0, KILL_ON_MSG},
{"kill-signal", required_argument, 0, KILL_SIGNAL},
{"kill-pid", required_argument, 0, KILL_PID},
{"connect-retries", required_argument, 0, CONNECT_RETRIES},
{"no-exit-on-error", no_argument, 0, 'N'},
{0, 0, 0, 0}
};
while((c = getopt_long(argc, argv, "a:c:e:d:D:I:K:l:m:n:NP:p:R:S:Tt:vx:y:z:", long_options, &option_index)) != -1) {
#endif
switch(c) {
case 'a':
authMode = optarg;
break;
case 'c':
tlsConfigCmd = optarg;
break;
case 'e':
if((errFile = fopen(optarg, "w")) == NULL) {
perror(optarg);
fprintf(stderr, "error opening error file\n");
exit(1);
}
break;
case DBGFILE:
if((dbgFile = fopen(optarg, "w")) == NULL) {
perror(optarg);
fprintf(stderr, "error opening debug file\n");
exit(1);
}
break;
case 'd':
len = atoi(optarg);
if(len < 128) {
fprintf(stderr, "send.c: messageSize has invalid "
"value: %d - must be at least 128\n", len);
exit(1);
} else {
msgDataLen = len;
}
break;
case 'v':
verbose = 1;
break;
case 'l': /* tls lib */
tlslib = optarg;
break;
case 'm': /* message text to send */
pMsg = (const char*)optarg;
lenMsg = strlen(pMsg);
break;
case 'n':
num_messages = atoi(optarg);
break;
case 'P':
permittedPeer = optarg;
break;
case 'p':
port = (unsigned char*)optarg;
break;
case 'T':
bEnableTLS = 1;
break;
case 't':
target = (unsigned char*)optarg;
break;
case 'x':
caCertFile = optarg;
break;
case 'y':
myCertFile = optarg;
break;
case 'z':
myPrivKeyFile = optarg;
break;
case 'N':
no_exit_on_err = 1;
break;
case KILL_ON_MSG:
kill_on_msg = atoi(optarg);
break;
case KILL_SIGNAL:
kill_signal = atoi(optarg);
break;
case KILL_PID:
kill_pid = atoi(optarg);
break;
case CONNECT_RETRIES:
connect_retries = atoi(optarg);
break;
default:
print_usage();
exit(1);
}
}
atexit(exit_hdlr);
if (no_exit_on_err == 0) {
hdlr_enable(SIGPIPE, do_signal);
} else {
signal(SIGPIPE, SIG_IGN);
}
if(msgDataLen != 0 && msgDataLen < lenMsg) {
fprintf(stderr, "send: message is larger than configured message size!\n");
exit(1);
}
if (target == NULL || port == NULL || (pMsg == NULL && num_messages == 0)) {
printf("Missing parameter\n");
print_usage();
exit(1);
}
if(authMode != NULL) {
if( (strcasecmp(authMode, "certvalid") != 0 && permittedPeer == NULL) ||
myCertFile == NULL || myPrivKeyFile == NULL) {
printf("send: mode '%s' parameter missing; certificates and permittedPeer required\n",
authMode);
exit(1);
}
}
if(caCertFile != NULL || myCertFile != NULL || myPrivKeyFile != NULL) {
if(bEnableTLS == 0) {
printf("send: Certificates were specified, but TLS was "
"not enabled! To enable it use parameter \"-T\"\n");
exit(1);
}
}
if(tlsConfigCmd != NULL) {
if(bEnableTLS == 0) {
fprintf(stderr, "send: tls config command were specified, but TLS was "
"not enabled! To enable it use parameter \"-T\"\n");
goto done;
}
}
TRY(relpEngineConstruct(&pRelpEngine));
TRY(relpEngineSetDbgprint(pRelpEngine, verbose ? dbgprintf : NULL));
TRY(relpEngineSetOnErr(pRelpEngine, onErr));
TRY(relpEngineSetOnGenericErr(pRelpEngine, onGenericErr));
TRY(relpEngineSetOnAuthErr(pRelpEngine, onAuthErr));
if(tlslib != NULL) {
TRY(relpEngineSetTLSLibByName(pRelpEngine, tlslib));
}
TRY(relpEngineSetEnableCmd(pRelpEngine, (unsigned char*)"syslog", eRelpCmdState_Required));
TRY(relpEngineCltConstruct(pRelpEngine, &pRelpClt));
// Create userdata pointer as soon as possible for error callbacks
userdata = calloc(1, sizeof(struct usrdata));
userdata->magic = USR_MAGIC;
userdata->progname = strdup("send");
TRY(relpCltSetUsrPtr(pRelpClt, userdata));
TRY(relpCltSetTimeout(pRelpClt, timeout));
if(bEnableTLS) {
TRY(relpCltEnableTLS(pRelpClt));
TRY(relpCltSetTlsConfigCmd(pRelpClt, tlsConfigCmd));
if(authMode != NULL) {
TRY(relpCltSetAuthMode(pRelpClt, authMode));
TRY(relpCltSetCACert(pRelpClt, caCertFile));
TRY(relpCltSetOwnCert(pRelpClt, myCertFile));
TRY(relpCltSetPrivKey(pRelpClt, myPrivKeyFile));
if (permittedPeer != NULL) {
TRY(relpCltAddPermittedPeer(pRelpClt, permittedPeer));
}
}
printf("send: Init TLS Parameters DONE\n");
}
// Need to check error code!
ret = relpCltConnect(pRelpClt, protFamily, port, target);
if(ret != RELP_RET_OK) {
fprintf(stderr, "send: FAILURE in 'relpCltConnect' with errorcode %d\n", ret);
ret = 1;
goto done;
}
printf("send: Connect DONE\n");
if(num_messages == 0) {
send_msgs_single(pMsg);
} else {
send_msgs_counter();
}
TRY(relpEngineCltDestruct(pRelpEngine, &pRelpClt));
TRY(relpEngineDestruct(&pRelpEngine));
done:
fprintf(stderr, "send: terminating with state %d\n", ret);
return ret;
}
librelp-1.13.0/tests/tcp-accept-fd-reuse.c 0000664 0001750 0001750 00000010452 15241030422 013744 /*
* Verify accepted-socket ownership on an error after ownership transfer.
*
* An invalid GnuTLS priority provides a deterministic failure after
* relpTcpAcceptConnReq() assigns the accepted socket to relpTcp_t. The close
* wrapper reuses that descriptor after relpTcpDestruct() closes it. Error
* cleanup must not close the replacement descriptor a second time.
*/
#include "config.h"
#if defined(ENABLE_TLS)
#include
#include
#include
#include
#include
#include
#include
#include "librelp.h"
#include "relpsrv.h"
#include "tcp.h"
static int watched_fd = -1;
static int replacement_fd = -1;
static int replacement_installed;
static int wrapper_error;
static unsigned int watched_close_count;
int __real_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
int __wrap_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
int __real_close(int fd);
int __wrap_close(int fd);
int
__wrap_accept(const int sockfd, struct sockaddr *const addr, socklen_t *const addrlen)
{
const int fd = __real_accept(sockfd, addr, addrlen);
if(fd >= 0)
watched_fd = fd;
return fd;
}
int
__wrap_close(const int fd)
{
if(fd == watched_fd) {
++watched_close_count;
const int ret = __real_close(fd);
if(watched_close_count == 1 && ret == 0) {
if(dup2(replacement_fd, watched_fd) == -1)
wrapper_error = errno;
else
replacement_installed = 1;
}
return ret;
}
return __real_close(fd);
}
static void
discard_debug(char *const fmt __attribute__((unused)), ...)
{
}
static void
close_real(const int fd)
{
if(fd >= 0)
(void) __real_close(fd);
}
int
main(void)
{
relpEngine_t *engine = NULL;
relpSrv_t *server = NULL;
relpTcp_t *accepted = NULL;
struct sockaddr_in address = {0};
socklen_t address_len = sizeof(address);
int replacement[2] = {-1, -1};
int listener = -1;
int client = -1;
int rc = EXIT_FAILURE;
if(relpEngineConstruct(&engine) != RELP_RET_OK
|| relpEngineSetDbgprint(engine, discard_debug) != RELP_RET_OK
|| relpEngineSetTLSLibByName(engine, "gnutls") != RELP_RET_OK
|| relpSrvConstruct(&server, engine) != RELP_RET_OK
|| relpTcpConstruct(&server->pTcp, engine, RELP_SRV_CONN, server) != RELP_RET_OK
|| relpTcpEnableTLS(server->pTcp) != RELP_RET_OK
|| relpTcpSetGnuTLSPriString(server->pTcp, (char *) "INVALID-PRIORITY") != RELP_RET_OK) {
fprintf(stderr, "failed to construct librelp test objects\n");
goto done;
}
if(socketpair(AF_UNIX, SOCK_STREAM, 0, replacement) != 0) {
perror("socketpair");
goto done;
}
replacement_fd = replacement[0];
listener = socket(AF_INET, SOCK_STREAM, 0);
if(listener == -1) {
perror("socket");
goto done;
}
address.sin_family = AF_INET;
address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
address.sin_port = 0;
if(bind(listener, (struct sockaddr *) &address, sizeof(address)) != 0
|| listen(listener, 1) != 0
|| getsockname(listener, (struct sockaddr *) &address, &address_len) != 0) {
perror("listener setup");
goto done;
}
client = socket(AF_INET, SOCK_STREAM, 0);
if(client == -1 || connect(client, (struct sockaddr *) &address, sizeof(address)) != 0) {
perror("connect");
goto done;
}
if(relpTcpAcceptConnReq(&accepted, listener, server) != RELP_RET_INVLD_TLS_PRIO) {
fprintf(stderr, "accept did not fail at the expected post-transfer point\n");
goto done;
}
if(accepted != NULL) {
fprintf(stderr, "failed accept returned a connection object\n");
goto done;
}
if(wrapper_error != 0) {
errno = wrapper_error;
perror("could not reuse accepted descriptor");
goto done;
}
if(!replacement_installed || watched_close_count != 1) {
fprintf(stderr, "accepted descriptor was closed %u times\n", watched_close_count);
goto done;
}
errno = 0;
if(fcntl(watched_fd, F_GETFD) == -1) {
perror("replacement descriptor was closed by accept cleanup");
goto done;
}
printf("replacement descriptor remained open after accept cleanup\n");
rc = EXIT_SUCCESS;
done:
if(accepted != NULL)
(void) relpTcpDestruct(&accepted);
if(server != NULL)
(void) relpSrvDestruct(&server);
if(engine != NULL)
(void) relpEngineDestruct(&engine);
close_real(watched_fd);
close_real(client);
close_real(listener);
close_real(replacement[0]);
close_real(replacement[1]);
return rc;
}
#else
int
main(void)
{
return 77;
}
#endif
librelp-1.13.0/tests/dummyclient.py 0000755 0001750 0001750 00000000415 13437164712 012767 #!/usr/bin/env python
import socket
import os
port = int(os.environ['TESTPORT'])
print("dummyclient info: opening and closing port " + str(port) + " without sending data")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", port))
s.close()
librelp-1.13.0/tests/duplicate-receiver-vg.sh 0000775 0001750 0001750 00000001667 14354536317 014624 #!/bin/bash
# This test checks that when a second receiver is started it properly
# terminates.
cat << EOF
This test currently does not do anything really useful. We should
either change that or drop the test.
I assume it shall test that librelp does not segfault if the
listen port cannot be bound to.
EOF
exit 77
. ${srcdir:=$(pwd)}/test-framework.sh
check_command_available valgrind
if [ "$VALGRIND" == "NO" ] ; then
echo "valgrind tests are not permitted by environment config"
exit 77
fi
if [ $(uname) = "SunOS" ] ; then
echo "This test currently does not work on all flavors of Solaris."
exit 77
fi
if [ $(uname) = "FreeBSD" ] ; then
echo "This test currently does not work on FreeBSD."
exit 77
fi
startup_receiver_valgrind # note: two receivers are started intentionally
startup_receiver_valgrind
echo 'Send Message...'
./send -t 127.0.0.1 -p $TESTPORT -m "testmessage"
stop_receiver
check_output "testmessage"
terminate
librelp-1.13.0/ChangeLog 0000664 0001750 0001750 00000120431 15241030422 010454 ----------------------------------------------------------------------
Version 1.13.0 - 2026-08-18
- API: add server-session lifecycle callbacks
Applications can now register callbacks for session open, close, and
failed-open events. Callback teardown semantics and the accompanying
regression coverage have been corrected as well.
- relp: avoid spurious errors while tearing down half-open clients
Do not attempt a graceful RELP close when a client has not reached a state
in which it can send one, avoiding an extra wait-state error during
shutdown.
Thanks to Copilot for the initial patch.
- OpenSSL: apply client TLS configuration commands before creating SSL objects
tlsConfigCmd settings such as Groups now take effect on client connections,
including on OpenSSL 3.x.
Thanks to Cropi for the patch.
- documentation: convert the RELP specification to Markdown and correct
follow-up typos.
Thanks to sapunyangkut for the conversion.
- OpenSSL: clean up connections whose TLS setup fails.
- build: initialize the epoll descriptor before platform-specific setup.
- OpenSSL: fix socket ownership during TLS teardown
OpenSSL BIOs no longer close sockets owned by librelp, preventing a
descriptor that has already been reused from being closed during TLS
cleanup. Error cleanup after accepting a connection now also has a single,
explicit socket owner.
Thanks to Renaud Métrich for the original work and finding in #292; this
was accidentally merged via a different PR.
- TLS: make teardown safe for both supported TLS libraries
GnuTLS now sends close_notify while the transport is still available and
releases session, credential, and DH resources even when setup fails
partway through. OpenSSL cleanup correctly handles partially initialized
TLS state. Regression tests cover the affected ownership and lifecycle
paths.
- OpenSSL: prevent a busy loop after successful TLS I/O
Clear stale retry state after SSL_read() or SSL_write() succeeds following
WANT_READ or WANT_WRITE, so the event loop is not left waiting for the
wrong readiness direction.
closes: https://github.com/rsyslog/librelp/issues/296
- OpenSSL: release peer certificates after use
Prevent a peer-certificate memory leak during certificate verification.
- build: fix compiler attribute placement
Thanks to zhangzikang01 for the patch.
- testbench: make TLS ownership and lifecycle regression tests portable
The static white-box fixtures now detect their socket, realtime, and pthread
link dependencies, support OpenSSL 1.0.2, and are skipped where Solaris
linker wrapping is unavailable.
- CI: restrict Codecov uploads to the canonical repository.
- development: ignore local machine-specific Codex agent notes.
----------------------------------------------------------------------
Version 1.12.0 - 2025-09-08
- API: add ability to communicate source port back to caller
This is handled via a new "on connection" callback
- tcp: tcp: avoid deprecated ENGINE_cleanup
ENGINE_cleanup is deprecated as of OpenSSL 1.1.0, and may not be available
with 3.0 and OPENSSL_NO_ENGINE.
Thanks to Yaakov Selkowitz for the patch.
- relp: fix build against `gcc-14` (`-Werror=calloc-transposed-args`)
`gcc-14` added a new `-Wcalloc-transposed-args` warning. It
detected minor infelicity in `calloc()` API usage
Fixes
../../git/src/relp.c: In function 'addToEpollSet':
../../git/src/relp.c:101:39: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
101 | CHKmalloc(epd = calloc(sizeof(epolld_t), 1));
Thanks to Khem Raj for the patch.
- tests: Include missing sys/time.h
This is found when building for musl C library systems where sys/time.h
is not included indirectly and select() and timeval structs are used
Thanks to Khem Raj for the patch.
- bugfix: code adapted to C23 (as used in gcc 15 by default)
Thanks to Khem Raj for the patch.
----------------------------------------------------------------------
Version 1.11.0 - 2023-01-10
- bugfix: function inline errors in debug optimization (-Og)
Compiler does not inline any functions when using debug
optimization (-Og). Hence, remove -Winline flag when compiling with
debug optimization.
Thanks to Yash Shinde for the patch.
- CI: upgrading to newer ubuntu version as required by github
we used older ubuntu versions as base for our containers, these
versions are no longer available in github actions. As such,
we upgraded. Has no effect on testbench as we execute everything
in container environment and container remains the same.
- tcp: fix some compiler warnings with enable-tls-openssl
When --enable-tls=no and --enable-tls-openssl=yes, the following
compiler errors were reported.
Thanks to Patrick Williams for the patch.
- code cleanup
During the initial librelp implementation it was thought about an
auto-retry feature (whatever that means). Variable bAutoRetry was
created to control that behaviour. It's default was 0 (inactive).
Some code has been written to evaluate that variable and act
accordingly. However, no setter method for this variable was
created and it was also nowhere changed from the default value
of zero. As such, the code activated by it was never used.
This patch now removes both the variable and the few code lines
accessing it. This will have no effect, as the code was never
used.
closes: https://github.com/rsyslog/librelp/issues/223
- testbench: Fix commands in some openssl tests
Those commands were not correctly handeled on AIX, now they are.
- AIX: Changed ERRNO handling after connect in tcp.c
see also: https://github.com/rsyslog/librelp/issues/250
- AIX: Add handling for other ERRNO codes in tcp.c
For send(), recv() and connect() we need to handle different ERRNO
codes on AIX according to doc:
https://www.ibm.com/docs/en/aix/7.1?topic=r-recv-subroutine
https://www.ibm.com/docs/en/aix/7.1?topic=s-send-subroutine
https://www.ibm.com/docs/en/aix/7.1?topic=c-connect-subroutine
- bugfix/TCP: relpTcpGetRtryDirection onyl needs to check direction if SSL is active.
closes: https://github.com/rsyslog/librelp/issues/240
- AIX: in relpTcpRcv we need to set RETRY_recv if errno is 0
On AIX 10.x, when a recv call fails with len -1 and errno 0
we can still go into relpTCP_RETRY_recv mode. Testbench on
rsyslog side appears to be finally working with this fix.
On AIX 10.x, same problem as above appear to happen with
connect() as well not setting errno to EINPROGRESS on failure.
rsyslog ptcp driver does not check errno value at all, which is
why we did not have this problem on AIX with rsyslog.
Reduce test message count in receiver-abort.sh to 50000,
because otherwise the test can timeout on very slow machines.
Moved receive buffer in relpSessRcvData back to stack memory
closes: https://github.com/rsyslog/librelp/pull/239
- openssl: fix openssl exit code avoid double free of ctx
When more than one librelp instance are used in the same process,
and the relpTcpExitTLS call was called a second time, the process
could freeze due a double free (See SSL_CTX_free call).
Thanks to David GOUARIN for the
discovery and initial fix.
Also added an openssl instance counter to avoid freeing the SSL library
which could be still in use by another librelp instance
in the same process.
closes: https://github.com/rsyslog/librelp/issues/235
- librelp hardening: Fix multiple minor issues causing debugging trouble
- avoid invalid dbgprint calls
- avoid double free in relpTcpDestruct (if called twice).
- add debug output into relpTcpRcv
- OpenSSL: fix depreacted API issues for OpenSSL 3.x
- OpenSSL error strings are loaded automatically now
- Adapted Debug Callback for 3.x
- See for more:
https://www.openssl.org/docs/manmaster/man7/migration_guide.html
closes: https://github.com/rsyslog/librelp/issues/246
- bugfix: compatiblity problem with openssl 1.1
There were undefined reference to CRYPTO_set_id_callback if system
use openssl 1.1, which lead to load and/or other erros.
Thanks to Alexander Eremin for the patch.
- bugfix: Forward return code from relpEngineSetTLSLib to relpEngineSetTLSLibName
Previous situation: In case librelp is compiled without openssl
support but openssl is requested from the user side, then librelp
silently switches to the default tls driver(gnutls).
Thanks to Attila Lakatos for the patch.
- bugfix: make relpEngineSetTLSLib debug safe
In case pThis == NULL condition is true at line
https://github.com/rsyslog/librelp/blob/master/src/relp.c#L345
pThis->dbgprint(...) would cause unexpected behavior.
Thanks to Attila Lakatos for the patch.
- bugfix: warnings reported by coverity scan
Thanks to Attila Lakatos for the patch.
- testbench: Added compatiblity to run on AIX
- removed long options from receive send utilities (Not supported on AIX).
- added checks for existing commands in some tests.
- added msleep utility from rsyslog (sleep, timeout etc. not supported on AIX).
- github workflow: Disabled some unrelated tests from rsyslog testbench
closes: https://github.com/rsyslog/librelp/issues/228
- gnutls drvr bugfix: library called exit() under some circumstances
When relpTcpRcv ran into an error, it could call exit() and thus
terminate the calling process. This was a regression from commit
6555545c4ebe9afe9259b15c176fd81eeecc93f4.
closes: https://github.com/rsyslog/librelp/issues/230
----------------------------------------------------------------------
Version 1.10.0 - 2021-02-16
- TLS handling bugfix
When the client tried to conntect to the server, custom
cipherstrings (Set by tlscommands feature) were not used. This
could lead to the negotiation of different and potentially weaker
ciphers. Other custom tlscommands settings like Protocol where not
affected. We do not overwrite the custom ciphers anymore if they are
set by tlscommands. Another problem only related to the relp
receiver (server) was, that the custom tlscommands/priority string
where not applied on the accepted client connections. This could
lead to the same problem as the default ciphers were used.
Besides the main problem, the following changes were applied:
- Add new testcase for setting custom tls ciphers in tlscommand.
- Add support to use semicolon (;) as tlscommand seperator (See new testcase)
- Fix GCC9 "destination size" warning in offers.c
closes: https://github.com/rsyslog/librelp/issues/224
----------------------------------------------------------------------
Version 1.9.0 - 2020-11-24
- openssl bugfix: preprocessor check for tlsconfigcmd code
tls config commands no is compiled for OpenSSL 1.0.2.
closes: https://github.com/rsyslog/librelp/issues/221
- solaris compatibility fix: add strndup compatibility code
On some platforms, strndup() is not present. However, it was used
in "tlsconfigcmd" command processing. This bug was unlikely to
trigger as the platforms in question had either non-appropriate
openssl library versions or were affected by the openssl version
check bug (see above).
----------------------------------------------------------------------
Version 1.8.0 - 2020-09-29
- gnutls "bugfix": handle receives who break connection on close
Some TLS servers don't reply to graceful shutdown requests "for
optimization". This can lead to librelp keeping the connection
for ever and thus effectively to hang on it.
This patch is modelled after a similiar patch by Renaud Métrich
for rsyslog.
see also https://github.com/rsyslog/rsyslog/pull/4424
- gnutls bugfix: per-session memory leak
Depending on callig sequence and use, there were two memory leaks
which could cause operational issues for long-running processes.
This was primarily a problem for sender processes (and not listeners)
closes: https://github.com/rsyslog/librelp/issues/194
- tls bugfix: RETRY not correctly handled in TLS Mode & CI improvement
Relp session handling did not honor rtryOP status correctly,
instead it was checkong for errno=EAGAIN only.
This patch comes with a number of smaller patches, unfortunately
all rolled into a single commit.
- CI: Add centos8 / fedora30 workflows.
- CI: Switch rsyslog workflow to ubuntu-20.04
- CI: Imported run-ci script from rsyslog
- Fix multiple issue found with -Werror=missing-declarations (fedora30).
- openssl: Fix error output for all error cases
- testbench: Add test for tls basic with mixed tls libs
- testbench: fix python3 compatibility issues
- testbench: fix parallel tests for receiver-abort.sh and other tests.
- testbench: Added extra debug output to send.c utility.
closes: https://github.com/rsyslog/librelp/issues/207
- testbench: obtain python binary path via AM_PATH_PYTHON
closes: https://github.com/rsyslog/librelp/issues/214
- bugfix: librelp.h contains duplicate function definition
- removed some more externally visible symbols not being part of API
- testbench tooling improvements
- distcheck bugfix: add missing testbench cert files
closes: https://github.com/rsyslog/librelp/issues/206
----------------------------------------------------------------------
Version 1.7.0 - 2020-08-25
- some internal cleanup (const attributes and such)
- bugfix: library did export non-API symbols
closes https://github.com/rsyslog/librelp/issues/187
- openssl: Fix chained certificate files for older OpenSSL Version.
For older OpenSSL Versions, we are loading the Own Certfile
(Which can be chained) into CTX Verify locations. This enables
chained certificates for older OpenSSL Versions as well
devtools: updated devcontainer.sh (based on rsyslog version)
see also: https://github.com/rsyslog/librelp/issues/195
- fix FD leak when socket shutdown is one-sided
AWS LB has timeouts when connection is inactive and when this
happens, AWS LB shuts down socket from one-side only. When rsyslog
detects one-sided shutdown, it assumes that connection is closed
while it isn't. The connection is left unclosed and unclosed FD
are piling up, eventually filling up FD number space.
Thanks to Ognyan Kulev for the patch.
- TLS: Added call to destruct OpenSSL remains to relpEngineDestruct
For a clean cleanup, OpenSSL remains are now being removed at the end
of relpEngineDestruct()
closes: https://github.com/rsyslog/librelp/issues/199
- fix memory leak on session break
When librelp session breaks unexpected, a memory leak could happen in sendq.c
when relpSendqeConstruct was called before the session break happened.
- Also Adds a new valgrind test basic-sessionbreak-vg.sh to reproduce
the problem. without the fix, the test will fail.
- Adjusted testbench plumbing to support session break valgrind test.
closes: https://github.com/rsyslog/librelp/issues/188
----------------------------------------------------------------------
Version 1.6.0 - 2020-04-21
- fix namespace pollution - some non-API functions were exported
While fixing this, also some internal inconsistencies in function
visibility were fixed as well.
closes https://github.com/rsyslog/librelp/issues/179
- replsess: fix double free of sendbuf in some cases.
In iRet handler of relpSessSendResponse, the sendbuf
was freed if iRet returned a failure.
However if error RELP_RET_IO_ERR happened in relpSendqAddBuf,
sendbuf was already assigned to relpSendqe_t. As a result
sendbuf was double freed in relpSendqDestruct.
see also
https://github.com/rsyslog/rsyslog/issues/4184
https://github.com/rsyslog/rsyslog/issues/4005
closes https://github.com/rsyslog/librelp/issues/183
- improve support for libressl
LibreSSL has no support for @SECLEVEL and SSL_CONF_CTX_set_flags().
LibreSSL is now detected and some functionality disabled if it is
used.
Thanks to Remi Locherer for the patch.
- Modified GnuTLS priority according to standard crypto-policy guideline
Edited TLS priority string default to conform to system-wide default
and align librelp behavior with other crypto-utilizing packages.
Note: this may be different from what the openSSL driver does.
Thanks to Jiri Vymazal for the patch.
- tcp: Missing pUsr Copy to relpTcp Pointer fixed in relpTcpAcceptConnReq
The userpointer was not copied into the relpTcp object.
Also fixed core dump crash in receive / send helpers when userpointer
is returned NULL from librelp.
- report io errors for plain tcp connections
this already happens with TLS, but not with plain tcp. Error messages
are a useful troubleshooting tool.
----------------------------------------------------------------------
Version 1.5.0 - 2020-01-14
- bugfix: too late termination of relp Engine on shutdown
When librelp is instructed to shutdown, it processes messages
still present inside its receive buffers. It only terminates
when it needs to wait for new data to arrive.
Depending on RELP and TCP window size and message length,
this may cause many messages to be processed while in shutdown.
Even with default settings, up to 128 messages may be taken off
the wire and be processed.
This is a problem regarding the shutdown timing of a librelp
user (e.g. rsyslog). It may take unexpectedly long to shutdown
the RELP component and as such timeout may occur in the caller
code. This is especially the case if the caller does lengthy
processing when a RELP message is received. Note: It is
perfectly fine for a caller to do this. The problem is that
librelp continues to provide new data for a relatively long
and unexpected period.
This fix ensure that the relp engine shuts down much quicker
when shutdown is requested. It now also checks the shutdown
request while processing already received buffer data.
This problem was detected when working on
see also https://github.com/rsyslog/rsyslog/issues/3941
closes https://github.com/rsyslog/librelp/issues/175
- build system fix: invalid default in configure help text
closes https://github.com/rsyslog/librelp/issues/169
- error message on invalid TLS library request added
This way an invalid TLS library (name) can be detected and the
error presented to the user. So far, invalid library names were
hard to find.
----------------------------------------------------------------------
Version 1.4.0 - 2019-03-05
NOTE TO PACKAGERS:
Both openssl and GnuTLS are now enabled by default. This is to
enable apps to choice which of the two drivers they want to use.
If you want to disable one or both of the drivers, use
--disable-tls to disable GnuTLS (option name is historic)
--disable-tls-openssl to disable openssl
- build system: enable openssl by default, this means both TLS drivers
are now build by default
- support that both GnuTLS and openssl TLS drivers are active together
This permits the caller to select which one to use via a NEW API
relpEngineSetTLSLibByName() and relpEngineSetTLSLib().
- portability: use GCC __attribute__ only where supported
- bugfix: build problem when HAVE_STRERROR_R is undefined
Thanks to Paul Cameron for the fix.
- bugfix: openssl driver did not properly handle retries when sending
Every TLS library can request i/o call retry if in non-blocking mode.
When sending, the openssl driver did not properly handle this.
Note: the GnuTLS driver was not affected by this bug.
- bugfix: in openssl mode, cert name validation did not work properly
closes https://github.com/rsyslog/librelp/issues/149
- bugfix: invalid handling of connection fail could lead to abort
... or more precisely to SIGPIPE on the sender app. What exactly happens
in that case depends on SIGPIPE handling in the sender. This is of course
not acceptable or desired behaviour. This patch fixes it.
This commit also includes testbench improvements, especially in regard
to support easier diagnostic of such cases.
closes https://github.com/rsyslog/librelp/issues/161
- tests: make dummyclient.py compatible with Python2 and Python3
closes: https://github.com/rsyslog/librelp/issues/163
Thanks to whissi for the patch.
- a couple of minor and cosmetic nitfixes, improvements and cleanup
----------------------------------------------------------------------
Version 1.3.0 - 2018-12-11
- improved error reporting
- bugfix openssl: anon mode did not work with openssl 1.1.0+
This was caused by "hardening" inside openssl, so not a real bug.
- bugfix: do not send multiple open commands
multiple open commands can happen when a session was broken
and is being reestablished. Chances to experience this problem
increase with the number of sessions broken in a row. A trigger
is that the remote system accepts the TCP connection, but does
NOT send a response to the "open" command (aka "very short-lived
session). This can happen e.g. with proxy servers which cannot
connect to the actual server.
closes https://github.com/rsyslog/librelp/issues/129
- bugfix testbench: TLS tests were executed even when TLS was disabled
- testbench:
* add test for receiver abort and restart
* much improved testbench framework and tools to support
this type of test. Done some general improvements to the
tooling.
* imported rsyslog tool "chkseq" for checking
----------------------------------------------------------------------
Version 1.2.18 - 2018-09-18
- added non-standard "certvalid" auth mode to TLS authentication
- bugfix CI: make distcheck did not work
----------------------------------------------------------------------
Version 1.2.17 - 2018-08-02
- added support for openssl
now, at configure time, openssl (--enable-tls-openssl) or gnutls
(--enable-tls) can be enabled. Openssl is recommended as it permits
better error messages and has more robust certificate handling,
but the default remains gnutls so that packagers do not need to
change without specific need.
Note: if openssl is selected, setting the gnutls priority string
does not have any effect. This will be worked on in later releases.
- improve code quality: replace strerror() by portable equivalent
- improve error message on connection failure
it now contains the OS-provided error message
Thanks to Justin Azoff for the patch.
- bugfix: 100% CPU utilization due to busy loop
happend because EAGAIN was not properly handled
Thanks to Lex Neva for the patch.
closes https://github.com/rsyslog/librelp/issues/13
- bugfix: do not expose symbols that are not part of public API
Some other symbols were exported. Now only symbols starting with
"relp" are exported.
Thanks to Michael Biebl for the patch.
- bugfix: potential segfault when listener could not be bound
This was fixed as a side-effect of refactoring some static analyzer
warnings, exact commit is not flagged.
see also https://github.com/rsyslog/rsyslog/issues/2874
----------------------------------------------------------------------
Version 1.2.16 - 2018-05-14
- API changes
* add new API: relpSrvSetOversizeMode()
This permits to tell librelp how to handle oversize messages.
Traditionally (and now default), this aborts the session. We now
added an option to truncate the message instead.
Also, in case of session abort a descriptive error message is
emitted. This did not happen previously and caused confusion.
closes https://github.com/rsyslog/librelp/issues/81
* add new API: relpSrvSetLstnAddr()
It permits to set the listen address inside the relp server.
If not called, the server will bind to all interfaces.
Thanks to github user perlei for contributing it.
- support additional hashes for fingerprint mode
old-style SHA1 is used automatically
Thanks to github user briaeros for the patch.
see also https://github.com/rsyslog/librelp/pull/55
- bugfix: potential memory leak
This is very unlikely to occur in practice. Memory can be leaked
when TLS initialization fails when the client tries to connect
to the server. However, if this actually happens, it can happen
frequently and so accumulate to a large leak.
No report of such occurence from practice.
Detected by Coverity Scan, CID 266008.
- bugfix: memory leak on protocol error
Receiving relp frames are not correctly deallocated while handling
protocol errors resulting in memory leak of dirty pages.
Thanks to github user gleentea for the patch.
see also https://github.com/rsyslog/librelp/issues/59
closes https://github.com/rsyslog/librelp/issues/60
- fixed a couple of minor issues:
* fix memory leak when relp frame construction fails
detected by clang static analyzer
* removed unnecessary code
detected by clang static analyzer
* fix memory leak
This leaks occurs if the process is already totally out of memory,
a situation that is very rare and will also cuase other troubles.
So the practical relevance of this patch looks rather slim.
Detected by clang static analyzer.
* fix memory leak on relpSrvRun() error
this is kind of cosmetic, because it can only occur when the
run fails, which usually should lead to termination of the
calling application
deteced by Coverity Scan, CID 266016
* fix memory leak on relp listener construction error
detected by Coverity Scan, CID 266014, 266015
* also resolved all other issues reported by Coverity scan
- CI
* added native testbench (formerly used rsyslog for testing)
* added additional compile tests
----------------------------------------------------------------------
Version 1.2.15 - 2018-03-21
- made build on Solaris again
- made build on AIX
Thanks to Philippe Duveau for providing the patches
- bugfix: invalid handling of snprintf() return code
- bugfix: invalid assert predicate
an assert could change status variable due to typo, so in debug
mode processing could fail.
thanks to github user KatMisato for alerting us
fixes https://github.com/rsyslog/librelp/issues/66
- some code cleanup
- bugfix: error message on open error was truncated
The "connection already open" error message when trying to open
an already open connection was truncated due to too-small size
specified.
Thanks to rsyslog forum user AlanR for the problem report.
----------------------------------------------------------------------
Version 1.2.14 - 2017-05-29
- API extension: add relpSrvSetMaxDataSize()
Thanks to Nathan Brown for the patch.
----------------------------------------------------------------------
Version 1.2.13 - 2017-02-20
- make build under BSD
- bugfix: duplicated lines after server reconnect
Thanks to Hervé for the patch.
----------------------------------------------------------------------
Version 1.2.12 - 2016-07-07
- API enhancement: permit to set connection timeout
Thanks to Nathan Brown for the patch.
- cleanup: replace deprecated GnuTLS data types by current ones
- CI improvements: added dynamic tests
we now use the rsyslog testbench to do dynamic librelp tests. This
currently happens only under Travis CI.
----------------------------------------------------------------------
Version 1.2.11 - 2016-06-22
- bugfix: do not accept more than one "open" verb on a connection
closes https://github.com/rsyslog/librelp/issues/37
- bugfix: potential segfault when high-numbered fd is used in sender
When a fd (socket) with value >= 1024 was used by the client sender
process, the library could segfault in select(). This depended a bit
on the platform.
This patch solves the issue by replacing the select() call with
poll(). Note that we do not changed to epoll(), because
(a) we only wait on a single fd
(b) poll() is more portable
closes https://github.com/rsyslog/librelp/issues/38
- bugfix: make librelp not run in thight loop when out of sockets
If the process can no longer accept new connections (via accept)
because it has reached its file handle maximum, librelp runs in
a thight loop until either the client connection request is aborted
or a file handle becomes available.
This happens due to the fact that we get event notifications on
connection requests. As we can't satisfy it, we librelp always
retries. Unfortunately, there is no socket call to cancel a
connection request, so we cannot push the client request out.
An alternative solution would be to close and re-open the
listening socket, but in that case it is uncertain if we ever can
re-aquire a socket (an easy DoS). So the best thing we can
probably do is delay retries a bit. We must be careful, however,
not to use a too long delay, as that would also affect other
connections. We could address that problem via a dedicated thread
for the listening process, but librelp is designed so that it can
be used by callers with any threading library and threading model,
and that would violate this design principle.
Judging the alternatives, a slight delay probably is the best
solution, especially as the situation is uncommon and will hopefully
not last too long. This patch implements that solution.
closes https://github.com/rsyslog/librelp/issues/34
- bugfix: flush the current recv frame if it exists if the client
session is restarting
Thanks to Nate Brown for the patch.
- API enhancement: add configurable connection timeout
Thanks to Nate Brown for the patch.
----------------------------------------------------------------------
Version 1.2.10 - 2016-03-30
- make compatible with older versions of GnuTLS which require
libgcrypt
- improve example sender/receiver code
Thanks to Chris Pilkington for the patches.
- bugfix: Send full buffers after connection re-establishing
When sending large buffers it's possible that only part of buffer data
will be transferred before connection is closed. Then on connection
re-establishing librelp thinks part of buffer is already sent and
transfers only remaining part. Remote side then is not be able to parse
such message and always closes the connection.
Thanks to github user cellscape for the patch.
----------------------------------------------------------------------
Version 1.2.9 - 2015-12-15
- bugfix: Ignoring return status when handling syslog frames now.
Otherwise valid messages in the frame buffer will get lost when the
remote connection is closed during meantime.
- build bugfix: GnuTLS header was required even if TLS was turned off
Thanks to Pedro Alvarez Piedehierro for the patch.
- bugfix: correct wrong assert() calls [debug mode only affected]
----------------------------------------------------------------------
Version 1.2.8 - 2014-09-07
- bugfix: segfault if KEEPALIVE is used
Thanks to Tomas Heinrich for the patch.
----------------------------------------------------------------------
Version 1.2.7 - 2014-04-29
- bugfix: librelp was incompatible with C++ without a real reason
Thanks to Ivan Kryak for the patch
- bugfix: potential misadressing in wildcard match
see: https://github.com/rsyslog/librelp/pull/3
Thanks to Sebastian Schmidt for the patch.
- bugfix: always last wildcard match was reported, not first
see: https://github.com/rsyslog/librelp/pull/4
Thanks to Sebastian Schmidt for the patch.
----------------------------------------------------------------------
Version 1.2.6 - 2014-03-20
- report error when preparing for non-anon TLS and this is unsupported
The error is reported when the processes own certificate is set,
which also turns off anon TLS. We now check if TLS AUTH is supported
and, if not, return an error. This enables better error tracking
in the client, as otherwise the problem is reported much later
or even not at all (in the case of a relp server).
----------------------------------------------------------------------
Version 1.2.5 - 2014-03-20
- permit to use anonymous TLS on platforms where GnuTLS misses
certificate verification function. This permits to use at least
anon TLS on platforms like RHEL and CENTOS 6.
----------------------------------------------------------------------
Version 1.2.4 - 2014-03-17
- correct API/ABI change in 1.2.3
My reasoning was flawed, and we could run into problems with
apps that required the new version but could not detect that an
older one was installed.
Thanks to Michael Biebl for pointing this out.
What we have done is:
- revert back to previous state (return void)
* relpSrvEnableTLS();
* relpSrvEnableTLSZip();
These functions are now deprecated.
- introduce new functions that return a state
* relpSrvEnableTLS2();
* relpSrvEnableTLSZip2();
----------------------------------------------------------------------
Version 1.2.3 - 2014-03-13
************************************************************
* NOTE: this version should NOT be used due to the API *
* change specified below. *
************************************************************
- add ability to build librelp without TLS
This is required on some platforms where GnuTLS is too old
Use --disable-tls to select this mode. If set, RELP_RET_ERR_NO_TLS
will be returned on calls that selected TLS mode.
See also: https://github.com/rsyslog/librelp/issues/1
- API change: two functions that used to return void now return state
these are:
* relpSrvEnableTLS();
* relpSrvEnableTLSZip();
This change is acceptable because the state must not necessary be
evaluated. If not, the same error is returned a bit later in the
calling sequence. Having it early, however, may help with better
error messages. So it's still optional to check.
- bugfix: configure required too-old version of GnuTLS
This lead to successful builds which later on would not execute.
----------------------------------------------------------------------
Version 1.2.2 - 2014-01-07
- add capability to enable tcp KEEPALIVE
- introduced new API relpSrvSetKeepAlive() to support KEEPALIVE
----------------------------------------------------------------------
Version 1.2.1 - 2013-09-26
- errors binding listener port are now reported via error message
callback
----------------------------------------------------------------------
Version 1.2.0 - 2013-07-15
- support for epoll() added
platforms that do not support it fall back to select()
- API extension: relpEngineSetOnGenericErr
----------------------------------------------------------------------
Version 1.1.5 - 2013-07-05
- bugfix: memory leak on connection close
around 60 bytes of memory were lost on each connection close at the
server side (when the client initiated a close)
- bugfix: potential misadressing on session close
This can happen if also a write was outstanding, a quite unusable
situation. In that case, already freed memory was being accessed.
----------------------------------------------------------------------
Version 1.1.4 - 2013-07-03
- fix build problems on BSD
Thanks to Christiano for analysis and patch suggestion.
- add ability to specify a non-standard RELP Window size
- add burst support to the client API
With this, we remove the unconditional performance improvement
done in 1.1.3 - it is better to call the APIs explicitely.
- wildcards are now supported in TLS name peer authentication
They follow RFC5425 recommandations, e.g.
*.example.com, client*.example.com, client01.*.com
- new APIs: relpCltHintBurstBegin, relpCltHintBurstEnd,
relpCltSetWindowSize
----------------------------------------------------------------------
Version 1.1.3 - 2013-06-26
- increased performance of RELP connection
- bugfix: potential segfault if no GnuTLS priority string was set
----------------------------------------------------------------------
Version 1.1.2 - 2013-06-24
- add capability to specify the GnuTLS priority string
This gives callers complete control over crypto parameters, like
ciphers to use.
- add certificate-based authentication
- add capability to specify number of Diffie-Hellman bits to use
- API extension: relpSrvSetDHBits, relpSrvSetGnuTLSPriString,
relpSrvSetGnuTLSPriString, relpCltSetGnuTLSPriString
relpEngineSetOnAuthErr, relpCltSetUsrPtr,
relpSrvSetAuthMode, relpCltSetAuthMode
----------------------------------------------------------------------
Version 1.1.1 - 2013-06-11
- added compression support for TLS
- API extension: relpCltEnableTLSZip, relpSrvEnableTLSZip
----------------------------------------------------------------------
Version 1.1.0 - 2013-06-03
- add TLS support
- new api for creating listners:
... which permits us to set various properties before the listener
is actually started. New callers should use it. Sequence is:
* relpEngineListnerConstruct()
* ... set properties ... (via relpSrv...() family)
* relgEngineListnerConstructFinalize()
This new style permits us to add/set additional listner options
without the need to introduce ever-new listner create functions.
Actually, their number would grow exponentionally, so this were
a dead end.
The old-style APIs relpEngineAddListner() and
relpEngineAddListner2() are still fully supported (and supposed
to be for a long time), but flagged as deprecated.
----------------------------------------------------------------------
Version 1.0.7 - 2013-05-13
- ABI change: removed relpCltConnect2() API which was against
librelp API philosophy
This was only introduced in 1.0.6 and been in the code for a very
short time. So we decided that the best thing to do is actually
remove it (there is NO known released user, this changes was for
yet unreleased rsyslog 7.5.0).
----------------------------------------------------------------------
Version 1.0.6 - 2013-05-06
- enhanced API to permit binding a client to a specific IP address
----------------------------------------------------------------------
Version 1.0.5 (rgerhards), 2013-04-24
- bugfix: compile problem on Solaris
Thanks to John Lyman for the patch
----------------------------------------------------------------------
Version 1.0.4 (rgerhards), 2013-04-11
- bugfix: busy loop on syslog sending as a client when server did not
accept data; this was broken out only when the remote peer
indicated that the connection as whole was broken. Now we properly
timeout.
----------------------------------------------------------------------
Version 1.0.3 (rgerhards), 2013-04-10
- added relpCltSetTimeout() interface function
- improved timeout handling
Note: default timeout is now consistently 90 seconds (there were
some parts of the code where it were 10 seconds and at others
they were 180).
- provide support for user-settable shutdown indicator
This was introduced in support of rsyslog, but is probably useful
for other users as well. In short, it provides the ability to set
a pointer that is expected to be zero as long as the library shall
continue to run and set to 1 if it shall terminate. That ptr is then
checked at appropriate places of the library code.
----------------------------------------------------------------------
Version 1.0.2 (rgerhards), 2013-03-15
- added capability to support only IPv4/v6 instead of both
----------------------------------------------------------------------
Version 1.0.1 (rgerhards), 2012-09-06
- added capability to stop server without canceling its thread
- bugfix: interrupt of select() was not properly handled
However, this caused no actual failure, just some unnecessary code
execution (and confusing debug messages).
----------------------------------------------------------------------
Version 1.0.0 (rgerhards), 2009-12-11
This version of librelp matured in practice and it is now time for
a 1.0 release. Besides that, it includes a small number of
changes:
- bugfix: user callback never received remote IP address
- bugfix: offers builder did use a fixed size string without bounds
checking. I don't think this was a real issue as it was not
exposed to the outside world, but now the buffer dynamically
grows (which is the right thing to do). Thank to mterry for alerting
me.
----------------------------------------------------------------------
Version 0.1.3 (rgerhards), 2009-02-10
- the callback on message reception did not contain a way to pass on
a caller cookie (e.g. for an instance pointer). An additional
interface has been added to support that.
- cleaned up FDL license specifics
- added libtool versioning
- made librelp compile out of the box on FreeBSD - thanks to Michael
Biebl for the patch
----------------------------------------------------------------------
Version 0.1.2 (rgerhards), 2008-04-09
- forward compatibility changes in support of our plans to use the
rsyslog runtime in the future
----------------------------------------------------------------------
Version 0.1.1 (rgerhards), 2008-04-09
- improved build system, thanks to Michael Biebl
now easier to integrate with autoconf
----------------------------------------------------------------------
Version 0.1.0 (rgerhards), 2008-04-01
- first version that is available to the public
----------------------------------------------------------------------
Version 0.0.1 (rgerhards), 2008-03-13
- very experimental and incomplete version, not to be used any longer
librelp-1.13.0/ltmain.sh 0000755 0001750 0001750 00001212375 15241057377 010557 #! /usr/bin/env sh
## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
## by inline-source v2019-02-19.15
# libtool (GNU libtool) 2.4.7
# Provide generalized library-building support services.
# Written by Gordon Matzigkeit , 1996
# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool 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.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool 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, see .
PROGRAM=libtool
PACKAGE=libtool
VERSION="2.4.7 Debian-2.4.7-7build1"
package_revision=2.4.7
## ------ ##
## Usage. ##
## ------ ##
# Run './libtool --help' for help with using this script from the
# command line.
## ------------------------------- ##
## User overridable command paths. ##
## ------------------------------- ##
# After configure completes, it has a better idea of some of the
# shell tools we need than the defaults used by the functions shared
# with bootstrap, so set those here where they can still be over-
# ridden by the user, but otherwise take precedence.
: ${AUTOCONF="autoconf"}
: ${AUTOMAKE="automake"}
## -------------------------- ##
## Source external libraries. ##
## -------------------------- ##
# Much of our low-level functionality needs to be sourced from external
# libraries, which are installed to $pkgauxdir.
# Set a version string for this script.
scriptversion=2019-02-19.15; # UTC
# General shell script boiler plate, and helper functions.
# Written by Gary V. Vaughan, 2004
# This is free software. There is NO warranty; not even for
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Copyright (C) 2004-2019, 2021 Bootstrap Authors
#
# This file is dual licensed under the terms of the MIT license
# , and GPL version 2 or later
# . You must apply one of
# these licenses when using or redistributing this software or any of
# the files within it. See the URLs above, or the file `LICENSE`
# included in the Bootstrap distribution for the full license texts.
# Please report bugs or propose patches to:
#
## ------ ##
## Usage. ##
## ------ ##
# Evaluate this file near the top of your script to gain access to
# the functions and variables defined here:
#
# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
#
# If you need to override any of the default environment variable
# settings, do that before evaluating this file.
## -------------------- ##
## Shell normalisation. ##
## -------------------- ##
# Some shells need a little help to be as Bourne compatible as possible.
# Before doing anything else, make sure all that help has been provided!
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
# NLS nuisances: We save the old values in case they are required later.
_G_user_locale=
_G_safe_locale=
for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test set = \"\${$_G_var+set}\"; then
save_$_G_var=\$$_G_var
$_G_var=C
export $_G_var
_G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
_G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
fi"
done
# These NLS vars are set unconditionally (bootstrap issue #24). Unset those
# in case the environment reset is needed later and the $save_* variant is not
# defined (see the code above).
LC_ALL=C
LANGUAGE=C
export LANGUAGE LC_ALL
# Make sure IFS has a sensible default
sp=' '
nl='
'
IFS="$sp $nl"
# There are apparently some retarded systems that use ';' as a PATH separator!
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
# func_unset VAR
# --------------
# Portably unset VAR.
# In some shells, an 'unset VAR' statement leaves a non-zero return
# status if VAR is already unset, which might be problematic if the
# statement is used at the end of a function (thus poisoning its return
# value) or when 'set -e' is active (causing even a spurious abort of
# the script in this case).
func_unset ()
{
{ eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
}
# Make sure CDPATH doesn't cause `cd` commands to output the target dir.
func_unset CDPATH
# Make sure ${,E,F}GREP behave sanely.
func_unset GREP_OPTIONS
## ------------------------- ##
## Locate command utilities. ##
## ------------------------- ##
# func_executable_p FILE
# ----------------------
# Check that FILE is an executable regular file.
func_executable_p ()
{
test -f "$1" && test -x "$1"
}
# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
# --------------------------------------------
# Search for either a program that responds to --version with output
# containing "GNU", or else returned by CHECK_FUNC otherwise, by
# trying all the directories in PATH with each of the elements of
# PROGS_LIST.
#
# CHECK_FUNC should accept the path to a candidate program, and
# set $func_check_prog_result if it truncates its output less than
# $_G_path_prog_max characters.
func_path_progs ()
{
_G_progs_list=$1
_G_check_func=$2
_G_PATH=${3-"$PATH"}
_G_path_prog_max=0
_G_path_prog_found=false
_G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
for _G_dir in $_G_PATH; do
IFS=$_G_save_IFS
test -z "$_G_dir" && _G_dir=.
for _G_prog_name in $_G_progs_list; do
for _exeext in '' .EXE; do
_G_path_prog=$_G_dir/$_G_prog_name$_exeext
func_executable_p "$_G_path_prog" || continue
case `"$_G_path_prog" --version 2>&1` in
*GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
*) $_G_check_func $_G_path_prog
func_path_progs_result=$func_check_prog_result
;;
esac
$_G_path_prog_found && break 3
done
done
done
IFS=$_G_save_IFS
test -z "$func_path_progs_result" && {
echo "no acceptable sed could be found in \$PATH" >&2
exit 1
}
}
# We want to be able to use the functions in this file before configure
# has figured out where the best binaries are kept, which means we have
# to search for them ourselves - except when the results are already set
# where we skip the searches.
# Unless the user overrides by setting SED, search the path for either GNU
# sed, or the sed that truncates its output the least.
test -z "$SED" && {
_G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
for _G_i in 1 2 3 4 5 6 7; do
_G_sed_script=$_G_sed_script$nl$_G_sed_script
done
echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
_G_sed_script=
func_check_prog_sed ()
{
_G_path_prog=$1
_G_count=0
printf 0123456789 >conftest.in
while :
do
cat conftest.in conftest.in >conftest.tmp
mv conftest.tmp conftest.in
cp conftest.in conftest.nl
echo '' >> conftest.nl
"$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break
diff conftest.out conftest.nl >/dev/null 2>&1 || break
_G_count=`expr $_G_count + 1`
if test "$_G_count" -gt "$_G_path_prog_max"; then
# Best one so far, save it but keep looking for a better one
func_check_prog_result=$_G_path_prog
_G_path_prog_max=$_G_count
fi
# 10*(2^10) chars as input seems more than enough
test 10 -lt "$_G_count" && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out
}
func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
rm -f conftest.sed
SED=$func_path_progs_result
}
# Unless the user overrides by setting GREP, search the path for either GNU
# grep, or the grep that truncates its output the least.
test -z "$GREP" && {
func_check_prog_grep ()
{
_G_path_prog=$1
_G_count=0
_G_path_prog_max=0
printf 0123456789 >conftest.in
while :
do
cat conftest.in conftest.in >conftest.tmp
mv conftest.tmp conftest.in
cp conftest.in conftest.nl
echo 'GREP' >> conftest.nl
"$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break
diff conftest.out conftest.nl >/dev/null 2>&1 || break
_G_count=`expr $_G_count + 1`
if test "$_G_count" -gt "$_G_path_prog_max"; then
# Best one so far, save it but keep looking for a better one
func_check_prog_result=$_G_path_prog
_G_path_prog_max=$_G_count
fi
# 10*(2^10) chars as input seems more than enough
test 10 -lt "$_G_count" && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out
}
func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
GREP=$func_path_progs_result
}
## ------------------------------- ##
## User overridable command paths. ##
## ------------------------------- ##
# All uppercase variable names are used for environment variables. These
# variables can be overridden by the user before calling a script that
# uses them if a suitable command of that name is not already available
# in the command search PATH.
: ${CP="cp -f"}
: ${ECHO="printf %s\n"}
: ${EGREP="$GREP -E"}
: ${FGREP="$GREP -F"}
: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
## -------------------- ##
## Useful sed snippets. ##
## -------------------- ##
sed_dirname='s|/[^/]*$||'
sed_basename='s|^.*/||'
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
# Same as above, but do not quote variable references.
sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
# Sed substitution that turns a string into a regex matching for the
# string literally.
sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
# Sed substitution that converts a w32 file name or path
# that contains forward slashes, into one that contains
# (escaped) backslashes. A very naive implementation.
sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
# Re-'\' parameter expansions in output of sed_double_quote_subst that
# were '\'-ed in input to the same. If an odd number of '\' preceded a
# '$' in input to sed_double_quote_subst, that '$' was protected from
# expansion. Since each input '\' is now two '\'s, look for any number
# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
_G_bs='\\'
_G_bs2='\\\\'
_G_bs4='\\\\\\\\'
_G_dollar='\$'
sed_double_backslash="\
s/$_G_bs4/&\\
/g
s/^$_G_bs2$_G_dollar/$_G_bs&/
s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
s/\n//g"
# require_check_ifs_backslash
# ---------------------------
# Check if we can use backslash as IFS='\' separator, and set
# $check_ifs_backshlash_broken to ':' or 'false'.
require_check_ifs_backslash=func_require_check_ifs_backslash
func_require_check_ifs_backslash ()
{
_G_save_IFS=$IFS
IFS='\'
_G_check_ifs_backshlash='a\\b'
for _G_i in $_G_check_ifs_backshlash
do
case $_G_i in
a)
check_ifs_backshlash_broken=false
;;
'')
break
;;
*)
check_ifs_backshlash_broken=:
break
;;
esac
done
IFS=$_G_save_IFS
require_check_ifs_backslash=:
}
## ----------------- ##
## Global variables. ##
## ----------------- ##
# Except for the global variables explicitly listed below, the following
# functions in the '^func_' namespace, and the '^require_' namespace
# variables initialised in the 'Resource management' section, sourcing
# this file will not pollute your global namespace with anything
# else. There's no portable way to scope variables in Bourne shell
# though, so actually running these functions will sometimes place
# results into a variable named after the function, and often use
# temporary variables in the '^_G_' namespace. If you are careful to
# avoid using those namespaces casually in your sourcing script, things
# should continue to work as you expect. And, of course, you can freely
# overwrite any of the functions or variables defined here before
# calling anything to customize them.
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
# Allow overriding, eg assuming that you follow the convention of
# putting '$debug_cmd' at the start of all your functions, you can get
# bash to show function call trace with:
#
# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
debug_cmd=${debug_cmd-":"}
exit_cmd=:
# By convention, finish your script with:
#
# exit $exit_status
#
# so that you can set exit_status to non-zero if you want to indicate
# something went wrong during execution without actually bailing out at
# the point of failure.
exit_status=$EXIT_SUCCESS
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
# is ksh but when the shell is invoked as "sh" and the current value of
# the _XPG environment variable is not equal to 1 (one), the special
# positional parameter $0, within a function call, is the name of the
# function.
progpath=$0
# The name of this program.
progname=`$ECHO "$progpath" |$SED "$sed_basename"`
# Make sure we have an absolute progpath for reexecution:
case $progpath in
[\\/]*|[A-Za-z]:\\*) ;;
*[\\/]*)
progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
progdir=`cd "$progdir" && pwd`
progpath=$progdir/$progname
;;
*)
_G_IFS=$IFS
IFS=${PATH_SEPARATOR-:}
for progdir in $PATH; do
IFS=$_G_IFS
test -x "$progdir/$progname" && break
done
IFS=$_G_IFS
test -n "$progdir" || progdir=`pwd`
progpath=$progdir/$progname
;;
esac
## ----------------- ##
## Standard options. ##
## ----------------- ##
# The following options affect the operation of the functions defined
# below, and should be set appropriately depending on run-time para-
# meters passed on the command line.
opt_dry_run=false
opt_quiet=false
opt_verbose=false
# Categories 'all' and 'none' are always available. Append any others
# you will pass as the first argument to func_warning from your own
# code.
warning_categories=
# By default, display warnings according to 'opt_warning_types'. Set
# 'warning_func' to ':' to elide all warnings, or func_fatal_error to
# treat the next displayed warning as a fatal error.
warning_func=func_warn_and_continue
# Set to 'all' to display all warnings, 'none' to suppress all
# warnings, or a space delimited list of some subset of
# 'warning_categories' to display only the listed warnings.
opt_warning_types=all
## -------------------- ##
## Resource management. ##
## -------------------- ##
# This section contains definitions for functions that each ensure a
# particular resource (a file, or a non-empty configuration variable for
# example) is available, and if appropriate to extract default values
# from pertinent package files. Call them using their associated
# 'require_*' variable to ensure that they are executed, at most, once.
#
# It's entirely deliberate that calling these functions can set
# variables that don't obey the namespace limitations obeyed by the rest
# of this file, in order that that they be as useful as possible to
# callers.
# require_term_colors
# -------------------
# Allow display of bold text on terminals that support it.
require_term_colors=func_require_term_colors
func_require_term_colors ()
{
$debug_cmd
test -t 1 && {
# COLORTERM and USE_ANSI_COLORS environment variables take
# precedence, because most terminfo databases neglect to describe
# whether color sequences are supported.
test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
if test 1 = "$USE_ANSI_COLORS"; then
# Standard ANSI escape sequences
tc_reset='[0m'
tc_bold='[1m'; tc_standout='[7m'
tc_red='[31m'; tc_green='[32m'
tc_blue='[34m'; tc_cyan='[36m'
else
# Otherwise trust the terminfo database after all.
test -n "`tput sgr0 2>/dev/null`" && {
tc_reset=`tput sgr0`
test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
tc_standout=$tc_bold
test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
}
fi
}
require_term_colors=:
}
## ----------------- ##
## Function library. ##
## ----------------- ##
# This section contains a variety of useful functions to call in your
# scripts. Take note of the portable wrappers for features provided by
# some modern shells, which will fall back to slower equivalents on
# less featureful shells.
# func_append VAR VALUE
# ---------------------
# Append VALUE onto the existing contents of VAR.
# _G_HAVE_PLUSEQ_OP
# Can be empty, in which case the shell is probed, "yes" if += is
# useable or anything else if it does not work.
if test -z "$_G_HAVE_PLUSEQ_OP" && \
__PLUSEQ_TEST="a" && \
__PLUSEQ_TEST+=" b" 2>/dev/null && \
test "a b" = "$__PLUSEQ_TEST"; then
_G_HAVE_PLUSEQ_OP=yes
fi
if test yes = "$_G_HAVE_PLUSEQ_OP"
then
# This is an XSI compatible shell, allowing a faster implementation...
eval 'func_append ()
{
$debug_cmd
eval "$1+=\$2"
}'
else
# ...otherwise fall back to using expr, which is often a shell builtin.
func_append ()
{
$debug_cmd
eval "$1=\$$1\$2"
}
fi
# func_append_quoted VAR VALUE
# ----------------------------
# Quote VALUE and append to the end of shell variable VAR, separated
# by a space.
if test yes = "$_G_HAVE_PLUSEQ_OP"; then
eval 'func_append_quoted ()
{
$debug_cmd
func_quote_arg pretty "$2"
eval "$1+=\\ \$func_quote_arg_result"
}'
else
func_append_quoted ()
{
$debug_cmd
func_quote_arg pretty "$2"
eval "$1=\$$1\\ \$func_quote_arg_result"
}
fi
# func_append_uniq VAR VALUE
# --------------------------
# Append unique VALUE onto the existing contents of VAR, assuming
# entries are delimited by the first character of VALUE. For example:
#
# func_append_uniq options " --another-option option-argument"
#
# will only append to $options if " --another-option option-argument "
# is not already present somewhere in $options already (note spaces at
# each end implied by leading space in second argument).
func_append_uniq ()
{
$debug_cmd
eval _G_current_value='`$ECHO $'$1'`'
_G_delim=`expr "$2" : '\(.\)'`
case $_G_delim$_G_current_value$_G_delim in
*"$2$_G_delim"*) ;;
*) func_append "$@" ;;
esac
}
# func_arith TERM...
# ------------------
# Set func_arith_result to the result of evaluating TERMs.
test -z "$_G_HAVE_ARITH_OP" \
&& (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
&& _G_HAVE_ARITH_OP=yes
if test yes = "$_G_HAVE_ARITH_OP"; then
eval 'func_arith ()
{
$debug_cmd
func_arith_result=$(( $* ))
}'
else
func_arith ()
{
$debug_cmd
func_arith_result=`expr "$@"`
}
fi
# func_basename FILE
# ------------------
# Set func_basename_result to FILE with everything up to and including
# the last / stripped.
if test yes = "$_G_HAVE_XSI_OPS"; then
# If this shell supports suffix pattern removal, then use it to avoid
# forking. Hide the definitions single quotes in case the shell chokes
# on unsupported syntax...
_b='func_basename_result=${1##*/}'
_d='case $1 in
*/*) func_dirname_result=${1%/*}$2 ;;
* ) func_dirname_result=$3 ;;
esac'
else
# ...otherwise fall back to using sed.
_b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
_d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
if test "X$func_dirname_result" = "X$1"; then
func_dirname_result=$3
else
func_append func_dirname_result "$2"
fi'
fi
eval 'func_basename ()
{
$debug_cmd
'"$_b"'
}'
# func_dirname FILE APPEND NONDIR_REPLACEMENT
# -------------------------------------------
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
# otherwise set result to NONDIR_REPLACEMENT.
eval 'func_dirname ()
{
$debug_cmd
'"$_d"'
}'
# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
# --------------------------------------------------------
# Perform func_basename and func_dirname in a single function
# call:
# dirname: Compute the dirname of FILE. If nonempty,
# add APPEND to the result, otherwise set result
# to NONDIR_REPLACEMENT.
# value returned in "$func_dirname_result"
# basename: Compute filename of FILE.
# value retuned in "$func_basename_result"
# For efficiency, we do not delegate to the functions above but instead
# duplicate the functionality here.
eval 'func_dirname_and_basename ()
{
$debug_cmd
'"$_b"'
'"$_d"'
}'
# func_echo ARG...
# ----------------
# Echo program name prefixed message.
func_echo ()
{
$debug_cmd
_G_message=$*
func_echo_IFS=$IFS
IFS=$nl
for _G_line in $_G_message; do
IFS=$func_echo_IFS
$ECHO "$progname: $_G_line"
done
IFS=$func_echo_IFS
}
# func_echo_all ARG...
# --------------------
# Invoke $ECHO with all args, space-separated.
func_echo_all ()
{
$ECHO "$*"
}
# func_echo_infix_1 INFIX ARG...
# ------------------------------
# Echo program name, followed by INFIX on the first line, with any
# additional lines not showing INFIX.
func_echo_infix_1 ()
{
$debug_cmd
$require_term_colors
_G_infix=$1; shift
_G_indent=$_G_infix
_G_prefix="$progname: $_G_infix: "
_G_message=$*
# Strip color escape sequences before counting printable length
for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
do
test -n "$_G_tc" && {
_G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
_G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
}
done
_G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
func_echo_infix_1_IFS=$IFS
IFS=$nl
for _G_line in $_G_message; do
IFS=$func_echo_infix_1_IFS
$ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
_G_prefix=$_G_indent
done
IFS=$func_echo_infix_1_IFS
}
# func_error ARG...
# -----------------
# Echo program name prefixed message to standard error.
func_error ()
{
$debug_cmd
$require_term_colors
func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
}
# func_fatal_error ARG...
# -----------------------
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
$debug_cmd
func_error "$*"
exit $EXIT_FAILURE
}
# func_grep EXPRESSION FILENAME
# -----------------------------
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
$debug_cmd
$GREP "$1" "$2" >/dev/null 2>&1
}
# func_len STRING
# ---------------
# Set func_len_result to the length of STRING. STRING may not
# start with a hyphen.
test -z "$_G_HAVE_XSI_OPS" \
&& (eval 'x=a/b/c;
test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
&& _G_HAVE_XSI_OPS=yes
if test yes = "$_G_HAVE_XSI_OPS"; then
eval 'func_len ()
{
$debug_cmd
func_len_result=${#1}
}'
else
func_len ()
{
$debug_cmd
func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
}
fi
# func_mkdir_p DIRECTORY-PATH
# ---------------------------
# Make sure the entire path to DIRECTORY-PATH is available.
func_mkdir_p ()
{
$debug_cmd
_G_directory_path=$1
_G_dir_list=
if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
# Protect directory names starting with '-'
case $_G_directory_path in
-*) _G_directory_path=./$_G_directory_path ;;
esac
# While some portion of DIR does not yet exist...
while test ! -d "$_G_directory_path"; do
# ...make a list in topmost first order. Use a colon delimited
# list incase some portion of path contains whitespace.
_G_dir_list=$_G_directory_path:$_G_dir_list
# If the last portion added has no slash in it, the list is done
case $_G_directory_path in */*) ;; *) break ;; esac
# ...otherwise throw away the child directory and loop
_G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
done
_G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
func_mkdir_p_IFS=$IFS; IFS=:
for _G_dir in $_G_dir_list; do
IFS=$func_mkdir_p_IFS
# mkdir can fail with a 'File exist' error if two processes
# try to create one of the directories concurrently. Don't
# stop in that case!
$MKDIR "$_G_dir" 2>/dev/null || :
done
IFS=$func_mkdir_p_IFS
# Bail out if we (or some other process) failed to create a directory.
test -d "$_G_directory_path" || \
func_fatal_error "Failed to create '$1'"
fi
}
# func_mktempdir [BASENAME]
# -------------------------
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, BASENAME is the basename for that directory.
func_mktempdir ()
{
$debug_cmd
_G_template=${TMPDIR-/tmp}/${1-$progname}
if test : = "$opt_dry_run"; then
# Return a directory name, but don't create it in dry-run mode
_G_tmpdir=$_G_template-$$
else
# If mktemp works, use that first and foremost
_G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
if test ! -d "$_G_tmpdir"; then
# Failing that, at least try and use $RANDOM to avoid a race
_G_tmpdir=$_G_template-${RANDOM-0}$$
func_mktempdir_umask=`umask`
umask 0077
$MKDIR "$_G_tmpdir"
umask $func_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
test -d "$_G_tmpdir" || \
func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
fi
$ECHO "$_G_tmpdir"
}
# func_normal_abspath PATH
# ------------------------
# Remove doubled-up and trailing slashes, "." path components,
# and cancel out any ".." path components in PATH after making
# it an absolute path.
func_normal_abspath ()
{
$debug_cmd
# These SED scripts presuppose an absolute path with a trailing slash.
_G_pathcar='s|^/\([^/]*\).*$|\1|'
_G_pathcdr='s|^/[^/]*||'
_G_removedotparts=':dotsl
s|/\./|/|g
t dotsl
s|/\.$|/|'
_G_collapseslashes='s|/\{1,\}|/|g'
_G_finalslash='s|/*$|/|'
# Start from root dir and reassemble the path.
func_normal_abspath_result=
func_normal_abspath_tpath=$1
func_normal_abspath_altnamespace=
case $func_normal_abspath_tpath in
"")
# Empty path, that just means $cwd.
func_stripname '' '/' "`pwd`"
func_normal_abspath_result=$func_stripname_result
return
;;
# The next three entries are used to spot a run of precisely
# two leading slashes without using negated character classes;
# we take advantage of case's first-match behaviour.
///*)
# Unusual form of absolute path, do nothing.
;;
//*)
# Not necessarily an ordinary path; POSIX reserves leading '//'
# and for example Cygwin uses it to access remote file shares
# over CIFS/SMB, so we conserve a leading double slash if found.
func_normal_abspath_altnamespace=/
;;
/*)
# Absolute path, do nothing.
;;
*)
# Relative path, prepend $cwd.
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
;;
esac
# Cancel out all the simple stuff to save iterations. We also want
# the path to end with a slash for ease of parsing, so make sure
# there is one (and only one) here.
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
while :; do
# Processed it all yet?
if test / = "$func_normal_abspath_tpath"; then
# If we ascended to the root using ".." the result may be empty now.
if test -z "$func_normal_abspath_result"; then
func_normal_abspath_result=/
fi
break
fi
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$_G_pathcar"`
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$_G_pathcdr"`
# Figure out what to do with it
case $func_normal_abspath_tcomponent in
"")
# Trailing empty path component, ignore it.
;;
..)
# Parent dir; strip last assembled component from result.
func_dirname "$func_normal_abspath_result"
func_normal_abspath_result=$func_dirname_result
;;
*)
# Actual path component, append it.
func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
;;
esac
done
# Restore leading double-slash if one was found on entry.
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
}
# func_notquiet ARG...
# --------------------
# Echo program name prefixed message only when not in quiet mode.
func_notquiet ()
{
$debug_cmd
$opt_quiet || func_echo ${1+"$@"}
# A bug in bash halts the script if the last line of a function
# fails when set -e is in force, so we need another command to
# work around that:
:
}
# func_relative_path SRCDIR DSTDIR
# --------------------------------
# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
func_relative_path ()
{
$debug_cmd
func_relative_path_result=
func_normal_abspath "$1"
func_relative_path_tlibdir=$func_normal_abspath_result
func_normal_abspath "$2"
func_relative_path_tbindir=$func_normal_abspath_result
# Ascend the tree starting from libdir
while :; do
# check if we have found a prefix of bindir
case $func_relative_path_tbindir in
$func_relative_path_tlibdir)
# found an exact match
func_relative_path_tcancelled=
break
;;
$func_relative_path_tlibdir*)
# found a matching prefix
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
func_relative_path_tcancelled=$func_stripname_result
if test -z "$func_relative_path_result"; then
func_relative_path_result=.
fi
break
;;
*)
func_dirname $func_relative_path_tlibdir
func_relative_path_tlibdir=$func_dirname_result
if test -z "$func_relative_path_tlibdir"; then
# Have to descend all the way to the root!
func_relative_path_result=../$func_relative_path_result
func_relative_path_tcancelled=$func_relative_path_tbindir
break
fi
func_relative_path_result=../$func_relative_path_result
;;
esac
done
# Now calculate path; take care to avoid doubling-up slashes.
func_stripname '' '/' "$func_relative_path_result"
func_relative_path_result=$func_stripname_result
func_stripname '/' '/' "$func_relative_path_tcancelled"
if test -n "$func_stripname_result"; then
func_append func_relative_path_result "/$func_stripname_result"
fi
# Normalisation. If bindir is libdir, return '.' else relative path.
if test -n "$func_relative_path_result"; then
func_stripname './' '' "$func_relative_path_result"
func_relative_path_result=$func_stripname_result
fi
test -n "$func_relative_path_result" || func_relative_path_result=.
:
}
# func_quote_portable EVAL ARG
# ----------------------------
# Internal function to portably implement func_quote_arg. Note that we still
# keep attention to performance here so we as much as possible try to avoid
# calling sed binary (so far O(N) complexity as long as func_append is O(1)).
func_quote_portable ()
{
$debug_cmd
$require_check_ifs_backslash
func_quote_portable_result=$2
# one-time-loop (easy break)
while true
do
if $1; then
func_quote_portable_result=`$ECHO "$2" | $SED \
-e "$sed_double_quote_subst" -e "$sed_double_backslash"`
break
fi
# Quote for eval.
case $func_quote_portable_result in
*[\\\`\"\$]*)
# Fallback to sed for $func_check_bs_ifs_broken=:, or when the string
# contains the shell wildcard characters.
case $check_ifs_backshlash_broken$func_quote_portable_result in
:*|*[\[\*\?]*)
func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
| $SED "$sed_quote_subst"`
break
;;
esac
func_quote_portable_old_IFS=$IFS
for _G_char in '\' '`' '"' '$'
do
# STATE($1) PREV($2) SEPARATOR($3)
set start "" ""
func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
IFS=$_G_char
for _G_part in $func_quote_portable_result
do
case $1 in
quote)
func_append func_quote_portable_result "$3$2"
set quote "$_G_part" "\\$_G_char"
;;
start)
set first "" ""
func_quote_portable_result=
;;
first)
set quote "$_G_part" ""
;;
esac
done
done
IFS=$func_quote_portable_old_IFS
;;
*) ;;
esac
break
done
func_quote_portable_unquoted_result=$func_quote_portable_result
case $func_quote_portable_result in
# double-quote args containing shell metacharacters to delay
# word splitting, command substitution and variable expansion
# for a subsequent eval.
# many bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_portable_result=\"$func_quote_portable_result\"
;;
esac
}
# func_quotefast_eval ARG
# -----------------------
# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
# but optimized for speed. Result is stored in $func_quotefast_eval.
if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
printf -v _GL_test_printf_tilde %q '~'
if test '\~' = "$_GL_test_printf_tilde"; then
func_quotefast_eval ()
{
printf -v func_quotefast_eval_result %q "$1"
}
else
# Broken older Bash implementations. Make those faster too if possible.
func_quotefast_eval ()
{
case $1 in
'~'*)
func_quote_portable false "$1"
func_quotefast_eval_result=$func_quote_portable_result
;;
*)
printf -v func_quotefast_eval_result %q "$1"
;;
esac
}
fi
else
func_quotefast_eval ()
{
func_quote_portable false "$1"
func_quotefast_eval_result=$func_quote_portable_result
}
fi
# func_quote_arg MODEs ARG
# ------------------------
# Quote one ARG to be evaled later. MODEs argument may contain zero or more
# specifiers listed below separated by ',' character. This function returns two
# values:
# i) func_quote_arg_result
# double-quoted (when needed), suitable for a subsequent eval
# ii) func_quote_arg_unquoted_result
# has all characters that are still active within double
# quotes backslashified. Available only if 'unquoted' is specified.
#
# Available modes:
# ----------------
# 'eval' (default)
# - escape shell special characters
# 'expand'
# - the same as 'eval'; but do not quote variable references
# 'pretty'
# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
# be used later in func_quote to get output like: 'echo "a b"' instead
# of 'echo a\ b'. This is slower than default on some shells.
# 'unquoted'
# - produce also $func_quote_arg_unquoted_result which does not contain
# wrapping double-quotes.
#
# Examples for 'func_quote_arg pretty,unquoted string':
#
# string | *_result | *_unquoted_result
# ------------+-----------------------+-------------------
# " | \" | \"
# a b | "a b" | a b
# "a b" | "\"a b\"" | \"a b\"
# * | "*" | *
# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
#
# Examples for 'func_quote_arg pretty,unquoted,expand string':
#
# string | *_result | *_unquoted_result
# --------------+---------------------+--------------------
# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
func_quote_arg ()
{
_G_quote_expand=false
case ,$1, in
*,expand,*)
_G_quote_expand=:
;;
esac
case ,$1, in
*,pretty,*|*,expand,*|*,unquoted,*)
func_quote_portable $_G_quote_expand "$2"
func_quote_arg_result=$func_quote_portable_result
func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
;;
*)
# Faster quote-for-eval for some shells.
func_quotefast_eval "$2"
func_quote_arg_result=$func_quotefast_eval_result
;;
esac
}
# func_quote MODEs ARGs...
# ------------------------
# Quote all ARGs to be evaled later and join them into single command. See
# func_quote_arg's description for more info.
func_quote ()
{
$debug_cmd
_G_func_quote_mode=$1 ; shift
func_quote_result=
while test 0 -lt $#; do
func_quote_arg "$_G_func_quote_mode" "$1"
if test -n "$func_quote_result"; then
func_append func_quote_result " $func_quote_arg_result"
else
func_append func_quote_result "$func_quote_arg_result"
fi
shift
done
}
# func_stripname PREFIX SUFFIX NAME
# ---------------------------------
# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
# PREFIX and SUFFIX must not contain globbing or regex special
# characters, hashes, percent signs, but SUFFIX may contain a leading
# dot (in which case that matches only a dot).
if test yes = "$_G_HAVE_XSI_OPS"; then
eval 'func_stripname ()
{
$debug_cmd
# pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
# positional parameters, so assign one to ordinary variable first.
func_stripname_result=$3
func_stripname_result=${func_stripname_result#"$1"}
func_stripname_result=${func_stripname_result%"$2"}
}'
else
func_stripname ()
{
$debug_cmd
case $2 in
.*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
esac
}
fi
# func_show_eval CMD [FAIL_EXP]
# -----------------------------
# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it.
func_show_eval ()
{
$debug_cmd
_G_cmd=$1
_G_fail_exp=${2-':'}
func_quote_arg pretty,expand "$_G_cmd"
eval "func_notquiet $func_quote_arg_result"
$opt_dry_run || {
eval "$_G_cmd"
_G_status=$?
if test 0 -ne "$_G_status"; then
eval "(exit $_G_status); $_G_fail_exp"
fi
}
}
# func_show_eval_locale CMD [FAIL_EXP]
# ------------------------------------
# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it. Use the saved locale for evaluation.
func_show_eval_locale ()
{
$debug_cmd
_G_cmd=$1
_G_fail_exp=${2-':'}
$opt_quiet || {
func_quote_arg expand,pretty "$_G_cmd"
eval "func_echo $func_quote_arg_result"
}
$opt_dry_run || {
eval "$_G_user_locale
$_G_cmd"
_G_status=$?
eval "$_G_safe_locale"
if test 0 -ne "$_G_status"; then
eval "(exit $_G_status); $_G_fail_exp"
fi
}
}
# func_tr_sh
# ----------
# Turn $1 into a string suitable for a shell variable name.
# Result is stored in $func_tr_sh_result. All characters
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
# if $1 begins with a digit, a '_' is prepended as well.
func_tr_sh ()
{
$debug_cmd
case $1 in
[0-9]* | *[!a-zA-Z0-9_]*)
func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
;;
* )
func_tr_sh_result=$1
;;
esac
}
# func_verbose ARG...
# -------------------
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
$debug_cmd
$opt_verbose && func_echo "$*"
:
}
# func_warn_and_continue ARG...
# -----------------------------
# Echo program name prefixed warning message to standard error.
func_warn_and_continue ()
{
$debug_cmd
$require_term_colors
func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
}
# func_warning CATEGORY ARG...
# ----------------------------
# Echo program name prefixed warning message to standard error. Warning
# messages can be filtered according to CATEGORY, where this function
# elides messages where CATEGORY is not listed in the global variable
# 'opt_warning_types'.
func_warning ()
{
$debug_cmd
# CATEGORY must be in the warning_categories list!
case " $warning_categories " in
*" $1 "*) ;;
*) func_internal_error "invalid warning category '$1'" ;;
esac
_G_category=$1
shift
case " $opt_warning_types " in
*" $_G_category "*) $warning_func ${1+"$@"} ;;
esac
}
# func_sort_ver VER1 VER2
# -----------------------
# 'sort -V' is not generally available.
# Note this deviates from the version comparison in automake
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
# but this should suffice as we won't be specifying old
# version formats or redundant trailing .0 in bootstrap.conf.
# If we did want full compatibility then we should probably
# use m4_version_compare from autoconf.
func_sort_ver ()
{
$debug_cmd
printf '%s\n%s\n' "$1" "$2" \
| sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
}
# func_lt_ver PREV CURR
# ---------------------
# Return true if PREV and CURR are in the correct order according to
# func_sort_ver, otherwise false. Use it like this:
#
# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
func_lt_ver ()
{
$debug_cmd
test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
}
# Local variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
# time-stamp-time-zone: "UTC"
# End:
#! /bin/sh
# A portable, pluggable option parser for Bourne shell.
# Written by Gary V. Vaughan, 2010
# This is free software. There is NO warranty; not even for
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Copyright (C) 2010-2019, 2021 Bootstrap Authors
#
# This file is dual licensed under the terms of the MIT license
#