mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'develop' as a checkpoint to keep master recent
This commit is contained in:
commit
93ee83022e
|
@ -0,0 +1,5 @@
|
|||
*~
|
||||
Makefile
|
||||
aclocal.m4
|
||||
depcomp
|
||||
.deps/
|
|
@ -1,22 +1,33 @@
|
|||
#
|
||||
# Makefile. Generated from Makefile.in by configure.
|
||||
# @configure_input@
|
||||
#
|
||||
|
||||
|
||||
package = getdns
|
||||
version = 0.320
|
||||
tarname = getdns
|
||||
package = @PACKAGE_NAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
tarname = @PACKAGE_TARNAME@
|
||||
distdir = $(tarname)-$(version)
|
||||
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
bindir = ${exec_prefix}/bin
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
|
||||
srcdir = .
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
default:
|
||||
cd src && $(MAKE) $@
|
||||
|
||||
all clean getdns:
|
||||
cd common && $(MAKE) $@
|
||||
all : default
|
||||
|
||||
clean:
|
||||
cd src && $(MAKE) $@
|
||||
rm -f *.o
|
||||
|
||||
distclean:
|
||||
cd src && $(MAKE) $@
|
||||
rm -f config.log config.status Makefile
|
||||
rm -fR autom4te.cache
|
||||
|
||||
$(distdir): FORCE
|
||||
mkdir -p $(distdir)/src
|
||||
|
@ -34,8 +45,8 @@ distcheck: $(distdir).tar.gz
|
|||
cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst uninstall
|
||||
@remaining="`find $${PWD}/$(distdir)/_inst -type f | wc -l`"; \
|
||||
if test "$${remaining}" -ne 0; then
|
||||
echo "@@@ $${remaining} file(s) remaining in stage directory!"; \
|
||||
exit 1; \
|
||||
echo "@@@ $${remaining} file(s) remaining in stage directory!"; \
|
||||
exit 1; \
|
||||
fi
|
||||
cd $(distdir) && $(MAKE) clean
|
||||
rm -rf $(distdir)
|
||||
|
@ -43,8 +54,8 @@ distcheck: $(distdir).tar.gz
|
|||
|
||||
Makefile: Makefile.in config.status
|
||||
./config.status $@
|
||||
|
||||
|
||||
configure.status: configure
|
||||
./config.status --recheck
|
||||
|
||||
.PHONY: all clean
|
||||
.PHONY: all distclean clean default
|
12
README.md
12
README.md
|
@ -16,7 +16,7 @@ The goals of this implementation of the getdns API are:
|
|||
* Include examples and tests as part of the build
|
||||
* Document code using doxygen
|
||||
* Leverage github as much as possible for project coordination
|
||||
* Coding style/standards follow the [BSD coding style](ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/misc/style)
|
||||
* Coding style/standards follow the BSD coding style <ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/misc/style>
|
||||
* Follow the git flow branching model described at <http://nvie.com/posts/a-successful-git-branching-model/>
|
||||
** the master branch is always in a production ready state
|
||||
** the develop branch contains the latest development changes which are merged from develop into master once they are considered production ready
|
||||
|
@ -27,10 +27,10 @@ Non-goals (things we will not be doing) include:
|
|||
|
||||
Contributors
|
||||
============
|
||||
Neel Goyal, Verisign, Inc.
|
||||
Allison Mankin, Verisign, Inc.
|
||||
Melinda Shore, No Mountain Software LLC
|
||||
Glen Wiley, Verisign, Inc.
|
||||
* Neel Goyal, Verisign, Inc.
|
||||
* Allison Mankin, Verisign, Inc.
|
||||
* Melinda Shore, No Mountain Software LLC
|
||||
* Glen Wiley, Verisign, Inc.
|
||||
|
||||
External Dependencies
|
||||
=====================
|
||||
|
@ -42,6 +42,8 @@ Although [libevent](http://libevent.org) is used initially to implement the asyn
|
|||
|
||||
Doxygen is used to generate documentation, while this is not technically necessary for the build it makes things a lot more pleasant.
|
||||
|
||||
GNU autoconf is used to generate the configure script (and consequently the Makefiles)
|
||||
|
||||
Current State of the Implementation
|
||||
===================================
|
||||
We are currently in the early stages of building the API so the code should be considered incomplete. The current target platforms and the personal primarily responsible for ensuring it builds and runs on that platform include:
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for getdns 0.320.
|
||||
# Generated by GNU Autoconf 2.69 for getdns 0.320.
|
||||
#
|
||||
# Report bugs to <melinda.shore@nomountain.net>.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
|
||||
# Foundation, Inc.
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
#
|
||||
#
|
||||
# This configure script is free software; the Free Software Foundation
|
||||
|
@ -136,6 +134,31 @@ export LANGUAGE
|
|||
# CDPATH.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
||||
# Use a proper internal environment variable to ensure we don't fall
|
||||
# into an infinite loop, continuously re-executing ourselves.
|
||||
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
|
||||
_as_can_reexec=no; export _as_can_reexec;
|
||||
# We cannot yet assume a decent shell, so we have to provide a
|
||||
# neutralization value for shells without unset; and this also
|
||||
# works around shells that cannot unset nonexistent variables.
|
||||
# Preserve -v and -x to the replacement shell.
|
||||
BASH_ENV=/dev/null
|
||||
ENV=/dev/null
|
||||
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
|
||||
case $- in # ((((
|
||||
*v*x* | *x*v* ) as_opts=-vx ;;
|
||||
*v* ) as_opts=-v ;;
|
||||
*x* ) as_opts=-x ;;
|
||||
* ) as_opts= ;;
|
||||
esac
|
||||
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
|
||||
# Admittedly, this is quite paranoid, since all the known shells bail
|
||||
# out after a failed `exec'.
|
||||
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
|
||||
as_fn_exit 255
|
||||
fi
|
||||
# We don't want this to propagate to other subprocesses.
|
||||
{ _as_can_reexec=; unset _as_can_reexec;}
|
||||
if test "x$CONFIG_SHELL" = x; then
|
||||
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
|
||||
emulate sh
|
||||
|
@ -169,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
|
|||
else
|
||||
exitcode=1; echo positional parameters were not saved.
|
||||
fi
|
||||
test x\$exitcode = x0 || exit 1"
|
||||
test x\$exitcode = x0 || exit 1
|
||||
test -x / || exit 1"
|
||||
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
|
||||
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
|
||||
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
|
||||
|
@ -214,21 +238,25 @@ IFS=$as_save_IFS
|
|||
|
||||
|
||||
if test "x$CONFIG_SHELL" != x; then :
|
||||
# We cannot yet assume a decent shell, so we have to provide a
|
||||
# neutralization value for shells without unset; and this also
|
||||
# works around shells that cannot unset nonexistent variables.
|
||||
# Preserve -v and -x to the replacement shell.
|
||||
BASH_ENV=/dev/null
|
||||
ENV=/dev/null
|
||||
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
|
||||
export CONFIG_SHELL
|
||||
case $- in # ((((
|
||||
*v*x* | *x*v* ) as_opts=-vx ;;
|
||||
*v* ) as_opts=-v ;;
|
||||
*x* ) as_opts=-x ;;
|
||||
* ) as_opts= ;;
|
||||
esac
|
||||
exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
|
||||
export CONFIG_SHELL
|
||||
# We cannot yet assume a decent shell, so we have to provide a
|
||||
# neutralization value for shells without unset; and this also
|
||||
# works around shells that cannot unset nonexistent variables.
|
||||
# Preserve -v and -x to the replacement shell.
|
||||
BASH_ENV=/dev/null
|
||||
ENV=/dev/null
|
||||
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
|
||||
case $- in # ((((
|
||||
*v*x* | *x*v* ) as_opts=-vx ;;
|
||||
*v* ) as_opts=-v ;;
|
||||
*x* ) as_opts=-x ;;
|
||||
* ) as_opts= ;;
|
||||
esac
|
||||
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
|
||||
# Admittedly, this is quite paranoid, since all the known shells bail
|
||||
# out after a failed `exec'.
|
||||
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if test x$as_have_required = xno; then :
|
||||
|
@ -331,6 +359,14 @@ $as_echo X"$as_dir" |
|
|||
|
||||
|
||||
} # as_fn_mkdir_p
|
||||
|
||||
# as_fn_executable_p FILE
|
||||
# -----------------------
|
||||
# Test if FILE is an executable regular file.
|
||||
as_fn_executable_p ()
|
||||
{
|
||||
test -f "$1" && test -x "$1"
|
||||
} # as_fn_executable_p
|
||||
# as_fn_append VAR VALUE
|
||||
# ----------------------
|
||||
# Append the text in VALUE to the end of the definition contained in VAR. Take
|
||||
|
@ -452,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
|
|||
chmod +x "$as_me.lineno" ||
|
||||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
|
||||
|
||||
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
|
||||
# already done that, so ensure we don't try to do so again and fall
|
||||
# in an infinite loop. This has already happened in practice.
|
||||
_as_can_reexec=no; export _as_can_reexec
|
||||
# Don't try to exec as it changes $[0], causing all sort of problems
|
||||
# (the dirname of $[0] is not the place where we might find the
|
||||
# original and so on. Autoconf is especially sensitive to this).
|
||||
|
@ -486,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then
|
|||
# ... but there are two gotchas:
|
||||
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
|
||||
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
|
||||
# In both cases, we have to default to `cp -p'.
|
||||
# In both cases, we have to default to `cp -pR'.
|
||||
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
elif ln conf$$.file conf$$ 2>/dev/null; then
|
||||
as_ln_s=ln
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
|
||||
rmdir conf$$.dir 2>/dev/null
|
||||
|
@ -507,28 +547,8 @@ else
|
|||
as_mkdir_p=false
|
||||
fi
|
||||
|
||||
if test -x / >/dev/null 2>&1; then
|
||||
as_test_x='test -x'
|
||||
else
|
||||
if ls -dL / >/dev/null 2>&1; then
|
||||
as_ls_L_option=L
|
||||
else
|
||||
as_ls_L_option=
|
||||
fi
|
||||
as_test_x='
|
||||
eval sh -c '\''
|
||||
if test -d "$1"; then
|
||||
test -d "$1/.";
|
||||
else
|
||||
case $1 in #(
|
||||
-*)set "./$1";;
|
||||
esac;
|
||||
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
|
||||
???[sx]*):;;*)false;;esac;fi
|
||||
'\'' sh
|
||||
'
|
||||
fi
|
||||
as_executable_p=$as_test_x
|
||||
as_test_x='test -x'
|
||||
as_executable_p=as_fn_executable_p
|
||||
|
||||
# Sed expression to map a string onto a valid CPP name.
|
||||
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
|
||||
|
@ -1120,8 +1140,6 @@ target=$target_alias
|
|||
if test "x$host_alias" != x; then
|
||||
if test "x$build_alias" = x; then
|
||||
cross_compiling=maybe
|
||||
$as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
|
||||
If a cross compiler is detected then cross compile mode will be used" >&2
|
||||
elif test "x$build_alias" != "x$host_alias"; then
|
||||
cross_compiling=yes
|
||||
fi
|
||||
|
@ -1349,9 +1367,9 @@ test -n "$ac_init_help" && exit $ac_status
|
|||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
getdns configure 0.320
|
||||
generated by GNU Autoconf 2.68
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
This configure script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it.
|
||||
_ACEOF
|
||||
|
@ -1427,7 +1445,7 @@ $as_echo "$ac_try_echo"; } >&5
|
|||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext && {
|
||||
test "$cross_compiling" = yes ||
|
||||
$as_test_x conftest$ac_exeext
|
||||
test -x conftest$ac_exeext
|
||||
}; then :
|
||||
ac_retval=0
|
||||
else
|
||||
|
@ -1725,7 +1743,8 @@ int
|
|||
main ()
|
||||
{
|
||||
static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
|
||||
test_array [0] = 0
|
||||
test_array [0] = 0;
|
||||
return test_array [0];
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
@ -1758,7 +1777,7 @@ This file contains any messages produced by compilers while
|
|||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by getdns $as_me 0.320, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
||||
|
@ -2131,7 +2150,7 @@ do
|
|||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="${ac_tool_prefix}gcc"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
|
@ -2171,7 +2190,7 @@ do
|
|||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CC="gcc"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
|
@ -2224,7 +2243,7 @@ do
|
|||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="${ac_tool_prefix}cc"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
|
@ -2265,7 +2284,7 @@ do
|
|||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
|
||||
ac_prog_rejected=yes
|
||||
continue
|
||||
|
@ -2323,7 +2342,7 @@ do
|
|||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
|
@ -2367,7 +2386,7 @@ do
|
|||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CC="$ac_prog"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
|
@ -2813,8 +2832,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|||
/* end confdefs.h. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
struct stat;
|
||||
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
|
||||
struct buf { int x; };
|
||||
FILE * (*rcsopen) (struct buf *, struct stat *, int);
|
||||
|
@ -3193,7 +3211,7 @@ do
|
|||
for ac_prog in grep ggrep; do
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
|
||||
{ test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
|
||||
as_fn_executable_p "$ac_path_GREP" || continue
|
||||
# Check for GNU ac_path_GREP and select it if it is found.
|
||||
# Check for GNU $ac_path_GREP
|
||||
case `"$ac_path_GREP" --version 2>&1` in
|
||||
|
@ -3259,7 +3277,7 @@ do
|
|||
for ac_prog in egrep; do
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
|
||||
{ test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
|
||||
as_fn_executable_p "$ac_path_EGREP" || continue
|
||||
# Check for GNU ac_path_EGREP and select it if it is found.
|
||||
# Check for GNU $ac_path_EGREP
|
||||
case `"$ac_path_EGREP" --version 2>&1` in
|
||||
|
@ -3459,60 +3477,60 @@ else
|
|||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifndef bool
|
||||
"error: bool is not defined"
|
||||
#endif
|
||||
#ifndef false
|
||||
"error: false is not defined"
|
||||
#endif
|
||||
#if false
|
||||
"error: false is not 0"
|
||||
#endif
|
||||
#ifndef true
|
||||
"error: true is not defined"
|
||||
#endif
|
||||
#if true != 1
|
||||
"error: true is not 1"
|
||||
#endif
|
||||
#ifndef __bool_true_false_are_defined
|
||||
"error: __bool_true_false_are_defined is not defined"
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
#ifndef bool
|
||||
"error: bool is not defined"
|
||||
#endif
|
||||
#ifndef false
|
||||
"error: false is not defined"
|
||||
#endif
|
||||
#if false
|
||||
"error: false is not 0"
|
||||
#endif
|
||||
#ifndef true
|
||||
"error: true is not defined"
|
||||
#endif
|
||||
#if true != 1
|
||||
"error: true is not 1"
|
||||
#endif
|
||||
#ifndef __bool_true_false_are_defined
|
||||
"error: __bool_true_false_are_defined is not defined"
|
||||
#endif
|
||||
|
||||
struct s { _Bool s: 1; _Bool t; } s;
|
||||
struct s { _Bool s: 1; _Bool t; } s;
|
||||
|
||||
char a[true == 1 ? 1 : -1];
|
||||
char b[false == 0 ? 1 : -1];
|
||||
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
|
||||
char d[(bool) 0.5 == true ? 1 : -1];
|
||||
/* See body of main program for 'e'. */
|
||||
char f[(_Bool) 0.0 == false ? 1 : -1];
|
||||
char g[true];
|
||||
char h[sizeof (_Bool)];
|
||||
char i[sizeof s.t];
|
||||
enum { j = false, k = true, l = false * true, m = true * 256 };
|
||||
/* The following fails for
|
||||
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
|
||||
_Bool n[m];
|
||||
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
|
||||
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
|
||||
/* Catch a bug in an HP-UX C compiler. See
|
||||
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
|
||||
*/
|
||||
_Bool q = true;
|
||||
_Bool *pq = &q;
|
||||
char a[true == 1 ? 1 : -1];
|
||||
char b[false == 0 ? 1 : -1];
|
||||
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
|
||||
char d[(bool) 0.5 == true ? 1 : -1];
|
||||
/* See body of main program for 'e'. */
|
||||
char f[(_Bool) 0.0 == false ? 1 : -1];
|
||||
char g[true];
|
||||
char h[sizeof (_Bool)];
|
||||
char i[sizeof s.t];
|
||||
enum { j = false, k = true, l = false * true, m = true * 256 };
|
||||
/* The following fails for
|
||||
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
|
||||
_Bool n[m];
|
||||
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
|
||||
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
|
||||
/* Catch a bug in an HP-UX C compiler. See
|
||||
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
|
||||
*/
|
||||
_Bool q = true;
|
||||
_Bool *pq = &q;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
bool e = &s;
|
||||
*pq |= q;
|
||||
*pq |= ! q;
|
||||
/* Refer to every declared value, to avoid compiler optimizations. */
|
||||
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
|
||||
+ !m + !n + !o + !p + !q + !pq);
|
||||
bool e = &s;
|
||||
*pq |= q;
|
||||
*pq |= ! q;
|
||||
/* Refer to every declared value, to avoid compiler optimizations. */
|
||||
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
|
||||
+ !m + !n + !o + !p + !q + !pq);
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
@ -3527,7 +3545,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
|
||||
$as_echo "$ac_cv_header_stdbool_h" >&6; }
|
||||
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
|
||||
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
|
||||
if test "x$ac_cv_type__Bool" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
|
@ -3537,6 +3555,7 @@ _ACEOF
|
|||
|
||||
fi
|
||||
|
||||
|
||||
if test $ac_cv_header_stdbool_h = yes; then
|
||||
|
||||
$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
|
||||
|
@ -3609,7 +3628,7 @@ _ACEOF
|
|||
esac
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile common/Makefile"
|
||||
ac_config_files="$ac_config_files Makefile src/common/Makefile src/test/Makefile"
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
|
@ -4054,16 +4073,16 @@ if (echo >conf$$.file) 2>/dev/null; then
|
|||
# ... but there are two gotchas:
|
||||
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
|
||||
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
|
||||
# In both cases, we have to default to `cp -p'.
|
||||
# In both cases, we have to default to `cp -pR'.
|
||||
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
elif ln conf$$.file conf$$ 2>/dev/null; then
|
||||
as_ln_s=ln
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
as_ln_s='cp -pR'
|
||||
fi
|
||||
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
|
||||
rmdir conf$$.dir 2>/dev/null
|
||||
|
@ -4123,28 +4142,16 @@ else
|
|||
as_mkdir_p=false
|
||||
fi
|
||||
|
||||
if test -x / >/dev/null 2>&1; then
|
||||
as_test_x='test -x'
|
||||
else
|
||||
if ls -dL / >/dev/null 2>&1; then
|
||||
as_ls_L_option=L
|
||||
else
|
||||
as_ls_L_option=
|
||||
fi
|
||||
as_test_x='
|
||||
eval sh -c '\''
|
||||
if test -d "$1"; then
|
||||
test -d "$1/.";
|
||||
else
|
||||
case $1 in #(
|
||||
-*)set "./$1";;
|
||||
esac;
|
||||
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
|
||||
???[sx]*):;;*)false;;esac;fi
|
||||
'\'' sh
|
||||
'
|
||||
fi
|
||||
as_executable_p=$as_test_x
|
||||
|
||||
# as_fn_executable_p FILE
|
||||
# -----------------------
|
||||
# Test if FILE is an executable regular file.
|
||||
as_fn_executable_p ()
|
||||
{
|
||||
test -f "$1" && test -x "$1"
|
||||
} # as_fn_executable_p
|
||||
as_test_x='test -x'
|
||||
as_executable_p=as_fn_executable_p
|
||||
|
||||
# Sed expression to map a string onto a valid CPP name.
|
||||
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
|
||||
|
@ -4166,7 +4173,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by getdns $as_me 0.320, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
CONFIG_HEADERS = $CONFIG_HEADERS
|
||||
|
@ -4219,10 +4226,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
|||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
getdns config.status 0.320
|
||||
configured by $0, generated by GNU Autoconf 2.68,
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
This config.status script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it."
|
||||
|
||||
|
@ -4299,7 +4306,7 @@ fi
|
|||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
if \$ac_cs_recheck; then
|
||||
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
|
||||
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
|
||||
shift
|
||||
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
|
||||
CONFIG_SHELL='$SHELL'
|
||||
|
@ -4329,7 +4336,8 @@ for ac_config_target in $ac_config_targets
|
|||
do
|
||||
case $ac_config_target in
|
||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
"common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;
|
||||
"src/common/Makefile") CONFIG_FILES="$CONFIG_FILES src/common/Makefile" ;;
|
||||
"src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;;
|
||||
|
||||
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
|
||||
esac
|
|
@ -27,5 +27,5 @@ AC_TYPE_UINT32_T
|
|||
AC_TYPE_UINT64_T
|
||||
AC_TYPE_UINT8_T
|
||||
|
||||
AC_CONFIG_FILES([Makefile common/Makefile])
|
||||
AC_CONFIG_FILES([Makefile src/common/Makefile src/test/Makefile])
|
||||
AC_OUTPUT
|
|
@ -0,0 +1,65 @@
|
|||
proposed getdns cache design
|
||||
Glen Wiley <gwiley@verisign.com>
|
||||
|
||||
API Description Requirements
|
||||
============================
|
||||
Considerations regarding cache are slightly different depending on
|
||||
whether we are operating as a stub resolver or a recursive resolver.
|
||||
The API description requires that we operate as a recursive resolver
|
||||
and considers stub resolver behavior optional.
|
||||
|
||||
Recursive Resolver Cache
|
||||
========================
|
||||
Caching is arguably an important feature for most recursive resolvers.
|
||||
In this case we are not intending a replacement for the fully
|
||||
functional recursive resolvers already available (BIND, Unbound, etc.)
|
||||
so we shoudl limit a cache implementation to behaviors important to
|
||||
proper operation of a recursive resolver.
|
||||
|
||||
DNSSEC validation can potentially triggers more queries than a simple
|
||||
request for a A RR so I think it makes sense to cache root and TLD
|
||||
data. Once we have gone that far it isn't much of a reach to cache
|
||||
at each layer in the hierarchy (depth will not increase the coding
|
||||
effort or defect rates).
|
||||
|
||||
Bear in mind that this resolver will only answer local processes,
|
||||
it is not listening for queries over the network.
|
||||
|
||||
Stub Resolver Cache
|
||||
===================
|
||||
One well supported poition is that a stub resolver should not cache
|
||||
DNS replies as it relies on a proximate recursive resolver for
|
||||
iterative resolution and caching. DNSSEC validation introduces
|
||||
a potential use case for caching even when we would prefer to not
|
||||
cache DNS replies in the stub resolver. I'd like to avoid a
|
||||
religious debate about whether a stub resolver should have a cache
|
||||
and focus on what we need to make the getdns API best suited to
|
||||
its intended focus.
|
||||
|
||||
Since a cache makes sense for a recursive resolver we will need
|
||||
to implement it anyway. With that in mind I recommend that we
|
||||
use a configuration setting to enable caching and control its
|
||||
behavior when running as a stub resolver.
|
||||
|
||||
Cache Design Points
|
||||
===================
|
||||
If we assume that we need a cache implementation (which I concede is
|
||||
not yet decided) then I would recommend the following design points:
|
||||
|
||||
Local configuration via API or local file (e.g. /etc/getdns.conf, ~/.getdnsrc)
|
||||
- turn cache on/off
|
||||
- turn negative cache on/off
|
||||
- use a per user cache vs. system wide cache
|
||||
- max TTL/TTL override (separate for pos/neg cache entries)
|
||||
- inclusions (use cache for specified domains) (maybe over-eng)
|
||||
- exceptions (avoid ache for specified domains) (maybe over-eng)
|
||||
- persistant vs. transitory cache
|
||||
|
||||
- cache data store via Berkely db to allow for persistance
|
||||
|
||||
- negative cache TTL derived from SOA
|
||||
|
||||
- positive cache TTL
|
||||
|
||||
- max entries - flush oldest entries when max reached
|
||||
|
|
@ -1 +0,0 @@
|
|||
# dummy
|
|
@ -1,161 +0,0 @@
|
|||
example_simple_answers.o: example_simple_answers.c /usr/include/stdio.h \
|
||||
/usr/include/features.h /usr/include/i386-linux-gnu/bits/predefs.h \
|
||||
/usr/include/i386-linux-gnu/sys/cdefs.h \
|
||||
/usr/include/i386-linux-gnu/bits/wordsize.h \
|
||||
/usr/include/i386-linux-gnu/gnu/stubs.h \
|
||||
/usr/include/i386-linux-gnu/gnu/stubs-32.h \
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stddef.h \
|
||||
/usr/include/i386-linux-gnu/bits/types.h \
|
||||
/usr/include/i386-linux-gnu/bits/typesizes.h /usr/include/libio.h \
|
||||
/usr/include/_G_config.h /usr/include/wchar.h \
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stdarg.h \
|
||||
/usr/include/i386-linux-gnu/bits/stdio_lim.h \
|
||||
/usr/include/i386-linux-gnu/bits/sys_errlist.h \
|
||||
/usr/include/i386-linux-gnu/bits/stdio.h \
|
||||
/usr/include/i386-linux-gnu/bits/stdio2.h \
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stdint.h /usr/include/stdint.h \
|
||||
/usr/include/i386-linux-gnu/bits/wchar.h /usr/include/stdlib.h \
|
||||
/usr/include/i386-linux-gnu/bits/stdlib.h /usr/include/string.h \
|
||||
/usr/include/i386-linux-gnu/bits/string.h \
|
||||
/usr/include/i386-linux-gnu/bits/string2.h /usr/include/endian.h \
|
||||
/usr/include/i386-linux-gnu/bits/endian.h \
|
||||
/usr/include/i386-linux-gnu/bits/string3.h /usr/include/inttypes.h \
|
||||
getdns_libevent.h /usr/include/event2/event.h \
|
||||
/usr/include/event2/event-config.h \
|
||||
/usr/include/i386-linux-gnu/sys/types.h /usr/include/time.h \
|
||||
/usr/include/i386-linux-gnu/sys/time.h \
|
||||
/usr/include/i386-linux-gnu/bits/time.h \
|
||||
/usr/include/i386-linux-gnu/sys/select.h \
|
||||
/usr/include/i386-linux-gnu/bits/select.h \
|
||||
/usr/include/i386-linux-gnu/bits/sigset.h /usr/include/event2/util.h \
|
||||
/usr/include/netdb.h /usr/include/netinet/in.h \
|
||||
/usr/include/i386-linux-gnu/sys/socket.h \
|
||||
/usr/include/i386-linux-gnu/sys/uio.h \
|
||||
/usr/include/i386-linux-gnu/bits/uio.h \
|
||||
/usr/include/i386-linux-gnu/bits/socket.h \
|
||||
/usr/include/i386-linux-gnu/bits/sockaddr.h \
|
||||
/usr/include/i386-linux-gnu/asm/socket.h \
|
||||
/usr/include/asm-generic/socket.h \
|
||||
/usr/include/i386-linux-gnu/asm/sockios.h \
|
||||
/usr/include/asm-generic/sockios.h \
|
||||
/usr/include/i386-linux-gnu/bits/socket2.h \
|
||||
/usr/include/i386-linux-gnu/bits/in.h \
|
||||
/usr/include/i386-linux-gnu/bits/byteswap.h \
|
||||
/usr/include/i386-linux-gnu/bits/netdb.h getdns_core_only.h \
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stdbool.h
|
||||
|
||||
/usr/include/stdio.h:
|
||||
|
||||
/usr/include/features.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/predefs.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/sys/cdefs.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/wordsize.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/gnu/stubs.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/gnu/stubs-32.h:
|
||||
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stddef.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/types.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/typesizes.h:
|
||||
|
||||
/usr/include/libio.h:
|
||||
|
||||
/usr/include/_G_config.h:
|
||||
|
||||
/usr/include/wchar.h:
|
||||
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stdarg.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/stdio_lim.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/sys_errlist.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/stdio.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/stdio2.h:
|
||||
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stdint.h:
|
||||
|
||||
/usr/include/stdint.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/wchar.h:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/stdlib.h:
|
||||
|
||||
/usr/include/string.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/string.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/string2.h:
|
||||
|
||||
/usr/include/endian.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/endian.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/string3.h:
|
||||
|
||||
/usr/include/inttypes.h:
|
||||
|
||||
getdns_libevent.h:
|
||||
|
||||
/usr/include/event2/event.h:
|
||||
|
||||
/usr/include/event2/event-config.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/sys/types.h:
|
||||
|
||||
/usr/include/time.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/sys/time.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/time.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/sys/select.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/select.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/sigset.h:
|
||||
|
||||
/usr/include/event2/util.h:
|
||||
|
||||
/usr/include/netdb.h:
|
||||
|
||||
/usr/include/netinet/in.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/sys/socket.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/sys/uio.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/uio.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/socket.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/sockaddr.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/asm/socket.h:
|
||||
|
||||
/usr/include/asm-generic/socket.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/asm/sockios.h:
|
||||
|
||||
/usr/include/asm-generic/sockios.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/socket2.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/in.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/byteswap.h:
|
||||
|
||||
/usr/include/i386-linux-gnu/bits/netdb.h:
|
||||
|
||||
getdns_core_only.h:
|
||||
|
||||
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/stdbool.h:
|
|
@ -1 +0,0 @@
|
|||
# dummy
|
|
@ -1 +0,0 @@
|
|||
# dummy
|
|
@ -15,8 +15,24 @@ bindir = @bindir@
|
|||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
all clean getdns:
|
||||
default:
|
||||
cd common && $(MAKE)
|
||||
|
||||
all : default test
|
||||
|
||||
test:
|
||||
cd test && $(MAKE) $@
|
||||
|
||||
clean:
|
||||
cd common && $(MAKE) $@
|
||||
cd test && $(MAKE) $@
|
||||
rm -f *.o
|
||||
|
||||
distclean:
|
||||
cd common && $(MAKE) $@
|
||||
cd test && $(MAKE) $@
|
||||
rm -f libgetdns*.so config.log config.status Makefile
|
||||
rm -fR autom4te.cache
|
||||
|
||||
$(distdir): FORCE
|
||||
mkdir -p $(distdir)/src
|
||||
|
@ -47,4 +63,4 @@ Makefile: Makefile.in config.status
|
|||
configure.status: configure
|
||||
./config.status --recheck
|
||||
|
||||
.PHONY: all clean
|
||||
.PHONY: all distclean clean default
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
#
|
||||
# common/Makefile. Generated from Makefile.in by configure.
|
||||
#
|
||||
|
||||
package = getdns
|
||||
version = 0.320
|
||||
tarname = getdns
|
||||
distdir = $(tarname)-$(version)
|
||||
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
bindir = ${exec_prefix}/bin
|
||||
|
||||
srcdir = .
|
||||
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -g -fPIC -I$(srcdir)/ -std=c99
|
||||
LDFLAGS=-L.
|
||||
LDLIBS=-levent_core -lldns -lgetdns
|
||||
PROGRAMS=example-simple-answers example-tree example-all-functions example-synchronous
|
||||
|
||||
.SUFFIXES: .c .o .a .lo .h
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
all: libgetdns example-simple-answers example-tree example-all-functions example-synchronous
|
||||
|
||||
libgetdns: getdns_sync.o getdns_context.o getdns_list.o getdns_dict.o getdns_address.o getdns_convert.o getdns_general.o getdns_hostname.o getdns_service.o getdns_validate_dnssec.o
|
||||
$(CC) $(CFLAGS) -shared -o libgetdns.so $^
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAMS) libgetdns.so
|
||||
|
||||
$(distdir): FORCE
|
||||
mkdir -p $(distdir)/src
|
||||
cp configure.ac $(distdir)
|
||||
cp configure $(distdir)
|
||||
cp Makefile.in $(distdir)
|
||||
cp src/Makefile.in $(distdir)/src
|
||||
|
||||
distcheck: $(distdir).tar.gz
|
||||
gzip -cd $(distdir).tar.gz | tar xvf -
|
||||
cd $(distdir) && ./configure
|
||||
cd $(distdir) && $(MAKE) all
|
||||
cd $(distdir) && $(MAKE) check
|
||||
cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst install
|
||||
cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst uninstall
|
||||
@remaining="`find $${PWD}/$(distdir)/_inst -type f | wc -l`"; \
|
||||
if test "$${remaining}" -ne 0; then
|
||||
echo "@@@ $${remaining} file(s) remaining in stage directory!"; \
|
||||
exit 1; \
|
||||
fi
|
||||
cd $(distdir) && $(MAKE) clean
|
||||
rm -rf $(distdir)
|
||||
@echo "*** Package $(distdir).tar.gz is ready for distribution"
|
||||
|
||||
Makefile: Makefile.in ../config.status
|
||||
cd .. && ./config.status $@
|
||||
|
||||
configure.status: configure
|
||||
cd .. && ./config.status --recheck
|
||||
|
||||
.PHONY: clean
|
||||
|
|
@ -15,8 +15,8 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -g -fPIC -I$(srcdir)/ -std=c99
|
||||
LDFLAGS=-L.
|
||||
CFLAGS=-Wall -g -fPIC -I$(srcdir)/ -I /usr/local/include -std=c99
|
||||
LDFLAGS=-L. -L/usr/local/lib
|
||||
LDLIBS=-levent_core -lldns -lgetdns
|
||||
PROGRAMS=example-simple-answers example-tree example-all-functions example-synchronous
|
||||
|
||||
|
@ -28,11 +28,15 @@ PROGRAMS=example-simple-answers example-tree example-all-functions example-synch
|
|||
all: libgetdns example-simple-answers example-tree example-all-functions example-synchronous
|
||||
|
||||
libgetdns: getdns_sync.o getdns_context.o getdns_list.o getdns_dict.o getdns_address.o getdns_convert.o getdns_general.o getdns_hostname.o getdns_service.o getdns_validate_dnssec.o
|
||||
$(CC) $(CFLAGS) -shared -o libgetdns.so $^
|
||||
$(CC) $(CFLAGS) -shared -o libgetdns.so $?
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAMS) libgetdns.so
|
||||
|
||||
distclean : clean
|
||||
rm -f Makefile config.status config.log
|
||||
rm -Rf autom4te.cache
|
||||
|
||||
$(distdir): FORCE
|
||||
mkdir -p $(distdir)/src
|
||||
cp configure.ac $(distdir)
|
||||
|
|
|
@ -1,951 +0,0 @@
|
|||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 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_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
|
||||
[m4_warning([this file was generated for autoconf 2.68.
|
||||
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'.])])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 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.11'
|
||||
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.11.1], [],
|
||||
[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.11.1])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, 2003, 2005 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],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
|
||||
# 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.
|
||||
|
||||
# serial 9
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$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, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
|
||||
# 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.
|
||||
|
||||
# serial 10
|
||||
|
||||
# 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", "GCJ", or "OBJC".
|
||||
# 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
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" 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'.
|
||||
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 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this. Also, some Intel
|
||||
# versions had trouble with output in subdirs
|
||||
am__obj=sub/conftest.${OBJEXT-o}
|
||||
am__minus_obj="-o $am__obj"
|
||||
case $depmode in
|
||||
gcc)
|
||||
# This depmode causes a compiler race in universal mode.
|
||||
test "$am__universal" = false || continue
|
||||
;;
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
msvisualcpp | msvcmsys)
|
||||
# This compiler won't grok `-c -o', but also, the minuso test has
|
||||
# not run yet. These depmodes are late enough in the game, and
|
||||
# so weak that their functioning should not be impacted.
|
||||
am__obj=conftest.${OBJEXT-o}
|
||||
am__minus_obj=
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=$am__obj \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$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,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
|
||||
# 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.
|
||||
|
||||
#serial 5
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[{
|
||||
# Autoconf 2.62 quotes --file arguments for eval, but not when files
|
||||
# are listed without --file. Let's play safe and only enable the eval
|
||||
# if we detect the quoting.
|
||||
case $CONFIG_FILES in
|
||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
||||
*) set x $CONFIG_FILES ;;
|
||||
esac
|
||||
shift
|
||||
for mf
|
||||
do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
}
|
||||
])# _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. FIXME. This creates each `.P' file that we will
|
||||
# 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" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2008, 2009 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.
|
||||
|
||||
# serial 16
|
||||
|
||||
# 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.
|
||||
|
||||
# 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.62])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],
|
||||
[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_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
|
||||
[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([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. 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)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
|
||||
[_AM_DEPENDENCIES(OBJC)],
|
||||
[define([AC_PROG_OBJC],
|
||||
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
|
||||
])
|
||||
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
|
||||
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
|
||||
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
|
||||
dnl 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
|
||||
])
|
||||
|
||||
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, 2003, 2005, 2008 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}" != 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, 2005 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.
|
||||
|
||||
# serial 2
|
||||
|
||||
# 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, 2002, 2003, 2005, 2009 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.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo this is the am__doit target
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# Ignore all kinds of additional output from `make'.
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
;;
|
||||
esac
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
|
||||
# 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.
|
||||
|
||||
# serial 6
|
||||
|
||||
# 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 supports --run.
|
||||
# If it does, 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
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
||||
*)
|
||||
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
||||
esac
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006 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_MKDIR_P
|
||||
# ---------------
|
||||
# Check for `mkdir -p'.
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[AC_PREREQ([2.60])dnl
|
||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
|
||||
dnl while keeping a definition of mkdir_p for backward compatibility.
|
||||
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
|
||||
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
|
||||
dnl Makefile.ins that do not define MKDIR_P, so we do our own
|
||||
dnl adjustment using top_builddir (which is defined more often than
|
||||
dnl MKDIR_P).
|
||||
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
|
||||
case $mkdir_p in
|
||||
[[\\/$]]* | ?:[[\\/]]*) ;;
|
||||
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2008 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.
|
||||
|
||||
# serial 4
|
||||
|
||||
# _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])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
|
||||
# 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.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
# name. Accept space and tab only in the latter.
|
||||
am_lf='
|
||||
'
|
||||
case `pwd` in
|
||||
*[[\\\"\#\$\&\'\`$am_lf]]*)
|
||||
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 (
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
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)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 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, 2008 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.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _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, 2005 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.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _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.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
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 <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/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
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
## ---------------------- ##
|
||||
## Running config.status. ##
|
||||
## ---------------------- ##
|
||||
|
||||
This file was extended by getdns config.status 0.320, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
CONFIG_FILES =
|
||||
CONFIG_HEADERS =
|
||||
CONFIG_LINKS =
|
||||
CONFIG_COMMANDS =
|
||||
$ ../config.status Makefile
|
||||
|
||||
on ubuntu-11-10
|
||||
|
||||
config.status:737: creating Makefile
|
|
@ -1,32 +0,0 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
# @configure_input@
|
||||
#
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([getdns], [0.320], [melinda.shore@nomountain.net])
|
||||
AM_INIT_AUTOMAKE([getkey], [0.320])
|
||||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([event_core], [event_base_new])
|
||||
AC_CHECK_LIB([getdns], [getdns_context_create])
|
||||
AC_CHECK_LIB([ldns], [ldns_dname_new_frm_str])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_STDBOOL
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT64_T
|
||||
AC_TYPE_UINT8_T
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
|
@ -1,630 +0,0 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -63,4 +63,16 @@ getdns_display_ip_address(
|
|||
)
|
||||
{ UNUSED_PARAM(bindata_of_ipv4_or_ipv6_address); return NULL; }
|
||||
|
||||
getdns_return_t
|
||||
getdns_strerror(getdns_return_t err, char *buf, size_t buflen)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_GOOD;
|
||||
|
||||
/* TODO: make this produce an actual string */
|
||||
|
||||
snprintf(buf, buflen, "%d", retval);
|
||||
|
||||
return retval;
|
||||
} /* getdns_strerror */
|
||||
|
||||
/* getdns_core_only.c */
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED 309
|
||||
#define GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED_TEXT A query was made with a context that is using stub resolution and a DNSSEC extension specified.
|
||||
|
||||
|
||||
/** @}
|
||||
*/
|
||||
|
||||
|
@ -238,136 +239,336 @@
|
|||
* \defgroup rrtypes RR Types
|
||||
* @{
|
||||
*/
|
||||
#define GETDNS_RRTYPE_A 1
|
||||
#define GETDNS_RRTYPE_NS 2
|
||||
#define GETDNS_RRTYPE_MD 3
|
||||
#define GETDNS_RRTYPE_MF 4
|
||||
#define GETDNS_RRTYPE_CNAME 5
|
||||
#define GETDNS_RRTYPE_SOA 6
|
||||
#define GETDNS_RRTYPE_MB 7
|
||||
#define GETDNS_RRTYPE_MG 8
|
||||
#define GETDNS_RRTYPE_MR 9
|
||||
#define GETDNS_RRTYPE_NULL 10
|
||||
#define GETDNS_RRTYPE_WKS 11
|
||||
#define GETDNS_RRTYPE_PTR 12
|
||||
#define GETDNS_RRTYPE_HINFO 13
|
||||
#define GETDNS_RRTYPE_MINFO 14
|
||||
#define GETDNS_RRTYPE_MX 15
|
||||
#define GETDNS_RRTYPE_TXT 16
|
||||
#define GETDNS_RRTYPE_RP 17
|
||||
#define GETDNS_RRTYPE_AFSDB 18
|
||||
#define GETDNS_RRTYPE_X25 19
|
||||
#define GETDNS_RRTYPE_ISDN 20
|
||||
#define GETDNS_RRTYPE_RT 21
|
||||
#define GETDNS_RRTYPE_NSAP 22
|
||||
#define GETDNS_RRTYPE_SIG 24
|
||||
#define GETDNS_RRTYPE_KEY 25
|
||||
#define GETDNS_RRTYPE_PX 26
|
||||
#define GETDNS_RRTYPE_GPOS 27
|
||||
#define GETDNS_RRTYPE_AAAA 28
|
||||
#define GETDNS_RRTYPE_LOC 29
|
||||
#define GETDNS_RRTYPE_NXT 30
|
||||
#define GETDNS_RRTYPE_EID 31
|
||||
#define GETDNS_RRTYPE_NIMLOC 32
|
||||
#define GETDNS_RRTYPE_SRV 33
|
||||
#define GETDNS_RRTYPE_ATMA 34
|
||||
#define GETDNS_RRTYPE_NAPTR 35
|
||||
#define GETDNS_RRTYPE_KX 36
|
||||
#define GETDNS_RRTYPE_CERT 37
|
||||
#define GETDNS_RRTYPE_A6 38
|
||||
#define GETDNS_RRTYPE_DNAME 39
|
||||
#define GETDNS_RRTYPE_SINK 40
|
||||
#define GETDNS_RRTYPE_OPT 41
|
||||
#define GETDNS_RRTYPE_APL 42
|
||||
#define GETDNS_RRTYPE_DS 43
|
||||
#define GETDNS_RRTYPE_SSHFP 44
|
||||
#define GETDNS_RRTYPE_IPSECKEY 45
|
||||
#define GETDNS_RRTYPE_RRSIG 46
|
||||
#define GETDNS_RRTYPE_NSEC 47
|
||||
#define GETDNS_RRTYPE_DNSKEY 48
|
||||
#define GETDNS_RRTYPE_DHCID 49
|
||||
#define GETDNS_RRTYPE_NSEC3 50
|
||||
#define GETDNS_RRTYPE_A 1
|
||||
#define GETDNS_RRTYPE_NS 2
|
||||
#define GETDNS_RRTYPE_MD 3
|
||||
#define GETDNS_RRTYPE_MF 4
|
||||
#define GETDNS_RRTYPE_CNAME 5
|
||||
#define GETDNS_RRTYPE_SOA 6
|
||||
#define GETDNS_RRTYPE_MB 7
|
||||
#define GETDNS_RRTYPE_MG 8
|
||||
#define GETDNS_RRTYPE_MR 9
|
||||
#define GETDNS_RRTYPE_NULL 10
|
||||
#define GETDNS_RRTYPE_WKS 11
|
||||
#define GETDNS_RRTYPE_PTR 12
|
||||
#define GETDNS_RRTYPE_HINFO 13
|
||||
#define GETDNS_RRTYPE_MINFO 14
|
||||
#define GETDNS_RRTYPE_MX 15
|
||||
#define GETDNS_RRTYPE_TXT 16
|
||||
#define GETDNS_RRTYPE_RP 17
|
||||
#define GETDNS_RRTYPE_AFSDB 18
|
||||
#define GETDNS_RRTYPE_X25 19
|
||||
#define GETDNS_RRTYPE_ISDN 20
|
||||
#define GETDNS_RRTYPE_RT 21
|
||||
#define GETDNS_RRTYPE_NSAP 22
|
||||
#define GETDNS_RRTYPE_SIG 24
|
||||
#define GETDNS_RRTYPE_KEY 25
|
||||
#define GETDNS_RRTYPE_PX 26
|
||||
#define GETDNS_RRTYPE_GPOS 27
|
||||
#define GETDNS_RRTYPE_AAAA 28
|
||||
#define GETDNS_RRTYPE_LOC 29
|
||||
#define GETDNS_RRTYPE_NXT 30
|
||||
#define GETDNS_RRTYPE_EID 31
|
||||
#define GETDNS_RRTYPE_NIMLOC 32
|
||||
#define GETDNS_RRTYPE_SRV 33
|
||||
#define GETDNS_RRTYPE_ATMA 34
|
||||
#define GETDNS_RRTYPE_NAPTR 35
|
||||
#define GETDNS_RRTYPE_KX 36
|
||||
#define GETDNS_RRTYPE_CERT 37
|
||||
#define GETDNS_RRTYPE_A6 38
|
||||
#define GETDNS_RRTYPE_DNAME 39
|
||||
#define GETDNS_RRTYPE_SINK 40
|
||||
#define GETDNS_RRTYPE_OPT 41
|
||||
#define GETDNS_RRTYPE_APL 42
|
||||
#define GETDNS_RRTYPE_DS 43
|
||||
#define GETDNS_RRTYPE_SSHFP 44
|
||||
#define GETDNS_RRTYPE_IPSECKEY 45
|
||||
#define GETDNS_RRTYPE_RRSIG 46
|
||||
#define GETDNS_RRTYPE_NSEC 47
|
||||
#define GETDNS_RRTYPE_DNSKEY 48
|
||||
#define GETDNS_RRTYPE_DHCID 49
|
||||
#define GETDNS_RRTYPE_NSEC3 50
|
||||
#define GETDNS_RRTYPE_NSEC3PARAM 51
|
||||
#define GETDNS_RRTYPE_TLSA 52
|
||||
#define GETDNS_RRTYPE_HIP 55
|
||||
#define GETDNS_RRTYPE_NINFO 56
|
||||
#define GETDNS_RRTYPE_RKEY 57
|
||||
#define GETDNS_RRTYPE_TALINK 58
|
||||
#define GETDNS_RRTYPE_CDS 59
|
||||
#define GETDNS_RRTYPE_SPF 99
|
||||
#define GETDNS_RRTYPE_UINFO 100
|
||||
#define GETDNS_RRTYPE_UID 101
|
||||
#define GETDNS_RRTYPE_GID 102
|
||||
#define GETDNS_RRTYPE_UNSPEC 103
|
||||
#define GETDNS_RRTYPE_NID 104
|
||||
#define GETDNS_RRTYPE_L32 105
|
||||
#define GETDNS_RRTYPE_L64 106
|
||||
#define GETDNS_RRTYPE_LP 107
|
||||
#define GETDNS_RRTYPE_TKEY 249
|
||||
#define GETDNS_RRTYPE_TSIG 250
|
||||
#define GETDNS_RRTYPE_IXFR 251
|
||||
#define GETDNS_RRTYPE_AXFR 252
|
||||
#define GETDNS_RRTYPE_MAILB 253
|
||||
#define GETDNS_RRTYPE_MAILA 254
|
||||
#define GETDNS_RRTYPE_URI 256
|
||||
#define GETDNS_RRTYPE_CAA 257
|
||||
#define GETDNS_RRTYPE_TA 32768
|
||||
#define GETDNS_RRTYPE_DLV 32769
|
||||
#define GETDNS_RRTYPE_TLSA 52
|
||||
#define GETDNS_RRTYPE_HIP 55
|
||||
#define GETDNS_RRTYPE_NINFO 56
|
||||
#define GETDNS_RRTYPE_RKEY 57
|
||||
#define GETDNS_RRTYPE_TALINK 58
|
||||
#define GETDNS_RRTYPE_CDS 59
|
||||
#define GETDNS_RRTYPE_SPF 99
|
||||
#define GETDNS_RRTYPE_UINFO 100
|
||||
#define GETDNS_RRTYPE_UID 101
|
||||
#define GETDNS_RRTYPE_GID 102
|
||||
#define GETDNS_RRTYPE_UNSPEC 103
|
||||
#define GETDNS_RRTYPE_NID 104
|
||||
#define GETDNS_RRTYPE_L32 105
|
||||
#define GETDNS_RRTYPE_L64 106
|
||||
#define GETDNS_RRTYPE_LP 107
|
||||
#define GETDNS_RRTYPE_TKEY 249
|
||||
#define GETDNS_RRTYPE_TSIG 250
|
||||
#define GETDNS_RRTYPE_IXFR 251
|
||||
#define GETDNS_RRTYPE_AXFR 252
|
||||
#define GETDNS_RRTYPE_MAILB 253
|
||||
#define GETDNS_RRTYPE_MAILA 254
|
||||
#define GETDNS_RRTYPE_URI 256
|
||||
#define GETDNS_RRTYPE_CAA 257
|
||||
#define GETDNS_RRTYPE_TA 32768
|
||||
#define GETDNS_RRTYPE_DLV 32769
|
||||
/** @}
|
||||
*/
|
||||
|
||||
|
||||
/* Various typedefs */
|
||||
typedef struct getdns_context_t *getdns_context_t;
|
||||
typedef uint16_t getdns_return_t;
|
||||
typedef uint64_t getdns_transaction_t;
|
||||
typedef enum some_data_type {
|
||||
t_dict, t_list, t_int, t_bindata
|
||||
typedef enum getdns_data_type {
|
||||
t_dict, t_list, t_int, t_bindata, t_invalid
|
||||
} getdns_data_type;
|
||||
typedef struct getdns_bindata {
|
||||
size_t size;
|
||||
uint8_t *binary_stuff;
|
||||
} some_bindata;
|
||||
typedef struct getdns_dict some_dict;
|
||||
typedef struct getdns_list some_list;
|
||||
|
||||
/* Helper functions for data structures */
|
||||
uint8_t *data;
|
||||
} getdns_bindata;
|
||||
|
||||
/**
|
||||
* @param this_list list of any of the supported data types
|
||||
* @param answer pointer to previsouly allocated storage for size_t
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if name argument doesnt exist in the dictionary
|
||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the requested data type doesn't match the contents of the indexed argument or name
|
||||
* this structure represents a single item in a dictionary type
|
||||
*/
|
||||
struct getdns_dict_item {
|
||||
char *key;
|
||||
getdns_data_type dtype;
|
||||
union {
|
||||
struct getdns_list *list;
|
||||
struct getdns_dict *dict;
|
||||
int n;
|
||||
struct getdns_bindata *bindata;
|
||||
} data;
|
||||
};
|
||||
|
||||
/**
|
||||
* getdns dictionary data type
|
||||
* Use helper functions getdns_dict_* to manipulate and iterate dictionaries
|
||||
* dict is implemented using the t*() functions for manipulating binary search
|
||||
* trees in the std library. The internal implementation may change so the
|
||||
* application should stick to the helper functions.
|
||||
*/
|
||||
typedef struct getdns_dict {
|
||||
void *rootp;
|
||||
} getdns_dict;
|
||||
|
||||
/**
|
||||
* translate an error code to a string value, not in the original api description
|
||||
* but seems like a nice thing to have
|
||||
* @param err return code from GETDNS_RETURN_* defines
|
||||
* @param buf buffer to which to copy the error string
|
||||
* @param buflen length of buf
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
*/
|
||||
getdns_return_t getdns_strerror(getdns_return_t err, char *buf, size_t buflen);
|
||||
|
||||
#define GETDNS_LIST_BLOCKSZ 10
|
||||
|
||||
/**
|
||||
* getdns list data type
|
||||
* Use helper functions getdns_list_* to manipulate and iterate lists
|
||||
* lists are implemented as arrays internally since the helper functions
|
||||
* like to reference indexes in the list. Elements are allocated in blocks
|
||||
* and then marked valid as they are used and invalid as they are not used
|
||||
* The use cases do not justify working too hard at shrinking the structures.
|
||||
* Indexes are 0 based.
|
||||
*/
|
||||
typedef struct getdns_list {
|
||||
int numalloc;
|
||||
int numinuse;
|
||||
struct getdns_list_item *items;
|
||||
} getdns_list;
|
||||
|
||||
/**
|
||||
* this structure represents a single item in a list
|
||||
*/
|
||||
struct getdns_list_item {
|
||||
int inuse;
|
||||
getdns_data_type dtype;
|
||||
union {
|
||||
getdns_list *list;
|
||||
getdns_dict *dict;
|
||||
int n;
|
||||
getdns_bindata *bindata;
|
||||
} data;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the length of the specified list (returned in *answer)
|
||||
* @param list list of any of the supported data types
|
||||
* @param answer number of valid items in the list
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if list is not valid or params are NULL
|
||||
*/
|
||||
getdns_return_t getdns_list_get_length(struct getdns_list *list, size_t *answer);
|
||||
/**
|
||||
* get the enumerated data type of the indexed list item
|
||||
* @param list the list from which to fetch the data type
|
||||
* @param index the item in the list from which to fetch the data type
|
||||
* @param *answer assigned the value of the data type on success
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||
*/
|
||||
getdns_return_t getdns_list_get_length(struct getdns_list *this_list, size_t *answer);
|
||||
getdns_return_t getdns_list_get_data_type(struct getdns_list *this_list, size_t index, getdns_data_type *answer);
|
||||
getdns_return_t getdns_list_get_dict(struct getdns_list *this_list, size_t index, struct getdns_dict **answer);
|
||||
/**
|
||||
* retrieve the list value of the specified list item, the caller must not free
|
||||
* storage associated with the return value. When the list is destroyed any
|
||||
* list data is also free()'d - keep this in mind when using this function.
|
||||
* @param list the list from which to fetch the value
|
||||
* @param index the item in the list from which to fetch the value
|
||||
* @param **answer assigned a pointer to the list value of the indexed element
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
||||
*/
|
||||
getdns_return_t getdns_list_get_list(struct getdns_list *this_list, size_t index, struct getdns_list **answer);
|
||||
/**
|
||||
* retrieve the binary data value of the specified list item, the caller must not
|
||||
* free storage associated with the return value. When the list is destroyed any
|
||||
* bindata data is also free()'d - keep this in mind when using this function.
|
||||
* @param list the list from which to fetch the value
|
||||
* @param index the item in the list from which to fetch the value
|
||||
* @param **answer assigned a pointer to the list value of the indexed element
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
||||
*/
|
||||
getdns_return_t getdns_list_get_bindata(struct getdns_list *this_list, size_t index, struct getdns_bindata **answer);
|
||||
getdns_return_t getdns_list_get_int(struct getdns_list *this_list, size_t index, uint32_t *answer);
|
||||
/**
|
||||
* retrieve the integer value of the specified list item
|
||||
* @param list the list from which to fetch the item
|
||||
* @param index the index of the element in the list to fetch from
|
||||
* @param *answer assigned the integer value of the indexed element
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
||||
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
||||
*/
|
||||
getdns_return_t getdns_list_get_int(struct getdns_list *list, size_t index, uint32_t *answer);
|
||||
|
||||
/* Dicts: get the list of names, get the data_type of the
|
||||
value at a given name, and get the data at a given name */
|
||||
getdns_return_t getdns_dict_get_names(struct getdns_dict *this_dict, struct getdns_list **answer);
|
||||
/**
|
||||
* fetch a list of names from the dictionary, this list must be freed by the caller
|
||||
* via a call to getdns_list_destroy
|
||||
* @param dict dictionary from which to produce the list of names
|
||||
* @param **answer a pointer to the new list will be assigned to *answer
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid
|
||||
*/
|
||||
getdns_return_t getdns_dict_get_names(struct getdns_dict *dict, struct getdns_list **answer);
|
||||
/**
|
||||
* fetch the data type for the data associated with the specified name
|
||||
* @param dict dictionary from which to fetch the data type
|
||||
* @param name a name/key value to look up in the dictionary
|
||||
* @param *answer data type will be stored at this address
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||
*/
|
||||
getdns_return_t getdns_dict_get_data_type(struct getdns_dict *this_dict, char *name, getdns_data_type *answer);
|
||||
/**
|
||||
* fetch the dictionary associated with the specified name, the dictionary should
|
||||
* be free()'d by the caller via getdns_dict_destroy()
|
||||
* @param dict dictionary from which to fetch the dictionary
|
||||
* @param name a name/key value to look up in the dictionary
|
||||
* @param **answer a copy of the dictionary will be stored at this address
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||
*/
|
||||
getdns_return_t getdns_dict_get_dict(struct getdns_dict *this_dict, char *name, struct getdns_dict **answer);
|
||||
/**
|
||||
* fetch the list associated with the specified name, the list should be free()'d
|
||||
* by the caller via getdns_list_destroy()
|
||||
* @param dict dictionary from which to fetch the list
|
||||
* @param name a name/key value to look up in the dictionary
|
||||
* @param **answer a copy of the list will be stored at this address
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||
*/
|
||||
getdns_return_t getdns_dict_get_list(struct getdns_dict *this_dict, char *name, struct getdns_list **answer);
|
||||
/**
|
||||
* fetch the bindata associated with the specified name, the bindata should be
|
||||
* free()'d by the caller
|
||||
* @param dict dictionary from which to fetch the bindata
|
||||
* @param name a name/key value to look up in the dictionary
|
||||
* @param **answer a copy of the bindata will be stored at this address
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||
*/
|
||||
getdns_return_t getdns_dict_get_bindata(struct getdns_dict *this_dict, char *name, struct getdns_bindata **answer);
|
||||
/**
|
||||
* fetch the integer value associated with the specified name
|
||||
* @param dict dictionary from which to fetch the integer
|
||||
* @param name a name/key value to look up in the dictionary
|
||||
* @param *answer the integer will be stored at this address
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
||||
*/
|
||||
getdns_return_t getdns_dict_get_int(struct getdns_dict *this_dict, char *name, uint32_t *answer);
|
||||
|
||||
|
||||
/* Lists: create, destroy, and set the data at a given position */
|
||||
/**
|
||||
* create a new list with no items
|
||||
* @return pointer to an allocated list, NULL if insufficient memory
|
||||
*/
|
||||
struct getdns_list * getdns_list_create();
|
||||
/**
|
||||
* free memory allocated to the list (also frees all children of the list)
|
||||
* note that lists and bindata retrieved from the list via the getdns_list_get_*
|
||||
* helper functions will be destroyed as well - if you fetched them previously
|
||||
* you MUST copy those instances BEFORE you destroy the list else
|
||||
* unpleasant things will happen at run-time
|
||||
*/
|
||||
void getdns_list_destroy(struct getdns_list *this_list);
|
||||
getdns_return_t getdns_list_set_dict(struct getdns_list *this_list, size_t index, struct getdns_dict *child_dict);
|
||||
getdns_return_t getdns_list_set_list(struct getdns_list *this_list, size_t index, struct getdns_list *child_list);
|
||||
getdns_return_t getdns_list_set_bindata(struct getdns_list *this_list, size_t index, struct getdns_bindata *child_bindata);
|
||||
getdns_return_t getdns_list_set_int(struct getdns_list *this_list, size_t index, uint32_t child_uint32);
|
||||
/**
|
||||
* add an item to the tail of a list - note that this was not in the getdns API
|
||||
* description but the list_set functions seem to be designed to modify an existing
|
||||
* item in the list. The newly added item has no data type.
|
||||
* @param *index assigned to the index of the newly added item on success
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_GENERAL_ERROR if out of memory
|
||||
*/
|
||||
getdns_return_t getdns_list_add_item(struct getdns_list *list, size_t *index);
|
||||
getdns_return_t getdns_list_set_dict(struct getdns_list *list, size_t index, struct getdns_dict *child_dict);
|
||||
/**
|
||||
* assign the child_list to an item in a parent list, the parent list copies
|
||||
* the child list and will free the copy when the list is destroyed
|
||||
* @param list list contiaining the item to which child_list is to be assigned
|
||||
* @param index index of the item within list to which child_list is to be assigned
|
||||
* @param *child_list list to assign to the item
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if index is out of range, or list is NULL
|
||||
*/
|
||||
getdns_return_t getdns_list_set_list(struct getdns_list *list, size_t index, struct getdns_list *child_list);
|
||||
/**
|
||||
* assign the child_bindata to an item in a parent list, the parent list copies
|
||||
* the child data and will free the copy when the list is destroyed
|
||||
* @param list list contiaining the item to which child_list is to be assigned
|
||||
* @param index index of the item within list to which child_list is to be assigned
|
||||
* @param *child_bindata data to assign to the item
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if index is out of range, or list is NULL
|
||||
*/
|
||||
getdns_return_t getdns_list_set_bindata(struct getdns_list *list, size_t index, struct getdns_bindata *child_bindata);
|
||||
/**
|
||||
* set the integrer value of the indexed item (zero based index)
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if index is out of range, or list is NULL
|
||||
*/
|
||||
getdns_return_t getdns_list_set_int(struct getdns_list *list, size_t index, uint32_t child_uint32);
|
||||
|
||||
/* Dicts: create, destroy, and set the data at a given name */
|
||||
struct getdns_dict * getdns_dict_create();
|
||||
/**
|
||||
* create a new dictionary with no items
|
||||
* @return pointer to an allocated dictionary, NULL if insufficient memory
|
||||
*/
|
||||
struct getdns_dict *getdns_dict_create();
|
||||
|
||||
/**
|
||||
* destroy a dictionary and all items within that dictionary
|
||||
* be aware that if you have fetched any data from the dictionary it will
|
||||
* no longer be available (you are likely to experience bad things if you try)
|
||||
* @return pointer to an allocated dictionary, NULL if insufficient memory
|
||||
*/
|
||||
void getdns_dict_destroy(struct getdns_dict *this_dict);
|
||||
|
||||
getdns_return_t getdns_dict_set_dict(struct getdns_dict *this_dict, char *name, struct getdns_dict *child_dict);
|
||||
getdns_return_t getdns_dict_set_list(struct getdns_dict *this_dict, char *name, struct getdns_list *child_list);
|
||||
getdns_return_t getdns_dict_set_bindata(struct getdns_dict *this_dict, char *name, struct getdns_bindata *child_bindata);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/**
|
||||
*
|
||||
* /brief getdns list management functions
|
||||
* getdns list management functions, note that the internal storage is
|
||||
* accomplished via the libc binary search tree implementation so your
|
||||
* pointer foo needs to be keen to digest some of the internal semantics
|
||||
*
|
||||
* This is the meat of the API
|
||||
* Originally taken from the getdns API description pseudo implementation.
|
||||
* Interfaces originally taken from the getdns API description pseudo implementation.
|
||||
*
|
||||
*/
|
||||
/* The MIT License (MIT)
|
||||
|
@ -28,37 +29,333 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <search.h>
|
||||
#include <string.h>
|
||||
#include <getdns_libevent.h>
|
||||
|
||||
/* stuff to make it compile pedantically */
|
||||
#define UNUSED_PARAM(x) ((void)(x))
|
||||
|
||||
/*---------------------------------------- getdns_dict_cmp */
|
||||
/**
|
||||
* private function used by the t*() functions for managing binary trees
|
||||
* behaves similar to strcmp()
|
||||
* @param itemp1 pointer to pointer to getdns_dict_item to compare
|
||||
* @param itemp2 pointer to pointer to getdns_dict_item to compare
|
||||
* @return results of lexicographic comparison between item1->key and item2->key
|
||||
*/
|
||||
int
|
||||
getdns_dict_cmp(const void *item1, const void *item2)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
if(item1 == NULL)
|
||||
{
|
||||
if(item2 == NULL)
|
||||
retval = 0;
|
||||
else
|
||||
retval = -1;
|
||||
}
|
||||
else if(item2 == NULL)
|
||||
retval = 1;
|
||||
else
|
||||
{
|
||||
retval = strcmp(((struct getdns_dict_item *) item1)->key
|
||||
, ((struct getdns_dict_item *) item2)->key);
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_dict_comp */
|
||||
|
||||
/*---------------------------------------- getdns_dict_find */
|
||||
/**
|
||||
* private function used to locate a key in a dictionary
|
||||
* @param dict dicitonary to search
|
||||
* @param key key to search for
|
||||
* @param addifnotfnd if TRUE then an item will be added if the key is not found
|
||||
* @return pointer to dictionary item, caller must not free storage associated with item
|
||||
* @return NULL if additnotfnd == FALSE and key is not in dictionary
|
||||
*/
|
||||
struct getdns_dict_item *
|
||||
getdns_dict_find(struct getdns_dict *dict, char *key, bool addifnotfnd)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item **item;
|
||||
struct getdns_dict_item *newitem;
|
||||
struct getdns_dict_item *ret = NULL;
|
||||
|
||||
if(dict != NULL && key != NULL)
|
||||
{
|
||||
/* we try to find it first, if we do then clear the existing data */
|
||||
keyitem.key = key;
|
||||
keyitem.dtype = t_invalid;
|
||||
keyitem.data.n = 0;
|
||||
item = tfind(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
if(addifnotfnd == true && (item == NULL || *item == NULL))
|
||||
{
|
||||
/* tsearch will add a node automatically for us */
|
||||
newitem = (struct getdns_dict_item *) malloc(sizeof(struct getdns_dict_item));
|
||||
newitem->key = strdup(key);
|
||||
newitem->dtype = t_invalid;
|
||||
newitem->data.n = 0;
|
||||
item = tsearch(newitem, &(dict->rootp), getdns_dict_cmp);
|
||||
}
|
||||
if(item != NULL)
|
||||
ret = *item;
|
||||
}
|
||||
|
||||
return *item;
|
||||
} /* getdns_dict_set_int */
|
||||
|
||||
getdns_return_t getdns_dict_get_names(struct getdns_dict *this_dict, struct getdns_list **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_get_data_type(struct getdns_dict *this_dict, char *name, getdns_data_type *answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
/*---------------------------------------- getdns_dict_get_data_type */
|
||||
getdns_return_t
|
||||
getdns_dict_get_data_type(struct getdns_dict *dict, char *name, getdns_data_type *answer)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item **item;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
getdns_return_t getdns_dict_get_dict(struct getdns_dict *this_dict, char *name, struct getdns_dict **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
if(dict != NULL && name != NULL && answer != NULL)
|
||||
{
|
||||
keyitem.key = name;
|
||||
item = tfind(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
if(item != NULL && *item != NULL)
|
||||
{
|
||||
*answer = (*item)->dtype;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
getdns_return_t getdns_dict_get_list(struct getdns_dict *this_dict, char *name, struct getdns_list **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
return retval;
|
||||
} /* getdns_dict_get_data_type */
|
||||
|
||||
getdns_return_t getdns_dict_get_bindata(struct getdns_dict *this_dict, char *name, struct getdns_bindata **answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
/*---------------------------------------- getdns_dict_get_dict */
|
||||
getdns_return_t
|
||||
getdns_dict_get_dict(struct getdns_dict *dict, char *name, struct getdns_dict **answer)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item **item;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
getdns_return_t getdns_dict_get_int(struct getdns_dict *this_dict, char *name, uint32_t *answer)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
if(dict != NULL && name != NULL && answer != NULL)
|
||||
{
|
||||
keyitem.key = name;
|
||||
item = tfind(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
if(item != NULL && *item != NULL)
|
||||
{
|
||||
if((*item)->dtype != t_dict)
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
else
|
||||
{
|
||||
*answer = (*item)->data.dict;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct getdns_dict * getdns_dict_create()
|
||||
{ return NULL; }
|
||||
return retval;
|
||||
} /* getdns_dict_get_dict */
|
||||
|
||||
void getdns_dict_destroy(struct getdns_dict *this_dict)
|
||||
{ UNUSED_PARAM(this_dict); }
|
||||
/*---------------------------------------- getdns_dict_get_list */
|
||||
getdns_return_t
|
||||
getdns_dict_get_list(struct getdns_dict *dict, char *name, struct getdns_list **answer)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item **item;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
getdns_return_t getdns_dict_set_dict(struct getdns_dict *this_dict, char *name, struct getdns_dict *child_dict)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_dict); return GETDNS_RETURN_GOOD; }
|
||||
if(dict != NULL && name != NULL && answer != NULL)
|
||||
{
|
||||
keyitem.key = name;
|
||||
item = tfind(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
if(item != NULL && *item != NULL)
|
||||
{
|
||||
if((*item)->dtype != t_list)
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
else
|
||||
{
|
||||
*answer = (*item)->data.list;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_dict_get_list */
|
||||
|
||||
/*---------------------------------------- getdns_dict_get_bindata */
|
||||
getdns_return_t
|
||||
getdns_dict_get_bindata(struct getdns_dict *dict, char *name, struct getdns_bindata **answer)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item **item;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
if(dict != NULL && name != NULL && answer != NULL)
|
||||
{
|
||||
keyitem.key = name;
|
||||
item = tfind(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
if(item != NULL && *item != NULL)
|
||||
{
|
||||
if((*item)->dtype != t_bindata)
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
else
|
||||
{
|
||||
*answer = (*item)->data.bindata;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_dict_get_bindata */
|
||||
|
||||
/*---------------------------------------- getdns_dict_get_int */
|
||||
getdns_return_t
|
||||
getdns_dict_get_int(struct getdns_dict *dict, char *name, uint32_t *answer)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item **item;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
if(dict != NULL && name != NULL && answer != NULL)
|
||||
{
|
||||
keyitem.key = name;
|
||||
item = tfind(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
if(item != NULL && *item != NULL)
|
||||
{
|
||||
if((*item)->dtype != t_int)
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
else
|
||||
{
|
||||
*answer = (*item)->data.n;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_dict_get_int */
|
||||
|
||||
/*---------------------------------------- getdns_dict_create */
|
||||
struct getdns_dict *
|
||||
getdns_dict_create()
|
||||
{
|
||||
struct getdns_dict *dict;
|
||||
|
||||
dict = (struct getdns_dict *) malloc(sizeof(struct getdns_dict));
|
||||
dict->rootp = NULL;
|
||||
|
||||
return dict;
|
||||
} /* getdns_dict_create */
|
||||
|
||||
/*---------------------------------------- getdns_dict_copy */
|
||||
/**
|
||||
* private function used to make a copy of a dict structure
|
||||
* @param srcdict the dictionary structure to copy
|
||||
* @return the address of the copy of the dictionary structure on success
|
||||
* @return NULL on error (out of memory, invalid srcdict)
|
||||
*/
|
||||
struct getdns_dict *
|
||||
getdns_dict_copy(struct getdns_dict *srcdict)
|
||||
{
|
||||
struct getdns_dict *newdict = NULL;
|
||||
|
||||
if(srcdict != NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return newdict;
|
||||
} /* getdns_dict_copy */
|
||||
|
||||
/*---------------------------------------- getdns_dict_item_free */
|
||||
/**
|
||||
* private function used to release storage associated with a dictionary item
|
||||
* @param all memory in this structure and its children will be freed
|
||||
* @return void
|
||||
*/
|
||||
void
|
||||
getdns_dict_item_free(struct getdns_dict_item *item)
|
||||
{
|
||||
if(item != NULL)
|
||||
{
|
||||
if(item->dtype == t_bindata)
|
||||
{
|
||||
if(item->data.bindata->size > 0)
|
||||
free(item->data.bindata->data);
|
||||
free(item->data.bindata);
|
||||
}
|
||||
else if(item->dtype == t_dict)
|
||||
{
|
||||
getdns_dict_destroy(item->data.dict);
|
||||
}
|
||||
else if(item->dtype == t_list)
|
||||
{
|
||||
getdns_list_destroy(item->data.list);
|
||||
}
|
||||
|
||||
if(item->key != NULL)
|
||||
free(item->key);
|
||||
free(item);
|
||||
}
|
||||
} /* getdns_dict_item_free */
|
||||
|
||||
/*---------------------------------------- getdns_dict_destroy */
|
||||
void
|
||||
getdns_dict_destroy(struct getdns_dict *dict)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item *item;
|
||||
|
||||
if(dict != NULL && dict->rootp != NULL)
|
||||
{
|
||||
while(dict->rootp != NULL)
|
||||
{
|
||||
item = *((struct getdns_dict_item **) dict->rootp);
|
||||
keyitem.key = item->key;
|
||||
tdelete(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
getdns_dict_item_free(item);
|
||||
}
|
||||
|
||||
free(dict);
|
||||
}
|
||||
|
||||
return;
|
||||
} /* getdns_dict_destroy */
|
||||
|
||||
/*---------------------------------------- getdns_dict_set_dict */
|
||||
getdns_return_t
|
||||
getdns_dict_set_dict(struct getdns_dict *dict, char *name, struct getdns_dict *child_dict)
|
||||
{
|
||||
struct getdns_dict_item keyitem;
|
||||
struct getdns_dict_item **item;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
if(dict != NULL && name != NULL && child_dict != NULL)
|
||||
{
|
||||
/* we try to find it first, if we do then clear the existing data */
|
||||
keyitem.key = name;
|
||||
item = tfind(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
if(item != NULL && *item != NULL)
|
||||
{
|
||||
getdns_dict_item_free(*item);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* tsearch will add a node automatically for us */
|
||||
item = tsearch(&keyitem, &(dict->rootp), getdns_dict_cmp);
|
||||
(*item)->key = strdup(keyitem.key);
|
||||
(*item)->dtype = t_dict;
|
||||
(*item)->data.dict = getdns_dict_copy(child_dict);
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_dict_set_dict */
|
||||
|
||||
getdns_return_t getdns_dict_set_list(struct getdns_dict *this_dict, char *name, struct getdns_list *child_list)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_list); return GETDNS_RETURN_GOOD; }
|
||||
|
@ -66,8 +363,23 @@ getdns_return_t getdns_dict_set_list(struct getdns_dict *this_dict, char *name,
|
|||
getdns_return_t getdns_dict_set_bindata(struct getdns_dict *this_dict, char *name, struct getdns_bindata *child_bindata)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_bindata); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_dict_set_int(struct getdns_dict *this_dict, char *name, uint32_t child_uint32)
|
||||
{ UNUSED_PARAM(this_dict); UNUSED_PARAM(name); UNUSED_PARAM(child_uint32); return GETDNS_RETURN_GOOD; }
|
||||
/*---------------------------------------- getdns_dict_set_int */
|
||||
getdns_return_t
|
||||
getdns_dict_set_int(struct getdns_dict *dict, char *name, uint32_t child_uint32)
|
||||
{
|
||||
struct getdns_dict_item *item;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_DICT_NAME;
|
||||
|
||||
item = getdns_dict_find(dict, name, true);
|
||||
if(dict != NULL && name != NULL)
|
||||
{
|
||||
item->dtype = t_int;
|
||||
item->data.n = child_uint32;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_dict_set_int */
|
||||
|
||||
char *
|
||||
getdns_pretty_print_dict(
|
||||
|
|
|
@ -28,45 +28,341 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <getdns_libevent.h>
|
||||
#include "getdns_core_only.h"
|
||||
|
||||
/* stuff to make it compile pedantically */
|
||||
#define UNUSED_PARAM(x) ((void)(x))
|
||||
|
||||
getdns_return_t getdns_list_get_length(struct getdns_list *this_list, size_t *answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_get_data_type(struct getdns_list *this_list, size_t index, getdns_data_type *answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
getdns_return_t
|
||||
getdns_list_get_length(struct getdns_list *list, size_t *answer)
|
||||
{
|
||||
int retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if(list != NULL && answer != NULL)
|
||||
{
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
*answer = list->numinuse;
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_list_get_length */
|
||||
|
||||
/*---------------------------------------- getdns_list_get_data_type */
|
||||
getdns_return_t
|
||||
getdns_list_get_data_type(struct getdns_list *list, size_t index, getdns_data_type *answer)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if(list != NULL && index < list->numinuse)
|
||||
{
|
||||
*answer = list->items[index].dtype;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
return retval;
|
||||
} /* getdns_list_get_data_type */
|
||||
|
||||
getdns_return_t getdns_list_get_dict(struct getdns_list *this_list, size_t index, struct getdns_dict **answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_get_list(struct getdns_list *this_list, size_t index, struct getdns_list **answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
/*---------------------------------------- getdns_list_get_list */
|
||||
getdns_return_t
|
||||
getdns_list_get_list(struct getdns_list *list, size_t index, struct getdns_list **answer)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
getdns_return_t getdns_list_get_bindata(struct getdns_list *this_list, size_t index, struct getdns_bindata **answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
if(list != NULL && index < list->numinuse)
|
||||
{
|
||||
if(list->items[index].dtype != t_list)
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
else
|
||||
{
|
||||
*answer = list->items[index].data.list;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
getdns_return_t getdns_list_get_int(struct getdns_list *this_list, size_t index, uint32_t *answer)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(answer); return GETDNS_RETURN_GOOD; }
|
||||
return retval;
|
||||
} /* getdns_list_get_list */
|
||||
|
||||
struct getdns_list * getdns_list_create()
|
||||
{ return NULL; }
|
||||
/*---------------------------------------- getdns_list_get_bindata */
|
||||
getdns_return_t getdns_list_get_bindata(struct getdns_list *list, size_t index, struct getdns_bindata **answer)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
void getdns_list_destroy(struct getdns_list *this_list)
|
||||
{ UNUSED_PARAM(this_list); }
|
||||
if(list != NULL && index < list->numinuse)
|
||||
{
|
||||
if(list->items[index].dtype != t_bindata)
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
else
|
||||
{
|
||||
*answer = list->items[index].data.bindata;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_list_get_bindata */
|
||||
|
||||
/*---------------------------------------- getdns_list_get_int */
|
||||
getdns_return_t
|
||||
getdns_list_get_int(struct getdns_list *list, size_t index, uint32_t *answer)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if(list != NULL && index < list->numinuse)
|
||||
{
|
||||
if(list->items[index].dtype != t_int)
|
||||
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
|
||||
else
|
||||
{
|
||||
*answer = list->items[index].data.n;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_list_get_int */
|
||||
|
||||
/*---------------------------------------- getdns_list_realloc */
|
||||
/**
|
||||
* private function (API users should not be calling this)
|
||||
* allocates a block of items, should be called when a list needs to grow
|
||||
* preserves the existing items
|
||||
* in case of an error the list should be considered unusable
|
||||
* @return GETDNS_RETURN_GOOD on success, GETDNS_RETURN_GENERIC_ERROR if out of memory
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_list_realloc(struct getdns_list *list)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_GENERIC_ERROR;
|
||||
int i;
|
||||
struct getdns_list_item *newlist;
|
||||
|
||||
if(list != NULL)
|
||||
{
|
||||
newlist = (struct getdns_list_item *) realloc(list->items
|
||||
, (list->numalloc + GETDNS_LIST_BLOCKSZ) * sizeof(struct getdns_list_item));
|
||||
if(newlist != NULL)
|
||||
{
|
||||
list->items = newlist;
|
||||
for(i=list->numalloc; i<list->numalloc + GETDNS_LIST_BLOCKSZ; i++)
|
||||
{
|
||||
list->items[i].inuse = false;
|
||||
list->items[i].dtype = t_invalid;
|
||||
}
|
||||
list->numalloc += GETDNS_LIST_BLOCKSZ;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_list_realloc */
|
||||
|
||||
/*---------------------------------------- getdns_list_copy */
|
||||
/**
|
||||
* private function (API users should not be calling this), this uses library
|
||||
* routines to make a copy of the list - would be faster to make the copy directly
|
||||
* @param list pointer to list to copy
|
||||
* @param newlist pointer to pointer to list to receive the copy (will be allocated)
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if list is invalid
|
||||
* @return GETDNS_RETURN_GENERIC_ERROR if out of memory
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_list_copy(struct getdns_list *srclist, struct getdns_list **dstlist)
|
||||
{
|
||||
int i;
|
||||
size_t index;
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if(srclist != NULL && *dstlist != NULL)
|
||||
{
|
||||
*dstlist = getdns_list_create();
|
||||
if(*dstlist != NULL)
|
||||
{
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
for(i=0; i<srclist->numinuse; i++)
|
||||
{
|
||||
if(getdns_list_add_item(*dstlist, &index) == GETDNS_RETURN_GOOD)
|
||||
{
|
||||
(*dstlist)->items[index].inuse = true;
|
||||
(*dstlist)->items[index].dtype = srclist->items[i].dtype;
|
||||
|
||||
if(srclist->items[i].dtype == t_int)
|
||||
(*dstlist)->items[index].data.n = srclist->items[i].data.n;
|
||||
else if(srclist->items[i].dtype == t_list)
|
||||
retval = getdns_list_copy(srclist->items[index].data.list
|
||||
, &((*dstlist)->items[i].data.list));
|
||||
else if(srclist->items[i].dtype == t_bindata)
|
||||
{
|
||||
(*dstlist)->items[i].data.bindata = (struct getdns_bindata *)
|
||||
malloc(sizeof(getdns_bindata));
|
||||
(*dstlist)->items[i].data.bindata->size = srclist->items[i].data.bindata->size;
|
||||
(*dstlist)->items[i].data.bindata->data = (uint8_t *)
|
||||
malloc(srclist->items[i].data.bindata->size);
|
||||
if((*dstlist)->items[i].data.bindata->data != NULL)
|
||||
memcpy(srclist->items[i].data.bindata->data
|
||||
, (*dstlist)->items[i].data.bindata->data
|
||||
, srclist->items[i].data.bindata->size);
|
||||
else
|
||||
retval = GETDNS_RETURN_GENERIC_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
retval = GETDNS_RETURN_GENERIC_ERROR;
|
||||
|
||||
if(retval != GETDNS_RETURN_GOOD)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
retval = GETDNS_RETURN_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_list_copy */
|
||||
|
||||
/*---------------------------------------- getdns_list_create */
|
||||
struct getdns_list *
|
||||
getdns_list_create()
|
||||
{
|
||||
struct getdns_list *list = NULL;
|
||||
|
||||
list = (struct getdns_list *) malloc(sizeof(struct getdns_list));
|
||||
if(list != NULL)
|
||||
{
|
||||
list->numalloc = 0;
|
||||
list->numinuse = 0;
|
||||
list->items = NULL;
|
||||
|
||||
getdns_list_realloc(list);
|
||||
}
|
||||
|
||||
return list;
|
||||
} /* getdns_list_create */
|
||||
|
||||
/*---------------------------------------- getdns_list_destroy */
|
||||
void
|
||||
getdns_list_destroy(struct getdns_list *list)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(list != NULL)
|
||||
{
|
||||
if(list->items != NULL)
|
||||
{
|
||||
for(i=0; i<list->numinuse; i++)
|
||||
{
|
||||
if(list->items[i].dtype == t_list)
|
||||
{
|
||||
if(list->items[i].dtype == t_list)
|
||||
getdns_list_destroy(list->items[i].data.list);
|
||||
}
|
||||
else if(list->items[i].dtype == t_bindata)
|
||||
{
|
||||
if(list->items[i].data.bindata->size > 0)
|
||||
free(list->items[i].data.bindata->data);
|
||||
free(list->items[i].data.bindata);
|
||||
}
|
||||
}
|
||||
free(list->items);
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
} /* getdns_list_destroy */
|
||||
|
||||
/*---------------------------------------- getdns_list_add_item */
|
||||
getdns_return_t
|
||||
getdns_list_add_item(struct getdns_list *list, size_t *index)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
if(list != NULL && index != NULL)
|
||||
{
|
||||
if(list->numalloc == list->numinuse)
|
||||
retval = getdns_list_realloc(list);
|
||||
else
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
|
||||
if(retval == GETDNS_RETURN_GOOD)
|
||||
{
|
||||
*index = list->numinuse;
|
||||
list->items[*index].inuse = true;
|
||||
list->numinuse++;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
} /* getdns_list_add_item */
|
||||
|
||||
getdns_return_t getdns_list_set_dict(struct getdns_list *this_list, size_t index, struct getdns_dict *child_dict)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_dict); return GETDNS_RETURN_GOOD; }
|
||||
|
||||
getdns_return_t getdns_list_set_list(struct getdns_list *this_list, size_t index, struct getdns_list *child_list)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_list); return GETDNS_RETURN_GOOD; }
|
||||
/*---------------------------------------- getdns_set_list */
|
||||
getdns_return_t
|
||||
getdns_list_set_list(struct getdns_list *list, size_t index, struct getdns_list *child_list)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
getdns_return_t getdns_list_set_bindata(struct getdns_list *this_list, size_t index, struct getdns_bindata *child_bindata)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_bindata); return GETDNS_RETURN_GOOD; }
|
||||
if(list != NULL && child_list != NULL)
|
||||
{
|
||||
if(list->numinuse > index)
|
||||
{
|
||||
list->items[index].dtype = t_list;
|
||||
retval = getdns_list_copy(child_list, &(list->items[index].data.list));
|
||||
}
|
||||
}
|
||||
|
||||
getdns_return_t getdns_list_set_int(struct getdns_list *this_list, size_t index, uint32_t child_uint32)
|
||||
{ UNUSED_PARAM(this_list); UNUSED_PARAM(index); UNUSED_PARAM(child_uint32); return GETDNS_RETURN_GOOD; }
|
||||
return retval;
|
||||
} /* getdns_set_list */
|
||||
|
||||
/*---------------------------------------- getdns_list_set_bindata */
|
||||
getdns_return_t
|
||||
getdns_list_set_bindata(struct getdns_list *list, size_t index, struct getdns_bindata *child_bindata)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if(list != NULL && child_bindata != NULL)
|
||||
{
|
||||
if(list->numinuse > index)
|
||||
{
|
||||
list->items[index].dtype = t_bindata;
|
||||
list->items[index].data.bindata = (struct getdns_bindata *)
|
||||
malloc(sizeof(struct getdns_bindata));
|
||||
if(list->items[index].data.bindata != NULL)
|
||||
{
|
||||
list->items[index].data.bindata->size = child_bindata->size;
|
||||
list->items[index].data.bindata->data = (uint8_t *) malloc(child_bindata->size
|
||||
* sizeof(uint8_t));
|
||||
memcpy(list->items[index].data.bindata->data, child_bindata->data, child_bindata->size);
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
else
|
||||
retval = GETDNS_RETURN_GENERIC_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_list_set_bindata */
|
||||
|
||||
/*---------------------------------------- getdns_list_set_int */
|
||||
getdns_return_t
|
||||
getdns_list_set_int(struct getdns_list *list, size_t index, uint32_t child_uint32)
|
||||
{
|
||||
getdns_return_t retval = GETDNS_RETURN_NO_SUCH_LIST_ITEM;
|
||||
|
||||
if(list != NULL)
|
||||
{
|
||||
if(list->numinuse > index)
|
||||
{
|
||||
list->items[index].dtype = t_int;
|
||||
list->items[index].data.n = child_uint32;
|
||||
retval = GETDNS_RETURN_GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
} /* getdns_list_set_int */
|
||||
|
||||
/* getdns_list.c */
|
||||
|
|
|
@ -0,0 +1,527 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2011-11-20.07; # 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.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# 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_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
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 the last 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.
|
||||
-s $stripprog installed files.
|
||||
-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
|
||||
"
|
||||
|
||||
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
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
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
|
||||
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=$?
|
||||
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; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# 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
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/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.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or 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
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob 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=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_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 && $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` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# 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 -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$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 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -1,6 +1,7 @@
|
|||
#
|
||||
# @configure_input@
|
||||
#
|
||||
# TODO: OSX, fix DYLD_LIBRARY_PATH problem
|
||||
|
||||
package = @PACKAGE_NAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
|
@ -15,21 +16,41 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-g -I. -std=c99
|
||||
LDFLAGS=-L.
|
||||
LDLIBS=-levent_core -lldns -lgetdns
|
||||
PROGRAMS=example-simple-answers example-tree example-all-functions example-synchronous
|
||||
CFLAGS=-Wall -g -I./ -I../common -I$(srcdir)/ -std=c99
|
||||
LDFLAGS=-L../common
|
||||
LDLIBS=-lgetdns
|
||||
PROGRAMS=tests_list tests_dict
|
||||
|
||||
all: libgetdns example-simple-answers example-tree example-all-functions example-synchronous
|
||||
.SUFFIXES: .c .o .a .lo .h .can .out .res
|
||||
|
||||
getdns_core_only.o: getdns_core_only.c
|
||||
$(CC) -c -Wall -fPIC $(CFLAGS) $^
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
libgetdns: getdns_core_only.c
|
||||
$(CC) $(CFLAGS) -shared -o libgetdns.so $^
|
||||
.out.res:
|
||||
diff $< $(basename $<).can > $@
|
||||
|
||||
all: tests_list tests_list.res tests_dict tests_dict.res
|
||||
|
||||
tests_list: tests_list.o ../common/libgetdns.so testmessages.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^
|
||||
|
||||
tests_dict: tests_dict.o ../common/libgetdns.so testmessages.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^
|
||||
|
||||
# we want the library that was just built to be used in the tests
|
||||
# NOT one that is installed on the system
|
||||
tests_list.out : tests_list
|
||||
export DYLD_LIBRARY_PATH=../common; ./tests_list > tests_list.out
|
||||
|
||||
tests_dict.out : tests_dict
|
||||
export DYLD_LIBRARY_PATH=../common; ./tests_dict > tests_dict.out
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAMS) libgetdns.so
|
||||
rm -f *.o *.out *.res $(PROGRAMS)
|
||||
|
||||
distclean : clean
|
||||
rm -f Makefile config.status config.log
|
||||
rm -Rf autom4te.cache
|
||||
|
||||
$(distdir): FORCE
|
||||
mkdir -p $(distdir)/src
|
||||
|
@ -60,5 +81,5 @@ Makefile: Makefile.in ../config.status
|
|||
configure.status: configure
|
||||
cd .. && ./config.status --recheck
|
||||
|
||||
.PHONY: clean
|
||||
.PHONY: all clean distclean
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
The programs in this directory are intended to provide a regression
|
||||
test suite - we should be adding tests here as we build the package.
|
||||
|
||||
When building unit tests one approach that makes regression testing
|
||||
easy is to generate canonical output and maintain that with the
|
||||
code. Changes to the code should produce output that matches the
|
||||
canonical output, if it doesn't then the developer needs to look at
|
||||
the differences to determine whether something broke or is fixed. Once
|
||||
the new output is verified it can replace the canonical output.
|
||||
|
||||
A typical flow might be illustrated via tests_list:
|
||||
- build tests_list (an executable linked against the library)
|
||||
- run the regression tests
|
||||
./tests_list > tests_list.out
|
||||
- compare output to canonical output
|
||||
diff tests_list.out tests_list.can > tests_list.res
|
||||
- if there are any diffs then a change affected the output
|
||||
- verify the new output and copy it to tests_list.can
|
||||
- commit the new canonical output to the repository
|
||||
|
||||
Some of the tests that remain to be implemented:
|
||||
- memory leak testing integrated into the test progs
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* \file
|
||||
* \brief display messages to support unit testing
|
||||
*/
|
||||
/* The MIT License (MIT)
|
||||
* Copyright (c) 2013 Verisign, Inc.
|
||||
*
|
||||
* 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
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include "testmessages.h"
|
||||
|
||||
static char *testprog = NULL;
|
||||
static char **cases = NULL;
|
||||
static int ncases = 0;
|
||||
|
||||
void
|
||||
tstmsg_prog_begin(char *prognm)
|
||||
{
|
||||
if(testprog != NULL)
|
||||
{ tstmsg_prog_end();
|
||||
free(testprog);
|
||||
}
|
||||
testprog = strdup(prognm);
|
||||
printf("TESTPROG %s START\n", testprog);
|
||||
} /* tstmsg_prog_begin */
|
||||
|
||||
void
|
||||
tstmsg_prog_end()
|
||||
{
|
||||
printf("TESTPROG %s END\n", testprog);
|
||||
} /* tstmsg_prog_end */
|
||||
|
||||
void
|
||||
tstmsg_case_begin(char *casenm)
|
||||
{
|
||||
ncases++;
|
||||
cases = (char **) realloc(cases, sizeof(char *) * ncases);
|
||||
cases[ncases-1] = strdup(casenm);
|
||||
|
||||
printf("TESTCASE %s:%s BEGIN\n", testprog, cases[ncases-1]);
|
||||
} /* tstmsg_case_begin */
|
||||
|
||||
void
|
||||
tstmsg_case_end(void)
|
||||
{
|
||||
if(ncases > 0)
|
||||
{
|
||||
printf("TESTCASE %s:%s END\n", testprog, cases[ncases-1]);
|
||||
ncases--;
|
||||
free(cases[ncases]);
|
||||
cases = (char **) realloc(cases, sizeof(char *) * ncases);
|
||||
}
|
||||
} /* tstmsg_case_end */
|
||||
|
||||
void
|
||||
tstmsg_case_msg(char *msg)
|
||||
{
|
||||
printf(" %s:%s: %s\n", testprog, cases[ncases-1], msg);
|
||||
} /* tstmsg_case_msg */
|
||||
|
||||
/* testmessages.c */
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* \file
|
||||
* \brief display messages to support unit testing
|
||||
*/
|
||||
/* The MIT License (MIT)
|
||||
* Copyright (c) 2013 Verisign, Inc.
|
||||
*
|
||||
* 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
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef TESTMESSAGES_H
|
||||
#define TESTMESSAGES_H 1
|
||||
|
||||
/**
|
||||
* call at the start of a test program to display start message
|
||||
*/
|
||||
void tstmsg_prog_begin(char *prognm);
|
||||
/**
|
||||
* call at the end of a test program to display end message
|
||||
*/
|
||||
void tstmsg_prog_end();
|
||||
|
||||
/**
|
||||
* call at the start of a test case (after test_prog_begin)
|
||||
* to display case start message
|
||||
*/
|
||||
void tstmsg_case_begin(char *casenm);
|
||||
/**
|
||||
* call at the end of a test case (after test_prog_begin/test_case_begin)
|
||||
* to display case end message
|
||||
*/
|
||||
void tstmsg_case_end();
|
||||
|
||||
/**
|
||||
* call to display message regarding the current test case
|
||||
* to display case end message
|
||||
*/
|
||||
void tstmsg_case_msg(char *msg);
|
||||
|
||||
#endif
|
||||
|
||||
/* testmessages.h */
|
|
@ -0,0 +1,171 @@
|
|||
/**
|
||||
* \file
|
||||
* unit tests for getdns_dict helper routines, these should be used to
|
||||
* perform regression tests, output must be unchanged from canonical output
|
||||
* stored with the sources
|
||||
*/
|
||||
/* The MIT License (MIT)
|
||||
* Copyright (c) 2013 Verisign, Inc.
|
||||
*
|
||||
* 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
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "testmessages.h"
|
||||
#include "getdns_core_only.h"
|
||||
|
||||
#define TSTMSGBUF 80
|
||||
|
||||
/*---------------------------------------- tst_intsetget */
|
||||
/**
|
||||
* test the int get and set routines
|
||||
*/
|
||||
void
|
||||
tst_intsetget(void)
|
||||
{
|
||||
char msg[TSTMSGBUF];
|
||||
char key[20];
|
||||
uint32_t ans_int;
|
||||
uint32_t newint;
|
||||
getdns_return_t retval;
|
||||
struct getdns_dict *dict = NULL;
|
||||
|
||||
tstmsg_case_begin("tst_intsetget");
|
||||
|
||||
dict = getdns_dict_create();
|
||||
|
||||
/* test int get function against empty list and with bogus params */
|
||||
|
||||
strcpy(key, "foo");
|
||||
|
||||
tstmsg_case_msg("getdns_dict_get_int() empty dict");
|
||||
retval = getdns_dict_get_int(NULL, key, &ans_int);
|
||||
sprintf(msg, "line %d: getdns_dict_get_int(NULL, key, &ans_int),retval = %d", __LINE__, retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
retval = getdns_dict_get_int(dict, key, NULL);
|
||||
sprintf(msg, "line %d: getdns_dict_get_int(dict, key, NULL),retval = %d", __LINE__, retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_dict_get_int(dict, NULL, &ans_int)");
|
||||
retval = getdns_dict_get_int(dict, NULL, &ans_int);
|
||||
sprintf(msg, "line %d: getdns_dict_get_int,retval = %d", __LINE__, retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_dict_get_int(dict, key, &ans_int)");
|
||||
retval = getdns_dict_get_int(dict, key, &ans_int);
|
||||
sprintf(msg, "line %d: getdns_list_get_int,retval = %d", __LINE__, retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
getdns_dict_destroy(dict);
|
||||
|
||||
/* TODO: test getdns_dict_set functions with bogus params */
|
||||
|
||||
/* test set and get legitimate use case */
|
||||
|
||||
dict = getdns_dict_create();
|
||||
|
||||
strcpy(key, "foo");
|
||||
newint = 42;
|
||||
|
||||
tstmsg_case_msg("getdns_dict_set_int(dict, key, newint)");
|
||||
retval = getdns_dict_set_int(dict, key, newint);
|
||||
sprintf(msg, "line %d: getdns_dict_set_int,retval=%d,key=%s,int=%d", __LINE__, retval, key, newint);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_dict_get_int(dict, key, &ans_int)");
|
||||
retval = getdns_dict_get_int(dict, key, &ans_int);
|
||||
sprintf(msg, "line %d: getdns_dict_get_int,retval=%d,key=%s,int=%d", __LINE__, retval, key, ans_int);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
strcpy(key, "bar");
|
||||
newint = 52;
|
||||
tstmsg_case_msg("getdns_dict_set_int(dict, key, newint)");
|
||||
retval = getdns_dict_set_int(dict, key, newint);
|
||||
sprintf(msg, "line %d: getdns_dict_set_int,retval=%d,key=%s,int=%d", __LINE__, retval, key, newint);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_dict_get_int(dict, key, &ans_int)");
|
||||
retval = getdns_dict_get_int(dict, key, &ans_int);
|
||||
sprintf(msg, "line %d: getdns_dict_get_int,retval=%d,key=%s,int=%d", __LINE__, retval, key, ans_int);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
getdns_dict_destroy(dict);
|
||||
|
||||
tstmsg_case_end();
|
||||
|
||||
return;
|
||||
} /* tst_intsetget */
|
||||
|
||||
/*---------------------------------------- tst_create */
|
||||
/**
|
||||
* test the create, destroy and allocation functions
|
||||
*/
|
||||
void
|
||||
tst_create(void)
|
||||
{
|
||||
struct getdns_dict *dict = NULL;
|
||||
|
||||
/* make sure we can do a simple create/destroy first */
|
||||
|
||||
tstmsg_case_begin("tst_create");
|
||||
|
||||
tstmsg_case_msg("getdns_dict_create");
|
||||
dict = getdns_dict_create();
|
||||
|
||||
if(dict != NULL)
|
||||
{
|
||||
tstmsg_case_msg("getdns_dict_destroy(dict)");
|
||||
getdns_dict_destroy(dict);
|
||||
}
|
||||
|
||||
tstmsg_case_msg("getdns_dict_destroy(NULL)");
|
||||
getdns_dict_destroy(NULL);
|
||||
|
||||
tstmsg_case_end();
|
||||
|
||||
return;
|
||||
} /* tst_create */
|
||||
|
||||
/*---------------------------------------- main */
|
||||
/**
|
||||
* runs unit tests against list management routines
|
||||
*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
tstmsg_prog_begin("tests_dict");
|
||||
|
||||
tst_create();
|
||||
|
||||
tst_intsetget();
|
||||
|
||||
/*
|
||||
tst_listsetget();
|
||||
|
||||
tst_bindatasetget();
|
||||
|
||||
tstmsg_prog_end();
|
||||
*/
|
||||
return 0;
|
||||
} /* main */
|
||||
|
||||
/* end tests_dict.c */
|
|
@ -0,0 +1,361 @@
|
|||
/**
|
||||
* \file
|
||||
* unit tests for getdns_list helper routines, these should be used to
|
||||
* perform regression tests, output must be unchanged from canonical output
|
||||
* stored with the sources
|
||||
*/
|
||||
/* The MIT License (MIT)
|
||||
* Copyright (c) 2013 Verisign, Inc.
|
||||
*
|
||||
* 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
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "testmessages.h"
|
||||
#include "getdns_core_only.h"
|
||||
|
||||
#define TSTMSGBUF 80
|
||||
|
||||
/*---------------------------------------- tst_bindatasetget */
|
||||
/**
|
||||
* test the list get and set routines
|
||||
*/
|
||||
void
|
||||
tst_bindatasetget(void)
|
||||
{
|
||||
char msg[TSTMSGBUF];
|
||||
size_t index;
|
||||
getdns_return_t retval;
|
||||
struct getdns_list *list = NULL;
|
||||
struct getdns_bindata *new_bindata = NULL;
|
||||
struct getdns_bindata *ans_bindata = NULL;
|
||||
|
||||
tstmsg_case_begin("tst_bindatasetget");
|
||||
|
||||
list = getdns_list_create();
|
||||
|
||||
/* test get function against empty list and with bogus params */
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_bindata() empty list");
|
||||
retval = getdns_list_get_bindata(NULL, index, &ans_bindata);
|
||||
sprintf(msg, "getdns_list_get_bindata(NULL, index, &ans_bindata),retval = %d"
|
||||
, retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
retval = getdns_list_get_bindata(list, index, NULL);
|
||||
sprintf(msg, "getdns_list_get_bindata(list, index, NULL),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_bindata(list, 0, &ans_bindata)");
|
||||
retval = getdns_list_get_bindata(list, 0, &ans_bindata);
|
||||
sprintf(msg, "getdns_list_get_bindata,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_bindata(list, 1, &ans_bindata)");
|
||||
retval = getdns_list_get_bindata(list, 1, &ans_bindata);
|
||||
sprintf(msg, "getdns_list_get_bindata,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
/* test set function against empty list with bogus params */
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_bindata() empty list");
|
||||
retval = getdns_list_set_bindata(NULL, index, NULL);
|
||||
sprintf(msg, "getdns_list_set_bindata(NULL, index, ans_bindata),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_bindata(list, 0, ans_bindata)");
|
||||
retval = getdns_list_set_bindata(list, 0, NULL);
|
||||
sprintf(msg, "getdns_list_set_bindata,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_bindata(list, 1, ans_bindata)");
|
||||
retval = getdns_list_set_bindata(list, 1, NULL);
|
||||
sprintf(msg, "getdns_list_set_bindata,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
/* test set and get legitimate use case */
|
||||
|
||||
new_bindata = (struct getdns_bindata *) malloc(sizeof(struct getdns_bindata));
|
||||
new_bindata->size = strlen("foobar") + 1;
|
||||
new_bindata->data = (uint8_t *) strdup("foobar");
|
||||
new_bindata->data[strlen("foobar")] = '\0';
|
||||
|
||||
getdns_list_add_item(list, &index);
|
||||
getdns_list_set_bindata(list, index, new_bindata);
|
||||
retval = getdns_list_get_bindata(list, index, &ans_bindata);
|
||||
sprintf(msg, "getdns_list_set/get_bindata,retval = %d, bindata->data = %d,%s"
|
||||
, retval, (int) ans_bindata->size, (char *) ans_bindata->data);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
getdns_list_destroy(list);
|
||||
|
||||
tstmsg_case_end();
|
||||
|
||||
return;
|
||||
} /* tst_bindatasetget */
|
||||
|
||||
/*---------------------------------------- tst_listsetget */
|
||||
/**
|
||||
* test the list get and set routines
|
||||
*/
|
||||
void
|
||||
tst_listsetget(void)
|
||||
{
|
||||
char msg[TSTMSGBUF];
|
||||
size_t index;
|
||||
getdns_return_t retval;
|
||||
uint32_t ans_int;
|
||||
struct getdns_list *list = NULL;
|
||||
struct getdns_list *new_list = NULL;
|
||||
struct getdns_list *ans_list = NULL;
|
||||
|
||||
tstmsg_case_begin("tst_listsetget");
|
||||
|
||||
list = getdns_list_create();
|
||||
|
||||
/* test get function against empty list and with bogus params */
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_list() empty list");
|
||||
retval = getdns_list_get_list(NULL, index, &ans_list);
|
||||
sprintf(msg, "getdns_list_get_list(NULL, index, &ans_list),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
retval = getdns_list_get_list(list, index, NULL);
|
||||
sprintf(msg, "getdns_list_get_list(list, index, NULL),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_list(list, 0, &ans_list)");
|
||||
retval = getdns_list_get_list(list, 0, &ans_list);
|
||||
sprintf(msg, "getdns_list_get_list,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_list(list, 1, &ans_list)");
|
||||
retval = getdns_list_get_list(list, 1, &ans_list);
|
||||
sprintf(msg, "getdns_list_get_list,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
/* test set function against empty list with bogus params */
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_list() empty list");
|
||||
retval = getdns_list_set_list(NULL, index, NULL);
|
||||
sprintf(msg, "getdns_list_set_list(NULL, index, ans_list),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_list(list, 0, ans_list)");
|
||||
retval = getdns_list_set_list(list, 0, NULL);
|
||||
sprintf(msg, "getdns_list_set_list,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_list(list, 1, ans_list)");
|
||||
retval = getdns_list_set_list(list, 1, NULL);
|
||||
sprintf(msg, "getdns_list_set_list,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
/* test set and get legitimate use case */
|
||||
|
||||
new_list = getdns_list_create();
|
||||
getdns_list_add_item(new_list, &index);
|
||||
getdns_list_set_int(new_list, index, 42);
|
||||
|
||||
getdns_list_add_item(list, &index);
|
||||
getdns_list_set_list(list, index, new_list);
|
||||
retval = getdns_list_get_list(list, index, &ans_list);
|
||||
getdns_list_get_int(ans_list, 0, &ans_int);
|
||||
sprintf(msg, "getdns_list_set/get_list,retval = %d, ans[0] = %d", retval, ans_int);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
getdns_list_destroy(list);
|
||||
|
||||
tstmsg_case_end();
|
||||
|
||||
return;
|
||||
} /* tst_listsetget */
|
||||
|
||||
/*---------------------------------------- tst_intsetget */
|
||||
/**
|
||||
* test the int get and set routines
|
||||
*/
|
||||
void
|
||||
tst_intsetget(void)
|
||||
{
|
||||
char msg[TSTMSGBUF];
|
||||
size_t index;
|
||||
uint32_t ans_int;
|
||||
getdns_return_t retval;
|
||||
struct getdns_list *list = NULL;
|
||||
|
||||
tstmsg_case_begin("tst_intsetget");
|
||||
|
||||
list = getdns_list_create();
|
||||
|
||||
/* test int get function against empty list and with bogus params */
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_int() empty list");
|
||||
retval = getdns_list_get_int(NULL, index, &ans_int);
|
||||
sprintf(msg, "getdns_list_get_int(NULL, index, &ans_int),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
retval = getdns_list_get_int(list, index, NULL);
|
||||
sprintf(msg, "getdns_list_get_int(list, index, NULL),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_int(list, 0, &ans_int)");
|
||||
retval = getdns_list_get_int(list, 0, &ans_int);
|
||||
sprintf(msg, "getdns_list_get_int,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_int(list, 1, &ans_int)");
|
||||
retval = getdns_list_get_int(list, 1, &ans_int);
|
||||
sprintf(msg, "getdns_list_get_int,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
/* test int set function against empty list with bogus params */
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_int() empty list");
|
||||
retval = getdns_list_set_int(NULL, index, ans_int);
|
||||
sprintf(msg, "getdns_list_set_int(NULL, index, ans_int),retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_int(list, 0, ans_int)");
|
||||
retval = getdns_list_set_int(list, 0, ans_int);
|
||||
sprintf(msg, "getdns_list_set_int,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_set_int(list, 1, ans_int)");
|
||||
retval = getdns_list_set_int(list, 1, ans_int);
|
||||
sprintf(msg, "getdns_list_set_int,retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
/* test set and get legitimate use case */
|
||||
|
||||
getdns_list_add_item(list, &index);
|
||||
getdns_list_set_int(list, index, 42);
|
||||
retval = getdns_list_get_int(list, index, &ans_int);
|
||||
sprintf(msg, "getdns_list_set/get_int,retval = %d, ans = %d", retval, ans_int);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
getdns_list_destroy(list);
|
||||
|
||||
tstmsg_case_end();
|
||||
|
||||
return;
|
||||
} /* tst_intsetget */
|
||||
|
||||
/*---------------------------------------- tst_create */
|
||||
/**
|
||||
* test the create, destroy and allocation functions
|
||||
*/
|
||||
void
|
||||
tst_create(void)
|
||||
{
|
||||
char msg[TSTMSGBUF];
|
||||
size_t index;
|
||||
int i;
|
||||
getdns_return_t retval;
|
||||
struct getdns_list *list = NULL;
|
||||
|
||||
/* make sure we can do a simple create/destroy first */
|
||||
|
||||
tstmsg_case_begin("tst_create");
|
||||
|
||||
tstmsg_case_msg("getdns_list_create");
|
||||
list = getdns_list_create();
|
||||
|
||||
if(list != NULL)
|
||||
{
|
||||
tstmsg_case_msg("getdns_list_destroy(list)");
|
||||
getdns_list_destroy(list);
|
||||
}
|
||||
|
||||
tstmsg_case_msg("getdns_list_destroy(NULL)");
|
||||
getdns_list_destroy(NULL);
|
||||
|
||||
/* add items until we force it to allocate more storage */
|
||||
|
||||
tstmsg_case_msg("getdns_add_item(list) past block size");
|
||||
list = getdns_list_create();
|
||||
for(i=0; i<GETDNS_LIST_BLOCKSZ+2; i++)
|
||||
{
|
||||
retval = getdns_list_add_item(list, &index);
|
||||
if(retval != GETDNS_RETURN_GOOD)
|
||||
{
|
||||
sprintf(msg, "getdns_list_add_item,i=%d,retval = %d", i, retval);
|
||||
tstmsg_case_msg(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(index != i)
|
||||
{
|
||||
sprintf(msg, "getdns_list_add_item,i=%d,index=%d,retval = %d"
|
||||
, i, (int) index, retval);
|
||||
tstmsg_case_msg(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_length(list)");
|
||||
retval = getdns_list_get_length(list, &index);
|
||||
sprintf(msg, "list length = %d", (int) index);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
tstmsg_case_msg("getdns_list_get_length()");
|
||||
retval = getdns_list_get_length(NULL, &index);
|
||||
sprintf(msg, "NUll, &i, retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
retval = getdns_list_get_length(NULL, NULL);
|
||||
sprintf(msg, "NUll, NULL, retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
retval = getdns_list_get_length(list, NULL);
|
||||
sprintf(msg, "list, NULL, retval = %d", retval);
|
||||
tstmsg_case_msg(msg);
|
||||
|
||||
getdns_list_destroy(list);
|
||||
|
||||
tstmsg_case_end();
|
||||
|
||||
return;
|
||||
} /* tst_create */
|
||||
|
||||
/*---------------------------------------- main */
|
||||
/**
|
||||
* runs unit tests against list management routines
|
||||
*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
tstmsg_prog_begin("tests_list");
|
||||
|
||||
tst_create();
|
||||
|
||||
tst_intsetget();
|
||||
|
||||
tst_listsetget();
|
||||
|
||||
tst_bindatasetget();
|
||||
|
||||
tstmsg_prog_end();
|
||||
|
||||
return 0;
|
||||
} /* main */
|
||||
|
||||
/* end tests_list.c */
|
|
@ -0,0 +1,46 @@
|
|||
TESTPROG tests_list START
|
||||
TESTCASE tests_list:tst_create BEGIN
|
||||
tests_list:tst_create: getdns_list_create
|
||||
tests_list:tst_create: getdns_list_destroy(list)
|
||||
tests_list:tst_create: getdns_list_destroy(NULL)
|
||||
tests_list:tst_create: getdns_add_item(list) past block size
|
||||
tests_list:tst_create: getdns_list_get_length(list)
|
||||
tests_list:tst_create: list length = 12
|
||||
tests_list:tst_create: getdns_list_get_length()
|
||||
tests_list:tst_create: NUll, &i, retval = 304
|
||||
tests_list:tst_create: NUll, NULL, retval = 304
|
||||
tests_list:tst_create: list, NULL, retval = 304
|
||||
TESTCASE tests_list:tst_create END
|
||||
TESTCASE tests_list:tst_intsetget BEGIN
|
||||
tests_list:tst_intsetget: getdns_list_get_int() empty list
|
||||
tests_list:tst_intsetget: getdns_list_get_int(NULL, index, &ans_int),retval = 304
|
||||
tests_list:tst_intsetget: getdns_list_get_int(list, index, NULL),retval = 304
|
||||
tests_list:tst_intsetget: getdns_list_get_int(list, 0, &ans_int)
|
||||
tests_list:tst_intsetget: getdns_list_get_int,retval = 304
|
||||
tests_list:tst_intsetget: getdns_list_get_int(list, 1, &ans_int)
|
||||
tests_list:tst_intsetget: getdns_list_get_int,retval = 304
|
||||
tests_list:tst_intsetget: getdns_list_set_int() empty list
|
||||
tests_list:tst_intsetget: getdns_list_set_int(NULL, index, ans_int),retval = 304
|
||||
tests_list:tst_intsetget: getdns_list_set_int(list, 0, ans_int)
|
||||
tests_list:tst_intsetget: getdns_list_set_int,retval = 304
|
||||
tests_list:tst_intsetget: getdns_list_set_int(list, 1, ans_int)
|
||||
tests_list:tst_intsetget: getdns_list_set_int,retval = 304
|
||||
tests_list:tst_intsetget: getdns_list_set/get_int,retval = 0, ans = 42
|
||||
TESTCASE tests_list:tst_intsetget END
|
||||
TESTCASE tests_list:tst_listsetget BEGIN
|
||||
tests_list:tst_listsetget: getdns_list_get_list() empty list
|
||||
tests_list:tst_listsetget: getdns_list_get_list(NULL, index, &ans_list),retval = 304
|
||||
tests_list:tst_listsetget: getdns_list_get_list(list, index, NULL),retval = 304
|
||||
tests_list:tst_listsetget: getdns_list_get_list(list, 0, &ans_list)
|
||||
tests_list:tst_listsetget: getdns_list_get_list,retval = 304
|
||||
tests_list:tst_listsetget: getdns_list_get_int(list, 1, &ans_list)
|
||||
tests_list:tst_listsetget: getdns_list_get_list,retval = 304
|
||||
tests_list:tst_listsetget: getdns_list_set_list() empty list
|
||||
tests_list:tst_listsetget: getdns_list_set_list(NULL, index, ans_list),retval = 304
|
||||
tests_list:tst_listsetget: getdns_list_set_list(list, 0, ans_list)
|
||||
tests_list:tst_listsetget: getdns_list_set_list,retval = 304
|
||||
tests_list:tst_listsetget: getdns_list_set_list(list, 1, ans_list)
|
||||
tests_list:tst_listsetget: getdns_list_set_list,retval = 304
|
||||
tests_list:tst_listsetget: getdns_list_set/get_list,retval = 0, ans[0] = 42
|
||||
TESTCASE tests_list:tst_listsetget END
|
||||
TESTPROG tests_list END
|
Loading…
Reference in New Issue