dnssec-tools-2.2/0000775000237200023720000000000012544611342014124 5ustar hardakerhardakerdnssec-tools-2.2/ltmain.sh0000664000237200023720000060342612544611342015757 0ustar hardakerhardaker# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # 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. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) extracted_serial=`expr $extracted_serial + 1` my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; *.obj) xform=obj ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. # for path in $notinst_path; do # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` # done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` else compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` fi ;; * ) compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \$*\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` else relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: dnssec-tools-2.2/config.sub0000775000237200023720000010532712544611342016117 0ustar hardakerhardaker#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-04-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: dnssec-tools-2.2/.cvsignore0000664000237200023720000000011412544611342016120 0ustar hardakerhardakerMakefile aclocal.m4 autom4te.cache config.log config.status libtool stamp-h dnssec-tools-2.2/configure0000775000237200023720000140725512544611342016051 0ustar hardakerhardaker#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for dnssec-tools 1.8. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # 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 NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 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'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : 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 : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: dnssec-tools-users@lists.sourceforge.net about your $0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_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 # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # 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). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dnssec-tools' PACKAGE_TARNAME='dnssec-tools' PACKAGE_VERSION='1.8' PACKAGE_STRING='dnssec-tools 1.8' PACKAGE_BUGREPORT='dnssec-tools-users@lists.sourceforge.net' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" enable_option_checking=no ac_subst_vars='LTLIBOBJS LIBOBJS expanded_localstatedir expanded_sysconfdir PERLARGS DNSSEC_SUBDIRS subdirs SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL AWK RANLIB STRIP ac_ct_AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL BIND_DNSSEC_CHECKZONE BIND_DNSSEC_SIGNZONE BIND_DNSSEC_KEYGEN RM AR PERLPROG target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_out_validator enable_validator enable_bind_checks enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock with_validator with_openssl with_ipv6 with_nsec3 with_dlv with_threads with_perl_build_args ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' ac_subdirs_all='validator' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures dnssec-tools 1.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/dnssec-tools] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of dnssec-tools 1.8:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-bind-checks Disable checks for bind dnssec utilities --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --without-validator Build without libsres, libval and binary apps (Disable if they fail to build on your platform). Validator specific options: --with-openssl=PATH Look for openssl in PATH/{lib,include}. --with-ipv6 Enable IPv6 support. --with-nsec3 Enable nsec3 support. --with-dlv Enable DLV support. --without-threads Don't use threads. --with-perl-build-args=ARGS Add ARGS to building perl Makefiles. Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF dnssec-tools configure 1.8 generated by GNU Autoconf 2.69 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 exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by dnssec-tools $as_me 1.8, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --with-out-validator was given. if test "${with_out_validator+set}" = set; then : withval=$with_out_validator; as_fn_error $? " Invalid option. Use --with-validator/--without-validator instead " "$LINENO" 5 fi # Check whether --enable-validator was given. if test "${enable_validator+set}" = set; then : enableval=$enable_validator; as_fn_error $? " Invalid option. Use --with-validator/--without-validator instead " "$LINENO" 5 fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PERLPROG+:} false; then : $as_echo_n "(cached) " >&6 else case $PERLPROG in [\\/]* | ?:[\\/]*) ac_cv_path_PERLPROG="$PERLPROG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PERLPROG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PERLPROG=$ac_cv_path_PERLPROG if test -n "$PERLPROG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERLPROG" >&5 $as_echo "$PERLPROG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_AR+:} false; then : $as_echo_n "(cached) " >&6 else case $AR in [\\/]* | ?:[\\/]*) ac_cv_path_AR="$AR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi AR=$ac_cv_path_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_RM+:} false; then : $as_echo_n "(cached) " >&6 else case $RM in [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi RM=$ac_cv_path_RM if test -n "$RM"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 $as_echo "$RM" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # allow user to disable bind checks # Check whether --enable-bind-checks was given. if test "${enable_bind_checks+set}" = set; then : enableval=$enable_bind_checks; fi if test "x$enable_bind_checks" != "xno"; then # Extract the first word of "dnssec-keygen", so it can be a program name with args. set dummy dnssec-keygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_BIND_DNSSEC_KEYGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $BIND_DNSSEC_KEYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_BIND_DNSSEC_KEYGEN="$BIND_DNSSEC_KEYGEN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_BIND_DNSSEC_KEYGEN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi BIND_DNSSEC_KEYGEN=$ac_cv_path_BIND_DNSSEC_KEYGEN if test -n "$BIND_DNSSEC_KEYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BIND_DNSSEC_KEYGEN" >&5 $as_echo "$BIND_DNSSEC_KEYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$BIND_DNSSEC_KEYGEN"; then as_fn_error $? "Could not locate dnssec-keygen. Please install BIND utilities." "$LINENO" 5 fi # Extract the first word of "dnssec-signzone", so it can be a program name with args. set dummy dnssec-signzone; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_BIND_DNSSEC_SIGNZONE+:} false; then : $as_echo_n "(cached) " >&6 else case $BIND_DNSSEC_SIGNZONE in [\\/]* | ?:[\\/]*) ac_cv_path_BIND_DNSSEC_SIGNZONE="$BIND_DNSSEC_SIGNZONE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_BIND_DNSSEC_SIGNZONE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi BIND_DNSSEC_SIGNZONE=$ac_cv_path_BIND_DNSSEC_SIGNZONE if test -n "$BIND_DNSSEC_SIGNZONE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BIND_DNSSEC_SIGNZONE" >&5 $as_echo "$BIND_DNSSEC_SIGNZONE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$BIND_DNSSEC_SIGNZONE"; then as_fn_error $? "Could not locate dnssec-signzone. Please install BIND utilities." "$LINENO" 5 fi # Extract the first word of "named-checkzone", so it can be a program name with args. set dummy named-checkzone; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_BIND_DNSSEC_CHECKZONE+:} false; then : $as_echo_n "(cached) " >&6 else case $BIND_DNSSEC_CHECKZONE in [\\/]* | ?:[\\/]*) ac_cv_path_BIND_DNSSEC_CHECKZONE="$BIND_DNSSEC_CHECKZONE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_BIND_DNSSEC_CHECKZONE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi BIND_DNSSEC_CHECKZONE=$ac_cv_path_BIND_DNSSEC_CHECKZONE if test -n "$BIND_DNSSEC_CHECKZONE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BIND_DNSSEC_CHECKZONE" >&5 $as_echo "$BIND_DNSSEC_CHECKZONE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$BIND_DNSSEC_CHECKZONE"; then as_fn_error $? "Could not locate named-checkzone. Please install BIND utilities." "$LINENO" 5 fi fi # ? rndc # libtool info ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if 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 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if 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 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if 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 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if 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 fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if 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 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if 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 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include 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); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" 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 *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" 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 *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: # useful stuff for installation # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi # Check whether --with-validator was given. if test "${with_validator+set}" = set; then : withval=$with_validator; fi if test "x$with_validator" != "xno"; then subdirs="$subdirs validator" DNSSEC_SUBDIRS="validator" PERLARGS="" else DNSSEC_SUBDIRS="none" PERLARGS="NOVALIDATOR" fi # # these are bogus flags for this script but get passed down to validator/config* # # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then : withval=$with_openssl; fi # Check whether --with-ipv6 was given. if test "${with_ipv6+set}" = set; then : withval=$with_ipv6; fi # Check whether --with-nsec3 was given. if test "${with_nsec3+set}" = set; then : withval=$with_nsec3; fi # Check whether --with-dlv was given. if test "${with_dlv+set}" = set; then : withval=$with_dlv; fi # Check whether --with-threads was given. if test "${with_threads+set}" = set; then : withval=$with_threads; fi if test "x$prefix" = "xNONE" ; then # if a default prefix is set then don't change perl's install # prefix from what *it* thinks is right, which may not be the # default system prefix prefix=$ac_default_prefix else # if a prefix was specificied, install everything into the # specified prefix, including all perl specific scripts and mans # ugh: this likely isn't perfect. if test "x$mandir" = "xNONE" ; then mandir="$datadir/man" fi if test "x$exec_prefix" = "xNONE" ; then exec_prefix="$prefix" fi PERLARGS="$PERLARGS INSTALLSCRIPT=$prefix/bin INSTALLSITESCRIPT=$prefix/bin INSTALLBIN=$exec_prefix/bin INSTALLSITEBIN=$exec_prefix/bin INSTALLSITEMAN1DIR=$mandir/man1 INSTALLSITEMAN3DIR=$mandir/man3 INSTALLMAN1DIR=$mandir/man1 INSTALLMAN3DIR=$mandir/man3" fi # Check whether --with-perl-build-args was given. if test "${with_perl_build_args+set}" = set; then : withval=$with_perl_build_args; PERLARGS="$PERLARGS $withval" fi missing="" for module in ExtUtils::MakeMaker Net::DNS Net::DNS::SEC Date::Parse do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $module" >&5 $as_echo_n "checking for perl module $module... " >&6; } $PERLPROG "-e 'require $module'" > /dev/null 2>&1 if test $? -ne 0; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; missing="$missing $module" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; }; fi done if test -n "$missing" ; then as_fn_error $? "Missing required perl modules: $missing" "$LINENO" 5 fi missing="" for module in GraphViz Mail::Mailer::sendmail XML::Simple do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recommended perl module $module" >&5 $as_echo_n "checking for recommended perl module $module... " >&6; } $PERLPROG -e "require $module" > /dev/null 2>&1 if test $? -ne 0; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; missing="$missing $module" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; }; fi done if test -n "$missing" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Missing recommended perl modules: $missing" >&5 $as_echo "$as_me: WARNING: Missing recommended perl modules: $missing" >&2;} fi expanded_sysconfdir=`eval echo $sysconfdir` expanded_localstatedir=`eval echo $localstatedir` ac_config_files="$ac_config_files Makefile:Makefile.in tools/modules/conf.pm:tools/modules/conf.pm.in testing/Makefile:testing/Makefile.in dist/rollerd.service:dist/rollerd.service.in dist/donutsd.service:dist/donutsd.service.in" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by dnssec-tools $as_me 1.8, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ dnssec-tools config.status 1.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" 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." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.in" ;; "tools/modules/conf.pm") CONFIG_FILES="$CONFIG_FILES tools/modules/conf.pm:tools/modules/conf.pm.in" ;; "testing/Makefile") CONFIG_FILES="$CONFIG_FILES testing/Makefile:testing/Makefile.in" ;; "dist/rollerd.service") CONFIG_FILES="$CONFIG_FILES dist/rollerd.service:dist/rollerd.service.in" ;; "dist/donutsd.service") CONFIG_FILES="$CONFIG_FILES dist/donutsd.service:dist/donutsd.service.in" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "default":C) echo timestamp > stamp-h ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 $as_echo "$ac_msg" >&6 as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi dnssec-tools-2.2/tools/0000775000237200023720000000000012544611342015264 5ustar hardakerhardakerdnssec-tools-2.2/tools/scripts/0000775000237200023720000000000012544611342016753 5ustar hardakerhardakerdnssec-tools-2.2/tools/scripts/rollrec-editor0000775000237200023720000030220112544611342021625 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2007-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details. # # DNSSEC-Tools: rollrec-editor # # rollrec-editor provides the capability for easy management of rollrec # files in a GUI. New rollrecs may be created and existing rollrecs may # be modified or deleted from rollrec-editor. Only a subset of rollrec # fields may be modified by rollrec-editor. # # # TODO: # - undo command # # - quit editor command works, but the exit(0) call generates # a segmentation fault # use strict; use Net::DNS::SEC::Tools::dnssectools; use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::rollmgr; use Net::DNS::SEC::Tools::rolllog; use Net::DNS::SEC::Tools::rollrec; use Net::DNS::SEC::Tools::BootStrap; use Getopt::Long qw(:config no_ignore_case_always); # # Version information. # my $NAME = "rollrec-editor"; my $VERS = "$NAME version: 2.1.0"; my $DTVERS = "DNSSEC-Tools Version: 2.1"; ###################################################################### # # DESTROY THESE DATA!!! # # These data are part of the undo code that was carried over from # signset-editor. When the undo code is rewritten here, these # variables should be either deleted or renamed. # my %key_lists; my @ssnames; my @krnames; ###################################################################### # # Detect required Perl modules. # dnssec_tools_load_mods( 'Tk' => "", 'Tk::Dialog' => "", 'Tk::DialogBox' => "", 'Tk::FileSelect' => "", 'Tk::Pane' => "", 'Tk::Table' => "", ); ####################################################################### # # program (non-GUI) data # # # Variables for command options. # my %options = (); # Filled option array. my @opts = ( "ignore-warns", # Ignore-edit-warnings flag. "no-filter", # No-name-filtering flag. "columns=i", # Columns in button window. "Version", # Display the version number. "help", # Give a usage message and exit. ); # # Flags for options. # my $givewarnings = 1; # Give-warnings flag. my $namefilter = 1; # Use-name-filter flag (FS). # # File name variables. # my $rrfile = "dummy"; # Rollrec file we're examining. my $curnode = "dummy"; # Node of rrfile. # # Lists of rollrecs. # my %rollrecs = (); # Rollrec hash. my @rollrecs = (); # Rollrec array. my @rrnames = (); # List of rollrec names. my $numrrnames; # Number of rollrec names. my $modified = 0; # Modified-rrfile flag. my %modified = (); # Modified-rollrecs hash. ########################################################################### # # Undo data. # my @undo_stack; # Stack for undo commands. ########################################################################### # # Tk GUI data # ######################################################## # # Main window data. # my $MAINTITLE = "DNSSEC-Tools Rollrec Editor"; my $title = "dummy"; # Node for title. my $modset = 0; # Flag for (modified) title. # # The main window and help window. # my $wm; # Main window. my $helpwin; # Help window. my $inhelpwind = 0; # Showing help window flag. # # The contents of the main window and its frames. # my $mbar; # Menubar frame. my $rrfl; # Keyrec frame. my $body; # Window body frame. my $null; # Empty frame. ######################################################## # # Menubar and menu data. # # # Menu item widgets. # my $fm_open; # Open keyrec file item. my $fm_save; # Save keyrec file item. my $fm_svas; # Save-as keyrec file item. my $fm_quit; # Quit file item. my $em_undo; # Undo edit item. my $cm_create; # Create a rollrec. my $cm_delete; # Delete selected rollrecs. my $cm_modify; # Modify selected rollrecs. my $cm_merger; # Merge two rollrec files. my $cm_rename; # Rename selected rollrec. my $cm_verify; # Verify a rollrec file. my $vw_selall; # Select all rollrecs set item. my $vw_closeall; # Close rollrec edit windows. my $vw_raiser; # Raise rollrec edit windows. my $tog_ignwarn; # Ignore-Edit-Warning toggle. my $tog_namefilt = 1; # Use-name-filter toggle. my $hm_help; # Help item. # # Labels for toggles in the Options menu. # my $IGNORE_ON = "Ignore Edit Warnings"; my $IGNORE_OFF = "Don't Ignore Edit Warnings"; my $FILTER_OFF = "Don't Filter Name Selection"; my $FILTER_ON = "Filter Name Selection"; ######################################################## # # Button window data. # # # Column and row data for button windows. # my $DEFCOLS = 4; # Default columns in button table. my $MAXCOLS = 12; # Maximum allowable button columns. my $MINCOLS = 3; # Minimum allowable button columns. my $numcols; # Current number of table cols. my $numrows; # Current number of table rows. my $columncount = $DEFCOLS; # Column count. # # Font data for text in button window. # my $fontsize = 18; my $font = "*-*-bold-r-*-*-$fontsize-*-*-*-*-*-*-*"; # # Colors for selected/unselected button in button window. # my $RRTAB_UNSEL = 'white'; my $RRTAB_SEL = 'blue'; ######################################################## # # Edit window data. # # # Row and column constants for the edit-window tables. # my $COL_FIELD = 0; # Edit table's label column. my $COL_DATA = 1; # Edit table's data column. my $ROW_TYPE = 0; # Type row. my $ROW_ZONENAME = 1; # Zonename row. my $ROW_ZONEFILE = 2; # Zonefile row. my $ROW_KEYREC = 3; # Keyrec row. my $ROW_ZONEGROUP = 4; # Zonegroup row. my $ROW_ADMIN = 5; # Administrator's email row. my $ROW_DIR = 6; # Directory row. my $ROW_DISPLAY = 7; # Display row. my $ROW_LOG = 8; # Loglevel col. my $ROW_MAXTTL = 9; # Maxttl row. my $ROW_ZSARGS = 10; # Zsargs row. my $ROW_FIRST = $ROW_TYPE; # Edit table's first row. my $ROW_LAST = $ROW_ZSARGS; # Edit table's last row. my $ROW_MSG = ($ROW_LAST + 1); # Message line - after ROW_LAST. # # Labels for the field-column entries of the edit-window tables. # # These MUST correspond to the $ROW_ constants! # my @ET_LABELS = ( "Type", "Zonename", "Zonefile", "Keyrec", "Zonegroup", "Admin Email", "Directory", "Display Flag", "Logging Level", "Max-TTL", "Zonesigner Arguments", "dummy", # Dummy label, just ensures message row is created. ); # # These are the rollrec fields that are editable. # my @EDITFIELDS = ( 'administrator', 'directory', 'display', 'keyrec', 'loglevel', 'maxttl', 'zonefile', 'zonegroup', 'zonename', 'zsargs' ); # # Constants for message text colors. # my $NORMALCOLOR = "black"; # Color for normal messages. my $WARNCOLOR = "yellow"; # Color for warning messages. my $ERRCOLOR = "red"; # Color for error messages. my $rrnametab; # Rollrec name table widget. my %editwinds; # Rollrec edit windows. my %edittabs = (); # Edit-area tables. my %renwinds = (); # Rollrec rename windows. my %rentabs = (); # Rename something or another. my %editrbs; # Type radiobutton values for edit windows. my %editdfs; # Display flag radiobutton vals for edit winds. ########################################################################### main(); exit(0); #--------------------------------------------------------------------------- # Routine: main() # sub main { my $argc = @ARGV; erraction(ERR_EXIT); # # Check our options. # doopts(); # # Get the rollrec filename and the path's node. # $rrfile = $ARGV[0]; $curnode = getnode($rrfile); settitle($curnode); # # Ensure this rollrec file actually exists. # if(! -e $rrfile) { print STDERR "$rrfile does not exist\n"; exit(1); } # # Build the main window. # buildmainwind(); # # Start the whole shebang rollin'. # MainLoop(); } #----------------------------------------------------------------------------- # Routine: doopts() # # Purpose: This routine gets the options from the command line. # sub doopts { my $argc = @ARGV; # Number of command line arguments. usage() if($argc == 0); GetOptions(\%options,@opts) || usage(); # # Show the version number or help info if requested. # version() if(defined($options{'Version'})); usage() if(defined($options{'help'})); # # Set some flags based on the command line. # $givewarnings = 0 if(defined($options{'ignore-warns'})); $namefilter = 0 if(defined($options{'no-filter'})); # # Check for the column-count option. # if(defined($options{'columns'})) { $columncount = $options{'columns'}; if(($columncount < $MINCOLS) || ($columncount > $MAXCOLS)) { print STDERR "column count must be between $MINCOLS and $MAXCOLS\n"; exit(1); } } } #--------------------------------------------------------------------------- # Routine: buildmainwind() # # Purpose: Create and initialize the main window. # sub buildmainwind { my $file; # File menu. my $edit; # Edit menu. my $cmds; # Commands menu. my $view; # Rollrecs menu. my $opts; # Options menu. my $help; # Help menu. my $curfile; # Current keyrec. my $nulline; # Empty line. # # Create the main window and set its size. # $wm = MainWindow->new(-title => $MAINTITLE); # # Get the keyrec file info. No error message; it was given below. # exit(1) if(readrrf($rrfile) == 0); # # Create the frames we'll need. # $mbar = $wm->Frame(-relief => 'raised', -borderwidth => 1); $rrfl = $wm->Frame(-relief => 'raised', -borderwidth => 1); $body = $wm->Frame(-relief => 'raised', -borderwidth => 1); $null = $wm->Frame(-relief => 'raised', -borderwidth => 1); $mbar->pack(-fill => 'x'); $rrfl->pack(-fill => 'x'); $body->pack(-fill => 'x'); $null->pack(-fill => 'x'); # # Create our menus. # $file = $mbar->Menubutton(-text => 'File', -tearoff => 0, -underline => 0); $edit = $mbar->Menubutton(-text => 'Edit', -tearoff => 0, -underline => 0); $cmds = $mbar->Menubutton(-text => 'Commands', -tearoff => 0, -underline => 0); $view = $mbar->Menubutton(-text => 'View', -tearoff => 0, -underline => 0); $opts = $mbar->Menubutton(-text => 'Options', -tearoff => 0, -underline => 0); $help = $mbar->Menubutton(-text => 'Help', -tearoff => 0, -underline => 0); ################################################## # # Add the File menu entries. # $fm_open = $file->command(-label => 'Open...', -command => \&file_open, -accelerator => 'Ctrl+O', -underline => 0); $fm_save = $file->command(-label => 'Save', -command => \&file_save, -accelerator => 'Ctrl+S', -underline => 0); $fm_svas = $file->command(-label => 'Save As...', -command => \&file_saveas, -underline => 0); $file->separator(); $fm_quit = $file->command(-label => 'Quit', -command => \&file_quit, -accelerator => 'Ctrl+Q', -underline => 0); $file->pack(-side => 'left'); $wm->bind('',\&file_open); $wm->bind('',\&file_save); $wm->bind('',\&file_quit); ################################################## # # Add the Edit menu entries. # $em_undo = $edit->command(-label => 'Undo Changes', -command => \&edit_undo, -accelerator => 'Ctrl+U', -state => 'disabled', -underline => 0); $edit->pack(-side => 'left'); $wm->bind('',\&edit_undo); ################################################## # # Add the Commands menu entries. # $cm_create = $cmds->command(-label => 'New Rollrec...', -command => \&cmds_create, -accelerator => 'Ctrl+N', -underline => 0); $cm_delete = $cmds->command(-label => 'Delete Selected Rollrecs', -command => \&cmds_delete, -accelerator => 'Ctrl+D', -underline => 0); $cm_modify = $cmds->command(-label => 'Edit Selected Rollrecs...', -command => \&cmds_modify, -accelerator => 'Ctrl+E', -underline => 0); $cmds->separator(); ################### $cm_rename = $cmds->command(-label => 'Rename Selected Rollrec...', -command => \&cmds_rename, -underline => 0); $cmds->separator(); ################### $cm_merger = $cmds->command(-label => 'Merge Rollrec Files...', -command => \&cmds_merger, -accelerator => 'Ctrl+M', -underline => 0); $cm_verify = $cmds->command(-label => 'Verify Rollrec File', -command => [\&cmds_verify, 0], -accelerator => 'Ctrl+V', -underline => 0); $cm_verify = $cmds->command(-label => 'Summarize Problems', -command => [\&cmds_verify, 1], -underline => 0); $cmds->pack(-side => 'left'); $wm->bind('',\&cmds_create); $wm->bind('',\&cmds_delete); $wm->bind('',\&cmds_modify); $wm->bind('',\&cmds_merger); $wm->bind('',\&cmds_verify); ################################################## # # Add the Rollrecs menu entries. # $vw_selall = $view->command(-label => 'Select All Rollrecs', -command => \&view_selall, -accelerator => 'Ctrl+A', -underline => 0); $vw_raiser = $view->command(-label => 'Reveal Rollrec Edit Windows', -command => \&view_raiser, -accelerator => 'Ctrl+R', -underline => 0); $vw_closeall = $view->command(-label =>'Close Rollrec Edit Windows', -command => \&view_closeall, -accelerator => 'Ctrl+K', -underline => 0); $view->pack(-side => 'left'); $wm->bind('',\&view_selall); $wm->bind('',\&view_closeall); $wm->bind('',\&view_raiser); ################################################## # # Add the Options menu entries. # $tog_ignwarn = $opts->command(-label => $IGNORE_ON, -command => \&toggle_ignwarn, -underline => 0); $opts->pack(-side => 'left'); $namefilter = 1; $tog_namefilt = $opts->command(-label => $FILTER_OFF, -command => \&toggle_namefilt, -underline => 0); $opts->pack(-side => 'left'); $opts->command(-label => 'Columns in Button Window', -command => [\&set_btncols, 0], -underline => 0); $opts->pack(-side => 'left'); # # Set the menu labels based on default values and options. # $givewarnings = !$givewarnings; toggle_ignwarn(); ################################################## # # Add the Help menu entries. # $hm_help = $help->command(-label => 'Help', -command => \&help_help, -accelerator => 'Ctrl+H', -underline => 0); $help->pack(-side => 'right'); $wm->bind('',\&help_help); ################################################## # # Create a line holding the current rollrec filename. # $curfile = $rrfl->Label(-text => "Editing Rollrec File: "); $curfile->pack(-side => 'left'); $curfile = $rrfl->Label(-textvariable => \$title); $curfile->pack(-side => 'left'); $rrfl->pack(-side => 'top', -fill => 'x'); ################################################## # # Create a table to hold the button window. # buildtable(42); # # Create a line holding the current rollrec filename. # $nulline = $null->Label(-text => " "); $nulline->pack(); $null->pack(-side => 'top', -fill => 'x'); } #--------------------------------------------------------------------------- # Routine: buildtable() # # Purpose: Rebuild the rollrec name table. This also re-reads the # current rollrec file, so the list of rollrec names may # increase or shrink depending on the state of that file. # sub buildtable { my $readflag = shift; # Rollrec-read flag. my $cnt = 0; # Count of rollrec names added. # # Create a brand new table. # maketable(); # # Read the list of rollrec names. # readrrf($rrfile,1) if($readflag); return if($numrrnames == 0); # # Ensure the rollrec name list is sorted. # @rrnames = sort(@rrnames); # # Re-populate and update the table. # for(my $ind = 0; $ind < $numrrnames; $ind++) { my $btn; # Button widget. my $row; # Cell's row index. my $col; # Cell's column index. # # Get the column and row indices. # ($col,$row) = ind2cr($ind); $btn = $rrnametab->Button(-text => "$rrnames[$ind]", -font => $font, -anchor => 'w', -state => 'normal', -command => [\&rrname_toggle, $ind], -background => $RRTAB_UNSEL); $rrnametab->put($row,$col,$btn); } $rrnametab->update(); # # Pack it all up. # $rrnametab->pack(-fill => 'both', -expand => 1); $body->pack(-fill => 'both', -expand => 1); } #--------------------------------------------------------------------------- # Routine: rrname_select() # # Purpose: A rollrec name's button has been pushed. Figure out what # to do with it... # sub rrname_select { my $rrind = shift; # Rollrec's name index. my $btn; # Selected button. # # Get the rollrec's button. # $btn = getbutton($rrind); # # ... and set the button's color. # $btn->configure(-activebackground => $RRTAB_SEL, -background => $RRTAB_SEL); } #--------------------------------------------------------------------------- # Routine: rrname_deselect() # # Purpose: A rollrec name's button has been pushed. Figure out what # to do with it... # sub rrname_deselect { my $rrind = shift; # Rollrec's name index. my $btn; # Selected button. # # Get the rollrec's button. # $btn = getbutton($rrind); # # ... and set the button's color. # $btn->configure(-activebackground => $RRTAB_UNSEL, -background => $RRTAB_UNSEL); } #--------------------------------------------------------------------------- # Routine: rrname_toggle() # # Purpose: A rollrec name's button has been pushed. Figure out what # to do with it... # sub rrname_toggle { my $rrind = shift; # Rollrec's name index. my $rowind; # Cell's row index. my $colind; # Cell's column index. my $btn; # Selected button. my $bgclr; # New button background color. # # Get the rollrec's button. # $btn = getbutton($rrind); # # Choose an appropriate background color given the button's # current state... # $bgclr = $btn->cget(-background); $bgclr = ($bgclr eq $RRTAB_SEL) ? $RRTAB_UNSEL : $RRTAB_SEL; # # ... and set the button's color. # $btn->configure(-activebackground => $bgclr, -background => $bgclr); } #--------------------------------------------------------------------------- # Routine: getbutton() # # Purpose: Return a rollrec's button widget given the name's index into # @rrnames. # sub getbutton { my $rrind = shift; # Rollrec's name index. my $rowind; # Cell's row index. my $colind; # Cell's column index. # # Get the column and row indices. # ($colind,$rowind) = ind2cr($rrind); # # Return the proper button widget. # return($rrnametab->get($rowind,$colind)); } #--------------------------------------------------------------------------- # Routine: selected_rrnames() # # Purpose: Return a list of the selected rollrec names buttons. # sub selected_rrnames { my @selected = (); # Selected rollrec names. my $col; # Column index. my $row; # Row index. my $btn; # Rollrec button. for(my $ind=0; $ind < $numrrnames; $ind++) { ($col,$row) = ind2cr($ind); $btn = $rrnametab->get($row,$col); push @selected, $ind if($btn->cget(-background) eq $RRTAB_SEL); } return(sort(@selected)); } #--------------------------------------------------------------------------- # Routine: ind2cr() # # Purpose: Convert a rollrec name table index to its table rows and # column indices. # sub ind2cr { my $nind = shift; # Rollrec name index. my $col; # Column index. my $row; # Row index. $col = int($nind / $numrows); $row = $nind % $numrows; return($col,$row); } #--------------------------------------------------------------------------- # Routine: maketable() # # Purpose: Create the rollrec name table. # sub maketable { # # Don't do anything if we don't have any rollrec names. # return if($numrrnames == 0); # # Calculate the size of the button table. # if($numrrnames != 0) { $numrows = int($numrrnames / $columncount); $numrows++ if(($numrrnames % $columncount) != 0); $numcols = $columncount; } # # Destroy the rollrec-name table's widgets. # if($rrnametab) { $rrnametab->clear; $rrnametab->destroy; } # # Create the new button table. # $rrnametab = $body->Table(-rows => $numrows, -columns => $numcols, -scrollbars => 'e', -relief => 'raised', -borderwidth => 1, -fixedrows => 0, -takefocus => 1, ); } ############################################################################## # # Menu widget interface routines. # ############################################################################## #--------------------------------------------------------------------------- # Routine: file_open() # sub file_open { my $fowin; # File-open widget. my %fsopts = (); # FileSelect() options. my $newfile; # New file name. # # Warn the user if this file has been modified. We'll also give # the user a chance to save the file, not save the file, or cancel # the process of opening the new file. # if($modified) { my $dlg; # Warning dialog widget. my $ret; # Warning response. $dlg = $wm->Dialog(-title => 'Warning', -text => "$curnode has been modified; save before proceeding?", -buttons => ["Save","Don't Save","Cancel"]); $ret = $dlg->Show(); return if($ret eq "Cancel"); rollrec_close() if($ret eq "Save"); } # # Set up options for FileSelect. # %fsopts = (-directory => '.'); $fsopts{'-filter'} = '*.rrf' if($namefilter); # # Prompt for the new file. Return to our caller if nothing was chosen. # $fowin = $wm->FileSelect(%fsopts); $newfile = $fowin->Show; return if($newfile eq ""); # # Save the new filename and its node. # $rrfile = $newfile; $curnode = getnode($rrfile); settitle($curnode); # # Read the new rollrec file and rebuild the button window. # if(readrrf($rrfile)) { buildtable(0); } } #--------------------------------------------------------------------------- # Routine: file_save() # sub file_save { return if(!$modified); # # Save and re-open the rollrec file. # rollrec_close(); readrrf($rrfile); # # Mark the rollrecs as saved. # $modified = 0; $modset = 0; rrsaved(); # # Disable the undo menu option, reset our undo stack, and mark # the file as unmodified. # $em_undo->configure(-state => 'disabled'); @undo_stack = (); } #--------------------------------------------------------------------------- # Routine: file_saveas() # sub file_saveas { my $fowin; # File-open widget. my $newfile; # New file's name. my %fsopts; # FileSelect() options. # # Set up options for FileSelect. # %fsopts = (-directory => '.'); $fsopts{'-filter'} = '*.rrf' if($namefilter); # # Prompt for the new file. # $fowin = $wm->FileSelect(%fsopts); $newfile = $fowin->Show; return if($newfile eq ""); # # Make sure the user *really* wants to overwrite an existing file. # Continue if they do, return if they don't. # if(-e $newfile) { my $dlg; # Warning dialog widget. my $ret; # Warning response. $dlg = $wm->Dialog(-title => 'Warning', -text => "$newfile already exists; overwrite?", -buttons => ["Overwrite","Cancel"]); $ret = $dlg->Show(); return if($ret eq "Cancel"); } # # Save the file. # rollrec_saveas($newfile); } #--------------------------------------------------------------------------- # Routine: file_quit() # sub file_quit { # # Destroy the rollrec name table's widgets. # if($rrnametab) { $rrnametab->clear; $rrnametab->destroy; } # # Warn the user if this file has been modified. We'll also give # the user a chance to save the file, not save the file, or cancel # the process of opening the new file. # if($modified) { my $dlg; # Warning dialog widget. my $ret; # Warning response. $dlg = $wm->Dialog(-title => 'Warning', -text => "$curnode has been modified; save before proceeding?", -buttons => ["Save","Don't Save","Cancel"]); $ret = $dlg->Show(); return if($ret eq "Cancel"); rollrec_close() if($ret eq "Save"); } else { rollrec_discard(); } # # Destroy the main window. This will cause MainLoop() to return, # leading to the program exiting. # $wm->destroy; } #--------------------------------------------------------------------------- # Routine: edit_undo() # sub edit_undo { my $undohash; # First hash from undo stack. my $type; # Undo type. my $op; # Undo operation. my $field; # Undo field. my $value; # Undo value. # # Ensure we have something to undo. # return if(@undo_stack == 0); # # Get the undo entry fields. # $undohash = shift @undo_stack; $type = $undohash->{'type'}; $op = $undohash->{'op'}; $field = $undohash->{'field'}; $value = $undohash->{'value'}; # # Undo based on the operation. This means that creates are deleted, # deletes are re-created, and modifies are returned to the old ways. # if($op eq "create") { my @signset; # Signing set's keyrecs. # # Since we can only create signing sets, that's the only # create operation we'll be able to undo. # if($type eq "signing_set") { # # Delete the signing set name from each keyrec # in the set. # @signset = keyrec_signsets($field); foreach my $kr (@signset) { keyrec_signset_delkey($field,$kr); } # # Delete the signing set name from our list of names. # for(my $ind=0; $ind < @ssnames; $ind++) { if($ssnames[$ind] eq $field) { splice @ssnames, $ind, 1; last; } } } } elsif($op eq "delete") { my @signset; # Signing set's keyrecs. # # If the signing set was deleted, we'll add the signing set # to each keyrec in the set. # If the keyrec was deleted, we'll add each signing set in # the record to the named keyrec. # if($type eq "signing_set") { # # Add the signing set name to each keyrec in the set. # @signset = split / /, $value; foreach my $kr (sort(@signset)) { keyrec_signset_addkey($field,$kr); } # # Add the new set's name to the list of signing sets. # push @ssnames, $field; @ssnames = sort(@ssnames); } elsif($type eq "keyrec") { # # Add each signing set name to the keyrec. # @signset = split / /, $value; foreach my $ssn (@signset) { keyrec_signset_addkey($ssn,$field); } # # Add the keyrec's set list back to the keyrec list. # $key_lists{$field} = $value; push @krnames, $field; @krnames = sort(@krnames); } } elsif($op eq "modify") { # # Handle the modify command for signing sets. # if($type eq "signing_set") { my @keylist; # List of keys. my $newlist; # Keys to be replaced. # # Delete the keys from the signing set. # $newlist = keyrec_recval($field,'keys'); @keylist = split / /, $newlist; foreach my $key (@keylist) { keyrec_signset_delkey($field,$key); } # # Restore the old keys to the signing set. # @keylist = split / /, $value; foreach my $key (@keylist) { keyrec_signset_addkey($field,$key); } } elsif($type eq "keyrec") { # # Handle the modify command for keys. # my $kk = $field; # Key we're undoing. # # Go through all the signing sets to see which need # an undo operation. # foreach my $set (keyrec_signsets()) { my $kfound; # Key-found flag. my $sfound = 0; # Set-found flag. my @undosets = split / /, $value; # # Figure out if this set holds this key. # $kfound = keyrec_signset_haskey($set,$kk); # # Go through the undo set to see if it # contains this set. # foreach my $sset (@undosets) { if($set eq $sset) { $sfound = 1; last; } } # # If the set is in the undo set and it doesn't # have the key, add it back in. # If the set is not in the undo set and it has # the key, take it back out. # if($sfound) { if(!$kfound) { keyrec_signset_addkey($set,$kk); } } else { if($kfound) { keyrec_signset_delkey($set,$kk); } } } } } # # Disable the undo menu option if this was the last undo item. # $em_undo->configure(-state => 'disabled') if(@undo_stack == 0); # # Update the window and decrement our modifications counter. # $modified--; settitle($curnode); } #--------------------------------------------------------------------------- # Routine: undo_add() # sub undo_add { my %undo = (); # Undo hash. # # Add the arguments to our undo hash. # $undo{'type'} = shift; $undo{'op'} = shift; $undo{'field'} = shift; $undo{'value'} = shift; # # Add the undo hash to the beginning of the undo stack. # unshift @undo_stack, \%undo; # # Make sure the undo menu option is enabled. # $em_undo->configure(-state => 'normal'); return; } #--------------------------------------------------------------------------- # Routine: cmds_create() # sub cmds_create { my $dlg; # Dialog box. my $lab; # Label widget. my $ent; # Entry widget. my $ret; # Dialog box return. my $rrn; # New rollrec's name. # print STDERR "cmds_create: down in New Rollrec\n"; # # Create a new dialog box to get the name of the new rollrec entry. # $dlg = $wm->DialogBox(-title => 'New Rollrec Name', -buttons => ["Create", "Cancel" ]); # # Add a description... # $lab = $dlg->add('Label', -text => 'Enter new rollrec name: '); $lab->pack(-side => 'left'); # # ... and a text entry slot, focus on the entry ... # $ent = $dlg->add('Entry'); $ent->pack(-side => 'left'); $dlg->configure(-focus => $ent); # # ... mix, stir, and *voila*! We've got a dialog box. # $ret = $dlg->Show(); # # Drop out if the user changed their mind. # return if($ret eq "Cancel"); # # Get the user's requested name. # $rrn = $ent->get(); # # Give a warning if this rollrec already exists. # if(rollrec_exists($rrn,'zonefile')) { my $dlg; # Warning dialog widget. my $ret; # Warning response. $dlg = $wm->Dialog(-title => 'Warning', -text => "Rollrec $rrn already exists", -buttons => ["Re-enter Name", "Cancel" ]); $ret = $dlg->Show(); # # Drop out if the user changed their mind. # return if($ret eq "Cancel"); # # Let the user try again. # cmds_create(); } # # Set up an edit window for the zone name. # editwindow($rrn,1); } #--------------------------------------------------------------------------- # Routine: cmds_delete() # sub cmds_delete { my @selected = (); # Selected rollrec indices. my @selnames = (); # Selected rollrec names my $numsel; # Number of selected rollrecs. my $ret; # Warning response. my $dlg; # Warning dialog widget. my $nametab; # Name table. my $lab; # Label for table. my $rowind = 0; # Name table row index. # print STDERR "cmds_delete: down in Delete Selected Rollrecs\n"; # # Get the list of selected rollrec indices. # @selected = selected_rrnames(); $numsel = @selected; # # Build the dialog box. # $dlg = $wm->DialogBox(-title => 'Delete Warning', -buttons => ["Delete", "Cancel" ]); # # Add a description. # $lab = $dlg->add('Label', -text => ' Delete the following rollrecs:'); $lab->pack(-anchor => 'w', -side => 'top'); # # Build a table to hold the rollrec names. # $nametab = $dlg->Table(-rows => $numsel, -columns => 1, -relief => 'raised', -scrollbars => '', -borderwidth => 1, -fixedrows => 0, -takefocus => 1, ); # # Add the selected rollrec names to the table. # foreach my $ind (sort {$a <=> $b} @selected) { my $txt; # Label text. $txt = " $rrnames[$ind]"; $lab = $nametab->Label(-text => $txt,-anchor => 'w'); $lab->pack(-fill => 'x', -side => 'top'); $nametab->put($rowind,0,$lab); $rowind++; } # # Pack the name table. # $nametab->pack(-side => 'top'); # # Display the dialog box. # $ret = $dlg->Show(); # # Check for a "don't do this" response. # return if($ret eq "Cancel"); # # Delete and deselect the selected rollrecs. # foreach my $rrind (sort {$a <=> $b} @selected) { rollrec_del($rrnames[$rrind]); rrname_deselect($rrind); } # # Delete the selected rollrec names from the list of rollrecs. # foreach my $rrind (sort {$b <=> $a} @selected) { splice @rrnames, $rrind, 1; $numrrnames--; } # # Rebuild the button table. # buildtable(0); # # Set the modified flag. # $modified++; settitle($title); } #--------------------------------------------------------------------------- # Routine: cmds_modify() # # Purpose: This routine creates edit windows for the selected rollrecs. # sub cmds_modify { my @selected = (); # Selected rollrec names. my $numsel; # Number of selected rollrecs. # print STDERR "cmds_modify: down in Edit Selected Rollrecs\n"; # # Get the list of selected rollrec names. # @selected = selected_rrnames(); $numsel = @selected; # # Create the edit windows. # foreach my $rrind (sort(@selected)) { editwindow($rrnames[$rrind],0); } } #--------------------------------------------------------------------------- # Routine: cmds_merger() # # Purpose: This routine merges two rollrec files. # sub cmds_merger { my $curfile = $rrfile; # Current rollrec file. my $newfile; # New rollrec file. my @curnames = (); # Rollrec names from cur file. my %curnames = (); # Rollrec name hash -- cur file. my @newnames = (); # Rollrec names from new file. my @dupnames = (); # Duplicated rollrec names. my %currrs = (); # Saved rollrecs from cur file. my %newrrs = (); # Saved rollrecs from new file. my $fswin; # FileSelect window widget. my %fsopts; # Options for FileSelect. my $name; # Rollrec name. my $rref; # Rollrec reference. # print STDERR "cmds_merger: down in Merge Rollrec Files\n"; # # Ensure that the currently loaded rollrec matches the version on # disk. If not, don't let the merge happen. # if($modified) { errorbox_multi("$curfile has been modified. Unable to merge until changes have been saved"); return; } # # Save the rollrec data from the currently open rollrec file. # @curnames = rollrec_names(); foreach $name (@curnames) { $rref = rollrec_fullrec($name); $currrs{$name} = $rref; $curnames{$name} = 1; } # # Set up options for FileSelect. # %fsopts = ( -directory => '.', -filelabel => 'File To Be Merged' ); $fsopts{'-filter'} = '*.rrf' if($namefilter); # # Get the name of the file to be merged with the current file. # We'll call this the "new" file. # while(42) { my $cdev; # Current rollrec's filesys devicenum. my $cino; # Current rollrec's inode number. my $ndev; # New rollrec's filesys devicenum. my $nino; # New rollrec's inode number. # # Let the user select a new file. # $fswin = $wm->FileSelect(%fsopts); $newfile = $fswin->Show; # # Return if the user canceled out of the dialog. # return if($newfile eq ''); # # Get the file info for the current and new rollrec files. # ($cdev,$cino) = stat($curfile); ($ndev,$nino) = stat($newfile); # # Drop out of the loop if the two files have different # inode numbers or file system device numbers. # last if(($cino != $nino) || ($cdev != $ndev)); # # Give an error message about the two files. # errorbox_multi("Cannot merge a rollrec file with itself.\nCurrent rollrec - $curfile\nNew rollrec - $newfile"); } # # Ensure the new file is actually a rollrec file. # if(dt_filetype($newfile) ne "rollrec") { my $curnode = getnode($newfile); errorbox("$curnode is not a rollrec file; unable to continue merge"); return; } # # Read the new file. If we couldn't read it, we'll put up a dialog # box explaining the problem. # if(rollrec_read($newfile) < 0) { my $curnode = getnode($newfile); errorbox_multi("Unable to read rollrec file $curnode. Check to ensure the file exists and is readable.\nComplete path - $newfile"); return; } # # Save the rollrec data from the new rollrec file. # @newnames = rollrec_names(); foreach $name (@newnames) { $rref = rollrec_fullrec($name); $newrrs{$name} = $rref; } # # Check for overlapping names in the two rollrecs. # foreach $name (@newnames) { push @dupnames, $name if(defined($curnames{$name})); } # # Re-read the original file. # rollrec_close(); rollrec_read($rrfile); # # If we've got any duplicate names, we'll report them and let the # user decide whether or not to continue. # if(@dupnames) { my $ret; # Dialog's value. $ret = dbx_dups(@dupnames); return if($ret eq "Cancel"); } # # Add the non-overlapping rollrecs to the current rollrec file. # foreach $name (@newnames) { my $rref; # Ref to rollrec. # # Skip the overlapping rollrecs. # next if(defined($curnames{$name})); # # Add rollrec to the in-memory version of the rollrec file. # $rref = $newrrs{$name}; rollrec_add($rref->{'rollrec_type'},$name,$rref); } # # Rebuild the button table. # @rrnames = rollrec_names(); $numrrnames = @rrnames; buildtable(0); # # Set the modified flag. # $modified++; settitle($title); } #--------------------------------------------------------------------------- # Routine: cmds_rename() # # Purpose: This routine creates the rename rollrec window for the # selected rollrec. # sub cmds_rename { my @selected = (); # Selected rollrec names. my $numsel; # Number of selected rollrecs. my $rrind; # Index of selected rollrec. my $dbx; # Error dialog box. # print STDERR "cmds_rename: down in Rename Selected Rollrec\n"; # # Get the list of selected rollrec names. # @selected = selected_rrnames(); $numsel = @selected; # # Complain if there wasn't a selected rollrec. # if($numsel == 0) { $dbx = $wm->Dialog(-title => 'Rename Selected Rollrec', -text => "One rollrec must be selected to use the Rename Rollrec command", -buttons => ["Okay"]); $dbx->Show(); return; } # # Complain if there was more than one selected rollrec. # if($numsel > 1) { $dbx = $wm->Dialog(-title => 'Rename Selected Rollrec', -text => "A single rollrec must be selected to use the Rename Rollrec command", -buttons => ["Okay"]); $dbx->Show(); return; } # # Let user know that modified rollrecs must be saved prior to the # rollrec rename. If the user is okay with this, we'll save the # contents of the rollrec. # if($modified) { my $dret; # Return value from dialog. $dbx = $wm->Dialog(-title => 'Rename Selected Rollrec', -text => "The rollrec file has been modified. In order to rename the selected rollrec, the changes will be saved to the rollrec file", -buttons => ["Okay", "Cancel"]); $dret = $dbx->Show(); return if($dret eq 'Cancel'); file_save(); } # # Create the rename-rollrec window. # $rrind = $selected[0]; renamewindow($rrnames[$rrind]); } #--------------------------------------------------------------------------- # Routine: cmds_verify() # # Purpose: This routine verifies a rollrec file. If the summary flag # was given, then a dialog box will be created that contains # the names and error counts of each bad rollrec. If the # summary flag wasn't given, then an edit window will be # put up for each bad rollrec. # sub cmds_verify { my $summary = shift; # Summary-only flag. my %errcnts = (); # Counts of errors. my $errcnt = 0; # Rollrecs with errors. my $dbx; # Dialog box. my $rrtab; # Bad rollrec table. my $lab; # Label for table. my $rowind = 0; # Error table row index. my $errrows; # Rows in table. my $sbars = 'e'; # Scrollbars. # print STDERR "cmds_verify: down in Verify Rollrec File\n"; # # See if any rollrecs have problems. # foreach my $rrn (reverse(sort(@rrnames))) { my $errors = 0; # Errors for rollrec. my $warns = 0; # Warnings for rollrec. my $problems; # Errs and/or warns for rollrec. # # Check this rollrec. # ($warns,$errors) = goodrollrec($rrn,0); # # Get the count of rollrec problems. If there were any # problems, add 'em to the error count hash. # $problems = $errors; $problems += $warns if($givewarnings); if($problems) { $errcnts{$rrn}{'warns'} = $warns; $errcnts{$rrn}{'errors'} = $errors; $errcnt++; } # # If there were problems and the user wants more than a # summary, we'll put up an edit window for the rollrec # and mark up its problem fields. # if($problems && !$summary) { editwindow($rrn,0); goodrollrec($rrn,1); } } # # If there weren't any errors, we'll put up a dialog box saying so # and then return once it's dismissed. # if($errcnt == 0) { $dbx = $wm->Dialog(-title => 'Rollrecs Valid', -text => "Rollrecs passed validity checks", -buttons => ["Done"]); $dbx->Show(); return; } # # Return if the user doesn't want an error summary. # return if(!$summary); # # Get the row count, which is the number of erring rollrecs plus # a header row. # If there's only a few rows, we'll dump the scrollbar. # $errrows = $errcnt + 1; $sbars = '' if($errrows < 4); # # Build a dialog box to hold an error summary. # $dbx = $wm->DialogBox(-title => 'Rollrecs With Errors', -buttons => ["Done"]); # # Build a table to hold the rollrec names. # $rrtab = $dbx->Table(-rows => $errrows, -columns => 3, -relief => 'raised', -scrollbars => $sbars, -borderwidth => 1, -fixedrows => 0, -takefocus => 1, ); # # Add some column headers. # $lab = $rrtab->Label(-text => 'Rollrec'); $rrtab->put($rowind,0,$lab); $lab = $rrtab->Label(-text => 'Warnings'); $rrtab->put($rowind,1,$lab); $lab = $rrtab->Label(-text => 'Errors'); $rrtab->put($rowind,2,$lab); $rowind++; # # Add the selected rollrec names to the table. # foreach my $rrn (sort(keys(%errcnts))) { my $err = $errcnts{$rrn}{'errors'}; my $wrn = $errcnts{$rrn}{'warns'}; $lab = $rrtab->Label(-text => $rrn); $rrtab->put($rowind,0,$lab); $lab = $rrtab->Label(-text => $wrn); $rrtab->put($rowind,1,$lab); $lab = $rrtab->Label(-text => $err); $rrtab->put($rowind,2,$lab); $rowind++; } # # Pack the error table. # $rrtab->pack(-side => 'top'); # # Display the dialog box. # $dbx->Show(); } #--------------------------------------------------------------------------- # Routine: view_selall() # # Purpose: This routine selects/deselects all rollrec names. # If any names are selected, the remainder will be selected. # If all names are selected, they will all be deselected. # sub view_selall { my @selected = (); # Selected rollrec names. # print STDERR "view_selall: down in Select All Rollrecs\n"; # # Get the list of selected rollrec names. # @selected = selected_rrnames(); # # If all the names are selected, we'll deselect everything. # If not all the names are selected, we'll select them all. # if(@selected == $numrrnames) { # # Unselect all names. # for(my $ind = 0; $ind < $numrrnames; $ind++) { rrname_deselect($ind); } $vw_selall->configure(-label => 'Select All Rollrecs'); } else { # # Select all names. # for(my $ind=0; $ind < $numrrnames; $ind++) { my $col; # Column index. my $row; # Row index. my $btn; # Rollrec button. ($col,$row) = ind2cr($ind); $btn = $rrnametab->get($row,$col); rrname_select($ind) if($btn->cget(-background) eq $RRTAB_UNSEL); } $vw_selall->configure(-label => 'Unselect All Rollrecs'); } } #--------------------------------------------------------------------------- # Routine: view_raiser() # # Purpose: This routine brings the rollrec edit windows to the front. # sub view_raiser { # print STDERR "view_raiser: down in Raise Rollrec Edit Windows\n"; # # Raise the edit windows. # foreach my $rrn (reverse(sort(keys(%editwinds)))) { $editwinds{$rrn}->raise; } } #--------------------------------------------------------------------------- # Routine: view_closeall() # # Purpose: This routine closes the selected rollrec edit windows. # The rollrec's buttons are deselected as well. # sub view_closeall { # print STDERR "view_closeall: down in Close All Selected Rollrecs\n"; # # Destroy all edit windows and remove them from the edit-window list. # foreach my $rrn (sort(keys(%editwinds))) { editbegone($rrn); } } #--------------------------------------------------------------------------- # Routine: view_closeone() # # Purpose: This routine closes the current rollrec edit window. # The rollrec's button is deselected as well. # sub view_closeone { my $rrn = shift; # print STDERR "view_closeone: down in Close Selected Rollrec\n"; editbegone($rrn); } #--------------------------------------------------------------------------- # Routine: editwindow() # # Purpose: This routine creates a new rollrec-edit window. # sub editwindow { my $rrn = shift; # Name of rollrec to edit. my $newflag = shift; # New-rollrec flag. my $editwin; # Edit window. my $eframe; # Edit frame. my $edittab; # Edit table. my $etlen = @ET_LABELS; # Row-length of table. my $frm; # Frame widget. my $lab; # Label widget. my $ent; # Entry widget. my $rb; # Radiobutton widget. my $btn; # Button widget. my $casca; # Cascading menu widget. my $rrec; # Rollrec reference. my $llev; # Logging level. # print STDERR "editwindow: down in Edit Selected Rollrecs\n"; # # If we've already got an edit window for this rollrec, we'll raise # that window and return. # if(defined($editwinds{$rrn})) { $editwinds{$rrn}->focus; return; } # # Get this rollrec's data. # $rrec = rollrec_fullrec($rrn); # # If this is a new rollrec, we'll set some defaults. # if(!rollrec_exists($rrn)) { $rrec->{'rollrec_type'} = 'roll'; $rrec->{'keyrec'} = "$rrn.krf"; $rrec->{'zonefile'} = "$rrn.signed"; $rrec->{'zonename'} = "$rrn"; } # # Add the rollrec's data to the %rollrecs hash. # $rollrecs{$rrn}{'administrator'} = $rrec->{'administrator'}; $rollrecs{$rrn}{'directory'} = $rrec->{'directory'}; $rollrecs{$rrn}{'display'} = $rrec->{'display'}; $rollrecs{$rrn}{'keyrec'} = $rrec->{'keyrec'}; $rollrecs{$rrn}{'loglevel'} = $rrec->{'loglevel'}; $rollrecs{$rrn}{'maxttl'} = $rrec->{'maxttl'}; $rollrecs{$rrn}{'rollrec_type'} = $rrec->{'rollrec_type'}; $rollrecs{$rrn}{'zonefile'} = $rrec->{'zonefile'}; $rollrecs{$rrn}{'zonegroup'} = $rrec->{'zonegroup'}; if(!defined($rrec->{'zonename'})) { $rollrecs{$rrn}{'zonename'} = $rrn; } else { $rollrecs{$rrn}{'zonename'} = $rrec->{'zonename'}; } # # Set up the radio buttons' data areas for the record type and # the display flag. # $editrbs{$rrn} = $rollrecs{$rrn}{'rollrec_type'} eq 'roll' ? 1 : 0; if(!exists($rollrecs{$rrn}{'display'}) || !defined($rollrecs{$rrn}{'display'})) { $editdfs{$rrn} = -1; } elsif($rollrecs{$rrn}{'display'} == 0) { $editdfs{$rrn} = 0; } elsif($rollrecs{$rrn}{'display'} == 1) { $editdfs{$rrn} = 1; } # # Create a new window to hold our edit session. Bind up some # key accelerators, too. # $editwin = MainWindow->new(-relief => 'raised', -title => "$rrn", -borderwidth => 1); $editwin->bind('', \&file_quit); $editwin->bind('', [\&editbegone, $rrn]); $editwin->bind('', \&view_closeone); $editwin->bind('', \&view_closeall); # # Now make the containers for the window. # $eframe = $editwin->Frame(-relief => 'raised', -borderwidth => 1); $eframe->pack(-fill => 'x'); # # Create a table to hold the rollrec data. # $edittab = $eframe->Table(-rows => $etlen, -columns => 2, -relief => 'raised', -scrollbars => '', -borderwidth => 1, -fixedrows => 0, -takefocus => 1, ); #---------------- # # Set the field column. # for(my $ind = $ROW_FIRST; $ind <= $ROW_LAST; $ind++) { $lab = $eframe->Label(-text => $ET_LABELS[$ind],-anchor => 'w'); $lab->pack(-fill => 'x', -side => 'top'); $edittab->put($ind,$COL_FIELD,$lab); } #---------------- # # Record type: Add the stuff for the record type. # $frm = $eframe->Frame(-relief => 'raised', -borderwidth => 1); $rb = $frm->Radiobutton(-text => 'Roll', -variable => \$editrbs{$rrn}, -value => 1); $rb->pack(-fill => 'x', -side => 'left'); $rb = $frm->Radiobutton(-text => 'Skip', -variable => \$editrbs{$rrn}, -value => 0); $rb->pack(-fill => 'x', -side => 'left'); $frm->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_TYPE,$COL_DATA,$frm); #---------------- # # Zonename: Add the stuff for the rollrec's zonename. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'zonename'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_ZONENAME,$COL_DATA,$ent); #---------------- # # Zonefile: Add the stuff for the rollrec's zonefile. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'zonefile'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_ZONEFILE,$COL_DATA,$ent); #---------------- # # Keyrec: Add the stuff for the rollrec's keyrec. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'keyrec'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_KEYREC,$COL_DATA,$ent); #---------------- # # Zonegroup: Add the stuff for the rollrec's zonegroup. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'zonegroup'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_ZONEGROUP,$COL_DATA,$ent); #---------------- # # Administrator: Add the stuff for the rollrec's admin mail. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'administrator'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_ADMIN,$COL_DATA,$ent); #---------------- # # Directory: Add the stuff for the rollrec's directory. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'directory'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_DIR,$COL_DATA,$ent); #---------------- # # Display: Add the stuff for the rollrec's display flag. # $frm = $eframe->Frame(-relief => 'raised', -borderwidth => 1); $rb = $frm->Radiobutton(-text => 'On', -variable => \$editdfs{$rrn}, -value => 1); $rb->pack(-fill => 'x', -side => 'left'); $rb = $frm->Radiobutton(-text => 'Off', -variable => \$editdfs{$rrn}, -value => 0); $rb->pack(-fill => 'x', -side => 'left'); $rb = $frm->Radiobutton(-text => 'Default', -variable => \$editdfs{$rrn}, -value => -1); $rb->pack(-fill => 'x', -side => 'left'); $frm->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_DISPLAY,$COL_DATA,$frm); #---------------- # # Logging level: Add the stuff for the rollrec's log level. # # # Get the label for the logging level's menu button. If it's defined # in the rollrec, we'll make sure we have the string value. If we # can't convert it, we'll use a dummy error value. If it isn't # defined in the rollrec, we'll use "default" for the button label. # if(defined($rollrecs{$rrn}{'loglevel'})) { $llev = rolllog_str($rollrecs{$rrn}{'loglevel'}); if($llev eq '') { $llev = ''; } } else { $llev = 'default'; } # # Create the menu button. # $ent = $eframe->Menubutton(-text => $llev, -tearoff => 0); # # Add a new radiobutton for each logging level. # $casca = $ent->cascade(-label => ''); foreach $llev (rolllog_levels()) { $casca->radiobutton(-label => "$llev", -variable => \$rollrecs{$rrn}{'loglevel'}, -command => [\&setloglvl, $ent, $llev]); } # # Add a default entry. # $casca->radiobutton(-label => "default", -variable => \$rollrecs{$rrn}{'loglevel'}, -command => [\&setloglvl, $ent, 'default']); # # Make it all available to the user. # $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_LOG,$COL_DATA,$ent); #---------------- # # Max-TTL: Add the stuff for the rollrec's maximum TTL. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'maxttl'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_MAXTTL,$COL_DATA,$ent); #---------------- # # ZSArgs: Add the stuff for the rollrec's zonesigner arguments. # $ent = $eframe->Entry(-textvariable => \$rollrecs{$rrn}{'zsargs'}); $ent->pack(-fill => 'x', -side => 'top'); $edittab->put($ROW_ZSARGS,$COL_DATA,$ent); #---------------- # # Done adding our data. Do another pack, just for kicks. # $edittab->pack(-side => 'top'); # # Add a button to dismiss the window. # $btn = $eframe->Button(-text => 'Save', -command => [\&editsaver, $rrn, $newflag]); $btn->pack(-side => 'left', -fill => 'x', -expand => 1); $btn = $eframe->Button(-text => 'Cancel', -command => [\&editbegone, $rrn]); $btn->pack(-side => 'left', -fill => 'x', -expand => 1); # # Save the new edit window in the hash table of edit windows. # $editwinds{$rrn} = $editwin; $edittabs{$rrn} = $edittab; } #--------------------------------------------------------------------------- # Routine: renamewindow() # # Purpose: This routine creates a new rollrec-rename window. # sub renamewindow { my $rrn = shift; # Name of rollrec to rename. my $dbx; # Error dialog box. my $renwin; # Rename window. ########## my $rframe; # Rename frame. my $rentab; # Rename table. my $frm; # Frame widget. my $lab; # Label widget. my $ent; # Entry widget. my $btn; # Button widget. # print STDERR "renamewindow: down in Rename Rollrec\n"; # # If there's a rename window for this rollrec, we'll give an error # and return. # if(defined($renwinds{$rrn})) { $dbx = $wm->Dialog(-title => 'Rename Selected Rollrec', -text => "This rollrec is already being renamed", -buttons => ["Okay"]); $dbx->Show(); return; } # # If there's an edit window for this rollrec, we'll give an error # and return. # if(defined($editwinds{$rrn})) { $dbx = $wm->Dialog(-title => 'Rename Selected Rollrec', -text => "Unable to rename a rollrec while it is being edited", -buttons => ["Okay"]); $dbx->Show(); return; } # # Create a new window to hold our rename session. Bind up some # key accelerators, too. # $renwin = MainWindow->new(-relief => 'raised', -title => "Rename $rrn", -borderwidth => 1); $renwin->bind('', \&file_quit); $renwin->bind('', [\&renamebegone, $rrn]); # # Now make the containers for the window. # $rframe = $renwin->Frame(-relief => 'raised', -borderwidth => 1); $rframe->pack(-fill => 'x'); # # Create a table to hold the rollrec data. # $rentab = $rframe->Table(-rows => 2, -columns => 2, -relief => 'raised', -scrollbars => '', -borderwidth => 1, -fixedrows => 0, -takefocus => 1, ); # # Add the label column. # $lab = $rframe->Label(-text => 'New rollrec name',-anchor => 'w'); $lab->pack(-fill => 'x', -side => 'top'); $rentab->put(0,0,$lab); # # Add the empty field for the rollrec's new name. # $rollrecs{$rrn}{'newname'} = ''; $ent = $rframe->Entry(-textvariable => \$rollrecs{$rrn}{'newname'}); $ent->pack(-fill => 'x', -side => 'top'); $rentab->put(0,1,$ent); # # Done adding our data. Do another pack, just for kicks. # $rentab->pack(-side => 'top'); # # Add a button to dismiss the window. # $btn = $rframe->Button(-text => 'Rename', -command => [\&renamesaver, $rrn]); $btn->pack(-side => 'left', -fill => 'x', -expand => 1); $btn = $rframe->Button(-text => 'Cancel', -command => [\&renamebegone, $rrn]); $btn->pack(-side => 'left', -fill => 'x', -expand => 1); # # Save the new rename window in the hash table of rename windows. # $renwinds{$rrn} = $renwin; $rentabs{$rrn} = $rentab; } #--------------------------------------------------------------------------- # Routine: setloglvl() # # Purpose: Set the logging level label in an edit window's menu button. # sub setloglvl { my $ent = shift; # Menu label to change. my $llev = shift; # New menu label. $ent->configure(-text => $llev); } ############################################################################## # # Utility routines # ############################################################################## #--------------------------------------------------------------------------- # Routine: readrrf() # sub readrrf { my $rrf = shift; # Rollrec file. my @names; # Rollrec names. # # If the specified file doesn't exist, ask the user if we should # continue or quit. # if(! -e $rrf) { my $dlg; # Warning dialog widget. my $ret; # Warning response. $dlg = $wm->Dialog(-title => 'Warning', -text => "$curnode does not exist", -buttons => ["Continue", "Quit" ]); $ret = $dlg->Show(); return(1) if($ret eq "Continue"); file_quit(); } # # Ensure the file is actually a rollrec file. # if(dt_filetype($rrf) ne "rollrec") { my $curnode = getnode($rrf); errorbox("$curnode is not a rollrec file; unable to continue"); return(0); } # # Zap the old data. # @rrnames = (); @rollrecs = (); # # Get data from the rollrec file. # rollrec_read($rrf); @rrnames = rollrec_names(); $numrrnames = @rrnames; # # Initialize the rollrecs hash for each rollrec. # foreach my $rrn (@rrnames) { my $rrec; # This rollrec's data. # # Get this rollrec's data. # $rrec = rollrec_fullrec($rrn); # # Add the rollrec's data to the %rollrecs hash. # $rollrecs{$rrn}{'administrator'} = $rrec->{'administrator'}; $rollrecs{$rrn}{'directory'} = $rrec->{'directory'}; $rollrecs{$rrn}{'display'} = $rrec->{'display'}; $rollrecs{$rrn}{'keyrec'} = $rrec->{'keyrec'}; $rollrecs{$rrn}{'loglevel'} = $rrec->{'loglevel'}; $rollrecs{$rrn}{'maxttl'} = $rrec->{'maxttl'}; $rollrecs{$rrn}{'rollrec_type'} = $rrec->{'rollrec_type'}; $rollrecs{$rrn}{'zonefile'} = $rrec->{'zonefile'}; $rollrecs{$rrn}{'zonegroup'} = $rrec->{'zonegroup'}; $rollrecs{$rrn}{'zonename'} = $rrec->{'zonename'}; $rollrecs{$rrn}{'zsargs'} = $rrec->{'zsargs'}; # # Set up the radio buttons' data areas for the record type and # the display flag. # $editrbs{$rrn} = $rollrecs{$rrn}{'rollrec_type'} eq 'roll' ? 1 : 0; if(!exists($rollrecs{$rrn}{'display'}) || !defined($rollrecs{$rrn}{'display'})) { $editdfs{$rrn} = -1; } elsif($rollrecs{$rrn}{'display'} == 0) { $editdfs{$rrn} = 0; } elsif($rollrecs{$rrn}{'display'} == 1) { $editdfs{$rrn} = 1; } } # # Reset the modified-keyrec file flag. # $modified = 0; settitle($curnode); return(1); } #--------------------------------------------------------------------------- # Routine: getnode() # # Purpose: Get the node of a pathname. # sub getnode { my $path = shift; # Path to nodify. my @pathelts; # Path elements. my $pathnode; # Last path elements. @pathelts = split /\//, $path; $pathnode = pop @pathelts; return($pathnode); } #--------------------------------------------------------------------------- # Routine: editsaver() # # Purpose: Save a rollrec and get rid of its edit window. # sub editsaver { my $rrn = shift; # Name of rollrec to save. my $newflag = shift; # New-rollrec flag. # print STDERR "editsaver: saver rollrec edits for $rrn\n"; $rollrecs{$rrn}{'display'} = $editdfs{$rrn}; # # If this is a valid rollrec, we'll get rid of the edit window # and save the data. If this is a new rollrec, we'll also add # a rollrec button to the main window. # if(goodrollrec($rrn,1)) { # # If this is a new rollrec, add the name to the rollrec # list and then rebuild the main button table. # if($newflag) { push @rrnames, $rrn; $numrrnames++; buildtable(0); } # # Get rid of the edit window and save the rollrec data. # editbegone($rrn); saverollrec($rrn); } } #--------------------------------------------------------------------------- # Routine: renamesaver() # # Purpose: Save a rollrec and get rid of its rename window. # sub renamesaver { my $rrn = shift; # Name of rollrec to save. my $newname; # New rollrec name. my $newname2; # Copy of new rollrec name. # print STDERR "renamesaver: rename rollrec edits for $rrn\n"; $newname = $rollrecs{$rrn}{'newname'}; # # Ensure a new name was given. # if($newname eq '') { errorbox("A new rollrec name must be given"); delete $renwinds{$rrn}; delete $rentabs{$rrn}; return; } # # Ensure a *valid* new name was given. # $newname2 = $newname; $newname2 =~ s/[a-zA-Z0-9\/\-+_.,: \@\t]//g; if(length($newname2) > 0) { errorbox("\"$newname\" is an invalid rollrec name"); delete $renwinds{$rrn}; delete $rentabs{$rrn}; return; } # # Rename the rollrec. # rollrec_rename($rrn,$newname); $modified = 1; # # Write the rollrec file contents and rebuild our rollrec list. # rollrec_close(); buildtable(1); # # Get rid of the rename window. # renamebegone($rrn,$newname); $modified = 0; } #----------------------------------------------------------------------------- # Routine: goodrollrec() # # Purpose: Ensure that the rollrec has valid data. # # The following fields may be empty: # - administrator # - directory # - display # - loglevel # - maxttl # - zonegroup # # Error checks are: # - empty zonename field # - invalid logging level # - non-positive maxttl # - invalid display value # - zone file is not a regular file # - keyrec file is not a regular file # # Warning checks are: # - zone directory doesn't exist # - zone directory isn't a directory # - zone file doesn't exist # - zone file isn't a regular file # - keyrec file doesn't exist # - keyrec file isn't a regular file # sub goodrollrec { my $rrn = shift; # Name of the rollrec. my $upd = shift; # Update-window flag. # print STDERR "goodrollrec: down in ($rrn)\n"; my $errors = 0; # Error count. my $warns = 0; # Warning count. my $problems = 0; # Problem count. my $admin; # Administrator email address. my $dispflag; # Display flag. my $krfile; # Keyrec file. my $loglevel; # Logging level. my $maxttl; # Maximum TTL. my $zonedir; # Directory. my $zonefile; # Zonefile. my $zonegroup; # Zonegroup. my $zonename; # Zonename. my $zsargs; # Zonesigner arguments. # # Reset the message fields. # if($upd) { addmsg($rrn,$COL_FIELD,0,' '); addmsg($rrn,$COL_DATA,0,' '); } # # Strip all whitespace from the beginning and end of the fields. # foreach my $fld (@EDITFIELDS) { next if(!exists($rollrecs{$rrn}{$fld}) || ($rollrecs{$rrn}{$fld} eq '')); $rollrecs{$rrn}{$fld} =~ s/^[ \t]*//; $rollrecs{$rrn}{$fld} =~ s/[ \t]*$//; } # # Get the rollrec data. # $admin = $rollrecs{$rrn}{'administrator'}; $dispflag = $rollrecs{$rrn}{'display'}; $krfile = $rollrecs{$rrn}{'keyrec'}; $loglevel = $rollrecs{$rrn}{'loglevel'}; $maxttl = $rollrecs{$rrn}{'maxttl'}; $zonedir = $rollrecs{$rrn}{'directory'}; $zonefile = $rollrecs{$rrn}{'zonefile'}; $zonegroup = $rollrecs{$rrn}{'zonegroup'}; $zsargs = $rollrecs{$rrn}{'zsargs'}; if(!defined($rollrecs{$rrn}{'zonename'})) { $zonename = $rrn; } else { $zonename = $rollrecs{$rrn}{'zonename'}; } # # Reset all the label colors. # if($upd) { fieldcolor($ROW_ZONEFILE,$rrn,$NORMALCOLOR); fieldcolor($ROW_KEYREC,$rrn,$NORMALCOLOR); fieldcolor($ROW_ZONEGROUP,$rrn,$NORMALCOLOR); fieldcolor($ROW_ADMIN,$rrn,$NORMALCOLOR); fieldcolor($ROW_DIR,$rrn,$NORMALCOLOR); fieldcolor($ROW_DISPLAY,$rrn,$NORMALCOLOR); fieldcolor($ROW_LOG,$rrn,$NORMALCOLOR); fieldcolor($ROW_MAXTTL,$rrn,$NORMALCOLOR); fieldcolor($ROW_ZSARGS,$rrn,$NORMALCOLOR); } # # Check the zonename. # if($zonename eq '') { errval($ROW_ZONENAME,$rrn,"no zone name specified") if($upd); $errors++; } # # Check the zone file. # if($zonefile eq '') { errval($ROW_ZONEFILE,$rrn,"no zone file specified") if($upd); $errors++; } else { if((!-e $zonefile) && $givewarnings) { warnval($ROW_ZONEFILE,$rrn,"zone file \"$zonefile\" does not exist") if($upd); $warns++; } elsif((!-f $zonefile) && $givewarnings) { warnval($ROW_ZONEFILE,$rrn,"zone file \"$zonefile\" is not a regular file") if($upd); $warns++; } } # # Check the keyrec file. # if($krfile eq '') { errval($ROW_KEYREC,$rrn,"no keyrec file specified") if($upd); $errors++; } else { if((!-e $krfile) && $givewarnings) { warnval($ROW_KEYREC,$rrn,"keyrec file \"$krfile\" does not exist") if($upd); $warns++; } elsif((!-f $krfile) && $givewarnings) { warnval($ROW_KEYREC,$rrn,"keyrec file \"$krfile\" is not a regular file") if($upd); $warns++; } } # # No validity checks for the zonegroup. # # # No validity checks for the administrator. # # # Check the directory. # if(exists($rollrecs{$rrn}{'directory'})) { if(($rollrecs{$rrn}{'directory'}) ne '') { if(!-e $zonedir) { warnval($ROW_DIR,$rrn,"directory \"$zonedir\" does not exist") if($upd); $warns++; } elsif(!-d $zonedir) { warnval($ROW_DIR,$rrn,"directory \"$zonedir\" is not a directory") if($upd); $warns++; } } } # # Make sure we've got a valid display flag. # if(defined($dispflag)) { if(($dispflag != 0) && ($dispflag != 1) && ($dispflag != -1)) { errval($ROW_DISPLAY,$rrn,"invalid display flag \"$dispflag\"") if($upd); $errors++; } } # # Make sure we've got a valid logging level. # if(exists($rollrecs{$rrn}{'loglevel'})) { if(($rollrecs{$rrn}{'loglevel'} ne '') && ($rollrecs{$rrn}{'loglevel'} ne 'default')) { if(rolllog_level($loglevel,0) < 0) { errval($ROW_LOG,$rrn,"invalid loglevel \"$loglevel\"") if($upd); $errors++; } } } # # Make sure we've got a valid maximum TTL. # if(exists($rollrecs{$rrn}{'maxttl'})) { if($rollrecs{$rrn}{'maxttl'} ne '') { if($maxttl < 1) { errval($ROW_MAXTTL,$rrn,"invalid maxttl \"$maxttl\"") if($upd); $errors++; } } } # # No error checks for zonesigner arguments. # # # If we found any errors or warnings, we'll add a message about them. # if($upd) { addmsg($rrn,$COL_FIELD,$errors,"error") if($errors); addmsg($rrn,$COL_DATA,$warns,"warn") if($warns); } # # Add the warning count to the error count if we shouldn't ignore # warnings # $problems = $errors; $problems += $warns if($givewarnings); # # If we've found this rollrec is good, we'll make some adjustments. # if(!$errors) { # # Delete the administrator if it's empty. # if($rollrecs{$rrn}{'administrator'} eq '') { delete $rollrecs{$rrn}{'administrator'}; } # # Delete the directory if it's empty. # if(($rollrecs{$rrn}{'directory'}) eq '') { delete $rollrecs{$rrn}{'directory'}; } # # Delete the loglevel if it's empty or the default was chosen. # if(($rollrecs{$rrn}{'loglevel'} eq '') || ($rollrecs{$rrn}{'loglevel'} eq 'default')) { delete $rollrecs{$rrn}{'loglevel'}; } # # Delete the max-ttl if it's empty. # if($rollrecs{$rrn}{'maxttl'} eq '') { delete $rollrecs{$rrn}{'maxttl'}; } # # Delete the zonegroup if it's empty. # if(($rollrecs{$rrn}{'zonegroup'}) eq '') { delete $rollrecs{$rrn}{'zonegroup'}; } # # Delete the zsargs if it's empty. # if($rollrecs{$rrn}{'zsargs'} eq '') { delete $rollrecs{$rrn}{'zsargs'}; } } return($warns,$errors) if(!$upd); return(!$problems); } #----------------------------------------------------------------------------- # Routine: saverollrec() # # Purpose: Save the rollrec's data into the rollrec module data. # # sub saverollrec { my $rrn = shift; # Name of the rollrec. my $typestr; # Calculated rollrec type. # print STDERR "saverollrec: down in ($rrn)\n"; # # Get the rollrec type from %editrbs. # $typestr = $editrbs{$rrn} ? "roll" : "skip"; # # Get the display flag from %editdfs. # if(!exists($editdfs{$rrn}) || !defined($editdfs{$rrn}) || ($editdfs{$rrn} == -1)) { delete($rollrecs{$rrn}{'display'}); } elsif($editdfs{$rrn} == 0) { $rollrecs{$rrn}{'display'} = 0; } elsif($editdfs{$rrn} == 1) { $rollrecs{$rrn}{'display'} = 1; } # # Set the rollrec's type. # rollrec_rectype($rrn,$typestr); # # Save the fields into the rollrec itself. If the field exists # in %rollrecs{$rrn}, we'll save the value. If the field does # not exist, we'll delete the field. # foreach my $field (@EDITFIELDS) { if(exists($rollrecs{$rrn}{$field})) { rollrec_setval($rrn,$field,$rollrecs{$rrn}{$field}); } else { rollrec_delfield($rrn,$field); } } # # Mark this rollrec as having been modified. # rrmodified($rrn); } #--------------------------------------------------------------------------- # Routine: rrmodified() # # Purpose: Mark a rollrec as having been modified. # sub rrmodified { my $rrn = shift; # Modified rollrec. # # Increment the modified-keyrec flag. # $modified++; $modified{$rrn} = 1; settitle($title); # # Re-populate and update the table. # for(my $ind = 0; $ind < $numrrnames; $ind++) { my $row; # Cell's row index. my $col; # Cell's column index. my $btn; # Button widget. my $name; # Label of button. # # Get the column and row indices. # ($col,$row) = ind2cr($ind); # # Get this button's label. # $btn = $rrnametab->get($row,$col); $name = $btn->cget(-text); # # Modify the name of just the button we're looking for. # next if($name ne $rrn); $btn->configure(-text => "* $name"); } } #--------------------------------------------------------------------------- # Routine: rrsaved() # # Purpose: Mark the rollrecs as having been saved. # sub rrsaved { # # Re-populate and update the table. # # print STDERR "rrsaved: numrrnames - $numrrnames\n"; for(my $ind = 0; $ind < $numrrnames; $ind++) { my $row; # Cell's row index. my $col; # Cell's column index. my $btn; # Button widget. my $name; # Label of button. # # Get the column and row indices. # ($col,$row) = ind2cr($ind); # # Get this button's label. # $btn = $rrnametab->get($row,$col); $name = $btn->cget(-text); $name =~ s/^\* //; # # Skip buttons that haven't been modified. # next if(!$modified{$name}); # # Modify the the button's label. # $btn->configure(-text => $name); } # # Reset the modified-keyrec flag. # $modified = 0; %modified = (); settitle($title); } #--------------------------------------------------------------------------- # Routine: errval() # # Purpose: Take an error action. # sub errval { my $row = shift; # Errant rollrec's row. my $rrn = shift; # Errant rollrec's name. my $msg = shift; # Error message. # print STDERR "errval: <$rrn>\t$msg\n"; fieldcolor($row,$rrn,$ERRCOLOR); } #--------------------------------------------------------------------------- # Routine: warnval() # # Purpose: Take a warning action. # sub warnval { my $row = shift; # Errant rollrec's row. my $rrn = shift; # Errant rollrec's name. my $msg = shift; # Warning message. # print STDERR "warnval: <$rrn>\t$msg\n"; fieldcolor($row,$rrn,$WARNCOLOR); } #--------------------------------------------------------------------------- # Routine: fieldcolor() # # Purpose: Change the text color of a given edit window field. # sub fieldcolor { my $row = shift; # Rollrec's row. my $rrn = shift; # Rollrec's name. my $clr = shift; # New color. my $tbl; # Table to modify. my $wij; # Widget to modify. # # Get the label widget for the field. # $tbl = $edittabs{$rrn}; $wij = $tbl->get($row,$COL_FIELD); # # Turn the label widget's color. # $wij->configure(-foreground => $clr); } #--------------------------------------------------------------------------- # Routine: addmsg() # # Purpose: Add a message to one of the edit window's message columns. # If the count parameter is zero, then we'll zap the column. # sub addmsg { my $rrn = shift; # Rollrec name. my $col = shift; # Column to modify. my $cnt = shift; # Thing count. my $thing = shift; # Thing. my $tbl; # Table to modify. my $lab; # New label. my $str = ' '; # Error message. if($cnt) { $str = "$cnt $thing"; $str = $str . 's' if($cnt != 1); } $tbl = $edittabs{$rrn}; $lab = $tbl->Label(-text => $str, -anchor => 'w'); $lab->pack(-fill => 'x', -side => 'top'); $tbl->put($ROW_MSG,$col,$lab); } #--------------------------------------------------------------------------- # Routine: toggle_ignwarn() # # Purpose: Toggle on /off the "Ignore Edit Warnings" menu command. # # If we're turning off edit warnings, we'll also go through # any open edit windows and turn off any "warned" lines. # Error lines will remain marked. # sub toggle_ignwarn { if($givewarnings) { $givewarnings = 0; $tog_ignwarn->configure(-label => $IGNORE_OFF); # # Turn off all the warning labels in all the edit windows. # foreach my $rrn (keys(%edittabs)) { for(my $row = $ROW_FIRST; $row <= $ROW_LAST; $row++) { my $clr; # Current row color. my $wij; # Row widget. # # Skip non-warning rows. # $wij = $edittabs{$rrn}->get($row,$COL_FIELD); $clr = $wij->cget(-foreground); next if($clr ne $WARNCOLOR); # # Change the label color. # fieldcolor($row,$rrn,$NORMALCOLOR); } addmsg($rrn,$COL_DATA,0,' '); } } else { $givewarnings = 1; $tog_ignwarn->configure(-label => $IGNORE_ON); } } #--------------------------------------------------------------------------- # Routine: toggle_namefilt() # # Purpose: Toggle on /off the "Use Name Filter" menu command. # sub toggle_namefilt { if($namefilter) { $namefilter = 0; $tog_namefilt->configure(-label => $FILTER_OFF); } else { $namefilter = 1; $tog_namefilt->configure(-label => $FILTER_ON); } } #--------------------------------------------------------------------------- # Routine: set_btncols() # # Purpose: # sub set_btncols { my $err = shift; # Error flag. my $dlg; # Dialog widget. my $lab; # Label for dialog box. my $ent; # Entry for dialog box. my $col; # New column count. my $ret; # Dialog box return. # # Create the new dialog box. # $dlg = $wm->DialogBox(-title => 'Set Columns for Button Window', -buttons => ["Okay", "Cancel" ]); # # Add a label to the dialog. # $lab = $dlg->Label(-text => 'Enter New Column Count:'); $lab->pack(-side => 'left'); # # Add a text entry slot and focus on the entry. # $ent = $dlg->add('Entry'); $ent->pack(-side => 'left'); $dlg->configure(-focus => $ent); # # Add a potential error location to the dialog. # $lab = $dlg->Label(-text => ' '); $lab->pack(-side => 'bottom'); if($err) { $lab->configure(-text => "Count must be between 1 and $MAXCOLS", -foreground => 'red') } # # Show the dialog box and handle cancellations. # $ret = $dlg->Show(); return if($ret eq 'Cancel'); # # Get the user's column size. # $col = $ent->get(); # # If this is an invalid column count, give an error message and # ask again. # set_btncols(1) if(($col < 1) || ($col > $MAXCOLS)); # # Save the new column count and rebuild the table. # $columncount = $col; buildtable(0); } #--------------------------------------------------------------------------- # Routine: editbegone() # # Purpose: Destroy an edit window. In addition to deleting the window # itself, the rollrec is removed from several tables. These # tables are the list of edit windows (%editwinds), and the # edit window radio buttons (%editrbs and %editdfs). # # In some cases, this routine will be passed the edit window # widget instead of the rollrec name. If we couldn't find # the argument in the edit-window hash, we'll look up the # widget itself and recurse with the associated name. # sub editbegone { my $rrname = shift; # Name of rollrec whose editwin we'll destroy. my $editwin; # Edit window to destroy. # print STDERR "editbegone: destroying edit window for $rrname\n"; # # Don't do anything for a null name. # return if($rrname eq ''); # # Deselect the rollrec's button. # for(my $ind = 0; $ind < $numrrnames; $ind++) { # # Destroy the window and remove it from our edit-window list. # if($rrnames[$ind] eq $rrname) { rrname_deselect($ind); $editwinds{$rrname}->destroy(); delete($editwinds{$rrname}); delete($edittabs{$rrname}); return; } } # # Didn't find the name in the list of rollrec names, so maybe it's # a widget itself. If we find it in the list of edit windows, # we'll delete it here. # foreach my $rrn (keys(%editwinds)) { if($rrn == $rrname) { $editwinds{$rrname}->destroy(); delete($editwinds{$rrname}); delete($edittabs{$rrname}); return; } } } #--------------------------------------------------------------------------- # Routine: renamebegone() # # Purpose: Destroy a rename window. In addition to deleting the window # itself, the rollrec is removed from several tables. These # tables are the list of rename windows (%renwinds). # # In some cases, this routine will be passed the rename window # widget instead of the rollrec name. If we couldn't find # the argument in the rename-window hash, we'll look up the # widget itself and recurse with the associated name. # sub renamebegone { my $oldname = shift; # Old name of rollrec. my $newname = shift; # New name of rollrec. # print STDERR "renamebegone: destroying rename window for $oldname\n"; # # Don't do anything for a null name. # return if($oldname eq ''); return if($newname eq ''); # # Destroy the old name's rename window and remove it from our # rename-window list. # if(exists($renwinds{$oldname})) { $renwinds{$oldname}->destroy(); delete($renwinds{$oldname}); delete($rentabs{$oldname}); } # # Remove the new name from our rename-window list. # delete($renwinds{$newname}); delete($rentabs{$newname}); } #--------------------------------------------------------------------------- # Routine: helpbegone() # # Purpose: Destroy a help window. # sub helpbegone { $helpwin->destroy(); $inhelpwind = 0; } ############################################################################# #--------------------------------------------------------------------------- # Routine: errorbox() # # Purpose: Display an error dialog box. # sub errorbox { my $msg = shift; # Warning message. my $dlg; # Warning dialog widget. $dlg = $wm->Dialog(-title => "$NAME Error", -text => $msg, -default_button => "Okay", -buttons => ["Okay"]); $dlg->Show(); } #--------------------------------------------------------------------------- # Routine: errorbox_multi() # # Purpose: Display a multiline error dialog box. Newlines in the message # signal a new line (implemented with a new label) in the dialog # box. # sub errorbox_multi { my $msgs = shift; # Messages to display. my $dlg; # Warning dialog widget. my $lab; # Label for table. my @lines; # Lines in message. my $line; # Individual message line. $dlg = $wm->DialogBox(-title => "$NAME Error", -buttons => ["Okay"]); @lines = split /\n/, $msgs; foreach $line (@lines) { $lab = $dlg->Label(-text => $line); $lab->pack(-side => 'top'); } $dlg->Show(); } #--------------------------------------------------------------------------- # Routine: dbx_dups() # # Purpose: Puts up a dialog box with names of the duplicated rollrecs. # This is used for the "Merge Rollrecs" command. # sub dbx_dups { my @dupnames = @_; # Duplicated rollrecs. my $dbx; # Dialog box. my $rrtab; # Dup'd rollrec table. my $lab; # Label for table. my $rowind = 1; # Table row index. my $rows = @dupnames + 1; # Rows in table. my $sbars = 'e'; # Scrollbars. my $ret; # Dialog return. # # Build a dialog box to hold an error summary. # $dbx = $wm->DialogBox(-title => 'Duplicated Rollrecs', -buttons => ["Merge", "Cancel" ]); # # If there's only a few rows, we'll dump the scrollbar. # $sbars = '' if($rows < 4); # # Build a table to hold the duplicated rollrec names. # $rrtab = $dbx->Table(-rows => $rows, -columns => 1, -relief => 'raised', -scrollbars => $sbars, -borderwidth => 1, -fixedrows => 0, -takefocus => 1, ); # # Add a column header. # $lab = $rrtab->Label(-text => 'Duplicated Rollrecs'); $rrtab->put(0,0,$lab); # # Add the selected rollrec names to the table. # foreach my $rrn (sort {$a <=> $b} @dupnames) { $lab = $rrtab->Label(-text => $rrn, -anchor => 'w'); $rrtab->put($rowind,0,$lab); $rowind++; } # # Pack the error table and display the dialog box. # $rrtab->pack(-side => 'top'); $ret = $dbx->Show(); return($ret); } #--------------------------------------------------------------------------- # Routine: help_help() # # Purpose: Display a help window. # sub help_help { my $hframe; # Help frame. my $wdgt; # General widget. my $helpstr; $helpstr = " rollrec-editor - DNSSEC-Tools Rollrec GUI Editor SYNOPSIS rollrec-editor [options] DESCRIPTION rollrec-editor provides the capability for easy GUI-based management of rollrec files. A rollrec file contains one or more rollrec records. These records are used by the DNSSEC-Tools rollover utilities (rollerd, etc.) to describe zones' rollover state. Each zone's rollrec record contains such information as the zone file, the rollover phase, and logging level. rollrec files are text files and may be edited by any text editor. rollrec-editor allows editing of only those records a user should change and performs error checking on the data. When rollrec-editor starts, a window is created that has \"buttons\" for each rollrec record in the given rollrec file. (In this documentation, this window is called the Button Window.) Clicking on the buttons selects (or deselects) that zone. After one or more zones are selected, one of several commands may be executed. Commands allow modification and deletion of existing rollrec records, creation of new rollrec records, merging of rollrec files, and verification of file validity. rollrec-editor's commands are available through the menus and most have a keyboard accelerator. The commands are described in the manual page. When a rollrec record is selected for modification, a new window is created to hold the editable fields of the record. The fields may be modified in place. When editing is complete, the record is \"saved\". This does not save the modified rollrec into its on-disk file; the file must be saved explicitly from the Button Window. As stated above, verification checks are performed when saving an edited rollrec record. One set of checks ensures that files and directories associated with a zone actually exist. This check may be turned off at command start-up with the -ignore-warns command line option. It may be modified during execution with the \"Ignore Edit Warnings\" menu command. More information may be found in rollrec-editor's man page. "; # # If we've already got another help window, we'll give an error and # return. Otherwise, we'll turn on our in-helpwindow flag. # if($inhelpwind) { errorbox("Multiple help windows cannot be created\n"); return; } $inhelpwind = 1; # # Create a new window to hold our help info. Bind up some # key accelerators, too. # $helpwin = MainWindow->new(-relief => 'raised', -title => 'Help!', -borderwidth => 1); $helpwin->bind('',\&file_quit); $helpwin->bind('',\&helpbegone); # # Now make the containers for the window. # $hframe = $helpwin->Frame(-relief => 'raised', -borderwidth => 1); $hframe->pack(-fill => 'x'); # # Add the help data to the frame. # $wdgt = $hframe->Label(-text => $helpstr, -justify => 'left'); $wdgt->pack(-side => 'top'); # # Add a button to dismiss the window. # $wdgt = $hframe->Button(-text => 'Done', -command => \&helpbegone); $wdgt->pack(-side => 'top'); } #---------------------------------------------------------------------- # # Routine: settitle() # # Purpose: Set the title for use in the "Editing File" line. # sub settitle { my $name = shift; # Name to use. if($modified) { $name .= " (modified)" if(!$modset); $modset = 1; } $title = $name; } #---------------------------------------------------------------------- # # Routine: version() # # Purpose: Print the version number(s) and exit. # sub version { print STDERR "$VERS\n"; print STDERR "$DTVERS\n"; exit(0); } #--------------------------------------------------------------------------- # Routine: usage() # # Purpose: Print a usage message and exit. # sub usage { print STDERR "usage: rollrec-editor [options] \n"; print STDERR "\toptions:\n"; print STDERR "\t\t-ignore-warns ignore edit warnings\n"; print STDERR "\t\t-no-filter turn off name filtering\n"; print STDERR "\t\t-columns columns columns in button window\n"; print STDERR "\t\t-V program version\n"; exit(0); } 1; ############################################################################# =pod =head1 NAME rollrec-editor - DNSSEC-Tools Rollrec GUI Editor =head1 SYNOPSIS rollrec-editor [options] =head1 DESCRIPTION B provides the capability for easy GUI-based management of I files. A B file contains one or more I records. These records are used by the DNSSEC-Tools rollover utilities (B, etc.) to describe zones' rollover state. Each zone's I record contains such information as the zone file, the rollover phase, and logging level. I files are text files and may be edited by any text editor. B allows editing of only those records a user should change and performs error checking on the data. When B starts, a window is created that has "buttons" for each I record in the given I file. (In this documentation, this window is called the Button Window.) Clicking on the buttons selects (or deselects) that zone. After one or more zones are selected, one of several commands may be executed. Commands allow modification and deletion of existing I records, creation of new I records, merging of I files, and verification of file validity. B's commands are available through the menus and most have a keyboard accelerator. The commands are described below in the COMMANDS section. When a I record is selected for modification, a new window is created to hold the editable fields of the record. The fields may be modified in place. When editing is complete, the record is "saved". This does not save the modified I into its on-disk file; the file must be saved explicitly from the Button Window. As stated above, verification checks are performed when saving an edited I record. One set of checks ensures that files and directories associated with a zone actually exist. This check may be turned off at command start-up with the B<-ignore-warns> command line option. It may be modified during execution with the "Ignore Edit Warnings" menu command. =head2 Button Window Layout The Button Window contains a button for each I record in the selected file. The buttons are arranged in a table that with at least three columns. The number of columns may be set at command start-up with the B<-columns> command line option. It may be modified during execution with the "Columns in Button Window" menu command. When setting the number of columns, B minimizes the space required to display the selected file's I buttons. This will sometimes cause the number of columns to differ from that requested. For example, assume a I file has 12 I records. The following table shows how many rows and columns are given for each of the given column selections. column count rows columns 1 12 1 2 6 2 3 4 3 4 3 4 5 3 4 6 2 6 7 2 6 8 2 6 9 2 6 10 2 6 11 2 6 12 1 12 The actual rows and columns for a requested column count will vary in order to allow a "best-fit". =head2 UNDOING MODIFICATIONS B B has the ability to reverse modifications it has made to a I file. This historical restoration will only work for modifications made during a particular execution of B; modifications made during a previous execution may not be undone. After a "Save" operation, the data required for reversing modifications are deleted. This is not the case for the "Save As" operation. =head1 OPTIONS B supports the following options. =over 4 =item B<-columns columns> This option allows the user to specify the number of columns to be used in the Button Window. =item B<-ignore-warns> This option causes B to ignore edit warnings when performing validation checks on the contents of I records. =item B<-no-filter> This option turns off name filtering when B presents a file-selection dialog for choosing a new I file. If this option is not given, then the file-selection dialog will only list regular files with a suffix of B<.rrf>. =item B<-Version> Displays the version information for B and the DNSSEC-Tools package. =back =head1 COMMANDS B provides the following commands, organized by menus: File, Edit, Commands, Rollrecs, and Options. =head2 File Menu The File Menu contains commands for manipulating I files and stopping execution. =over 4 =item B Open a new I file. If the specified file does not exist, the user will be prompted for the action to take. If the user chooses the "Continue" action, then B will continue editing the current I file. If the "Quit" action is selected, then B will exit. =item B Save the current I file. The data for the "Undo Changes" command are purged, so this file will appear to be unmodified. Nothing will happen if no changes have been made. =item B Save the current I file to a name selected by the user. =item B Exit B. =back =head2 Edit Menu The Edit Menu contains commands for general editing operations. =over 4 =item B Reverse modifications made to the I records. This is B for the in-memory version of the I file. B =back =head2 Commands Menu The Commands Menu contains commands for modifying I records. =over 4 =item B Create a new I record. The user is given a new window in which to edit the user-modifiable I fields. A button for the new I record will be inserted into the Button Window. After editing is completed, the "Save" button will add the new I record to the in-memory I file. The file must be saved in order to have the new I added to the file. Potentially erroneous conditions will be reported to the user at save time. If the I flag has been turned on, then these warnings will not be reported. Errors (e.g., invalid log conditions) will always be reported. =item B Delete the selected I records. The buttons for each selected record will be removed from the Button Window. =item B Modify the selected I records. For every record selected for modification, the user is given a new window in which to edit the user-modifiable I fields. When the edit window goes away (after a "Save" or "Cancel"), the I record's button is deselected. After editing is completed, the "Save" button will add the new I record to the in-memory I file. The file must be saved in order to have the new I added to the file. Potentially erroneous conditions will be reported to the user at save time. If the I flag has been turned on, then these warnings will not be reported. Errors (e.g., invalid log conditions) will always be reported. =item B Rename the selected I record. The name in the I's "roll" or "skip" line will be changed to the new name. Only one I may be renamed at a time, and it may not be edited while the rename is taking place. If the I has been modified, the new contents B be written to disk prior to the rename happening. The user will be prompted to ensure that this the user wishes to continue. =item B Merge a I file with the currently open I file. After a successful merge, the I records in the second file will be added to the I of the currently open I file. If there are any I name collisions in the files, then the user will be asked whether to continue with the merge or cancel it. If the merge continues, then the conflicting I records from the "new" file will be discarded in favor of the currently open I file. =item B Verify the validity of the I file. The user-editable fields in the open I file are checked for validity. An edit window is opened for each I record that registers an error or warning. If the I flag has been turned on, then potentially erroneous conditions will not be reported. Errors (e.g., invalid log conditions) will always be reported. =item B Summarize the warning and error counts of the I file. Each I record in the open I file is checked for validity. If any warnings or errors are found, a window is displayed that lists the name of each I record and its warning and error counts. If the I flag has been turned on, then potentially erroneous conditions will not be reported. Errors (e.g., invalid log conditions) will always be reported. =back =head2 View Menu The View Menu contains miscellaneous commands for viewing edit windows. =over 4 =item B Ensure the I field is valid. If the filename starts with a '/', the file must be a regular executable file. =item I Ensure the I field is valid. If the filename starts with a '/', the file must be a regular executable file. =item I Ensure the I field is valid. If the filename starts with a '/', the file must be a regular executable file. =item I Ensure the I field is valid. If the filename starts with a '/', the file must be a regular executable file. =back The following path checks are performed for miscellaneous files and directories: =over 8 =item I Ensure the I field is valid. The file must be a character device file. =item I Ensure the I field is a regular file. =item I Ensure the I field is a regular file. =item I Ensure the I field is a directory. =back =head2 Rollover Daemon Checks The following checks are performed for B values: =over 8 =item I Ensure that the I flag is a valid boolean. =item I Ensure the I field is either 'gmt' or 'local'. =item I =item I ... I =item I ... I Ensure that the rollover phase commands are valid paths. Each of these fields is a semicolon-separated command list. The file checks are run on the commands to ensure the commands exist and are executable. Options and arguments to the commands are ignored, as is the I keyword. =item I Ensure that the I flag is a valid boolean. =item I Ensure that the log file for the B is valid. If the file exists, it must be a regular file. =item I Ensure that the logging level for the B is reasonable. The log level must be one of the following text or numeric values: tmi 1 Overly verbose informational messages. expire 3 A verbose countdown of zone expiration is given. info 4 Informational messages. phase 6 Current state of zone. err 8 Error messages. fatal 9 Fatal errors. Specifying a particular log level will causes messages of a higher numeric value to also be displayed. =item I Ensure that the B's sleep-time is reasonable. B's sleep-time must be at least one minute. =item I Ensure that the username for B is valid. If it's a username, it must be translatable to a uid; if it's a uid, it must translate to a known username. =item I Ensure that the zone error count is numeric and 0 or greater. =back =head2 NSEC3 Checks The following checks are performed for NSEC3-related values: =over 8 =item I Ensure that the I iteration count falls within the range used by B. The current values are from 1 - 65535. =item I Ensure that the I flag is a valid boolean. =item I Ensure that the I flag is a valid boolean. =back =head2 Miscellaneous Checks The following miscellaneous checks are performed: =over 8 =item I Ensure that the I field is defined and has a value. B does not try to validate the email address itself. =item I Ensure that the I directory is actually a directory. This check is only performed if the I flag is set on. =item I Ensure that the I flag is a valid boolean. =item I Ensure that the I flag is a valid boolean. If this flag is set to 1, then the I field will also be checked. =item I Ensure that the I flag is a valid boolean. =item I Ensure that the I flag is a valid Perl module. This is checked by using the Perl "require" facility to load the specified module. =back =head1 OPTIONS =over 4 =item B<-expert> This option will bypass the following checks: - KSK has a longer lifespan than the configuration file's default minimum lifespan - KSK has a shorter lifespan than the configuration file's default maximum lifespan - ZSKs have a longer lifespan than the configuration file's default minimum lifespan - ZSKs have a shorter lifespan than the configuration file's default maximum lifespan =item B<-quiet> No output will be given. The number of errors will be used as the exit code. =item B<-summary> A final summary of success or failure will be printed. The number of errors will be used as the exit code. =item B<-verbose> Success or failure status of each check will be given. A B<+> or B<-> prefix will be given for each valid and invalid entry. The number of errors will be used as the exit code. =item B<-Version> Displays the version information for B and the DNSSEC-Tools package. =item B<-help> Display a usage message. =back =head1 COPYRIGHT Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B, B, B, B B, B B =cut dnssec-tools-2.2/tools/scripts/dtinitconf0000775000237200023720000015674312544611342021062 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details. # # DNSSEC-Tools: dtinitconf # # This script initializes the DNSSEC-Tools configuration file. # # dtinitconf # use strict; use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::defaults; use Net::DNS::SEC::Tools::tooloptions; use Net::DNS::SEC::Tools::BootStrap; # # Version information. # my $NAME = "dtinitconf"; my $VERS = "$NAME version: 2.1.0"; my $DTVERS = "DNSSEC-Tools Version: 2.1"; # # The DNSSEC-Tools programs we're expecting to find. # my @DTPROGS = ( "genkrf", "keyarch", "rollchk", "rollctl", "zonesigner" ); # # Common locations for DNSSEC-Tools. # my @COMMON_DTLOCS = ( "/usr/bin", "/usr/local/bin", "/usr/local/sbin", "/usr/sbin", "/opt/local/bin", "/opt/local/sbin", ); # # Common locations for BIND. These locations were found on: # # FreeBSD 5.4 # MacOS X 10.4.5 # SunOS 5.8 # my @COMMON_BINDLOCS = ( "/usr/local/sbin", "/usr/sbin", ); # # The BIND programs we're expecting to find. # my @BINDPROGS = ( "dnssec-keygen", "dnssec-signzone", "named-checkzone", "rndc" ); my $DEFAULT_EDITOR = "vi"; my $DEFZFPARSER = dnssec_tools_default("zoneparser"); my $ROOTHINTS = 'http://www.internic.net/zones/named.root'; # # Command-line options specifically for this program. # my %opts = (); # Options hash. my @opts = ( "outfile=s", # Output config file. "edit", # Edit resulting file. "overwrite", # Overwrite existing files. "noprompt", # Don't prompt user. "template", # Create a template config file. "verbose", # Verbose equivalent. "Version", # Display the version number. "maxlife=i", # Maximum key lifespan. "minlife=i", # Minimum key lifespan. "zoneparser=s", # Zone-file parser "usegui", # Use option GUI. "noentropy_msg", # Don't give entropy message. "nosavekeys", # Don't save old keys. "nousegui", # Don't use option GUI. "admin=s", # Administrator's email address. "binddir=s", # Path to BIND programs. "dtdir=s", # Path to DNSSEC-Tools programs. "autosign!", # Turn on/off rollerd's autosign flag. "roll-loadzone", # Turn on rollerd's zone-loading flag. "no-roll-loadzone", # Turn off rollerd's zone-loading flag. "roll-logfile=s", # Logfile for rollerd. "roll-loglevel=s", # Logging level for rollerd. "roll-phasemsg=s", # Phase-message length for rollerd. "roll-sleeptime=i", # Sleep-time for rollerd. "roll-username=s", # Username for rollerd. "roll-logtz=s", # Timezone for rollerd's logfile. "mailer-server=s", # Mail server. "mailer-type=s", # Mail type. "ta-contact=s", # trustman's email contact. "ta-resolvconf=s", # Location of resolv.conf file. "ta-smtpserver=s", # trustman's SMTP server. "ta-tmpdir=s", # trustman's temp. directory. "genroothints=s", # Create root.hints file. ); # # Data required for command-line options. # my $alg; # The encryption algorithm. my $endtime; # Endtime of signature validity. my $kskcnt; # Count of KSK keys. my $ksklen; # The KSK size. my $ksklife; # Lifespan of the KSK. my $maxlife; # Maximum lifespan of the keys. my $minlife; # Minimum lifespan of the keys. my $random; # The source of randomness. my $usensec3; # Use nsec3 by default? my $nsec3salt; # The default salt to use my $nsec3iter; # The default iterations to use my $nsec3optout; # Default to NSEC3 optout my $zskcnt; # Count of ZSK keys. my $zsklen; # The ZSK size. my $zsklife; # Lifespan of the ZSK. my $zoneparser; # Parser module for zone files. my $admin; # Administrator's email address. my $entmsg; # Display entropy message. my $keyarchdir; # Key archive directory. my $savekeys; # Save/delete old keys. my $usegui; # Use-GUI flag. my $editflag; # Edit resulting config file. my $noprompt = 0; # Don't prompt -- just use defaults. my $outfile; # Output filename. my $overwrite; # Overwrite existing output file. my $template = 0; # Create template file. my $verbose = 0; # Give verbose output. my $kgopts; # Options for key-generation program. my $zcopts; # Options for zone-checking program. my $zsopts; # Options for zone-signing program. my $autosign; # Autosign flag for rollerd. my $rloadzone; # rollerd's zone-loading flag. my $rlogfile; # Logfile for rollerd. my $rloglevel; # Logging level for rollerd. my $rlogtz; # Timezone for rollerd's logfile. my $rphasemsg; # Logging level for rollerd. my $rsleep; # Sleep-time for rollerd. my $rusername; # Username for rollerd. my $zoneerrs; # Maximum error count for zones. my $mailertype; # Type of mailer. my $mailerserver; # Mail server. my $tacontact; # trustman's email contact. my $taresolvconf; # Location of resolv.conf file. my $tasmtpserver; # trustman's SMTP server. my $tatmpdir; # trustman's temporary directory. my $roothints; # root.hints file to create. # # Program paths. # my $dtdir; # DNSSEC-Tools directory. my $genkrf; # genkrf program. my $keyarch; # keyarch program. my $rollchk; # rollchk program. my $rollctl; # rollctl program. my $zonesigner; # zonesigner program. my $binddir; # BIND directory. my $keygen; # BIND's key-generation program. my $rndc; # BIND's name server control program. my $zonecheck; # BIND's zone-checking program. my $zonesign; # BIND's zone-signing program. # my $viewimg; # Image viewer. main(); exit(0); #---------------------------------------------------------------------------- # Routine: main() # # Purpose: Yeah, yeah, a main() isn't necessary. However, it offends my # sense of aesthetics to have great gobs of code on the same # level as a pile of globals. # # But what about those globals, you ask... # sub main { my $confdir; # Configuration directory. # # Force output to be written right away. # $| = 1; # # Parse the command line options. # optsandargs(); # # Ensure our configuration directory exists and is a directory. # $confdir = getconfdir(); if(! -e $confdir) { my $uid = 0; # UID of confdir. my $gid; # GID of confdir. print STDERR "configuration directory \"$confdir\" does not exist; creating...\n\n"; $gid = getgrnam("dnssec") || -1; mkdir($confdir,0755); chown($uid,$gid,$confdir); } elsif(! -d $confdir) { print STDERR "configuration directory \"$confdir\" is not a directory; unable to continue\n"; exit(1); } # # Ensure that we can write the output file. # if(-e $outfile) { # # Only overwrite an existing config file if the user wants it. # if((-f $outfile) && !$overwrite) { print STDERR "config file \"$outfile\" already exists;\n"; print STDERR " use -overwrite to overwrite it\n"; exit(1); } # # Ensure the existing config file is writable. # if(! -w $outfile) { print STDERR "\nwarning: configuration file \"$outfile\" is not writable;\n"; print STDERR "\t\tthis must be fixed before the final pieces of data are gathered\n\n"; } } else { # # Ensure the config directory is writable. # if((! -w $confdir) && (! defined($opts{'outfile'}))) { print STDERR "\nwarning: configuration directory \"$confdir\" is not writable;\n"; print STDERR "\t\tthis must be fixed before the final pieces of data are gathered\n\n"; } } # # Prompt the user for the data, unless they don't want to be prompted. # if($template) { # # Set some defaults (that aren't already set.) # $admin = "root"; $genkrf = "genkrf"; $keyarch = "keyarch"; $keygen = "dnssec-keygen"; $kgopts = ""; $rndc = "rndc"; $rollchk = "rollchk"; $rollctl = "rollctl"; $roothints = "/etc/root.hints"; $tacontact = "root"; $mailertype = "smtp"; $mailerserver = "localhost"; $zcopts = ""; $zonecheck = "named-checkzone"; $zonesign = "dnssec-signzone"; $zonesigner = "zonesigner"; $zsopts = ""; # # Write the template configuration file. # writetemplate(); } else { if($noprompt) { guessdata(); } else { gatherdata(); } # # Write the configuration file. # writeconf(); } # # Edit the configuration file. # editconf(); } #----------------------------------------------------------------------------- # Routine: optsandargs() # # Purpose: Parse the command line for options and arguments. # sub optsandargs { my $ropts; # Reference to options hash. # # Slurp up the options. # opts_onerr(1); $ropts = opts_cmdopts(@opts); %opts = %$ropts if($ropts != undef); # # Give usage message if desired. # usage() if($opts{'help'}); # # Display the version number. # version() if($opts{'Version'}); # # Get the option values. If these weren't given on the command # line, they'll be taken the DNSSEC-Tools defaults. # $maxlife = $opts{'maxlife'} || dnssec_tools_default("lifespan-max"); $minlife = $opts{'minlife'} || dnssec_tools_default("lifespan-min"); $kskcnt = $opts{'kskcount'} || dnssec_tools_default("kskcount"); $ksklen = $opts{'ksklength'} || dnssec_tools_default("ksklength"); $ksklife = $opts{'ksklife'} || dnssec_tools_default("ksklife"); $zskcnt = $opts{'zskcount'} || dnssec_tools_default("zskcount"); $zsklen = $opts{'zsklength'} || dnssec_tools_default("zsklength"); $zsklife = $opts{'zsklife'} || dnssec_tools_default("zsklife"); $alg = $opts{'algorithm'} || dnssec_tools_default("algorithm"); $endtime = $opts{'endtime'} || dnssec_tools_default("enddate"); $random = $opts{'random'} || dnssec_tools_default("random"); $usensec3 = $opts{'usensec3'} || dnssec_tools_default("usensec3"); $nsec3salt = $opts{'nsec3salt'} || dnssec_tools_default("nsec3salt"); $nsec3iter = $opts{'nsec3iter'} || dnssec_tools_default("nsec3iter"); $nsec3optout = $opts{'nsec3optout'} || dnssec_tools_default("nsec3optout"); $keyarchdir = $opts{'archivedir'} || dnssec_tools_default("archivedir"); $savekeys = $opts{'savekeys'} || dnssec_tools_default("savekeys"); $usegui = $opts{'usegui'} || dnssec_tools_default("usegui"); $entmsg = $opts{'entropy_msg'} || dnssec_tools_default("entropy_msg"); $autosign = defined($opts{'autosign'}) ? $opts{'autosign'} : dnssec_tools_default("autosign"); $rloadzone = dnssec_tools_default("roll_loadzone"); $rloadzone = 0 if(defined($opts{'no-roll-loadzone'})); $rloadzone = 1 if(defined($opts{'roll-loadzone'})); $rlogfile = $opts{'roll-logfile'} || dnssec_tools_default("roll_logfile"); $rloglevel = $opts{'roll-loglevel'} || dnssec_tools_default("roll_loglevel"); $rlogtz = $opts{'roll-logtz'} || dnssec_tools_default("log_tz"); $rphasemsg = $opts{'roll-phasemsg'} || dnssec_tools_default("roll_phasemsg"); $rsleep = $opts{'roll-sleeptime'} || dnssec_tools_default("roll_sleeptime"); $rusername = $opts{'roll-username'} || ''; $zoneerrs = $opts{'zoneerrs'} || dnssec_tools_default("zone_errors"); $mailerserver = $opts{'mailer-server'} || dnssec_tools_default("mailer-server"); $mailertype = $opts{'mailer-type'} || dnssec_tools_default("mailer-type"); $tacontact = $opts{'ta-contact'} || dnssec_tools_default("tacontact"); $taresolvconf = $opts{'ta-resolvconf'} || dnssec_tools_default("taresolvconf"); $tasmtpserver = $opts{'ta-smtpserver'} || dnssec_tools_default("tasmtpserver"); $tatmpdir = $opts{'ta-tmpdir'} || dnssec_tools_default("tatmpdir"); $roothints = $opts{'genroothints'}; $entmsg = 0 if(defined($opts{'noentropy_msg'})); $savekeys = 0 if(defined($opts{'nosavekeys'})); $usegui = 0 if(defined($opts{'nousegui'})); $admin = $opts{'admin'} || dnssec_tools_default("admin"); $zoneparser = $opts{'zoneparser'} || dnssec_tools_default("zoneparser"); $binddir = $opts{'binddir'}; $dtdir = $opts{'dtdir'}; $outfile = $opts{'outfile'} || getconffile(); $overwrite = $opts{'overwrite'}; $template = $opts{'template'}; $verbose = $opts{'verbose'} || $opts{'v'}; $editflag = $opts{'edit'}; $noprompt = $opts{'noprompt'}; # # Generate a new root.hints file, if the user so desires. # The current root.hints will be pull from InterNIC. # We will ensure the user-specified file doesn't already exist. # if($roothints) { my $ua; # HTTP user agent. my $rq; # HTTP request object. my $rz; # Request response. # # This module is only required if we're generating hints # dnssec_tools_load_mods('LWP::UserAgent' => ""); # # Complain and die if the specified file already exists. # if(-e $roothints) { print STDERR "root.hints file \"$roothints\" already exists\n"; exit(1); } # # Create the user agent that'll fetch the file. # $ua = LWP::UserAgent->new; $ua->agent("dtinitconf"); # # Create the request that'll be sent. # $rq = HTTP::Request->new(GET => "$ROOTHINTS"); $rq->content_type('application/x-www-form-urlencoded'); $rq->content('query=libwww-perl&mode=dist'); # # Pass the request to the user agent. # $rz = $ua->request($rq); # # If we fetched the file, save it to the specified file. # If not, give an error message and continue. # if($rz->is_success) { open(RH,"> $roothints") or print STDERR "unable to create \"$roothints\".\n"; print RH $rz->content; close(RH); } else { print STDERR "unable to retrieve root.hints file (" . $rz->status_line . ")\n"; print STDERR "fetch the root.hints file manually from $ROOTHINTS\n"; print STDERR "continuing to build DNSSEC-Tools configuration file\n"; } $roothints = "roothints $roothints"; } } #---------------------------------------------------------------------------- # Routine: gatherdata() # # Purpose: Get all our stray little data. # sub gatherdata() { get_paths(); get_key_opts(); get_nsec3_opts(); get_zone_opts(); get_dt_opts(); } #---------------------------------------------------------------------------- # Routine: guessdata() # # Purpose: Guess at some of our data. # sub guessdata() { guess_paths(); } #---------------------------------------------------------------------------- # Routine: writeconf() # # Purpose: Write the new config file. # sub writeconf() { my $kronos = gmtime(); # Timestamp when file was created. # # If the verbose flag was given, show all the values. # if($verbose) { print "writing the following values to \"$outfile\":\n"; print "\tadmin - \"$admin\"\n"; print "\talgorithm - \"$alg\"\n"; print "\trandom - \"$random\"\n"; print "\tmaxlife - \"$maxlife\"\n"; print "\tminlife - \"$minlife\"\n"; print "\tkskcount - \"$kskcnt\"\n\n"; print "\tksklen - \"$ksklen\"\n"; print "\tksklife - \"$ksklife\"\n"; print "\tzskcount - \"$zskcnt\"\n\n"; print "\tzsklen - \"$zsklen\"\n"; print "\tzsklife - \"$zsklife\"\n\n"; print "\tusensec3 - \"$usensec3\"\n"; print "\tnsec3salt - \"$nsec3salt\"\n"; print "\tnsec3iter - \"$nsec3iter\"\n\n"; print "\tnsec3optout - \"$nsec3optout\"\n\n"; print "\tendtime - \"$endtime\"\n\n"; print "\tentropy message flag - \"$entmsg\"\n"; print "\told key archive - \"$keyarchdir\"\n"; print "\tsave-old-keys flag - \"$savekeys\"\n"; print "\tuse-gui flag - \"$usegui\"\n\n"; print "\tautosign - \"$autosign\"\n"; print "\troll-loadzone - \"$rloadzone\"\n"; print "\troll-logfile - \"$rlogfile\"\n"; print "\troll-loglevel - \"$rloglevel\"\n"; print "\troll-phasemsg - \"$rphasemsg\"\n"; print "\troll-sleep - \"$rsleep\"\n\n"; print "\troll-logtz - \"$rlogtz\"\n"; print "\tzoneerrs - \"$zoneerrs\"\n\n"; print "\tzone-file parser - \"$zoneparser\"\n\n"; print "\tgenkrf - \"$genkrf\"\n"; print "\tkeyarch - \"$keyarch\"\n"; print "\trollchk - \"$rollchk\"\n"; print "\trollctl - \"$rollctl\"\n"; print "\tzonesigner - \"$zonesigner\"\n"; print "\tkeygen - \"$keygen\"\n"; print "\trndc - \"$rndc\"\n"; print "\tzonecheck - \"$zonecheck\"\n"; print "\tzonesign - \"$zonesign\"\n"; print "\tkeygen options - \"$kgopts\"\n"; print "\tzonecheck options - \"$zcopts\"\n"; print "\tzonesign options - \"$zsopts\"\n\n"; print "\tmailer-server - \"$mailerserver\"\n"; print "\tmailer-type - \"$mailertype\"\n\n"; print "\tta-contact - \"$tacontact\"\n"; print "\tta-resolvconf - \"$taresolvconf\"\n"; print "\tta-smtpserver - \"$tasmtpserver\"\n"; print "\tta-tmpdir - \"$tatmpdir\"\n"; print "\tgenroothints - \"$roothints\"\n"; } open(DTCONF,">$outfile") or die "unable to open \"$outfile\" for writing"; print DTCONF "# # DNSSEC-Tools Configuration # # This file contains configuration information for DNSSEC-Tools. # # This was automatically generated by dtinitconf on # $kronos (GMT). # # # Settings for DNSSEC-Tools administration. # admin-email $admin mailer-server $mailerserver mailer-type $mailertype # # Paths to needed programs. These may need adjusting for individual hosts. # genkrf $genkrf keyarch $keyarch rollchk $rollchk rollctl $rollctl zonesigner $zonesigner keygen $keygen rndc $rndc zonecheck $zonecheck zonesign $zonesign # # The name of the Perl module that will be used to parse zone files. # Net::DNS::ZoneFile::Fast is the default and isn't required to be set. # "; if($zoneparser ne $DEFZFPARSER) { print DTCONF "zonefile-parser $zoneparser\n"; } else { print DTCONF "# zonefile-parser $DEFZFPARSER\n"; } if(($kgopts ne "") || ($zcopts ne "") || ($zsopts ne "")) { print DTCONF " # # Program options. # "; } print DTCONF "keygen-opts $kgopts\n" if($kgopts ne ""); print DTCONF "zonecheck-opts $zcopts\n" if($zcopts ne ""); print DTCONF "zonesign-opts $zsopts\n" if($zsopts ne ""); print DTCONF " # # Key-related values. # algorithm $alg ksklength $ksklen zsklength $zsklen random $random # # NSEC3 functionality # usensec3 $usensec3 nsec3iter $nsec3iter nsec3salt $nsec3salt nsec3optout $nsec3optout # # Settings for dnssec-signzone. # endtime $endtime # RRSIGs good for thirty days. # # Life-times for keys. These defaults indicate how long a key has # between rollovers. The values are measured in seconds. # # Sample values: # 3600 hour # 86400 day # 604800 week # 2592000 30-day month # 15768000 half-year # 31536000 year # lifespan-max $maxlife lifespan-min $minlife ksklife $ksklife zsklife $zsklife # # Settings for zonesigner. # archivedir $keyarchdir entropy_msg $entmsg savekeys $savekeys kskcount $kskcnt zskcount $zskcnt # # Settings for rollerd. # autosign $autosign roll_loadzone $rloadzone roll_logfile $rlogfile roll_loglevel $rloglevel roll_phasemsg $rphasemsg roll_sleeptime $rsleep zone_errors $zoneerrs log_tz $rlogtz "; if($rusername ne '') { print DTCONF "roll_username $rusername\n"; } print DTCONF " # # Settings for trustman. # tacontact $tacontact tasmtpserver $tasmtpserver taresolvconf $taresolvconf tatmpdir $tatmpdir $roothints # # GUI-usage flag. # usegui $usegui "; close(DTCONF); print "Wrote configuration file $outfile\n"; } #---------------------------------------------------------------------------- # Routine: writetemplate() # # Purpose: Write the new config file. # sub writetemplate() { my $kronos = gmtime(); # Timestamp when file was created. open(DTTMPL,">$outfile") or die "unable to open \"$outfile\" for writing"; print DTTMPL "# # DNSSEC-Tools Configuration # # This file contains configuration information for DNSSEC-Tools. # # This was automatically generated by dtinitconf on # $kronos (GMT). # # # Settings for DNSSEC-Tools administration. # # admin-email $admin # mailer-server $mailertype # mailer-type $mailerserver # # Paths to needed programs. These may need adjusting for individual hosts. # # genkrf $genkrf # keyarch $keyarch # rollchk $rollchk # rollctl $rollctl # zonesigner $zonesigner # keygen $keygen # rndc $rndc # zonecheck $zonecheck # zonesign $zonesign # keygen-opts $kgopts # zonecheck-opts $zcopts # zonesign-opts $zsopts # # The name of the Perl module that will be used to parse zone files. # Net::DNS::ZoneFile::Fast is the default and isn't required to be set. # # zonefile-parser Net::DNS::ZoneFile::Fast # # Key-related values. # # algorithm $alg # ksklength $ksklen # zsklength $zsklen # random $random # # NSEC3 functionality # # usensec3 $usensec3 # nsec3iter $nsec3iter # nsec3salt $nsec3salt # nsec3optout $nsec3optout # # Settings for dnssec-signzone. # # endtime $endtime # RRSIGs good for thirty days. # # Life-times for keys. These defaults indicate how long a key has # between rollovers. The values are measured in seconds. # # Sample values: # 3600 hour # 86400 day # 604800 week # 2592000 30-day month # 15768000 half-year # 31536000 year # # lifespan-max $maxlife # lifespan-min $minlife # ksklife $ksklife # zsklife $zsklife # # Settings for zonesigner. # # archivedir $keyarchdir # entropy_msg $entmsg # savekeys $savekeys # kskcount $kskcnt # zskcount $zskcnt # # Settings for rollerd. # # autosign $autosign # roll_loadzone $rloadzone # roll_logfile $rlogfile # roll_loglevel $rloglevel # roll_phasemsg $rphasemsg # roll_sleeptime $rsleep # zone_errors $zoneerrs # roll_username some-user # # log_tz $rlogtz # # Settings for trustman # # tacontact $tacontact # tasmtpserver $tasmtpserver # taresolvconf $taresolvconf # tatmpdir $tatmpdir # roothints $roothints # # GUI-usage flag. # # usegui $usegui "; close(DTTMPL); print "Wrote template configuration file $outfile\n"; } #---------------------------------------------------------------------------- # Routine: editconf() # # Purpose: Edit the new config file. # sub editconf() { my $eddie; # User's preferred editor. my $cmdstr = ""; # Edit command string. return if(!$editflag); # # Get the editor's path. # $eddie = $ENV{'EDITOR'}; $eddie = $DEFAULT_EDITOR if(!defined($eddie)); if(!defined($eddie)) { print STDERR "unable to find editor\n"; return; } # # Try to execute the editor. # $cmdstr = "$eddie $outfile"; system($cmdstr); } #---------------------------------------------------------------------------- # Routine: get_paths() # # Purpose: This routine gathers path-related data. The primary task # is to figure out the paths for DNSSEC-Tools and BIND programs. # After digging up these paths, they're used to create paths for # genkrf, keyarch, rollchk, rollctl, zonesigner, named_checkzone, # dnssec_keygen, dnssec_signzone, and rndc. # sub get_paths() { my $pcret = 0; # pathchk() return value. print "Path-related Options:\n"; # # If the user didn't give -dtdir, we'll go through our internal # collection of possible DNSSEC-Tools directories. # if($dtdir eq "") { my @dtdirs; # DNSSEC-Tools directories. # # Get the directories that contain DNSSEC-Tools programs. # @dtdirs = finddtdir(); # # If we found any directories with DNSSEC-Tools programs, # we'll list the directories for the user. If we didn't # find anything, we'll give a message. # if(@dtdirs > 0) { print "\tThese directories contain DNSSEC-Tools programs:\n"; foreach $dtdir (sort(@dtdirs)) { print "\t\t$dtdir\n"; } print "\n"; } else { print "\tDNSSEC-Tools may not be installed on your system\n"; } $dtdir = getval("DNSSEC-Tools directory",$dtdirs[0]); print "\n"; } else { print "\n\tUsing \"$dtdir\" for DNSSEC-Tools directory\n\n"; } # # If the user didn't give -binddir, we'll go through our internal # collection of possible BIND directories. # if($binddir eq "") { my @binddirs; # BIND directories. # # Get the directories that contain BIND programs. # @binddirs = findbind(); # # If we found any directories with BIND programs, we'll list # the directories for the user. If we didn't find anything, # we'll give a message. # if(@binddirs > 0) { print "\tThese directories contain BIND programs:\n"; foreach $binddir (sort(@binddirs)) { print "\t\t$binddir\n"; } print "\n"; } else { print "\tBIND may not be installed on your system\n"; } $binddir = getval("BIND directory",$binddirs[0]); print "\n"; } else { print "\n\tUsing \"$binddir\" for BIND directory\n\n"; } # # Get the path for an image viewer. # # $viewimg = getval("Image Display Program",$viewimg); # # Build paths for the DNSSEC-Tools programs. # if(($dtdir eq "") || ($dtdir eq "path")) { $genkrf = "genkrf"; $keyarch = "keyarch"; $rollchk = "rollchk"; $rollctl = "rollctl"; $zonesigner = "zonesigner"; } else { $genkrf = "$dtdir/genkrf"; $keyarch = "$dtdir/keyarch"; $rollchk = "$dtdir/rollchk"; $rollctl = "$dtdir/rollctl"; $zonesigner = "$dtdir/zonesigner"; print "\n"; print "\tChecking validity of DNSSEC-Tools paths\n"; $pcret += pathchk("DNSSEC-Tools directory",$dtdir); $pcret += pathchk("DNSSEC-Tools' genkrf",$genkrf); $pcret += pathchk("DNSSEC-Tools' keyarch",$keyarch); $pcret += pathchk("DNSSEC-Tools' rollchk",$rollchk); $pcret += pathchk("DNSSEC-Tools' rollctl",$rollctl); $pcret += pathchk("DNSSEC-Tools' zonesigner",$zonesigner); } # # Build paths for the BIND programs. # if(($binddir eq "") || ($binddir eq "path")) { $keygen = "dnssec-keygen"; $rndc = "rndc"; $zonecheck = "named-checkzone"; $zonesign = "dnssec-signzone"; } else { $keygen = "$binddir/dnssec-keygen"; $rndc = "$binddir/rndc"; $zonecheck = "$binddir/named-checkzone"; $zonesign = "$binddir/dnssec-signzone"; # # Check that the paths all valid. # print "\tChecking validity of BIND paths\n"; $pcret += pathchk("BIND directory",$binddir); $pcret += pathchk("BIND's rndc",$rndc); $pcret += pathchk("BIND's named_checkzone",$zonecheck); $pcret += pathchk("BIND's dnssec_keygen",$keygen); $pcret += pathchk("BIND's dnssec_signzone",$zonesign); # $pcret += pathchk("Image display program",$viewimg); } # # Check validity of non-DNSSEC-Tools, non-BIND paths. # # print "\tChecking validity of other paths\n"; # $pcret += pathchk("Image display program",$viewimg); # # If any of the paths don't exist, then we'll give the user # the option of re-entering the paths. # if($pcret) { my $again; # Re-entry flag. $again = getval("\n\tAt least one path did not exist.\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; $binddir = ""; get_paths(); } } else { print "\tAll paths are valid.\n"; } print "\n"; } #---------------------------------------------------------------------------- # Routine: guess_paths() # # Purpose: This routine makes guesses at path-related data and is only # called when -noprompt was given. The primary task is to figure # out the path for BIND programs. After digging up this path, # it's used to create paths for named_checkzone, dnssec_keygen, # dnssec_signzone, and rndc. # sub guess_paths() { # # If the user didn't give -dtdir, we'll go through our internal # collection of possible DNSSEC-Tools directories. # if($dtdir eq "") { my @dtdirs; # DNSSEC-Tools directories. # # Get the directories that contain DNSSEC-Tools programs. # @dtdirs = finddtdir(); # # If we found any directories with DNSSEC-Tools programs, # we'll use the first directory. # $dtdir = $dtdirs[0] if(@dtdirs > 0); } # # If the user didn't give -binddir, we'll go through our internal # collection of possible BIND directories. # if($binddir eq "") { my @binddirs; # BIND directories. # # Get the directories that contain BIND programs. # @binddirs = findbind(); # # If we found any directories with BIND programs, we'll use # the first directory. # $binddir = $binddirs[0] if(@binddirs > 0); } # # Build paths for the DNSSEC-Tools programs. # if(($dtdir eq "") || ($dtdir eq "path")) { $genkrf = "genkrf"; $keyarch = "keyarch"; $rollchk = "rollchk"; $rollctl = "rollctl"; $zonesigner = "zonesigner"; } else { $genkrf = "$dtdir/genkrf"; $keyarch = "$dtdir/keyarch"; $rollchk = "$dtdir/rollchk"; $rollctl = "$dtdir/rollctl"; $zonesigner = "$dtdir/zonesigner"; } # # Build paths for the BIND programs. # if(($binddir eq "") || ($binddir eq "path")) { $keygen = "dnssec-keygen"; $rndc = "rndc"; $zonecheck = "named-checkzone"; $zonesign = "dnssec-signzone"; } else { $keygen = "$binddir/dnssec-keygen"; $rndc = "$binddir/rndc"; $zonecheck = "$binddir/named-checkzone"; $zonesign = "$binddir/dnssec-signzone"; } } #---------------------------------------------------------------------------- # Routine: get_key_opts() # # Purpose: Get key-related options. # sub get_key_opts() { print "Key-related Options:\n"; $alg = getval("Encryption Algorithm",$alg); $random = getval("Random-number Generator",$random); print "\n"; # # Get the maximum key lifespan and ensure it isn't less then the # default minimum lifespan. # while(42) { my $mlife; # User-specified maximum life. $mlife = getval("Maximum Key Lifespan (in seconds)",$maxlife); # # Ensure the user's maximum lifespan is greater than the # default minimum lifespan. # if($mlife < $minlife) { my $again; # "Try-again" response. $again = getval("\n\tMaximum key lifespan is less than the minimum allowed lifespan\n\t($mlife < $minlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $maxlife; } # # Ensure the user's maximum lifespan is greater than the # default maximum lifespan. # if($mlife > $maxlife) { my $again; # "Try-again" response. $again = getval("\n\tMaximum key lifespan is greater than the maximum allowed lifespan\n\t($mlife > $maxlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $maxlife; } # # Save the lifespan limit and drop out of the loop. # $maxlife = $mlife; last; } # # Get the minimum key lifespan and ensure it isn't less then the # user-specified maximum lifespan. # while(42) { my $mlife; # User-specified minimum life. $mlife = getval("Minimum Key Lifespan (in seconds)",$minlife); # # Ensure the user's minimum lifespan is greater than the # default minimum lifespan. # if($mlife < $minlife) { my $again; # "Try-again" response. $again = getval("\n\tMinimum key lifespan is less than the minimum allowed lifespan\n\t($mlife < $minlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $minlife; } # # Ensure the user's minimum lifespan is less than the # user's maximum lifespan. # if($mlife > $maxlife) { my $again; # "Try-again" response. $again = getval("\n\tMinimum key lifespan is greater than the maximum key lifespan\n\t($mlife > $maxlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $minlife; } # # Save the lifespan limit and drop out of the loop. # $minlife = $mlife; last; } print "\n"; $kskcnt = getval("KSK Count",$kskcnt); $ksklen = getval("KSK Length (in bits)",$ksklen); # # Get the minimum key lifespan and ensure it isn't less then the # user-specified maximum lifespan. # while(42) { my $mlife; # Minimum key lifespan. $mlife = getval("KSK Lifespan (in seconds)",$ksklife); # # Ensure the user's KSK lifespan is greater than the # default minimum lifespan. # if($mlife < $minlife) { my $again; # "Try-again" response. $again = getval("\n\tKSK lifespan is less than the minimum allowed key lifespan\n\t($mlife < $minlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $minlife; } # # Ensure the user's KSK lifespan is less than the # default maximum lifespan. # if($mlife > $maxlife) { my $again; # "Try-again" response. $again = getval("\n\tKSK lifespan is greater than the maximum key lifespan\n\t($mlife > $maxlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $maxlife; } # # Save the KSK lifespan and drop out of the loop. # $ksklife = $mlife; last; } print "\n"; $zskcnt = getval("ZSK Count",$zskcnt); $zsklen = getval("ZSK Length (in bits)",$zsklen); # # Get the minimum key lifespan and ensure it isn't less then the # user-specified maximum lifespan. # while(42) { my $mlife; # Minimum key lifespan. $mlife = getval("ZSK Lifespan (in seconds)",$zsklife); # # Ensure the user's ZSK lifespan is greater than the # default minimum lifespan. # if($mlife < $minlife) { my $again; # "Try-again" response. $again = getval("\n\tZSK lifespan is less than the minimum allowed key lifespan\n\t($mlife < $minlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $minlife; } # # Ensure the user's ZSK lifespan is less than the # default maximum lifespan. # if($mlife > $maxlife) { my $again; # "Try-again" response. $again = getval("\n\tZSK lifespan is greater than the maximum key lifespan\n\t($mlife > $maxlife).\n\tWould you like to try again? ",1,"boolean"); if($again) { print "\n"; next; } $mlife = $maxlife; } # # Save the ZSK lifespan and drop out of the loop. # $zsklife = $mlife; last; } print "\n"; } #---------------------------------------------------------------------------- # Routine: get_nsec3_opts() # # Purpose: Get NSEC3 options. # sub get_nsec3_opts() { print "Key-related Options:\n"; $usensec3 = getval("Use NSEC3 by default",$usensec3); print "\tWhen using NSEC3:\n"; $nsec3iter = getval(" NSEC3 Iterations to use",$nsec3iter); $nsec3salt = getval(" NSEC3 salt to use",$nsec3salt); $nsec3optout = getval(" Default to NSEC3 OptOut",$nsec3optout); print "\n"; } #---------------------------------------------------------------------------- # Routine: get_zone_opts() # # Purpose: Get zone-related options. # sub get_zone_opts() { print "Zone-related Options:\n"; $endtime = getval("End-time",$endtime); print "\n"; } #---------------------------------------------------------------------------- # Routine: get_dt_opts() # # Purpose: Get DNSSEC-Tools-specific options. # sub get_dt_opts() { print "DNSSEC-Tools Options:\n"; $usegui = getval("Use DNSSEC-Tools GUI Interface",$usegui,"boolean"); $entmsg = getval("Display Entropy Message in Zonesigner",$entmsg,"boolean"); $savekeys = getval("Save Old Keys",$savekeys,"boolean"); $keyarchdir = getval("Key Archive Directory","$keyarchdir"); print "\n"; $kgopts = getval("Key-Generation Options",""); $zcopts = getval("Zone-Checking Options","-i local"); $zsopts = getval("Zone-Signing Options",""); $zoneparser = getval("Zone-File Parser",$DEFZFPARSER); print "\n"; $autosign = getval("Rollerd's Auto-signing Flag",$autosign,"boolean"); $rloadzone = getval("Rollerd's Zone-loading Flag",$rloadzone,"boolean"); $rlogfile = getval("Rollerd's Logfile",$rlogfile,""); $rloglevel = getval("Rollerd's Logging Level",$rloglevel,"", "(valid values: tmi, expire, info, phase, err, fatal)"); $rlogtz = getval("Rollerd's Logging Timezone",$rlogtz,"", "(valid values: gmt, local)"); $rphasemsg = getval("Rollerd's Phase-Message Length",$rphasemsg,"", "(valid values: long, short)"); $rsleep = getval("Rollerd's Sleep-time",$rsleep,""); $rusername = getval("Rollerd's Username",$rusername,""); $zoneerrs = getval("Rollerd's Maximum Error Count for Zones",$zoneerrs,""); print "\n"; $mailerserver = getval("mail server",$mailerserver,""); $mailertype = getval("mail type",$mailertype,""); print "\n"; $tacontact = getval("trustman's contact address",$tacontact,""); $tasmtpserver = getval("trustman's SMTP server",$tasmtpserver,""); $tatmpdir = getval("trustman's temporary directory",$tatmpdir,""); $taresolvconf = getval("trustman's resolv.conf file",$tasmtpserver,""); $roothints = getval("root.hints file",""); print "\n"; } #---------------------------------------------------------------------------- # Routine: getval() # # Purpose: Prompt a user for input, providing a default. If the return # key is hit without anything else being entered, the default # value is returned. Otherwise, the user's input is returned # (minus the trailing newline.) # sub getval() { my $prompt = shift; # User prompt. my $defval = shift; # Default value. my $type = shift; # Value type. my $secstr = shift; # Secondary string. my $defstr; # Default string. my $val; # User's value. # # Set up the default we'll actually print. # $defstr = $defval; $defstr = "no default" if($defval eq ""); # # If this is a boolean, we'll use friendly words. # if($type eq "boolean") { if($defval) { $defval = "yes"; } else { $defval = "no"; } $defstr = $defval; } # # Prompt for the value and read it in. # if(defined($secstr)) { print"\t$prompt [$defstr]\n"; print"\t $secstr: " if(defined($secstr)); } else { print"\t$prompt [$defstr]: "; } $val = ; # # Get rid of the trailing newline. If we're left with nothing, # then we'll use the default value. # $val =~ s/\n$//; $val = $defval if($val eq ""); # # If this was a boolean field, we'll translate "yes" and "no" into # one or zero. We'll also be sure that good boolean values were # submitted. If not, an error message is given and we start all # over again. # if($type eq "boolean") { # # If this was "yes" or "no", make the translation. # $val = lc($val); if(($val eq "yes") || ($val eq "ye") || ($val eq "y") || ($val eq "no") || ($val eq "n")) { if(($val eq "yes") || ($val eq "ye") || ($val eq "y")) { $val = 1; } else { $val = 0; } } else { # # If the whole value is an integer, we'll use it as # a boolean. If not, then we were give an invalid # response -- complain and try again. # if($val =~ /^[0-9]+$/) { $val = 1 * $val; } else { print STDERR "\ninvalid boolean value; you must use \"yes\", \"no\", \"1\", or \"0\"\n\n"; return(getval($prompt,$defval,$type,$secstr)); } } } # # Return the value. # return($val); } #---------------------------------------------------------------------------- # Routine: findbind() # # Purpose: This routine collects a set of directories that hold the # BIND programs used by DNSSEC-Tools. The following sources # are checked: # - directories in the path # - directories that commonly are used for BIND # - DNSSEC-Tools defaults # # The list of collected directories are returned to the caller. # sub findbind() { my $pbg; # Path to BIND programs. my $bpg; # Full path location of BIND programs. my $paths; # Path environment variable. my @paths; # Split-out paths. my %hfound = (); # Directories with BIND progs. my @found; # Directories with BIND progs. # # Look in the environment and in some common directories for a set # of BIND programs. Any time we find the program, we'll mark a hash # entry for its directory. # foreach my $bind (@BINDPROGS) { # # Look in our path for the BIND program. # $paths = $ENV{'PATH'}; @paths = split /:/, $paths; foreach my $path (@paths) { $pbg = "$path/$bind"; next if(! -e $pbg); $hfound{$path} = 1; } # # Look in a set of common locations for the BIND program. # foreach my $path (@COMMON_BINDLOCS) { $pbg = "$path/$bind"; next if(! -e $pbg); $hfound{$path} = 1; } } # # Look for the BIND tools in our defaults. # $pbg = $bpg = dnssec_tools_default("keygen"); $pbg =~ s/\/dnssec-keygen$//; $hfound{$pbg} = 1 if( -e $bpg); $pbg = $bpg = dnssec_tools_default("rndc"); $pbg =~ s/\/rndc$//; $hfound{$pbg} = 1 if( -e $bpg); $pbg = $bpg = dnssec_tools_default("zonecheck"); $pbg =~ s/\/named-checkzone$//; $hfound{$pbg} = 1 if( -e $bpg); $pbg = $bpg = dnssec_tools_default("zonesign"); $pbg =~ s/\/dnssec-signzone$//; $hfound{$pbg} = 1 if( -e $bpg); # # Return the directories we found with BIND programs. # @found = keys(%hfound); return(@found); } #---------------------------------------------------------------------------- # Routine: finddtdir() # # Purpose: This routine collects a set of directories that hold the # DNSSEC-Tools programs. The following sources are checked: # - directories in the path # - directories that commonly are used for DNSSEC-Tools # - DNSSEC-Tools defaults # # The list of collected directories are returned to the caller. # sub finddtdir() { my $pbg; # Path to DNSSEC-Tools programs. my $paths; # Path environment variable. my @paths; # Split-out paths. my %hfound = (); # Directories with DNSSEC-Tools progs. my @found; # Directories with DNSSEC-Tools progs. # # Look in the environment and in some common directories for a set # of DNSSEC-Tools programs. Any time we find the program, we'll mark # a hash entry for its directory. # foreach my $dtt (@DTPROGS) { # # Look in our path for the DNSSEC-Tools program. # $paths = $ENV{'PATH'}; @paths = split /:/, $paths; foreach my $path (@paths) { $pbg = "$path/$dtt"; next if(! -e $pbg); $hfound{$path} = 1; } # # Look in a set of common locations for the DNSSEC-Tools tools. # foreach my $path (@COMMON_DTLOCS) { $pbg = "$path/$dtt"; next if(! -e $pbg); $hfound{$path} = 1; } } # # Look for the DNSSEC-Tools tools in our defaults. # $pbg = dnssec_tools_default("genkrf"); $pbg =~ s/\/genkrf$//; $hfound{$pbg} = 1; $pbg = dnssec_tools_default("keyarch"); $pbg =~ s/\/keyarch$//; $hfound{$pbg} = 1; $pbg = dnssec_tools_default("rollchk"); $pbg =~ s/\/rollchk$//; $hfound{$pbg} = 1; $pbg = dnssec_tools_default("rollctl"); $pbg =~ s/\/rollctl$//; $hfound{$pbg} = 1; $pbg = dnssec_tools_default("zonesigner"); $pbg =~ s/\/zonesigner$//; $hfound{$pbg} = 1; # # Return the directories we found with DNSSEC-Tools programs. # @found = keys(%hfound); return(@found); } #---------------------------------------------------------------------------- # Routine: pathchk() # # Purpose: Check for existence of a path. If it doesn't exist, an # error message will be printed. # sub pathchk() { my $descr = shift; # Description of path to check. my $path = shift; # Path to check. return(0) if(-e $path); print "\t\t$descr ($path) does not exist\n"; return(1); } #---------------------------------------------------------------------- # Routine: version() # # Purpose: Print the version number(s) and exit. # sub version { print STDERR "$VERS\n"; print STDERR "$DTVERS\n"; exit(0); } #---------------------------------------------------------------------------- # Routine: usage() # sub usage() { print STDERR "usage: dtinitconf [options]\n"; print STDERR "\toptions:\n"; print STDERR "\t\t-algorithm \n"; print STDERR "\t\t-endtime \n"; print STDERR "\t\t-random \n\n"; print STDERR "\t\t-kskcount \n"; print STDERR "\t\t-ksklength \n"; print STDERR "\t\t-ksklife \n"; print STDERR "\t\t-zskcount \n"; print STDERR "\t\t-zsklength \n"; print STDERR "\t\t-zsklife \n\n"; print STDERR "\t\t-archivedir \n"; print STDERR "\t\t-binddir \n"; print STDERR "\t\t-entropy_msg | -noentropy_msg\n"; print STDERR "\t\t-savekeys | -nosavekeys\n\n"; print STDERR "\t\t-zoneparser \n"; print STDERR "\t\t-usegui | -nousegui\n\n"; print STDERR "\t\t-autosign | -noautosign\n"; print STDERR "\t\t-roll-loadzone | -no-roll-loadzone\n"; print STDERR "\t\t-roll-logfile \n"; print STDERR "\t\t-roll-loglevel \n"; print STDERR "\t\t-roll-sleeptime \n"; print STDERR "\t\t-roll-username \n\n"; print STDERR "\t\t-roll-logtz \n"; print STDERR "\t\t-ta-contact \n"; print STDERR "\t\t-ta-resolvconf \n"; print STDERR "\t\t-ta-smtpserver \n"; print STDERR "\t\t-ta-tmpdir \n"; print STDERR "\t\t-genroothints \n\n"; print STDERR "\t\t-outfile \n"; print STDERR "\t\t-overwrite\n"; print STDERR "\t\t-noprompt\n"; print STDERR "\t\t-edit\n"; print STDERR "\t\t-template\n"; print STDERR "\t\t-verbose\n"; print STDERR "\t\t-Version\n"; print STDERR "\t\t-help\n"; exit(0); } 1; ############################################################################## # =pod =head1 NAME dtinitconf - Creates a DNSSEC-Tools configuration file =head1 SYNOPSIS dtinitconf [options] =head1 DESCRIPTION The B program initializes the DNSSEC-Tools configuration file. By default, the actual configuration file will be created, though the created file can be specified by the user. Existing files, whether the default or one specified by the user, will not be overwritten unless specifically directed by the user. Each configuration field can be individually specified on the command line. The user will also be prompted for the fields, with default values taken from the DNSSEC-Tools B module. If the B<-noprompt> option is given, then a default configuration file (modulo command-line arguments) will be created. Configuration entries are created for several BIND programs. Several locations on the system are searched to find the locations of these programs. First, the directories in the path environment variable are checked; the names of any directories that contain the BIND programs are saved. Next, several common locations for BIND programs are checked; again, the names of directories that contain the BIND programs are saved. After collecting these directories, the user is presented with this list and may choose to use whichever set is desired. If no directories are found that contain the BIND programs, the user is prompted for the proper location. If the configuration file's parent directory does not exist, then an attempt is made to create the directory. The new directory's ownership will be set to I for the owner and I for the group, assuming the I group exists. Writability checks for the directory will not be performed if the I<-outfile> option is given. =head1 OPTIONS B takes options that control the contents of the newly generated DNSSEC-Tools configuration file. Each configuration file entry has a corresponding command-line option. The options, described below, are ordered in logical groups. =head2 Key-related Options These options deal with different aspects of creating and managing encryption keys. =over 4 =item B<-algorithm algorithm> Selects the cryptographic algorithm. The value of algorithm must be one that is recognized by the installed version of B. =item B<-kskcount KSK-count> The default number of KSK keys that will be created for a zone. =item B<-ksklength keylen> The default KSK key length to be passed to B. =item B<-ksklife lifespan> The default length of time between KSK rollovers. This is measured in seconds. This value must be within the range of the B and B values. This value is B used for key rollover. Keys do not have a life-time in any other sense. =item B<-maxlife maxlifespan> The maximum length of time between key rollovers. This is measured in seconds. The B and B values must be not greater than this value. This value is B used for key rollover. Keys do not have a life-time in any other sense. =item B<-minlife minlifespan> The minimum length of time between key rollovers. This is measured in seconds. The B and B values must be not less than this value. This value is B used for key rollover. Keys do not have a life-time in any other sense. =item B<-zskcount ZSK-count> The default number of ZSK keys that will be created for a zone. =item B<-zsklength keylen> The default ZSK key length to be passed to B. =item B<-zsklife lifespan> The default length of time between ZSK rollovers. This is measured in seconds. This value must be within the range of the B and B values. This value is B used for key rollover. Keys do not have a life-time in any other sense. =item B<-random randomdev> The random device generator to be passed to B. =back =head2 Zone-related Options These options deal with different aspects of zone signing. =over 4 =item B<-endtime endtime> The zone default expiration time to be passed to B. =back =head2 trustman-related Options These options deal with different aspects of executing B. =over 4 =item B<-genroothints roothints> A new B file will be created at the specified location. B requires that the file not already exist. The B file is retrieved from B. It is not considered a fatal error if B is unable to fetch the file. Rather, a warning message will be given and creation of the configuration file will continue. =item B<-ta-contact email> The email address of the B administrator. =item B<-ta-resolvconf resolvconffile> The location of the B file. =item B<-ta-smtpserver hostname> The SMTP server for the B command. =item B<-ta-tmpdir hostname> The temporary directory for the B command. =back =head2 BIND Options These options deal specifically with functionality provided by BIND. =over 4 =item B<-rndc rndc-path> B is the path to BIND's B command. =back =head2 DNSSEC-Tools Options These options deal specifically with functionality provided by DNSSEC-Tools. =over 4 =item B<-admin email-address> B is the email address of the DNSSEC-Tools administrator. This is the default address used by the I routine. =item B<-archivedir directory> B is the archived-key directory. Old encryption keys are moved to this directory, but only if they are to be saved and not deleted. =item B<-autosign> A flag indicating that B should automatically sign zonefiles that are found to be newer than their signed zonefile. If B<-noautosign> is specified, this will be set to false. =item B<-binddir directory> B is the directory holding the BIND programs. If the reserved word "path" is specified, then existence of the BIND programs is not verified when B is executed. Rather, the user's PATH directories will be searched for the BIND programs when the DNSSEC-Tools are executed. =item B<-dtdir directory> B is the directory holding the DNSSEC-Tools programs. If the reserved word "path" is specified, then existence of the DNSSEC-Tools programs is not verified when B is executed. Rather, the user's PATH directories will be searched for the DNSSEC-Tools programs when those tools are executed. =item B<-entropy_msg> A flag indicating that B should display a message about entropy generation. This is primarily dependent on the implementation of a system's random number generation. =item B<-mailer-server host> The mail server that will be contacted by I. This is passed to I. =item B<-mailer-server mailtype> The mail type that will be contacted by I. This is passed to I (by way of I.) Any values recognized by I may be used here. =item B<-noentropy_msg> A flag indicating that B should not display a message about entropy generation. This is primarily dependent on the implementation of a system's random number generation. =item B<-roll-loadzone> =item B<-no-roll-loadzone> Flags indicating whether or not B should have the DNS daemon load zones. =item B<-roll-logfile logfile> B is the logfile for the B daemon. =item B<-roll-loglevel loglevel> B is the logging level for the B daemon. =item B<-roll-phasemsg length> B is the default length of phase-related log messages used by B. The valid levels are "long" and "short", with "long" being the default value. The long message length means that a phase description will be included with some log messages. For example, the long form of a message about ZSK rollover phase 3 will look like this: "ZSK phase 3 (Waiting for old zone data to expire from caches)". The short message length means that a phase description will not be included with some log messages. For example, the short form of a message about ZSK rollover phase 3 will look like this: "ZSK phase 3". =item B<-roll-sleeptime sleep-time> B is the sleep-time for the B daemon. =item B<-roll-username username> B is the user for which the B daemon will be executed. If this is a username, it must correspond to a valid uid; if it is a uid, it must correspond to a valid username. =item B<-roll-logtz logtz> B is the timezone of the message timestamp for B's logfile. =item B<-zoneerrs error-count> B is the maximum error count for zones used by the B daemon. =item B<-savekeys> A flag indicating that old keys should be moved to the archive directory. =item B<-nosavekeys> A flag indicating that old keys should not be moved to the archive directory but will instead be left in place. =item B<-usegui> A flag indicating that the GUI for specifying command options may be used. =item B<-nousegui> A flag indicating that the GUI for specifying command options should not be used. =item B<-zoneparser parser-module> B is the name of the Perl module that will be used to parse zone files. The default is specified in I. =back =head2 dtinitconf Options These options deal specifically with B. =over 4 =item B<-outfile conffile> The configuration file will be written to B. If this is not given, then the default configuration file (as returned by I) will be used. If B is given as B<->, then the new configuration file will be written to the standard output. B must be writable. =item B<-overwrite> If B<-overwrite> is specified, existing output files may be overwritten. Without B<-overwrite>, if the output file is found to exist then B will give an error message and exit. =item B<-noprompt> If B<-noprompt> is specified, the user will not be prompted for any input. The configuration file will be created from command-line options and DNSSEC-Tools defaults. Guesses will be made for the BIND paths, based on the PATH environment variable. B: After using the B<-noprompt> option, the configuration file B be checked to ensure that the defaults are appropriate and acceptable for the installation. =item B<-template> If B<-template> is specified, a default configuration file is created. However, all entries are commented out. The only command line options that may be used in conjunction with B<-template> are B<-outfile> and B<-overwrite>. =item B<-edit> If B<-edit> is specified, the output file will be edited after it has been created. The EDITOR environment variable is consulted for the editor to use. If the EDITOR environment variable isn't defined, then the B editor will be used. =item B<-verbose> Provide verbose output. =item B<-Version> Displays the version information for B and the DNSSEC-Tools package. =item B<-help> Display a usage message and exit. =back =head1 COPYRIGHT Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B, B, B, B, B, B, B B, B, B, B, B B =cut dnssec-tools-2.2/tools/scripts/rollset0000775000237200023720000004450512544611342020375 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details. # # # rollset # # This script sets some values in a rollrec file. # use strict; use Getopt::Long qw(:config no_ignore_case_always); use Net::DNS::SEC::Tools::rollrec; use Net::DNS::SEC::Tools::rollmgr; use Net::DNS::SEC::Tools::tooloptions; # # Version information. # my $NAME = "rollset"; my $VERS = "$NAME version: 2.1.0"; my $DTVERS = "DNSSEC-Tools Version: 2.1"; ####################################################################### # # Data required for command line options. # my $verbose = 0; # Verbose flag. my $check = 0; # Check-rollrec flag. my $doall = 0; # Edit all rollrec entries flag. # # Flag variables for options. # my $name = ''; my $newname = ''; my $zonename = ''; my $zonefile = ''; my $zonegroup = ''; my $keyrec = ''; my $zsargs = ''; my $roll = 0; my $skip = 0; my $display = 0; my $nodisplay = 0; my $admin = 0; my $directory = 0; my $loglvl = -1; my $deladm = 0; my $deldir = 0; my $dellog = 0; my $delzsa = 0; my $delzg = 0; my $rstzn = 0; my %options = (); # Filled option array. my @opts = ( 'name=s', # Rollrec to edit. 'roll', # Make record a roll record. 'skip', # Make record a skip record. 'newname=s', # New rollrec name. 'zonename=s', # New zonename value. 'zg=s', # New zonegroup value. 'file=s', # New zonefile value. 'keyrec=s', # New keyrec value. 'admin=s', # New administrator email address. 'directory=s', # New directory for zone's files. 'loglevel=s', # New logging level value. 'display', # Turn on display flag. 'nodisplay', # Turn off display flag. 'zsargs=s', # New zonesigner arguments. 'del-admin', # Delete the administrator line. 'del-directory', # Delete the directory line. 'del-loglevel', # Delete the logging level line. 'del-zg', # Delete the zonegroup line. 'del-zsargs', # Delete the zonesigner arguments. 'reset-zonename', # Reset the zonename fields. 'check', # Run rollchk after edits. 'verbose', # Give lotsa output. 'Version', # Display the version number. 'help', # Give a usage message and exit. ); my $rrf; # Rollrec we're editing. my $ret; # Return code from main(). $ret = main(); exit($ret); #----------------------------------------------------------------------------- # Routine: main() # # Purpose: This routine controls everything. # sub main() { # # Check our options. # doopts(); # # Edit the rollrec file. # editrrf(); # # Maybe check the rollrec file for validity. # system("rollchk $rrf") if($check); return(0); } #----------------------------------------------------------------------------- # Routine: doopts() # # Purpose: This routine gets the options from the command line and does # a bit of validity checking. # sub doopts { my $argc = @ARGV; # Number of command line arguments. usage() if($argc == 0); GetOptions(\%options,@opts) || usage(); # # Set some flags based on the command line. # $name = $options{'name'}; $newname = $options{'newname'}; $zonename = $options{'zonename'}; $zonefile = $options{'file'}; $zonegroup = $options{'zg'}; $keyrec = $options{'keyrec'}; $admin = $options{'admin'}; $directory = $options{'directory'}; $roll = $options{'roll'}; $skip = $options{'skip'}; $display = $options{'display'}; $nodisplay = $options{'nodisplay'}; $loglvl = $options{'loglevel'} if(defined($options{'loglevel'})); $zsargs = $options{'zsargs'}; $deladm = $options{'del-admin'}; $deldir = $options{'del-directory'}; $dellog = $options{'del-loglevel'}; $delzg = $options{'del-zg'}; $delzsa = $options{'del-zsargs'}; $rstzn = $options{'reset-zonename'}; $check = $options{'check'}; $verbose = $options{'verbose'}; # # Show the version number or help info if requested. # version() if(defined($options{'Version'})); usage() if(defined($options{'help'})); # # Ensure we're not being asked to do the impossible. # (The stupid, actually.) # if($roll && $skip) { print STDERR "-roll and -skip are mutually exclusive\n"; exit(1); } if($display && $nodisplay) { print STDERR "-display and -nodisplay are mutually exclusive\n"; exit(1); } if(defined($zsargs) && $delzsa) { print STDERR "-zsargs and -del-zsargs are mutually exclusive\n"; exit(1); } if(defined($loglvl) && $dellog) { print STDERR "-loglevel and -del-loglevel are mutually exclusive\n"; exit(1); } if(defined($zonegroup) && $delzg) { print STDERR "-zg and -del-zg are mutually exclusive\n"; exit(1); } if(defined($zonename) && $rstzn) { print STDERR "-zonename and -reset-zonename are mutually exclusive\n"; exit(1); } # # Ensure the logging level is valid. # if($loglvl > -1) { my $logtmp; # Temporary log level. $logtmp = rolllog_num($loglvl); if($logtmp == -1) { print STDERR "loglevel $loglvl invalid\n"; exit(3); } $loglvl = rolllog_str($logtmp); } # # Convert the zonesigner arguments into their real form. # if($zsargs ne '') { my @zsargs = split / /, $zsargs; for(my $ind=0; $ind < @zsargs; $ind++) { $zsargs[$ind] =~ s/^=/-/; $zsargs[$ind] =~ s/=/ /; } $zsargs = join ' ', @zsargs; } # # If a rollrec name wasn't specified, we'll apply the fix to every # rollrec in the file. # $doall = 1 if(! $name); # # Ensure that -rename will be applied to a specific zone. # if($newname && $doall) { print STDERR "-rename may only be used with a single zone\n"; exit(5); } # # Remove leading and trailing whitespace, then ensure the name is # still there. # if(defined($zonegroup)) { $zonegroup =~ s/^\s*//; $zonegroup =~ s/\s*$//; if(length($zonegroup) == 0) { print STDERR "you must specify a zonegroup that isn't all blanks\n"; exit(6); } } # # Delete the non-command options and ensure that we were given # something to do. # delete $options{'name'}; delete $options{'check'}; delete $options{'verbose'}; delete $options{'Version'}; delete $options{'help'}; if(keys(%options) == 0) { print STDERR "you must specify something to be changed\n"; exit(4); } # # Ensure we were given a rollrec file to check. # usage() if($argc == 0); # # Save the name of the rollrec file. # $rrf = $ARGV[0]; } #----------------------------------------------------------------------------- # Routine: chkphase() # # Purpose: This routine verifies a rollover phase number. The phase # must be numeric and in the given range. # # Return Values: # 1 is returned on valid phase number. # 0 is returned on invalid phase number. # sub chkphase { my $phase = shift; # Phase to check. my $max = shift; # Phase's upper bound. my $ind; # # Check if the phase falls into the 0-to-$max range, returning # success if it does. # for(my $ind = 0; $ind <= $max; $ind++) { return(1) if($phase == $ind); } # # Return failure. # return(0); } #----------------------------------------------------------------------------- # Routine: editrrf() # # Purpose: This routine reads a rollrec file and performs the requested # record updates. # sub editrrf { # # Lock and load the rollrec file. # rollrec_lock(); if(rollrec_read($rrf) < 0) { rollrec_unlock(); print STDERR "unable to read rollrec file \"$rrf\"\n"; exit(-1); } # # Ensure the specified rollrec name exists. # if(!$doall && (rollrec_exists($name) == 0)) { print STDERR "invalid rollrec name \"$name\"\n"; exit(7); } # # Change the rollrec name, if so requested. # if($newname) { my $ret; # Rename return code. $ret = rollrec_rename($name,$newname); if($ret == 0) { if($verbose) { print "name: rollrec name changed to \"$newname\"\n"; } } elsif($ret == -3) { print STDERR "unable to rename \"$name\"; $name is not a valid rollrec name\n"; } elsif($ret == -4) { print STDERR "unable to rename \"$name\"; $newname is already a rollrec name\n"; } elsif($ret == -5) { print STDERR "unable to rename \"$name\"\n"; } } # # Go through the rollrecs and apply the needed changes. # foreach my $rname (rollrec_names()) { # # Go to the next record if we aren't doing everything or if # this isn't the specified record. # next if(!$doall && ($rname ne $name)); # # Set the rollrec record's type as requested by the user. # typer($roll,$rname,'roll'); typer($skip,$rname,'skip'); # # Set the rollrec fields as requested by the user. # changer($zonename,$rname,'zonename',$zonename); changer($zonefile,$rname,'zonefile',$zonefile); changer($zonegroup,$rname,'zonegroup',$zonegroup); changer($keyrec,$rname,'keyrec',$keyrec); changer($admin,$rname,'administrator',$admin); changer($directory,$rname,'directory',$directory); changer($zsargs,$rname,'zsargs',$zsargs); changer($display,$rname,'display',1); changer($nodisplay,$rname,'display',0); changer($loglvl,$rname,'loglevel',$loglvl) if($loglvl > -1); # # Delete some fields. # deleter($deladm,$rname,'administrator'); deleter($deldir,$rname,'directory'); deleter($dellog,$rname,'loglevel'); deleter($delzg,$rname,'zonegroup'); deleter($delzsa,$rname,'zsargs'); # # Reset some fields. # changer($rstzn,$rname,'zonename',$rname); # # If we aren't messing with all the rollrecs then we're # done because we've found the requested record. # last if(!$doall); } # # Close, write, and unlock the rollrec file. # rollrec_close(); rollrec_unlock(); } #---------------------------------------------------------------------- # Routine: typer() # # Purpose: Change a rollrec record's type to roll or skip. # sub typer { my $flag = shift; # Flag value. my $rname = shift; # Rollrec name. my $rectype = shift; # New record type. # # Do nothing if this record type shouldn't be changed. # return if(!$flag); # # If the verbose flag was given, we'll give a message. # print "$rname: changing record type to \"$rectype\"\n" if($verbose); # # Change the rollrec record's type. # rollrec_rectype($rname,$rectype); } #---------------------------------------------------------------------- # Routine: changer() # # Purpose: Change a rollrec field value and maybe give verbose messages. # sub changer { my $flag = shift; # Flag value. my $rname = shift; # Rollrec name. my $field = shift; # Field to change. my $val = shift; # Field's new value. # # Do nothing if this field shouldn't be changed. # return if(!$flag); # # If the verbose flag was given, we'll show the old value and # the new value. # if($verbose) { my $oldval; # Old value. $oldval = rollrec_recval($rname,$field); print "$rname: changing $field \"$oldval\" to \"$val\"\n"; } # # Change the rollrec field's value. # rollrec_setval($rname,$field,$val); } #---------------------------------------------------------------------- # Routine: deleter() # # Purpose: Delete a rollrec field and maybe give verbose messages. # sub deleter { my $flag = shift; # Flag value. my $rname = shift; # Rollrec name. my $field = shift; # Field to delete. my $val; # Value of field. # # Do nothing if this field shouldn't be deleted. # return if(!$flag); # # Ensure the field exists for the rollrec. # $val = rollrec_recval($rname,$field); if(!defined($val)) { print "$rname does not have a $field field\n" if(!$doall); return; } # # If the verbose flag was given, we'll show the current value. # print "$rname: deleting $field \"$val\"\n" if($verbose); # # Delete the rollrec field. # rollrec_delfield($rname,$field); } #---------------------------------------------------------------------- # Routine: version() # # Purpose: Print the version number(s) and exit. # sub version { print STDERR "$VERS\n"; print STDERR "$DTVERS\n"; exit(0); } #----------------------------------------------------------------------------- # Routine: usage() # sub usage { print STDERR "usage: rollset [options] \n"; print STDERR " options:\n"; print STDERR " -name rollrec-name\n"; print STDERR " -roll\n"; print STDERR " -skip\n"; print STDERR " -newname new-zone-name\n"; print STDERR " -zonename zone-name\n"; print STDERR " -zg zonegroup-name\n"; print STDERR " -file zone-file\n"; print STDERR " -keyrec keyrec-file\n"; print STDERR " -admin admin-email\n"; print STDERR " -directory zone-directory\n"; print STDERR " -loglevel logging-level\n"; print STDERR " -zsargs zonesigner-arguments\n"; print STDERR " -display\n"; print STDERR " -nodisplay\n"; print STDERR " -del-admin\n"; print STDERR " -del-directory\n"; print STDERR " -del-loglevel\n"; print STDERR " -del-zg\n"; print STDERR " -del-zsargs\n"; print STDERR " -reset-zonename\n"; print STDERR " -check\n"; print STDERR " -verbose\n"; print STDERR " -Version\n"; print STDERR " -help\n"; exit(0); } 1; ############################################################################## # =pod =head1 NAME rollset - Modifies entries in a DNSSEC-Tools I file =head1 SYNOPSIS rollset [options] rollrec-file =head1 DESCRIPTION B modifies fields in the I file specified by I. Multiple options may be combined in a single B execution. B operates quietly unless it is given the I<-verbose> option. All records in the specified I file will be modified, unless the B<-name> option is given. In that case, only the named zone will be modified. =head1 OPTIONS =over 4 =item B<-admin addr> The zone administrator's email address is set to I. =item B<-check> If this option is given, the B command will be run on the modified I file. =item B<-del-admin> The I line is deleted. The B<-admin> and B<-del-admin> options are mutually exclusive. =item B<-del-directory> The I line is deleted. The B<-directory> and B<-del-directory> options are mutually exclusive. =item B<-del-loglevel> The I line is deleted. The B<-loglevel> and B<-del-loglevel> options are mutually exclusive. =item B<-del-zg> The I line is deleted. The B<-zg> and B<-del-zg> options are mutually exclusive. =item B<-del-zsargs> The I line is deleted. The B<-zsargs> and B<-delzsargs> options are mutually exclusive. =item B<-directory dir> The directory to hold the zone's files is set to I. =item B<-display> Turn on the GUI display of the zones in the selected Is. This option is mutually exclusive of the I<-nodisplay> option. =item B<-file zone-file> The zone file in the selected I records is modified to be I. =item B<-keyrec keyrec-file> The I file in the selected I records is modified to be I. =item B<-loglevel logging-level> The logging level of the selected I records is set to I. The valid logging levels are defined in I. =item B<-name rollrec-name> The I whose name matches I is selected as the only rollrec that will be modified. If this name is not given, then all I records will be modified. =item B<-nodisplay> Turn off the GUI display of the zones in the selected Is. This option is mutually exclusive of the B<-display> option. =item B<-rename> The I's name is changed to match the specified name. The new name cannot be the name of an existing I in the file. This option must be used in conjunction with the B<-name> option. =item B<-reset-zonename> The I field is set to match the name of the I record. This option is mutually exclusive of the B<-zonename> option. =item B<-roll> Convert the selected Is to be active ("roll") records. This option is mutually exclusive of the B<-skip> option. =item B<-skip> Convert the selected Is to be inactive ("skip") records. This option is mutually exclusive of the B<-roll> option. =item B<-zg zonegroup-name> The zonegroup in the selected I records is modified to be I. This field may contain a single zonegroup name or a comma-separated list of names. If a list is given, then there may be whitespace before or after each name, but it is not recognized as being part of the zonegroup name itself. Whitespace I the name is considered part of the name. Zonegroup names are considered case insensitive. The names may be given with whatever case the user desires, but names whose only differences are the case of the letters are considered to be the same name. =item B<-zonename zone-name> The zone name in the selected I records is modified to be I. =item B<-zsargs arglist> Provides additional B arguments. These arguments will override the arguments in the DNSSEC-Tools defaults file, the DNSSEC-Tools configuration file, and the zones' I files. The B argument list is given in I. If more than one argument is given, the set of arguments should be enclosed in quotes. Given the B argument processing, the new arguments for B cannot be specified as expected. Instead, the arguments should be given in the following manner. The leading dash should be replaced with an equals sign. If the option takes an argument, the space that would separate the option from the option's argument should also be replaced by an equals sign. B translates these arguments to the appropriate format for B. These examples should clarify the argument modifications: normal zonesigner option -zsargs options ------------------------ --------------- -nokrfile =nokrfile -zskcount 5 =zskcount=5 The following are valid uses of I<-zsargs>: # rollset -zsargs =ksklength=2048 example.rollrec # rollset -zsargs "=ksklen=2048 =zsklen=2048" example.rollrec The B<-zsargs> and B<-delzsargs> options are mutually exclusive. =item B<-verbose> Display information about every modification made to the I file. =item B<-Version> Displays the version information for B and the DNSSEC-Tools package. =item B<-help> Display a usage message. =back =head1 COPYRIGHT Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B, B, B, B B, B B =cut dnssec-tools-2.2/tools/scripts/getdnskeys0000775000237200023720000001754312544611342021073 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2008-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details. # # # getdnskeys # use strict; use Net::DNS; use IO::File; use Net::DNS::SEC::Tools::BootStrap; use Net::DNS::SEC::Tools::QWPrimitives; # # Version information. # my $NAME = "getdnskeys"; my $VERS = "$NAME version: 2.0.0"; my $DTVERS = "DNSSEC-Tools Version: 2.1"; ###################################################################### # detect needed perl module requirements # dnssec_tools_load_mods('Net::DNS::SEC' => ""); my %opts; my @origargs = @ARGV; DTGetOptions(\%opts, ['GUI:VERSION',"0.9.1\nDNSSEC-Tools Version: 2.1"], ['GUI:separator',"DNS Configuration:"], ['k','Only look for key signing keys (KSK) and ignore others'], ['GUI:separator', "Named.conf configuration file input support:"], ['i|named-conf-in-file=s', 'Read path as a named.conf to compare key lists with'], ['T|use-current-trusted-keys', 'Check the current trusted key list from named.conf'], ['GUI:separator', "Named.conf configuration file output support:"], ['o|output-file=s','Output the results to a file'], ['t|print-named-conf-tokens', 'Enclose output in needed named.conf syntax markers'], ['GUI:separator','Miscellaneous Configuration:'], ['v|verbose','Verbose mode'], ['V|Version','Program and DNSSEC-Tools versions'], ); my $res = Net::DNS::Resolver->new; $res->udppacketsize(4096); my %keystorage; my $output; version() if($opts{'V'}); read_named_conf_keys(\%keystorage, $opts{'i'}) if ($opts{'i'}); if ($opts{'o'}) { $output = new IO::File; if (!$output->open(">" . $opts{'o'})) { print STDERR "Could not open output file: $opts{'o'}\n"; exit 1; } } use Data::Dumper;; my @currentkeys; @currentkeys = keys(%keystorage) if ($opts{'T'}); # print leading named.conf information if ($opts{'t'}) { Output("// \n"); Output("// trusted-keys list generated by $0\n"); Output("// arguments: ", join(" ",@origargs),"\n"); Output("// \n\n"); Output("trusted-keys {\n"); } # # foreach domain to check, query for it's dns keys and then compare # against the stashed copies. # foreach my $domain (@currentkeys, @ARGV) { my $q = $res->query($domain, "DNSKEY"); Verbose("Checking keys in $domain\n"); if ($q) { # my $newkeys = 0; foreach my $rec (grep { $_->type eq 'DNSKEY'} $q->answer) { next if ($opts{'k'} && !($rec->flags & 1)); # KSK's only my $key = $rec->key; $key =~ s/\s+//g; # if we're storing output (! -q) then print the keys Output_Key($domain, $rec->flags, $rec->protocol, $rec->algorithm, $key); # compare against cached named.conf records $newkeys += compare_keys(\%keystorage, $domain, $rec, $key) } Verbose(sprintf(" Old: %3d New: %3d\n", 1+$#{$keystorage{$domain}}, $newkeys)); } else { # no answer or other resolution problem print STDERR " Error pulling keys for $domain (maybe there were none)\n"; print STDERR " Error: " . $res->errorstring . "\n"; } } # # find the keys we couldn't verify # foreach my $domain (keys(%keystorage)) { foreach my $key (@{$keystorage{$domain}}) { if (!$key->{'found'}) { # key wasn't found on-line. Output_Key($domain, $key->{'flags'}, $key->{'protocol'}, $key->{'algorithm'}, $key->{'key'}); } } } # print the trailer for the named.conf information Output("};\n") if ($opts{'t'}); ####################################################################### # compare_keys() # # compares the contents of two keys to see if the new one ($domain, # $rec, and $keyin) matches the cached one previously remembered (in # $storage->{$domain} ) # sub compare_keys { my ($storage, $domain, $rec, $keyin) = @_; if (!exists($storage->{$domain})) { print STDERR " Found a key for $domain; previously we had none cached\n"; } my $keys = $storage->{$domain}; foreach my $key (@$keys) { if ($key->{'flags'} eq $rec->flags && $key->{'protocol'} eq $rec->protocol && $key->{'algorithm'} eq $rec->algorithm && $key->{'key'} eq $keyin) { # the key exactly matches a stored key $key->{'found'} = 1; return 0; } } print STDERR " Found a new key found for $domain\n"; return 1; } ####################################################################### # read_named_conf_keys() # # reads in a named.conf file pointed to by $file and stores key # information in $storage # sub read_named_conf_keys { my ($storage, $file) = @_; Verbose("reading and parsing trust keys from $file\n"); # regexp pulled from Fast.pm my $pat_maybefullname = qr{[-\w\$\d*]+(?:\.[-\w\$\d]+)*\.?}; my $fh = new IO::File; if (!$fh->open("<$file")) { print STDERR "Could not open named configuration file: $file\n"; exit 1; } while (<$fh>) { if (/trusted-keys {/) { while (<$fh>) { last if (/^\s*};/); if (/\s*($pat_maybefullname)\s+(256|257)\s+(\d+)\s+(\d+)\s+\"(.+)\"\s*;/) { push @{$storage->{$1}}, { flags => $2, protocol => $3, algorithm => $4, key => $5 }; $storage->{$1}[$#{$storage->{$1}}]{key} =~ s/\s+//g; } } } } } ####################################################################### # Verbose() # # prints something(s) to STDERR only if -v was specified. # sub Verbose { print STDERR @_ if ($opts{'v'}); } ####################################################################### # Output() # # prints something(s) to the output filehandle if -o was specified. # sub Output { print $output @_ if ($opts{'o'}); } ####################################################################### # Output_Key() # # Prints out a key to the output filehandle # sub Output_Key { my ($domain, $flags, $protocol, $algorithm, $keydata) = @_; # if we're storing output (! -q) then print the keys Output(sprintf " %s %d %d %d \"%s\";\n", $domain, $flags, $protocol, $algorithm, $keydata); } ####################################################################### # version() # # Prints version information and exits. # sub version { print STDERR "$VERS\n"; print STDERR "$DTVERS\n"; exit(0); } ####################################################################### # =pod =head1 NAME getdnskeys - Manage lists of DNSKEYs from DNS zones =head1 SYNOPSIS getdnskeys [-i file] [-o file] [-k] [-T] [-t] [-v] [zones] =head1 DESCRIPTION B manages lists of DNSKEYs from DNS zones. It may be used to retrieve and compare DNSKEYs. The output from B may be included (directly or indirectly) in a B file. =head1 OPTIONS B takes the following options: =over 4 =item B<-i path> Reads I as a B with which to compare key lists. =item B<-k> Only looks for Key Signing Keys (KSKs); all other keys are ignored. =item B<-o file> Writes the results to I. =item B<-T> Checks the current trusted key list from B. =item B<-t> Encloses output in needed B syntax markers. =item B<-v> Turns on verbose mode for additional output. =item B<-Version> Displays the version information for B and the DNSSEC-Tools package. =item B<-h> Gives a help message. =back =head1 EXAMPLES This B will retrieve the KSK for example.com: getdnskeys -o /etc/named.trustkeys.conf -k -v -t example.com This B will check saved keys against a live set of keys: getdnskeys -i /etc/named.trustkeys.conf -T -k -v -t This B will automatically update a set of saved keys: getdnskeys -i /etc/named.trustkeys.conf -k -t -T -v -o /etc/named.trustkeys.conf =head1 SECURITY ISSUES Currently this does not validate new keys placed in the file in any way, nor does it validate change over keys which have been added. It also does not handle revocation of keys. It should prompt you before adding a new key so that you can always run the auto-update feature. =cut dnssec-tools-2.2/tools/scripts/tachk0000775000237200023720000002222012544611342017771 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details. # # # tachk # # This script checks the validity of configured trust anchors # use strict; use Getopt::Long qw(:config no_ignore_case_always); use Net::DNS; use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::tooloptions; use Net::DNS::SEC::Tools::BootStrap; # # Version information. # my $NAME = "tachk"; my $VERS = "$NAME version: 2.0.0"; my $DTVERS = "DNSSEC-Tools Version: 2.1"; ###################################################################### # detect needed perl module requirements # dnssec_tools_load_mods('Net::DNS::SEC' => ""); ####################################################################### # # Data required for command line options. # my %options = (); # Filled option array. my @opts = ( "valid", # List valid trust anchors "invalid", # List invalid trust anchors "count", # Only give a count of trust anchors "terse", # Give terse output. "Version", # Display version. "long", # Give long output. "help", # Give a usage message and exit. ); # # Configuration options. # my %config = (); # # Flag values for the various options. Variable/option connection should # be obvious. # my $validflag; my $invalidflag; my $cntflag; my $terse; my $long; my $version; my $count = 0; # Record-match count. my %anchors = (); ####################################################################### my $ret; # Return code from main(). $ret = main(); exit($ret); #----------------------------------------------------------------------------- # # Routine: main() # sub main() { my $argc = @ARGV; # Number of command line arguments. my $errors = 0; # Total error count. # # Check our options. # doopts($argc); # # Parse the conf file. # %config = parseconfig(); # # Read the named.conf file. # getanchors($ARGV[0]); # # Give the output. # showanchors(); # # If the matching-record count should be given, give the count in # requested format. # if($cntflag) { if($terse) { print "$count\n"; } else { my $plural = "s"; $plural = "" if($count == 1); print "$count matching record$plural\n"; } } return(0); } #----------------------------------------------------------------------------- # # Routine: doopts() # # Purpose: This routine shakes and bakes our command line options. # A bunch of option variables are set according to the specified # options. Then a little massaging is done to make sure that # the proper actions are taken. A few options imply others, so # the implied options are set if the implying options are given. # sub doopts { my $argc = shift; # Command line argument count. # # Parse the options. # GetOptions(\%options,@opts) || usage(); # # Set our option variables based on the parsed options. # $validflag = $options{'valid'} || 0; $invalidflag = $options{'invalid'} || 0; $cntflag = $options{'count'} || 0; $terse = $options{'terse'} || 0; $long = $options{'long'} || 0; $version = $options{'Version'} || 0; # # Display the version number # show_version() if ($options{'Version'}); # # Give a usage flag if asked. # usage() if(defined($options{'help'})); # # Ensure we were given a named.conf file to check. # $argc = @ARGV; if($argc == 0) { usage(); exit(1); } } #----------------------------------------------------------------------------- # # Routine: getanchors() # sub getanchors { my $conffile = shift; # named.conf file my $inblock = 0; # # Make sure the config file actually exists. If not, we'll quietly return. # return if(! -e $conffile); # # Open up the config file. # if (open (CONF,"< $conffile") == 0) { print STDERR "unable to open $conffile\n"; return; } # # Read each line from the file, build a DNSKEY RR, and add it # to the anchors hash table. # while () { # # Do the in-block stuff first. # if ($inblock) { # # If this is the end of the block, we're done. # if (/\}/) { $inblock = 0; } # # Read the next line and build a DNSKEY RR. # else { my ($name, $flags, $protocol, $algorithm, $keydata) = split(/ /, $_, 5); my $rrstring = substr($name,2,-2) . " IN DNSKEY " . $flags . " " . $protocol . " " . $algorithm . " " . substr($keydata,2,-3); my $dnskeyrr = Net::DNS::RR->new($rrstring); # # Add this variable/value pair to the anchors hash table. # $anchors{$dnskeyrr->keytag} = { name => $dnskeyrr->name, keytag => $dnskeyrr->keytag, valid => 0, dnskey => $dnskeyrr }; } } # # If we're not in a block yet, see if this line indicates the start of one. # if (/trusted-keys/) { # I need to check on the open brace as well, this will suffice for now. $inblock = 1; } } # # Close the configuration file # close(CONF); } #----------------------------------------------------------------------------- # # Routine: showanchors() # sub showanchors { # # Get a Net::DNS resolver to make queries through. # my $res = Net::DNS::Resolver->new; my %anchor = (); # # Iterate over each of the trust anchors. # foreach my $k (sort(keys(%anchors))) { %anchor = %{$anchors{$k}}; # # Start by querying for the name and any DNSKEY RRs. # my $packet = $res->send($anchor{'name'},'DNSKEY'); # # If there are no DNSKEY RRs for the name. # if ($packet->header->ancount == 0) { # # Mark the trust anchor as invalid. # $anchor{'valid'} = 0; # # If the user is interested in invalid trust anchors. # if ($invalidflag) { # # Bump the matching-records count. # $count++; # # If the user is not just interested in the count of matching records. # if (!$cntflag) { # # Give the output line appropriate # print "$anchor{'name'}/$anchor{'keytag'} is invalid.\n"; } } } # # There are DNSKEY RRs for the name. # else { # # Iterate over the RRs returned in the answer. # foreach my $rr ($packet->answer) { # # If one of the RRs has a keytag that matches our anchor. # if ($anchor{'keytag'} == $rr->keytag) { # # Mark the anchor as valid. # $anchor{'valid'} = 1; } } # # If the user is interested in valid trust anchors. # if ($validflag) { # # Bump the matching-records count. # $count++; # # If the user is not just interested in the count of matching records. # if (!$cntflag) { # # Give the output line appropriate. # print "$anchor{'name'}/$anchor{'keytag'} is valid.\n"; } } } } } #---------------------------------------------------------------------- # # Routine: show_version() # # Purpose: Print the version number(s) and exit. # sub show_version { print STDERR "$VERS\n"; print STDERR "$DTVERS\n"; exit(0); } #----------------------------------------------------------------------------- # # Routine: usage() # sub usage { print STDERR "usage: tachk [options] \n"; print STDERR "\trecord-attribute options:\n"; print STDERR "\t\t-valid\t show valid trust anchors\n"; print STDERR "\t\t-invalid show invalid trust anchors\n"; print STDERR "\toutput-format options:\n"; print STDERR "\t\t-count only give count of matching trust anchors\n"; print STDERR "\t\t-terse\t terse output\n"; print STDERR "\t\t-long long output\n"; print STDERR "\t\t-Version version message \n"; print STDERR "\t\t-help help message \n"; exit(0); } 1; ############################################################################## # =pod =head1 NAME tachk - Check the validity of the trust anchors in a B file =head1 SYNOPSIS tachk [options] =head1 DESCRIPTION B checks the validity of the trust anchors in the specified B file. The output given depends on the options selected. Note: This script may be removed in future releases. =head1 OPTIONS B takes two types of options: record-attribute options and output-style options. These option sets are detailed below. =head2 Record-Attribute Options These options define which trust anchor records will be displayed. =over 4 =item B<-valid> This option displays the valid trust anchors in a B file. =item B<-invalid> This option displays the invalid trust anchors in a B file. =back =head2 Output-Format Options These options define how the trust anchor information will be displayed. Without any of these options, the zone name and key tag will be displayed for each trust anchor. =over 4 =item B<-count> The count of matching records will be displayed, but the matching records will not be. =item B<-long> The long form of output will be given. The zone name and key tag will be displayed for each trust anchor. =item B<-terse> This option displays only the name of the zones selected by other options. =item B<-Version> Displays the version information for B and the DNSSEC-Tools package. =item B<-help> Display a usage message. =back =head1 AUTHOR Wesley Griffin (Current contact for B is Wayne Morrison, tewok@tislabs.com.) =head1 SEE ALSO B B =cut dnssec-tools-2.2/tools/dnspktflow/0000775000237200023720000000000012544611342017457 5ustar hardakerhardakerdnssec-tools-2.2/tools/dnspktflow/.cvsignore0000664000237200023720000000012012544611342021450 0ustar hardakerhardakerdb.* *.png *.signed Makefile blib pm_to_blib *.dump *.tethereal *.tcpdump *.mgp dnssec-tools-2.2/tools/dnspktflow/dnspktflow0000775000237200023720000004201212544611342021577 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2004-2013 SPARTA, Inc. All rights reserved. # See the COPYING file included with the DNSSEC-Tools package for details. # use Data::Dumper; use strict; use File::Temp qw(tempfile); use IO::File; use Net::DNS::SEC::Tools::BootStrap; use Net::DNS::SEC::Tools::QWPrimitives; ###################################################################### # detect needed GraphViz requirement # dnssec_tools_load_mods('GraphViz' => ""); my %opts; my $mapinwindow; %opts = ( o => "out%03d.png", b => 1, l => 0, fontsize => 9, 'layout-style' => 'dot', ); use QWizard; DTGetOptions(\%opts, ['GUI:otherargs_text', 'tcpdump files to analyze'], ["GUI:screen", "Input Packet Selection:"], ["GUI:guionly", { type => 'label', text => 'DNS Name Filters:'}], ['i|ignore-hosts=s',"A regular expression of host names to ignore in the query/response fields"], ['r|only-hosts=s',"A regular expression of host names to analyze in the query/response fields"], ['f|show-frame-num',"Display the packet frame numbers"], ['Q|no-query-num', "Don't show the query number"], ['b|begin-frame=i',"Begin at packet frame NUMBER"], ["GUI:screen", "Output File Options:"], ['o|output-file=s', "Output file name (default: $opts{o} as png format)", # question => { 'type' => 'fileupload' } ], ['fig','Output format should be fig'], ['svg','Output format should be svg'], ['svgz','Output format should be svgz'], ['ps','Output format should be postscript'], ['O|tshark-out=s','Save tshark output to this file', # question => { 'type' => 'fileupload' } ], ['m|multiple-outputs', "One picture per request (use %03d in the filename)"], ['M|magic-point=s', "Saves a Magic Point presentation for the output"], ["GUI:screen", "Output Visualization Options:"], ['layout-style=s','Layout style', question => { type => 'menu', values => [qw(dot neato twopi circo fdp)] }], ['node-size=s', "Reduce node size to 'small' or 'none'"], ['L|last-line-labels-only', "Only show data on the last line drawn."], ['z|most-lines=i', "Only show at most INTEGER connections."], "", ['T|input-is-tshark-out','The input file is already processed by tshark'], ["GUI:separator", "Graphical Options:"], ['t|show-type',"Shows message type in result image"], ['q|show-queries',"Shows query questions in result image"], ['a|show-answers',"Shows query answers in result image"], ['A|show-authoritative',"Shows authoritative information in result image"], ['x|show-additional',"Shows additional information in result image"], ['l|show-label-lines','Shows lines attaching labels to lines'], ['C|dont-cluster-auth', "Don't group the authoritative addresses"], ["fontsize=i","Font Size"], ["GUI:separator", "Debugging:"], ["d|dump-pkts", "Dump data collected from the packets"], ["h|help", "Show help for command line options"], # # GUI only options # ['GUI:guionly',{type => 'checkbox', values => [1,0], default => 1, text => 'Show map in a window', name => 'mapinwindow'}], ['GUI:actions', sub { require QWizard; import QWizard; $mapinwindow = qwparam('mapinwindow')}], ['GUI:VERSION',"DNSSEC-Tools Version: 2.1"], ); my $data; my @dnspkts; my $state; my $qdata; my $shorttype; my %authdata; my %ipdata; my $nameexp = '[-\w\.<>]+'; my $addrexp = '[\da-f\.:]+'; my $eitherexp = '[\w\.:]+'; foreach my $file (@ARGV) { my ($fh, $filename); # use tshark to parse the tcpdump file and save the text output # to the file specified by the -f option. Then set the file # variable to that file for use later. if (!$opts{'T'}) { if ($opts{'O'}) { $fh = new IO::File; $fh->open(">$opts{O}"); $filename = $opts{'O'}; } else { ($fh, $filename) = tempfile("dnspktXXXXXX", SUFFIX => 'txt', DIR => "/tmp"); } open(T,"tshark -V -o ip.defragment:TRUE -n -r $file|"); while () { print $fh $_; } close(T); $fh->close(); $file = $filename; } # read in the tshark output text file and parse it for various patterns open(I, $file); while () { # If it's a new frame, it's a brand new packet if (/^Frame (\d+)/) { $data = { Frame => $1 }; } # mark if we're a TCP packet $data->{'tcp'} = 1 if (/Transmission Control Protocol/); # collect to/from addresses (v4 or v6) $data->{'src'} = $1 if (/^Internet.*Src: ($eitherexp)/); $data->{'dst'} = $1 if (/^Internet.*Dst: ($eitherexp)/); # If DNS, remember the type of DNS message and push to packet list if (/Domain Name System \((\w+)\)/) { $data->{'type'} = $1; push @dnspkts, $data; } # misc things to watch for $data->{'dnssecok'} = 1 if (/Accepts DNSSEC/); $shorttype = $1 if (/type (\w+)/); $data->{'err'} = "/$1" if (/Reply code:\s*(.*)/); $data->{'truncated'} = 1 if (/1.*Truncated/); $data->{'udpsize'} = $1 if (/UDP payload size: (\d+)/); # mark if ... if (/(0|1).*(Truncated)/) { $data->{'flags'}{$2} = $1; } # collect queries and answers and ... $state = $1 if (/^\s*(Queries|Answers|Additional|Authoritative)/); # start a new record on a Name: field if (/^\s*Name: ($nameexp)/) { # remember the query itself $qdata = { Name => $1, type => $shorttype }; # save the query data by packet section. push @{$data->{'dns'}{$state}}, $qdata; # If the name matches the -i flag regexp, drop it # if the name doesn't match -r flag, drop it if (($opts{'i'} && $qdata->{'Name'} =~ /$opts{'i'}/) || ($opts{'r'} && $qdata->{'Name'} !~ /$opts{'r'}/)) { # drop packets we don't care about if ($#dnspkts > -1 && $dnspkts[$#dnspkts]{'Frame'} == $data->{'Frame'}) { print "dropping $data->{'Frame'}\n" if ($opts{'d'}); pop @dnspkts; } } } # remember other things that may be in it $qdata->{$1} = $2 if (/^\s*(Type|Name Server|Algorithm):\s*(.*)/); # remember authoritative name servers $authdata{$1}{$qdata->{'Name'}} = 1 if ($state eq 'Authoritative' && /Name server:\s($nameexp)/); $ipdata{$1} = $qdata->{'Name'} if (/^\s*Addr: ($addrexp)/); } close(I); unlink($filename) if (! $opts{'O'}); } # debugging output if ($opts{'d'}) { print "-" x 70, "\npackets:"; print Dumper(\@dnspkts); print "-" x 70, "\nauthdata:"; print Dumper(\%authdata); print "-" x 70, "\nip data:"; print Dumper(\%ipdata); } ####################################################################### # actually draw/output the results # # # multiple output files # if ($opts{'m'}) { $| = 1; print "Generating $#dnspkts images: "; # magic point output files if ($opts{'M'}) { open(M,">$opts{'M'}"); print M "%default 1 leftfill, size 2, fore \"dark blue\", back \"white\"\n"; print M "%default 2 size 6, vgap 10, prefix \" \", fore \"dark blue\"\n"; print M "%default 3 size 2, bar \"dark blue\", vgap 75, fore \"black\"\n"; } } # # graphviz images # my $gv; # either display everything at once, or if multiple files are # requested: save a series of cascading images to create an animation # with each new packet adding to the previous screen's data. #my @graphArgs = (layout => $opts{'layout-style'}, # edge => { fontsize => $opts{'fontsize'}}); my @graphArgs = (layout => 'fdp', rankdir => 1, edge => { fontsize => $opts{'fontsize'}}); if ($opts{'layout-style'} eq 'dot') { push @graphArgs, rankdir => 1; } for (my $m = ($opts{'m'} ? 0 : $#dnspkts); $m <= $#dnspkts; $m++) { if (exists($opts{'node-size'})) { if ($opts{'node-size'} eq 'small') { require GraphViz::Small; $gv = GraphViz::Small->new(@graphArgs); } elsif ($opts{'node-size'} eq 'none') { require GraphViz::No; $gv = GraphViz::No->new(@graphArgs); } else { print STDERR "The graphviz --node-style $opts{'node-size'} is not legal.\n"; print STDERR " please use option values of 'no' or 'small' instead.\n"; exit 1; } } else { $gv = GraphViz->new(@graphArgs); } for (my $i = ($opts{'z'} ? ($m > $opts{'z'} ? ($m - $opts{'z'}) : 0) : 0); $i <= (($opts{'m'}) ? $m : $#dnspkts); $i++) { my $pkt = $dnspkts[$i]; next if ($pkt->{'Frame'} < $opts{'b'}); $gv->add_node($pkt->{'src'}, label => get_host_label_plus($pkt->{'src'}), fontsize => $opts{'fontsize'}); $gv->add_node($pkt->{'dst'}, label => get_host_label_plus($pkt->{'dst'}), fontsize => $opts{'fontsize'}); my $edge = $gv->add_edge($pkt->{'src'} => $pkt->{'dst'}, get_edge_properties($pkt, $i, $m), decorateP => $opts{'l'}); } # if doing multiple files, save each frame to an individual image if ($opts{'m'}) { print " $m"; my $file = sprintf($opts{'o'}, $m); save_now($gv, $file); # if doing magic-point output, write the presentation screen if ($opts{'M'}) { print M "%page\n\nMessage " . ($m+1) . " / " . ($#dnspkts+1) . "\n" . get_host_label($dnspkts[$m]{'src'}) . " -> " . get_host_label($dnspkts[$m]{'dst'}) . "\n%center\n%image \"$file\"\n"; } } } if ($opts{'m'}) { # finish multiple output display print "\n"; } else { # if not multiple, save the final results # (if magic point then the results were already saved above) $opts{'o'} =~ s/\%\d*d//; save_now($gv, $opts{'o'}); } # # display the results in a window if requested # if ($mapinwindow && $Getopt::GUI::Long::GUI_qw) { $Getopt::GUI::Long::GUI_qw->merge_primaries( { mapout => { title => 'Map', questions => [{ type => 'image', image => $opts{'o'}, }] }}); $Getopt::GUI::Long::GUI_qw->magic('mapout'); } # # saves the current graphviz output as a fig or a png file # sub save_now { my ($gv,$file) = @_; if ($opts{'fig'}) { $gv->as_fig($file); } elsif ($opts{'svg'}) { $gv->as_svg($file); } elsif ($opts{'svgz'}) { $gv->as_svgz($file); } elsif ($opts{'ps'}) { $gv->as_ps($file); } else { $gv->as_png($file); } } sub get_host_label { my $addr = shift; my $lab; $lab = exists($ipdata{$addr}) ? $ipdata{$addr} : $addr; if (exists($authdata{$lab})) { $lab .= "\nauth:" . join("\nauth:",keys(%{$authdata{$lab}})); } return $lab; } sub get_host_label_plus { my $addr = shift; my @ret; if ($opts{'C'}) { return get_host_label($addr); } # return the host label push @ret, (exists($ipdata{$addr}) ? $ipdata{$addr} : $addr); # see if the node should be clustered with other nodes if (exists($authdata{$ret[0]})) { my $str = keys(%{$authdata{$ret[0]}}); push @ret, 'cluster', join("\n",keys(%{$authdata{$ret[0]}})); } return @ret; } # # create an edge label based on packet data # sub get_edge_properties { my ($pkt, $num, $mnum) = @_; my $lab = ''; my ($txt, $cnt, $type, $count); # $lab .= "$num / " . $pkt->{'Frame'}; $num++; $lab .= $num if (!$opts{'Q'}); $lab .= "/frame=" . $pkt->{'Frame'} if ($opts{'f'}); $lab .= "/trunc" if ($pkt->{'truncated'}); $lab .= "/udp=$pkt->{udpsize}" if ($pkt->{'udpsize'}); $lab .= "/dnssecok" if ($pkt->{'dnssecok'}); $lab .= "\n$pkt->{'err'}" if ($pkt->{'err'} && $pkt->{'err'} !~ /No err/); # $lab .= "\n$pkt->{'type'}"; if ($opts{'q'} && $pkt->{'type'} eq 'query') { $lab .= add_breakdown($pkt, 'Queries', '?'); } if ($opts{'a'} && $pkt->{'type'} eq 'response') { $lab .= add_breakdown($pkt, 'Queries', '='); } if ($opts{'A'} && $pkt->{'type'} eq 'response') { $lab .= add_breakdown($pkt, 'Authoritative', 'NS'); } if ($opts{'x'} && $pkt->{'type'} eq 'response') { $lab .= add_breakdown($pkt, 'Additional', '+'); } $lab = ""; # figure out the color code for the line my $edgecolor; if ((exists($pkt->{'dns'}{'Authoritative'}) && $#{$pkt->{'dns'}{'Authoritative'}} > -1 && $pkt->{'dns'}{'Authoritative'}[$#{$pkt->{'dns'}{'Authoritative'}}]{'type'} =~ /(RRSIG|DNSKEY|NSEC)/) || (exists($pkt->{'dns'}{'Queries'}) && $#{$pkt->{'dns'}{'Queries'}} > -1 && $pkt->{'dns'}{'Queries'}[$#{$pkt->{'dns'}{'Authoritative'}}]{'type'} =~ /(RRSIG|DNSKEY|NSEC)/)) { $edgecolor = 'darkgreen'; } elsif ($pkt->{'truncated'}) { $edgecolor = 'red'; } elsif ($pkt->{'type'} eq 'response') { $edgecolor = 'blue4'; } else { $edgecolor = 'orange'; } return (label => ((!$opts{'L'} || $num == $mnum+1) ? $lab : "$num"), style => (($pkt->{'tcp'}) ? 'bold' : 'solid'), color => $edgecolor ); } sub add_breakdown { my ($pkt, $name, $tag) = @_; # print "doing answers $num\n"; my ($lab, $txt, $type, $count); foreach my $q (@{$pkt->{'dns'}{$name}}) { # print "$q->{Name} ne $txt\n"; if ($txt && $type && (($q->{Name} ne $txt) || "/$q->{type}" ne $type)) { # print "$q->{Name} ne $txt-$type $txt$type\n"; $lab .= "\n$tag/$txt$type($count)"; $count = 0; } $txt = $q->{'Name'}; # remember name # print "$q->{Name} ne $txt\n"; $count++; # remember number $type = "/$q->{type}" if ($opts{'t'}); # remember type } if ($txt) { $lab .= "\n$tag/$txt$type($count)"; } return $lab; } =pod =head1 NAME dnspktflow - Analyze and draw DNS flow diagrams from a tcpdump file =head1 SYNOPSIS dnspktflow -o output.png file.tcpdump dnspktflow -o output.png -x -a -t -q file.tcpdump =head1 DESCRIPTION The B application takes a B network traffic dump file, passes it through the B application and then displays the resulting DNS packet flows in a "flow-diagram" image. B can output a single image or a series of images which can then be shown in sequence as an animation. B was written as a debugging utility to help trace DNS queries and responses, especially as they apply to DNSSEC-enabled lookups. =head1 REQUIREMENTS This application requires the following Perl modules and software components to work: graphviz (http://www.graphviz.org/) GraphViz (Perl module) tshark (http://www.wireshark.org/) The following is required for outputting screen presentations: MagicPoint (http://member.wide.ad.jp/wg/mgp/) If the following modules are installed, a GUI interface will be enabled for communication with B: QWizard (Perl module) Getopt::GUI::Long (Perl module) =head1 OPTIONS B takes a wide variety of command-line options. These options are described below in the following functional groups: input packet selection, output file options, output visualization options, graphical options, and debugging. =head2 Input Packet Selection These options determine the packets that will be selected by B. =over =item -i STRING =item --ignore-hosts=STRING A regular expression of host names to ignore in the query/response fields. =item -r STRING =item --only-hosts=STRING A regular expression of host names to analyze in the query/response fields. =item -f =item --show-frame-num Display the packet frame numbers. =item -b INTEGER =item --begin-frame=INTEGER Begin at packet frame NUMBER. =back =head2 Output File Options These options determine the type and location of B's output. =over =item -o STRING =item --output-file=STRING Output file name (default: out%03d.png as PNG format.) =item --fig Output format should be fig. =item -O STRING =item --tshark-out=STRING Save B output to this file. =item -m =item --multiple-outputs One picture per request (use %03d in the filename.) =item -M STRING =item --magic-point=STRING Saves a MagicPoint presentation for the output. =back =head2 Output Visualization Options: These options determine specifics of B's output. =over =item --layout-style Selects the graphviz layout style to use (dot, neato, twopi, circo, or fdp). =item -L =item --last-line-labels-only Only show data on the last line drawn. =item -z INTEGER =item --most-lines=INTEGER Only show at most INTEGER connections. =item -T =item --input-is-tshark-out The input file is already processed by B. =back =head2 Graphical Options: These options determine fields included in B's output. =over =item -t =item --show-type Shows message type in result image. =item -q =item --show-queries Shows query questions in result image. =item -a =item --show-answers Shows query answers in result image. =item -A =item --show-authoritative Shows authoritative information in result image. =item -x =item --show-additional Shows additional information in result image. =item -l =item --show-label-lines Shows lines attaching labels to lines. =item --fontsize=INTEGER Font Size =back =head2 Debugging: These options may assist in debugging B. =over =item -d =item --dump-pkts Dump data collected from the packets. =item -h =item --help Show help for command line options. =back =head1 COPYRIGHT Copyright 2004-2013 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wes Hardaker =head1 SEE ALSO B B B http://dnssec-tools.sourceforge.net/ =cut dnssec-tools-2.2/tools/dnspktflow/Makefile.PL0000664000237200023720000000070312544611342021431 0ustar hardakerhardaker#!/usr/bin/perl # Copyright 2004-2013 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details use ExtUtils::MakeMaker; %opts = ( 'NAME' => 'Net::DNS::SEC::Tools::Dnspktflow::dnspktflow', 'PREREQ_PM' => { GraphViz => 0, File::Temp => 0, IO::File => 0 }, 'EXE_FILES' => [qw(dnspktflow)], # 'depend' => {'pure__install' => 'installrulefiles'}, ); WriteMakefile(%opts); dnssec-tools-2.2/tools/maketestzone/0000775000237200023720000000000012544611342017775 5ustar hardakerhardakerdnssec-tools-2.2/tools/maketestzone/.cvsignore0000664000237200023720000000012412544611342021772 0ustar hardakerhardakerdb.* *.png *.signed Makefile blib pm_to_blib *.private *.key dsset-* keyset-* *.krf dnssec-tools-2.2/tools/maketestzone/maketestzone0000664000237200023720000010700112544611342022430 0ustar hardakerhardaker#!/usr/bin/perl # Copyright 2004-2013 SPARTA, Inc. All rights reserved. # See the COPYING file included with the DNSSEC-Tools package for details. use Carp; use strict; use IO::File; use Net::DNS; use Net::DNS::RR; use Net::DNS::SEC::Tools::BootStrap; use Net::DNS::SEC::Tools::QWPrimitives; # this is actually not used directly, but there is an autoload bug in # Net::DNS::RR::DS that gets triggered if you don't have it. use Digest::BubbleBabble; ###################################################################### # detect needed perl modules # dnssec_tools_load_mods("Net::DNS::SEC" => "", "Net::DNS::RR::RRSIG" => "noerror", ); my %opts = ( 'd' => 'test.dnssec-tools.org', 'ns' => 'dns1=127.0.0.1', 'a-addr' => '127.0.0.1', 'aaaa-addr' => '::1', 'S' => ";\n; %s\n;\n", o => "db.", O => ".zs", M => ".modified", 'donuts-output-suffix' => '.donuts', 'bind-db-dir' => '/etc/named', 'html-doc-root' => '/var/www/dnssec-test-zone', 'html-log' => 'logs/dnssec-test-zone', # Add --genksk --genzsk for new zones 'a' => "--verbose -gends --endtime +2592000 -archivedir TZkeyarchive", # XXX: # nsec skips the good record # nsec says type shouldn't be used # sig doesn't cover type 'p' => 'good,badsign,nosig,baddata,futuredate,pastdate,reverseddates', 'cname-extra-prefixes' => 'cnametodne', # XXX: # newksk: doesn't work because zonesigner requires generation of zsks too 'P' => 'insecure-ns,good-ns,badsign-ns,nosig-ns,nods-ns,futuredate-ds,pastdate-ds,reverseddates-ns,rollzsk-ns,newzsk-ns,newkeys-ns,rsamd5keys-ns,nsec3-ns', ); DTGetOptions(\%opts, ['GUI:VERSION',"DNSSEC-Tools Version: 2.1"], ['GUI:separator',"Output File Naming:"], ['o|output-file-prefix=s', 'Output prefix to use for zone files (default = db.)'], ['O|output-suffix-signed-file=s', 'Output suffix to be given to zonesigner (default = .zs)'], ['M|output-modified-file=s', 'Output suffix for the modified zone file (default = .modified)'], '', ['D|run-donuts','Run donuts on the results'], ['donuts-output-suffix=s', 'The file suffix to use for donuts output (default = .donuts)'], ['GUI:separator',"Output Zone Information:"], ['d|domain=s', 'domain name to generate records for'], ['ns|name-servers|n=s', 'Comma separated name=addr name-server records'], ['a-addr|a-record-address=s', 'A record (IPv4) address to use in data'], ['aaaa-addr|a-record-address=s', 'AAAA record (IPv6) address to use in data'], ['GUI:separator',"Output Data Type Selection:"], ['p|record-prefixes=s', 'Comma separated list of record prefixes to use'], ['P|ns-prefixes=s', 'Comma separated list of NS record prefixes to use'], ['cname-extra-prefixes=s', 'Comma separated list of extra prefixes to use for cnames'], ['c|no-cname-records','Don\'t create CNAME records'], ['s|no-ns-records','Don\'t create sub-zone records'], '', ['GUI:separator',"Task Selection:"], ['g|dont-generate-zone', 'Do not generate the zone; use the existing and sign/modify it'], ['z|dont-run-zonesigner', 'Do not run zonesigner to sign the records'], ['Z|dont-destroy', 'Do not destroy the records and leave them properly signed'], ['bind-config=s', 'Generate a bind configuration file snippit to load the DB sets'], ['html-out=s', 'Generate a HTML page containing a list of record names'], ['apache-out=s', 'Generate a Apache config snippit for configuring apache for each zone record'], ['sh-test-out=s', 'Generate a test script for running dig commands'], ['v|verbose','Verbose output'], ['GUI:separator',"Zonesigner Configuration:"], ['a|zonesigner-arguments=s', 'Arguments to pass to zonesigner'], ['k|generate-keys','Have zonesigner generate needed keys'], '', ['GUI:screen','Bind Configuration Options', doif => 'bind-config'], ['bind-db-dir=s', 'The base directory where the bind DB files will be placed'], ['GUI:screen','HTML Output Configuration', doif => 'html-out'], ['html-out-add-links','Make each html record name a http link to that address'], ['html-out-add-db-links','Add a link to each of the generated DB files.'], ['html-out-add-donuts-links','Add a link to each of the generated donuts error list files.'], ['GUI:screen','SH Test Script Configuration Options', doif => 'sh-out'], ['sh-test-resolver=s', 'The resolver address to force'], ); # default zonesigner opts: add key generation stuff if -k specified. $opts{'a'} .= " --genzsk --genksk --ksklength 2048 --zsklength 1024" if ($opts{'k'}); # # address definitions # my %addrs = (A => $opts{'a-addr'}, AAAA => $opts{'aaaa-addr'}); sub getnums { my $count = shift; my $res; $res = "0123456789" x (int($count/10)); $res .= substr("0123456789",0,$count-10*(int($count/10))); } my %extrarecords = (TXT => '"TXT record test"', longlabel => sub { my ($domain, $name) = @_; my $record = $name . "-" . (getnums(63 - length($name)-1)); print_record("$record.$domain.", "1D IN", 'TXT', '"Long Label Test"'); add_web_stuff_for_domain($domain, "$record", "TXT"); }, wildcard => sub { my ($domain, $name) = @_; print_record("*", "1D IN", 'TXT', '"Wild Card Record"'); add_web_stuff_for_domain($domain, "*", "TXT"); }, nsectest => sub { my ($domain, $name) = @_; print_record("nsectest", "1D IN", 'TXT', '"NSEC record signature change"'); add_web_stuff_for_domain($domain, "nsectest", "TXT"); }, # XXX: arg... need to find the actual rules. # longrecord => sub { my ($domain, $name) = @_; # my $length = 230 - length($domain) - 1 - 64; # my $record = $name . "-" . # getnums(63 - length($name) - 1) . "."; # while ($length > 63) { # $record .= getnums(63) . "."; # $length -= 64; # } # $record .= getnums($length); # print_record("$record.$domain", "1D IN", # 'TXT', '"Long Record Test"'); # add_web_stuff_for_domain($domain, "$record", "TXT"); # }, ); # # data modification functions # # regexp -> function # OR # regexp -> [function, EXTRA_ARG1, ARG2, ...] # # function will be called with all the REGEXP match args followed by # the optionla args # my %destroyFunctions = ( # changes the rrsig signature to insert bogus x's '^(badsign[-\w]+).*IN\s+(CNAME|A+)\s+' => \&destroy_signature, '^(badsign[-\w]+).*IN\s+NS\s+' => [\&destroy_signature, 'DS'], # changes the signature on an NSEC record '^(nsectest)\..*IN\s+TXT\s+' => [\&destroy_signature, 'NSEC'], # changes the address/cname record in the data '^(baddata[-\w]+).*IN\s+(A+)\s+(.*)' => \&modify_address, '^(baddata[-\w]+).*IN\s+(CNAME)\s+(.*)' => \&modify_cname, '^(cnametodne[-\w]+).*IN\s+(CNAME)\s+(.*)' => \&modify_cnametodne, # removes the rrsig record '^(nosig[-\w]+).*IN\s+(CNAME|A+)\s+' => [\&delete_signature, 'RRSIG'], '^(nosig[-\w]+).*IN\s+NS\s+' => [\&delete_signature, 'DS', 'RRSIG'], # removes the DS record '^(nods[-\w]+).*IN\s+NS\s+' => [\&delete_signature, '', 'DS'], # future expiration date = 60 days from now -> 90 days from now # warning: make_new_date expects $2 to be the type '^(futuredate[-\.\w]+).*IN\s+(A+|CNAME)\s+' => [\&make_new_date, 60*24*60*60, 90*24*60*60], '^(futuredate[-\.\w]+).*IN\s+NS\s+' => [\&make_new_date, 'DS', 60*24*60*60, 90*24*60*60], # past date: 30 days ago to 5 minutes ago # warning: make_new_date expects $2 to be the type '^(pastdate[-\.\w]+).*IN\s+(A+|CNAME)\s+' => [\&make_new_date, -(30*24*60*60), -300], '^(pastdate[-\.\w]+).*IN\s+NS\s+' => [\&make_new_date, 'DS', -(30*24*60*60), -300], # reverse dates '^(reverseddates[-\w]+).*IN\s+(A+|CNAME)\s+' => \&reverse_dates, '^(reverseddates[-\w]+).*IN\s+NS\s+' => [\&reverse_dates, 'DS'], ); # # Legend information # my %LegendInformation = ( # modification types addedlater => 'The record was added after signing took place and contain no RRSIG records properly signing them.', baddata => 'The data in the record was modified after signing and thus the signature should not validate the record data. Note: modified CNAME records will point to a otherwise valid domain name within the zone (see cnametodne)', cnametodne => 'The CNAME record has been modified to point to a record that never existed in the signed zone.', badsign => 'The RRSIG signature data was modified after signing so the signature should no longer be a valid signature.', futuredate => 'The record and signature are valid but the inception date of the RRSIG is in the future and should not be valid yet.', pastdate => 'The expiration date of the RRSIG covering the record has expired.', good => 'An unmodified record that should be completely valid.', nosig => 'The RRSIG record has been completely removed from the data set and is not available to verify the original record.', nods => 'A valid NS record where the parent zone did not have the DNSKEY for the child and thus does not provide a valid DS record to securely delegate to the child zone.', # key difference subzones rollzsk => 'The ZSK for this zone is rolled every time the zone is generated', newzsk => 'The ZSKs for this zone are brand new every time the zone is generated', newksk => 'The KSKs (but not the ZSKs) for this zone are brand new every time the zone is generated', newkeys => 'The KSKs and the ZSKs for this zone are brand new every time the zone is generated', rsamd5keys => 'The keys for this zone are of type RSAMD5', nsec3 => 'The zone contains NSEC3 proof-of-non-existence records', # record types A => 'An A (IPv4) address record', AAAA => 'An AAAA (IPv6) address record', CNAME => 'A CNAME record pointing to an address record', DNAME => 'A DNAME record pointing to a parallel subzone', NS => 'An NS record pointing to a child zone.', longlabel => 'A TXT record with a maximum length label (63)', longrecord => 'A TXT record with a maximum length record (254)', wildcard => 'A TXT record generated by a wildcard', nsectest => 'A NSEC record that will not valiadate because the signature is incorrect', ); # # ZONENAME => EXTRAOPTS # defines extra options that zonesigner will run with for a given domain # # - using special op of NOSIGN means it won't run zonesigner # my %zonesigner_domain_opts = ( 'rollzsk-ns.' . $opts{'d'} => ($opts{'a'} =~ /-gen/ ? '' : '-rollzsk'), 'newzsk-ns.' . $opts{'d'} => '-genzsk', 'newksk-ns.' . $opts{'d'} => '-genksk', 'newkeys-ns.' . $opts{'d'} => '-genkeys', 'nsec3-ns.' . $opts{'d'} => '-usensec3', 'rsamd5keys-ns.' . $opts{'d'} => '-algorithm RSAMD5 -genkeys', 'insecure-ns.' . $opts{'d'} => 'NOSIGN', ); # # globals # my $name; my @prefixes = split(/,\s*/,$opts{p}); my @nsprefixes = split(/,\s*/,$opts{P}); my @cnameextraprefixes = split(/,\s*/,$opts{'cname-extra-prefixes'}); # output information my (@resultfiles, @outdomains); # file handles my ($fh, $bcfh, $apachefh, $htmlfh, $shfh); # domain info to store my (%linkinfo, %keypaths, $topdomain, $currentdomain); ###################################################################### # do it setup_global_files(); # generate the zone we wanted $topdomain = $opts{'d'}; generate_zone($opts{'d'}, $opts{'c'}, $opts{'s'}); shutdown_global_files(); Verbose("\nDONE:\n"); Verbose("I created the following modified zone files:\n"," ", join("\n ",@resultfiles)); ###################################################################### # Generate records based on inputs # sub generate_zone { my ($domain, $nocnames, $nosubdomains) = @_; # save current zone and make our new one the current my $olddomain = $currentdomain; $currentdomain = $domain; # add the named.conf snippit for this file if ($bcfh) { print $bcfh "zone \"$domain\" {\n"; print $bcfh "\ttype master;\n"; print $bcfh "\tfile \"$opts{'bind-db-dir'}/$opts{'o'}$domain$opts{'O'}.signed$opts{'M'}\";\n"; print $bcfh "};\n\n"; } generate_records($domain, $nocnames, $nosubdomains) if (!$opts{'g'}); run_zonesigner($domain) if (!$opts{'z'}); modify_records($domain) if (!$opts{'Z'}); run_donuts($domain) if ($opts{'D'}); unshift @outdomains, $domain; # restore the current domain $currentdomain = $olddomain; } ####################################################################### # Generate output records # # args: string the domain name, # boolean whether to generate cnames # boolean whether to generate sub-domains # # - loops through output record types (%addrs) and generates them # - generates cnames for each record type if appropriate # sub generate_records { my ($domain, $nocnames, $nosubdomains) = @_; my $file = $opts{'o'} . $domain; Verbose("generating $file"); # # open the output file # $fh = new IO::File (">$file"); generate_top($domain); # bogus address to replace bad cname data and point to this: print_record("other-a", "1D IN", 'A', $addrs{'A'}); print_record("other-aaaa", "1D IN", 'AAAA', $addrs{'AAAA'}); # # for each address, generate records # print_comment("Main records"); foreach my $addr (keys(%addrs)) { print_comment("$addr records"); # generate address records foreach my $prefix (@prefixes) { print_record("$prefix-$addr", "1D IN", $addr, $addrs{$addr}); add_web_stuff_for_domain($domain, "$prefix-$addr", $addr); } # generate address records if (!$nocnames) { print_comment("CNAMEs to $addr records"); foreach my $cnameprefix (@prefixes, @cnameextraprefixes) { foreach my $addrprefix (@prefixes) { print_record("${cnameprefix}-cname-to-${addrprefix}-${addr}", "CNAME", "", lc("${addrprefix}-${addr}")); add_web_stuff_for_domain($domain, "${cnameprefix}-cname-to-${addrprefix}-${addr}", $addr); } } } } print_comment("Other Record Types"); foreach my $name (keys(%extrarecords)) { if (ref($extrarecords{$name}) eq 'CODE') { $extrarecords{$name}($domain, $name); } else { print_record("extra-$name", "1D IN", $name, $extrarecords{$name}); add_web_stuff_for_domain($domain, "extra-$name", $name); } } # generate address records if (!$nosubdomains) { print_comment("NS records to sub zones"); foreach my $nsprefix (@nsprefixes) { my $savefh = $fh; generate_zone("${nsprefix}.$domain", 1, 1); $fh = $savefh; # DNAME records print_record("dname-${nsprefix}", "1D IN", "DNAME", lc("${nsprefix}.$domain.")); foreach my $ns (split(",",$opts{'ns'})) { my ($rec,$addr) = split(/=/,$ns); # NS record print_record("${nsprefix}", "1D IN", "NS", lc("$rec.${nsprefix}.$domain.")); # glue records print_record(lc("$rec.${nsprefix}.$domain."), "1D IN", "A", $addr); } } } $fh->close(); } ####################################################################### # Setup and open the various output files # # - bind configuration output file --bind-config # - html output file --html-out # - apache config file --apache-out # - sh test script --sh-test-out # sub setup_global_files { # # bind configuration file # if ($opts{'bind-config'}) { $bcfh = new IO::File(">$opts{'bind-config'}"); print $bcfh "// " . "*" x 70 . "\n"; print $bcfh "// DNSSEC Test Zone Files\n"; print $bcfh "// " . "*" x 70 . "\n\n"; } # # HTML output file o' links # if ($opts{'html-out'}) { $htmlfh = new IO::File(">$opts{'html-out'}"); print $htmlfh " Test Zone HTML Links

Test Zone HTML Links

The below is a lits of HTML links to DNS zone names that may have various DNSSEC problems.

Legend:

The following table describes the components of a record name that indicate how the data in the record has potentally been affected

\n"; foreach my $addr (keys(%addrs)) { print $htmlfh "\n"; } if (!$opts{'c'}) { print $htmlfh "\n"; } if (!$opts{'s'}) { print $htmlfh "\n"; } foreach my $key (keys(%extrarecords)) { print $htmlfh "\n"; } my %done; foreach my $prefix (@prefixes, @nsprefixes, @cnameextraprefixes) { next if ($done{$prefix}); $done{$prefix} = 1; print $htmlfh "\n"; } print $htmlfh "
TypeName ComponentDescription
Record$addr$LegendInformation{$addr}
RecordCNAME$LegendInformation{CNAME}
RecordNS$LegendInformation{NS}
Record$key$LegendInformation{$key}
Manipulation$prefix$LegendInformation{$prefix}

Records may contain any number of the above components. For example, a record name of \"nosig-cname-to-futuredate-a\" would be a CNAME record with no signature which was pointing at an A record with an RRSIG which is not yet valid at the time the signature was created.

"; } # # Apache configuration file # if ($opts{'apache-out'}) { $apachefh = new IO::File(">$opts{'apache-out'}"); print $apachefh "#\n# Apache Configuration for DNSSEC Test zone\n#\n"; } # # SH test script # if ($opts{'sh-test-out'}) { $shfh = new IO::File(">$opts{'sh-test-out'}"); print $shfh "#!/bin/sh\n\n# test script for testing the test zone\n\n"; } } sub shutdown_global_files { $bcfh->close() if ($bcfh); $apachefh->close() if ($apachefh); $shfh->close() if ($shfh); if ($htmlfh) { foreach my $domain (@outdomains) { print $htmlfh "

Records in $domain

\n
    "; if ($opts{'html-out-add-db-links'}) { print $htmlfh "

    The zone file for this domain: $domain

    \n"; } if ($opts{'html-out-add-donuts-links'}) { print $htmlfh "

    The errors for the records contained within this zone as caught by the donuts application: $domain

    \n"; } foreach my $addr (sort @{$linkinfo{$domain}}) { print $htmlfh "
  • "; print $htmlfh "" if ($opts{'html-out-add-links'}); print $htmlfh $addr; print $htmlfh "" if ($opts{'html-out-add-links'}); print $htmlfh "
  • \n"; } print $htmlfh "
\n"; } print $htmlfh "\n"; } } ###################################################################### # Create the apache web configuration file # Create the shell script test script file # sub add_web_stuff_for_domain { my ($domain, $addr, $type) = @_; if ($htmlfh) { push @{$linkinfo{$domain}},"$addr.$domain"; } if ($apachefh) { print $apachefh "\n"; print $apachefh " DocumentRoot $opts{'html-doc-root'}\n"; print $apachefh " ServerName $addr.$domain\n"; print $apachefh " CustomLog $opts{'html-log'} combined\n"; print $apachefh "\n\n"; } if ($shfh) { print $shfh "echo \"$addr.$domain: \"\n"; print $shfh "dig +short " . ($opts{'sh-test-resolver'} ? "\@$opts{'sh-test-resolver'} " : "") . "$addr.$domain $type\n"; print $shfh "echo \"\"\n"; print $shfh "echo \"\"\n"; } } ###################################################################### # Run zonesigner on the resulting file. # sub run_zonesigner { my ($domain) = @_; my $infile = $opts{'o'} . $domain; my $outfile = $opts{'o'} . $domain . $opts{'O'}; # # Run zonesigner to sign the thing # if ($zonesigner_domain_opts{$domain} eq 'NOSIGN') { # we don't actually want to sign this zone; just copy it Verbose("copying $infile to produce (unsigned) $outfile.signed"); System("cp $infile $outfile.signed"); } else { Verbose("running zonesigner on $infile ($domain) to produce $outfile.signed"); System("zonesigner $opts{'a'} $zonesigner_domain_opts{$domain} --intermediate $infile$opts{'O'} --zone $domain $infile $outfile.signed"); } } ###################################################################### # Run donuts on the final results. # sub run_donuts { my ($domain) = @_; my $infile = $opts{'o'} . $domain . $opts{'O'} . '.signed' . $opts{'M'}; my $outfile = $infile . $opts{'donuts-output-suffix'}; # # Run donuts to check the badness of the zone # Verbose("running donuts on $infile to produce $outfile"); System("donuts $infile $domain > $outfile 2>&1"); } ###################################################################### # Modifies the records based on the registered functions # sub modify_records { my ($domain) = @_; my $infile = $opts{'o'} . $domain . $opts{'O'} . '.signed'; my $outfile = $opts{'o'} . $domain . $opts{'O'} . '.signed' . $opts{'M'}; push @resultfiles, $outfile; # if it wasn't signed, the modifications won't work if ($zonesigner_domain_opts{$domain} eq 'NOSIGN') { Verbose("Not modifying records in $infile; copying to $outfile"); System("cp $infile $outfile"); return; } open(I,"$infile"); $fh = new IO::File (">$outfile"); $_ = ; my @matches; while ($_) { my $found; foreach my $type (keys(%destroyFunctions)) { my $matchtype = $type; $matchtype =~ s/CURRENTDOMAIN/$domain/; if (@matches = /$matchtype/) { my @args; my $func = $destroyFunctions{$type}; if (ref($func) eq 'ARRAY') { @args = @$func; $func = shift @args; } $func->(@matches, @args); $found = 1; last; } } if (!$found) { print $fh $_; $_ = ; } } print $fh "; records added later after signing took place\n"; foreach my $addr (keys(%addrs)) { print $fh "addedlater-nosig-$addr.$domain. 86400 IN $addr $addrs{$addr}\n"; add_web_stuff_for_domain($domain, "addedlater-nosig-$addr", $addr); # zone has no sub-key next if (!exists($keypaths{$domain})); # the current RRset my $rec = "addedlater-withsig-$addr.$domain. 86400 IN $addr $addrs{$addr}"; print $fh $rec,"\n"; # turn into an object $rec = Net::DNS::RR->new($rec); # create the sig record my $sigrr = Net::DNS::RR::RRSIG->create([$rec], $keypaths{$domain}, ttl => $rec->ttl); # print it print $fh $sigrr->string,"\n"; } close(I); $fh->close(); } ###################################################################### # Functions to mess with results # sub destroy_signature { my ($name, $type) = @_; Verbose(" modifying signatures of $name"); print $fh $_; my $inrec = 0; while () { last if /^\w/; $inrec = 1 if (/RRSIG\s+$type/); s/^(\s*)(.)(.*)= \)/$1 . ($2 eq "x" ? "y" : "x") . $3 . "= )"/e if ($inrec); $inrec = 0 if (/\)/); print $fh $_; } } sub modify_address { my ($name, $type, $data) = @_; Verbose(" modifying data of $name:$type"); # mods end-field (eg address) $_ =~ s/(.)$/($1 eq '0') ? "1" : "0"/e; print $fh $_; $_ = ; } sub modify_cname { my ($name, $type, $data) = @_; Verbose(" modifying data of $name:$type"); # modifies CNAME $_ =~ s/([-\w]+)(-a+)\.([-\w\.]+)$/other$2.$currentdomain./; print $fh $_; $_ = ; } sub modify_cnametodne { my ($name, $type, $data) = @_; Verbose(" modifying data of $name:$type"); # modifies CNAME $_ =~ s/([-\w]+)(-a+)\.([-\w\.]+)$/addedlater-nosig$2.$topdomain./; print $fh $_; $_ = ; } sub delete_signature { my ($name, $type, $expr) = @_; Verbose(" deleting signatures of $_[0]"); print $fh $_; my $inrec = 0; while () { last if /^\w/; $inrec = 1 if (/$expr\s+$type/); print $fh $_ if (!$inrec); $inrec = 0 if (/\)/); } } sub make_new_date { my ($name, $type, $sigin_mod, $sigex_mod) = @_; $type = $2 if (!$type); Verbose(" changing time in signatures of $_[0]"); # print and save the current rr set print $fh $_; my $currentrr = $_ if ($type ne 'DS'); # delete the old signature my $inrec = 0; my $slurp = 0; my ($keyid, $keyname); my @records; while () { last if /^\w/; if ($type eq 'DS' && /\d+\s+DS\s+\d+/) { $slurp=1; $currentrr = $name . " " . $_; } elsif ($slurp) { $currentrr .= $_; } if ($inrec == 1) { # get the key id from the current line after the RRSIG line # Note: depends heavily on format of dnssec-signzone output # # XXX: read this in instead into an RR record and get the # keyid from that for better flexible parsing. ($keyid, $keyname) = /^\s*\d+\s+(\d+)\s+([-\.\w]+)/; $inrec = 2; } elsif (/RRSIG\s+$type/) { $inrec = 1; } print $fh $_ if (!$inrec && !$slurp); if (/\)/) { if ($slurp) { push @records, Net::DNS::RR->new($currentrr); } $inrec = $slurp = 0; } } # # create the new signature based on the record/key # # save the current line since Net::DNS::RR::* messes with it my $currentline = $_; push @records, Net::DNS::RR->new($currentrr) if ($#records == -1); # the current RRset croak "can't read one of keyid ($keyid) or keyname ($keyname) from input RRSIG\n" if (!$keyid || !$keyname); my $keypath; foreach my $alg (1, 5, 7) { $keypath = sprintf("K${keyname}+%03d+%05d.private",$alg, $keyid); last if (-f $keypath); } croak "can't find needed private key file: $keypath\n" if (!-f $keypath); $keypaths{$currentdomain} = $keypath; # create the new record if ($type eq 'DS') { foreach my $rec (@records) { print $fh $rec->string,"\n" ; } } my $sigrr = Net::DNS::RR::RRSIG->create(\@records, $keypath, sigin => make_date($sigin_mod), sigex => make_date($sigex_mod), ttl => $records[0]->ttl); # print it print $fh $sigrr->string,"\n"; # put the remembered line back $_ = $currentline; } sub make_date { my @timeinfo = localtime(time() + $_[0]); return sprintf("%04d%02d%02d%02d%02d%02d", $timeinfo[5]+1900, $timeinfo[4]+1, $timeinfo[3], $timeinfo[2], $timeinfo[1], $timeinfo[0]); } sub reverse_dates { my ($name, $type) = @_; Verbose(" reversing dates for signatures of $_[0]"); # print and save the current rr set print $fh $_; my $currentrr = $_; # delete the old signature my $inrec = 0; my ($keyid, $keyname); while () { last if /^\w/; if (/RRSIG\s+$type.*\s+(\d+)\s*\(/) { my $futuredate = $1; my $firstline = $_; my $secondline = ; my ($pastdate) = ($secondline =~ /^\s*(\d+)/); $secondline =~ s/$pastdate/$futuredate/; $firstline =~ s/$futuredate/$pastdate/; print $fh $firstline; print $fh $secondline; } else { print $fh $_; } } } sub freq_zsk_roll { my ($name, $type) = @_; } ###################################################################### # printing-subs # sub print_record { my @txt = @_; $txt[0] = lc($txt[0]); printf $fh ("%-30s %-6s %-6s %s\n", @txt); } sub print_comment { Verbose($_[0]); printf $fh ($opts{'S'}, $_[0]); } sub generate_top { my $domain = shift; print $fh "; -*- dns -*-\n"; print_comment "This file was generated by $0"; print $fh "\$TTL 1D $domain. 600 IN SOA dns.$domain. hardaker.$domain. ( " . time() . " 2H ; refresh (2 hours) 1H ; retry (1 hour) 1W ; expire (1 week) 600 ; minimum (10 minutes) ) TXT \"DNSSEC-TOOLS test zone for $domain\" "; my ($ns, $rec, $addr); foreach $ns (split(",",$opts{'ns'})) { ($rec,$addr) = split(/=/,$ns); print_record("","NS","",$rec . "." . $domain . "."); } foreach $ns (split(",",$opts{'ns'})) { ($rec,$addr) = split(/=/,$ns); print_record("$rec","1D IN","A",$addr); } } sub Verbose { print @_,"\n" if ($opts{'v'}); } sub System { Verbose("running: ",@_); system(@_); die "system command failed!!!\n" if ($_[0] !~ /^donuts/ && $? != 0) } =head1 NAME generaterecords - generates a test dnssec zone that can be used to DNSSEC =head1 SYNOPSIS generaterecords -v -d mytestzone.example.com =head1 DESCRIPTION The generaterecords script generates a zone file, given a domain name, which is then signed and modified to invalidate portions of the data in particular ways. Each generated record is named appropriately to how the security data is modified (the gooda record will contain a A record with valid DNSSEC data, but the badseca record will contain an A record where the signature has been modified to invalidate it). The results of this process can then be served and test secure validators, applications, and other software can be thrown at it to see if they properly fail or succeed under the dns security policies being deployed. After the files are generated, consider running B on them to see how the data in them has been tampered with to be invalid. =head1 PRE-REQUISITES zonesigner from the dnssec-tools project bind software 9.3.1 or greater =head1 GETTING STARTED To get started creating a new zone, you'll need to tell zonesigner to create new keys for all of the new zones that B creates. Thus, the first run of B should look like: =over =item First Time: maketestzone -k [OTHER DESIRED OPTIONS] =back After that, the generated zone files can be loaded and served in a test server. Once every 30 days (by default via zonesigner) the script will need to be rerun to recreate the records and resign the data so the signature date stamps remain valid (or in some cases invalid). =over =item Every 30 days: maketestzone [OTHER DESIRED OPTIONS] =back =head1 OPTIONS Below are thoe options that are accepted by the B tool. =over =head2 Output File Naming: =item -o STRING =item --output-file-prefix=STRING Output prefix to use for zone files (default = db.) =item -O STRING =item --output-suffix-signed-file=STRING Output suffix to be given to zonesigner (default = .zs) =item -M STRING =item --output-modified-file=STRING Output suffix for the modified zone file (default = .modified) =item -D =item --run-donuts Run donuts on the results =item --donuts-output-suffix=STRING The file suffix to use for donuts output (default = .donuts) =head2 Output Zone Information: =item -d STRING =item --domain=STRING domain name to generate records for =item --ns=STRING =item --name-servers=STRING =item -n STRING Comma separated name=addr name-server records =item --a-addr=STRING =item --a-record-address=STRING A record (IPv4) address to use in data =item --aaaa-addr=STRING =item --a-record-address=STRING AAAA record (IPv6) address to use in data =head2 Output Data Type Selection: =item -p STRING =item --record-prefixes=STRING Comma separated list of record prefixes to use =item -P STRING =item --ns-prefixes=STRING Comma separated list of NS record prefixes to use =item -c =item --no-cname-records Don't create CNAME records =item -s =item --no-ns-records Don't create sub-zone records =head2 Task Selection: =item -g =item --dont-generate-zone Do not generate the zone; use the existing and sign/modify it =item -z =item --dont-run-zonesigner Do not run zonesigner to sign the records =item -Z =item --dont-destroy Do not destroy the records and leave them properly signed =item --bind-config=STRING Generate a bind configuration file snippit to load the DB sets =item --html-out=STRING Generate a HTML page containing a list of record names =item --apache-out=STRING Generate a Apache config snippit for configuring apache for each zone record =item --sh-test-out=STRING Generate a test script for running dig commands =item -v =item --verbose Verbose output =head2 Zonesigner Configuration: =item -a STRING =item --zonesigner-arguments=STRING Arguments to pass to zonesigner =item -k =item --generate-keys Have zonesigner generate needed keys =head2 Bind Configuration Options =item --bind-db-dir=STRING The base directory where the bind DB files will be placed =head2 HTML Output Configuration =item --html-out-add-links Make each html record name a http link to that address =item --html-out-add-db-links Add a link to each of the generated DB files. =item --html-out-add-donuts-links Add a link to each of the generated donuts error list files. =head2 SH Test Script Configuration Options =item --sh-test-resolver=STRING The resolver address to force =head2 Help Options =item -h Display a help summary (short flags preferred) =item --help Display a help summary (long flags preferred) =item --help-full Display all help options (both short and long) =item --version Display the script version number. =back =head1 ADDING NEW OUTPUT The following section discusses how to extend the B tool with new output modifications. =head2 ADDING LEGEND INFORMATION For the legend HTML output, the %LegendInformation hash contains a keyname and description for each modification type. =head2 ADDING NEW SUBZONE DIFFERENCES The I<%zonesigner_domain_opts> hash lists additional arguments between how zonesigner is called for various sub-domains. Thus you can create additional sub-zones with different zonesigner optionns to test other operational parameters between parent and child. For example: 'rollzsk-ns.' . $opts{'d'} => '-rollzsk', Forces the rollzsk-ns test sub-zone to roll it's zsk when the zone is signed. =head2 ADDING NEW RECORD MODIFICATIONS Maketestzone is in early development stages but already has the beginnings of an extnesible system allowing you to modify records at will based on regexp => subroutine hooks. To add a new modification, add a new keyword to the 'p' and optionally 'P' default flags (or add it at run time), and then add a new function to the list of callbacks defined in the %destroyFunctions hash that is based on your new keyword. When the file is getting parsed and hits a record matching your expression, your functional will be called. Arguments can be added to the function by passing an array reference where the first argument is the subroutine to be called, and the remainder are additional arguments. Output lines should be printed to the $fh file handle. Here's an example function that deletes the RRSIG signature of the next record: sub delete_signature { # the first 2 arguments are always passed; the other was in the # array refeence the subroutine was registered with. my ($name, $type, $expr) = @_; Verbose(" deleting signatures of $_[0]"); # print the current line print $fh $_; my $inrec = 0; while () { # new name record means we're done. last if /^\w/; # we're in a multi-line rrsig record $inrec = 1 if (/$expr\s+$type/); # print the line if we're not in the rrsig record print $fh $_ if (!$inrec); # when done with the last line of the rrsig record, mark this spot $inrec = 0 if (/\)/); } } This is then registered within %destroyFunctions. Here's an example of registering the function to delete the signature on a DS record: '^(nosig[-\w]+).*IN\s+NS\s+' => [\&delete_signature, 'DS', 'RRSIG'], =head1 COPYRIGHT Copyright 2004-2013 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wes Hardaker =head1 SEE ALSO B http://dnssec-tools.sourceforge.net zonesigner(1), donuts(1) =cut dnssec-tools-2.2/tools/maketestzone/Makefile.PL0000664000237200023720000000064012544611342021747 0ustar hardakerhardaker#!/usr/bin/perl # Copyright 2004-2013 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details use ExtUtils::MakeMaker; %opts = ( 'NAME' => 'Net::DNS::SEC::Tools::Maketestzone::maketestzone', 'PREREQ_PM' => { Text::Wrap => '2001' }, 'EXE_FILES' => [qw(maketestzone)], # 'depend' => {'pure__install' => 'installrulefiles'}, ); WriteMakefile(%opts); dnssec-tools-2.2/tools/README0000664000237200023720000000063712544611342016152 0ustar hardakerhardaker# Copyright 2004-2008 SPARTA, Inc. All rights reserved. # See the COPYING file included with the DNSSEC-Tools package for details. DNSSEC-Tools Is your domain secure? This directory contains tools and data for the DNSSEC-Tools-specific project. The tools and data files are divided into subdirectories based roughly along the lines of functionality. See .../dnssec-tools/README for details on each. dnssec-tools-2.2/tools/modules/0000775000237200023720000000000012544611342016734 5ustar hardakerhardakerdnssec-tools-2.2/tools/modules/keyrec.pod0000664000237200023720000002033412544611342020724 0ustar hardakerhardaker# # Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # Keyrec file format. # 1; ############################################################################# =pod =head1 NAME B - Zone and key data used by DNSSEC-Tools programs. =head1 DESCRIPTION I files contain data about zones signed by and keys generated by the DNSSEC-Tools programs. A I file is organized in sets of I records. Each I must be either of I type, I type, or I type. Zone Is describe how the zones were signed. Set Is describe sets of key Is. Key Is describe how encryption keys were generated. A I consists of a set of keyword/value entries. The DNSSEC-Tools B module manipulates the contents of a I file. Module interfaces exist for looking up I records, creating new records, and modifying existing records. Comment lines and blank lines are ignored by the DNSSEC-Tools programs. Comment lines start with either a '#' character or a ';' character. A I's name may consist of alphabetic characters, numbers, and several special characters. The special characters are the minus sign, the plus sign, the underscore, the comma, the period, and the colon. The values in a I's entries may consist of alphabetic characters, numbers, and several special characters. The special characters are the minus sign, the plus sign, the underscore, the comma, the period, the colon, the forward-slash, the space, and the tab. The B command modifies the key parameters for a zone. The modifications will take effect in future invocations of B, but current and past keys will not be affected. To make these changes, B places new entries in the zone I. These entries are all temporary, and are automatically removed once B starts using the new parameter values. These temporary entries all begin with "new_" and the rest of the entry keyword is a normal entry keyword. For example, if B is used to modify the "ksklength" parameter, then a new entry will be added that has the keyword "new_ksklength". See B for more information. =head1 FIELDS The fields in a I record are described in this section. The fields in each type of record (zone, set, key) are described in their own subsection. =head2 Zone Keyrec Fields * archivedir The name of the key archive directory for this zone. * dsdir The name of the directory to hold the zone's dsset files. * endtime The time when the zone's SIG records expire. This field is passed to B as the argument to the I<-e> option. * gends Boolean value to indicate whether or not DS records should be generated for the zone. * keyrec_signdate The textual timestamp of the zone I's last update. This is a translation of the I field. * keyrec_signsecs The numeric timestamp of the zone I's last update. This is measured in seconds since the epoch. * ksdir The name of the directory to hold the zone's keyset files. * kskcount The number of KSKs to generate for the zone. * kskcur The name of the zone's Current KSK signing set. This is used as the name of the signing set of KSK keys I fields. * kskpub The name of the zone's Published KSK signing set. * kskdirectory The directory that holds the KSK keys. * lastcmd The most recent B command line used for this zone. * lastset The most recently generated signing set for the zone. * rollmgr The name of the rollover manager for this zone. This doubles as an indicator that the zone actually is in rollover management. * serial The most recent serial number for the zone. * signedzone The name of the signed zone file for this zone. * szopts Optional arguments passed to the B command. * zonefile The name of the zone file for this zone. * zskcount The number of ZSKs to generate for the zone. * zskcur The name of the signing set for the current ZSK keys. This is the name of the signing set's set I. * zskdirectory The directory that holds the ZSK keys. * zskpub The name of the signing set for the current ZSK keys. This is the name of the signing set's set I. * zsknew The name of the signing set for the current ZSK keys. This is the name of the signing set's set I. =head2 Set Keyrec Fields * keys The list of keys in this signing set. Each key listed should have a corresponding key I whose name matches the key name. * keyrec_setdate The textual timestamp of the signing set's last modification. This is a translation of the I field. * keyrec_setsecs The numeric timestamp of the signing set's last modification. This is measured in seconds since the epoch. * zonename The name of the zone for which this signing set was generated. =head2 Key Keyrec Fields * algorithm The encryption algorithm used to generate this key. * keypath The path to the key. This may be an absolute or relative path, but it should be one which B may use (in conjunction with other I fields to find the key. * keyrec_gendate The textual timestamp of the key's creation. This is a translation of the I field. * keyrec_gensecs The numeric timestamp of the key's creation. This is measured in seconds since the epoch. * kgopts Additional options to pass to the B command. * ksklength The length of a KSK key. This is only included in Is for KSK keys. * ksklife The life of a KSK key. This is only included in Is for KSK keys. * revperiod The revocation period of a KSK key. This is only included in Is for KSK keys. * random The random number generator used to generate this key. * zonename The name of the zone for which this key was generated. * zsklength The length of a ZSK key. This is only included in Is for ZSK keys. * zsklife The life of a ZSK key. This is only included in Is for ZSK keys. =head2 General Keyrec Fields * keyrec_type The type of the I. For zone Is, the value of this field will be "zone". For set Is, the value of this field will be "kskcur", "kskpub", "kskrev", "kskobs", "zskcur", "zskpub", "zsknew", or "zskobs". For key Is, the value of this field will be "kskcur", "kskpub", "kskrev", "kskobs", "zskcur", "zskpub", "zsknew", or "zskobs". =head1 EXAMPLES The following is an example of a zone I: zone "example.com" zonefile "db.example.com" signedzone "db.example.com.signed" endtime "+604800" archivedir "/usr/etc/dnssec-tools/key-vault" kskcur "signing-set-41" kskdirectory "keydir" zskcur "signing-set-42" zskpub "signing-set-43" zsknew "signing-set-44" lastset "signing-set-44" keyrec_type "zone" keyrec_signsecs "1123771721" keyrec_signdate "Thu Aug 11 14:48:41 2005" The following is an example of a set I: set "signing-set-42" zonename "example.com" keys "Kexample.com.+005+88888" keyrec_type "zskcur" keyrec_setsecs "1123771350" keyrec_setdate "Thu Aug 11 14:42:30 2005" The following is an example of a key I: key "Kexample.com.+005+88888" zonename "example.com" keyrec_type "zskcur" algorithm "rsasha1" random "/dev/urandom" keypath "./Kexample.com.+005+88888.key" ksklength "2048" keyrec_gensecs "1123771354" keyrec_gendate "Thu Aug 11 14:42:34 2005" =head1 COPYRIGHT Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B B, B, B, B, B B =cut dnssec-tools-2.2/tools/modules/QWPrimitives.pm0000664000237200023720000001564512544611342021710 0ustar hardakerhardaker# # # Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # package Net::DNS::SEC::Tools::QWPrimitives; use strict; require Exporter; use Net::DNS::SEC::Tools::conf; our $VERSION = "1.9"; our $MODULE_VERSION = "1.9.0"; our @ISA = qw(Exporter); our @EXPORT = qw(dnssec_tools_get_qwprimitives DTGetOptions); our $gui_file_slots = 5; ####################################################################### # Getopt::GUI::Long safe calling in case it doesn't exist on the system # sub DTGetOptions { my $configfile; my $usegui = 0; my $extraopts = []; # A special calling case is allowed: --dtconf configfile if ($ARGV[0] eq '--dtconf') { $configfile = $ARGV[1]; @ARGV = () if ($#ARGV == 1); # call the GUI or help if only option } # read in the default config file my %config = parseconfig($configfile); # see if we CAN even do a gui my $have_gui = eval {require Getopt::GUI::Long;}; # special config; is this used anywhere? if ($_[0] eq 'config') { shift @_; $extraopts = shift @_; } # if the default config says not to use a GUI, mark it not to load. # (boolconvert defaults nothing=false and we want nothing = true) if (exists($config{'usegui'})) { $usegui = boolconvert($config{'usegui'}); } # allow the environmental override if (exists($ENV{'DT_GUI'})) { $usegui = boolconvert($ENV{'DT_GUI'}); } # XXX: support --dtconf foo.conf --gui # then do the right thing based on if we have the Getopt::GUI::Long package # and whether we should use it or not by default. if ($have_gui) { require Getopt::Long; import Getopt::GUI::Long; Getopt::GUI::Long::Configure(qw(display_help no_ignore_case)); if (!$usegui && $Getopt::GUI::Long::VERSION >= 0.9) { # we *can perform* a GUI at this point, but the default is off. # the user can still override using --gui Getopt::GUI::Long::Configure(qw(no_gui), @$extraopts); } return GetOptions(@_); } # fall back to the normal Getopt::Long support require Getopt::Long; import Getopt::Long; # set up for -h / --help output warning my $hashref = 0; my $optionref; if (ref($_[0]) eq 'HASH') { # hash reference options were passed $optionref = $_[0]; $hashref = 1; push @_, ["h|help|help-full"]; } else { # variable reference options were passed push @_, ["h|help|help-full"], \$optionref; } # actually run getoptions Getopt::Long::Configure(qw(auto_help no_ignore_case)); my $ret = GetOptions(LocalOptionsMap(@_)); # check to see if they specified -h or --help if (($optionref && $optionref->{'h'}) || (!$hashref && $$optionref)) { print "\nPlease install perl's Getopt::GUI::Long module for help output\n\n"; exit 1; } return $ret; } sub LocalOptionsMap { my ($st, $cb, @opts) = ((ref($_[0]) eq 'HASH') ? (1, 1, $_[0]) : (0, 2)); for (my $i = $st; $i <= $#_; $i += $cb) { if ($_[$i]) { next if (ref($_[$i]) eq 'ARRAY' && $_[$i][0] =~ /^GUI:/); push @opts, ((ref($_[$i]) eq 'ARRAY') ? $_[$i][0] : $_[$i]); push @opts, $_[$i+1] if ($cb == 2); } } return @opts; } sub dnssec_tools_get_qwprimitives { my %qwp = ( # defining our own follow-on screens here 'getzonefiles' => {title => 'Which files', introduction => 'Which DNS zone files do you want to operate on?.', questions => [{type => 'dynamic', values => sub { my @qs; for (my $i = 1; $i <= $gui_file_slots; $i++) { push @qs, {type => 'fileupload', text => 'Zone File ' . $i, name => 'file' . $i}; push @qs, {type => 'hidden', text => '', name => 'tmp_name' . $i, values => ''}; } return \@qs; }}, ], post_answers => [sub { require QWizard; import QWizard; my $rstr; for (my $i = 1; $i <=5; $i++) { if (qwparam('file'.$i)) { my $fn = $Getopt::GUI::Long::GUI_qw->qw_upload_file('file'.$i); $fn =~ s/.*qwHTML//; qwparam('tmp_name' . $i, $fn); } } }], }, 'getzonenames' => {title => 'Zone Names', introduction => 'For each of the DNS zone files you selected, please indicate what their zone names are.', post_answers => [sub { require QWizard; import QWizard; my $rstr; for (my $i = 1; $i <=5; $i++) { if (qwparam('file'.$i) && qwparam('zonename'.$i)) { if (ref($_[0]->{'generator'}) =~ /HTML/) { # don't allow web users to specify other file names my $fn = qwparam('tmp_name'.$i); if ($fn =~ /^[^\.\/]{6}\.tmp$/) { $fn = "/tmp/qwHTML$fn"; next if (! -f $fn); if (qwparam('dnssec_zone_names_first')) { push @main::guiargs, qwparam('zonename'.$i), $fn; } else { push @main::guiargs, $fn, qwparam('zonename'.$i); } } } else { $rstr .= qwparam('file' . $i) . " " . qwparam('zonename'.$i); push @main::guiargs, qwparam('file' . $i), qwparam('zonename'.$i); } } } }], questions => [{type => 'dynamic', values => sub { my @qs; require QWizard; import QWizard; for (my $i = 1; $i <=5; $i++) { if (qwparam('file'.$i)) { my $def = qwparam('file'.$i); $def =~ s/^.*\///; $def =~ s/^db\.//; $def =~ s/\.signed$//; $def =~ s/\.zs$//; push @qs, {type => 'text', name => 'zonename' . $i, default => $def, text => qwparam('file'.$i)}; } } return \@qs; }}] }, @_, ); return %qwp; } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::QWPrimitives - QWizard primitives for DNSSEC-Tools =head1 SYNOPSIS use Net::DNS::SEC::Tools::QWPrimitives; use Getopt::Long::GUI; our @guiargs; DTGetOptions( ..., ['GUI:nootherargs',1], ['GUI:otherprimaries',dnssec_tools_get_qwprimitives()], ['GUI:submodules','getzonefiles','getzonenames'], ); =head1 DESCRIPTION B is a dynamic GUI-construction kit. It displays a series of questions, then retrieves and acts upon the answers. This module provides access to B for DNSSEC-Tools software. In particular, the I returns a set of primary screens for requesting a set of zone files followed by a set of domain names for those zone files. These are then pushed into the @guiargs which should be treated as the final ARGV array to process. =head1 COPYRIGHT Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wes Hardaker =head1 SEE ALSO B, B, B http://www.dnssec-tools.org =cut dnssec-tools-2.2/tools/modules/dnssectools.pm0000664000237200023720000003461412544611342021642 0ustar hardakerhardaker# # Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # dnssectools.pm - General functions for DNSSEC-Tools. # # This module provides a place for disparate interfaces needed by # DNSSEC-Tools programs. # package Net::DNS::SEC::Tools::dnssectools; require Exporter; use strict; use Mail::Send; use Net::DNS::SEC; use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::defaults; use Net::DNS::SEC::Tools::keyrec; use Net::DNS::SEC::Tools::rollrec; our $VERSION = "2.1"; our $MODULE_VERSION = "2.1.0"; our @ISA = qw(Exporter); our @EXPORT = qw( dt_adminmail dt_cmdpath dt_filetype dt_parse_duration dt_parse_zonefile ); our $ZONEFILE_PARSER; # # List of valid DNSSEC-Tools commands. Used by dt_cmdpath(). # my %dtcmds = ( 'blinkenlights' => 1, 'cleanarch' => 1, 'cleankrf' => 1, 'dtconf' => 1, 'dtconfchk' => 1, 'dtdefs' => 1, 'dtinitconf' => 1, 'dtrealms' => 1, 'expchk' => 1, 'fixkrf' => 1, 'genkrf' => 1, 'getdnskeys' => 1, 'grandvizier' => 1, 'keyarch' => 1, 'krfcheck' => 1, 'lsdnssec' => 1, 'lskrf' => 1, 'lsrealm' => 1, 'lsroll' => 1, 'realmchk' => 1, 'realmctl' => 1, 'realminit' => 1, 'rollchk' => 1, 'rollctl' => 1, 'rollerd' => 1, 'rollinit' => 1, 'rolllog' => 1, 'rollrec-editor' => 1, 'rollset' => 1, 'signset-editor' => 1, 'tachk' => 1, 'timetrans' => 1, 'trustman' => 1, 'zonesigner' => 1, ); #----------------------------------------------------------------------------- # # Routine: dt_adminmail() # # Purpose: This routine emails a message to the administrative user # listed in the DNSSEC-Tools configuration file. # sub dt_adminmail { my $subject = shift; # Message subject. my $msgbody = shift; # Message body. my $sendto = ""; # Message recipient. my $msg; # Message object. my $mh; # Mail handler. my %dtconf; # DNSSEC-Tools config file. my @mailargs; # # Get the message recipient. If the caller didn't specify one, # we'll use the default recipient from the config file. # if(@_) { $sendto = shift; } else { # # Get the default DNSEEC-Tools administrative contact. # %dtconf = parseconfig(); return(0) if(!defined($dtconf{'admin-email'})); $sendto = $dtconf{'admin-email'}; } # # Ensure we really have a recipient. # return(0) if($sendto eq ""); # # If things are configured to not send email, we'll return success. # return(1) if($sendto eq "nomail"); # # Create the message object. # $msg = new Mail::Send; # # Add some message headers. # $msg->to($sendto); $msg->subject($subject); # # Open the "connection" and add the message body. # push @mailargs, $dtconf{'mailer-type'} if(defined($dtconf{'mailer-type'})); push @mailargs, 'smtp' if(!defined($dtconf{'mailer-type'}) && defined($dtconf{'mailer-server'})); push @mailargs, Server => $dtconf{'mailer-server'} if(defined($dtconf{'mailer-server'})); eval { $mh = $msg->open(@mailargs); }; return(0) if $@; print $mh $msgbody . "\n"; # # Complete the message and send it. # eval { $mh->close; }; return(0) if $@; return(1); } #----------------------------------------------------------------------------- # Routine: dt_cmdpath() # # Purpose: This routine returns the path to a DNSSEC-Tools command. # Null is returned if the command isn't a valid DNSSEC-Tools # command. Otherwise, the command's path is returned. # sub dt_cmdpath { my $cmd = shift; # Command to pathenate. return('') if($cmd eq ''); return('') if(!$dtcmds{$cmd}); return(dnssec_tools_default($cmd)); } #----------------------------------------------------------------------------- # Routine: dt_filetype() # # Purpose: This routine returns the type of a DNSSEC-Tools file. # It is given a path and it counts the rollrec and keyrec # records contained therein. # # The following return values are possible: # # "keyrec" At least one keyrec record was found # and no rollrec records were found. # # "rollrec" At least one rollrec record was found # and no keyrec records were found. # # "mixed" At least one rollrec record and at # least one keyrec record were found. # This is most likely an erroneous file. # # "unknown" No rollrec records nor keyrec records # were found. # # "nofile" The file doesn't exist. # # Interpretation of the result is application dependent. # sub dt_filetype { my $path = shift; # File to check. my @names; # Record names in file. my $rcnt = 0; # Count of rollrec records. my $kcnt = 0; # Count of keyrec records. # # Ensure the file exists. # return("nofile") if(!-e $path); # # Get the record names as if it were a rollrec file. # @names = (); rollrec_read($path); @names = rollrec_names(); rollrec_close(); # # Count the valid record names. # foreach my $name (sort (@names)) { $rcnt++ if($name ne ""); } # # Get the record names as if it were a keyrec file. # @names = (); keyrec_read($path); @names = keyrec_names(); keyrec_close(); # # Count the valid record names. # foreach my $name (sort (@names)) { $kcnt++ if($name ne ""); } # print "keyrec count - $kcnt\trollrec count - $rcnt\n"; # # Return the type of file we found this to be. # return("rollrec") if( $rcnt && !$kcnt); return("keyrec") if(!$rcnt && $kcnt); return("mixed") if( $rcnt && $kcnt); return("unknown"); } #----------------------------------------------------------------------------- # Routine: dt_parse_duration() # # Purpose: This routine translates a duration given in "1w2d3h4m5s" format # and returns the equivalent number of seconds, or undef if the # duration has an invalid format. # sub dt_parse_duration { my ($duration) = @_; my %duration; # # Ensure the duration is properly formatted. # return(undef) unless $duration =~ /^(?:\d+[WDHMS]?)+$/i; # # Initialize the duration hash elements to zero. # %duration = map { $_=>0 } qw(W D H M S); # # Build the duration hash. # while($duration =~ /(\d+)([WDHMS]?)/gi) { my $mod = $2 || "S"; $duration{uc $mod} += $1; } # # Calculate the duration in seconds and return that value. # return($duration{S} + 60 * ($duration{M} + 60 * ($duration{H} + 24 * ($duration{D} + 7 * $duration{W})))); } #----------------------------------------------------------------------------- # Routine: _normalize_rrtype() # # Purpose: This routine normalizes a string, returned by the accessor # passed, to a normal form of RR names. If an RR name changed, # the accessor is called to set the new value. # sub _normalize_rrtype { my $attr = shift; # Accessor. my $old = &$attr; my $new = $old; # # Translate every TYPExxx known to typesbyval() to its mnemonic. # $new =~ s/\bTYPE(\d+)/Net::DNS::typesbyval($1)/ge; # # Translate every mnemonic not known to typesbyval() back to TYPExxx. # $new = join(" ", map { my $type = $_; # determine if we have Net::DNS::Parameters my $haveParameters = eval { require Net::DNS::Parameters; }; # determine if that module has the typesbyname() function my $parametersHasTypeByName = 0; if ($haveParameters) { $parametersHasTypeByName = Net::DNS::Parameters->can('typebyname'); } # Now, we should know what we have to call if ($parametersHasTypeByName) { $type = "TYPE".Net::DNS::Parameters::typebyname($type); } else { eval { Net::DNS::typesbyname($type) }; if($@) { warn "$@ - things may not validate correctly" if($@); } $type } } split(/\s+/, $new)); &$attr($new) if($new ne $old); } #----------------------------------------------------------------------------- # Routine: dt_parse_zonefile() # # Purpose: This routine parses a given zone file using the configured # zone-file parser and returns an array reference containing # the RRs. # Currently supported parsers: # Net::DNS::ZoneFile (default) # Net::DNS::ZoneFile::Fast ("old" versions only) # sub dt_parse_zonefile { my %options = @_; # Parsing options. my $ret; # Return value. my $default_parser; # Default zonefile parser. # # Get the default zonefile parser. # $default_parser = dnssec_tools_default("zonefile-parser"); # # On first call, we'll set up the zonefile-parser object. # We'll ensure the parser exists and maybe die if it doesn't. # if(!defined($ZONEFILE_PARSER)) { my %conf = parseconfig(); my $parser = $conf{"zonefile-parser"} || $default_parser; eval "require $parser"; if($@ && ($parser ne $default_parser)) { warn "zonefile parser $parser not usable; using default parser $default_parser"; eval "require $default_parser"; die $@ if($@); $ZONEFILE_PARSER = $default_parser; } elsif($@) { die $@; # Default parser not loadable. } else { $ZONEFILE_PARSER = $parser; } } # # Parse the zonefile as required by the various parsers. # if($ZONEFILE_PARSER->isa("Net::DNS::ZoneFile::Fast")) { $ret = Net::DNS::ZoneFile::Fast::parse(%options); } elsif($ZONEFILE_PARSER->isa("Net::DNS::ZoneFile")) { # # Assume Net::DNS::ZoneFile calling convention. # my @args = ($options{file}); push(@args, $options{origin}) if($options{origin}); my $parser; $ret = eval { $parser = $ZONEFILE_PARSER->new(@args); return([ $parser->read ]); }; if($@) { my $line = $parser ? $parser->line : 0; my $err = (split(/\n/, $@))[0]; die $@ unless $options{soft_errors}; if(my $handler = $options{on_error}) { &{$handler}($line, $err); } else { warn "Parse error at line $line: $err\n" unless $options{quiet}; } return; } } else { warn "unrecognized zonefile parser\n" unless $options{quiet}; return; } # # Normalize any resource records that were found. # if($ret && (ref($ret) eq "ARRAY")) { # # Normalize all RRs. # foreach my $rr (@$ret) { # # Type and typelist attributes provide an accessor. # foreach my $attr (qw(type typelist)) { if($rr->can($attr)) { _normalize_rrtype(sub{ $rr->$attr() ; }); } } # # SIG and RRSIG provide no accessor (except read-only # via AUTOLOAD) so we need to manipulate the hashref # ourself. # if($rr->isa("Net::DNS::RR::SIG") || $rr->isa("Net::DNS::RR::RRSIG")) { # # SIG and RRSIG provide no accessors # _normalize_rrtype(sub { $_[0] ? ($rr->{typecovered} = $_[0]) : $rr->{typecovered} }); } } } return($ret); } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::dnssectools - General routines for the DNSSEC-Tools package. =head1 SYNOPSIS use Net::DNS::SEC::Tools::dnssectools; dt_adminmail($subject,$msgbody,$recipient); $zspath = dt_cmdpath('zonesigner'); $ftype = dt_findtype($path); $seconds = dt_parse_duration("0w3d1h10m20s") $rrset = dt_parse_zonefile(file => 'example.com'); =head1 DESCRIPTION The B module provides a general set of methods for use with DNSSEC-Tools utilities. =head1 INTERFACES The interfaces to the B module are given below. =over 4 =item I This routine emails a message to the administrative user listed in the DNSSEC-Tools configuration file. I requires two parameters, both scalars. The I parameter is the subject for the mail message. The I parameter is the body of the mail message. A third parameter, I, may be given to specify the message's recipient. If this is not given, then the recipient will be taken from the I record of the DNSSEC-Tools configuration file. If I is "nomail", then no message will be sent and success will be returned. Return values: 1 - the message was created and sent. 0 - an invalid recipient was specified. =back It relies on the the following dnssec-tools.conf configuration parameters: =over 4 =item I The email address that the mail should come from. =item I Should be one of: I. This option is not required and will default to trying sendmail and qmail to deliver the mail. If I is set to a defined value but I is not, then I will default to =item I The server, if I is set to I, that the mail should be delivered to. =item I This routine returns the path to a specified DNSSEC-Tools command. I should be the name only, without any leading directories. The command name is checked to ensure that it is a valid DNSEC-Tools command, Return values: The absolute path to the command is returned if the command is valid. Null is returned if the command is not valid. =item I This routine returns the type of the file named in I. The rollrec and keyrec records contained therein are counted and a type determination is made. Return values: "keyrec" - At least one keyrec record was found and no rollrec records were found. "rollrec" - At least one rollrec record was found and no keyrec records were found. "mixed" - At least one rollrec record and at least one keyrec record were found. This is most likely an erroneous file. "unknown" - No rollrec records nor keyrec records were found. "nofile" - The specified file does not exist. =item I This routine translates a duration given in "1w2d3h4m5s" format and returns the equivalent number of seconds, or undef if the duration has an invalid format. =item I This routine parses a given zone file using the configured zone file parser and returns an array reference containing the RRs. The options hash is the same as for B. The zone parser to be used depends on the setting of the I configuration value. If this is not set, then the B zone parser will be used. =back =head1 COPYRIGHT Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B, B =cut # Local Variables: # tab-width: 4 # cperl-indent-level: 4 # End: dnssec-tools-2.2/tools/modules/timetrans.pm0000664000237200023720000002312612544611342021304 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # timetrans # # This module contains an interface to convert an integer seconds count # into the equivalent number of days, hours, and minutes. # package Net::DNS::SEC::Tools::timetrans; use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(timetrans fuzzytimetrans timetrans_weeks); our $VERSION = "2.1"; our $MODULE_VERSION = "2.1.0"; ####################################################################### # # Time-related constants. my $MINUTE = 60; my $HOUR = (60 * $MINUTE); my $DAY = (24 * $HOUR); my $WEEK = (7 * $DAY); #--------------------------------------------------------------------------- # # Routine: timetrans() # # Purpose: This routine converts an integer seconds count into the # equivalent number of days, hours, and minutes. # sub timetrans { my $seconds = shift; # The seconds to be translated. my $minutes; # Minutes in seconds. my $hours; # Hours in seconds. my $days; # Days in seconds. my $tstr; # Time string. my $sstr; # Seconds string. my $mstr; # Minutes string. my $hstr; # Hours string. my $dstr; # Days string. # # Ensure we were given a valid seconds count. # return("") if($seconds < 0); # # Check for zero seconds. # # return("0 seconds") if($seconds == 0); return("") if($seconds == 0); # # Handle the less-than-a-minute case. # if($seconds < $MINUTE) { $tstr = "$seconds second"; $tstr = $tstr . "s" if($seconds != 1); return("") if($seconds == 0); return($tstr); } # # Handle the less-than-an-hour case. # if($seconds < $HOUR) { $minutes = $seconds / $MINUTE; $seconds = $seconds % $MINUTE; $sstr = timetrans($seconds); if($sstr ne "") { $tstr = sprintf("%d minutes, $sstr",$minutes); } else { $tstr = sprintf("%d minutes",$minutes); } $tstr =~ s/minutes/minute/ if($tstr =~ /^1 /); return("") if($minutes == 0); return($tstr); } # # Handle the less-than-a-day case. # if($seconds < $DAY) { $hours = $seconds / $HOUR; $minutes = $seconds % $HOUR; $mstr = timetrans($minutes); if($mstr ne "") { $tstr = sprintf("%d hours, $mstr",$hours); } else { $tstr = sprintf("%d hours",$hours); } $tstr =~ s/hours/hour/ if($tstr =~ /^1 /); return("") if($hours == 0); return($tstr); } # # The rest of the cases all fall into days. # $days = $seconds / $DAY; $hours = $seconds % $DAY; $hstr = timetrans($hours); if($hstr ne "") { $tstr = sprintf("%d days, $hstr",$days); } else { $tstr = sprintf("%d days",$days); } $tstr =~ s/days/day/ if($tstr =~ /^1 /); return($tstr); } #--------------------------------------------------------------------------- # # Routine: timetrans_weeks() # # Purpose: This routine converts an integer seconds count into the # equivalent number of weeks, days, hours, and minutes. # # WARNING: This routine is unsupported and will most likely # disappear before long. If you really need it and # don't want the routine to go away, bring this up # on the dnssec-tools user list. # sub timetrans_weeks { my $seconds = shift; # The seconds to be translated. my $minutes; # Minutes in seconds. my $hours; # Hours in seconds. my $days; # Days in seconds. my $weeks; # Weeks in seconds. my $tstr; # Time string. my $sstr; # Seconds string. my $mstr; # Minutes string. my $hstr; # Hours string. my $dstr; # Days string. # # Ensure we were given a valid seconds count. # return("") if($seconds < 0); # # Check for zero seconds. # # return("0 seconds") if($seconds == 0); return("") if($seconds == 0); # # Handle the less-than-a-minute case. # if($seconds < $MINUTE) { $tstr = "$seconds second"; $tstr = $tstr . "s" if($seconds != 1); return("") if($seconds == 0); return($tstr); } # # Handle the less-than-an-hour case. # if($seconds < $HOUR) { $minutes = $seconds / $MINUTE; $seconds = $seconds % $MINUTE; $sstr = timetrans($seconds); if($sstr ne "") { $tstr = sprintf("%d minutes, $sstr",$minutes); } else { $tstr = sprintf("%d minutes",$minutes); } $tstr =~ s/minutes/minute/ if($tstr =~ /^1 /); return("") if($minutes == 0); return($tstr); } # # Handle the less-than-a-day case. # if($seconds < $DAY) { $hours = $seconds / $HOUR; $minutes = $seconds % $HOUR; $mstr = timetrans($minutes); if($mstr ne "") { $tstr = sprintf("%d hours, $mstr",$hours); } else { $tstr = sprintf("%d hours",$hours); } $tstr =~ s/hours/hour/ if($tstr =~ /^1 /); return("") if($hours == 0); return($tstr); } # # Handle the less-than-a-week case. # if($seconds < $WEEK) { $days = $seconds / $DAY; $hours = $seconds % $DAY; $hstr = timetrans($hours); if($hstr ne "") { $tstr = sprintf("%d days, $hstr",$days); } else { $tstr = sprintf("%d days",$days); } $tstr =~ s/days/day/ if($tstr =~ /^1 /); return("") if($days == 0); return($tstr); } # # The rest of the cases all fall into weeks. Months get a bit # sticky, so we're going to ignore them. # $weeks = $seconds / $WEEK; $days = $seconds % $WEEK; $dstr = timetrans($days); if($dstr ne "") { $tstr = sprintf("%d weeks, $dstr",$weeks); } else { $tstr = sprintf("%d weeks",$weeks); } $tstr =~ s/weeks/week/ if($tstr =~ /^1 /); return($tstr); } #--------------------------------------------------------------------------- # # Routine: fuzzytimetrans() # # Purpose: This routine converts an integer seconds count into the # equivalent number of weeks *or* days *or* hours *or* minutes. # sub fuzzytimetrans { my $seconds = shift; # Seconds to translate. my $div; # Divisor. my $unit; # Time unit. my $remnant; # Calculated time. my $timestr; # Translated time. # # Ensure we were given a valid seconds count. # return("") if($seconds < 0); # # Check for zero seconds. # return("0 seconds") if($seconds == 0); # # Set the divisor and textual units we'll be using, based on # how many seconds we were given. # if($seconds < $MINUTE) { $div = 1; $unit = "second"; } elsif($seconds < $HOUR) { $div = $MINUTE; $unit = "minute"; } elsif($seconds < $DAY) { $div = $HOUR; $unit = "hour"; } elsif($seconds < $WEEK) { $div = $DAY; $unit = "day"; } else { $div = $WEEK; $unit = "week"; } # # Calculate the number of units we have and translate it into # an "N.M" floating format. # $remnant = $seconds / $div; $timestr = sprintf("%.1f",$remnant); # # Pluralize the units if needed and build our return value. # $unit = $unit . "s" if($timestr != 1); $timestr = "$timestr $unit"; return($timestr); } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::timetrans - Convert an integer seconds count into text units. =head1 SYNOPSIS use Net::DNS::SEC::Tools::timetrans; $timestring = timetrans(86488); $timestring = fuzzytimetrans(86488); =head1 DESCRIPTION The I() interface in B converts an integer seconds count into the equivalent number of days, hours, and minutes. The time converted is a relative time, B an absolute time. The returned time is given in terms of days, hours, minutes, and seconds, as required to express the seconds count appropriately. The I() interface converts an integer seconds count into the equivalent number of weeks B days B hours B minutes. The unit chosen is that which is most natural for the seconds count. One decimal place of precision is included in the result. =head1 INTERFACES The interfaces to the B module are given below. =head2 B This routine converts an integer seconds count into the equivalent number of days, hours, and minutes. This converted seconds count is returned as a text string. The seconds count must be greater than zero or an error will be returned. Return Values: If a valid seconds count was given, the count converted into the appropriate text string will be returned. An empty string is returned if no seconds count was given or if the seconds count is less than one. =head2 B This routine converts an integer seconds count into the equivalent number of weeks, days, hours, or minutes. This converted seconds count is returned as a text string. The seconds count must be greater than zero or an error will be returned. Return Values: If a valid seconds count was given, the count converted into the appropriate text string will be returned. An empty string is returned if no seconds count was given or if the seconds count is less than one. =head1 EXAMPLES I returns 6 minutes, 40 seconds I returns 7 minutes I returns 14 minutes, 48 seconds I returns 1 day I returns 1 day, 28 seconds I returns 8 days, 6 hours, 36 minutes, 40 second I returns 8 days, 8 hours I returns 6.7 minutes I returns 7.0 minutes I returns 14.8 minutes I returns 1.0 day I returns 1.0 day I returns 1.2 weeks I returns 1.2 weeks =head1 COPYRIGHT Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B =cut dnssec-tools-2.2/tools/modules/rollrec.pod0000664000237200023720000002033412544611342021104 0ustar hardakerhardaker# # Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # Rollrec file format. # 1; ############################################################################# =pod =head1 NAME B - Rollover-related zone data used by DNSSEC-Tools programs. =head1 DESCRIPTION I files contain data used by the DNSSEC-Tools to manage key rollover. A I file is organized in sets of I records. Each I record describes the rollover state of a single zone and must be either of I type or I type. Roll Is record information about currently rolling zones. Skip Is record information about zones that are not being rolled. A I consists of a set of keyword/value entries. The DNSSEC-Tools B module manipulates the contents of a I file. Module interfaces exist for looking up I records, creating new records, and modifying existing records. Comment lines and blank lines are ignored by the DNSSEC-Tools programs. Comment lines start with either a '#' character or a ';' character. A I's name may consist of alphabetic characters, numbers, and several special characters. The special characters are the minus sign, the plus sign, the underscore, the comma, the period, the colon, the forward-slash, the space, and the tab. This name is an identifier. It is commonly set to be the same as the name of the zone which the I record describes, but this is not necessary. If the name is not given, then B will create a new I field using the name of the I record. The values in a I's entries may consist of alphabetic characters, numbers, and several special characters. The special characters are the minus sign, the plus sign, the underscore, the comma, the period, the colon, the forward-slash, the space, and the tab. There is a special I called the B I. It contains information about the I file, such as the version of Is stored within the file. It is only accessible through the I interface, and the I interface will indicate if the file's version number is current. The name of this I is "rollrec info", which is a reserved name. It has its own set of fields, with only one overlap with regular Is. =head1 FILE VERSIONS The B file format will evolve from time to time. The B I was introduced specifically to account for changes between versions. You should not manually change a B file's version, but let the DNSEC-Tools update the file for you. The version differences are summarized below. B: This was the original format of the I file. At various times, additional fields were added to it, but the basic format of the file remained essentially the same. B: The B I was added for this version. No other format changes were introduced. The B module was modified to recognize this I and not allow calling programs to modify it. For this reason, versions 1 and 2 are considered functionally equivalent when it comes to whether or not a I file is considered current. (DNSSEC-Tools version 1.15; February 2013) =head1 FIELDS The fields in a I record are: * administrator This is the email address for the zone's administrative user. If it is not set, the default from the DNSSEC-Tools configuration file will be used. * curerrors The count of consecutive errors for the zone. This count is set to zero upon successful completion of a KSK or ZSK rollover. * directory This field contains the name of the directory in which B will execute for the I's zone. If it is not specified, then the normal B execution directory will be used. * display This boolean field indicates whether or not the zone should be displayed by the B program. * keyrec The zone's I file. * kskphase The zone's current KSK rollover phase. A value of zero indicates that the zone is not in rollover, but is in normal operation. A numeric value of 1-7 indicates that the zone is in that phase of KSK rollover. * ksk_rolldate The time at which the zone's last KSK rollover completed. This is only used to provide a human-readable format of the timestamp. It is derived from the I field. * ksk_rollsecs The time at which the zone's last KSK rollover completed. This value is used to derive the I field. * loglevel The B logging level for this zone. * maxerrors The maximum number of consecutive errors for the zone. After this count has been exceeded, the zone will be changed to be a I zone. If a zone doesn't have this field set, the I configuration value will be used instead. * maxttl The maximum time-to-live for the zone. This is measured in seconds. * phasestart The time-stamp of the beginning of the zone's current phase. * version This is the format version of the Is in the I file. The value of this field is a numeric value, such as "1.3" or "2". It should B be modified by DNSSEC-Tools programs. This field is only available in the B I. * zonefile The zone's zone file. * zonegroup The zone's zonegroup. This is used to associate related zones for group I commands. This field is optional. * zonename The zone's name. If this is not given, then B will create a new I field using the name of the I record. * zsargs The user-specified arguments for B. This field is set by the B command to allow modification of a zone's rollover options without having to restart B. * zskphase The zone's current ZSK rollover phase. A value of zero indicates that the zone is not in rollover, but is in normal operation. A value of 1, 2, 3, 4 indicates that the zone is in that phase of ZSK rollover. * zsk_rolldate The time at which the zone's last ZSK rollover completed. This is only used to provide a human-readable format of the timestamp. It is derived from the I field. * zsk_rollsecs The time at which the zone's last ZSK rollover completed. This value is used to derive the I field. =head1 EXAMPLES The following is an example of a roll I: roll "example" zonename "example.com" zonefile "example.signed" keyrec "example.krf" zonegroup "example zones" kskphase "1" zskphase "0" administrator "bob@bobbox.example.com" loglevel "info" maxttl "60" display "1" zsargs "-zsklength 2048" ksk_rollsecs "1172614842" ksk_rolldate "Tue Feb 27 22:20:42 2007" zsk_rollsecs "1172615087" zsk_rolldate "Tue Feb 27 22:24:47 2007" phasestart "Mon Feb 20 12:34:56 2007" The following is an example of a skip I: skip "test.com" zonename "test.com" zonefile "test.com.signed" keyrec "test.com.krf" kskphase "0" zskphase "2" administrator "tess@test.com" loglevel "info" maxttl "60" display "1" ksk_rollsecs "1172614800" ksk_rolldate "Tue Feb 27 22:20:00 2007" zsk_rollsecs "1172615070" zsk_rolldate "Tue Feb 27 22:24:30 2007" phasestart "Mon Feb 20 12:34:56 2007" The following is an example of a skip I: roll "rollrec info" version "2" =head1 COPYRIGHT Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B B, B, B, B B, B B =cut dnssec-tools-2.2/tools/modules/tests/0000775000237200023720000000000012544611342020076 5ustar hardakerhardakerdnssec-tools-2.2/tools/modules/tests/test-rollmgr0000775000237200023720000002152112544611342022460 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2005-2013 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # # This script performs several tests of the DNSSEC-Tools rollmgr module. # # The following interfaces are tested: # # rollmgr_dir # rollmgr_pidfile # rollmgr_getpid # rollmgr_droppid # rollmgr_rmpid # rollmgr_qproc # rollmgr_halt # use strict; use Net::DNS::SEC::Tools::rollmgr; # test_rollmgr_dir(); # test_rollmgr_pidfile(); # test_rollmgr_getpid(); # test_rollmgr_droppid(); # test_rollmgr_rmpid(); # test_rollmgr_qproc(); test_rollmgr_halt(); exit 0; ############################################################# # sub test_rollmgr_dir { my $dirname = rollmgr_dir(); print "\n-----------------------------------------------------\n\n"; print "testing rollmgr_dir()\t\t(requires manual verification)\n\n"; print "\trollmgr directory - $dirname\n"; } ############################################################# # sub test_rollmgr_pidfile { my $pidfile = rollmgr_pidfile(); print "\n-----------------------------------------------------\n\n"; print "testing rollmgr_pidfile()\t\t(requires manual verification)\n\n"; print "\trollmgr pidfile - $pidfile\n"; } ############################################################# # sub test_rollmgr_getpid { my $errs = 0; # Failed tests. my $newpid; # Manufactured process id. my $pid; # Process id. my $pidfile; # Name of roll-over manager's pidfile. print "\n-----------------------------------------------------\n\n"; print "testing rollmgr_getpid()\n"; ##################### # # Make sure we have a clean slate. # $pidfile = rollmgr_pidfile(); system("/bin/rm -f $pidfile"); ##################### # # Check that rollmgr_getpid() actually does need a pidfile. # print "\ttesting for non-existent pidfile\n"; $pid = rollmgr_getpid(); if($pid == -1) { print "\t\tSUCCESS: couldn't read from a non-existent pidfile\n\n"; } else { print "\t\tFAILURE: returned pid $pid when pidfile doesn't exist\n\n"; $errs++; } ##################### # # Check that rollmgr_getpid() will succeed if the pidfile exists. # print "\ttesting for valid pid in pidfile\n"; $newpid = 88 . $$ . 88; system(`/bin/echo $newpid >> $pidfile`); $pid = rollmgr_getpid(); if($pid == $newpid) { print "\t\tSUCCESS: pidfile contains correct pid\n\n"; } else { print "\t\tFAILURE: pidfile does not contain correct pid\n"; print "\t\t contains <$pid>, should have <$newpid>\n\n"; $errs++; } ##################### # # Check to see how many tests failed. # if($errs) { print "\t$errs test(s) of rollmgr_getpid() failed\n"; } else { print "\tall rollmgr_getpid() tests succeeded\n"; } } ############################################################# # sub test_rollmgr_droppid { my $errs = 0; # Failed tests. my $pid; # Process id. my $pidfile; # Name of roll-over manager's pidfile. print "\n-----------------------------------------------------\n\n"; print "testing rollmgr_droppid()\n"; ##################### # # Make sure we have a clean slate. # $pidfile = rollmgr_pidfile(); system("/bin/rm -f $pidfile"); ##################### # # Check that rollmgr_droppid() will create the proper pidfile if # one doesn't exist. # print "\ttesting for non-existent file\n"; rollmgr_droppid(); $pid = `/bin/cat $pidfile`; if($pid == $$) { print "\t\tSUCCESS: successfully created a new pidfile\n\n"; } else { print "\t\tFAILURE: did not properly create a new pidfile\n\n"; $errs++; } ##################### # # Check that rollmgr_droppid() will appear to succeed if the # pidfile contains the process' pid. # # This test assumes the previous test succeeded. # print "\ttesting for matching pid in pidfile\n"; rollmgr_droppid(); $pid = `/bin/cat $pidfile`; if($pid == $$) { print "\t\tSUCCESS: pidfile contains correct pid\n\n"; } else { print "\t\tFAILURE: pidfile does not contain correct pid\n\n"; $errs++; } ##################### # # Check that rollmgr_droppid() won't over-write a pidfile created # by another process. # print "\ttesting for existent file\n"; $pid = $$ - 10; system(`/bin/echo $pid >> $pidfile`); rollmgr_droppid(); $pid = `/bin/cat $pidfile`; if($pid != $$) { print "\t\tSUCCESS: did not over-write another process' pidfile\n\n"; } else { print "\t\tFAILURE: overwrote another process' pidfile\n\n"; $errs++; } ##################### # # Check to see how many tests failed. # if($errs) { print "\t$errs test(s) of rollmgr_droppid() failed\n"; } else { print "\tall rollmgr_droppid() tests succeeded\n"; } } ############################################################# # sub test_rollmgr_rmpid { my $errs = 0; # Failed tests. my $pid; # Process id. my $pidfile; # Name of roll-over manager's pidfile. my $ret; # rollmgr-rmpid() return code. print "\n-----------------------------------------------------\n\n"; print "testing rollmgr_rmpid()\n"; ##################### # # Make sure we have a clean slate. # $pidfile = rollmgr_pidfile(); system("/bin/rm -f $pidfile"); ##################### # # Check that rollmgr_rmpid() will give the proper errcode if the # pidfile if doesn't exist. # print "\ttesting for non-existent file\n"; if(($ret=rollmgr_rmpid()) == 0) { print "\t\tSUCCESS: couldn't delete non-existent pidfile\n\n"; } else { if($ret == 1) { print "\t\tFAILURE: improperly deleted pidfile\n\n"; } else { print "\t\tFAILURE: failed for reason $ret\n\n"; } $errs++; } ##################### # # Check that rollmgr_rmpid() will delete our own pidfile. # print "\ttesting for existent file with our pid\n"; system(`/bin/echo $$ >> $pidfile`); if(($ret=rollmgr_rmpid()) == 1) { print "\t\tSUCCESS: deleted our own pidfile\n\n"; } else { print "\t\tFAILURE: failed for reason $ret\n\n"; $errs++; } ##################### # # Check that rollmgr_rmpid() won't delete a pidfile created # by another process. # print "\ttesting for existent file with our pid\n"; $pid = $$ - 10; system(`/bin/echo $pid >> $pidfile`); if(($ret=rollmgr_rmpid()) == -1) { print "\t\tSUCCESS: unable to delete someone else's pidfile\n\n"; } else { if($ret == 1) { print "\t\tFAILURE: deleted someone else's pidfile\n\n"; } else { print "\t\tFAILURE: failed for reason $ret\n\n"; } $errs++; } ##################### # # Check to see how many tests failed. # if($errs) { print "\t$errs test(s) of rollmgr_rmpid() failed\n"; } else { print "\tall rollmgr_rmpid() tests succeeded\n"; } } ############################################################# sub test_rollmgr_qproc { my $caught = 0; # Signal-caught flag. my $child; # Child's pid. my $parent = $$; # Parent's pid. my $pidfile; # Roll-over manager's pidfile. my $naptime = 30; # Time to sleep(). my %procs; # Process names. print "\n-----------------------------------------------------\n\n"; print "testing rollmgr_qproc()\n"; print "\t(may pause for up to $naptime seconds)\n\n"; $pidfile = rollmgr_pidfile(); system(`/bin/echo $parent > $pidfile`); $child = fork(); # # The child process will let the parent fake-up a roll-over manager, # and then tell it to process its queue. # if($child == 0) { sleep(2); rollmgr_qproc(); exit(0); } # # Fake-up a roll-over manager for this test. # $SIG{HUP} = sub { print "\tSUCCESS: fake roll-over manager received the \"process queue\" command \n"; $caught = 1; }; # # Wait a bit... # sleep($naptime); # # If we didn't receive the "process queue" command, then give an # error message. # if(!$caught) { print "\tFAILURE: \"process queue\" command not sent to the fake roll-over manager\n"; } } ############################################################# sub test_rollmgr_halt { my $caught = 0; # Signal-caught flag. my $child; # Child's pid. my $parent = $$; # Parent's pid. my $pidfile; # Roll-over manager's pidfile. my $naptime = 30; # Time to sleep(). my %procs; # Process names. print "\n-----------------------------------------------------\n\n"; print "testing rollmgr_halt()\n"; print "\t(may pause for up to $naptime seconds)\n\n"; $pidfile = rollmgr_pidfile(); system(`/bin/echo $parent > $pidfile`); $child = fork(); # # The child process will let the parent fake-up a roll-over manager, # and then tell it to process its queue. # if($child == 0) { sleep(2); rollmgr_halt(); exit(0); } # # Fake-up a roll-over manager for this test. # $SIG{INT} = sub { $caught = 1; }; # # Wait a bit... # sleep($naptime); # # If we didn't receive the "halt" command, then give an # error message. # if($caught) { print "\tSUCCESS: fake roll-over manager received the \"halt\" command \n"; } else { print "\tFAILURE: \"halt\" command not sent to the fake roll-over manager\n"; } } dnssec-tools-2.2/tools/modules/tests/.cvsignore0000664000237200023720000000005312544611342022074 0ustar hardakerhardakerMakefile portrigh.keyrec dnssec-tools.conf dnssec-tools-2.2/tools/modules/tests/test-toolopts30000775000237200023720000001030412544611342022745 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2004-2013 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # # DNSSEC-Tools # # Test script for the DNSSEC-Tools tooloptions module. This script tests # the opts_keykr() and opts_zonekr() interfaces. The script attempts to # retrieve a key keyrec using both opts_keykr() and opts_zonekr(); the # first should succeed and the second should fail. It does the opposite # and tries to retrieve a zone keyrec using opts_keykr() and opts_zonekr(). # In this case, the first should fail and the second should succeed. # # This script needs no options for execution. # # Some of the data in the test keyrec file is nonsense. However, it is # useful to distinguish between keyrecs, thus allowing one to determine # if the test passed or failed. # use strict; use Net::DNS::SEC::Tools::tooloptions; my $ropts; # Reference to option table. my %opts; # Option hash table. my $krf; # Keyrec file. ######################################################## # # Build a keyrec file for use by these tests. # $krf = "portrigh.keyrec"; buildkrf($krf); ######################################################## # checker($krf,"key","Ktriharpskel.com.+005+64000"); print "\n-------------------------------------\n\n"; checker($krf,"zone","portrigh.com"); exit(0); ##################################################################### # sub checker { my $krf = shift; # Keyrec name to retrieve. my $ktype = shift; # Type of keyrec to retrieve. my $kname = shift; # Keyrec name to retrieve. my $rkr; # Reference to the keyrec. my %keyrec; # The keyrec itself. # # Try to get the key keyrec from the keyrec file. If we found it, # print the key/val pairs. # $rkr = opts_keykr($krf,$kname); if($rkr == undef) { print "couldn't find key keyrec for $ktype \"$kname\"; check keyrec file and try again\n"; } else { %keyrec = %$rkr; print "key keyrec:\n"; foreach my $k (sort(keys(%keyrec))) { print "\t$k\t\t$keyrec{$k}\n"; } } print "\n----------------\n\n"; # # Try to get the zone keyrec from the keyrec file. If we found it, # print the key/val pairs. # $rkr = opts_zonekr($krf,$kname); if($rkr == undef) { print "couldn't find zone keyrec for $ktype \"$kname\"; check keyrec file and try again\n"; } else { %keyrec = %$rkr; print "zone keyrec:\n"; foreach my $k (sort(keys(%keyrec))) { print "\t$k\t\t$keyrec{$k}\n"; } } print "\n"; } ##################################################################### # # buildkrf() # sub buildkrf { my $krf = shift; open(KRF,"> $krf"); print KRF < <$dnssec_conf{$k}>\n"; } } ############################################################################ sub create_conffile { open(CNF,"> $conf"); print CNF <\t<$sval{$k}>\n"; } print "\n"; } } ############################################################# sub test_rollrec_newrec { print "\n-----------------------------------------------------\n\n"; print "testing rollrec_newrec()\n"; if(rollrec_newrec("nrr") < 0) { print "\n\trollrec_newrec() tests failed\n"; } else { print "\n\trollrec_newrec() tests passed\n"; } } ############################################################# sub test_rollrec_recval { print "\n-----------------------------------------------------\n\n"; print "testing rollrec_recval()\n\n"; getit("portrigh.com","zonefile"); getit("portrigh.com","curphase"); print "\n"; } ############################################################# sub test_rollrec_setval { my $field; # Field value from rollrec file. print "\n-----------------------------------------------------\n\n"; print "testing rollrec_setval()\n\n"; # rollrec_dump_hash(); print "\n"; # rollrec_dump_array(); print "\n"; rollrec_setval("portrigh.com","zonefile","db.portrigh.com"); rollrec_setval("portrigh.com","curphase","1"); rollrec_setval("portrigh.com","curphase","2"); # rollrec_dump_array(); print "\n"; # rollrec_dump_hash(); print "\n"; rollrec_write(); rollrec_discard(); $rollrecs = rollrec_read($rrf); $field = rollrec_recval("portrigh.com","zonefile"); if($field eq "db.portrigh.com") { print "\trollrec_setval(zonefile) succeeded\n"; } else { print "\trollrec_setval(zonefile) failed\n"; print "\t\treturned \"$field\" instead of \"db.portrigh.com\"\n"; } $field = rollrec_recval("portrigh.com","curphase"); if($field == 2) { print "\trollrec_setval(curphase) succeeded\n"; } else { print "\trollrec_setval(curphase) failed\n"; print "\t\treturned \"$field\" instead of \"2\"\n"; } } ############################################################# sub test_rollrec_add { my %fields; # Fields for new rollrecs. my $rr; # Rollrec reference. my %names; # New rollrec name hash. print "\n-----------------------------------------------------\n\n"; print "testing rollrec_add()\n\n"; rollrec_discard(); $rollrecs = rollrec_read($rrf); # # Build a set of three rollrecs and add them to the rollrec table. # %fields = (); $fields{'zonefile'} = "db.harp.portrigh.com"; $fields{'curphase'} = "0"; $fields{'maxttl'} = "86400"; $fields{'rollrec_signsecs'} = "1101183759"; $fields{'rollrec_signdate'} = "Tue Nov 23 04:22:39 2004-2006"; rollrec_add("harp.portrigh.com",\%fields); %fields = (); $fields{'zonefile'} = "db.pipes.portrigh.com"; $fields{'rollrec_gensecs'} = "1101183760"; $fields{'rollrec_gendate'} = "Tue Nov 23 04:22:40 2004-2006"; rollrec_add("pipes.portrigh.com",\%fields); %fields = (); $fields{'zonename'} = "db.whistle.portrigh.com"; $fields{'rollrec_gensecs'} = "1101183762"; $fields{'rollrec_gendate'} = "Tue Nov 23 04:22:42 2004-2006"; rollrec_add("whistle.portrigh.com",\%fields); # # Write the new rollrec file, dump all our data, and then re-read # the file. # rollrec_write(); rollrec_init(); $rollrecs = rollrec_read($rrf); # # Build a table of rollrec names (as created above.) If the hash # value is 1, then we're expecting a rollrec_fullrec() on the hash # key to succeed. If the value is 0, we're expecting it to fail. # %names = ( "harp.portrigh.com" => 1, "pipes.portrigh.com" => 1, "whistle.portrigh.com" => 1, "flute.portrigh.com" => 0, "song.portrigh.com" => 0, ); # # Go through the list of rollrec names and ensure that our newly # created rollrecs exist, and that our dummy rollrec doesn't exist. # foreach my $rn (keys(%names)) { my $expected = $names{$rn}; $rr = rollrec_fullrec($rn); if(defined($rr)) { if($expected) { print "\tsuccess: rollrec_add($rn) worked\n"; } else { print "\tfailure: key $rn should not exist\n"; } } else { if($expected) { print "\tfailure: key $rn should exist\n"; } else { print "\tsuccess: $rn invalid, as expected\n"; } } } } ############################################################# sub test_rollrec_del { my %fields; # Fields for new rollrecs. my $rr; # Rollrec reference. my %names; # New rollrec name hash. print "\n-----------------------------------------------------\n\n"; print "testing rollrec_del()\n\n"; rollrec_del("whistle.portrigh.com"); # # Write the new rollrec file, dump all our data, and then re-read # the file. # rollrec_write(); rollrec_init(); $rollrecs = rollrec_read($rrf); # # Build a table of rollrec names (as created above.) If the hash # value is 1, then we're expecting a rollrec_fullrec() on the hash # key to succeed. If the value is 0, we're expecting it to fail. # %names = ( "harp.portrigh.com" => 1, "pipes.portrigh.com" => 1, "whistle.portrigh.com" => 0, "flute.portrigh.com" => 0, "song.portrigh.com" => 0, ); # # Go through the list of rollrec names and ensure that our newly # created rollrecs exist, and that our dummy rollrec doesn't exist. # foreach my $rn (keys(%names)) { my $expected = $names{$rn}; $rr = rollrec_fullrec($rn); if(defined($rr)) { if($expected) { print "\tsuccess: rollrec_add($rn) worked\n"; } else { print "\tfailure: key $rn should not exist\n"; } } else { if($expected) { print "\tfailure: key $rn should exist\n"; } else { print "\tsuccess: $rn invalid, as expected\n"; } } } } ############################################################################ sub getit { my $p1 = shift; my $p2 = shift; my $val = rollrec_recval($p1,$p2); if($val eq "") { print "\t$p1/$p2 - empty\n"; } elsif(!defined($val)) { print "\t$p1/$p2 - not defined\n"; } else { print "\t$p1/$p2 - <$val>\n"; } } ############################################################################ # # These data are in the portrigh.rollrec file used in this test. sub create_rollrecfile { open(RRF,"> /tmp/test.rollrec"); print RRF <\n"; } ######################################################## # # Get the options keyrec names of the KSK and ZSK for the # zone specified in our command line. # ($dum,$dum,$ropts) = opts_krfile("",""); if($ropts == undef) { print "opts_krfile() returned an undefined option reference\n"; } else { %opts = %$ropts; print "kskkey\t\t$opts{'kskkey'}\n"; print "zskkey\t\t$opts{'zskkey'}\n"; print "\n"; } ######################################################## # # Get the KSK and ZSK keyrecs for the zone specified in our command line. # ($rkh,$rzh) = opts_getkeys(); if($rkh == undef) { print "opts_getkeys() returned an undefined KSK option reference\n"; exit(1); } if($rzh == undef) { print "opts_getkeys() returned an undefined ZSK option reference\n"; exit(1); } %kskrec = %$rkh; %zskrec = %$rzh; print "kskrec:\n"; foreach my $k (sort(keys(%kskrec))) { print "\t$k\t\t$kskrec{$k}\n"; } print "\n\n"; print "zskrec:\n"; foreach my $k (sort(keys(%zskrec))) { print "\t$k\t\t$zskrec{$k}\n"; } print "\n\n"; exit(0); ##################################################################### # # buildkrf() # sub buildkrf { my $krf = shift; open(KRF,"> $krf"); print KRF < <$opts{$k}>\n"; } print "\n"; ##################################################################### # # Test a call with keyrec file, keyrec name, and local options. # $ropts = tooloptions("",@locopts); %opts = %$ropts; print "options (no keyrec):\n"; foreach my $k (sort(keys(%opts))) { print "\t<$k> <$opts{$k}>\n"; } print "\n"; ##################################################################### # # Test a call with keyrec file, keyrec name, and local options. # Use of command line options is suspended. # opts_suspend(); $ropts = tooloptions($krf,$krname,@locopts); %opts = %$ropts; print "options (with suspended options):\n"; foreach my $k (sort(keys(%opts))) { print "\t<$k> <$opts{$k}>\n"; } print "\n"; ##################################################################### # # Test a call with keyrec file, keyrec name, and local options. # Use of command line options is restored. # opts_restore(); $ropts = tooloptions($krf,$krname,@locopts); %opts = %$ropts; print "options (with restored options):\n"; foreach my $k (sort(keys(%opts))) { print "\t<$k> <$opts{$k}>\n"; } print "\n"; ##################################################################### # # Test a call with keyrec file, keyrec name, and local options. # Use of command line options is dropped. # opts_drop(); $ropts = tooloptions($krf,$krname,@locopts); %opts = %$ropts; print "options (with dropped options):\n"; foreach my $k (sort(keys(%opts))) { print "\t<$k> <$opts{$k}>\n"; } print "\n"; ##################################################################### # # Test a call with keyrec file, keyrec name, and local options. # Use of command line options is restored, but inaccessible. # opts_restore(); $ropts = tooloptions($krf,$krname,@locopts); %opts = %$ropts; print "options (with restored options, but post-drop):\n"; foreach my $k (sort(keys(%opts))) { print "\t<$k> <$opts{$k}>\n"; } print "\n"; exit(0); ##################################################################### # # buildkrf() # sub buildkrf { my $krf = shift; open(KRF,"> $krf"); print KRF < Makefile"); print MF <\t<$sval{$k}>\n"; } print "\n"; } } ############################################################# sub test_keyrec_newkeyrec { my $kn1 = "nkr_1"; # Test keyrec name. my $kn2 = "nkr_2"; # Test keyrec name. my $kn3 = "nkr_3"; # Test keyrec name. my $errs = 0; # Error count. print "\n-----------------------------------------------------\n\n"; print "testing keyrec_newkeyrec()\n\n"; if(keyrec_newkeyrec($kn1,"zone") < 0) { print "\tunable to create new zone keyrec $kn1\n"; $errs++; } if(keyrec_newkeyrec($kn2,"key") < 0) { print "\tunable to create new key keyrec $kn2\n"; $errs++; } if(keyrec_newkeyrec($kn3,"badtype") == 0) { print "\table to create new bad-type keyrec $kn3\n"; $errs++; } if($errs == 0) { print "\n\tall keyrec_newkeyrec() tests passed\n"; } else { print "\n\tonly " . (3 - $errs) . " keyrec_newkeyrec() tests passed\n"; } print "\n"; } ############################################################# sub test_keyrec_recval { print "\n-----------------------------------------------------\n\n"; print "testing keyrec_recval()\n\n"; getit("portrigh.com","zonefile"); getit("portrigh.com","kskpath"); getit("portrigh.com","endtime"); getit("Kportrigh.com.+005+26000","zonename"); getit("Kportrigh.com.+005+26000","algorithm"); getit("Kportrigh.com.+005+52000","zonename"); getit("Kportrigh.com.+005+52000","random"); getit("Kportrigh.com.+005+88888","zonename"); print "\n"; } ############################################################# sub test_keyrec_setval { print "\n-----------------------------------------------------\n\n"; print "testing keyrec_setval()\n\n"; # keyrec_dump_hash(); print "\n"; # keyrec_dump_array(); print "\n"; keyrec_setval("key","Kportrigh.com.+005+12345","keyrec_type","ksk"); keyrec_setval("zone","portrigh.com","zonefile","db.portrigh.com"); keyrec_setval("zone","portrigh.com","endtime","+8888000"); keyrec_setval("zone","portrigh.com","kskpath","keys.ksk/Kportrigh.com.+005+44000"); keyrec_setval("zone","portrigh.com","zskpath","keys.zsk/Kportrigh.com.+005+88000"); keyrec_setval("zone","portrigh.com","endtime","+8888888"); # keyrec_dump_array(); print "\n"; # keyrec_dump_hash(); print "\n"; keyrec_write(); } ############################################################# sub test_keyrec_add { my %fields; # Fields for new keyrecs. my $kr; # Keyrec reference. my %names; # New keyrec name hash. print "\n-----------------------------------------------------\n\n"; print "testing keyrec_add()\n\n"; keyrec_discard(); $keyrecs = keyrec_read($krf); # # Build a set of three keyrecs and add them to the keyrec table. # %fields = (); $fields{'zonefile'} = "db.harp.portrigh.com"; $fields{'kskkey'} = "Kharp.portrigh.com.+005+12345"; $fields{'zskkey'} = "Kharp.portrigh.com.+005+23456"; $fields{'endtime'} = "+2598000"; $fields{'keyrec_signsecs'} = "1101183759"; $fields{'keyrec_signdate'} = "Tue Nov 23 04:22:39 2004-2006"; keyrec_add("zone","harp.portrigh.com",\%fields); %fields = (); $fields{'zonename'} = "harp.portrigh.com"; $fields{'keyrec_type'} = "ksk"; $fields{'ksklength'} = "1024"; $fields{'algorithm'} = "rsasha1"; $fields{'random'} = "-r /dev/urandom"; $fields{'keyrec_gensecs'} = "1101183759"; $fields{'keyrec_gendate'} = "Tue Nov 23 04:22:39 2004-2006"; keyrec_add("key","Kharp.portrigh.com.+005+12345",\%fields); %fields = (); $fields{'zonename'} = "harp.portrigh.com"; $fields{'keyrec_type'} = "zsk"; $fields{'zsklength'} = "512"; $fields{'algorithm'} = "rsasha1"; $fields{'random'} = "-r /dev/urandom"; $fields{'keyrec_gensecs'} = "1101183759"; $fields{'keyrec_gendate'} = "Tue Nov 23 04:22:39 2004-2006"; keyrec_add("key","Kharp.portrigh.com.+005+23456",\%fields); # # Write the new keyrec file, dump all our data, and then re-read # the file. # keyrec_write(); keyrec_init(); $keyrecs = keyrec_read($krf); # # Build a table of keyrec names (as created above.) If the hash value # is 1, then we're expecting a keyrec_fullrec() on the hash key to # succeed. If the value is 0, we're expecting it to fail. # %names = ( "harp.portrigh.com" => 1, "Kharp.portrigh.com.+005+12345" => 1, "Kharp.portrigh.com.+005+23456" => 1, "dummy.keyname.value" => 0, ); # # Go through the list of keyrec names and ensure that our newly # created keyrecs exist, and that our dummy keyrec doesn't exist. # foreach my $kn (keys(%names)) { my $expected = $names{$kn}; $kr = keyrec_fullrec($kn); if(defined($kr)) { if($expected) { print "\tsuccess: keyrec_add($kn) worked\n"; } else { print "\tfailure: key $kn should not exist\n"; } } else { if($expected) { print "\tfailure: key $kn should exist\n"; } else { print "\tsuccess: $kn invalid, as expected\n"; } } } } ############################################################################ sub getit { my $p1 = shift; my $p2 = shift; my $val = keyrec_recval($p1,$p2); if($val eq "") { print "$p1/$p2 - empty\n"; } elsif(!defined($val)) { print "$p1/$p2 - not defined\n"; } else { print "$p1/$p2 - <$val>\n"; } } ############################################################################ # # These data are in the portrigh.keyrec file used in this test. sub create_keyrecfile { open(KRF,"> portrigh.keyrec"); print KRF < 1); } # # If any file was listed multiple times, given an error and return. # if($errs) { err("unable to merge realm files since some realm files were given multiple times\n",1); return(-5); } # # Create a target file if the first realm file doesn't exist. # if(! -e $firstrlm) { if(open(TMP,"> $firstrlm") == 0) { err("realm_merge: unable to create target realm file \"$firstrlm\"\n",1); return(-2); } close(TMP); } # # Read the first realm file. This will also zap all our current # internal data. # $allrlms{$firstrlm}++; if(realm_read($firstrlm) < 0) { return(-3); } # # Read each remaining realm file and add it to our internal # realm collection. # foreach my $rrf (@rlmlist) { # # Make sure the realm file exists. # if(! -e $rrf) { err("realm file \"$rrf\" does not exist\n",1); $errs++; next; } # # Close the needed file handle. # close(REALM_MERGE); # # Open up the realm file. # if(open(REALM_MERGE,"< $rrf") == 0) { err("unable to open $rrf\n",1); $errs++; next; } # # Read the contents of the specified realm file. # if(realm_readfile(*REALM_MERGE) < 0) { $errs++; } } # # Close the file handle. # close(REALM_MERGE); # # If we encountered errors while merging the files, we'll give # an error and reset ourself. # if($errs) { err("unable to merge realm files due to errors\n",1); realm_init(); return(-4); } # # Write the new realm file. # $modified = 1; realm_write(); # # Return the number of realm we found. # $rrcnt = keys(%realms); return($rrcnt); } #-------------------------------------------------------------------------- # Routine: realm_split() # # Purpose: Split a realm file in two. A list of realm entries will # be removed from the current realm file and appended to # another file. The realm entries will be removed from # @realmlines and %realms. # # The realms will be appended to the destination file. # sub realm_split { my $newrrf = shift; # New realm file. my @rrlist = @_; # Set of realm names. my $valid = 0; # Count of valid names. my @badnames = (); # List of invalid names. my $rrcnt = 0; # Number of realms we split. # print "realm_split: down in\n"; # # Make sure a set of realm files was specified. # if((! defined($newrrf)) || ($newrrf eq '')) { err("no target realm file given for split\n",1); return(-1); } # # Make sure a set of realm files was specified. # if(@rrlist == 0) { err("no realm names given for split\n",1); return(-2); } # # Count the valid realm names in the name list. # foreach my $rrn (@rrlist) { $valid++ if(defined($realms{$rrn})); } # # Ensure that at least one of the realm names in the name list # is valid. # if($valid == 0) { err("no realm names given for split are existing realms\n",1); return(-3); } # # Open the target realm file for appending. # if(open(REALM_SPLIT,">> $newrrf") == 0) { err("unable to open \"$newrrf\" for split\n",1); return(-4); } # # Read each remaining realm file and add it to our internal # realm collection. # foreach my $rrn (@rrlist) { my $rlmind; # Index to realm's first line. # # If this name isn't the name of an existing realm, we'll # save the name and go to the next. # if(! exists($realms{$rrn})) { push @badnames,$rrn; next; } # # Find the index for this realm in @realmlines. # $rlmind = rlmindex($rrn); # # Bump our count of split realms. # $rrcnt++; # # Find the specified field's entry in the realm's lines in # @realmlines. We'll skip over lines that don't have a # keyword and dquotes-enclosed value. # print REALM_SPLIT "$realmlines[$rlmind]"; for($rlmind++; $rlmind<$realmlen; $rlmind++) { my $ln = $realmlines[$rlmind]; # Line in realm file. my $lkw; # Line's keyword. # # Get the line's keyword and value. # $ln =~ /^\s*([a-z_]+)\s+"([a-z0-9\/\-+_.,: \t]*)"/i; $lkw = $1; # # If we hit the beginning of the next realm or a # blank line, we'll write a blank line and, drop out. # if(($lkw =~ /^realm$/i) || ($ln eq "\n")) { print REALM_SPLIT "\n"; last; } print REALM_SPLIT "$ln"; } # # If we hit the beginning of the next realm or a # blank line, we'll write a blank line and, drop out. # if($rlmind == $realmlen) { print REALM_SPLIT "\n"; } # # Delete the named realm. # realm_del($rrn); } # # Close the file handle. # close(REALM_SPLIT); # # If we found some names that aren't in the original realm file, # we'll give an error and return the list of bad names. # if(@badnames > 0) { err("invalid realm names (@badnames) in split\n",1); return(-5, @badnames); } # # Write the updated realm file. # $modified = 1; realm_write(); # # Return the number of realms we split into a new realm file. # return($rrcnt); } #-------------------------------------------------------------------------- # Routine: realm_readfile() # # Purpose: Read the specified realm file. The contents are read into # the @realmlines array and the realms are broken out into # the %realms hash table. # sub realm_readfile { my $rfh = shift; # File handle for realm file. my $name; # Name of the realm entry. my $havecmdsalready = 0; # Commands-read flag. my $prevline = 'dummy'; # Previous line. # # Grab the lines and pop 'em into the realmlines array. We'll also # save each realm into a hash table for easy reference. # while(<$rfh>) { my $line; # Line from the realm file. my $keyword = ""; # Keyword from the line. my $value = ""; # Keyword's value. $line = $_; # # Collapse consecutive blank lines to a single blank. # # This isn't strictly necessary, but it keeps realm files # from getting filled with lots of blank lines. # next if(($prevline =~ /^\s*$/) && ($line =~ /^\s*$/)); $prevline = $line; # # Save the line in our array of realm lines. # $realmlines[$realmlen] = $line; $realmlen++; # # Skip comment lines and empty lines. # if(($line =~ /^\s*$/) || ($line =~ /^\s*[;#]/)) { next; } # # Grab the keyword and value from the line. The keyword # must be alphabetic. The value can contain alphanumerics, # and a number of punctuation characters. The value *must* # be enclosed in double quotes. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $keyword = $1; $value = $2; # print "realm_readfile: keyword <$keyword>\t\t<$value>\n"; # # If the keyword is "realm", then we're starting a new record. # We'll save the name of the realm, and then proceed on to # the next line. # if($keyword =~ /^realm$/i) { $name = $value; # # If this name has already been used for a realm, # we'll whinge, clean up, and return. No realms # will be retained. # if(exists($realms{$name})) { realm_discard(); err("realm_readfile: duplicate record name; aborting...\n",-1); return(-1); } realm_newrec($keyword,$name,$realmlen - 1); next; } # # Save this subfield into the realm's collection. # $realms{$name}{$keyword} = $value; } # # Make sure the last line is a blank line. # if($realmlines[-1] !~ /^\s*$/) { push @realmlines, "\n"; $realmlen = @realmlines; } # # Build our index of realm indices. # buildrealmindex(); return(0); } #-------------------------------------------------------------------------- # Routine: realm_names() # # Purpose: Smoosh the realm names into an array and return the array. # sub realm_names { my $rrn; # Realm name index. my @names = (); # Array for realm names. # print "realm_names: down in\n"; foreach $rrn (sort(keys(%realms))) { push @names, $rrn; } return(@names); } #-------------------------------------------------------------------------- # Routine: realm_exists() # # Purpose: Return a flag indicating if the given realm exists. # sub realm_exists { my $name = shift; # print "realm_exists: down in ($name)\n"; return(exists($realms{$name})); } #-------------------------------------------------------------------------- # Routine: realm_fullrec() # # Purpose: Return all entries in a given realm. # sub realm_fullrec { my $name = shift; my $nrec = $realms{$name}; # print "realm_fullrec: down in ($name)\n"; return($nrec); } #-------------------------------------------------------------------------- # Routine: realm_recval() # # Purpose: Return the value of a name/subfield pair. # sub realm_recval { my $name = shift; my $field = shift; my $val = $realms{$name}{$field}; # print "realm_recval: down in ($name) ($field) ($val)\n"; return($val); } #-------------------------------------------------------------------------- # Routine: realm_rectype() # # Purpose: Change the value of a realm. The new value may only be # "realm". # # Return Values: # 1 - success # 0 - failure (invalid record type or realm not found) # sub realm_rectype { my $name = shift; # Name of realm we're modifying. my $rectype = shift; # Realm's new type. my $rlmind; # Realm's index. # print STDERR "realm_rectype: <$name> <$rectype>\n"; # # Make sure we've got a valid record type. # return(0) if($rectype ne "realm"); # # Ensure this is a valid realm. # return(0) if(!defined($realmindex{$name})); # # Get the realm's index. # $rlmind = rlmindex($name); # # Change the realm's type. # $realmlines[$rlmind] =~ s/^(\s*)realm(\s+)/$1$rectype$2/i; $realms{$name}{'realm_type'} = $rectype; # # Set the modified flag and return success. # $modified = 1; return(1); } #-------------------------------------------------------------------------- # Routine: realm_setval() # # Purpose: Set the value of a name/subfield pair. The value is saved # in both %realms and in @realmlines. The file-modified flag # is updated, along with the length $realmlen. # sub realm_setval { my $name = shift; # Name of realm we're modifying. my $field = shift; # Realm's subfield to be changed. my $val = shift; # New value for the realm's subfield. my $found = 0; # Realm-found flag. my $fldind; # Loop index. my $rlmind; # Loop index for finding realm. my $lastfld = 0; # Last found field in @realmlines. # print "realm_setval: down in\n"; # # If a realm of the specified name doesn't exist, we'll create a # new one. We'll add it to @realmlines and %realms. # # We'll also assume it's a "realm" type realm. # if(!exists($realms{$name})) { # # Add the realm to the %realms hash. # realm_newrec("realm",$name,$realmlen + 1); # # Start the new realm in @realmlines. # $realmlines[$realmlen] = "\n"; $realmlen++; $realmlines[$realmlen] = "realm\t\"$name\"\n"; $realmindex{$name} = $realmlen; $realmlen++; } # # Set the new value for the name/field in %realms. # $realms{$name}{$field} = $val; # # Get the index of the realm in @realmlines. # $rlmind = rlmindex($name); # # Find the specified field's entry in the realm's lines in # @realmlines. We'll skip over lines that don't have a keyword # and dquotes-enclosed value. If we hit the next realm then we'll # stop looking and add a new entry at the end of the realm's fields. # for($fldind=$rlmind+1;$fldind<$realmlen;$fldind++) { my $line = $realmlines[$fldind]; # Line in realm file. my $lkw; # Line's keyword. my $lval; # Line's value. # # Get the line's keyword and value. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \t]*)"/; $lkw = $1; $lval = $2; # # Skip lines that don't match the expected field/value pattern. # next if($lkw eq ""); # # If we hit the beginning of the next realm without # finding the field, drop out and insert it. # last if(lc($lkw) eq "realm"); # # Save the index of the last field we've looked at that # belongs to the realm. # $lastfld = $fldind; # # If we found the field, set the found flag, drop out and # modify it. # if(lc($lkw) eq lc($field)) { $found = 1; last; } } # # If we found the entry, we'll modify it in place. # If we didn't find the entry, we'll insert a new line into the array. # if($found) { $realmlines[$fldind] =~ s/"([a-zA-Z0-9\/\-+_.,: \t]*)"/"$val"/; } else { my $newline = "\t$field\t\t\"$val\"\n"; # # If the keyword is longer than 7 characters, we'll lop out one # of the tabs between the keyword and the value. This is to do # some rough, simple formatting to keep the realm file some- # what orderly. This assumes eight-character tabstops. # if(length($field) > 7) { $newline =~ s/\t\t/\t/; } # # If the starting realm line is the last line in the file, # we'll just push the new line at the end. If it's somewhere # in the middle, we'll do the magic to insert it at the start # of the realm. # my @endarr = splice(@realmlines,$rlmind+1); push(@realmlines,$newline); push(@realmlines,@endarr); # # Bump the array length counter. # $realmlen++; # # Rebuild our table of realm indices. # buildrealmindex(); } # # Tell the world (or at least the module) that the file has # been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: realm_delfield() # # Purpose: Delete a name/subfield pair. The value is deleted from # both %realms and @realmlines. The $modified file- # modified flag is updated, along with the length $realmlen. # sub realm_delfield { my $name = shift; # Name of realm we're modifying. my $field = shift; # Realm's subfield to be deleted. my $found = 0; # Realm-found flag. my $fldind; # Loop index. my $rlmind; # Loop index for finding realm. my $lastfld = 0; # Last found field in @realmlines. # print "realm_delfield: down in\n"; # # Return if a realm of the specified name doesn't exist. # return(0) if(!exists($realms{$name})); # # Return if a realm of the specified name doesn't have the # specified field. # return(0) if(!exists($realms{$name}{$field})); # # Delete the field from %realms. # delete($realms{$name}{$field}); # # Get the index for the realm. # $rlmind = rlmindex($name); # # Find the specified field's entry in the realm's lines in # @realmlines. We'll skip over lines that don't have a keyword # and dquotes-enclosed value. # for($fldind=$rlmind+1;$fldind<$realmlen;$fldind++) { my $line = $realmlines[$fldind]; # Line in realm file. my $lkw; # Line's keyword. my $lval; # Line's value. # # Get the line's keyword and value. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \t]*)"/; $lkw = $1; $lval = $2; # # Go to the next line if this one doesn't match the # field/value pattern. # next if($lkw eq ""); # # If we hit the beginning of the next realm without # finding the field, drop out. # last if(lc($lkw) eq "realm"); # # Save the index of the last field we've looked at that # belongs to the realm. # $lastfld = $fldind; # # If we found the field, set the found flag, drop out and # modify it. # if(lc($lkw) eq lc($field)) { $found = 1; last; } } # # If we found the entry, we'll delete it and rebuild the # realm index table. # if($found) { splice @realmlines, $fldind, 1; buildrealmindex(); } # # Tell the world (or at least the module) that the file has # been modified. # $modified = 1; return(1); } #-------------------------------------------------------------------------- # Routine: realm_add() # # Purpose: Adds a new realm and fields to %realms and $realmlines. # sub realm_add { my $rlmtype = shift; # Realm type. my $rlmname = shift; # Name of realm we're creating. my $flds = shift; # Reference to realm fields. my $chronosecs; # Current time in seconds. my $chronostr; # Current time string. my %fields; # Realm fields. # print "realm_add: down in\n"; # # Get the timestamp. # $chronosecs = time(); $chronostr = gmtime($chronosecs); # # Create the basic realm info. # realm_newrec($rlmtype,$rlmname,$realmlen + 1); # # Add the new realm's first line to the end of the realm table. # and add an entry to the realm index. # $realmlines[$realmlen] = "\n"; $realmlen++; $realmlines[$realmlen] = "realm\t\"$rlmname\"\n"; $realmindex{$rlmname} = $realmlen; $realmlen++; # # Fill the new realm with the caller's hash fields and add it to # the end of the realm table. # if(defined($flds)) { %fields = %$flds; foreach my $fn (@REALMFIELDS) { my $spacing = "\t\t"; # Spacing string. # # If this field isn't defined for the realm, # don't add it in. # if(!defined($fields{$fn})) { next; } # # Drop back to a single tab between key and value # if the key name is long. # $spacing = "\t" if(length($fn) > 7); # # Add the field to the hash table and to the realm # file contents array. # $realms{$rlmname}{$fn} = $fields{$fn}; $realmlines[$realmlen] = "\t$fn$spacing\"$fields{$fn}\"\n"; $realmlen++; } } # # Put a blank line after the final line of the realm. # $realmlines[$realmlen] = "\n"; $realmlen++; # # Mark the realm file as having been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: realm_del() # # Purpose: Deletes a realm and fields from %realms and $realmlines. # sub realm_del { my $rlmname = shift; # Name of realm we're deleting. my %realm; # Realm to be deleted. my $rrr; # Realm reference. my $ind; # Index into realmlines. my $rlmind; # Index to realm's first line. my $line; # Realm line from @realmlines. my $lkey; # Realm line's key. my $lval; # Realm line's value. my $len; # Length of array slice to delete. # print "realm_del: down in\n"; # # Don't allow empty realm names or non-existent realms. # return(-1) if($rlmname eq ""); return(-1) if(!defined($realmindex{$rlmname})); # # Get a copy of the realm from the realm hash and then delete # the original. # $rrr = $realms{$rlmname}; %realm = %$rrr; delete $realms{$rlmname}; # # Get the index for this realm. # $rlmind = rlmindex($rlmname); # # Find the beginning of the next realm. # for($ind = $rlmind+1; $ind < $realmlen; $ind++) { $line = $realmlines[$ind]; $line =~ /^\s*(realm)\s+"([a-zA-Z0-9\/\-+_.,: \t]+)"/i; $lkey = $1; $lval = $2; last if($lkey eq "realm"); } $ind--; # # Find the end of the previous realm (the one to be deleted.) # while($ind > $rlmind) { last if($realmlines[$ind] ne "\n"); $ind--; } # # Delete the realm from @realmlines. # $len = $ind - $rlmind + 1; splice(@realmlines,$rlmind,$len); $realmlen -= $len; # # Fold two consecutive blank lines into one. # if(($realmlines[$rlmind-1] eq "\n") && ($realmlines[$rlmind] eq "\n")) { splice(@realmlines,$rlmind,1); } # # Rebuild our table of realm indices. # buildrealmindex(); # # Mark that the file has been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: realm_rename() # # Purpose: Renames a realm. # sub realm_rename { my $oldname = shift; # Name of realm we're renaming. my $newname = shift; # New name of realm. my %realm; # Realm to be deleted. my $rrr; # Realm reference. my $ind; # Index into realmlines. my $rlmind; # Index to realm's first line. my $line; # Realm line from @realmlines. my $lkey; # Realm line's key. my $lval; # Realm line's value. my $len; # Length of array slice to delete. # print "realm_rename: down in\n"; # # Don't allow empty realm names. # return(-1) if($oldname eq ''); return(-2) if($newname eq ''); # # The old realm must exist. # return(-3) if(! exists($realms{$oldname})); # # Don't allow renames to existing realm names. # return(-4) if(exists($realms{$newname})); # # Get a copy of the old realm. # $realms{$newname} = $realms{$oldname}; # # Change the name field in the new realm. # $realms{$newname}{'realm_name'} = $newname; $rrr = $realms{$newname}; %realm = %$rrr; # # If we didn't find a realm with this name, return failure. # return(-5) if(!defined($realmindex{name})); # # Get the index of this realm. # $rlmind = rlmindex($oldname); # # Find the beginning of the next realm. # $realmlen = @realmlines; for($ind = $rlmind+1;$ind < $realmlen; $ind++) { $line = $realmlines[$ind]; $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $lkey = $1; $lval = $2; last if($lkey eq "realm"); } $ind--; # # Find the end of the previous realm (the one to be deleted.) # while($ind > $rlmind) { last if($realmlines[$ind] ne "\n"); $ind--; } # # Find the realm's realm line and change the name. # for(my $i=$rlmind; $i <= $ind; $i++) { my $chunk; # Key and spacing from line. $realmlines[$i] =~ /^(\s*([a-zA-Z_]+)\s+)"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $chunk = $1; $lkey = $2; if($lkey eq 'realm') { $realmlines[$i] = "$chunk\"$newname\"\n"; last; } } # # Delete the old realm and the old name's entry in the index hash. # delete $realms{$oldname}; $realmindex{$newname} = $realmindex{$oldname}; delete $realmindex{$oldname}; # # Mark that the file has been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: realm_newrec() # # Purpose: Creates a realm in %realms. The name and type fields # are set. # # This routine is NOT rebuilding the index. Doing this here # has the potential for slowing down file reads and such. # The index is dealt with in those module routines which call # realm_newrec(); since it isn't exported, there should be # no outside callers to worry about. # sub realm_newrec { my $type = shift; # Type of realm we're creating. my $name = shift; # Name of realm we're creating. my $line = shift; # Line number of this realm. # print "realm_newrec: down in\n"; return if($type ne "realm"); $realms{$name}{"realm_name"} = $name; $realms{$name}{"realm_type"} = $type; $realmindex{$name} = $line; } #-------------------------------------------------------------------------- # Routine: realm_fields() # # Purpose: Return the list of realm fields. # sub realm_fields { # print "realm_fields: down in\n"; return(@REALMFIELDS); } #-------------------------------------------------------------------------- # Routine: realm_default() # # Purpose: Return the default realm file. # sub realm_default { my $confdir; # Configuration directory. my $defrr; # Default realm name. # print "realm_default: down in\n"; # # Get the DNSSEC-Tools config directory. # $confdir = getconfdir() || $DEFAULT_DNSSECTOOLS_DIR; # # Build our lock file. # $defrr = "$confdir/$DEFAULT_REALMFILE"; return($defrr); } #-------------------------------------------------------------------------- # Routine: realm_init() # # Purpose: Initialize the internal data. # sub realm_init { # print "realm_init: down in\n"; %realms = (); %realmindex = (); @realmlines = (); $realmlen = 0; $modified = 0; } #-------------------------------------------------------------------------- # Routine: realm_discard() # # Purpose: Discard the current realm file -- don't save the contents, # don't delete the file, reset all internal fields. # sub realm_discard { # print "realm_discard: down in\n"; close(REALM); realm_init(); } #-------------------------------------------------------------------------- # Routine: realm_close() # # Purpose: Save the realm file and close the descriptor. # sub realm_close { # print "realm_close: down in\n"; realm_write(); close(REALM); } #-------------------------------------------------------------------------- # Routine: realm_write() # # Purpose: Save the realm file and leave the file handle open. # We'll get an exclusive lock on the realm file in order # to (try to) ensure we're the only ones writing the file. # # We'll make a (hopefully atomic) copy of the in-core realm # lines prior to trying to write. This is an attempt to # keep the data from being mucked with while we're using it. # sub realm_write { my $writecmds = shift; # Boolean for saving unexecuted commands. my $rfc = ""; # Concatenated realm file contents. my $ofh; # Old file handle. my @rrlines = @realmlines; # Copy of The Realm. my $rrlen; # Number of lines in The Realm. # print STDERR "realm_write: down in\n"; # # If the file hasn't changed, we'll skip writing. # return if(!$modified); # # Make sure we've got the correct count of realm lines. # $rrlen = @rrlines; # # Loop through the array of realm lines and concatenate them all. # for(my $ind = 0; $ind < $rrlen; $ind++) { $rfc .= $rrlines[$ind]; } # # Lock the realm file. # flock(REALM,LOCK_EX); # # Force immediate writes of REALM. # $ofh = select REALM; $| = 1; # # Zap the realm file and write out the new one. # seek(REALM,0,0); truncate(REALM,0); print REALM $rfc; # # Reset REALM buffering to original state. # select $ofh; # # Unlock the realm file. # return(flock(REALM,LOCK_UN)); } #-------------------------------------------------------------------------- # Routine: buildrealmindex() # # Purpose: This routine builds a name->index hash table for the defined # realms. The name is the name of a realm. The index is # that realm's index in the @realmlines array. # sub buildrealmindex { # # Zap the current realm index. # %realmindex = (); # # Traipse through @realmlines, and save the line index for the # start of each realm. # for(my $rlmind=0;$rlmind<$realmlen;$rlmind++) { my $line = $realmlines[$rlmind]; # Line in realm file. my $rlmname; # Realm name. # # Dig out the line's keyword and value. # $line =~ /^\s*realm\s+"([a-zA-Z0-9\/\-+_.,: \t]+)"/i; $rlmname = $1; # # If this is a realm line, save the line index for # this realm entry. # if($rlmname ne '') { $realmindex{$rlmname} = $rlmind; } } } #-------------------------------------------------------------------------- # Routine: rlmindex() # # Purpose: Get the index for the named realm entry. We'll first # consult the name's existing index to @realmlines. If the # name matches, all's well. If it doesn't, then we'll rebuild # the index hash and then get the table index. # # Callers MUST have already checked that the realm name # exists. Arguably, this should be done here, but it isn't. # sub rlmindex { my $name = shift; # Realm to look up. my $rlmind; # Realm's index. my $line; # Supposed start of realm. my $lname; # Name from line. # # Find the index for this realm in @realmlines. # $rlmind = $realmindex{$name}; # # Get the line we're expecting this realm to start with. # $line = $realmlines[$rlmind]; # # Dig out the realm name from this line. # $line =~ /^\s*(realm)\s+"([a-zA-Z0-9\/\-+_.,: \t]+)"/i; $lname = $2; # # If this name doesn't match the requested name, we'll rebuild # the index and call ourself to find the index. # # This should never fail, as long as the caller already ensured # the realm name is valid. # if($lname ne $name) { buildrealmindex(); $rlmind = rlmindex($name); } # # Give the realm's index back to our caller. # return($rlmind); } #-------------------------------------------------------------------------- # Routine: realm_dump_hash() # # Purpose: Dump the parsed realm entries. # sub realm_dump_hash { # print "realm_dump_hash: down in\n"; # # Loop through the hash of realms and print the realm names, # subfields, and values. # foreach my $k (sort(keys(%realms))) { print "realm - $k\n"; my $subp = $realms{$k}; my %subrecs = %$subp; foreach my $sk (sort(keys(%subrecs))) { print "\t$sk\t\t$subrecs{$sk}\n"; } print "\n"; } } #-------------------------------------------------------------------------- # Routine: realm_dump_array() # # Purpose: Display the contents of @realmlines. # sub realm_dump_array { # print "realm_dump_array: down in\n"; # # Loop through the array of realm lines and print them all. # for(my $ind=0;$ind<$realmlen;$ind++) { print $realmlines[$ind]; } } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::realm - Manipulate a DNSSEC-Tools realm file. =head1 SYNOPSIS use Net::DNS::SEC::Tools::realm; realm_lock(); realm_read("localhost.realm"); @rlmnames = realm_names(); $flag = realm_exists("example"); $rrec = realm_fullrec("example"); %rrhash = %$rrec; $zname = $rrhash{"maxttl"}; $val = realm_recval("example","state"); realm_add("realm","example",\%realmfields); realm_del("example"); realm_rename("example","test-realm"); realm_setval("example","rollrec","example.rrf"); realm_delfield("example","user"); @realmfields = realm_fields(); $count = realmrec_merge("primary.realm", "new0.realm", "new1.realm"); @retvals = realmrec_split("new-realm.rrf", @list_of_realms); $default_file = realm_default(); realm_write(); realm_close(); realm_discard(); realm_unlock(); =head1 DESCRIPTION The B module manipulates the contents of a DNSSEC-Tools I file. I files describe the status of a zone rollover environment, as managed by the DNSSEC-Tools programs. Module interfaces exist for looking up I records, creating new records, and modifying existing records. A I file is organized in sets of I records. Is describe the state of a rollover environment. A I consists of a set of keyword/value entries. The following is an example of a I: realm "production" state "active" realmdir "/usr/etc/dnssec-tools/realms/production" configdir "/usr/etc/dnssec-tools/configs/production" rollrec "production.rollrec" administrator "sysfolks@example.com" display "1" args "-loglevel phase -logfile log.prod -display" user "prodmgr" The first step in using this module must be to read the I file. The I interface reads the file and parses it into an internal format. The file's records are copied into a hash table (for easy reference by the B routines) and in an array (for preserving formatting and comments.) After the file has been read, the contents are referenced using I and I. The I and I interfaces are used to modify the contents of a I record. If the I file has been modified, it must be explicitly written or the changes will not saved. I saves the new contents to disk. I saves the file and close the Perl file handle to the I file. If a I file is no longer wanted to be open, yet the contents should not be saved, I gets rid of the data closes and the file handle B saving any modified data. On reading a I file, consecutive blank lines are collapsed into a single blank line. As I entries are added and deleted, files merged and files split, it is possible for blocks of consecutive blanks lines to grow. This will prevent these blocks from growing excessively. =head1 REALM LOCKING This module includes interfaces for synchronizing access to the I files. This synchronization is very simple and relies upon locking and unlocking a single lock file for all I files. I locking is not required before using this module, but it is recommended. The expected use of these facilities follows: realm_lock() || die "unable to lock realm file\n"; realm_read(); ... perform other realm operations ... realm_close(); realm_unlock(); Synchronization is performed in this manner due to the way the module's functionality is implemented, as well as providing flexibility to users of the module. It also provides a clear delineation in callers' code as to where and when I locking is performed. This synchronization method has the disadvantage of having a single lockfile as a bottleneck to all I file access. However, it reduces complexity in the locking interfaces and cuts back on the potential number of required lockfiles. Using a single synchronization file may not be practical in large installations. If that is found to be the case, then this will be reworked. =head1 REALM INTERFACES The interfaces to the B module are given below. =over 4 =item I This routine adds a new I to the I file and the internal representation of the file contents. The I is added to both the I<%realms> hash table and the I<@realmlines> array. Entries are only added if they are defined for Is. I is the type of the I. This must be "realm". I is the name of the I. I is a reference to a hash table that contains the name/value I fields. The keys of the hash table are always converted to lowercase, but the entry values are left as given. A blank line is added after the final line of the new I. The I file is not written after I, though it is internally marked as having been modified. =item I This routine deletes a I from the I file and the internal representation of the file contents. The I is deleted from both the I<%realms> hash table and the I<@realmlines> array. Only the I itself is deleted from the file. Any associated comments and blank lines surrounding it are left intact. The I file is not written after I, though it is internally marked as having been modified. Return values are: 0 successful realm deletion -1 unknown name =item I This interface saves the internal version of the I file (opened with I) and closes the file handle. =item I Deletes the given field from the specified I. The file is B written after updating the value, but the internal file-modified flag is set. The value is saved in both I<%realms> and in I<@realmlines>. Return values: 0 - failure (realm not found or realm does not contain the field) 1 - success =item I This routine removes a I file from use by a program. The internally stored data are deleted and the I file handle is closed. However, modified data are not saved prior to closing the file handle. Thus, modified and new data will be lost. =item I This routine returns a boolean flag indicating if the I named in I exists. =item I I returns a reference to the I specified in I. =item I I locks the I lockfile. An exclusive lock is requested, so the execution will suspend until the lock is available. If the I synchronization file does not exist, it will be created. If the process can't create the synchronization file, an error will be returned. Success or failure is returned. =item I This interface merges the specified I files. It reads each file and parses them into a I hash table and a file-contents array. The resulting merge is written to the file named by I. If another I is already open, it is saved and closed prior to opening the new I. If I is an existing I file, its contents will be merged with the other files passed to I. If the file does not exist, I will create it and merge the remaining files into it. Upon success, I returns the number of Is read from the file. Failure return values: -1 no realm files were given to realm_merge -2 unable to create target realm file -3 unable to read first realm file -4 an error occurred while reading the realm names -5 realm files were duplicated in the list of realm files =item I This routine returns a list of the I names from the file. =item I This interface reads the specified I file and parses it into a I hash table and a file-contents array. I B be called prior to any of the other B calls. If another I is already open, it is saved and closed prior to opening the new I. I attempts to open the I file for reading and writing. If this fails, then it attempts to open the file for reading only. I is a front-end for I. It sets up the module's saved data in preparation for reading a new I file. These house-keeping actions are not performed by I. Upon success, I returns the number of Is read from the file. Failure return values: -1 specified realm file doesn't exit -2 unable to open realm file -3 duplicate realm names in file =item I This interface reads the specified file handle to a I file and parses the file contents into a I hash table and a file-contents array. The hash table and file-contents array are B cleared prior to adding data to them. Upon success, I returns zero. Failure return values: -1 duplicate realm names in file =item I Set the type of the specified I record. The file is B written after updating the value, but the internal file-modified flag is set. The value is saved in both I<%realms> and in I<@realmlines>. I is the name of the I that will be modified. I is the new type of the I, which must be "realm". Return values: 0 - failure (invalid record type or realm not found) 1 - success =item I This routine returns the value of a specified field in a given I. I is the name of the particular I to consult. I is the field name within that I. For example, the current I file contains the following I. realm "example" rollrec "example.rrf" The call: realm_recval("example","rollrec") will return the value "example.rrf". =item I This routine renames the I named by I to I. The actual effect is to change the name in the I line to I. The name is changed in the internal version of the the I file only. The file itself is not changed, but must be saved by calling either I, I, or I. I must be the name of an existing I. Conversely, I must not name an existing I. Return values: 0 - success -1 - old_realm_name was null or empty -2 - new_realm_name was null or empty -3 - old_realm_name is not an existing realm -4 - new_realm_name is already a realm -5 - internal error that should never happen =item I Set the value of a name/field pair in a specified I. The file is B written after updating the value, but the internal file-modified flag is set. The value is saved in both I<%realms> and in I<@realmlines>. I is the name of the I that will be modified. If the named I does not exist, it will be created as a "realm"-type I. I is the I field which will be modified. I is the new value for the field. =item I Move a set of I entries from the current I file to a new file. The moved I entries are removed both from the current file and from the internal module data representing that file. The I parameter holds the name of the new I file. If this file doesn't exist, it will be created. If it does exist, the I entries will be appended to that file. I is a list of I entries that will be moved from the current file to the file named in I. If some of the given I names are invalid, the valid names will be moved to the new file and the invalid names will be returned in a list to the caller. Only the I entries themselves will be moved to the new I file. Any associated comments will be left in the current I file. On success, the count of moved I entries is returned. Error returns are given below. Failure return values: -1 - no target realm file given in new_realm_file -2 - no realm names given in realm_names -3 - none of the realm names given are existing realms -4 - unable to open new_realm_file -5 - invalid realm names were specified in realm_names, followed by the list of bad names. =item I I unlocks the I synchronization file. =item I This interface saves the internal version of the I file (opened with I). It does not close the file handle. As an efficiency measure, an internal modification flag is checked prior to writing the file. If the program has not modified the contents of the I file, it is not rewritten. I gets an exclusive lock on the I file while writing. =back =head1 REALM INTERNAL INTERFACES The interfaces described in this section are intended for internal use by the B module. However, there are situations where external entities may have need of them. Use with caution, as misuse may result in damaged or lost I files. =over 4 =item I This routine initializes the internal I data. Pending changes will be lost. A new I file must be read in order to use the B interfaces again. =item I This routine returns the name of the default I file. =back =head1 REALM DEBUGGING INTERFACES The following interfaces display information about the currently parsed I file. They are intended to be used for debugging and testing, but may be useful at other times. =over 4 =item I This routine prints the I file as it is stored internally in a hash table. The Is are printed in alphabetical order, with the fields alphabetized for each I. New Is and I fields are alphabetized along with current Is and fields. Comments from the I file are not included with the hash table. =item I This routine prints the I file as it is stored internally in an array. The Is are printed in the order given in the file, with the fields ordered in the same manner. New Is are appended to the end of the array. I fields added to existing Is are added at the beginning of the I entry. Comments and vertical whitespace are preserved as given in the I file. =back =head1 COPYRIGHT Copyright 2012-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B, B, B B, =cut dnssec-tools-2.2/tools/modules/ZoneFile-Fast/0000775000237200023720000000000012544611342021342 5ustar hardakerhardakerdnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/0000775000237200023720000000000012544611342021605 5ustar hardakerhardakerdnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/nameslash.t0000664000237200023720000000330412544611342023745 0ustar hardakerhardaker# This is -*- perl -*- # # Test for allowing slashes in SOA zonenames. # This file was copied from zone.t. # use Net::DNS; use Net::DNS::ZoneFile::Fast; my $zone = <<'EOF'; $ORIGIN 2.1.in-addr.arpa. $TTL 600 3 IN SOA dns1.acme.com. host\.master.acme.com. ( 1000 ; The serial number 180 ; The refresh interval 60 ; The retry interval 1800 ; The expire interval 1000 ; The minimum TTL ) IN NS dns1.acme.com. IN NS dns2.acme.com. 1.3 600 IN PTR host1.acme.com. 2.3 100 IN PTR host2.acme.com. 3.3 50 PTR host3.acme.com. 4.3 PTR dns1.acme.com. 5.3 1800 IN PTR dns2.acme.com. $ORIGIN acme.com. @ IN SOA dns1.acme.com. host\.master.acme.com. ( 1000 ; The serial number 180 ; The refresh interval 60 ; The retry interval 1800 ; The expire interval 1000 ; The minimum TTL ) 3600 IN NS dns1.acme.com. IN NS dns2.acme.com. NS dns3.acme.com. IN MX 10 mail1.acme.com. 3600 MX 20 mail2.acme.com. MX 30 coyote.acme.com. RP postmaster @ dns1 1000 IN A 1.2.3.4 dns2.acme.com. 1000 IN A 1.2.3.5 @ 10 IN CNAME host1.acme.com. . IN A 1.2.3.1 host1 IN A 1.2.3.1 IN TXT "This is the first host" RP tobez.tobez.org. host1 coyote IN CNAME @ ; some comments to make life interesting EOF BEGIN { @rr = ( [ Net::DNS::RR->new("3.2.1.in-addr.arpa. 600 IN SOA dns1.acme.com. host\\.master.acme.com. 1000 180 60 1800 1000")->string, "IN-ADDR.ARPA SOA", 3 ], ); }; use Test::More tests => (1 + 2*@rr); my $rrset = Net::DNS::ZoneFile::Fast::parse($zone); ok(defined $rrset, "Parsing zone file"); for my $rr (@rr) { my $trr = shift @$rrset; is($trr->string, $rr->[0], $rr->[1]); is($trr->Line, $rr->[2], "$rr->[1] - line number"); } dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/rrs-naptr.t0000664000237200023720000000127212544611342023724 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; BEGIN { @test = ( q{2.1.2.1.5.5.5.0.7.7.1.e164.arpa. IN NAPTR 100 10 "u" "E2U+sip" "!^.*$!sip:information@pbx.example.com!i" .}, q{2.1.2.1.5.5.5.0.7.7.1.e164.arpa. IN NAPTR 102 10 "u" "E2U+email" "!^.*$!mailto:information@example.com!i" .}, ); } use Test::More tests => 2 * scalar @test; for my $rrdata (@test) { my $rrset = Net::DNS::ZoneFile::Fast::parse($rrdata); ok(defined $rrset, "Parsing $rrdata"); my $rr = new Net::DNS::RR $rrdata; (my $rrcorrect = $rr->string) =~ s/\s+/ /g; (my $rrtxt = $rrset->[0]->string) =~ s/\s+/ /g; is($rrtxt, $rrcorrect, "RR comparison for $rrdata"); } dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/zone.t0000664000237200023720000001052612544611342022751 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS; use Net::DNS::ZoneFile::Fast; my $zone = <<'EOF'; $ORIGIN 2.1.in-addr.arpa. $TTL 600 3 IN SOA dns1.acme.com. hostmaster.acme.com. ( ; The host that should give auth answers ; The one who cares when it doesn't ; this comment is a pain... 1000 ; The serial number 180 ; The refresh interval 60 ; The retry interval 1800 ; The expire interval 1000 ; The minimum TTL ) IN NS dns1.acme.com. IN NS dns2.acme.com. 1.3 600 IN PTR host1.acme.com. 2.3 100 IN PTR host2.acme.com. 3.3 50 PTR host3.acme.com. 4.3 PTR dns1.acme.com. 5.3 1800 IN PTR dns2.acme.com. $ORIGIN acme.com. @ IN SOA dns1.acme.com. hostmaster.acme.com. ( ; The host that should give auth answers ; The one who cares when it doesn't 1000 ; The serial number 180 ; The refresh interval 60 ; The retry interval 1800 ; The expire interval 1000 ; The minimum TTL ) 3600 IN NS dns1.acme.com. IN NS dns2.acme.com. NS dns3.acme.com. IN MX 10 mail1.acme.com. 3600 MX 20 mail2.acme.com. MX 30 coyote.acme.com. RP postmaster @ dns1 1000 IN A 1.2.3.4 dns2.acme.com. 1000 IN A 1.2.3.5 @ 10 IN CNAME host1.acme.com. . IN A 1.2.3.1 host1 IN A 1.2.3.1 IN TXT "This is the first host" RP tobez.tobez.org. host1 coyote IN CNAME @ ; some comments to make life interesting EOF BEGIN { @rr = ( [ Net::DNS::RR->new("3.2.1.in-addr.arpa. 600 IN SOA dns1.acme.com. hostmaster.acme.com. 1000 180 60 1800 1000")->string, "IN-ADDR.ARPA SOA", 3 ], [ Net::DNS::RR->new("3.2.1.in-addr.arpa. 600 IN NS dns1.acme.com.")->string, "First NS RR", 12 ], [ Net::DNS::RR->new("3.2.1.in-addr.arpa. 600 IN NS dns2.acme.com.")->string, "Second NS RR", 13 ], [ Net::DNS::RR->new("1.3.2.1.in-addr.arpa. 600 IN PTR host1.acme.com.")->string, "PTR RR with default TTL", 15 ], [ Net::DNS::RR->new("2.3.2.1.in-addr.arpa. 100 IN PTR host2.acme.com.")->string, "PTR RR with explicit TTL", 16 ], [ Net::DNS::RR->new("3.3.2.1.in-addr.arpa. 50 PTR host3.acme.com.")->string, "PTR RR with no class", 17 ], [ Net::DNS::RR->new("4.3.2.1.in-addr.arpa. 600 PTR dns1.acme.com.")->string, "PTR RR with no class and default TTL", 18 ], [ Net::DNS::RR->new("5.3.2.1.in-addr.arpa. 1800 IN PTR dns2.acme.com.")->string, "Plan PTR RR", 19 ], [ Net::DNS::RR->new("acme.com. 600 IN SOA dns1.acme.com. hostmaster.acme.com. 1000 180 60 1800 1000")->string, "acme.com. SOA", 22 ], [ Net::DNS::RR->new("acme.com. 3600 IN NS dns1.acme.com.")->string, "First NS RR", 29 ], [ Net::DNS::RR->new("acme.com. 600 IN NS dns2.acme.com.")->string, "Second NS RR", 30 ], [ Net::DNS::RR->new("acme.com. 600 IN NS dns3.acme.com.")->string, "Third NS RR", 31 ], [ Net::DNS::RR->new("acme.com. 600 IN MX 10 mail1.acme.com.")->string, "Innocent MX", 33 ], [ Net::DNS::RR->new("acme.com. 3600 IN MX 20 mail2.acme.com.")->string, "MX with TTL", 34 ], [ Net::DNS::RR->new("acme.com. 600 IN MX 30 coyote.acme.com.")->string, "Compact MX", 35 ], [ Net::DNS::RR->new("acme.com. 600 IN RP postmaster.acme.com. acme.com.")->string, "RP with implicit mbox and \@-txtdname", 36 ], [ Net::DNS::RR->new("dns1.acme.com. 1000 IN A 1.2.3.4")->string, "Simple A RR", 38 ], [ Net::DNS::RR->new("dns2.acme.com. 1000 IN A 1.2.3.5")->string, "FQDN A RR", 39 ], [ Net::DNS::RR->new("acme.com. 10 IN CNAME host1.acme.com.")->string, "\@ CNAME", 40 ], [ Net::DNS::RR->new(". 600 IN A 1.2.3.1")->string, "A RR for the root domain (invalid anyway)", 41 ], [ Net::DNS::RR->new("host1.acme.com. 600 IN A 1.2.3.1")->string, "Simple A RR", 42 ], [ Net::DNS::RR->new("host1.acme.com. 600 IN TXT \"This is the first host\"")->string, "dangling TXT RR", 43 ], [ Net::DNS::RR->new("host1.acme.com. 600 IN RP tobez.tobez.org. host1.acme.com.")->string, "RP with implicit txtdname", 44 ], [ Net::DNS::RR->new("coyote.acme.com. 600 IN CNAME acme.com.")->string, "@ on the RHS", 46 ], ); }; use Test::More tests => (1 + 2*@rr); my $rrset = Net::DNS::ZoneFile::Fast::parse($zone); ok(defined $rrset, "Parsing zone file"); for my $rr (@rr) { my $trr = shift @$rrset; is($trr->string, $rr->[0], $rr->[1]); is($trr->Line, $rr->[2], "$rr->[1] - line number"); } dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/origin.t0000664000237200023720000000222312544611342023260 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use Test::More tests => 9; ok(defined Net::DNS::ZoneFile::Fast::parse(q{}), 'Empty zone'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{$ORIGIN acme.com.}), 'Simple $ORIGIN clause'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{$ORIGIN acme.com. ; comment}), 'Simple $ORIGIN clause with comments'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{$ORIGIN acme.com}), 'Simple $ORIGIN clause with no trailing dot'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{$ORIGIN acme.com ; comment}), 'Simple $ORIGIN clause with comments and no dot'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{$ORIGIN . ; comment}), 'Simple $ORIGIN clause with comments and just a dot'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{$ORIGIN .}), 'Simple $ORIGIN clause with just a dot'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => q{$ORIGIN}, quiet => 1, soft_errors => 1), '$ORIGIN token alone in the file'); my $rr = Net::DNS::ZoneFile::Fast::parse("\$ORIGIN bork.\n\$ORIGIN moo.bla\nmoof A 1.2.3.4"); ok(defined($rr) && 1 == @$rr && $rr->[0]->name eq "moof.moo.bla.bork", 'Relative origin'); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/ttl.t0000664000237200023720000000435712544611342022606 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use Test::More tests => 24; ok(defined Net::DNS::ZoneFile::Fast::parse(q{$TTL 30}), 'Simple $TTL clause'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{$TTL 30 ; comment}), 'Simple $TTL clause with comments'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "\$TTL\n30", quiet => 1, soft_errors => 1), '$TTL clause spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => q{$TTL}, quiet => 1, soft_errors => 1), '$TTL token alone in the file'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => q{$TTL 1C3F}, quiet => 1, soft_errors => 1), '$TTL expressed in cats per forthnight'); my $p; ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 1800\na.b. A 1.2.3.4")), '$TTL as a number'); is($p->[0]->ttl, 1800, "TTL == 1800 seconds"); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 1S\na.b. A 1.2.3.4")), '$TTL with seconds'); is($p->[0]->ttl, 1, "TTL == 1 second"); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 1M\na.b. A 1.2.3.4")), '$TTL with minutes'); is($p->[0]->ttl, 60, "TTL == 1 minute"); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 1H\na.b. A 1.2.3.4")), '$TTL with hours'); is($p->[0]->ttl, 3600, "TTL == 1 hour"); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 2H3h\na.b. A 1.2.3.4")), '$TTL with some hours'); is($p->[0]->ttl, 5*3600, "TTL == 5 hours"); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 1D\na.b. A 1.2.3.4")), '$TTL with days'); is($p->[0]->ttl, 86400, "TTL == 1 day"); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 1W\na.b. A 1.2.3.4")), '$TTL with weeks'); is($p->[0]->ttl, 604800, "TTL == 1 week"); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 2W3D4H30M45S\na.b. A 1.2.3.4")), '$TTL with weeks, days, hours, minutes, and seconds [1]'); is($p->[0]->ttl, 1485045, "TTL == something [1]"); ok(!defined($p = Net::DNS::ZoneFile::Fast::parse(text => "\$TTL 2W3D4H30M45x\na.b. A 1.2.3.4", quiet => 1, soft_errors => 1)), '$TTL with weeks, days, hours, minutes, and seconds [2]'); ok(defined($p = Net::DNS::ZoneFile::Fast::parse("\$TTL 30M45S2W\na.b. A 1.2.3.4")), '$TTL with minutes, seconds, and weeks'); is($p->[0]->ttl, 1211445, "TTL == 2w30m45s"); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/generate.t0000664000237200023720000000173612544611342023573 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use Test::More tests => 7 ; my $data = q{ $GENERATE 1-5 $.1.1.1.in-addr.arpa. IN PTR host-$.acme.com. }; my @rr = ( [ Net::DNS::RR->new("1.1.1.1.in-addr.arpa. IN PTR host-1.acme.com.")->string, "First RR of a \$GENERATE" ], [ Net::DNS::RR->new("2.1.1.1.in-addr.arpa. IN PTR host-2.acme.com.")->string, "Second RR of a \$GENERATE" ], [ Net::DNS::RR->new("3.1.1.1.in-addr.arpa. IN PTR host-3.acme.com.")->string, "Third RR of a \$GENERATE" ], [ Net::DNS::RR->new("4.1.1.1.in-addr.arpa. IN PTR host-4.acme.com.")->string, "Fourth RR of a \$GENERATE" ], [ Net::DNS::RR->new("5.1.1.1.in-addr.arpa. IN PTR host-5.acme.com.")->string, "Last RR of a \$GENERATE" ], ); my $rrset = Net::DNS::ZoneFile::Fast::parse($data); ok(defined $rrset, "Parsing of a \$GENERATE statement"); is(scalar @$rrset, scalar @rr, "Number of parsed RRs"); for my $rr (@rr) { my $rrt = shift @$rrset; is($rrt->string, $rr->[0], $rr->[1]); } dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/00-load.t0000664000237200023720000000123512544611342023127 0ustar hardakerhardaker# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..1\n"; } END {print "not ok 1\n" unless $loaded;} use Net::DNS::ZoneFile::Fast; $loaded = 1; print "ok 1\n"; ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/soattl.t0000664000237200023720000000156512544611342023307 0ustar hardakerhardaker# This is -*- perl -*- use IO::File; use Net::DNS; use Net::DNS::RR; use Net::DNS::ZoneFile::Fast; use Test::More tests => 5; END { unlink "./read.txt"; } my $zone = q{a.com. 30 IN SOA dns1.a.com. hostmaster.a.com. (1 1 1 1 1)}; ok(defined Net::DNS::ZoneFile::Fast::parse($zone), "parse of the test zone"); my $fh = new IO::File "./read.txt", "w" or die "# Failed to create test file\n"; print $fh $zone; $fh->close; $fh = new IO::File "./read.txt" or die "# Failed to open test file\n"; ok(defined Net::DNS::ZoneFile::Fast::parse(fh => $fh), 'readfh'); $fh->close; ok(defined Net::DNS::ZoneFile::Fast::parse(file => "./read.txt"), 'read'); my $rrset = Net::DNS::ZoneFile::Fast::parse(file => "./read.txt"); ok(defined $rrset, 're-read'); die unless defined $rrset; my $rr = new Net::DNS::RR $zone; ok($rr->string eq $rrset->[0]->string, "RR comparison"); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/rr-multi-a.t0000664000237200023720000000211412544611342023761 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use Test::More tests => 6; $zone = q{ $ORIGIN acme.com. www 926 IN A 10.10.10.10 925 IN A 11.11.11.11 }; $crr = Net::DNS::RR->new("www.acme.com 925 IN A 11.11.11.11")->string; my $rrset = Net::DNS::ZoneFile::Fast::parse($zone); is (scalar @$rrset, 2, "Correct number of RRs in zone"); is ($rrset->[1]->string, $crr, "Correct (empty) RR parsed"); $zone = q{ $ORIGIN acme.com. www 926 IN A 10.10.10.10 www 925 IN A 11.11.11.11 }; $crr = Net::DNS::RR->new("www.acme.com 925 IN A 11.11.11.11")->string; $rrset = Net::DNS::ZoneFile::Fast::parse($zone); is (scalar @$rrset, 2, "Correct number of RRs in zone"); is ($rrset->[1]->string, $crr, "Correct (partial) RR parsed"); $zone = q{ $ORIGIN acme.com. www 926 IN A 10.10.10.10 www.acme.com. 925 IN A 11.11.11.11 }; $crr = Net::DNS::RR->new("www.acme.com 925 IN A 11.11.11.11")->string; $rrset = Net::DNS::ZoneFile::Fast::parse($zone); is (scalar @$rrset, 2, "Correct number of RRs in zone"); is ($rrset->[1]->string, $crr, "Correct (fqdn) RR parsed"); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/newlines.t0000664000237200023720000000615712544611342023627 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use Test::More tests => 18; ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "\$ORIGIN\nmicrosoft.com.", quiet => 1, soft_errors => 1), '$ORIGIN clause spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "\$TTL\n30", quiet => 1, soft_errors => 1), '$TTL clause spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "\$GENERATE\n1-5 \$.1.1.1.in-addr.arpa. IN PTR host-\$.acme.com.", quiet => 1, soft_errors => 1), '$GENERATE clause spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. 30 IN SOA dns1.a.com. hostmaster.a.com.\n(1 1 1 1 1)", quiet => 1, soft_errors => 1), 'SOA record spanning multiple lines in a wrong way 1'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com.\n30 IN SOA dns1.a.com. hostmaster.a.com. (1 1 1 1 1)", quiet => 1, soft_errors => 1), 'SOA record spanning multiple lines in a wrong way 2'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. 30\nIN SOA dns1.a.com. hostmaster.a.com. (1 1 1 1 1)", quiet => 1, soft_errors => 1), 'SOA record spanning multiple lines in a wrong way 3'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. 30 IN\nSOA dns1.a.com. hostmaster.a.com. (1 1 1 1 1)", quiet => 1, soft_errors => 1), 'SOA record spanning multiple lines in a wrong way 4'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. 30 IN SOA\ndns1.a.com. hostmaster.a.com. (1 1 1 1 1)", quiet => 1, soft_errors => 1), 'SOA record spanning multiple lines in a wrong way 5'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. 30 IN SOA dns1.a.com.\nhostmaster.a.com. (1 1 1 1 1)", quiet => 1, soft_errors => 1), 'SOA record spanning multiple lines in a wrong way 6'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "4.3.2.1.in-addr.arpa. PTR\nbla.com.", quiet => 1, soft_errors => 1), 'PTR record spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. NS\nns.a.com.", quiet => 1, soft_errors => 1), 'NS record spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. CNAME\nb.com.", quiet => 1, soft_errors => 1), 'CNAME record spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. MX 0\nmail.a.com.", quiet => 1, soft_errors => 1), 'MX record spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. TXT\n\"hello, world\"", quiet => 1, soft_errors => 1), 'TXT record spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. HINFO Small-Laptop\nFreeBSD", quiet => 1, soft_errors => 1), 'HINFO record spanning multiple lines'); ok(defined Net::DNS::ZoneFile::Fast::parse("a.com. AAAA 3ffe:8050:201:1860:42::1"), 'normal AAAA record'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. AAAA\n3ffe:8050:201:1860:42::1", quiet => 1, soft_errors => 1), 'AAAA record spanning multiple lines'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "a.com. A\n1.2.3.4", quiet => 1, soft_errors => 1), 'A record spanning multiple lines'); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/rrs-ws.t0000664000237200023720000000426112544611342023232 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; BEGIN { @test = ( q{. 300 IN A 127.0.0.1}, q{localhost. 300 IN A 127.0.0.1}, q{localhost IN A 127.0.0.1}, q{localhost.acme IN A 127.0.0.1}, q{localhost A 127.0.0.1}, q{localhost. 300 A 127.0.0.1}, q{10.10.10.10.in-addr.arpa 300 IN PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa. 300 IN PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa. 300 PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa. IN PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa PTR www.acme.com.}, q{. 3600 IN NS dns1.acme.com.}, q{acme.com. 3600 IN NS dns1.acme.com.}, q{@ 3600 IN NS dns1.acme.com.}, q{acme.com. 100 IN CNAME www.acme.com.}, q{acme.com 100 IN CNAME www.acme.com.}, q{text.acme.com. 100 IN TXT "This is a quite long text"}, q{text.acme.com IN TXT "This is another piece"}, q{text.acme.com TXT "This is another piece"}, q{* 100 IN MX 10 mailhost.acme.com.}, q{* IN A 1.2.3.4}, q{* 10 IN A 1.2.3.4}, # q{* IN 10 A 1.2.3.4}, XXX newer Net::DNS does not like this syntax q{acme.com. 200 IN MX 10 mailhost.acme.com.}, q{acme.com. IN MX 10 mailhost.acme.com.}, q{acme.com. MX 10 mailhost.acme.com.}, q{acme.com 200 IN MX 10 mailhost.acme.com.}, q{acme.com IN MX 10 mailhost.acme.com.}, q{acme.com MX 10 mailhost.acme.com.}, q{acme.com. IN SOA dns1.acme.com. me.acme.com. ( 1 2 3 4 5 )}, q{. IN SOA dns1.acme.com. hostmaster.acme.com. ( 1 1 1 1 1 )}, q{@ IN SOA dns1.acme.com. hostmaster.acme.com. ( 1 1 1 1 1 )}, q{. IN SOA dns1.acme.com. hostmaster.acme.com. ( 1 1 1 1 1 )}, q{acme.com. IN AAAA 2001:688:0:102::1:2}, q{acme.com. IN AAAA 2001:688:0:102::3}, q{acme.com. IN RP abuse.acme.com. acme.com.}, ); } use Test::More tests => 2 * scalar @test; for my $rrdata (@test) { my $test = "\n \n" . $rrdata . "\n\n\n \n"; my $rrset = Net::DNS::ZoneFile::Fast::parse($test); (my $adata = $rrdata) =~ s/@/./; $adata =~ s/(IN SOA .* (\d+)) \)/ $2 $1/; my $rr = new Net::DNS::RR $adata; (my $rrcorrect = $rr->string) =~ s/\s+/ /g; ok(defined $rrset, "Parsing $rrdata"); (my $rrtxt = $rrset->[0]->string) =~ s/\s+/ /g; is($rrtxt, $rrcorrect, "RR comparison for $rrdata + whitespace"); } dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/lines.t0000664000237200023720000000140412544611342023103 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use Test::More tests => 4; my $ln = -1; my %h = ( quiet => 1, on_error => sub { $ln = $_[0]; }, ); my $z1 = < $z1, %h), 'Bad zone parse.'); ok($ln == 6, 'Error must be at line 6.'); ok(!defined Net::DNS::ZoneFile::Fast::parse(text => $z2, %h), 'Bad zone parse.'); ok($ln == 4, 'Error must be at line 4.'); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/null-rr.t0000664000237200023720000000114412544611342023365 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS; use Net::DNS::ZoneFile::Fast; use Test::More tests => 4; my $zone = q{ $ORIGIN choicecarecard.com. dddwww IN A 199.93.70.72 IN A 199.93.70.210 }; my $rrset = Net::DNS::ZoneFile::Fast::parse($zone); ok(defined $rrset, "Parsing of the zone file"); ok(@$rrset == 2, "Correct number of records"); ok($rrset->[0]->string eq Net::DNS::RR->new("dddwww.choicecarecard.com. 0 IN A 199.93.70.72")->string, "First dummy RR is ok"); ok($rrset->[1]->string eq Net::DNS::RR->new("dddwww.choicecarecard.com. 0 IN A 199.93.70.210")->string, "Second dummy RR is ok"); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/read.t0000664000237200023720000000155012544611342022706 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use IO::File; use Test::More tests => 3; END { unlink "./read.txt"; } my $zone = q{ ; This is a real zone, changed to protect the innocent ; $ORIGIN 10.10.10.in-addr.arpa. ; @ 30 IN SOA dns1.acme.com. hostmaster.acme.com. ( 2002040300 ; Serial Number 172800 ; Refresh 48 hours 3600 ; Retry 1 hours 1728000 ; Expire 20 days 172800 ) ; Minimum 48 hours }; ok(defined Net::DNS::ZoneFile::Fast::parse($zone), "parse of the test zone"); my $fh = new IO::File "./read.txt", "w" or die "# Failed to create test file\n"; print $fh $zone; $fh->close; $fh = new IO::File "./read.txt" or die "# Failed to open test file\n"; ok(defined Net::DNS::ZoneFile::Fast::parse(fh => $fh), 'readfh'); $fh->close; ok(defined Net::DNS::ZoneFile::Fast::parse(file => "./read.txt"), 'read'); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/comment.t0000664000237200023720000000132112544611342023431 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS::ZoneFile::Fast; use Test::More tests => 6; ok(defined Net::DNS::ZoneFile::Fast::parse(q{; just a comment}), 'Zone with just a bare comment'); ok(defined Net::DNS::ZoneFile::Fast::parse(q{;}), 'Zone with just an empty comment'); ok(defined Net::DNS::ZoneFile::Fast::parse(qq{;\n}), 'Zone with just an empty comment and a \n'); ok(defined Net::DNS::ZoneFile::Fast::parse(qq{;two\n;things\n}), 'Two comments back to back'); ok(defined Net::DNS::ZoneFile::Fast::parse(qq{; just a comment\n. IN A 127.0.0.1}), 'A comment and an RR'); ok(defined Net::DNS::ZoneFile::Fast::parse(qq{;two\n;things\n. IN A 127.0.0.1}), 'Two comments back to back and an RR'); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/rrs.t0000664000237200023720000000754212544611342022610 0ustar hardakerhardaker# This is -*- perl -*- use Net::DNS; use Net::DNS::ZoneFile::Fast; BEGIN { @test = ( q{. 300 IN A 127.0.0.1}, q{localhost. 300 IN A 127.0.0.1}, q{localhost IN A 127.0.0.1}, q{localhost A 127.0.0.1}, q{localhost. 300 A 127.0.0.1}, q{*.acme.com. 300 IN MX 10 host.acme.com.}, q{* 300 IN MX 10 host.acme.com.}, q{10.10.10.10.in-addr.arpa 300 IN PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa. 300 IN PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa. 300 PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa. IN PTR www.acme.com.}, q{10.10.10.10.in-addr.arpa PTR www.acme.com.}, q{10.10/10.10.10.in-addr.arpa. IN PTR www.acme.com.}, q{. 3600 IN NS dns1.acme.com.}, q{acme.com. 3600 IN NS dns1.acme.com.}, q{@ 3600 IN NS dns1.acme.com.}, q{acme.com. 100 IN CNAME www.acme.com.}, q{acme.com 100 IN CNAME www.acme.com.}, q{acme.com. 100 IN DNAME example.com.}, q{acme.com 100 IN DNAME example.com.}, q{text.acme.com. 100 IN TXT "This is a quite long text"}, q{text.acme.com IN TXT "This is another piece"}, q{text.acme.com TXT "This is another piece"}, q{text.acme.com. 100 IN SPF "SPF record - contents not checked for SPF validity"}, q{text.acme.com IN SPF "SPF record - contents not checked for SPF validity"}, q{text.acme.com SPF "SPF record - contents not checked for SPF validity"}, q{* 100 IN MX 10 mailhost.acme.com.}, q{* IN A 1.2.3.4}, q{* 10 IN A 1.2.3.4}, # q{* IN 10 A 1.2.3.4}, XXX newer Net::DNS does not like this syntax q{fo\157.acme.com. 10 IN A 1.2.3.4}, q{acme.com. 200 IN MX 10 mailhost.acme.com.}, q{acme.com. 200 IN MX 10 .}, q{acme.com. IN MX 10 mailhost.acme.com.}, q{acme.com. MX 10 mailhost.acme.com.}, q{acme.com 200 IN MX 10 mailhost.acme.com.}, q{acme.com IN MX 10 mailhost.acme.com.}, q{acme.com MX 10 mailhost.acme.com.}, q{acme.com. IN SOA dns1.acme.com. me.acme.com. ( 1 2 3 4 5 )}, q{. IN SOA dns1.acme.com. hostmaster.acme.com. ( 1 1 1 1 1 )}, q{@ IN SOA dns1.acme.com. hostmaster.acme.com. ( 1 1 1 1 1 )}, q{. IN SOA dns1.acme.com. hostmaster.acme.com. ( 1 1 1 1 1 )}, # included te test cpan bug 17745 q{. IN SOA dns1.acme.com. hostmaster.acme.com ( 1 1 1 1 1 )}, q{. IN SOA dns1.acme.com. hostmaster ( 1 1 1 1 1 )}, q{. IN SOA dns1.acme.com hostmaster.acme.com. ( 1 1 1 1 1 )}, q{. IN SOA dns1 hostmaster. ( 1 1 1 1 1 )}, q{. IN SOA @ hostmaster.acme.com. ( 1 1 1 1 1 )}, q{. IN SOA @ hostmaster+foo.acme.com. ( 1 1 1 1 1 )}, q{acme.com. IN AAAA 2001:688:0:102::1:2}, q{acme.com. IN AAAA 2001:688:0:102::3}, q{acme.com. IN RP abuse.acme.com. acme.com.}, q{acme.com. IN SSHFP 2 1 123456789ABCDEF67890123456789ABCDEF67890}, q{acme.com. IN HINFO SUN4/110 UNIX}, q{acme.com. IN HINFO "SUN4/110 foo" UNIX}, q{acme.com. IN HINFO "SUN4/110 foo" "UNIX bar"}, ); if ($Net::DNS::VERSION > 0.72) { push @test, q{acme.com. IN TLSA 3 0 1 1BFC4290C5798EFCC6D4A1F2D79C3C5F49ACCAC687DF42974B68A45F 05BA074F}; push @test, q{acme.com. IN TLSA 3 0 1 ( 1BFC4290C5798EFCC6D4A1F2D79C3C5F49ACCAC687DF42974B68A45F 05BA074F )}; push @test, q{acme.com. IN TLSA 3 0 1 ( 1BFC4290C5798EFCC6D4A1F2D79C3C5F49ACCAC687DF42974B68A45F 05BA074F )}; } } use Test::More tests => 2 + 2 * scalar @test; for my $rrdata (@test) { my $rrset = Net::DNS::ZoneFile::Fast::parse($rrdata); (my $adata = $rrdata) =~ s/@/./; $adata =~ s/(IN SOA .* (\d+)) \)/ $2 $1/; my $rr = new Net::DNS::RR $adata; (my $rrcorrect = $rr->string) =~ s/\s+/ /g; ok(defined $rrset, "Parsing $rrdata"); (my $rrtxt = $rrset->[0]->string) =~ s/\s+/ /g; is($rrtxt, $rrcorrect, "RR comparison for $rrdata"); } ok(!defined Net::DNS::ZoneFile::Fast::parse(text => "acme.com. in aaaa ok", quiet => 1, soft_errors => 1), "Bad AAAA"); ok(!defined eval { Net::DNS::ZoneFile::Fast::parse(text => "acme.com. in aaaa ok", quiet => 1) }, "Bad AAAA with die"); dnssec-tools-2.2/tools/modules/ZoneFile-Fast/t/rr-dnssec.t0000664000237200023720000001446212544611342023701 0ustar hardakerhardaker # This is -*- perl -*- use Net::DNS::ZoneFile::Fast; # we test multiple line and single line parsing for each record # data is pulled from the dnssec-tools.org zone BEGIN { @test = ( q{dnssec-tools.org. 86400 RRSIG SOA 5 2 86400 20060429134027 ( 20060330134027 42869 dnssec-tools.org. QZzAz5sVC5+n7vJhkXfFaN/sdjKXVpT/nv22 NJI+sDde180Sj1pDXW6mFt+Efg4uUAuyLQup jLv20EVM8/oBPA7DjNu2CZHGe8UDeuAoqIth Q/79Ltw4NtP7W1zWAs/ms/oSKiKYrAUHqt0U UskiXkCA1GKn6RNqVT4+IuSUgALLYSMLjlaA 2kE/KaffqeGnynIO2AC5BMFzUlxCSMDSxus3 bJm2xAIxMiUYomw9XfbGfrkCtfIrH+H/LVG/ X2K/kKxjcFcQhkukMUxjzzmAP3xJHq6vgwVM tpm/qaR0g5jH5B46iJefGYzwcMAyexbLOQEW uv1Xs6i/lBwQo9T7xw== )}, q{. 86400 RRSIG SOA 5 0 86400 20090913150000 ( 20090907150000 18160 . kgbUsnZwzY/s9zGcHvQ30tTNk5raweJuvo71 9GzBI+Ennjn25bGp7CYbfLk0tMk9Fcai5nfg 8hDshKwEUemign1r+SkHsiwISOr3vpTAUANg +GzQwLSrZHT81wvS06DYXE/O0L/pxSKfQBON 8owuxhnczIDncP3xeh0Stai2jeU= )}, # failing oddly during text compare. spacing is different. q{nospace.dnssec-tools.org. 86400 RRSIG SOA 5 2 86400 20060429134027 20060330134027 42869 dnssec-tools.org. QZzAz5sVC5+n7vJhkXfFaN/sdjKXVpT/nv22 NJI+sDde180Sj1pDXW6mFt+Efg4uUAuyLQup jLv20EVM8/oBPA7DjNu2CZHGe8UDeuAoqIth Q/79Ltw4NtP7W1zWAs/ms/oSKiKYrAUHqt0U UskiXkCA1GKn6RNqVT4+IuSUgALLYSMLjlaA 2kE/KaffqeGnynIO2AC5BMFzUlxCSMDSxus3 bJm2xAIxMiUYomw9XfbGfrkCtfIrH+H/LVG/ X2K/kKxjcFcQhkukMUxjzzmAP3xJHq6vgwVM tpm/qaR0g5jH5B46iJefGYzwcMAyexbLOQEW uv1Xs6i/lBwQo9T7xw= }, q{dnssec-tools.org. 10800 NSEC cvs.dnssec-tools.org. A DNSKEY MX NS NSEC RRSIG SOA TXT}, q{dnssec-tools.org. 10800 NSEC mor\145text.dnssec-tools.org. CNAME RRSIG NSEC}, q{THA2IPMDLT9RU307BO9LQ6MF5K565A6M.example.com. 10800 IN NSEC3 1 0 100 610b88f0d9f42c74 QIVB7DNNE2T5J9HLI4FRE9PN61F754CK A RRSIG}, q{THA2IPMDLT9RU307BO9LQ6MF5K565A6M.example.com. 10800 IN NSEC3 1 0 100 610b88f0d9f42c74 ( QIVB7DNNE2T5J9HLI4FRE9PN61F754CK A RRSIG )}, q{THA2IPMDLT9RU307BO9LQ6MF5K565A6M.example.com. 10800 IN NSEC3 1 0 100 610b88f0d9f42c74 QIVB7DNNE2T5J9HLI4FRE9PN61F754CK}, q{THA2IPMDLT9RU307BO9LQ6MF5K565A6M.example.com. 10800 IN NSEC3 1 0 100 610b88f0d9f42c74 ( QIVB7DNNE2T5J9HLI4FRE9PN61F754CK )}, q{example.com 0 NSEC3PARAM 1 0 100 610b88f0d9f42c74}, q{dnssec-tools.org. 86400 DNSKEY 256 3 5 ( AQOfW6Uo0QQZS1fJmtx3XoX+B67Bxfyn+uhe py5JifpPWPnx+O0bR30+Oi4bpVrXtipGK3EW ouDWy4eAflrsdIgunotWE1H4/rQaXxc4IowJ V8dm5xejyMswUzPOxL3mnbhQ0gUtSTSO7/Ho EJisuqy50/pg1y8a09PiicJefXaB31IawDXn IZz2QYluyxS2zYPnb/2RjeCxgTzGgtjUYlw5 0czRYDARyGlkAiwxch/RfgEcqoLk+dPwmSU9 l4Shu8XkkpiAFEUqs3cTooA2UltVvKFpqoMT q0EVHcdHDuIExeGCxCw/RjsiOOIey3BKo86T NCU8USUWld3FinA4BPnB ) ; key id = 42869}, q{dnssec-tools.org. 86400 DNSKEY 256 3 5 AQOfW6Uo0QQZS1fJmtx3XoX+B67Bxfyn+uhe py5JifpPWPnx+O0bR30+Oi4bpVrXtipGK3EW ouDWy4eAflrsdIgunotWE1H4/rQaXxc4IowJ V8dm5xejyMswUzPOxL3mnbhQ0gUtSTSO7/Ho EJisuqy50/pg1y8a09PiicJefXaB31IawDXn IZz2QYluyxS2zYPnb/2RjeCxgTzGgtjUYlw5 0czRYDARyGlkAiwxch/RfgEcqoLk+dPwmSU9 l4Shu8XkkpiAFEUqs3cTooA2UltVvKFpqoMT q0EVHcdHDuIExeGCxCw/RjsiOOIey3BKo86T NCU8USUWld3FinA4BPnB}, q{dnssec-tools.org. 86400 DNSKEY 256 3 5 AQOfW6Uo0QQZS1fJmtx3XoX+B67Bxfyn+uhe py5JifpPWPnx+O0bR30+Oi4bpVrXtipGK3EW ouDWy4eAflrsdIgunotWE1H4/rQaXxc4IowJ V8dm5xejyMswUzPOxL3mnbhQ0gUtSTSO7/Ho EJisuqy50/pg1y8a09PiicJefXaB31IawDXn IZz2QYluyxS2zYPnb/2RjeCxgTzGgtjUYlw5 0czRYDARyGlkAiwxch/RfgEcqoLk+dPwmSU9 l4Shu8XkkpiAFEUqs3cTooA2UltVvKFpqoMT q0EVHcdHDuIExeGCxCw/RjsiOOIey3BKo86T NCU8USUWld3FinA4BPnB}, q{dnssec-tools.org. 86400 DNSKEY 256 3 5 AQOfW6Uo0QQZS1fJmtx3XoX+B67Bxfyn+uhe py5JifpPWPnx+O0bR30+Oi4bpVrXtipGK3EW ouDWy4eAflrsdIgunotWE1H4/rQaXxc4IowJ V8dm5xejyMswUzPOxL3mnbhQ0gUtSTSO7/Ho EJisuqy50/pg1y8a09PiicJefXaB31IawDXn IZz2QYluyxS2zYPnb/2RjeCxgTzGgtjUYlw5 0czRYDARyGlkAiwxch/RfgEcqoLk+dPwmSU9 l4Shu8XkkpiAFEUqs3cTooA2UltVvKFpqoMT q0EVHcdHDuIExeGCxCw/RjsiOOIey3BKo86T NCU8USUWld3FinA4BPnB;bogus extra comment}, q{test.dnssec-tools.org. 86400 IN DS 28827 5 1 23a4c97124ab46e7fb7abb58e36887ff78745ac8}, q{test.dnssec-tools.org. 86400 IN DS 28827 5 2 7d06a161755f7c7ca0d15b8039c7d7b45fb8e5dd025fcebe209cb07756bbae07}, q{test.dnssec-tools.org. 86400 IN DS 28827 5 2 ( 7d06a161755f7c7ca0d15b8039c7d7b45fb8e5dd025fcebe209cb07756bbae07 ) }, q{test.dnssec-tools.org. 86400 DS 28827 5 1 23a4c97124ab46e7fb7abb58e36887ff78745ac8}, # a specific test for ttl values that could accidentially match DS q{test.dnssec-tools.org. DS 28827 5 2 7d06a161755f7c7ca0d15b8039c7d7b45fb8e5dd025fcebe209cb07756bbae07}, # bind 10 puts parens in new places: q{example.com 10 RRSIG SOA 5 2 10 20080613221109 ( 20080514221109 51389 example.com. rQ1d9a6ZCbZvwx47efKJL2s1FbcHzLt4SKca F2Xwr8YyPyhMffjkdFwtXGLFwvaQ9SE2ocEU /QpxKmvsqSyE3SyinuuCaR/XF/7XKK/PShUg iRJ7S/GExtJDfheJ04zydDyIYM8M96GpE920 0LfJVZuo+gxwvrvTZiejVn1aNnc= )}, q{example.com 10 RRSIG SOA 5 2 10 ( 20080613221109 20080514221109 51389 example.com. rQ1d9a6ZCbZvwx47efKJL2s1FbcHzLt4SKca F2Xwr8YyPyhMffjkdFwtXGLFwvaQ9SE2ocEU /QpxKmvsqSyE3SyinuuCaR/XF/7XKK/PShUg iRJ7S/GExtJDfheJ04zydDyIYM8M96GpE920 0LfJVZuo+gxwvrvTZiejVn1aNnc= )}, ); } use Test::More tests => 2 * scalar @test; for my $rrdata (@test) { my $rrset = Net::DNS::ZoneFile::Fast::parse($rrdata); (my $adata = $rrdata) =~ s/@/./; $adata =~ s/(IN SOA .* (\d+)) \)/ $2 $1/; my $rr = new Net::DNS::RR $adata; (my $rrcorrect = $rr->string) =~ s/\s+/ /g; ok(defined $rrset, "Parsing $rrdata"); (my $rrtxt = $rrset->[0]->string) =~ s/\s+/ /g; if ($rrtxt =~ /^nospace/) { $rrtxt =~ s/\s//g; $rrcorrect =~ s/\s//g; } is($rrtxt, $rrcorrect, "RR comparison for $rrdata"); } dnssec-tools-2.2/tools/modules/ZoneFile-Fast/MANIFEST0000664000237200023720000000044312544611342022474 0ustar hardakerhardakerChanges MANIFEST Makefile.PL README Fast.pm t/00-load.t t/comment.t t/generate.t t/lines.t t/newlines.t t/null-rr.t t/origin.t t/read.t t/rr-multi-a.t t/rrs-ws.t t/rrs.t t/soattl.t t/ttl.t t/zone.t t/rr-dnssec.t META.yml Module meta-data (added by MakeMaker) dnssec-tools-2.2/tools/modules/ZoneFile-Fast/Fast.pm0000664000237200023720000014226312544611342022605 0ustar hardakerhardaker# ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42) # wrote this file. As long as you retain this notice you # can do whatever you want with this stuff. If we meet some day, and you think # this stuff is worth it, you can buy me a beer in return. Anton Berezin # ---------------------------------------------------------------------------- # Copyright (c) 2005-2013 SPARTA, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # * Neither the name of SPARTA, Inc nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS # IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ---------------------------------------------------------------------------- # Copyright (c) 2013-2013 PARSONS, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # * Neither the name of SPARTA, Inc nor the names of its contributors may # be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS # IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # $Id$ # package Net::DNS::ZoneFile::Fast; # documentation at the __END__ of the file use strict; use 5.005; use vars qw($VERSION); use IO::File; use Net::DNS; use Net::DNS::RR; use MIME::Base64; $VERSION = '1.24'; my $MAXIMUM_TTL = 0x7fffffff; my $pat_ttl = qr{\d+[\dwdhms]*}i; my $pat_skip = qr{\s*(?:;.*)?}; my $pat_name = qr{(?:[-\*\w\$\d\/*]|\\[0-2]\d\d)+(?:\.(?:[-\*\w\$\d\/]|\\[0-2]\d\d)+)*}; my $pat_maybefullnameorroot = qr{(?:\.|(?:[-\w\$\d\/*]|\\[0-2]\d\d)+(?:\.(?:[-\w\$\d\/]|\\[0-2]\d\d)+)*\.?)}; # # Added the ability to have a backslash in the SOA username. This is to # provide for the RFC-allowed "Joe\.Jones.example.com" construct to allow # dots in usernames. Keeping the original version here for easy reference. # # my $pat_maybefullname = qr{[-\w\$\d\/*]+(?:\.[-\w\$\d\/]+)*\.?}; my $pat_maybefullname = qr{(?:[-\+\w\$\d\/*\\]|\\[0-2]\d\d)+(?:\.(?:[-\+\w\$\d\/]|\\[0-2]\d\d)+)*\.?}; my $debug; my $domain; my $parse; my $ln; my $default_ttl; my $minimum; my $origin; my $ttl; my @zone; my $soa; my $rrsig; my $sshfp; my $key; my $dnskey; my $ds; my $nsec3; my $tlsa; my $on_error; my $quiet; my $soft_errors; my $fh; my @fhs; my @lns; my $includes_root; my $globalerror; my $nsec3capable; # boot strap optional DNSSEC module functions # (not optional if trying to parse a signed zone, but we don't need # these modules unless we are. $nsec3capable = eval { require Net::DNS::RR::NSEC; require Net::DNS::RR::DNSKEY; require Net::DNS::RR::NSEC3; require Net::DNS::RR::NSEC3PARAM; require MIME::Base32; }; sub parse { my %param; my $text; $on_error = undef; $parse = \&parse_line; $ln = 0; $domain = "."; $default_ttl = -1; $minimum = -1; @zone = (); if (@_ == 1) { $text = shift; } else { %param = @_; if (defined $param{text}) { $text = $param{text}; } elsif (defined $param{fh}) { $fh = $param{fh}; } elsif (defined $param{file}) { $fh = IO::File->new($param{file}, "r"); error("cannot open $param{file}: $!") unless defined $fh; } else { error("want zone text, or file, or fh"); } } $debug = $param{debug}; $quiet = $param{quiet}; $origin = $param{origin}; $origin = "." unless defined $origin; $origin = ".$origin" unless $origin =~ /^\./; $origin = "$origin." unless $origin =~ /\.$/; $on_error = $param{on_error} || undef; $param{soft_errors} = 1 if $on_error && !exists $param{soft_errors}; $quiet = 1 if $on_error && !exists $param{quiet}; $soft_errors = $param{soft_errors}; $includes_root = $param{includes_root}; eval { if ($fh) { do { while ($_ = readline($fh)) { $ln++; $parse->(); } $fh = shift @fhs; $ln = shift @lns; } while ($fh); } else { my @text = split "\n", $text; for (@text) { $ln++; $parse->(); } } }; if ($@) { die "$globalerror (at input line #$ln)" if ($globalerror); return undef if $param{soft_errors}; die; } my @r; $minimum = 0 if $minimum < 0; for my $z (@zone) { $z->{ttl} = $minimum if $z->{ttl} <= 0; chop $z->{name}; my $line = $z->{Line}; my $lines = $z->{Lines} || 1; delete $z->{Line}; delete $z->{Lines}; if ($param{tolower}) { $z->{name} = lc $z->{name}; $z->{cname} = lc $z->{cname} if defined $z->{cname}; $z->{dname} = lc $z->{dname} if defined $z->{dname}; $z->{exchange} = lc $z->{exchange} if defined $z->{exchange}; $z->{mname} = lc $z->{mname} if defined $z->{mname}; $z->{rname} = lc $z->{rname} if defined $z->{rname}; $z->{nsdname} = lc $z->{nsdname} if defined $z->{nsdname}; $z->{ptrdname} = lc $z->{ptrdname} if defined $z->{ptrdname}; $z->{target} = lc $z->{target} if defined $z->{target}; $z->{mbox} = lc $z->{mbox} if defined $z->{mbox}; $z->{txtdname} = lc $z->{txtdname} if defined $z->{txtdname}; } elsif ($param{toupper}) { $z->{name} = uc $z->{name}; $z->{cname} = uc $z->{cname} if defined $z->{cname}; $z->{dname} = uc $z->{dname} if defined $z->{dname}; $z->{exchange} = uc $z->{exchange} if defined $z->{exchange}; $z->{mname} = uc $z->{mname} if defined $z->{mname}; $z->{rname} = uc $z->{rname} if defined $z->{rname}; $z->{nsdname} = uc $z->{nsdname} if defined $z->{nsdname}; $z->{ptrdname} = uc $z->{ptrdname} if defined $z->{ptrdname}; $z->{target} = uc $z->{target} if defined $z->{target}; $z->{mbox} = uc $z->{mbox} if defined $z->{mbox}; $z->{txtdname} = uc $z->{txtdname} if defined $z->{txtdname}; } my $newrec = Net::DNS::RR->new(%$z); if ($newrec->{'type'} eq 'DNSKEY') { if (ref($newrec) ne 'Net::DNS::RR::DNSKEY') { warn "Failed to define a DNSSEC object (got: " . ref($newrec) . "); you're probably missing either MIME::Base64 or MIME::Base32"; } else { $newrec->setkeytag; } } # no longer an issue with recent Net::DNS #if ($newrec->{'type'} eq 'RRSIG') { # fix an issue with RRSIG's signame being stripped of # the trailing dot. # $newrec->{'signame'} .= "." # if ($newrec->{'signame'} !~ /\.$/); #} push @r, $newrec; $r[-1]->{Line} = $line; $r[-1]->{Lines} = $lines; } return \@r; } sub error { if ($on_error) { eval { $on_error->($ln, @_) }; if($@ ne '') { # set global error so parse can die appropriately later. $globalerror = $@; die; } } else { warn "@_, line $ln\n" if $soft_errors && !$quiet; } die "@_, line $ln\n"; } sub parse_line { if (/^\$include[ \t]+/ig) { if (!/\G[\"\']*([^\s\'\"]+)[\"\']*/igc) { error("no include file specified $_"); return; } my $fn = $1; if (! -f $fn) { # expand file according to includes_root if ($includes_root && -f $includes_root . '/'. $fn) { $fn = $includes_root . '/'. $fn; } else { error("could not find file $fn"); return; } } unshift @fhs, $fh; unshift @lns, $ln; $fh = IO::File->new($fn, "r"); $ln = 0; error("cannot open include file $fn: $!") unless defined $fh; return; } elsif (/^\$origin[ \t]+/ig) { if (/\G($pat_maybefullname)$pat_skip$/gc) { my $name = $1; $name = "$name$origin" unless $name =~ /\.$/; $origin = $name; $origin = ".$origin" unless $origin =~ /^\./; return; } elsif (/\G\.$pat_skip$/gc) { $origin = "."; return; } else { error("bad \$ORIGIN"); } } elsif (/^\$generate[ \t]+/ig) { if (/\G(\d+)\s*-\s*(\d+)\s+(.*)$/) { my $from = $1; my $to = $2; my $pat = $3; error("bad range in \$GENERATE") if $from > $to; error("\$GENERATE pattern without a wildcard") if $pat !~ /\$/; while ($from <= $to) { $_ = $pat; s{\$ (?:\{ ([\d+-]+) (?:, (\d+) (?:, ([doxX]) )? )? \})?} { my ($offset, $width, $base) = ($1, $2, $3); $offset ||= 0; $width ||= 0; $base ||= 'd'; sprintf "%0$width$base", $offset + $from; }xge; $parse->(); $from++; } return; } else { error("bad \$GENERATE"); } } elsif (/^\$ttl\b/ig) { if (/\G\s+($pat_ttl)$pat_skip$/) { my $v = $1; $ttl = $default_ttl = ttl_fromtext($v); if ($default_ttl < 0 || $default_ttl > $MAXIMUM_TTL) { error("bad TTL value `$v'"); } else { debug("\$TTL < $default_ttl\n") if $debug; } } else { error("wrong \$TTL"); } return; } elsif (/^$pat_skip$/g) { # skip return; } elsif (/^[ \t]+/g) { # fall through } elsif (/^\.[ \t]+/g) { $domain = "."; } elsif (/^\@[ \t]+/g) { $domain = $origin; $domain =~ s/^.// unless $domain eq "."; } elsif (/^$/g) { # skip return; } elsif (/^($pat_name\.)[ \t]+/g) { $domain = $1; } elsif (/^($pat_name)[ \t]+/g) { $domain = "$1$origin"; } else { error("syntax error"); } if (/\G($pat_ttl)[ \t]+/gc) { my $v = $1; $ttl = ttl_fromtext($v); if ($ttl == 0) { $ttl = $default_ttl; } else { if ($ttl < 0 || $ttl > $MAXIMUM_TTL) { error("bad TTL value `$v'"); } } } else { $ttl = $default_ttl; } if (/\G(in)[ \t]+/igc) { # skip; we only support IN class } if (/\G(a)[ \t]+/igc) { if (/\G(\d+)\.(\d+)\.(\d+)\.(\d+)$pat_skip$/ && $1 < 256 && $2 < 256 && $3 < 256 && $4 < 256) { push @zone, { Line => $ln, name => $domain, type => "A", ttl => $ttl, class => "IN", address => "$1.$2.$3.$4", }; } else { error("bad IP address"); } } elsif (/\G(ptr)[ \t]+/igc) { if (/\G($pat_maybefullname)$pat_skip$/gc) { my $name = $1; $name = "$name$origin" unless $name =~ /\.$/; chop $name; push @zone, { Line => $ln, name => $domain, type => "PTR", ttl => $ttl, class => "IN", ptrdname => $name, }; } elsif (/\G\@$pat_skip$/gc) { my $name = $origin; $name =~ s/^.// unless $name eq "."; chop $name; push @zone, { Line => $ln, name => $domain, type => "PTR", ttl => $ttl, class => "IN", ptrdname => $name, }; } else { error("bad name in PTR"); } } elsif (/\G(afsdb)[ \t]+/igc) { my $subtype; if (/\G(\d+)[ \t]+/gc) { $subtype = $1; } else { error("bad subtype in AFSDB"); } if (/\G($pat_maybefullname)$pat_skip$/gc) { my $name = $1; $name = "$name$origin" unless $name =~ /\.$/; chop $name; push @zone, { Line => $ln, name => $domain, type => "AFSDB", ttl => $ttl, class => "IN", subtype => $subtype, hostname => $name, }; } } elsif (/\G(cname)[ \t]+/igc) { if (/\G($pat_maybefullname)$pat_skip$/gc) { my $name = $1; $name = "$name$origin" unless $name =~ /\.$/; chop $name; push @zone, { Line => $ln, name => $domain, type => "CNAME", ttl => $ttl, class => "IN", cname => $name, }; } elsif (/\G\@$pat_skip$/gc) { my $name = $origin; $name =~ s/^.// unless $name eq "."; chop $name; push @zone, { Line => $ln, name => $domain, type => "CNAME", ttl => $ttl, class => "IN", cname => $name, }; } else { error("bad cname in CNAME"); } } elsif (/\G(dname)[ \t]+/igc) { if (/\G($pat_maybefullname)$pat_skip$/gc) { my $name = $1; $name = "$name$origin" unless $name =~ /\.$/; chop $name; push @zone, { Line => $ln, name => $domain, type => "DNAME", ttl => $ttl, class => "IN", dname => $name, }; } elsif (/\G\@$pat_skip$/gc) { my $name = $origin; $name =~ s/^.// unless $name eq "."; chop $name; push @zone, { Line => $ln, name => $domain, type => "DNAME", ttl => $ttl, class => "IN", dname => $name, }; } else { error("bad dname in DNAME"); } } elsif (/\G(mx)[ \t]+/igc) { my $prio; if (/\G(\d+)[ \t]+/gc) { $prio = $1; } else { error("bad priority in MX"); } if (/\G($pat_maybefullnameorroot)$pat_skip$/gc) { my $name = $1; $name = "$name$origin" unless $name =~ /\.$/; chop $name; push @zone, { Line => $ln, name => $domain, type => "MX", ttl => $ttl, class => "IN", preference => $prio, exchange => $name, }; } elsif (/\G\@$pat_skip$/gc) { my $name = $origin; $name =~ s/^.// unless $name eq "."; chop $name; push @zone, { Line => $ln, name => $domain, type => "MX", ttl => $ttl, class => "IN", preference => $prio, exchange => $name, }; } else { error("bad exchange in MX"); } } elsif (/\G(aaaa)[ \t]+/igc) { if (/\G([\da-fA-F:.]+)$pat_skip$/) { # parsing stolen from Net::DNS::RR::AAAA my $string = $1; if ($string =~ /^(.*):(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { my ($front, $a, $b, $c, $d) = ($1, $2, $3, $4, $5); $string = $front . sprintf(":%x:%x", ($a << 8 | $b), ($c << 8 | $d)); } my @addr; if ($string =~ /^(.*)::(.*)$/) { my ($front, $back) = ($1, $2); my @front = split(/:/, $front); my @back = split(/:/, $back); my $fill = 8 - (@front ? $#front + 1 : 0) - (@back ? $#back + 1 : 0); my @middle = (0) x $fill; @addr = (@front, @middle, @back); } else { @addr = split(/:/, $string); if (@addr < 8) { @addr = ((0) x (8 - @addr), @addr); } } push @zone, { Line => $ln, name => $domain, type => "AAAA", ttl => $ttl, class => "IN", address => sprintf("%x:%x:%x:%x:%x:%x:%x:%x", map { hex $_ } @addr), }; } else { error("bad IPv6 address"); } } elsif (/\G(ns)[ \t]+/igc) { if (/\G($pat_maybefullname)$pat_skip$/gc) { my $name = $1; $name = "$name$origin" unless $name =~ /\.$/; chop $name; push @zone, { Line => $ln, name => $domain, type => "NS", ttl => $ttl, class => "IN", nsdname => lc($name), }; } elsif (/\G\@$pat_skip$/gc) { my $name = $origin; $name =~ s/^.// unless $name eq "."; chop $name; push @zone, { Line => $ln, name => $domain, type => "NS", ttl => $ttl, class => "IN", nsdname => lc($name), }; } else { error("bad name in NS"); } } elsif (/\G(soa)\b/igc) { $parse = \&parse_soa_name; $soa = { Line => $ln, name => $domain, type => "SOA", ttl => $ttl, class => "IN", breakable => 0, nextkey => "mname", }; $parse->(); return; } elsif (/\G(txt|spf)[ \t]+/igc) { my $type = uc($1); if (/\G('[^']+')$pat_skip$/gc) { push @zone, { Line => $ln, name => $domain, type => $type, ttl => $ttl, class => "IN", txtdata => $1, }; } elsif (/\G("[^"]+")$pat_skip$/gc) { push @zone, { Line => $ln, name => $domain, type => $type, ttl => $ttl, class => "IN", txtdata => $1, }; } elsif (/\G(["']?.*?["']?)$pat_skip$/gc) { push @zone, { Line => $ln, name => $domain, type => $type, ttl => $ttl, class => "IN", txtdata => $1, }; } else { error("bad txtdata in $type"); } } elsif (/\G(type[0-9]+)[ \t]+/igc) { my $type = $1; if (/\G\\#\s+(\d+)\s+\(\s(.*)$/gc) { # multi-line $sshfp = { Line => $ln, name => $domain, type => uc $type, ttl => $ttl, class => "IN", fptype => $1, fingerprint => $2, }; $parse = \&parse_sshfp; } elsif (/\G\\#\s+(\d+)\s+(.*)$pat_skip$/gc) { push @zone, { Line => $ln, name => $domain, type => uc $type, ttl => $ttl, class => "IN", fptype => $1, fingerprint => $2, }; } else { error("bad data in in $type"); } } elsif (/\G(sshfp)[ \t]+/igc) { if (/\G(\d+)\s+(\d+)\s+\(\s*$/gc) { # multi-line $sshfp = { Line => $ln, name => $domain, type => "SSHFP", ttl => $ttl, class => "IN", algorithm => $1, fptype => $2, }; $parse = \&parse_sshfp; } elsif (/\G(\d+)\s+(\d+)\s+([a-zA-Z0-9]+)$pat_skip$/gc) { push @zone, { Line => $ln, name => $domain, type => "SSHFP", ttl => $ttl, class => "IN", algorithm => $1, fptype => $2, fingerprint => $3, }; } else { error("bad data in in SSHFP"); } } elsif (/\G(loc)[ \t]+/igc) { # parsing stolen from Net::DNS::RR::LOC if (/\G (\d+) \s+ # deg lat ((\d+) \s+)? # min lat (([\d.]+) \s+)? # sec lat (N|S) \s+ # hem lat (\d+) \s+ # deg lon ((\d+) \s+)? # min lon (([\d.]+) \s+)? # sec lon (E|W) \s+ # hem lon (-?[\d.]+) m? # altitude (\s+ ([\d.]+) m?)? # size (\s+ ([\d.]+) m?)? # horiz precision (\s+ ([\d.]+) m?)? # vert precision $pat_skip $/ixgc) { # Defaults (from RFC 1876, Section 3). my $default_min = 0; my $default_sec = 0; my $default_size = 1; my $default_horiz_pre = 10_000; my $default_vert_pre = 10; # Reference altitude in centimeters (see RFC 1876). my $reference_alt = 100_000 * 100; my $version = 0; my ($latdeg, $latmin, $latsec, $lathem) = ($1, $3, $5, $6); my ($londeg, $lonmin, $lonsec, $lonhem) = ($7, $9, $11, $12); my ($alt, $size, $horiz_pre, $vert_pre) = ($13, $15, $17, $19); $latmin = $default_min unless $latmin; $latsec = $default_sec unless $latsec; $lathem = uc($lathem); $lonmin = $default_min unless $lonmin; $lonsec = $default_sec unless $lonsec; $lonhem = uc($lonhem); $size = $default_size unless $size; $horiz_pre = $default_horiz_pre unless $horiz_pre; $vert_pre = $default_vert_pre unless $vert_pre; push @zone, { Line => $ln, name => $domain, type => "LOC", ttl => $ttl, class => "IN", version => $version, size => $size * 100, horiz_pre => $horiz_pre * 100, vert_pre => $vert_pre * 100, latitude => dms2latlon($latdeg, $latmin, $latsec, $lathem), longitude => dms2latlon($londeg, $lonmin, $lonsec, $lonhem), altitude => $alt * 100 + $reference_alt, }; } else { error("bad LOC data"); } } elsif (/\G(hinfo)[ \t]+/igc) { if (/\G(["'].*?["']|\S+)\s+(["'].*?["']|\S+)$pat_skip$/gc) { my $result = { Line => $ln, name => $domain, type => "HINFO", ttl => $ttl, class => "IN", cpu => $1, os => $2, }; $result->{'cpu'} =~ s/^["']//; $result->{'cpu'} =~ s/["']$//; $result->{'os'} =~ s/^["']//; $result->{'os'} =~ s/["']$//; push @zone, $result; } else { error("bad HINFO data"); } } elsif (/\G(srv)[ \t]+/igc) { # parsing stolen from Net::DNS::RR::SRV if (/\G(\d+)\s+(\d+)\s+(\d+)\s+(\S+)$pat_skip$/gc) { push @zone, { Line => $ln, name => $domain, type => "SRV", ttl => $ttl, class => "IN", priority => $1, weight => $2, port => $3, target => $4, }; $zone[-1]->{target} =~ s/\.+$//; } else { error("bad SRV data"); } } elsif (/\G(key)[ \t]+/igc) { if (!/\G(\d+)\s+(\d+)\s+(\d+)\s+/gc) { error("bad KEY data 1"); } $dnskey = { first => 1, Line => $ln, name => $domain, ttl => $ttl, class => "IN", type => "KEY", flags => $1, protocol => $2, algorithm => $3 }; if (/\G\(\s*$/gc) { # multi-line $parse = \&parse_dnskey; } elsif (/\G(.*\S)\s*$/) { # single-line $dnskey->{'key'} .= $1; $dnskey->{'key'} =~ s/\s//g; $dnskey->{'keybin'} = decode_base64($dnskey->{'key'}); push @zone, $dnskey; $dnskey = undef; } else { error("bad KEY data 2"); } } elsif (/\G(rrsig)[ \t]+/igc) { if (/\G(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+/gc) { # some versions of bind (>=10) put the sig-expir on the first line $rrsig = { first => 1, Line => $ln, name => $domain, type => "RRSIG", class => "IN", ttl => $ttl, typecovered => $1, algorithm => $2, labels => $3, orgttl => $4, }; } else { error("bad RRSIG data 1"); } if (/\G(\d+)\s+/gc) { # some versions of bind (<10) put the sig-expir on the first line # and newer ones put it on the next. $rrsig->{'sigexpiration'} = $1; } else { $rrsig->{'needsigexp'} = $1; } if (/\G\(\s*$/gc) { # multi-line $parse = \&parse_rrsig; } elsif (/\G(\d+)\s+(\d+)\s+($pat_maybefullnameorroot)\s+([^=]+=)\s*/gc) { # single-line $rrsig->{'siginception'} = $1; $rrsig->{'keytag'} = $2; $rrsig->{'signame'} = $3; $rrsig->{'sig'} = $4; $rrsig->{'sigbin'} = decode_base64($rrsig->{'sig'}); push @zone, $rrsig; $rrsig = undef; } else { error("bad RRSIG data 2"); } } elsif (/\G(dnskey)[ \t]+/igc) { if (!/\G(\d+)\s+(\d+)\s+(\d+)\s+/gc) { error("bad DNSKEY data 1"); } $dnskey = { first => 1, Line => $ln, name => $domain, ttl => $ttl, class => "IN", type => "DNSKEY", flags => $1, protocol => $2, algorithm => $3 }; if (/\G\(\s*$/gc) { # multi-line $parse = \&parse_dnskey; } elsif (/\G([\sA-Za-z0-9\+\/=]+).*$/) { # single-line $dnskey->{'key'} .= $1; $dnskey->{'key'} =~ s/\s//g; $dnskey->{'keybin'} = decode_base64($dnskey->{'key'}); push @zone, $dnskey; $dnskey = undef; } else { error("bad DNSKEY data 2"); } } elsif (/\G(ds)[ \t]+/igc) { if (!/\G(\d+)\s+(\d+)\s+(\d+)\s+/gc) { error("bad DS data 1"); } $ds = { Line => $ln, name => $domain, class => "IN", ttl => $ttl, type => "DS", keytag => $1, algorithm => $2, digtype => $3, }; if (/\G\(\s*$/gc) { # multi-line $parse = \&parse_ds; } elsif (/\G(.*\S)\s*$/) { # single line $ds->{'digest'} .= $1; $ds->{'digest'} = lc($ds->{'digest'}); $ds->{'digest'} =~ s/\s//g; # remove any surrounding single line ()s $ds->{'digest'} =~ s/^\(//; $ds->{'digest'} =~ s/\)$//; $ds->{'digestbin'} = pack("H*", $ds->{'digest'}); push @zone, $ds; $ds = undef; } else { error("bad DS data"); } } elsif (/\G(tlsa)[ \t]+/igc) { if (!/\G(\d+)\s+(\d+)\s+(\d+)\s+/gc) { error("bad TLSA data 1"); } $tlsa = { Line => $ln, name => $domain, class => "IN", ttl => $ttl, type => "TLSA", usage => $1, selector => $2, matchingtype => $3, }; if (/\G\(\s*$/gc) { # multi-line $parse = \&parse_tlsa; } elsif (/\G(.*\S)\s*$/) { # single line $tlsa->{'cert'} .= $1; $tlsa->{'cert'} = lc($tlsa->{'cert'}); $tlsa->{'cert'} =~ s/\s//g; # remove any surrounding single line ()s $tlsa->{'cert'} =~ s/^\(//; $tlsa->{'cert'} =~ s/\)$//; $tlsa->{'certbin'} = pack("H*", $tlsa->{'cert'}); push @zone, $tlsa; $tlsa = undef; } else { error("bad TLSA data"); } } elsif (/\G(nsec)[ \t]+/igc) { if (/\G\s*($pat_maybefullnameorroot)\s+(.*?)$pat_skip$/gc) { # XXX: set the typebm field ourselves? my ($nxtdname, $typelist) = ($1, $2); $typelist = join(" ",sort split(/\s+/,$typelist)); push @zone, { Line => $ln, name => $domain, class => "IN", ttl => $ttl, type => "NSEC", nxtdname => $nxtdname, typelist => $typelist, typebm => Net::DNS::RR::NSEC::_typearray2typebm(split(/\s+/,$typelist)), }; } else { error("bad NSEC data"); } } elsif (/\G(nsec3)[ \t]+/igc) { error ("You are missing required modules for NSEC3 support") if (!$nsec3capable); if (/\G\s*(\d+)\s+(\d+)\s+(\d+)\s+([-0-9A-Fa-f]+)\s+($pat_maybefullname)\s*(.*?)$pat_skip$/gc) { # XXX: set the typebm field ourselves? my ($alg, $flags, $iters, $salt, $nxthash, $typelist) = ($1, $2, $3, $4, $5, $6); $typelist = join(" ",sort split(/\s+/,$typelist)); my $binhash = MIME::Base32::decode(uc($nxthash)); push @zone, { Line => $ln, name => $domain, class => "IN", ttl => $ttl, type => "NSEC3", hashalgo => $alg, flags => $flags, iterations => $iters, hnxtname => $nxthash, hnxtnamebin => $binhash, hashlength => length($binhash), salt => $salt, saltbin => pack("H*",$salt), saltlength => int(length($salt)/2), typelist => $typelist, typebm => Net::DNS::RR::NSEC::_typearray2typebm(split(/\s+/,$typelist)), }; # multi-line } elsif (/\G\s*(\d+)\s+(\d+)\s+(\d+)\s+([-0-9A-Fa-f]+)\s+\(/gc) { # XXX: set the typebm field ourselves? my ($alg, $flags, $iters, $salt) = ($1, $2, $3, $4); $nsec3 = { Line => $ln, name => $domain, class => "IN", ttl => $ttl, type => "NSEC3", hashalgo => $alg, flags => $flags, iterations => $iters, salt => $salt, saltbin => pack("H*",$salt), saltlength => int(length($salt)/2), }; $parse = \&parse_nsec3; } else { error("bad NSEC data"); } } elsif (/\G(nsec3param)[ \t]+/igc) { if (/\G\s*(\d+)\s+(\d+)\s+(\d+)\s+([-0-9A-Fa-f]+)$pat_skip$/gc) { # XXX: set the typebm field ourselves? my ($alg, $flags, $iters, $salt) = ($1, $2, $3, $4); push @zone, { Line => $ln, name => $domain, class => "IN", ttl => $ttl, type => "NSEC3PARAM", hashalgo => $alg, flags => $flags, iterations => $iters, salt => $salt, saltbin => pack("H*",$salt), saltlength => int(length($salt)/2), }; } else { error("bad NSEC data"); } } elsif (/\G(rp)[ \t]+/igc) { my $mbox; if (/\G($pat_maybefullname)[ \t]+/gc) { $mbox = $1; $mbox = "$mbox$origin" unless $mbox =~ /\.$/; chop $mbox; } elsif (/\G\@[ \t]+/gc) { $mbox = $origin; $mbox =~ s/^.// unless $mbox eq "."; chop $mbox; } else { error("bad mbox in PTR"); } my $txtdname; if (/\G($pat_maybefullname)$pat_skip$/gc) { $txtdname = $1; $txtdname = "$txtdname$origin" unless $txtdname =~ /\.$/; chop $txtdname; } elsif (/\G\@$pat_skip$/gc) { $txtdname = $origin; $txtdname =~ s/^.// unless $txtdname eq "."; chop $txtdname; } else { error("bad txtdname in PTR"); } push @zone, { Line => $ln, name => $domain, type => "RP", ttl => $ttl, class => "IN", mbox => $mbox, txtdname => $txtdname, }; } elsif (/\G(naptr)[ \t]+/igc) { # Parsing taken from Net::DNS::RR::NAPTR if (!/\G(\d+) \s+ (\d+) \s+ ['"] (.*?) ['"] \s+ ['"] (.*?) ['"] \s+ ['"] (.*?) ['"] \s+ (\S+)$/xgc) { error("bad NAPTR data"); } push @zone, { Line => $ln, name => $domain, class => "IN", ttl => $ttl, type => "NAPTR", order => $1, preference => $2, flags => $3, service => $4, regexp => $5, replacement => $6, }; $zone[ $#zone ]{replacement} =~ s/\.+$//; } elsif (/\Gany\s+tsig.*$/igc) { # XXX ignore tsigs } else { error("unrecognized type for $domain\n$_\n"); } } # Reference lat/lon (see RFC 1876). my $reference_latlon = 2**31; # Conversions to/from thousandths of a degree. my $conv_sec = 1000; my $conv_min = 60 * $conv_sec; my $conv_deg = 60 * $conv_min; sub dms2latlon { my ($deg, $min, $sec, $hem) = @_; my ($retval); $retval = ($deg * $conv_deg) + ($min * $conv_min) + ($sec * $conv_sec); $retval = -$retval if ($hem eq "S") || ($hem eq "W"); $retval += $reference_latlon; return $retval; } sub parse_soa_name { error("parse_soa_name: internal error, no \$soa") unless $soa; if ($soa->{breakable}) { if (/\G[ \t]*($pat_maybefullname)$pat_skip$/igc) { $soa->{$soa->{nextkey}} = $1; } elsif (/\G$pat_skip$/gc) { return; } elsif (/\G[ \t]*(\@)[ \t]/igc) { $soa->{$soa->{nextkey}} = $origin; } elsif (/\G[ \t]*($pat_name\.)[ \t]/igc) { $soa->{$soa->{nextkey}} = $1; } else { error("expected valid $soa->{nextkey}"); } } else { if (/\G[ \t]*($pat_maybefullname)/igc) { $soa->{$soa->{nextkey}} = $1; } elsif (/\G[ \t]*\($pat_skip$/igc) { $soa->{breakable} = 1; return; } elsif (/\G[ \t]*(\@)[ \t]/igc) { $soa->{$soa->{nextkey}} = $origin; } elsif (/\G[ \t]*\(/igc) { $soa->{breakable} = 1; $parse->(); return; } else { error("expected valid $soa->{nextkey}"); } } if ($soa->{nextkey} eq "mname") { $soa->{mname} = lc($soa->{mname}); $soa->{nextkey} = "rname"; } elsif ($soa->{nextkey} eq "rname") { $soa->{rname} = lc($soa->{rname}); $soa->{nextkey} = "serial"; $parse = \&parse_soa_number; } else { error("parse_soa_name: internal error, bad {nextkey}") unless $soa; } $parse->(); } sub ttl_or_serial { my ($v) = @_; if ($soa->{nextkey} eq "serial") { error("bad serial number") unless $v =~ /^\d+$/; } else { $v = ttl_fromtext($v); error("bad $soa->{nextkey}") unless $v; } return $v; } sub parse_rrsig { # got more data if ($rrsig->{'first'}) { delete $rrsig->{'first'}; if (exists($rrsig->{'needsigexp'}) && /\G\s*(\d+)\s+(\d+)\s+(\d+)\s+($pat_maybefullnameorroot)/gc) { delete $rrsig->{'needsigexp'}; $rrsig->{'sigexpiration'} = $1; $rrsig->{'siginception'} = $2; $rrsig->{'keytag'} = $3; $rrsig->{'signame'} = $4; } elsif (!exists($rrsig->{'needsigexp'}) && /\G\s*(\d+)\s+(\d+)\s+($pat_maybefullnameorroot)/gc) { $rrsig->{'siginception'} = $1; $rrsig->{'keytag'} = $2; $rrsig->{'signame'} = $3; } else { error("bad rrsig second line"); } } else { if (/\)\s*$/) { if (/\G\s*(\S+)\s*\)\s*$/gc) { $rrsig->{'sig'} .= $1; $rrsig->{'sigbin'} = decode_base64($rrsig->{'sig'}); # we're done $parse = \&parse_line; push @zone, $rrsig; $rrsig = undef; } else { error("bad rrsig last line"); } } else { if (/\G\s*(\S+)\s*$/gc) { $rrsig->{'sig'} .= $1; } else { error("bad rrsig remaining lines"); } } } } sub parse_sshfp { # got more data if (/\)\s*$/) { # last line if (/\G\s*(\S+)\s*\)\s*$/gc) { $sshfp->{'fingerprint'} .= $1; # we're done $parse = \&parse_line; push @zone, $sshfp; $sshfp = undef; } else { error("bad sshfp last line"); } } else { if (/\G\s*(\S+)\s*$/gc) { $sshfp->{'fingerprint'} .= $1; } else { error("bad sshfp remaining lines"); } } } sub parse_dnskey { # got more data? if (/\)\s*;.*$/) { if (/\G\s*(\S*)\s*\)\s*;.*$/gc) { $dnskey->{'key'} .= $1; # we're done $parse = \&parse_line; $dnskey->{'keybin'} = decode_base64($dnskey->{'key'}); push @zone, $dnskey; $dnskey = undef; } else { error("bad dnskey last line"); } } else { if (/\G\s*(\S+)\s*$/gc) { $dnskey->{'key'} .= $1; } else { error("bad dnskey remaining lines"); } } } sub parse_ds { # got more data if (/\)\s*$/) { if (/\G\s*(\S*)\s*\)\s*$/gc) { $ds->{'digest'} .= $1; $ds->{'digest'} = lc($ds->{'digest'}); # we're done $parse = \&parse_line; $ds->{'digestbin'} = pack("H*",$ds->{'digest'}); push @zone, $ds; $ds = undef; } else { error("bad ds last line"); } } else { if (/\G\s*(\S+)\s*$/gc) { $ds->{'digest'} .= $1; } else { error("bad ds remaining lines"); } } } sub parse_tlsa { # got more data if (/\)\s*$/) { while (/\G\s*([0-9A-Za-z]+)\s*/gc) { $tlsa->{'cert'} .= $1; } if (/\G\s*\)$/gc) { $tlsa->{'cert'} = lc($tlsa->{'cert'}); # we're done $parse = \&parse_line; $tlsa->{'certbin'} = pack("H*",$tlsa->{'cert'}); push @zone, $tlsa; $tlsa = undef; } else { error("bad tlsa last line: $_"); } } else { if (/\G\s*(\S+)\s*$/gc) { $tlsa->{'cert'} .= $1; } else { error("bad tlsa remaining lines"); } } } sub parse_nsec3 { #got more data if ( /\G\s*([A-Z0-9]{32})\s*(\))?/gc) { my $nxthash = $1; my $binhash = MIME::Base32::decode(uc($nxthash)); $nsec3->{ 'hnxtname' } = $nxthash; $nsec3->{ 'hnxtnamebin' } = $binhash; $nsec3->{ 'hashlength' } = length( $binhash ); if ( defined($2) && $2 eq ')' ) { # Was RR terminated ? push @zone, $nsec3; # we're done $parse = \&parse_line; $nsec3 = undef; } } elsif ( /\G\s+$/gc ) { # Empty line } elsif ( /\G\s*((\w+\s+)*)\)\s*$/) { my $typelist = $1; $typelist = join(" ",sort split(/\s+/,$typelist)); $nsec3->{ 'typelist' } = $typelist; $nsec3->{ 'typebm' } = Net::DNS::RR::NSEC::_typearray2typebm(split(/\s+/,$typelist)); push @zone, $nsec3; # we're done $parse = \&parse_line; $nsec3 = undef; } else { error( "bad NSEC3 continuation lines ($_)" ); } } sub parse_soa_number { error("parse_soa_number: internal error, no \$soa") unless $soa; if ($soa->{breakable}) { if (/\G[ \t]*($pat_ttl)$pat_skip$/igc) { $soa->{$soa->{nextkey}} = ttl_or_serial($1); } elsif (/\G$pat_skip$/gc) { return; } elsif (/\G[ \t]*($pat_ttl)\b/igc) { $soa->{$soa->{nextkey}} = ttl_or_serial($1); } else { error("expected valid $soa->{nextkey}"); } } else { if (/\G[ \t]+($pat_ttl)/igc) { $soa->{$soa->{nextkey}} = ttl_or_serial($1); } elsif (/\G[ \t]*\($pat_skip$/igc) { $soa->{breakable} = 1; return; } elsif (/\G[ \t]*\(/igc) { $soa->{breakable} = 1; $parse->(); return; } else { error("expected valid $soa->{nextkey}"); } } if ($soa->{nextkey} eq "serial") { $soa->{nextkey} = "refresh"; } elsif ($soa->{nextkey} eq "refresh") { $soa->{nextkey} = "retry"; } elsif ($soa->{nextkey} eq "retry") { $soa->{nextkey} = "expire"; } elsif ($soa->{nextkey} eq "expire") { $soa->{nextkey} = "minimum"; } elsif ($soa->{nextkey} eq "minimum") { $minimum = $soa->{minimum}; $default_ttl = $minimum if $default_ttl <= 0; $parse = $soa->{breakable} ? \&parse_close : \&parse_line; if (!$soa->{breakable} && !/\G$pat_skip$/gc) { error("unexpected trailing garbage after Minimum"); } delete $soa->{nextkey}; delete $soa->{breakable}; $soa->{mname} .= $origin unless ($soa->{mname} =~ /\.$/); $soa->{rname} .= $origin unless ($soa->{rname} =~ /\.$/); $soa->{mname} =~ s/\.$//; $soa->{rname} =~ s/\.$//; $soa->{Lines} = $ln - $soa->{Line} + 1; push @zone, $soa; $soa = undef; return if $parse == \&parse_line; } else { error("parse_soa_number: internal error, bad {nextkey}") unless $soa; } $parse->(); } sub parse_close { if (/\G[ \t]*\)$pat_skip$/igc) { $zone[-1]->{Lines} = $ln - $zone[-1]->{Line} + 1; $parse = \&parse_line; return; } elsif (/\G$pat_skip$/gc) { return; } else { error("expected closing block \")\""); } } sub debug { print STDERR @_; } sub ttl_fromtext # zero == invalid value { my ($t) = @_; my $ttl = 0; if ($t =~ /^\d+$/) { $ttl = $t; } elsif ($t =~ /^(?:\d+[WDHMS])+$/i) { my %ttl; $ttl{W} ||= 0; $ttl{D} ||= 0; $ttl{H} ||= 0; $ttl{M} ||= 0; $ttl{S} ||= 0; while ($t =~ /(\d+)([WDHMS])/gi) { $ttl{uc($2)} += $1; } $ttl = $ttl{S} + 60*($ttl{M} + 60*($ttl{H} + 24*($ttl{D} + 7*$ttl{W}))); } return $ttl; } 1; __END__ =head1 NAME Net::DNS::ZoneFile::Fast -- parse BIND8/9 zone files =head1 SYNOPSIS use Net::DNS::ZoneFile::Fast; my $rr = Net::DNS::ZoneFile::Fast::parse($zone_text); =head1 DESCRIPTION The Net::DNS::ZoneFile::Fast module provides an ability to parse zone files that BIND8 and BIND9 use, fast. Currently it provides a single function, I, which returns a reference to an array of traditional I objects, so that no new API has to be learned in order to manipulate zone records. Great care was taken to ensure that I does its job as fast as possible, so it is interesting to use this module to parse huge zones. As an example datapoint, it takes less than 5 seconds to parse a 2.2 MB zone with about 72000 records on an Athlon XP 2600+ box. On the other hand, it is likely that I objects that I returns are going to be further processed. To make it easier to link any record back to the zone file (say, to report a logical error like infamous `CNAME and other data' back to the user, or to do a zone file modification), I inserts line numbering information into I objects. The module currently understands: =over 4 =item B<$GENERATE> directive =item B<$ORIGIN> directive =item B<$TTL> directive =item B<$INCLUDE> directive (only while processing files or filehandles) =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =item B records =back =head2 Non-standard third-party modules I. =head2 Exports None. =head2 Subroutines =over 4 =item I Parses zone data and returns a reference to an array of I objects if successful. Takes the following named (no pun intended) parameters: =over 4 =item B A semi-mandatory parameter, textual contents of the zone to be parsed. =item B A semi-mandatory parameter, a file handle from which zone contents can be read for parsing. =item B A semi-mandatory parameter, a file name with the zone to parse. =item B An optional parameter specifying zone origin. The default is ".". A trailing "." is appended if necessary. =item B An optional parameter, user-defined error handler. If specified, it must be a subroutine reference, which will be called on any error. This subroutine will be passed two parameters: a line number in the zone, where the error occurred, and the error description. =item B By default, I throws an exception on any error. Set this optional parameter to a true value to avoid this. The default is false, unless B is also specified, in which case it is true. =item B An optional parameter. By default, any $INCLUDE directives encountered will be tested for existence and readability. If the base path of the included filename is not your current working directory, this test will fail. Set the B to the same as your named.conf file to avoid this failure. =item B An optional parameter. By default, on any error, the error description is printed via warn(). Set B to a true value if you don't want this. The default is false, unless B is also specified, in which case it is true. =item B An optional parameter. If set to true, will produce some debug printing. You probably don't want to use that. =back One of B, B, B must be specified. If more than one is specified at the same time, B takes precedence over B, which takes precedence over B. As a special case, if I is called with a single, unnamed parameter, it is assumed to be a zone text. If I is unsuccessful, and does not throw an exception (because either B or B was specified), I returns undef. The returned I are normal in every respect, except that each of them has two extra keys, Line and Lines, which correspondingly are the line number in the zone text where the record starts, and the number of lines the record spans. This information can be accessed either via hash lookup (C<$rr-E{Line}>), or via an accessor method (C<$rr-ELine>). =back =head1 BUGS The I subroutine is not re-entrant, and it probably will never be. There is also no guarantee that I will successfully parse every zone parsable by BIND, and no guarantee that BIND will parse every zone parsable by I. That said, I appears to do the right thing on around 50000 real life zones I tested it with. SOA serial numbers with a decimal point are not supported (they're not a legal zonefile contstruct, although bind8 supported them. Even bind is dropping support for them in future releases). =head1 COPYRIGHT AND LICENSE Copyright 2003 by Anton Berezin and catpipe Systems ApS "THE BEER-WARE LICENSE" (Revision 42) wrote this module. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Anton Berezin Copyright (c) 2004-2011 SPARTA, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of SPARTA, Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (c) 2013-2013 PARSONS, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of SPARTA, Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =head1 CREDITS Anton Berezin created the versions up until 0.5. Wes Hardaker at Sparta implemented the DNSSEC patches and took over maintenance of the module from 0.6 onward. Anton's original CREDITS section: This module was largely inspired by the I module by Luis E. Munoz. Many thanks to Phil Regnauld and Luis E. Munoz for discussions. =head1 SEE ALSO http://www.dnssec-tools.org/, Net::DNS(3), Net::DNS::RR(3), Net::DNS::SEC(3) =cut dnssec-tools-2.2/tools/modules/ZoneFile-Fast/META.yml0000664000237200023720000000070412544611342022614 0ustar hardakerhardaker# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Net-DNS-ZoneFile-Fast version: 0.7 version_from: Fast.pm installdirs: site requires: IO::File: 0 MIME::Base64: 0 Net::DNS: 0 Net::DNS::SEC: 0 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.17 dnssec-tools-2.2/tools/modules/ZoneFile-Fast/.cvsignore0000664000237200023720000000003112544611342023334 0ustar hardakerhardakerMakefile blib pm_to_blib dnssec-tools-2.2/tools/modules/ZoneFile-Fast/Changes0000664000237200023720000000261312544611342022637 0ustar hardakerhardakerRevision history for Perl extension Net::DNS::ZoneFile::Fast. 1.11 Wed Apr 29 2009 - Patch from Chris Adams to allow for negative offsets in $GENERATE 1.1 Tue Jan 27 2009 - Expanded SSHFP formatting support - NSEC3 and NSEC3PARAM support - fix issues with recent changes in Net::DNS 1.01 Tue Oct 7 2008 - Many many fixes, improvements, and even releases since the last Changes listing here. whoops. 0.6.1 Sat Apr 8 21:19:21 PDT 2006 - bug fix to match current Net::DNS::SEC APIs we shouldn't be using. 0.6 Mon Nov 14 16:35:00 PST 2005 - added support for DNSSEC records (RRSIG, DNSKEY, DS, NSEC, RRSIG) - added support for AFSDB records - added support for parsing included files (commonly used in DNSSEC) 0.5 Thu Apr 15 23:17:56 CEST 2004 - add support for RP "Responsible Person" records 0.4 Fri Mar 26 11:06:21 CET 2004 - add dependency from Net::DNS 0.3 Wed Mar 24 20:01:18 CET 2004 - rename the module from Net::DNS::Zone to Net::DNS::ZoneFile::Fast (after consulting with Net::DNS::ZoneFile's author) - fix a small bug with TXT records parsing 0.2 Mon Nov 17 14:21:33 CET 2003 - rename the module from Net::DNS::ZoneParse to Net::DNS::Zone - add documentation - add soft_errors parameter and fix die/fatal/warn/quiet logic - small fixes 0.01 Mon Oct 13 20:38:04 CET 2003 - original version dnssec-tools-2.2/tools/modules/ZoneFile-Fast/dist/0000775000237200023720000000000012544611342022305 5ustar hardakerhardakerdnssec-tools-2.2/tools/modules/ZoneFile-Fast/dist/makerelease.xml0000664000237200023720000000322112544611342025303 0ustar hardakerhardaker If the Net::DNS::ZoneFile::Fast module needs updating this will let you do it... Previous version: grep VERSION Fast.pm Fast.pm svn diff Fast.pm svn commit -m "Update Fast.pm Version Number: {FASTVERSION}" Fast.pm perl Makefile.PL make test make dist cpan-upload -mailto wjhns117@hardakers.net -user hardaker -verbose Net-DNS-ZoneFile-Fast-{FASTVERSION}.tar.gz dnssec-tools-2.2/tools/modules/ZoneFile-Fast/README0000664000237200023720000000271612544611342022230 0ustar hardakerhardakerUsage: use Net::DNS::ZoneFile::Fast; my $rr = Net::DNS::ZoneFile::Fast::parse($zone_text); Description: The Net::DNS::ZoneFile::Fast module provides an ability to parse zone files that BIND8 and BIND9 use, fast. Currently it provides a single function, parse(), which returns a reference to an array of traditional Net::DNS::RR objects, so that no new API has to be learned in order to manipulate zone records. Great care was taken to ensure that parse() does its job as fast as possible, so it is interesting to use this module to parse huge zones. As an example datapoint, it takes less than 5 seconds to parse a 2.2 MB zone with about 72000 records on an Athlon XP 2600+ box. On the other hand, it is likely that Net::DNS::RR objects that parse() returns are going to be further processed. To make it easier to link any record back to the zone file (say, to report a logical error like infamous `CNAME and other data' back to the user, or to do a zone file modification), parse() inserts line numbering information into Net::DNS::RR objects. Important Note about DNSSEC: If you try to load a ZoneFile with DNSSEC records in it *and* you haven't installed all the other necessary perl modules require to support the Net::DNS::SEC module set, you will get bad results. And, worse they'll be cryptic. A common problem is failing to install the MIME::Base32 and MIME::Base64 perl modules in addition to the Net::DNS::SEC modules. dnssec-tools-2.2/tools/modules/ZoneFile-Fast/Makefile.PL0000664000237200023720000000136012544611342023314 0ustar hardakerhardakeruse ExtUtils::MakeMaker; WriteMakefile( NAME => 'Net::DNS::ZoneFile::Fast', VERSION_FROM => 'Fast.pm', # Net::DNS{,::SEC} keeps changing internals by adding and removing # dots in certain fields, etc... That means we need to require # certain versions explicitly. PREREQ_PM => { 'Net::DNS' => 0.65, 'Net::DNS::SEC' => 0.15, 'MIME::Base64' => 0, 'IO::File' => 0, }, META_MERGE => { 'meta-spec' => { version => 2 }, resources => { repository => { type => 'svn', url => 'https://dnssec-tools.org/svn/dnssec-tools/', web => 'https://dnssec-tools.org/svn/dnssec-tools/', }, }, }, ); dnssec-tools-2.2/tools/modules/realm.pod0000664000237200023720000001120412544611342020536 0ustar hardakerhardaker# # Copyright 2012-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # Realm file format. # 1; ############################################################################# =pod =head1 NAME B - Realm-related data used by DNSSEC-Tools programs. =head1 DESCRIPTION The DNSSEC-Tools B command manages a group of distinct rollover environments running on a single host. These distinct rollover environments are called I. B uses a I file to properly create and manage each of its realms. A I file is organized in sets of I records. Each I record describes the execution environment of a single rollover instance. A I consists of a set of keyword/value entries. The DNSSEC-Tools B module manipulates the contents of a I file. Module interfaces exist for looking up I records, creating new records, and modifying existing records. Comment lines and blank lines are ignored by the DNSSEC-Tools programs. Comment lines start with either a '#' character or a ';' character. A I's name may consist of alphabetic characters, numbers, and several special characters. The special characters are the minus sign, the plus sign, the underscore, the comma, the period, the colon, the forward-slash, the space, and the tab. This name is an identifier. The values in a I's entries may consist of alphabetic characters, numbers, and several special characters. The special characters are the minus sign, the plus sign, the underscore, the comma, the period, the colon, the forward-slash, the space, and the tab. =head1 REALM FIELDS The fields in a I record are: * administrator This is the email address for the realm's administrative user. * args The user-specified arguments for the rollover manager. This is not a required field. * configdir This field contains the name of the directory in which B will find the realm's configuration information. This directory must contain a subdirectory named B, and the realm's configuration file will be stored there. This is a required field. * display This boolean field indicates whether or not the realm should be displayed by the B program. This is an optional field. * hoard This field contains the pathname to a collection of files used to build a realm. This field is B used by the B program. * manager This field contains the name of the rollover manager program for the realm. If this is not defined, then B will be used. * realmdir This field contains the name of the directory in which B will execute the realm's rollover manager. This is a required field. * rollrec The realm's B file. This file will be used by the rollover manager to control the rollover environment. * state This field contains the realm's state. It must be either "active" or "inactive". * statedir This field contains the name of the directory in which B and other DNSSEC-Tools programs will find the realm's state information. If this is not specified, the B directory will be used. * user This field contains the name of the user that the realm will be executed as. This is an optional field. I.> =head1 EXAMPLES The following are examples of Is: realm "example" state "active" configdir "/realms/configs/example" statedir "/realms/states/example" realmdir "/realms/realms/example" rollrec "demo-example.rollrec" administrator "zonefolks@example.com" display "1" manager "rollerd" args "-sleep 600 -loglevel phase -logfile log.example" user "zonemgr" realm "testing" state "inactive" configdir "/realms/configs/testing" realmdir "/realms/realms/testing" rollrec "demo-testing.rollrec" display "1" manager "rollerd-tester" args "-sleep 60 -loglevel tmi -logfile log.testing" =head1 COPYRIGHT Copyright 2012-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B, B, B, B, B, B B, B B =cut dnssec-tools-2.2/tools/modules/defaults.pm0000664000237200023720000003713012544611342021105 0ustar hardakerhardaker# # Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # DNSSEC-Tools default values. # # This module maintains a set of default values used by DNSSEC-Tools # programs. This allows these defaults to be centralized in a single # place and prevents them from being spread around multiple programs. # package Net::DNS::SEC::Tools::defaults; require Exporter; use strict; use Net::DNS::SEC::Tools::conf; our @ISA = qw(Exporter); our @EXPORT = qw( dnssec_tools_alldefaults dnssec_tools_default dnssec_tools_defnames ); our $VERSION = "2.1"; our $MODULE_VERSION = "2.1.0"; my $installdir = getprefixdir() . "/bin"; # DNSSEC-Tools installation directory. my %defaults = ( 'admin-email' => "root", # Admin's email address. 'archivedir' => getprefixdir() . "/var/key-archive", 'algorithm' => "rsasha1", # Encryption algorithm. 'autosign' => 1, # Auto-sign zone files flag. 'enddate' => "+2764800", # Zone life, in seconds. 'entropy_msg' => 1, # Display entropy message flag. 'keygen' => getprefixdir() . "/sbin/dnssec-keygen", 'keygen-opts' => "", # Options for key generator. 'kskcount' => 1, # Number of KSK keys. 'ksklength' => 2048, # Length of KSK key. 'ksklife' => 31536000, # Lifespan of KSK key. 'revperiod' => 3888000, # Revocation period. 'lifespan-max' => 94608000, # Max lifespan (two years.) 'lifespan-min' => 3600, # Min lifespan (one hour.) 'prog-ksk1' => 'default', # Program for KSK phase 1. 'prog-ksk2' => 'default', # Program for KSK phase 2. 'prog-ksk3' => 'default', # Program for KSK phase 3. 'prog-ksk4' => 'default', # Program for KSK phase 4. 'prog-ksk5' => 'default', # Program for KSK phase 5. 'prog-ksk6' => 'default', # Program for KSK phase 6. 'prog-ksk7' => 'default', # Program for KSK phase 7. 'prog-normal' => 'default', # Program for non-rollover. 'prog-zsk1' => 'default', # Program for ZSK phase 1. 'prog-zsk2' => 'default', # Program for ZSK phase 2. 'prog-zsk3' => 'default', # Program for ZSK phase 3. 'prog-zsk4' => 'default', # Program for ZSK phase 4. 'random' => "/dev/urandom", # Random no. generator device. 'rndc' => getprefixdir() . "/sbin/rndc", 'rndc-opts' => '', # Options for rndc. 'roll_loadzone' => 1, # Zone-reloading flag. 'roll_logfile' => makelocalstatedir() . "/log.rollerd", 'roll_loglevel' => "phase", # Rollerd's logging level. 'roll_phasemsg' => "long", # Rollerd's phase logmsg length. 'roll_sleeptime' => 3600, # Rollerd's sleep time. 'log_tz' => "gmt", # Log message timezone. 'savekeys' => 1, # Save/delete old keys flag. 'mailer-server' => "localhost", # Mail server. 'mailer-type' => "smtp", # Mail type. 'tacontact' => "", 'tatmpdir' => "/tmp/dnssec-tools/trustman", 'tadnsvalconffile' => getconfdir() . "/dnsval.conf", 'tanamedconffile' => getconfdir() . "/named/named.conf", 'tasleeptime' => 3600, 'tasmtpserver' => "localhost", # Trustman's SMTP server. 'taresolvconf' => "/etc/resolv.conf", # resolv.conf file. 'usegui' => 0, # Use GUI for option entry flag. 'zone_errors' => 5, 'zonecheck' => getprefixdir() . "/sbin/named-checkzone", 'zonecheck-opts' => "-i local", # Options for zone checker. 'zonefile-parser' => 'Net::DNS::ZoneFile', 'zonesign' => getprefixdir() . "/sbin/dnssec-signzone", 'zonesign-opts' => "", # Options for zone signer. 'zskcount' => 1, # Number of Current ZSK keys. 'zsklength' => 1024, # Length of ZSK key. 'zsklife' => 7884000, # Lifespan of ZSK key. 'usensec3' => "no", # Use NSEC3 by default 'nsec3iter' => 100, # default NSEC3 iterations 'nsec3salt' => "random:64", # default NSEC3 salt 'nsec3optout' => "no", # NSEC3 opt-out default 'blinkenlights' => "$installdir/blinkenlights", 'cleanarch' => "$installdir/cleanarch", 'cleankrf' => "$installdir/cleankrf", 'dtconf' => "$installdir/dtconf", 'dtconfchk' => "$installdir/dtconfchk", 'dtdefs' => "$installdir/dtdefs", 'dtinitconf' => "$installdir/dtinitconf", 'dtrealms' => "$installdir/dtrealms", 'expchk' => "$installdir/expchk", 'fixkrf' => "$installdir/fixkrf", 'genkrf' => "$installdir/genkrf", 'getdnskeys' => "$installdir/getdnskeys", 'grandvizier' => "$installdir/grandvizier", 'keyarch' => "$installdir/keyarch", 'krfcheck' => "$installdir/krfcheck", 'lsdnssec' => "$installdir/lsdnssec", 'lskrf' => "$installdir/lskrf", 'lsrealm' => "$installdir/lsrealm", 'lsroll' => "$installdir/lsroll", 'realmchk' => "$installdir/realmchk", 'realmctl' => "$installdir/realmctl", 'realminit' => "$installdir/realminit", 'rollchk' => "$installdir/rollchk", 'rollctl' => "$installdir/rollctl", 'rollerd' => "$installdir/rollerd", 'rollinit' => "$installdir/rollinit", 'rolllog' => "$installdir/rolllog", 'rollrec-editor' => "$installdir/rollrec-editor", 'rollset' => "$installdir/rollset", 'signset-editor' => "$installdir/signset-editor", 'tachk' => "$installdir/tachk", 'timetrans' => "$installdir/timetrans", 'trustman' => "$installdir/trustman", 'zonesigner' => "$installdir/zonesigner", ); #-------------------------------------------------------------------------- # # Routine: dnssec_tools_alldefaults() # # Purpose: Return a copy of the DNSSEC-Tools defaults. # sub dnssec_tools_alldefaults { my %defcopy; # Copy of default hash. %defcopy = %defaults; return(%defcopy); } #-------------------------------------------------------------------------- # # Routine: dnssec_tools_default() # # Purpose: Look up a DNSSEC-Tools default and return its value. # sub dnssec_tools_default { my $defvar = shift; # Default field to be returned. my $defval; # Default field's value. $defval = $defaults{$defvar}; return($defval); } #-------------------------------------------------------------------------- # # Routine: dnssec_tools_defnames() # # Purpose: Return the names of the default values. # sub dnssec_tools_defnames { my @defnames = sort(keys(%defaults)); return(@defnames); } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::defaults - DNSSEC-Tools default values. =head1 SYNOPSIS use Net::DNS::SEC::Tools::defaults; %defs = dnssec_tools_alldefaults(); $defalg = dnssec_tools_default("algorithm"); $cz_path = dnssec_tools_default("zonecheck"); $ksklife = dnssec_tools_default("ksklife"); @default_names = dnssec_tools_defnames(); =head1 DESCRIPTION This module maintains a set of default values used by DNSSEC-Tools programs. This allows these defaults to be centralized in a single place and prevents them from being spread around multiple programs. =head1 INTERFACES =over 4 =item I This interface returns a copy of all the DNSSEC-Tools defaults in a hash table. =item I This interface returns the value of a DNSSEC-Tools default. The interface is passed I, which is the name of a default to look up. The value of this default is returned to the caller. =item I This interface returns the names of all the DNSSEC-Tools defaults. No default values are returned, but the default names returned by I may then be passed to I. =back =head1 DEFAULT FIELDS The following are the defaults defined for DNSSEC-Tools. =over 4 =item B This default holds the default email address for the DNSSEC-Tools administrator. =item B This default holds the default directory in which keys will be archived. =item B This default holds the default encryption algorithm. =item B This default holds the default zone life, in seconds. =item B This default indicates whether or not I should display an entropy message. =item B This default holds the path to the key-generation program. =item B This default hold a set of options for the key-generation program. =item B This default holds the default number of KSK keys to generate for a zone. =item B This default holds the default length of a KSK key. =item B This default holds the default lifespan of a KSK key. This is only used for determining when to rollover the KSK key. Keys otherwise have no concept of a lifespan. This is measured in seconds. =item B This default is the maximum lifespan of a key. =item B This default is the minimum lifespan of a key. =item B This default is the timezone to be used in log-message timestamps. =item B The mail server that will be contacted by I. This is passed to I. =item B The type of mailer that will be contacted by I. This is passed to I (by way of I.) Any values recognized by I may be used here. =item B ... B These defaults hold the default phase commands to be executed by B for each phase of KSK rollover. The I keyword indicates that the normal phase processing should be performed. Multiple commands may be given, but they must be separated by bangs. The I keyword may be combined with other commands. =item B These defaults hold the default phase commands to be executed by B when a zone is not in a rollover state. The I keyword indicates that the normal phase processing should be performed. Multiple commands may be given, but they must be separated by bangs. The I keyword may be combined with other commands. =item B ... B These defaults hold the default phase commands to be executed by B for each phase of ZSK rollover. The I keyword indicates that the normal phase processing should be performed. Multiple commands may be given, but they must be separated by bangs. The I keyword may be combined with other commands. =item B This default holds the default random number generator device. =item B This default holds the default revocation period of a KSK key. This is the minimum period of time a revoked KSK is required to remain in the signing set so that it is properly observed by resolvers. This is measured in seconds. =item B This default is the default path of the BIND B program. =item B This default is flag indicates if B should have the DNS daemon reload its zones. =item B This default is the path to B's log file. =item B This default is the default logging level for B. =item B This default holds the default sleep time used by the B rollover daemon. =item B This default indicates whether or not keys should be deleted when they are no longer in use. =item B This is merely a placeholder for the contact information. There is no useful default value for this. =item B This default specifies the path of the B configuration file. =item B This default specifies the path of the B configuration file. =item B This default specifies the path to the DNS B file. =item B This default holds the default value for how long the daemon should sleep. =item B This default specifies the name of the SMTP server. =item B This default specifies the location of B's temporary directory. =item B This default indicates whether or not the DNSSEC-Tools GUI should be used for option entry. =item B This default holds the maximum number of consecutive errors a particular zone may have before it is changed to be a I zone. =item B This default holds the path to the zone-verification program. =item B This default hold a set of options for the zone-verification program. This default is set to "-i local". This value has been found to greatly improve the amount of time it takes B to run. =item B This default specifies the parser that will be used to parse zone files. The default value is to use the B module. =item B This default holds the path to the zone-signing program. =item B This default hold a set of options for the zone-signing program. =item B This default holds the default number of ZSK keys to generate for a zone. =item B This default holds the default length of the ZSK key. =item B This default holds the default lifespan of the ZSK key. This is only used for determining when to rollover the ZSK key. Keys otherwise have no concept of a lifespan. This is measured in seconds. =back =head1 DNSSEC-TOOLS PROGRAM FIELDS The following are the defaults holding the paths to the DNSSEC-Tools programs. =over 4 =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =item B This default holds the path to the DNSSEC-Tools B program. =back =head1 COPYRIGHT Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =cut dnssec-tools-2.2/tools/modules/rolllog.pm0000664000237200023720000003705612544611342020757 0ustar hardakerhardaker# # Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # rolllog.pm - Rollover logging functions. # # The routines in this module provide a logging mechanism. # package Net::DNS::SEC::Tools::rolllog; require Exporter; use strict; use Fcntl ':flock'; use Socket; use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::defaults; our $VERSION = "2.1"; our $MODULE_VERSION = "2.1.0"; our @ISA = qw(Exporter); our @EXPORT = qw( rolllog_log rolllog_file rolllog_validlevel rolllog_level rolllog_levels rolllog_num rolllog_gettz rolllog_settz rolllog_str LOG_NEVER LOG_TMI LOG_EXPIRE LOG_INFO LOG_PHASE LOG_ERR LOG_FATAL LOG_ALWAYS LOG_DEFAULT ); ############################################################################## # # Log levels. The first and last aren't selectable by a user. # my $LOG_NEVER = 0; # Do not log this message. my $LOG_TMI = 1; # Overly verbose informational message. my $LOG_EXPIRE = 3; # Time-to-expiration given. my $LOG_INFO = 4; # Informational message. my $LOG_PHASE = 6; # Give current state of zone. my $LOG_ERR = 8; # Non-fatal error message. my $LOG_FATAL = 9; # Fatal error. my $LOG_ALWAYS = 10; # Messages that should always be given. my $LOG_MIN = $LOG_NEVER; # Minimum log level. my $LOG_MAX = $LOG_ALWAYS; # Maximum log level. my $DEFAULT_LOGLEVEL = $LOG_INFO; # Default log level. sub LOG_NEVER { return($LOG_NEVER); }; sub LOG_TMI { return($LOG_TMI); }; sub LOG_EXPIRE { return($LOG_EXPIRE); }; sub LOG_INFO { return($LOG_INFO); }; sub LOG_PHASE { return($LOG_PHASE); }; sub LOG_ERR { return($LOG_ERR); }; sub LOG_FATAL { return($LOG_FATAL); }; sub LOG_ALWAYS { return($LOG_ALWAYS); }; sub LOG_DEFAULT { return($DEFAULT_LOGLEVEL); }; my $loglevel = $DEFAULT_LOGLEVEL; # Rollerd's logging level. my @logstrs = # Valid strings for levels. ( "never", "tmi", undef, "expire", "info", undef, "phase", undef, "err", "fatal", "always" ); my $logfile; # rollerd's log file. my $DEFAULT_LOGTZ = 'gmt'; # Default timezone. my $usetz = $DEFAULT_LOGTZ; # Timezone selector to use. ############################################################################## # # Routine: rolllog_validlevel() # # Purpose: Check if the given logging level is valid. A boolean is # returned indicating if it is. # sub rolllog_validlevel { my $level = shift; # Logging level to check. my $ret; # Return code. # # Do the Right Thing, depending on if the level is numeric or textual. # if($level =~ /^[\d]+$/) { $ret = rolllog_num($level); return(0) if($ret == -1); } else { $ret = rolllog_str($level); return(0) if(!defined($ret)); } # # We're here, so *everything* is okay. # return(1); } ############################################################################## # # Routine: rolllog_level() # # Purpose: Get/set the logging level. If no arguments are given, then # the current logging level is returned. If a valid new level # is given, that will become the new level. # # If a problem occurs (invalid log level), then -1 will be # returned, unless a non-zero argument was passed for the # second argument. In this case, a usage message is given and # the process exits. # sub rolllog_level { my $newlevel = shift; # New logging level. my $useflag = shift; # Usage-on-error flag. my $oldlevel = $loglevel; # Current logging level. my $err = 0; # Error flag. # # Return the current log level if that's all they want. # return($loglevel) if(!defined($newlevel)); # # Translate the logging level to its numeric form. # $loglevel = rolllog_num($newlevel); # # If there was a problem, give usage messages and exit. # if($loglevel == -1) { if(!$useflag) { $loglevel = $oldlevel; return(-1); } err("unknown logging level \"$newlevel\"\n" . "valid logging levels (text and numeric forms):\n" . "\ttmi 1\n" . "\texpire 3\n" . "\tinfo 4\n" . "\tphase 6\n" . "\terr 8\n" . "\tfatal 9\n",-1); return(-1); } # # Return the old logging level. # return($oldlevel); } ############################################################################## # # Routine: rolllog_levels() # # Purpose: Return the text forms of the valid log levels. The levels # are returned in order, from most verbose to least. # sub rolllog_levels { my @levels = (); # Valid log levels. # # Create an array holding only the user-settable logging levels. # for(my $ind = ($LOG_NEVER+1); $ind < $LOG_ALWAYS; $ind++) { next if($logstrs[$ind] eq ''); push @levels, $logstrs[$ind]; } return(@levels); } ############################################################################## # # Routine: rolllog_gettz() # # Purpose: Return the timezone function used for timestamps in log # messages. 'local' and 'gmt' are the acceptable values. # sub rolllog_gettz { # # If the logging timezone hasn't been set yet, we'll set it to # the default value # if($usetz eq '') { $usetz = $DEFAULT_LOGTZ; } return($usetz); } ############################################################################## # # Routine: rolllog_settz() # # Purpose: Set the timezone selector to use for timestamps in log # messages. 'local' and 'gmt' are the acceptable values. # sub rolllog_settz { my $newtz = shift; # New timezone. my $oldtz = $usetz; # Old timezone. # # Ensure a valid timezone selector was given. If no selector # was given, then we'll use the default. # if($newtz ne '') { return('') if(($newtz !~ /^gmt$/i) && ($newtz !~ /^local$/i)); } else { $newtz = dnssec_tools_default('log_tz'); } # # Set the timezone selector and return the old selector. # $usetz = lc $newtz; return($oldtz); } ############################################################################## # # Routine: rolllog_str() # # Purpose: Return the text form of the specified log level. # undef is returned for bad levels. # sub rolllog_str { my $level = shift; # New logging level. # # Ensure a level was given. # return(undef) if(!defined($level)); # # If log level isn't a numeric, we'll ensure that it's a valid # level string. # if($level =~ /[a-zA-Z]/) { my $lclev; # Lowercase level. # # Convert the logging level to lowercase (for efficiency.) # $lclev = lc($level); foreach my $lstr (@logstrs) { return($lstr) if(lc($lstr) eq lc($lclev)); } return(undef); } # # Check for out-of-bounds levels and return the text string. # return(undef) if(($level < $LOG_NEVER) || ($level > $LOG_ALWAYS)); return($logstrs[$level]); } ############################################################################## # # Routine: rolllog_num() # # Purpose: Translate a logging level to its numeric form. The level # is also validated along the way. # sub rolllog_num { my $newlevel = shift; # New logging level. my $llev = -1; # Level to return. # # If a non-numeric log level was given, translate it into the # appropriate numeric value. # if($newlevel !~ /^[0-9]+$/) { if($newlevel =~ /^tmi$/i) { $llev = LOG_TMI; } elsif($newlevel =~ /^expire$/i) { $llev = LOG_EXPIRE; } elsif($newlevel =~ /^info$/i) { $llev = LOG_INFO; } elsif($newlevel =~ /^phase$/i) { $llev = LOG_PHASE; } elsif($newlevel =~ /^err$/i) { $llev = LOG_ERR; } elsif($newlevel =~ /^fatal$/i) { $llev = LOG_FATAL; } } else { # # If a valid log level was given, make it the current level. # if(($newlevel >= $LOG_MIN) && ($newlevel <= $LOG_MAX) && defined($logstrs[$newlevel])) { $llev = $newlevel; } } # # Return the translated logging level. Or an error. # return($llev); } ############################################################################## # # Routine: rolllog_file() # # Purpose: Get/set the log file. If no arguments are given, then # the current log file is returned. If a valid new file # is given, that will become the new log file. # # If a problem occurs (invalid log file), then -1 will be # returned, unless a non-zero argument was passed for the # second argument. In this case, a usage message is given # and the process exits. # sub rolllog_file { my $newlogfile = shift; # Name of new logfile. my $useflag = shift; # Usage-on-error flag. my $oldlogfile = $logfile; # Current logfile. # # Return the current log file if a log file wasn't given. # return($logfile) if(!defined($newlogfile)); # # Allow "-" to represent stdout. # if($newlogfile eq "-") { $newlogfile = "/dev/stdout"; if(! -e $newlogfile) { err("logfile \"$newlogfile\" does not exist\n",-1) if($useflag); return(""); } } # # If a log file was specified, ensure it's a writable regular file. # If it isn't a regular file, ensure that it's one of the standard # process-output files. # if(-e $newlogfile) { if((! -f $newlogfile) && (($newlogfile ne "/dev/stdout") && ($newlogfile ne "/dev/tty"))) { err("logfile \"$newlogfile\" is not a regular file\n",-1) if($useflag); return(""); } if(! -w $newlogfile) { err("logfile \"$newlogfile\" is not writable\n",-1) if($useflag); return(""); } } # # Open up the log file (after closing any open logs.) # $logfile = $newlogfile; close(LOG); open(LOG,">> $logfile") || die "unable to open \"$logfile\"\n"; select(LOG); $| = 1; return($oldlogfile); } ############################################################################## # # Routine: rolllog_log() # sub rolllog_log { my $lvl = shift; # Message log level. my $fld = shift; # Message field. my $msg = shift; # Message to log. my $kronos; # Current time. my $outstr; # Output string. # # Don't give the message unless it's at or above the log level. # return if($lvl < $loglevel); # # Add an administrative field specifier if the field wasn't given. # $fld = "$fld: " if($fld ne ""); # # Get the timestamp. # if($usetz eq 'local') { $kronos = localtime(); } else { $kronos = gmtime(); } $kronos =~ s/^....//; # # Build the output string. # chomp $msg; $outstr = "$kronos: $fld$msg"; # # Write the message. # print LOG "$outstr\n"; } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::rolllog - DNSSEC-Tools rollover logging interfaces. =head1 SYNOPSIS use Net::DNS::SEC::Tools::rolllog; @levels = rolllog_levels(); $curlevel = rolllog_level(); $oldlevel = rolllog_level("info"); $oldlevel = rolllog_level(LOG_ERR,1); $curlogfile = rolllog_file(); $oldlogfile = rolllog_file("-"); $oldlogfile = rolllog_file("/var/log/roll.log",1); $loglevelstr = rolllog_str(8) $loglevelstr = rolllog_str("info") $ret = rolllog_num("info"); $bool = rolllog_validlevel($newlevel); $bool = rolllog_validlevel(8); $curtz = rolllog_gettz(); $oldtz = rolllog_settz('local'); rolllog_log(LOG_INFO,"example.com","zone is valid"); =head1 DESCRIPTION The B module provides logging interfaces for the rollover programs. The logging interfaces allow log messages to be recorded. B must be running, as it is responsible for updating the log file. Each log message is assigned a particular logging level. The valid logging levels are: text numeric meaning ---- ------- ------- tmi 1 The highest level -- all log messages are saved. expire 3 A verbose countdown of zone expiration is given. info 4 Many informational messages are recorded. phase 6 Each zone's current rollover phase is given. err 8 Errors are recorded. fatal 9 Fatal errors are saved. The levels include all numerically higher levels. For example, if the log level is set to B, then B and B messages will also be recorded. =head1 LOGGING INTERFACES =over 4 =item I This routine sets and retrieves the log file for B. The I argument specifies the new log file to be set. If I exists, it must be a regular file. The I argument is a boolean that indicates whether or not to give a descriptive message if an invalid log file is given. If I is true, the message is given and the process exits; if false, no message is given. For any error condition, an empty string is returned. =item I This routine returns the timezone selector currently in use. This value may be either 'gmt' (for Greenwich Mean Time) or 'local' (for the host's local time.) =item I This routine sets and retrieves the logging level for B. The I argument specifies the new logging level to be set. I may be given in either text or numeric form. The I argument is a boolean that indicates whether or not to give a descriptive message and exit if an invalid logging level is given. If I is true, the message is given and the process exits; if false, -1 is returned. If given with no arguments, the current logging level is returned. In fact, the current level is always returned unless an error is found. -1 is returned on error. =item I This routine returns an array holding the text forms of the user-settable logging levels. The levels are returned in order, from most verbose to least. =item I The I interface writes a message to the log file. Log messages have this format: timestamp: group: message The I argument is the message's logging level. It will only be written to the log file if the current log level is numerically equal to or less than I. I allows messages to be associated together. It is currently used by B to group messages by the zone to which the message applies. The I argument is the log message itself. Trailing newlines are removed. =item I This routine translates a text log level (given in I) into the associated numeric log level. The numeric log level is returned to the caller. If I is an invalid log level, -1 is returned. =item I This routine sets the timezone to be used for timestamps in messages written to the log. This I value may be either 'gmt' (Greenwich Mean Time) or 'local' (for the host's local time.) I may be uppercase or lowercase; the value will be converted to lowercase. If no value is passed, then the default will be used. The current timezone selector is returned. If an invalid selector is given, then an undefined value is returned. =item I This routine translates a log level (given in I) into the associated text log level. The text log level is returned to the caller. If I is a text string, it is checked to ensure it is a valid log level. Case is irrelevant when checking I. If I is numeric, it is must be in the valid range of log levels. I is returned if I is invalid. =item I This interface returns a boolean value indicating if the given logging level is valid. The I argument is the logging level to be validated. It may be a numeric or textual value. =back =head1 COPYRIGHT Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B B B =cut dnssec-tools-2.2/tools/modules/README0000664000237200023720000000307112544611342017615 0ustar hardakerhardaker# Copyright 2004-2014 SPARTA, Inc. All rights reserved. # See the COPYING file included with the DNSSEC-Tools package for details. DNSSEC-Tools Is your domain secure? This directory contains DNSSEC-Tools-specific Perl modules. Each file has a pod man page which may be consulted for details. BootStrap.pm Determines at run-time, rather than at installation time, if the right modules are available on the system. QWPrimitives.pm QWizard primitives for DNSSEC-Tools. conf.pm Parses the DNSSEC-Tools configuration file. defaults.pm Contains default values for DNSSEC-Tools programs. dnssectools.pm Catch-all module for DNSSEC-Tools routines that don't fit in with other modules. keyrec.pm Manages a DNSSEC-Tools keyrec file. Keyrec files maintain meta-information about DNSSEC-signed DNS zones. rolllog.pm Interfaces for manipulating the rollerd log. rollmgr.pm Provides communications interfaces with a DNSSEC-signed DNS zone roll-over manager daemon. Beware, here be monsters... This is a alpha code. rollrec.pm Manages a DNSSEC-Tools rollrec file. Rollrec files maintain meta-information about roll-over status of DNSSEC-signed DNS zones. DO NOT USE. This isn't even in a pre-alpha state. This is in a primordial state. timetrans.pm Converts an integer seconds count into equivalent text units. tooloptions.pm Parses command line options, and combines them with the DNSSEC-Tools configuration file data and keyrec files to determine the final set of options values to be used by DNSSEC-Tools programs. dnssec-tools-2.2/tools/modules/realmmgr.pm0000664000237200023720000013763512544611342021117 0ustar hardakerhardaker# # Copyright 2012-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # realmmgr.pm - Realm manager functions. # # The routines in this module provide a means to communicate with # dtrealms. The module is based on rollmgr.pm. # # # Introduction # This module provides interfaces for communicating with the # DNSSEC-Tools' realms manager. The top-level interfaces are # independent of the host operating system, but the actual # operations are dependent upon the host O/S. # # To allow similar O/Ses to share switch functions, thus # minimizing the size of the module, the realmmgr_prepdep() # routine determines which operating system class an operating # system falls into. This determination is based upon the O/S # name, as taken from $^O. # # This module has been ported to: # # O/S name O/S class # -------- --------- # FreeBSD Unix # Mac OSX Unix # Solaris Solaris/Unix # # When extending the interface or porting this module to another # O/S, the following entities must be modified as described # below. The Unix switches may be used as a model. # # # Port architecture hash # This hash table associates an operating-system class with # a switch hash. The class (determined in realmmgr_prepdep()) # is the hash key, with its associated switch hash as the # hash value. # The port architecture hash need not be updated when the # interface is extended. # The port architecture hash must be updated when the module # is ported to a new operating system. # # Switch hashes # The switch hashes contain references to the different # platforms supported by this module. # Each switch hash must be updated when the interface # is extended. # The existing switch hashes need not be updated when # the module is ported to a new operating system. # # Uninitialized switch functions # These interfaces are called when the switch table has not # yet been initialized. # These switch functions must be updated when the interface # is extended. # These switch functions need not be updated when the module # is ported to a new operating system. # # Unknown switch functions # These interfaces are called when realmmgr.pm has not been # ported to the host operating system. Unrecognized operating # systems will cause the module's calling process to exit. # These switch functions must be updated when the interface # is extended. # These switch functions need not be updated when the module # is ported to a new operating system. # # Top-level interfaces # The top-level interfaces are O/S-independent front-ends to # the O/S-dependent routines. These interfaces perform # these functions: # - look up their name in the switch table (%switchtab) # - call their associated O/S-dependent routine # - return the O/S-dependent routine's results # These switch functions must be updated when the interface # is extended. # These switch functions need not be updated when the module # is ported to a new operating system. # # package Net::DNS::SEC::Tools::realmmgr; require Exporter; use strict; use Fcntl ':flock'; use Socket; use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::defaults; use Net::DNS::SEC::Tools::rolllog; our $VERSION = "2.0"; our $MODULE_VERSION = "2.0.0"; our @ISA = qw(Exporter); our @EXPORT = qw( realmmgr_cmdint realmmgr_dir realmmgr_dropid realmmgr_getid realmmgr_halt realmmgr_idfile realmmgr_set_idfile realmmgr_rmid realmmgr_running realmmgr_saveid realmmgr_channel realmmgr_closechan realmmgr_getcmd realmmgr_getresp realmmgr_sendcmd realmmgr_queuecmd realmmgr_getqueueitem realmmgr_getallqueuedcmds realmmgr_sendresp realmmgr_verifycmd REALMCMD_COMMAND REALMCMD_DISPLAY REALMCMD_GETSTATUS REALMCMD_LOGFILE REALMCMD_LOGLEVEL REALMCMD_LOGMSG REALMCMD_LOGTZ REALMCMD_REALMSTATUS REALMCMD_SHUTDOWN REALMCMD_STARTALL REALMCMD_STARTREALM REALMCMD_STATUS REALMCMD_STOPALL REALMCMD_STOPREALM REALMCMD_RC_OKAY REALMCMD_RC_BADEVENT REALMCMD_RC_BADFILE REALMCMD_RC_BADLEVEL REALMCMD_RC_BADSLEEP REALMCMD_RC_BADTZ REALMCMD_RC_BADREALM REALMCMD_RC_BADREALMDATA REALMCMD_RC_DISPLAY REALMCMD_RC_NOARGS REALMCMD_RC_NOREALMS REALMCMD_RC_REALMOPEN CHANNEL_WAIT CHANNEL_CLOSE ); my $realmmgrid; # dtrealms's process id. ############################################################################## # # These "constants" are used by dtrealms' command interfaces. # my $ADDR = INADDR_ANY; # dtrealms' server address. my $CMDPORT = 660903; # dtrealms' server port. my $EOL = "\015\012"; # Net-standard end-of-line. my $CHANNEL_TYPE = PF_UNIX; # Type of channel we're using. my $UNIXSOCK = "/realmmgr.socket"; # Unix socket name. my $REALMMGR_PID = "/realmmgr.pid"; # Pid node name. # # Maximum lengths of Unix socket names for various systems. These are used # in rollmgr_channel(). # my $FREEBSD_MAXSOCKNAME = 103; my $MACOSX_MAXSOCKNAME = 103; my $LINUX_MAXSOCKNAME = 107; my $UNKNOWN_MAXSOCKNAME = $MACOSX_MAXSOCKNAME; # Use the shortest. my $maxsockname = $UNKNOWN_MAXSOCKNAME; # # The CHANNEL_ entities are used for specifying whether realmmgr_sendcmd() # should or should not wait for a response from dtrealms. # my $CHANNEL_WAIT = 0; my $CHANNEL_CLOSE = 1; sub CHANNEL_WAIT { return($CHANNEL_WAIT); }; sub CHANNEL_CLOSE { return($CHANNEL_CLOSE); }; my @queuedcmds; # # The REALMCMD_RC_ entities are return codes sent from dtrealms and received # by client programs from realmmgr_getresp(). # my $REALMCMD_RC_OKAY = 0; my $REALMCMD_RC_BADLEVEL = 1; my $REALMCMD_RC_BADFILE = 2; my $REALMCMD_RC_BADSLEEP = 3; my $REALMCMD_RC_BADREALM = 4; my $REALMCMD_RC_BADTZ = 5; my $REALMCMD_RC_REALMOPEN = 6; my $REALMCMD_RC_NOREALMS = 7; my $REALMCMD_RC_BADREALMDATA = 8; my $REALMCMD_RC_DISPLAY = 9; my $REALMCMD_RC_NOARGS = 10; my $REALMCMD_RC_BADEVENT = 11; sub REALMCMD_RC_OKAY { return($REALMCMD_RC_OKAY); }; sub REALMCMD_RC_BADEVENT { return($REALMCMD_RC_BADEVENT); }; sub REALMCMD_RC_BADFILE { return($REALMCMD_RC_BADFILE); }; sub REALMCMD_RC_BADLEVEL { return($REALMCMD_RC_BADLEVEL); }; sub REALMCMD_RC_BADRREALM { return($REALMCMD_RC_BADREALM); }; sub REALMCMD_RC_BADREALMDATA { return($REALMCMD_RC_BADREALMDATA); }; sub REALMCMD_RC_BADSLEEP { return($REALMCMD_RC_BADSLEEP); }; sub REALMCMD_RC_BADTZ { return($REALMCMD_RC_BADTZ); }; sub REALMCMD_RC_DISPLAY { return($REALMCMD_RC_DISPLAY); }; sub REALMCMD_RC_NOARGS { return($REALMCMD_RC_NOARGS); }; sub REALMCMD_RC_NOREALMS { return($REALMCMD_RC_NOREALMS); }; sub REALMCMD_RC_REALMOPEN { return($REALMCMD_RC_REALMOPEN); }; # # The remaining REALMCMD_ entities are the realmmgr_sendcmd() commands # recognized by dtrealms. %realm_commands is a hash table of valid commands. # my $REALMCMD_COMMAND = "realmcmd_command"; my $REALMCMD_DISPLAY = "realmcmd_display"; my $REALMCMD_GETSTATUS = "realmcmd_getstatus"; my $REALMCMD_LOGFILE = "realmcmd_logfile"; my $REALMCMD_LOGLEVEL = "realmcmd_loglevel"; my $REALMCMD_LOGMSG = "realmcmd_logmsg"; my $REALMCMD_LOGTZ = "realmcmd_logtz"; my $REALMCMD_REALMSTATUS = "realmcmd_realmstatus"; my $REALMCMD_SHUTDOWN = "realmcmd_shutdown"; my $REALMCMD_STARTALL = "realmcmd_startall"; my $REALMCMD_STARTREALM = "realmcmd_startrealm"; my $REALMCMD_STATUS = "realmcmd_status"; my $REALMCMD_STOPALL = "realmcmd_stopall"; my $REALMCMD_STOPREALM = "realmcmd_stoprealm"; sub REALMCMD_COMMAND { return($REALMCMD_COMMAND); }; sub REALMCMD_DISPLAY { return($REALMCMD_DISPLAY); }; sub REALMCMD_GETSTATUS { return($REALMCMD_GETSTATUS); }; sub REALMCMD_LOGFILE { return($REALMCMD_LOGFILE); }; sub REALMCMD_LOGLEVEL { return($REALMCMD_LOGLEVEL); }; sub REALMCMD_LOGMSG { return($REALMCMD_LOGMSG); }; sub REALMCMD_LOGTZ { return($REALMCMD_LOGTZ); }; sub REALMCMD_REALMSTATUS { return($REALMCMD_REALMSTATUS); }; sub REALMCMD_SHUTDOWN { return($REALMCMD_SHUTDOWN); }; sub REALMCMD_STARTALL { return($REALMCMD_STARTALL); }; sub REALMCMD_STARTREALM { return($REALMCMD_STARTREALM); }; sub REALMCMD_STATUS { return($REALMCMD_STATUS); }; sub REALMCMD_STOPALL { return($REALMCMD_STOPALL); }; sub REALMCMD_STOPREALM { return($REALMCMD_STOPREALM); }; my %realm_commands = ( realmcmd_command => 1, realmcmd_display => 1, realmcmd_getstatus => 1, realmcmd_logfile => 1, realmcmd_loglevel => 1, realmcmd_logmsg => 1, realmcmd_logtz => 1, realmcmd_nodisplay => 1, realmcmd_realmstatus => 1, realmcmd_shutdown => 1, realmcmd_startall => 1, realmcmd_startrealm => 1, realmcmd_status => 1, realmcmd_stopall => 1, realmcmd_stoprealm => 1, ); ############################################################################## # # These "constants" are the names of dtrealms' interfaces. # my $CMDINT = "cmdint"; my $DROPID = "dropid"; my $GETDIR = "getdir"; my $GETID = "getid"; my $HALT = "halt"; my $IDFILE = "idfile"; my $SETIDFILE = "setidfile"; my $RMID = "rmid"; my $RUNNING = "running"; my $SAVEID = "saveid"; ############################################################################## # # These are the switch hashes that determine what routine will be called # for what O/S classes. # my %switch_uninit = ( $CMDINT => \&uninit_cmdint, $DROPID => \&uninit_dropid, $GETDIR => \&uninit_dir, $GETID => \&uninit_getid, $HALT => \&uninit_halt, $IDFILE => \&uninit_idfile, $SETIDFILE => \&uninit_set_idfile, $RMID => \&uninit_rmid, $RUNNING => \&uninit_running, $SAVEID => \&uninit_saveid, ); my %switch_unknown = ( $CMDINT => \&unknown_cmdint, $DROPID => \&unknown_dropid, $GETDIR => \&unknown_dir, $GETID => \&unknown_getid, $HALT => \&unknown_halt, $IDFILE => \&unknown_idfile, $SETIDFILE => \&unknown_set_idfile, $RMID => \&unknown_rmid, $RUNNING => \&unknown_running, $SAVEID => \&unknown_saveid, ); my %switch_unix = ( $CMDINT => \&unix_cmdint, $DROPID => \&unix_dropid, $GETDIR => \&unix_dir, $GETID => \&unix_getpid, $HALT => \&unix_halt, $IDFILE => \&unix_idfile, $SETIDFILE => \&unix_set_idfile, $RMID => \&unix_rmid, $RUNNING => \&unix_running, $SAVEID => \&unix_saveid, ); my %switch_sysv = ( $CMDINT => \&unix_cmdint, $DROPID => \&unix_psef_dropid, $GETDIR => \&unix_dir, $GETID => \&unix_getpid, $HALT => \&unix_halt, $IDFILE => \&unix_idfile, $SETIDFILE => \&unix_set_idfile, $RMID => \&unix_rmid, $RUNNING => \&unix_running, $SAVEID => \&unix_saveid, ); ############################################################################## # # This is the port architecture hash that associates O/S names with their # switch tables. # my %port_archs = ( "uninitialized" => \%switch_uninit, "unknown" => \%switch_unknown, "unix" => \%switch_unix, "sysv" => \%switch_sysv, ); ############################################################################## # # Unix-related constants. # my $UNIX_REALMMGR_DIR = makelocalstatedir("run"); our $UNIX_REALMMGR_PIDFILE = ($UNIX_REALMMGR_DIR . $REALMMGR_PID); my $PS = "/bin/ps"; ############################################################################## # # These fields are the O/S class and switch table used for interface calls. # my $osclass = "uninitialized"; my %switchtab = %{$port_archs{$osclass}}; ############################################################################## ############################################################################## ############################################################################## # # Top-level Interfaces # # These interfaces are the module interfaces called by external # routines. # #-------------------------------------------------------------------------- # Routine: realmmgr_prepdep() # # Purpose: This routine prepares for device-dependent calls. A global # switch table is set, based on the short-form of the operating # system's name. # # This *must* be updated whenever this module is ported to # a new operating system. # sub realmmgr_prepdep { my $swtab; # Switch-table reference. my $osname = $^O; # Operating system name. # # Set up the default operating system class. # $osclass = "unknown"; # # Figure out which operating system class we're running on. # if(($osname eq "freebsd") || ($osname eq "linux") || ($osname eq "darwin")) { $osclass = "unix"; } # # Figure out which operating system class we're running on. # if(($osname eq "solaris")) { $osclass = "sysv"; } # # Set the maximum socket-name length depending on which operating # system class we're running on. # if($osname eq "darwin") { $maxsockname = $MACOSX_MAXSOCKNAME; } elsif($osname eq "freebsd") { $maxsockname = $FREEBSD_MAXSOCKNAME; } elsif($osname eq "linux") { $maxsockname = $LINUX_MAXSOCKNAME; } # # Get the appropriate switch table for this O/S class and save # it for later reference. # $swtab = $port_archs{$osclass}; %switchtab = %$swtab; } #-------------------------------------------------------------------------- # Routine: realmmgr_dir() # # Purpose: Front-end to the O/S-specific "get dtrealms' # directory" function. # sub realmmgr_dir { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_dir\n"; $func = $switchtab{$GETDIR}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_dropid() # # Purpose: Front-end to the O/S-specific "save dtrealms' # process id" function. # sub realmmgr_dropid { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_dropid\n"; $func = $switchtab{$DROPID}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_getid() # # Purpose: Front-end to the O/S-specific "get dtrealms' # identity" function. # sub realmmgr_getid { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_getid\n"; $func = $switchtab{$GETID}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_halt() # # Purpose: Front-end to the O/S-specific "halt dtrealms" # function. # sub realmmgr_halt { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_halt\n"; $func = $switchtab{$HALT}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_idfile() # # Purpose: Front-end to the O/S-specific "get dtrealms' # identity filename" function. # sub realmmgr_idfile { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_idfile\n"; $func = $switchtab{$IDFILE}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_set_idfile() # # Purpose: Front-end to the O/S-specific "set dtrealms' # identity filename" function. # sub realmmgr_set_idfile { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_set_idfile\n"; $func = $switchtab{$SETIDFILE}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_cmdint() # # Purpose: Front-end to the O/S-specific "dtrealms has a # command" function. # sub realmmgr_cmdint { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_cmdint\n"; $func = $switchtab{$CMDINT}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_rmid() # # Purpose: Front-end to the O/S-specific "remove dtrealms' # identity file" function. # sub realmmgr_rmid { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_rmid\n"; $func = $switchtab{$RMID}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_running() # # Purpose: Front-end to the O/S-specific "is dtrealms running?" function. # sub realmmgr_running { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_running\n"; $func = $switchtab{$RUNNING}; return(&$func(@args)); } #-------------------------------------------------------------------------- # Routine: realmmgr_saveid() # # Purpose: Front-end to the O/S-specific "save dtrealms' # identity" function. # sub realmmgr_saveid { my @args = @_; # Routine arguments. my $func; # Actual function. # print "realmmgr_saveid\n"; $func = $switchtab{$SAVEID}; return(&$func(@args)); } ############################################################################## ############################################################################## ############################################################################## # # Uninitialized switch functions # # These interfaces are called when the switch table has not yet been # initialized. Each interface calls realmmgr_prepdep() to set up the # operating-system-dependent switch table, then calls that O/S's # version of the interface. The O/S-specific results are returned # to the caller. Any subsequent calls to realmmgr_ interfaces will # call the proper O/S-dependent interface. #-------------------------------------------------------------------------- # Routine: uninit_dir() # # Purpose: Switch for uninitialized "get dir" command. # sub uninit_dir { my @args = @_; # Routine arguments. # print "uninit_dir\n"; realmmgr_prepdep(); return(realmmgr_dir(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_dropid() # # Purpose: Switch for uninitialized "drop id" command. # sub uninit_dropid { my @args = @_; # Routine arguments. # print "uninit_dropid\n"; realmmgr_prepdep(); return(realmmgr_dropid(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_getid() # # Purpose: Switch for uninitialized "get id" command. # sub uninit_getid { my @args = @_; # Routine arguments. # print "uninit_getid\n"; realmmgr_prepdep(); return(realmmgr_getid(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_halt() # # Purpose: Switch for uninitialized "halt" command. # sub uninit_halt { my @args = @_; # Routine arguments. # print "uninit_halt\n"; realmmgr_prepdep(); return(realmmgr_halt(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_idfile() # # Purpose: Switch for uninitialized "get id file" command. # sub uninit_idfile { my @args = @_; # Routine arguments. # print "uninit_idfile\n"; realmmgr_prepdep(); return(realmmgr_idfile(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_idfile() # # Purpose: Switch for uninitialized "get id file" command. # sub uninit_set_idfile { my @args = @_; # Routine arguments. # print "uninit_set_idfile\n"; realmmgr_prepdep(); return(realmmgr_set_idfile(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_cmdint() # # Purpose: Switch for uninitialized "force queue" command. # sub uninit_cmdint { my @args = @_; # Routine arguments. # print "uninit_cmdint\n"; realmmgr_prepdep(); return(realmmgr_cmdint(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_rmid() # # Purpose: Switch for uninitialized "remove id file" command. # sub uninit_rmid { my @args = @_; # Routine arguments. # print "uninit_rmid\n"; realmmgr_prepdep(); return(realmmgr_rmid(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_running() # # Purpose: Switch for uninitialized "is dtrealms running?" command. # sub uninit_running { my @args = @_; # Routine arguments. # print "uninit_running\n"; realmmgr_prepdep(); return(realmmgr_running(@args)); } #-------------------------------------------------------------------------- # Routine: uninit_saveid() # # Purpose: Switch for uninitialized "save id file" command. # sub uninit_saveid { my @args = @_; # Routine arguments. # print "uninit_saveid\n"; realmmgr_prepdep(); return(realmmgr_saveid(@args)); } ############################################################################## ############################################################################## ############################################################################## # # Unknown switch functions # # These interfaces are called when the operating system was not # recognized by realmmgr_prepdep(). In all cases, the routine # prints an error message and exits. # #-------------------------------------------------------------------------- # Routine: unknown_action() # sub unknown_action { err("realmmgr.pm has not been ported to your system yet; cannot continue until this has been done.\n",42); } #-------------------------------------------------------------------------- # Routine: unknown_dir() # sub unknown_dir { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_getid() # sub unknown_getid { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_halt() # sub unknown_halt { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_idfile() # sub unknown_idfile { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_set_idfile() # sub unknown_set_idfile { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_cmdint() # sub unknown_cmdint { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_rmid() # sub unknown_rmid { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_running() # sub unknown_running { unknown_action(); } #-------------------------------------------------------------------------- # Routine: unknown_saveid() # sub unknown_saveid { unknown_action(); } ############################################################################## ############################################################################## ############################################################################## # # Unix switch functions # # These interfaces are called when the O/S has been determined to # be a Unix-class O/S. # #-------------------------------------------------------------------------- # Routine: unix_dir() # sub unix_dir { return($UNIX_REALMMGR_DIR); } #-------------------------------------------------------------------------- # Routine: unix_idfile() # # Purpose: Return dtrealms' id file. # sub unix_idfile { return($UNIX_REALMMGR_PIDFILE); } #-------------------------------------------------------------------------- # Routine: unix_set_idfile() # # Purpose: Sets dtrealms' id file to a particular value # sub unix_set_idfile { $UNIX_REALMMGR_PIDFILE = $_[0]; } #-------------------------------------------------------------------------- # Routine: unix_psef_dropid() # # Purpose: Replaces unix_dropid on ps -ef based systems # sub unix_psef_dropid { return unix_dropid('-ps', '-ef', 1, @_); } #-------------------------------------------------------------------------- # Routine: unix_dropid() # # Purpose: Ensures that another instance of dtrealms is not running and # then creates a pid file for future reference. # # Options: [-ps FLAGS PIDPOSITION] # # Return Values: # 1 - The pidfile was initialized for this process. # 0 - Another process (not this one) is already acting as # dtrealms. # -1 - An error was encountered. # sub unix_dropid { my $ego = $$; # My identity. my $pfpid; # Pid from the pidfile. my $pspid = -1; # Pid from ps execution. my $psflags = "wax"; my $pidposition = 0; if ($_[0] eq '-ps') { shift @_; $psflags = shift @_; $pidposition = shift @_; } # print "unix_dropid: down in\n"; # # Get the pid from dtrealms' pidfile. # $pfpid = unix_getpid(0); # # Create the file if it doesn't exist. # If it does exist, we'll make sure the listed process isn't running. # If we can't create it, we'll complain and return a failure code. # if($pfpid < 0) { # print "unix_dropid: opening $UNIX_REALMMGR_PIDFILE\n"; unlink("$UNIX_REALMMGR_PIDFILE"); if(open(PIDFILE,"> $UNIX_REALMMGR_PIDFILE") == 0) { warn "DROPID UNABLE TO OPEN \"$UNIX_REALMMGR_PIDFILE\"\n"; return(-1); } flock(PIDFILE,LOCK_EX); } else { my $pid; # Pid from ps output. my $pscmd; # ps command to execute. my $psline; # Output line from ps. my $openrc; # Return code from open(). # print "unix_dropid: $UNIX_REALMMGR_PIDFILE exists\n"; flock(PIDFILE,LOCK_EX); # # Get the process status of the process having the pid # we found in the pidfile. # # We shouldn't have to do this this way. # We should be able to do "ps -p $pfpid" and # skip the search loop. # However, the $pfpid seems to be dropped # when using that method. # $pscmd = "$PS $psflags"; $openrc = open(PSOUT,"$pscmd |"); $psline = ; while() { my @psout; # ps line array. # # Skip this line if it isn't a dtrealms line. # next if(! /dtrealms/); # # Get the pid from the line and drop out. # s/^[ ]*//; @psout = split / +/; $pspid = $psout[$pidposition]; last; } close(PSOUT); # # Check if the pidfile's process is still running. # Return success if the current, executing manager is us. # Return failure if the current manager isn't us. # if($pfpid == $pspid) { flock(PIDFILE,LOCK_UN); return(1) if($pspid == $ego); return(0); } } # # Zap the file contents. # truncate($UNIX_REALMMGR_PIDFILE,0); # # Save our pid as THE dtrealms' pid. # seek(PIDFILE,0,0); print PIDFILE "$ego\n"; flock(PIDFILE,LOCK_UN); close(PIDFILE); # # Save our pid as the internal version of the manager's pid and # return success. # $realmmgrid = $ego; return(1); } #-------------------------------------------------------------------------- # Routine: unix_rmid() # # Purpose: Delete dtrealms' pidfile. This is done as part of the # manager's clean-up process. # # Return Values: # 1 - The pidfile was deleted. # 0 - No pidfile exists. # -1 - The calling process is not dtrealms. # -2 - Unable to delete the pidfile. # sub unix_rmid { my $ego = $$; # My identity. my $flret; # flock() return code. my $rdpid; # Pid read from the pidfile. # print "unix_rmid: down in\n"; # # Get the pid from dtrealms' pidfile. # $rdpid = unix_getpid(0); flock(PIDFILE,LOCK_EX); # # Complain and return if there is not pidfile. # if($rdpid == -1) { # print "unix_rmid: dtrealms' pidfile does not exist\n"; return(0); } # # Ensure that this process is the One True Realms Manager. # if($rdpid != $ego) { # print "unix_rmid: we are not dtrealms\n"; return(-1); } # # Get rid of the pidfile. # if(unlink($UNIX_REALMMGR_PIDFILE) != 1) { # print "unix_rmid: unable to delete pidfile\n"; return(-2); } # # Close and unlock the pidfile. # flock(PIDFILE,LOCK_UN); close(PIDFILE); return(1); } #-------------------------------------------------------------------------- # Routine: unix_running() # # Purpose: Determine if dtrealms is running and return a boolean # indicating the status. # # Return Values: # 1 - The pidfile's process is running. # 0 - The pidfile's process is not running. # -1 - Unable to read the pidfile. # sub unix_running { my $ret; # kill() return code. my $rdpid; # dtrealms' pid (from pidfile.) # print "unix_running: down in\n"; # # Get the pid from dtrealms' pidfile. # $rdpid = unix_getpid(1); # # Complain and return if there is not pidfile. # if($rdpid == -1) { return(-1); } # # Find out if dtrealms is alive. If it isn't, return 0. # $ret = kill 0, $rdpid; return(0) if($ret == 0); # # Check if the pid's procname is dtrealms, returning an indicator. # $ret = `$PS -p $rdpid`; return(0) if($ret !~ /(dtrealms|perl)/); return(1); } #-------------------------------------------------------------------------- # Routine: unix_getpid() # # Purpose: Return dtrealms, as recorded in its pidfile. # If the caller wants the file closed upon return, a non-zero # value should be passed as an argument. # # Return Values: # -1 is returned if the pidfile does not exist. # The first blob o' file contents is returned if it does exist. # # WARNINGS: # - This attempts to exclusively lock the pidfile. # Set a timer if this matters to you. # # - There's a nice little race condition here. We need to lock # the file and we can't do so without it being open. So, # we've got that little window we hope nothing sneaks through. # sub unix_getpid { my $closeflag = shift; # Close-flag for pidfile. my $pid; # Pid from pidfile. # print "unix_getpid: down in\n"; # # Return an error if the file doesn't exist. # return(-1) if(stat($UNIX_REALMMGR_PIDFILE) == 0); # # Open and lock the pidfile. # close(PIDFILE); if(open(PIDFILE,"+< $UNIX_REALMMGR_PIDFILE") == 0) { # err("unix_getpid: unable to open \"$UNIX_REALMMGR_PIDFILE\"\n",-1); return(-1); } flock(PIDFILE,LOCK_EX); # # Get the pid from the pidfile. # $pid = ; flock(PIDFILE,LOCK_UN); # # Close and unlock the file if the caller only wants the pid. # close(PIDFILE) if($closeflag); # # Lop off any trailing newlines and return. # # $pid =~ s/\n//g; $pid =~ /([0-9]+)/; $pid = $1; return($pid); } #-------------------------------------------------------------------------- # Routine: unix_cmdint() # # Purpose: Kick dtrealms to let it know it should re-read the realms # file and process its queue again. # sub unix_cmdint { my $pid; # dtrealms's pid. my $ret; # Return code from kill(). # print "unix_cmdint: down in\n"; # # Get dtrealms' process id. Return an error if we couldn't get it # or if what we got is below some low arbitrary limit. # $pid = unix_getpid(1); return(-1) if(!defined($pid) || ($pid < 10)); # # Send HUP to dtrealms. # $ret = kill("HUP", $pid); return($ret); } #-------------------------------------------------------------------------- # Routine: unix_halt() # # Purpose: Tell dtrealms to shut down. # sub unix_halt { my $pid; # dtrealms's pid. my $ret; # Return code from kill(). # print "unix_halt: down in\n"; # # Get dtrealms' process id. Return an error if we couldn't get it # or if what we got is below some low arbitrary limit. # $pid = unix_getpid(1); return(-1) if(!defined($pid) || ($pid < 10)); # # Send INT to dtrealms. # $ret = kill('INT',$pid); return($ret); } ############################################################################# ############################################################################# ############################################################################# #----------------------------------------------------------------------------- # Routine: realmmgr_channel() # # Purpose: This routine initializes a socket to use for dtrealms # communications. It is called by both dtrealms and dtrealms # clients. # # Currently, we're only setting up to connect to a dtrealms # running on our own host. In time, we may allow remote # connections. # sub realmmgr_channel { my $server = shift; # Server/client flag. # print "realmmgr_channel($server): down in\n"; # # Close any previously opened sockets. # close(CLNTSOCK); close(SOCK); if($CHANNEL_TYPE == PF_INET) { my $remote = "localhost"; # Server's hostname. my $serveraddr; # Server's address. my $conaddr; # Address in connect(). my $proto = getprotobyname("tcp"); # Protocol to use. # # Create a socket. # socket(SOCK,PF_INET,SOCK_STREAM,$proto); # # For the server, we'll set the socket's address and mark # it as connectable. # For the client, we'll get the address of the server and # connect to it. (Right now, we're only talking to localhost.) # if($server) { setsockopt(SOCK,SOL_SOCKET,SO_REUSEADDR,pack("l",1)); bind(SOCK,sockaddr_in($CMDPORT,$ADDR)) || return(-2); listen(SOCK,SOMAXCONN) || return(-4); } else { $remote = "localhost"; $serveraddr = inet_aton($remote); $conaddr = sockaddr_in($CMDPORT,$serveraddr); connect(SOCK,$conaddr) || return(0); } } elsif($CHANNEL_TYPE == PF_UNIX) { my $sockdata; # Path for socket. my $unixsock; # Unix socket file. # # Build the socket name and construct the socket data. # $unixsock = makelocalstatedir("/dnssec-tools") . $UNIXSOCK; # print STDERR "realmmgr_channel: unixsock - <$unixsock>\n"; # # Ensure the socket name isn't too long. This is a result # of a hardcode maximum length for socket names. This is # in the kernel and isn't # return(-5) if(length($unixsock) > $maxsockname); $sockdata = sockaddr_un($unixsock); # # For the server, we'll create the socket's file and bind it. # For the client, we'll get the connect to the server's socket. # if($server) { # # Create a Unix domain socket. # socket(SOCK,PF_UNIX,SOCK_STREAM,0) || return(-1); unlink($unixsock); bind(SOCK,$sockdata) || return(-2); chmod 0600, $unixsock || return(-3); listen(SOCK,SOMAXCONN) || return(-4); } else { # # Create and connect to a Unix domain socket. # socket(CLNTSOCK,PF_UNIX,SOCK_STREAM,0) || return(-1); connect(CLNTSOCK,$sockdata) || return(0); } } return(1); } #----------------------------------------------------------------------------- # Routine: realmmgr_closechan() # # Purpose: This routine closes down the communications channel to # dtrealms. It is called by both dtrealms and dtrealms clients. # sub realmmgr_closechan { # print "realmmgr_closechan: down in\n"; close(CLNTSOCK); } #----------------------------------------------------------------------------- # Routine: realmmgr_queuecmd() # # Purpose: This routine can be called internally to queue a command # for later processing via calls to realmmgr_getcmd(). # It is useful when doing initial start-up before full # processing is to commence. Commands queued by this # process take precedence over commands received via the # command interface (ie, via realmmgr_sendcmd()). # sub realmmgr_queuecmd { my ($cmd, $value) = @_; return(0) if (realmmgr_verifycmd($cmd) == 0); push @queuedcmds, [$cmd, $value]; } #----------------------------------------------------------------------------- # Routine: realmmgr_getqueueitem() # # Purpose: This routine can be called pull a command from the queue # This is intended to process the item, so it is removed # from the queue. # sub realmmgr_getqueueitem { if($#queuedcmds > -1) { my $cmd = shift @queuedcmds; return($cmd); } } #----------------------------------------------------------------------------- # Routine: realmmgr_getallqueuedcmds() # # Purpose: This routine returns all the queued commands in the stack # The items are left in place unless a truthful argument # (e.g. "1") is passed in. # sub realmmgr_getallqueuedcmds { my $removefromqueue = shift; my @results = @queuedcmds; @queuedcmds = () if ($removefromqueue); return(@queuedcmds); } #----------------------------------------------------------------------------- # Routine: realmmgr_getcmd() # # Purpose: This routine is called by the server to fetch a command and # its data from the command socket. realmmgr_channel() is # assumed to have been called to initialize the command socket. # sub realmmgr_getcmd { my $waiter = shift || 5; # Time to wait for connect. my $cmd; # Client's command. my $data; # Command's data. my $accresp; # Response from accept(). my $oldhandler = $SIG{ALRM}; # Old alarm handler. # print "realmmgr_getcmd: down in\n"; # # if we have anything queued up, process those first. # my $cmdandvalue = realmmgr_getqueueitem(); return(@$cmdandvalue) if(defined($cmdandvalue) && (ref($cmdandvalue) eq 'ARRAY')); # # Set a time limit on how long we'll wait for the connection. # Our alarm handler is a dummy, only intended to keep us from # waiting forever. # $SIG{ALRM} = sub { my $foo = 42 }; alarm($waiter); # # Accept the waiting connection. # $accresp = accept(CLNTSOCK,SOCK); return if(!defined($accresp)); # # Do any required domain-specific checks. # if($CHANNEL_TYPE == PF_INET) { my $raddr; # Client's address. my $clntname; # Client's name. my $rport; # Remote port. # # Convert the client's address into a hostname. # ($rport,$raddr) = sockaddr_in($accresp); $clntname = gethostbyaddr($raddr,AF_INET); # print "realmmgr_getcmd: connection from <$clntname>\n"; # # Ensure we're coming from the localhost. # return("bad host","$clntname","") if($clntname ne "localhost"); } elsif($CHANNEL_TYPE == PF_UNIX) { # # Nothing to do now for Unix-domain sockets. # } # # Get the command and data, and lop off the trailing goo. # $cmd = ; $data = ; $cmd =~ s/ $EOL$//; $data =~ s/ $EOL$//; # # Turn off the alarm and reset the alarm handler. # alarm(0); $SIG{ALRM} = $oldhandler; # # Close the remote socket and return the client's data. # return($cmd,$data); } #----------------------------------------------------------------------------- # Routine: realmmgr_sendcmd() # # Purpose: This routine allows a client to send a message to the server. # No other routines need be called to initialize anything. # sub realmmgr_sendcmd { my $close = shift; # Close flag. my $cmd = shift; # Command to send. my $data = shift; # Data for command. my $oldsel; # Currently selected fh. my $resp; # Response. my $ret = 1; # Return code. # print "realmmgr_sendcmd: down in\n"; return(0) if(realmmgr_verifycmd($cmd) == 0); # # Create the communications channel to dtrealms and send the message. # return(0) if(realmmgr_channel(0) != 1); # # Make CLNTSOCK autoflush its output. # $oldsel = select(CLNTSOCK); $| = 1; # # Send the command and data. # print CLNTSOCK "$cmd $EOL"; print CLNTSOCK "$data $EOL"; # # Select the previous file handle once more. # select($oldsel); # # Close the socket if the client doesn't want a response. # close(CLNTSOCK) if($close); # # Let dtrealms know there's a command waiting. # realmmgr_cmdint(); return(1); } #----------------------------------------------------------------------------- # Routine: realmmgr_sendresp() # # Purpose: This routine allows dtrealms to send a message to a client. # sub realmmgr_sendresp { my $retcode = shift; # Return code. my $respmsg = shift; # Response message. my $oldsel; # Currently selected fh. # print STDERR "realmmgr_sendresp: down in\n"; # # Make CLNTSOCK autoflush its output. # $oldsel = select(CLNTSOCK); $| = 1; # # Send the return code and response message. # print CLNTSOCK "$retcode $EOL"; print CLNTSOCK "$respmsg $EOL"; # # Select the previous file handle once more. # select($oldsel); } #----------------------------------------------------------------------------- # Routine: realmmgr_getresp() # # Purpose: This routine allows a client to wait for a message response # from the server. It will keep reading response lines until # either the socket closes or the timer expires. # sub realmmgr_getresp { my $retcode = -1; # Return code. my $respbuf; # Response buffer. my $oldhandler = $SIG{ALRM}; # Old alarm handler. my $waiter = 5; # Wait-time for resp. # print "realmmgr_getresp: down in\n"; # # Set a time limit on how long we'll wait for the response. # Our alarm handler is a dummy, only intended to keep us from # waiting forever. # $SIG{ALRM} = sub { my $foo = 42 }; alarm($waiter); # # Get the response code and message from dtrealms. # $retcode = ; while() { $respbuf .= $_; } $retcode =~ s/ $EOL$//; $respbuf =~ s/ $EOL$//; # # Reset the alarm handler and return the response buffer. # alarm(0); $SIG{ALRM} = $oldhandler; return($retcode,$respbuf); } #----------------------------------------------------------------------------- # Routine: realmmgr_verifycmd() # # Purpose: This routine returns a boolean indicating if the specified # command is a valid command for the realms daemon. # sub realmmgr_verifycmd { my $cmd = shift; # Command to check. my $hval; # Command hash value. # print "realmmgr_verifycmd: down in\n"; $hval = $realm_commands{$cmd}; # print "realmmgr_verifycmd: <$cmd>\t\t<$hval>\n"; # # Success! # return(1); } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::realmmgr - Communicate with the DNSSEC-Tools realms manager. =head1 SYNOPSIS use Net::DNS::SEC::Tools::realmmgr; $dir = realmmgr_dir(); $idfile = realmmgr_idfile(); $id = realmmgr_getid(); realmmgr_dropid(); realmmgr_rmid(); realmmgr_cmdint(); $runflag = realmmgr_running(); realmmgr_halt(); realmmgr_channel(1); ($cmd,$data) = realmmgr_getcmd(); $ret = realmmgr_verifycmd($cmd); realmmgr_sendcmd(CHANNEL_CLOSE,REALMCMD_STARTREALM,"example-realm"); realmmgr_sendcmd(CHANNEL_WAIT,REALMCMD_STARTREALM,"example-realm"); ($retcode, $respmsg) = realmmgr_getresp(); =head1 DESCRIPTION The B module provides standard, platform-independent methods for a program to communicate with DNSSEC-Tools' B realms manager. There are two interface classes described here: general interfaces and communications interfaces. =head1 GENERAL INTERFACES The interfaces to the B module are given below. =over 4 =item I This routine returns B's directory. =item I This routine returns B's id file. =item I This routine returns B's process id. If a non-zero value is passed as an argument, the id file will be left open and accessible through the PIDFILE file handle. See the WARNINGS section below. Return Values: On success, the first portion of the file contents (up to 80 characters) is returned. -1 is returned if the id file does not exist. =item I This interface ensures that another instance of B is not running and then creates a id file for future reference. Return Values: 1 - the id file was successfully created for this process 0 - another process is already acting as dtrealms -1 - unable to create the id file =item I This interface deletes B's id file. Return Values: 1 - the id file was successfully deleted 0 - no id file exists -1 - the calling process is not dtrealms -2 - unable to delete the id file =item I This routine informs B that a command has been sent via I. Return Values: -1 - an invalid process id was found for dtrealms Anything else indicates the number of processes that were signaled. (This should only ever be 1.) =item I This routine determines if dtrealms is running and returns a value indicating the status. Return Values: 1 - dtrealms is running. 0 - The process listed in the dtrealms process id file is not running. -1 - Unable to get the dtrealms process id. =item I This routine informs B to shut down. In the current implementation, the return code from the B command is returned. -1 - an invalid process id was found for dtrealms Anything else indicates the number of processes that were signaled. (This should only ever be 1.) =back =head1 DTREALMS COMMUNICATIONS INTERFACES =over 4 =item I This interface sets up a persistent channel for communications with B. If I is true, then the server's side of the channel is created. If I is false, then the client's side of the channel is created. Currently, the connection may only be made to the localhost. This may be changed to allow remote connections, if this is found to be needed. Return Values: 1 - Communications channel successfully established. 0 - Unable to connect to the server. -1 - Unable to create a Unix socket. -2 - Unable to bind to the Unix socket. (server only) -3 - Unable to change the permissions on the Unix socket. (server only) -4 - Unable to listen on the Unix socket. (server only) -5 - The socket name was longer than allowed for a Unix socket. =item I This interface internally remembers a command and it's optional value for later processing. See the I next for further details. =item I I processes commands that need to be dealt with. If there are any internally stored commands queued via the I function, they are dealt with first. After that it retrieves a command sent over B's communications channel by a client program. The command and the command's data are sent in each message. The command and the command's data are returned to the caller. =item I I sends a command to B. The command must be one of the commands from the table below. This interface creates a communications channel to B and sends the message. The channel is not closed, in case the caller wants to receive a response from B. The available commands and their required data are: command data purpose ------- ---- ------- REALMCMD_COMMAND realm, command run command in a realm REALMCMD_DISPLAY 1/0 start/stop dtrealms' graphical display REALMCMD_GETSTATUS none currently unused REALMCMD_LOGFILE log filename change the log file REALMCMD_LOGLEVEL log level set a new logging level REALMCMD_LOGMSG log message add a message to the log REALMCMD_LOGTZ timezone set timezone for log messages REALMCMD_NODISPLAY 0 stop dtrealms' graphical display REALMCMD_REALMSTATUS none get status of the realms REALMCMD_SHUTDOWN none stop dtrealms and its realms REALMCMD_STARTALL none start all stopped realms REALMCMD_STOPALL none stop all running realms REALMCMD_STARTREALM realm name restart a suspended realm REALMCMD_STOPREALM realm name stop realm REALMCMD_STATUS none get status of dtrealms The data aren't checked for validity by I; validity checking is a responsibility of B. If the caller does not need a response from B, then I should be set to B; if a response is required then I should be B. These values are boolean values, and the constants aren't required. On success, 1 is returned. If an invalid command is given, 0 is returned. =item I After executing a client command sent via I, B will send a response to the client. I allows the client to retrieve the response. A return code and a response string are returned, in that order. Both are specific to the command sent. =item I I verifies that I is a valid command for B. 1 is returned for a valid command; 0 is returned for an invalid command. 1 is returned for a valid command; 0 is returned for an invalid command. =back =head1 WARNINGS 1. I attempts to exclusively lock the id file. Set a timer if this matters to you. 2. I has a nice little race condition. We should lock the file prior to opening it, but we can't do so without it being open. =head1 COPYRIGHT Copyright 2012-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B B B, B, B =cut dnssec-tools-2.2/tools/modules/tooloptions.pm0000664000237200023720000006763612544611342021705 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details. # # DNSSEC-Tools # # Option routines. # # This module manipulates option lists for the DNSSEC-Tools. After # building an option list from a number of sources (DNSSEC-Tools # defaults, DNSSEC-Tools config file, keyrec file, command-specific # options, and command-line options), a hash table of options is # passed back to the caller. The caller uses the options as required. # package Net::DNS::SEC::Tools::tooloptions; use Net::DNS::SEC::Tools::QWPrimitives; use Net::DNS::SEC::Tools::defaults; require Exporter; use strict; use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::keyrec; our $VERSION = "2.1"; our $MODULE_VERSION = "2.1.0"; our @ISA = qw(Exporter); our @EXPORT = qw( opts_cmdline opts_cmdopts opts_createkrf opts_drop opts_gui opts_nogui opts_onerr opts_reset opts_restore opts_setcsopts opts_suspend opts_zonekr ); ############################################################################ # # Standard options accepted by all tools in the DNSSEC-Tools suite. # # These are in Getopt::GUI::Long format. # my @stdopts = ( ['GUI:separator', 'Cryptography Options:'], ["algorithm=s", "Cryptographic HASH algorithm", question => { type => 'menu', values => [qw(RSA RSAMD5 DH DSA RSASHA1 HMAC-MD5)], default => 'RSAMD5' } ], ["random=s", "Random number generator device"], ["endtime=s", "End-time for signed zone"], ["gends", "Generate DS records"], ["nogends", "Don't generate DS records"], '', ['GUI:separator', 'Configuration Options:'], ["dtconfig=s", "DNSSEC-Tools configuration file"], ["keyrec=s", "Keyrec name", helpdesc => 'test' ], ["krfile=s", "Keyrec file"], ["nokrfile", "Do not use a Keyrec file"], ["genkeys", "Generate KSK and ZSK"], ["savekeys", "Save old keys in archive directory"], ["archivedir=s", "Key archive directory"], '', ['GUI:separator', 'Key-signing Key Options:'], ["genksk", "Generate KSK"], ["kskkey=s", "KSK key"], ["kskcount=i", "Number of KSKs to generate"], ["kskdirectory=s", "Directory for KSK keys"], ["ksklength=i", "Length of KSK"], ["ksklife=i", "Life-span of KSK"], ["revperiod=i", "Revocation period"], ["dsdir=s", "Directory for dsset files"], ["ksdir=s", "Directory for keyset files"], '', ['GUI:separator', 'Zone-signing Key Options:'], ["genzsk", "Generate ZSK"], ["signset=s", "Signing Set"], ["zskkey=s", "ZSK key"], ["zskcount=i", "Number of Current ZSKs to generate"], ["zskdirectory=s", "Directory for ZSK keys"], ["zsklength=i", "Length of ZSK"], ["zsklife=i", "Life-span of ZSK"], ["zskpath=s", "Path to ZSK"], '', ['GUI:separator', 'Zone Options:'], ["zone=s", "Zone name", required => 1], ["zdata=s", "Zone data filename"], ["zfile=s", "Zone filename"], '', ["kgopts=s", "Additional key-generation options"], ["szopts=s", "Additional zone-signing options"], ["zcopts=s", "Additional zone-checking options"], '', ['GUI:separator', 'Roll-over Options:'], ["roll_logfile=s", "Roll-over manager's log filename"], ["roll_loglevel=s", "Roll-over manager's logging level"], ["logtz=s", "Roll-over manager's logging timezone"], ["roll_sleeptime=i", "Sleep-time for Roll-over manager"], ["zone_errors=i", "Maximum consecutive errors for a zone"], '', ['GUI:separator', 'Control Options:'], ["verbose+", "Verbose mode"], ["Version", "Display version number"], ["help", 'Show command line help', question => { values => 'Display Help', type => 'button' } ], # # Getopt::Long::GUI-specific argument specifications. Ignored if !GUI. # # # Don't show the "other arguments" dialog box. # ['GUI:nootherargs',1], # # Prompt for zone input and output file names. # ['GUI:guionly', { type => 'fileupload', name => 'zonein', check_values => \&qw_required_field, text => 'Input Zone File:' }, { type => 'fileupload', name => 'zoneout', check_values => \&qw_required_field, text => 'Output Zone File' } ], # # Map to other args variable. # ['GUI:hook_finished', sub { @main::saveargs = @ARGV; } ], ['GUI:actions', sub { require QWizard; import QWizard; qwparam('__otherargs', qwparam('zonein') . " " . qwparam('zoneout')); $Getopt::Long::GUI::verbose = 1; return('OK'); } ], ); ############################################################################ # my $firstcall = 1; # First-call flag. my $create_krfile = 0; # Create non-existent keyrec file flag. my $errexit = 0; # On-error flag. my $gui = 0; # GUI-usage flag. my %cmdopts = (); # Options from command line. my %saveopts = (); # Save-area for command-line options. my @cspecopts = (); # Caller-saved command-specific options. ############################################################################## # Routine: opts_cmdopts() # # Purpose: This call builds an option hash from data taken from several # places. The data are read and saved in this order: # # - DNSSEC-Tools defaults # - DNSSEC-Tools configuration file # - a set of command-specific options # - command line options # # Since there may be overlapping hash keys, the input becomes # more and more specific to a particular command invocation. # # A reference to the final option hash is returned to the caller. # sub opts_cmdopts { my @csopts = @_; # Command-specific options. my %optionset = (); # The combined options set. my %subopts = (); # Options subset. my %cmdopts = (); # Command line options. # print "opts_cmdopts: down in\n"; # # Get the DNSSEC-Tools defaults. # %optionset = dnssec_tools_alldefaults(); # # Get the config file and mix the file contents in with the defaults. # # %subopts = parseconfig(); foreach my $k (sort(keys(%subopts))) { $optionset{$k} = $subopts{$k}; } # # Set the GUI-usage flag according to the config file. This must be # done right here so that the proper GUI/non-GUI behavior takes place. # $gui = $optionset{'usegui'}; # # Mix in the command-line options with all the others. # %cmdopts = opts_int_cmdline(@csopts); foreach my $k (sort(keys(%cmdopts))) { $optionset{$k} = $cmdopts{$k}; } # # Return the whole swirling mess back to the user. # return(\%optionset); } ############################################################################## # Routine: opts_zonekr() # # Purpose: This call builds an option hash from data taken from several # places. The data are read and saved in this order: # # - DNSSEC-Tools defaults # - DNSSEC-Tools configuration file # - a given keyrec file # - a set of command-specific options # - command line options # # Since there may be overlapping hash keys, the input becomes # more and more specific to a particular command invocation. # # A reference to the final option hash is returned to the caller. # sub opts_zonekr { my $krfile = shift; # Keyrec file to parse. my $krname = shift; # Keyrec name to snarf. my @csopts = @_; # Command-specific options. my %optionset = (); # The combined options set. my %subopts = (); # Options subset. my %cmdopts = (); # Command line options. # print "opts_zonekr: down in\n"; # # Get the DNSSEC-Tools defaults. # %optionset = dnssec_tools_alldefaults(); # # Get the config file contents. # %subopts = parseconfig(); # # Set the GUI-usage flag according to the config file. This must be # done right here so that the proper GUI/non-GUI behavior takes place. # $gui = $optionset{'usegui'}; # # Get the command-line options. # %cmdopts = opts_int_cmdline(@csopts); # # If the user specified a different config file, we'll parse it. # if(defined($cmdopts{'dtconfig'})) { setconffile($cmdopts{'dtconfig'}); %subopts = parseconfig(); } # # Mix the config file contents in with the defaults. # foreach my $k (sort(keys(%subopts))) { $optionset{$k} = $subopts{$k}; } # # Get the keyrec file (from command line options) and keyrec name # (from command line args) values if the caller didn't give them. # $krfile = $cmdopts{'krfile'} if($krfile eq ""); $krname = $ARGV[0] if($krname eq ""); $krname = $cmdopts{'zone'} if(defined($cmdopts{'zone'})); # # Initialize (maybe) and read the keyrec file and the specified zone, # putting the data into a hash table. # $optionset{'krfile'} = $krfile; if($krfile ne "") { if(opts_int_newkrf($krfile) == 1) { %subopts = opts_int_zonecopy($krfile,$krname); } } # # Mix in the keyrec's options with the config and command options. # foreach my $k (sort(keys(%subopts))) { $optionset{$k} = $subopts{$k}; } # # Mix in the command-line options with all the others. # foreach my $k (sort(keys(%cmdopts))) { $optionset{$k} = $cmdopts{$k}; } # # Return the whole swirling mess back to the user. # return(\%optionset); } ############################################################################## # # Routine: opts_setcsopts() # # Purpose: Save a copy of the caller-specified, caller-specific options. # # sub opts_setcsopts { my @csopts = @_; # Command-specific options. @cspecopts = @csopts; } ############################################################################## # # Routine: opts_createkrf() # # Purpose: Turn on creation of non-existent keyrec files. # This flag is only used by tooloptions(). # sub opts_createkrf { $create_krfile = 1; } ############################################################################## # # Routine: opts_suspend() # # Purpose: Suspend use of the command-line options. While suspended, # tooloptions() will not add them to the final hash table. # sub opts_suspend { %saveopts = %cmdopts; %cmdopts = (); } ############################################################################## # # Routine: opts_restore() # # Purpose: Restore use of the command-line options. This will allow # tooloptions() to add them to the final hash table. # sub opts_restore { %cmdopts = %saveopts; %saveopts = (); } ############################################################################## # # Routine: opts_drop() # # Purpose: Irrevocably disable use of the command-line options. # tooloptions() will no longer add them to the final hash table. # # sub opts_drop { %cmdopts = (); %saveopts = (); } ############################################################################## # # Routine: opts_reset() # # Purpose: Reset the first-call flag so we can look at our command- # line arguments once more. # sub opts_reset { $firstcall = 1; opts_drop(); } ############################################################################## # # Routine: opts_gui() # # Purpose: Set the GUI flag to allow GUI usage. # sub opts_gui { $gui = 1; } ############################################################################## # # Routine: opts_nogui() # # Purpose: Set the GUI flag to disallow GUI usage. # sub opts_nogui { $gui = 0; } ############################################################################## # # Routine: opts_onerr() # # Purpose: Set new on-error flag and return the old flag. # sub opts_onerr { my $newaction = shift; # New on-error flag. my $oldaction = $errexit; # Old on-error flag. $errexit = $newaction; return($oldaction); } ############################################################################## # Routine: opts_int_newkrf() # # Purpose: Roughly speaking, this routine creates a new keyrec file. # (It actually just creates a new file, but it's a file intended # for use as a keyrec file.) # # Operation is influenced by $create_krfile. If that var is # set on and the specified file doesn't already exist, then # the keyrec file is created. # # If the keyrec file was created, then $create_krfile will be # turned off. # # Negative values are returned on failure; non-negative values # are returned on success. # # Return Values: # # 1 The keyrec file already exists. # 0 The keyrec file was created. # -1 No keyrec file was specified. # -2 $create_krfile was not turned on. # -3 Unable to create the keyrec file. # sub opts_int_newkrf { my $krfile = shift; # Keyrec file. my $ret; # open() return code. # print "opts_int_newkrf: down in\n"; # # If the caller didn't specify a keyrec file, return an error. # return(-1) if($krfile eq ""); # # If the keyrec file exists, return success. # (By which we mean that the file exists.) # return(1) if(-e $krfile); # # If the caller wants to create a non-existent keyrec file, we'll # create it now. # If the caller doesn't want to create a new keyrec, we'll assume # it already exists and read it. # # # If the specified keyrec file doesn't exist, create it. # return(-2) if(!$create_krfile); # # Create the specified keyrec file. # $ret = open(NEWKRF,"> $krfile"); return(-3) if(!defined($ret)); close(NEWKRF); # # Turn off keyrec file creation. # $create_krfile = 0; return(0); } ############################################################################## # sub opts_int_zonecopy { my $krfile = shift; # Name of keyrec file. my $krname = undef; # Keyrec name we're examining. my $krtype; # Keyrec type. my $found = 0; # Found flag. my $krec; # Keyrec reference. my %keyrec; # Keyrec. my %fields = (); # Fields from keyrec. # # Read the keyrec file. # keyrec_close(); keyrec_read($krfile); # print "\nopts_int_zonecopy: down in\n"; # # If we were given any arguments, we'll grab the zone keyrec's # name. If the name is empty, we'll mark it as undefined. # if(@_) { $krname = shift; $krname = undef if($krname eq ""); } # # If the zone keyrec is undefined, we'll use the alphabetically # first zone keyrec we find. # If the zone keyrec was given, we'll pull out that zone's keyrec. # if($krname eq undef) { my @krnames; # Keyrec names. # # Find the first zone keyrec in the keyrec file. # @krnames = keyrec_names(); foreach my $krn (sort(@krnames)) { $krtype = keyrec_recval($krn,'keyrec_type'); # # If this is a zone keyrec, we'll save the name and # drop out of the loop. # if($krtype eq "zone") { $krname = $krn; $found = 1; last; } } } else { $krtype = keyrec_recval($krname,'keyrec_type'); $found = 1 if($krtype eq "zone"); } # # Return failure if there's no zone keyrec. # if(!$found) { keyrec_close(); return(undef); } # # Get the zone's keyrec values. # $krec = keyrec_fullrec($krname); return(undef) if($krec == undef); %keyrec = %$krec; # # Copy the zone keyrec. # foreach my $k (sort(keys(%keyrec))) { $fields{$k} = $keyrec{$k} if($k !~ /^keyrec_/); } # # Copy the data from the Current KSK and Current ZSK keyrecs. # # foreach my $ktype ('kskcur', 'zskcur') foreach my $ktype ('kskcur', 'zskcur', 'kskpub', 'zskpub', 'zsknew') { my $setname; # Name of the signing set. my $setkeys; # Keys in the signing set. # # Get the keys in this signing set. # $setname = keyrec_recval($krname,$ktype); $setkeys = keyrec_recval($setname,'keys'); # # Add the data from each key's keyrec. # foreach my $keyname (split / /,$setkeys) { # # Get the key's keyrec values. # $krec = keyrec_fullrec($keyname); next if($krec eq ''); %keyrec = %$krec; # # Copy the key keyrec. # foreach my $k (keys(%keyrec)) { $fields{$k} = $keyrec{$k} if($k !~ /^keyrec_/); } } } # # Return the collected zone and key data. # return(%fields); } ############################################################################## # Routine: opts_cmdline() # # Purpose: Parse a command line looking for the arguments in the standard # set of options and the caller's set. If the first argument is # true, the program-wide @ARGV is restored after parsing. If the # caller provides other arguments, they're added as additional # options. The parsed options are returned to the caller. # sub opts_cmdline { my $saveargv = shift; # Flag for saving @ARGV. my @csopts = @_; # Command-specific options. my @args; # Copy of @ARGV. my @opts; # Copy of standard options. my %parsedopts; # Parsed options. my $curgui = $gui; # Saved $gui value. my $curfc = $firstcall; # Saved $firstcall value. # # Save the argument vector. # @args = @ARGV; # # Add the standard options to the caller's options. # @opts = @stdopts; push @opts, @csopts if(@csopts > 0); # # Force some flags we need. # $gui = 0; $firstcall = 0; # # Extract the command line options. # localgetoptions(\%parsedopts,@opts); # # Restore the forced flags. # $gui = $curgui; $firstcall = $curfc; # # Restore the saved argument vector. # @ARGV = @args if($saveargv); return(%parsedopts); } ############################################################################## # sub opts_int_cmdline { my @csopts = @_; # Command-specific options. my $cslen; # Length of @csopts. my @opts; # Copy of standard options. my %subopts = (); # Options subset. # # Don't do anything if this isn't the first time we were called. # return if(!$firstcall); # # We'll start with whatever's left in the argument list. If the # caller has saved a set of options already, we'll plop those onto # the end of this list. # push @csopts,@cspecopts if(scalar(@cspecopts) >= 0); $cslen = @csopts; # # Copy the standard options and append any command-specific # options that have been given. # @opts = @stdopts; push(@opts,@csopts) if($cslen > 0); # # Extract the command line options and set a flag indicating that # we've handled the options already. # localgetoptions(\%subopts,@opts); $firstcall = 0; return(%subopts); } ############################################################################## # # Routine: localgetoptions() # # Purpose: A wrapper to determine if options should be specified through # a GUI or not. If the $gui flag isn't set, then the GUI won't # be used. If $gui is set and the Getopt::Long::GUI routine is # available, then we'll use the GUI. Otherwise, we'll just # call Getopt::Long. # # localgetoptions() and localoptionsmap() are only needed to # support "not-requiring" Getopt::Long::GUI. # # Code pulled from the Getopt::Long::GUI documentation and can # be updated to newer versions in the future, if need be. # sub localgetoptions { my @args = @_; # Force copy since we're called multiple times. my $ret; # Return code from GetOptions(). if($gui) { if(($#ARGV == -1) && (eval {require Getopt::GUI::Long;})) { import Getopt::GUI::Long; return(GetOptions(@args)); } } require Getopt::Long; import Getopt::Long qw(:config no_ignore_case_always); # # Parse the command line for options. # $ret = GetOptions(localoptionsmap(@args)); # # If there was an option problem and we should exit, we'll do so. # If there's a usage() in the main module, we'll call that first. # if(!$ret && $errexit) { main::usage() if(main->can('usage')); exit(1); } # # Return the GetOptions() return code to our caller. # return($ret); } ############################################################################## # # Routine: localoptionsmap() # # Purpose: Maps Getopt::Long::GUI arguments to Getopt::Long arguments. # # Code pulled from the Getopt::Long::GUI documentation and can # be updated to newer versions in the future, if need be. # sub localoptionsmap { my ($st, $cb, @opts) = ((ref($_[0]) eq 'HASH') ? (1, 1, $_[0]) : (0,2)); for(my $i = $st; $i <= $#_; $i += $cb) { if($_[$i]) { next if((ref($_[$i]) eq 'ARRAY') && ($_[$i][0] =~ /^GUI:/)); push @opts, ((ref($_[$i]) eq 'ARRAY') ? $_[$i][0] : $_[$i]); push @opts, $_[$i+1] if($cb == 2); } } return(@opts); } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::tooloptions - DNSSEC-Tools option routines. =head1 SYNOPSIS use Net::DNS::SEC::Tools::tooloptions; @specopts = ("propagate+", "waittime=i"); %opts = opts_cmdline($restoreargv,@calleropts); $optsref = opts_cmdopts(@specopts); %options = %$optsref; $zoneref = opts_zonekr($keyrec_file,$keyrec_name,@specopts); %zone_kr = %$zoneref; opts_setcsopts(@specopts); opts_createkrf(); opts_suspend(); opts_restore(); opts_drop(); opts_reset(); opts_gui(); opts_nogui(); $oldaction = opts_onerr(1); opts_onerr(0); =head1 DESCRIPTION DNSSEC-Tools supports a set of options common to all the tools in the suite. These options may be set from DNSSEC-Tools defaults, values set in the B configuration file, in a I file, from command-specific options, from command-line options, or from any combination of the five. In order to enforce a common sequence of option interpretation, all DNSSEC-Tools should use the B routines to initialize their options. B routines combine data from the aforementioned option sources into a hash table. The hash table is returned to the caller, which will then use the options as needed. The command-line options are saved between calls, so a command may call B routines multiple times and still have the command-line options included in the final hash table. This is useful for examining multiple Is in a single command. Inclusion of command-line options may be suspended and restored using the I and I calls. Options may be discarded entirely by calling I; once dropped, command-line options may never be restored. Suspension, restoration, and dropping of command-line options are only effective after the initial B call. The options sources are combined in this order: =over 4 =item 1. DNSSEC-Tools Defaults The DNSSEC-Tools defaults, as defined in B are put into a hash table, with the option names as the hash key. =item 2. DNSSEC-Tools Configuration File The system-wide DNSSEC-Tools configuration file is read and these option values are added to the option collection. Again, the option names are used as the hash key. =item 3. I File If a I file was specified, then the I named by I will be retrieved. The I's fields are added to the hash table. Any field whose keyword matches an existing hash key will override any existing values. =item 4. Command-Specific Options Options specific to the invoking commands may be specified in I<@specopts>. This array is parsed by I from the B Perl module. These options are folded into the hash table; possibly overriding existing hash values. The options given in I<@specopts> must be in the format required by I. =item 5. Command-Line Options The command-line options are parsed using I from the B Perl module. These options are folded into the hash table; again, possibly overriding existing hash values. The options given in I<@specopts> must be in the format required by I. =back A reference to the hash table created in these steps is returned to the caller. =head1 EXAMPLE B has these entries: ksklength 2048 zsklength 1024 B has this entry: key "Kexample.com.+005+12345" zsklength "2048" B is executed with this command line: zonesigner -zsklength 4096 -wait 3600 ... example.com I will read each option source in turn, ending up with: I 1024 I 4096 I 600 =head1 TOOLOPTIONS INTERFACES =over 4 =item I This routine parses a command line looking for the arguments in the standard set of options and an optional set of options specified by the caller. If the first argument is true, the program-wide @ARGV is restored after parsing. If the caller provides other arguments, they're added as additional options. The parsed options are returned to the caller in a hash. =item I The I call builds an option hash from the system configuration file, a I, and a set of command-specific options. A reference to this option hash is returned to the caller. If I<$keyrec_file> is given as an empty string, then no I file will be consulted. In this case, it is assumed that I<$keyrec_name> will be left out altogether. If a non-existent I<$keyrec_file> is given and I has been called, then the named I file will be created. I must be called for each I file that must be created, as the B I-creation state is reset after B has completed. =item I This routine returns a reference to options gathered from the basic option sources and from the zone I named by I<$keyrec_name>, which is found in I<$keyrec_file>. The I fields from the zone's KSK and ZSK are folded in as well, but the key's I fields are excluded. This call ensures that the named I is a zone I; if it isn't, I is returned. The I file is read with I. To ensure it is properly read, I is called first. The I<$keyrec_file> argument specifies a I file that will be consulted. The I named by the I<$keyrec_name> argument will be loaded. If a I file is found and I has been previously called, then the I file will be created if it doesn't exist. If I<$keyrec_file> is given as "", then the command-line options are searched for a I<-krfile> option. If I<$keyrec_name> is given as "", then the name is taken from I<$ARGV[0]>. The I<@specopts> array contains command-specific arguments; the arguments must be in the format prescribed by the B Perl module. If the command line contains the I<-dtconfig> option, then I() sets that option to be the configuration file. It then parses that file and uses it as the source for configuration file data. =item I This routine saves a copy of the command-specific options given in I<@csopts>. This collection of options is added to the I<@csopts> array that may be passed to B routines. =item I Force creation of an empty I file if the specified file does not exist. This may happen on calls to I. =item I Suspend inclusion of the command-line options in building the final hash table of responses. =item I Restore inclusion of the command-line options in building the final hash table of responses. =item I Discard the command-line options. They will no longer be available for inclusion in building the final hash table of responses for this execution of the command. =item I Reset an internal flag so that the command-line arguments may be re-examined. This is usually only useful if the arguments have been modified by the calling program itself. =item I Set an internal flag so that command arguments may be specified with a GUI. GUI usage requires that B is available. If it isn't, then B will be used. =item I Set an internal flag so that the GUI will not be used for specifying command arguments. =item I Set an internal flag indicating what should happen if an invalid option is specified on the command line. If I is non-zero, then the process will exit on an invalid option; if it is zero, then the process will not exit. The default action is to report an error without exiting. The old exit action is returned. =back =head1 COPYRIGHT Copyright 2005-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B B B, B, B B =cut dnssec-tools-2.2/tools/modules/Makefile.PL0000775000237200023720000000131412544611342020710 0ustar hardakerhardaker#!/usr/bin/perl # Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details use ExtUtils::MakeMaker; %opts = InitMakeParams(); WriteMakefile(%opts); appendstuff(); sub InitMakeParams { $DIRS = ['ZoneFile-Fast']; if ($ARGV[0] ne 'NOVALIDATOR') { unshift @$DIRS, 'Net-DNS-SEC-Validator', 'Net-addrinfo'; } %opts = ( 'NAME' => 'Net::DNS::SEC::Tools::conf', 'VERSION_FROM' => 'conf.pm', # finds $VERSION 'DIR' => $DIRS, # avoids the testing dir ); return %opts; } sub appendstuff { open(MK,">> Makefile"); print MK ' %.pm: %.pm.in cd $(CURDIR)/../.. && ./config.status '; close(MK); } dnssec-tools-2.2/tools/modules/BootStrap.pm0000664000237200023720000000641312544611342021213 0ustar hardakerhardaker# # # Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # package Net::DNS::SEC::Tools::BootStrap; use strict; require Exporter; our $VERSION = "1.9"; our $MODULE_VERSION = "1.9.0"; our @ISA = qw(Exporter); our @EXPORT = qw(dnssec_tools_load_mods); our $gui_file_slots = 5; our %extra_help_text = (GraphViz => "Note: You also need the graphviz base libraries and tools as well. For this, please see: http://www.graphviz.org/ "); sub dnssec_tools_load_mods { my %modules = @_; my $oops = 0; foreach my $k (keys(%modules)) { my $haveit = eval "require $k;"; if (!$haveit) { if ($modules{'$k'} ne 'noerror') { print STDERR " SETUP ERROR: -------------------------------------------------- I could not find an installation of the '$k' perl module, which this tool needs in order to operate. Please obtain and install this module. You may be able do this using the CPAN ( http://www.cpan.org/ ) system as follows: perl -MCPAN -e 'install \"$k\"' The above command should install the '$k' module if it is available within the CPAN archives. $extra_help_text{$k}$modules{$k} "; } $oops = 1; } else { package main; import $k; package Net::DNS::SEC::Tools::BootStrap; } } exit if ($oops); } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::BootStrap - Optional loading of Perl modules =head1 SYNOPSIS use Net::DNS::SEC::Tools::BootStrap; dnssec_tools_load_mods( PerlModule => 'Additional help/error text' ); =head1 DESCRIPTION The DNSSEC-Tools package requires a number of Perl modules that are only needed by some of the tools. This module helps determine at run-time, rather than at installation time, if the right tools are available on the system. If any module fails to load, I will display an error message and calls I. The error message describes how to install a module via CPAN. The arguments to I are given in pairs. Each pair is a module to try to load (and import) and a supplemental error message. If the module fails to load, the supplemental error message will be displayed along with the installation-via-CPAN message. If the error message consists of the string "noerror", then no error message will be displayed before the function exits. =head1 CAVEATS The module will try to import any exported subroutines from the module into the I
namespace. This means that the I module is likely to not be useful for importing symbols into other modules. Work-arounds for this are: =over =item - import the symbols by hand dnssec_tools_load_mods( PerlModule => 'Additional help/error text' ); import PerlModule qw(func1 func2); func1(arg1, arg2); =item - call the fully qualified function name dnssec_tools_load_mods( PerlModule => 'Additional help/error text' ); PerlModule::func1(arg1, arg2); =back =head1 COPYRIGHT Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wes Hardaker =head1 SEE ALSO http://www.dnssec-tools.org/ =cut dnssec-tools-2.2/tools/modules/rollrec.pm0000664000237200023720000021603112544611342020737 0ustar hardakerhardaker#!/usr/bin/perl # # Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details. # # DNSSEC Tools # # Rollrec file routines. # # The routines in this module manipulate a rollrec file for the DNSSEC- # Tools. The rollrec file contains information about key rollover # status. # # Entries in the configuration file are of the "key value" format, with # the value enclosed in quotes. Comments may be included by prefacing # them with the '#' or ';' comment characters. # # These entries are grouped by the zone whose key(s) are being rolled # over. # # An example rollrec file follows: # # roll "example.com" # zonename "example.com" # zonefile "/usr/etc/dnssec-tools/zones/db.example.com" # keyrec "/usr/etc/dnssec-tools/keyrec/example.keyrec" # zskphase "2" # kskphase "0" # maxttl "86400" # curerrors "0" # display "0" # phasestart "Wed Mar 09 21:49:22 2005" # # roll "example2.com" # zonename "example2.com" # zonefile "/usr/etc/dnssec-tools/zone/db.example2.com" # keyrec "/usr/etc/dnssec-tools/keyrec/example2.keyrec" # kskphase "1" # zskphase "0" # maxttl "100000" # display "1" # loglevel "info" # curerrors "0" # maxerrors "5" # phasestart "Sun Jan 01 16:00:00 2005" # # roll "example2.com" # version "2" # # # The current implementation assumes that only one rollrec file will # be open at a time. If module use proves this to be a naive assumption # this module will have to be rewritten to account for it. # # The directory rollrec field was an excellent suggestion made by # Otmar Lendl . Several changes here, in rollerd, # and in other scripts are a result of this suggestion. # package Net::DNS::SEC::Tools::rollrec; require Exporter; use strict; use Fcntl qw(:DEFAULT :flock); use Net::DNS::SEC::Tools::conf; use Net::DNS::SEC::Tools::rollmgr; our $VERSION = "2.1"; our $MODULE_VERSION = "2.1.0"; our @ISA = qw(Exporter); #-------------------------------------------------------------------------- # # Exported commands. # our @EXPORT = qw( rollrec_add rollrec_close rollrec_current rollrec_default rollrec_del rollrec_delfield rollrec_discard rollrec_dump_array rollrec_dump_hash rollrec_exists rollrec_fields rollrec_fullrec rollrec_init rollrec_info rollrec_lock rollrec_merge rollrec_names rollrec_read rollrec_readfiles rollrec_rectype rollrec_recval rollrec_rename rollrec_settime rollrec_setval rollrec_split rollrec_unlock rollrec_version rollrec_write rollrec_zonegroup rollrec_zonegroups rollrec_zonegroup_cmds ); #-------------------------------------------------------------------------- # # Zonegroup commands. # my %zg_commands = ( 'rollcmd_dspub' => 1, 'rollcmd_rollksk' => 1, 'rollcmd_rollzone' => 1, 'rollcmd_rollzsk' => 1, 'rollcmd_skipzone' => 1, ); #-------------------------------------------------------------------------- # # Default file names. # my $DEFAULT_DNSSECTOOLS_DIR = getconfdir(); my $DEFAULT_ROLLREC = "dnssec-tools.rollrec"; my $LOCKNAME = "rollrec.lock"; # # Valid fields in a non-informational rollrec. # my @ROLLFIELDS = ( 'zonename', 'zonefile', 'keyrec', 'zonegroup', 'maxttl', 'administrator', 'directory', 'phasestart', 'display', 'loglevel', 'kskphase', 'zskphase', 'zsargs', 'curerrors', 'maxerrors', 'rndc_opts', 'ksk_rollsecs', 'ksk_rolldate', 'zsk_rollsecs', 'zsk_rolldate', ); # # Valid fields in an informational rollrec. # my @ROLLINFOFIELDS = ( 'version', ); our $ROLLREC_INFO = 'info rollrec'; # Name of info rollrec. our $ROLLREC_CURRENT_VERSION = 2; # Current version of rollrecs. #-------------------------------------------------------------------------- my @rollreclines; # Rollrec lines. my $rollreclen; # Number of rollrec lines. my %rollrecs; # Rollrec hash table. my %rollrecindex; # Maps rollrec names to @rollreclines indices. my %zonegroups; # Zone group hash table. my $modified; # File-modified flag. #-------------------------------------------------------------------------- # Routine: rollrec_lock() # # Purpose: Lock rollrec processing so that only one process reads a # rollrec file at a time. # # The actual rollrec file is not locked; rather, a synch- # ronization file is locked. We lock in this manner due to # the way the rollrec module's functionality is spread over # a set of routines. # sub rollrec_lock { my $lockdir; # Configuration file directory. my $lockfile; # Name of the lock file. # print "rollrec_lock: down in\n"; # # Get the DNSSEC-Tools config directory. # $lockdir = makelocalstatedir("/dnssec-tools") || $DEFAULT_DNSSECTOOLS_DIR; # # Build our lock file. # $lockfile = "$lockdir/$LOCKNAME"; # # Open (and create?) our lock file. # if(!sysopen(RRLOCK,$lockfile,O_RDONLY|O_CREAT)) { # err("unable to open lock file \"$lockfile\"; not locking...\n",-1); return(0); } # # Lock the lock file. # return(flock(RRLOCK,LOCK_EX)); } #-------------------------------------------------------------------------- # Routine: rollrec_unlock() # # Purpose: Unlock rollrec processing so that other processes may read # a rollrec file. # sub rollrec_unlock { # print "rollrec_unlock: down in\n"; # # Unlock the lock file. # return(flock(RRLOCK,LOCK_UN)); } #-------------------------------------------------------------------------- # Routine: rollrec_read() # # Purpose: Read a DNSSEC-Tools rollrec file. The contents are read into # the @rollreclines array and the rollrecs are broken out into # the %rollrecs hash table. # sub rollrec_read { my $rrf = shift; # Rollover file. my $rrcnt; # Number of rollrecs we found. my @sbuf; # Buffer for stat(). # print "rollrec_read: down in\n"; # # Use the default rollrec file, unless the caller specified # a different file. # $rrf = rollrec_default() if($rrf eq ''); # # Make sure the rollrec file exists. # if(! -e $rrf) { err("rollrec file $rrf does not exist\n",-1); return(-1); } # # If a rollrec file is already open, we'll flush our buffers and # save the file. # @sbuf = stat(ROLLREC); rollrec_close() if(@sbuf != 0); # # Open up the rollrec file. If we can't open it for reading and # writing, we'll try to open it just for reading. # if(open(ROLLREC,"+< $rrf") == 0) { if(open(ROLLREC,"< $rrf") == 0) { err("unable to open $rrf\n",-1); return(-2); } } # # Initialize some data. # rollrec_init(); # # Read the contents of the specified rollrec file. # rollrec_readfile(*ROLLREC,0); # # Return the number of rollrecs we found. # $rrcnt = keys(%rollrecs); return($rrcnt); } #-------------------------------------------------------------------------- # Routine: rollrec_merge() # # Purpose: Merge a set of DNSSEC-Tools rollrec files. The contents are # read into the @rollreclines array and the rollrecs are broken # out into the %rollrecs hash table. # sub rollrec_merge { my $firstrrf = shift; # First rollrec file in list. my @rrflist = @_; # Set of rollrec files. my %allrrfs = (); # All rollrec filenames to be merged. my $errs = 0; # Count of non-fatal errors. my $rrcnt; # Number of rollrecs we found. # print "rollrec_merge: down in\n"; # # Make sure a set of rollrec files was specified. # if((! defined($firstrrf)) || (@rrflist == 0)) { err("no rollrec files given to merge\n",1); return(-1); } # # Build a hash of the rollrec file names and the number of times # each is specified. # foreach my $fn ($firstrrf, @rrflist) { $allrrfs{$fn}++; } # # Bump the error count if a file was listed multiple times. # foreach my $fn (keys(%allrrfs)) { $errs++ if($allrrfs{$fn} > 1); } # # If any file was listed multiple times, given an error and return. # if($errs) { err("unable to merge rollrec files since some rollrec files were given multiple times\n",1); return(-5); } # # Create a target file if the first rollrec file doesn't exist or # if the file is empty. A bare-bones rollrec will be created that # only has an info rollrec. # if((! -e $firstrrf) || (-z $firstrrf)) { if(open(TMP,"> $firstrrf") == 0) { err("rollrec_merge: unable to create target rollrec file \"$firstrrf\"\n",1); return(-2); } # # Write the new info rollrec. # print TMP "\n"; print TMP "skip \"$ROLLREC_INFO\"\n"; print TMP " version \"$ROLLREC_CURRENT_VERSION\"\n"; print TMP "\n"; close(TMP); } # # Read the first rollrec file. This will also zap all our current # internal data. # $allrrfs{$firstrrf}++; if(rollrec_read($firstrrf) < 0) { return(-3); } # # Read each remaining rollrec file and add it to our internal # rollrec collection. # foreach my $rrf (@rrflist) { # # Make sure the rollrec file exists. # if(! -e $rrf) { err("rollrec file \"$rrf\" does not exist\n",1); $errs++; next; } # # Close the needed file handle. # close(ROLLREC_MERGE); # # Open up the rollrec file. # if(open(ROLLREC_MERGE,"< $rrf") == 0) { err("unable to open $rrf\n",1); $errs++; next; } # # Read the contents of the specified rollrec file. # if(rollrec_readfile(*ROLLREC_MERGE,1) < 0) { $errs++; } } # # Close the file handle. # close(ROLLREC_MERGE); # # If we encountered errors while merging the files, we'll give # an error and reset ourself. # if($errs) { err("unable to merge rollrec files due to errors\n",1); rollrec_init(); return(-4); } # # Write the new rollrec file. # $modified = 1; rollrec_write(); # # Return the number of rollrecs we found. # $rrcnt = keys(%rollrecs); return($rrcnt); } #-------------------------------------------------------------------------- # Routine: rollrec_split() # # Purpose: Split a rollrec file in two. A list of rollrec entries will # be removed from the current rollrec file and appended to # another file. The rollrec entries will be removed from # @rollreclines and %rollrecs. # # Things get interesting with the target rollrec file and the # info rollrec. If the target file doesn't exist, the source's # info rollrec is copied to it. If it does exist but doesn't # have an info rollrec, then the source's info rollrec is copied # to the target. If the target file exists and has an info # rollrec, then the two files must have matching version numbers. # # The rollrecs will be appended to the destination file. # sub rollrec_split { my $newrrf = shift; # New rollrec file. my @rrlist = @_; # Set of rollrec names. my $valid = 0; # Count of valid names. my @badnames = (); # List of invalid names. my $rrcnt = 0; # Number of rollrecs we split. my $verscopy = 0; # Flag for copying info rollrec. # print "rollrec_split: down in\n"; # # Make sure a set of rollrec files was specified. # if((! defined($newrrf)) || ($newrrf eq '')) { err("no target rollrec file given for split\n",1); return(-1); } # # Make sure a set of rollrec files was specified. # if(@rrlist == 0) { err("no rollrec names given for split\n",1); return(-2); } # # Count the valid rollrec names in the name list. # foreach my $rrn (@rrlist) { next if($rrn eq $ROLLREC_INFO); $valid++ if(defined($rollrecs{$rrn})); } # # Ensure that at least one of the rollrec names in the name list # is valid. # if($valid == 0) { err("no rollrec names given for split are existing rollrecs\n",1); return(-3); } # # If the new rollrec file already exists, make sure it's at the same # version as the old file. # # This code is ugly. We'll fix it when we objectify the module a bit # further so it can handle multiple open rollrecs. Having time to do # that will come RSN. # if(-e $newrrf) { my @nlines; # Lines in new rollrec. my $keyword; # Keyword from the line. my $value; # Keyword's value. my $newvers = -1; # Rollrec's version. if(open(TMP,"< $newrrf") == 0) { err("rollrec_split: unable to read target rollrec file \"$newrrf\"\n",1); return(-20); } @nlines = ; close(TMP); # # Find the start of the info rollrec. # for(my $ind=0; $ind < @nlines; $ind++) { my $line = $nlines[$ind]; # # Skip comment lines and empty lines. # if(($line =~ /^\s*$/) || ($line =~ /^\s*[;#]/)) { next; } # # Grab the keyword and value from the line. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $keyword = $1; $value = $2; # # Look for a keyword of "roll" or "skip" and the # info rollrec. # next if(($keyword !~ /^roll$/i) && ($keyword !~ /^skip$/i)); next if($value ne $ROLLREC_INFO); # # Okeedokee, we've got the info rollrec now. # Lop off the first chunk o' file. # splice @nlines, 0, $ind; last; } # # Find the end of the info rollrec. # for(my $ind=1; $ind < @nlines; $ind++) { my $line = $nlines[$ind]; # # Skip comment lines and empty lines. # if(($line =~ /^\s*$/) || ($line =~ /^\s*[;#]/)) { next; } # # Grab the keyword and value from the line. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $keyword = $1; next if(($keyword !~ /^roll$/i) && ($keyword !~ /^skip$/i)); # # Get rid of everything from here to the end. # splice @nlines, $ind, @nlines; } # # We now have the info rollrec -- if there is one. # if(@nlines) { my %newinfo = (); # New file's info rollrec. my $inforecs = 0; # Info records we found. for(my $ind=0; $ind < @nlines; $ind++) { my $line = $nlines[$ind]; # # Skip comment lines and empty lines. # if(($line =~ /^\s*$/) || ($line =~ /^\s*[;#]/)) { next; } # # Save this line's keyword/value pair. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $keyword = $1; $value = $2; $newinfo{$1} = $2; $inforecs++; } # # If we found any actual info records, we'll check # the version. # if($inforecs) { if(defined($newinfo{'version'})) { $newvers = $newinfo{'version'}; } else { $newvers = undef; } } } # # Figure out what to do with the version based on # value of $newvers: # < 0 There's no info rollrec. We'll copy the # current rollrec's info rollrec to the file. # # < 2 There's an info rollrec with a pre-info # rollrec version. We'll return an error. # # If it's neither of the above and it doesn't match # the current rollrec's version, then there's a fatal # version mismatch. We'll return an error. # if(! defined($newvers)) { return(-8); } elsif($newvers < 0) { $verscopy = 1; } elsif($newvers < 2) { return(-6); } elsif($rollrecs{$ROLLREC_INFO}{'version'} != $newvers) { return(-7); } } else { # # If this is a new target rollrec file, we'll copy the # info rollrec from the original file. # $verscopy = 1; } # # Open the target rollrec file for appending. # if(open(ROLLREC_SPLIT,">> $newrrf") == 0) { err("unable to open \"$newrrf\" for split\n",1); return(-4); } # # Add the info rollrec if we've found we should copy it. # unshift @rrlist, $ROLLREC_INFO if($verscopy); # # Read each remaining rollrec file and add it to our internal # rollrec collection. # foreach my $rrn (@rrlist) { my $rrind; # Index to rollrec's first line. # # Skip the info rollrec if it was named and we shouldn't # copy it. # next if(!$verscopy && ($rrn eq $ROLLREC_INFO)); # # If this name isn't the name of an existing rollrec, we'll # save the name and go to the next. # if(! exists($rollrecs{$rrn})) { push @badnames,$rrn; next; } # # Find the index for this rollrec in @rollreclines. # $rrind = rrindex($rrn); # # Bump our count of split rollrecs. # $rrcnt++; # # Find the specified field's entry in the rollrec's lines in # @rollreclines. We'll skip over lines that don't have a # keyword and dquotes-enclosed value. # print ROLLREC_SPLIT "$rollreclines[$rrind]"; for($rrind++; $rrind<$rollreclen; $rrind++) { my $ln = $rollreclines[$rrind]; # Line in rollrec file. my $lkw; # Line's keyword. # # Get the line's keyword and value. # $ln =~ /^\s*([a-z_]+)\s+"([a-z0-9\/\-+_.,: \t]*)"/i; $lkw = $1; # # If we hit the beginning of the next rollrec or a # blank line, we'll write a blank line and, drop out. # if(($lkw =~ /^(roll|skip)$/i) || ($ln eq "\n")) { print ROLLREC_SPLIT "\n"; last; } print ROLLREC_SPLIT "$ln"; } # # If we hit the beginning of the next rollrec or a # blank line, we'll write a blank line and, drop out. # if($rrind == $rollreclen) { print ROLLREC_SPLIT "\n"; } # # Delete the named rollrec. # rollrec_del($rrn); } # # Close the file handle. # close(ROLLREC_SPLIT); # # If we found some names that aren't in the original rollrec file, # we'll give an error and return the list of bad names. # if(@badnames > 0) { err("invalid rollrec names (@badnames) in split\n",1); return(-5, @badnames); } # # Write the updated rollrec file. # $modified = 1; rollrec_write(); # # Return the number of rollrecs we split into a new rollrec file. # return($rrcnt); } #-------------------------------------------------------------------------- # Routine: rollrec_readfile() # # Purpose: Read the specified rollrec file. The contents are read into # the @rollreclines array and the rollrecs are broken out into # the %rollrecs hash table. # sub rollrec_readfile { my $rfh = shift; # File handle for rollrec file. my $merger = shift; # Merge-rollrec flag. my $name; # Name of the rollrec entry. my $havecmdsalready = 0; # Commands-read flag. my $prevline = 'dummy'; # Previous line. my $mir_start = -1; # Start of merged rollrec. my $mir_found = 0; # Found-info-rollrec flag. my $mir_ir_start = -1; # Start of merged info rollrec. my $mir_version = -1; # Merged rollrec's version. # # If we already have commands loaded, don't reload them. # my @currentcmds = rollmgr_getallqueuedcmds(); $havecmdsalready = 1 if ($#currentcmds > -1); # # If we're starting a rollrec merge, we'll save the beginning # of the new rollrec. # $mir_start = $rollreclen if($merger); # # Grab the lines and pop 'em into the rollreclines array. We'll also # save each rollrec into a hash table for easy reference. # while(<$rfh>) { my $line; # Line from the rollrec file. my $keyword = ""; # Keyword from the line. my $value = ""; # Keyword's value. $line = $_; # # Collapse consecutive blank lines to a single blank. # # This isn't strictly necessary, but it keeps rollrec files # from getting filled with lots of blank lines. # next if(($prevline =~ /^\s*$/) && ($line =~ /^\s*$/)); $prevline = $line; # # Save the line in our array of rollrec lines. # $rollreclines[$rollreclen] = $line; $rollreclen++; # # Skip comment lines and empty lines. # if(($line =~ /^\s*$/) || ($line =~ /^\s*[;#]/)) { next; } # # Grab the keyword and value from the line. The keyword # must be alphabetic. The value can contain alphanumerics, # and a number of punctuation characters. The value *must* # be enclosed in double quotes. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $keyword = $1; $value = $2; # print "rollrec_readfile: keyword <$keyword>\t\t<$value>\n"; # # If the keyword is "roll" or "skip" and we aren't merging # rollrecs, then we're starting a new record. We'll save # the name of the rollrec, and then proceed on to the next # line. # if(($keyword =~ /^roll$/i) || ($keyword =~ /^skip$/i)) { if($merger) { # # If we've found the start of the info rollrec, # we'll save the position and set a flag that # we've found it. # If we've found the start of the next rollrec # after the info rollrec, then we'll remove # info rollrec from @rollreclines. # if($value eq $ROLLREC_INFO) { $mir_ir_start = $rollreclen - 1; $mir_found = 1; next; } elsif($mir_ir_start > -1) { splice @rollreclines, $mir_ir_start, -1; $mir_ir_start = -1; } } $name = $value; # # If this name has already been used for a rollrec, # we'll whinge, clean up, and return. No rollrecs # will be retained. # if(exists($rollrecs{$name})) { rollrec_discard(); err("rollrec_readfile: duplicate record name; aborting...\n",-1); return(-1); } rollrec_newrec($keyword,$name,$rollreclen - 1); next; } elsif($keyword =~ /^cmd$/i) { # # The line is used to issue a specific command to run. # We queue it for later processing. # # print STDERR "rollrec_readfile: processing command: $value / $havecmdsalready\n"; next if($havecmdsalready); my $cmdtoload = $value; my ($cmd, $arg) = ($cmdtoload =~ /^\s*(\w+)\s*(.*)$/); $cmd = "rollcmd_" . $cmd if($cmd !~ /^rollcmd_/); if(rollmgr_verifycmd($cmd) == 0) { err("rollrec_readfile: invalid command $cmdtoload\n", -1); next; } # # Save the command in our queue to process. # rollmgr_queuecmd($cmd, $arg); # # Remove the line from the file to write back out. # pop @rollreclines; next; } # # If we're merging rollrecs and we've found the rollrec # version in the info rollrec, save the version. # Also, we won't be adding anything from the additional # file's info rollrec to the existing info rollrec. # if($merger && ($mir_ir_start > -1) && ($keyword =~ /version/i)) { $mir_version = $value; if($rollrecs{$ROLLREC_INFO}{'version'} < $mir_version) { err("rollrec_readfile: merging rollrecs, version mismatch - $rollrecs{$ROLLREC_INFO}{'version'}, $mir_version\n"); return(-2); } next; } # # Save this zone's zonegroup. # if($keyword =~ /^zonegroup$/i) { $zonegroups{$value}++; } # # Save this subfield into the rollrec's collection. # $rollrecs{$name}{$keyword} = $value; } # # Make sure the last line is a blank line. # if($mir_found && ($mir_version == -1)) { err("rollrec_readfile: info rollrec found, but it contains no version field\n"); return(-3); } # # Make sure the last line is a blank line. # if($rollreclines[-1] !~ /^\s*$/) { push @rollreclines, "\n"; $rollreclen = @rollreclines; } # # If the rollrec doesn't have an info rollrec, we'll prepend a # new one. The hash entries will be added to %rollrecs; the # file lines will be prepended to @rollreclines. # if(!defined($rollrecs{$ROLLREC_INFO})) { my @newinfo = (); # New info rollrec. # # Build the new info rollrec. # $newinfo[0] = "\n"; $newinfo[1] = "skip \"$ROLLREC_INFO\"\n"; $newinfo[2] = " version \"$ROLLREC_CURRENT_VERSION\"\n"; $newinfo[3] = "\n"; # # Add the new info rollrec to our file contents and the # hash of rollrec entries. # unshift @rollreclines, @newinfo; $rollrecs{$ROLLREC_INFO}{'rollrec_type'} = 'skip'; $rollrecs{$ROLLREC_INFO}{'version'} = $ROLLREC_CURRENT_VERSION; # # Set the file-modified flag and we're good to go. # $modified = 1; } # # Build our index of rollrec indices. # buildrrindex(); return(0); } #-------------------------------------------------------------------------- # Routine: rollrec_current() # # Purpose: Return a boolean indicating if this rollrec is current. # Versions 0, 1, and 2 are considered equivalent. # # If this rollrec file's version matches the current rollrec # version, we'll return a true value. # If the file's version is less than the current rollrec # version, we'll return a false value. # If the file's version is greater than the current rollrec # version, we'll return a false value and print an error message. # If the file's version is not in the proper format, we'll # return a false value and print an error message. # # Since the last two conditions shouldn't ever happen, it could # be argued that a failure value should be returned. However, # an easy two-value boolean function was wanted, not a three- # value function. # sub rollrec_current { my $rrvers; # Rollrec's version. # print "rollrec_current: down in ($name)\n"; # # If the rollrec doesn't have a defined version, or there isn't # an info rollrec, then we'll force an out-of-date version. # if(!defined($rollrecs{$ROLLREC_INFO}) || !defined($rollrecs{$ROLLREC_INFO}{'version'})) { return(0); } # # Ensure the rollrec's version has the appropriate format. # $rrvers = $rollrecs{$ROLLREC_INFO}{'version'}; if($rrvers !~ /^[0-9]+\.?[0-9]*$/) { print STDERR "invalid format for rollrec version - \"$rrvers\"\n"; return(0); } # # Return an appropriate boolean for the rollrec file's currency. # if(($rrvers == 0) || ($rrvers == 1) || ($rrvers == $ROLLREC_CURRENT_VERSION)) { return(1); } else { if($rrvers > $ROLLREC_CURRENT_VERSION) { print STDERR "invalid rollrec version - \"$rrvers\"; current version is \"$ROLLREC_CURRENT_VERSION\"\n"; } return(0); } } #-------------------------------------------------------------------------- # Routine: rollrec_info() # # Purpose: Return the informational rollrec. # sub rollrec_info { my $nrec = $rollrecs{$ROLLREC_INFO}; # print "rollrec_info: down in ($name)\n"; return($nrec); } #-------------------------------------------------------------------------- # Routine: rollrec_version() # # Purpose: Return the rollrec's version. If the version is 0, then # we'll bump the number up to 1. # sub rollrec_version { my $rrv = $rollrecs{$ROLLREC_INFO}{'version'}; # print "rollrec_version: down in\n"; $rrv = 1 if($rrv == 0); return($rrv); } #-------------------------------------------------------------------------- # Routine: rollrec_names() # # Purpose: Smoosh the rollrec names into an array and return the array. # The name of the informational rollrec willnot be returned. # sub rollrec_names { my $rrn; # Rollrec name index. my @names = (); # Array for rollrec names. # print "rollrec_names: down in\n"; foreach $rrn (sort(keys(%rollrecs))) { next if($rrn eq $ROLLREC_INFO); push @names, $rrn; } return(@names); } #-------------------------------------------------------------------------- # Routine: rollrec_zonegroups() # # Purpose: Return the zonegroups hash. # sub rollrec_zonegroups { # print "rollrec_zonegroups: down in\n"; return(%zonegroups); } #-------------------------------------------------------------------------- # Routine: rollrec_zonegroup() # # Purpose: Return the zones (rollrec names) in a given zonegroup. # sub rollrec_zonegroup { my $zgname = shift; # Zonegroup to look up. my @zglist = (); # Zones in zonegroup. # print "rollrec_zonegroup: down in\n"; # # Return null if the name isn't defined. # return if(! defined($zgname)); # # Build a list of the zones in this zonegroup. # foreach my $rrn (sort(keys(%rollrecs))) { # # Skip the info rollrec. It shouldn't have a zonegroup, anyway. # next if($rrn eq $ROLLREC_INFO); if($rollrecs{$rrn}{'zonegroup'} eq $zgname) { push @zglist, $rrn; } } # # Return the list. # return(@zglist); } #-------------------------------------------------------------------------- # Routine: rollrec_zonegroup_cmds() # # Purpose: Return the list of commands relevant to zonegroups. # sub rollrec_zonegroup_cmds { # print "rollrec_zonegroup_cmds: down in\n"; return(%zg_commands); } #-------------------------------------------------------------------------- # Routine: rollrec_exists() # # Purpose: Return a flag indicating if the given rollrec exists. # sub rollrec_exists { my $name = shift; # print "rollrec_exists: down in ($name)\n"; # # Skip the info rollrec. # return if($name eq $ROLLREC_INFO); return(exists($rollrecs{$name})); } #-------------------------------------------------------------------------- # Routine: rollrec_fullrec() # # Purpose: Return all entries in a given rollrec. # sub rollrec_fullrec { my $name = shift; my $nrec = $rollrecs{$name}; # print "rollrec_fullrec: down in ($name)\n"; # # Skip the info rollrec. # return if($name eq $ROLLREC_INFO); return($nrec); } #-------------------------------------------------------------------------- # Routine: rollrec_recval() # # Purpose: Return the value of a name/subfield pair. # sub rollrec_recval { my $name = shift; my $field = shift; my $val = $rollrecs{$name}{$field}; # print "rollrec_recval: down in ($name) ($field) ($val)\n"; # # Skip the info rollrec. # return if($name eq $ROLLREC_INFO); return($val); } #-------------------------------------------------------------------------- # Routine: rollrec_rectype() # # Purpose: Change the value of a rollrec. The new value may only be # "roll" or "skip". # # Return Values: # 1 - success # 0 - failure (invalid record type or rollrec not found) # sub rollrec_rectype { my $name = shift; # Name of rollrec we're modifying. my $rectype = shift; # Rollrec's new type. my $rrind; # Rollrec's index. # print STDERR "rollrec_rectype: <$name> <$rectype>\n"; # # Skip the info rollrec. # return(0) if($name eq $ROLLREC_INFO); # # Make sure we've got a valid record type. # return(0) if(($rectype ne "roll") && ($rectype ne "skip")); # # Ensure this is a valid rollrec. # return(0) if(!defined($rollrecindex{$name})); # # Get the rollrec's index. # $rrind = rrindex($name); # # Change the rollrec's type. # $rollreclines[$rrind] =~ s/^(\s*)(roll|skip)(\s+)/$1$rectype$3/i; $rollrecs{$name}{'rollrec_type'} = $rectype; # # Set the modified flag and return success. # $modified = 1; return(1); } #-------------------------------------------------------------------------- # Routine: rollrec_setval() # # Purpose: Set the value of a name/subfield pair. The value is saved # in both %rollrecs and in @rollreclines. The $modified file- # modified flag is updated, along with the length $rollreclen. # sub rollrec_setval { my $name = shift; # Name of rollrec we're modifying. my $field = shift; # Rollrec's subfield to be changed. my $val = shift; # New value for the rollrec's subfield. my $found = 0; # Rollrec-found flag. my $fldind; # Loop index. my $rrind; # Loop index for finding rollrec. my $lastfld = 0; # Last found field in @rollreclines. # print "rollrec_setval: down in\n"; # # Skip the info rollrec. # return(0) if($name eq $ROLLREC_INFO); # # If a rollrec of the specified name doesn't exist, we'll create a # new one. We'll add it to @rollreclines and %rollrecs. # # We'll also assume it's a "roll" type rollrec. # if(!exists($rollrecs{$name})) { # # Add the rollrec to the %rollrecs hash. # rollrec_newrec("roll",$name,$rollreclen + 1); # # Start the new rollrec in @rollreclines. # $rollreclines[$rollreclen] = "\n"; $rollreclen++; $rollreclines[$rollreclen] = "roll\t\"$name\"\n"; $rollrecindex{$name} = $rollreclen; $rollreclen++; } # # Set the new value for the name/field in %rollrecs. # $rollrecs{$name}{$field} = $val; # # Get the index of the rollrec in @rollreclines. # $rrind = rrindex($name); # # Find the specified field's entry in the rollrec's lines in # @rollreclines. We'll skip over lines that don't have a keyword # and dquotes-enclosed value. If we hit the next rollrec then we'll # stop looking and add a new entry at the end of the rollrec's fields. # for($fldind=$rrind+1;$fldind<$rollreclen;$fldind++) { my $line = $rollreclines[$fldind]; # Line in rollrec file. my $lkw; # Line's keyword. my $lval; # Line's value. # # Get the line's keyword and value. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \t]*)"/; $lkw = $1; $lval = $2; # # Skip lines that don't match the expected field/value pattern. # next if($lkw eq ""); # # If we hit the beginning of the next rollrec without # finding the field, drop out and insert it. # last if((lc($lkw) eq "roll") || (lc($lkw) eq "skip")); # # Save the index of the last field we've looked at that # belongs to the rollrec. # $lastfld = $fldind; # # If we found the field, set the found flag, drop out and # modify it. # if(lc($lkw) eq lc($field)) { $found = 1; last; } } # # If we found the entry, we'll modify it in place. # If we didn't find the entry, we'll insert a new line into the array. # if($found) { $rollreclines[$fldind] =~ s/"([a-zA-Z0-9\/\-+_.,: \t]*)"/"$val"/; } else { my $newline = "\t$field\t\t\"$val\"\n"; # # If the keyword is longer than 7 characters, we'll lop out one # of the tabs between the keyword and the value. This is to do # some rough, simple formatting to keep the rollrec file some- # what orderly. This assumes eight-character tabstops. # if(length($field) > 7) { $newline =~ s/\t\t/\t/; } # # If the starting rollrec line is the last line in the file, # we'll just push the new line at the end. If it's somewhere # in the middle, we'll do the magic to insert it at the start # of the rollrec. # my @endarr = splice(@rollreclines,$rrind+1); push(@rollreclines,$newline); push(@rollreclines,@endarr); # # Bump the array length counter. # $rollreclen++; # # Rebuild our table of rollrec indices. # buildrrindex(); } # # Tell the world (or at least the module) that the file has # been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: rollrec_delfield() # # Purpose: Delete a name/subfield pair. The value is deleted from # both %rollrecs and @rollreclines. The $modified file- # modified flag is updated, along with the length $rollreclen. # sub rollrec_delfield { my $name = shift; # Name of rollrec we're modifying. my $field = shift; # Rollrec's subfield to be deleted. my $found = 0; # Rollrec-found flag. my $fldind; # Loop index. my $rrind; # Loop index for finding rollrec. my $lastfld = 0; # Last found field in @rollreclines. # print "rollrec_delfield: down in\n"; # # Skip the info rollrec. # return(0) if($name eq $ROLLREC_INFO); # # Return if a rollrec of the specified name doesn't exist. # return(0) if(!exists($rollrecs{$name})); # # Return if a rollrec of the specified name doesn't have the # specified field. # return(0) if(!exists($rollrecs{$name}{$field})); # # Delete the field from %rollrecs. # delete($rollrecs{$name}{$field}); # # Get the index for the rollrec. # $rrind = rrindex($name); # # Find the specified field's entry in the rollrec's lines in # @rollreclines. We'll skip over lines that don't have a keyword # and dquotes-enclosed value. # for($fldind=$rrind+1;$fldind<$rollreclen;$fldind++) { my $line = $rollreclines[$fldind]; # Line in rollrec file. my $lkw; # Line's keyword. my $lval; # Line's value. # # Get the line's keyword and value. # $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \t]*)"/; $lkw = $1; $lval = $2; # # Go to the next line if this one doesn't match the # field/value pattern. # next if($lkw eq ""); # # If we hit the beginning of the next rollrec without # finding the field, drop out. # last if((lc($lkw) eq "roll") || (lc($lkw) eq "skip")); # # Save the index of the last field we've looked at that # belongs to the rollrec. # $lastfld = $fldind; # # If we found the field, set the found flag, drop out and # modify it. # if(lc($lkw) eq lc($field)) { $found = 1; last; } } # # If we found the entry, we'll delete it and rebuild the # rollrec index table. # if($found) { splice @rollreclines, $fldind, 1; buildrrindex(); } # # Tell the world (or at least the module) that the file has # been modified. # $modified = 1; return(1); } #-------------------------------------------------------------------------- # Routine: rollrec_add() # # Purpose: Adds a new rollrec and fields to %rollrecs and $rollreclines. # sub rollrec_add { my $rrtype = shift; # Rollrec type. my $rrname = shift; # Name of rollrec we're creating. my $flds = shift; # Reference to rollrec fields. my $chronosecs; # Current time in seconds. my $chronostr; # Current time string. my %fields; # Rollrec fields. # print "rollrec_add: down in\n"; # # Skip the info rollrec. # return if($rrname eq $ROLLREC_INFO); # # Get the timestamp. # $chronosecs = time(); $chronostr = gmtime($chronosecs); # # Create the basic rollrec info. # rollrec_newrec($rrtype,$rrname,$rollreclen + 1); # # Add the new rollrec's first line to the end of the rollrec table. # and add an entry to the rollrec index. # $rollreclines[$rollreclen] = "\n"; $rollreclen++; $rollreclines[$rollreclen] = "roll\t\"$rrname\"\n"; $rollrecindex{$rrname} = $rollreclen; $rollreclen++; # # Fill the new rollrec with the caller's hash fields and add it to # the end of the rollrec table. # if(defined($flds)) { %fields = %$flds; foreach my $fn (@ROLLFIELDS) { my $spacing = "\t\t"; # Spacing string. # # Only add the timestamp at the end, and only # add the timestamp we're going to put in. # if(($fn eq 'rollrec_rollsecs') || ($fn eq 'rollrec_rolldate')) { next; } # # If this field isn't defined for the rollrec, # don't add it in. # if(!defined($fields{$fn})) { next; } # # Drop back to a single tab between key and value # if the key name is long. # $spacing = "\t" if(length($fn) > 7); # # Add the field to the hash table and to the rollrec # file contents array. # $rollrecs{$rrname}{$fn} = $fields{$fn}; $rollreclines[$rollreclen] = "\t$fn$spacing\"$fields{$fn}\"\n"; $rollreclen++; } } # # Set a timestamp for this entry. # $rollrecs{$rrname}{'rollrec_rollsecs'} = $chronosecs; $rollrecs{$rrname}{'rollrec_rolldate'} = $chronostr; $rollreclines[$rollreclen] = "\trollrec_rollsecs\t\"$chronosecs\"\n"; $rollreclen++; $rollreclines[$rollreclen] = "\trollrec_rolldate\t\"$chronostr\"\n"; $rollreclen++; # # Put a blank line after the final line of the rollrec. # $rollreclines[$rollreclen] = "\n"; $rollreclen++; # # Mark the rollrec file as having been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: rollrec_del() # # Purpose: Deletes a rollrec and fields from %rollrecs and $rollreclines. # sub rollrec_del { my $rrname = shift; # Name of rollrec we're deleting. my %rollrec; # Rollrec to be deleted. my $rrr; # Rollrec reference. my $ind; # Index into rollreclines. my $rrind; # Index to rollrec's first line. my $line; # Rollrec line from @rollreclines. my $lkey; # Rollrec line's key. my $lval; # Rollrec line's value. my $len; # Length of array slice to delete. # print "rollrec_del: down in\n"; # # Skip the info rollrec. # return(-1) if($rrname eq $ROLLREC_INFO); # # Don't allow empty rollrec names or non-existent rollrecs. # return(-1) if($rrname eq ''); return(-1) if(!defined($rollrecindex{$rrname})); # # Get a copy of the rollrec from the rollrec hash and then delete # the original. # $rrr = $rollrecs{$rrname}; %rollrec = %$rrr; delete $rollrecs{$rrname}; # # Get the index for this rollrec. # $rrind = rrindex($rrname); # # Find the beginning of the next rollrec. # for($ind = $rrind+1; $ind < $rollreclen; $ind++) { $line = $rollreclines[$ind]; $line =~ /^\s*(roll|skip)\s+"([a-zA-Z0-9\/\-+_.,: \t]+)"/i; $lkey = $1; $lval = $2; last if(($lkey eq "roll") || ($lkey eq "skip")); } $ind--; # # Find the end of the previous rollrec (the one to be deleted.) # while($ind > $rrind) { last if($rollreclines[$ind] ne "\n"); $ind--; } # # Delete the rollrec from @rollreclines. # $len = $ind - $rrind + 1; splice(@rollreclines,$rrind,$len); $rollreclen -= $len; # # Fold two consecutive blank lines into one. # if(($rollreclines[$rrind-1] eq "\n") && ($rollreclines[$rrind] eq "\n")) { splice(@rollreclines,$rrind,1); } # # Rebuild our table of rollrec indices. # buildrrindex(); # # Mark that the file has been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: rollrec_rename() # # Purpose: Renames a rollrec. # sub rollrec_rename { my $oldname = shift; # Name of rollrec we're renaming. my $newname = shift; # New name of rollrec. my %rollrec; # Rollrec to be deleted. my $rrr; # Rollrec reference. my $ind; # Index into rollreclines. my $rrind; # Index to rollrec's first line. my $line; # Rollrec line from @rollreclines. my $lkey; # Rollrec line's key. my $lval; # Rollrec line's value. my $len; # Length of array slice to delete. # print "rollrec_rename: down in\n"; # # Skip the info rollrec. # return(-6) if($oldname eq $ROLLREC_INFO); return(-7) if($newname eq $ROLLREC_INFO); # # Don't allow empty rollrec names. # return(-1) if($oldname eq ''); return(-2) if($newname eq ''); # # The old rollrec must exist. # return(-3) if(! exists($rollrecs{$oldname})); # # Don't allow renames to existing rollrec names. # return(-4) if(exists($rollrecs{$newname})); # # Get a copy of the old rollrec. # $rollrecs{$newname} = $rollrecs{$oldname}; # # Change the name field in the new rollrec. # $rollrecs{$newname}{'rollrec_name'} = $newname; $rrr = $rollrecs{$newname}; %rollrec = %$rrr; # # If we didn't find a rollrec with this name, return failure. # return(-5) if(!defined($rollrecindex{name})); # # Get the index of this rollrec. # $rrind = rrindex($oldname); # # Find the beginning of the next rollrec. # $rollreclen = @rollreclines; for($ind = $rrind+1;$ind < $rollreclen; $ind++) { $line = $rollreclines[$ind]; $line =~ /^\s*([a-zA-Z_]+)\s+"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $lkey = $1; $lval = $2; last if($lkey eq "roll"); } $ind--; # # Find the end of the previous rollrec (the one to be deleted.) # while($ind > $rrind) { last if($rollreclines[$ind] ne "\n"); $ind--; } # # Find the rollrec's roll or skip line and change the name. # for(my $i=$rrind; $i <= $ind; $i++) { my $chunk; # Key and spacing from line. $rollreclines[$i] =~ /^(\s*([a-zA-Z_]+)\s+)"([a-zA-Z0-9\/\-+_.,: \@\t]*)"/; $chunk = $1; $lkey = $2; if(($lkey eq 'roll') || ($lkey eq 'skip')) { $rollreclines[$i] = "$chunk\"$newname\"\n"; last; } } # # Delete the old rollrec and the old name's entry in the index hash. # delete $rollrecs{$oldname}; $rollrecindex{$newname} = $rollrecindex{$oldname}; delete $rollrecindex{$oldname}; # # Mark that the file has been modified. # $modified = 1; return(0); } #-------------------------------------------------------------------------- # Routine: rollrec_settime() # # Purpose: Sets the phase-start time in the rollrec. # sub rollrec_settime { my $cnt = @_; # Number of arguments. my $name = shift; # Name of rollrec we're creating. my $val = shift; # Optional argument. my $chronos; # Timestamp for the record. # print "rollrec_settime: down in\n"; # # Skip the info rollrec. # return if($name eq $ROLLREC_INFO); if(($cnt == 2) && ($val == 0)) { $chronos = ''; } else { $chronos = gmtime(); $chronos =~ s/\n$//; } rollrec_setval($name,"phasestart",$chronos); } #-------------------------------------------------------------------------- # Routine: rollrec_newrec() # # Purpose: Creates a rollrec in %rollrecs. The name and type fields # are set. # # This routine is NOT rebuilding the index. Doing this here # has the potential for slowing down file reads and such. # The index is dealt with in those module routines which call # rollrec_newrec(); since it isn't exported, there should be # no outside callers to worry about. # sub rollrec_newrec { my $type = shift; # Type of rollrec we're creating. my $name = shift; # Name of rollrec we're creating. my $line = shift; # Line number of this rollrec. # print "rollrec_newrec: down in\n"; return if(($type ne "roll") && ($type ne "skip")); $rollrecs{$name}{"rollrec_name"} = $name; $rollrecs{$name}{"rollrec_type"} = $type; $rollrecindex{$name} = $line; } #-------------------------------------------------------------------------- # Routine: rollrec_fields() # # Purpose: Return the list of rollrec fields. # sub rollrec_fields { # print "rollrec_fields: down in\n"; return(@ROLLFIELDS); } #-------------------------------------------------------------------------- # Routine: rollrec_default() # # Purpose: Return the default rollrec file. # sub rollrec_default { my $confdir; # Configuration directory. my $defrr; # Default rollrec name. # print "rollrec_default: down in\n"; # # Get the DNSSEC-Tools config directory. # $confdir = getconfdir() || $DEFAULT_DNSSECTOOLS_DIR; # # Build our lock file. # $defrr = "$confdir/$DEFAULT_ROLLREC"; return($defrr); } #-------------------------------------------------------------------------- # Routine: rollrec_init() # # Purpose: Initialize the internal data. # sub rollrec_init { # print "rollrec_init: down in\n"; %rollrecs = (); %zonegroups = (); %rollrecindex = (); @rollreclines = (); $rollreclen = 0; $modified = 0; } #-------------------------------------------------------------------------- # Routine: rollrec_discard() # # Purpose: Discard the current rollrec file -- don't save the contents, # don't delete the file, reset all internal fields. # sub rollrec_discard { # print "rollrec_discard: down in\n"; close(ROLLREC); rollrec_init(); } #-------------------------------------------------------------------------- # Routine: rollrec_close() # # Purpose: Save the roll record file and close the descriptor. # sub rollrec_close { # print "rollrec_close: down in\n"; rollrec_write(); close(ROLLREC); } #-------------------------------------------------------------------------- # Routine: rollrec_write() # # Purpose: Save the roll record file and leave the file handle open. # We'll get an exclusive lock on the rollrec file in order # to (try to) ensure we're the only ones writing the file. # # We'll make a (hopefully atomic) copy of the in-core rollrec # lines prior to trying to write. This is an attempt to # keep the data from being mucked with while we're using it. # sub rollrec_write { my $writecmds = shift; # Boolean for saving unexecuted commands. my $rrc = ""; # Concatenated rollrec file contents. my $ofh; # Old file handle. my @rrlines = @rollreclines; # Copy of The Rollrec. my $rrlen; # Number of lines in The Rollrec. # print STDERR "rollrec_write: down in\n"; my @currentcmds = rollmgr_getallqueuedcmds(); # # If the file hasn't changed, we'll skip writing. # return if(!$modified && ($#currentcmds == -1)); # # Make sure we've got the correct count of rollrec lines. # $rrlen = @rrlines; # # Loop through the array of rollrec lines and concatenate them all. # for(my $ind = 0; $ind < $rrlen; $ind++) { $rrc .= $rrlines[$ind]; } # # Remember any unprocessed queue commands. # if($writecmds) { foreach my $cmdandvalue (rollmgr_getallqueuedcmds()) { my ($cmd, $value) = @$cmdandvalue; $cmd =~ s/^rollcmd_//; $rrc .= "cmd \"$cmd $value\"\n"; } } # # Lock the rollrec file. # flock(ROLLREC,LOCK_EX); # # Force immediate writes of ROLLREC. # $ofh = select ROLLREC; $| = 1; # # Zap the rollrec file and write out the new one. # seek(ROLLREC,0,0); truncate(ROLLREC,0); print ROLLREC $rrc; # # Reset ROLLREC buffering to original state. # select $ofh; # # Unlock the rollrec file. # return(flock(ROLLREC,LOCK_UN)); } #-------------------------------------------------------------------------- # Routine: buildrrindex() # # Purpose: This routine builds a name->index hash table for the defined # rollrecs. The name is the name of a rollrec. The index is # that rollrec's index in the @rollreclines array. This hash # table drastically speeds up the reference time over the old # method of searching the whole table. # sub buildrrindex { # print "buildrrindex: down in\n"; # # Zap the current rollrec index. # %rollrecindex = (); # # Traipse through @rollreclines, and save the line index for the # start of each rollrec. # for(my $rrind=0;$rrind<$rollreclen;$rrind++) { my $line = $rollreclines[$rrind]; # Line in rollrec file. my $rrname; # Rollrec name. # # Dig out the line's keyword and value. # $line =~ /^\s*(roll|skip)\s+"([a-zA-Z0-9\/\-+_.,: \t]+)"/i; $rrname = $2; # # If this is a roll or skip line, save the line index for # this rollrec entry. # if($rrname ne '') { $rollrecindex{$rrname} = $rrind; } } } #-------------------------------------------------------------------------- # Routine: rrindex() # # Purpose: Get the index for the named rollrec entry. We'll first # consult the name's existing index to @rollreclines. If the # name matches, all's well. If it doesn't, then we'll rebuild # the index hash and then get the table index. # # Callers MUST have already checked that the rollrec name # exists. Arguably, this should be done here, but it isn't. # sub rrindex { my $name = shift; # Rollrec to look up. my $rrind; # Rollrec's index. my $line; # Supposed start of rollrec. my $lname; # Name from line. # # Find the index for this rollrec in @rollreclines. # $rrind = $rollrecindex{$name}; # # Get the line we're expecting this rollrec to start with. # $line = $rollreclines[$rrind]; # # Dig out the rollrec name from this line. # $line =~ /^\s*(roll|skip)\s+"([a-zA-Z0-9\/\-+_.,: \t]+)"/i; $lname = $2; # # If this name doesn't match the requested name, we'll rebuild # the index and call ourself to find the index. # # This should never fail, as long as the caller already ensured # the rollrec name is valid. # if($lname ne $name) { buildrrindex(); $rrind = rrindex($name); } # # Give the rollrec's index back to our caller. # return($rrind); } #-------------------------------------------------------------------------- # Routine: rollrec_dump_hash() # # Purpose: Dump the parsed rollrec entries. # sub rollrec_dump_hash { # print "rollrec_dump_hash: down in\n"; # # Loop through the hash of rollrecs and print the rollrec names, # subfields, and values. # foreach my $k (sort(keys(%rollrecs))) { print "rollrec - $k\n"; my $subp = $rollrecs{$k}; my %subrecs = %$subp; foreach my $sk (sort(keys(%subrecs))) { print "\t$sk\t\t$subrecs{$sk}\n"; } print "\n"; } } #-------------------------------------------------------------------------- # Routine: rollrec_dump_array() # # Purpose: Display the contents of @rollreclines. # sub rollrec_dump_array { # print "rollrec_dump_array: down in\n"; # # Loop through the array of rollrec lines and print them all. # for(my $ind=0;$ind<$rollreclen;$ind++) { print $rollreclines[$ind]; } } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::rollrec - Manipulate a DNSSEC-Tools rollrec file. =head1 SYNOPSIS use Net::DNS::SEC::Tools::rollrec; rollrec_lock(); rollrec_read("localhost.rollrec"); $valid = rollrec_current(); $rrinfo = rollrec_info(); @rrnames = rollrec_names(); $flag = rollrec_exists("example.com"); $rrec = rollrec_fullrec("example.com"); %rrhash = %$rrec; $zname = $rrhash{"maxttl"}; $val = rollrec_recval("example.com","zonefile"); rollrec_add("roll","example.com",\%rollfields); rollrec_add("skip","example.com",\%rollfields); rollrec_del("example.com"); rollrec_rename("example.com","subdom.example.com"); rollrec_type("example.com","roll"); rollrec_type("example.com","skip"); rollrec_setval("example.com","zonefile","db.example.com"); rollrec_delfield("example.com","directory"); rollrec_settime("example.com"); rollrec_settime("example.com",0); @rollrecfields = rollrec_fields(); $default_file = rollrec_default(); $count = rollrec_merge("primary.rrf", "new0.rrf", "new1.rrf"); @retvals = rollrec_split("new-rollrec.rrf", @rollrec_list); %zgroups = rollrec_zonegroups(); @zgroup = rollrec_zonegroup($zonegroupname); @zgcmds = rollrec_zonegroup_cmds(); rollrec_write(); rollrec_close(); rollrec_discard(); rollrec_unlock(); =head1 DESCRIPTION The B module manipulates the contents of a DNSSEC-Tools I file. I files describe the status of a zone rollover process, as performed by the DNSSEC-Tools programs. Module interfaces exist for looking up I records, creating new records, and modifying existing records. A I file is organized in sets of I records. Is describe the state of a rollover operation. A I consists of a set of keyword/value entries. The following is an example of a I: roll "example" zonename "example.com" zonefile "/etc/dnssec-tools/zones/db.example.com" keyrec "/etc/dnssec-tools/keyrec/example.keyrec" zonegroup "example zones" directory "/etc/dnssec-tools/dir-example.com" kskphase "0" zskphase "2" maxttl "86400" administrator "bob@bobhost.example.com" phasestart "Wed Mar 09 21:49:22 2005" display "0" loglevel "info" rollrec_rollsecs "1115923362" rollrec_rolldate "Tue Mar 09 19:12:54 2005" curerrors 0 maxerrors 5 # optional records: istrustanchor "yes" holddowntime "8W" Additionally, commands to be acted upon at start-up can be defined using the "cmd" token as shown in the following example. cmd "rollzsk example.com" Use this feature with caution and only if you understand the internals of B and I what will be done by the specified command. The first step in using this module must be to read the I file. The I interface reads the file and parses it into an internal format. The file's records are copied into a hash table (for easy reference by the B routines) and in an array (for preserving formatting and comments.) After the file has been read, the contents are referenced using I and I. The I, I, and I interfaces are used to modify the contents of a I record. If the I file has been modified, it must be explicitly written or the changes will not saved. I saves the new contents to disk. I saves the file and close the Perl file handle to the I file. If a I file is no longer wanted to be open, yet the contents should not be saved, I gets rid of the data closes and the file handle B saving any modified data. On reading a I file, consecutive blank lines are collapsed into a single blank line. As I entries are added and deleted, files merged and files split, it is possible for blocks of consecutive blanks lines to grow. This blank-line collapsing will prevent these blocks from growing excessively. There is a special I called the I. It contains information about the I file, such as the version of Is stored within the file. It is only accessible through the I interface, and the I interface will indicate if the file's version number is current. =head1 ROLLREC LOCKING This module includes interfaces for synchronizing access to the I files. This synchronization is very simple and relies upon locking and unlocking a single lock file for all I files. I locking is not required before using this module, but it is recommended. The expected use of these facilities follows: rollrec_lock() || die "unable to lock rollrec file\n"; rollrec_read(); ... perform other rollrec operations ... rollrec_close(); rollrec_unlock(); Synchronization is performed in this manner due to the way the module's functionality is implemented, as well as providing flexibility to users of the module. It also provides a clear delineation in callers' code as to where and when I locking is performed. This synchronization method has the disadvantage of having a single lockfile as a bottleneck to all I file access. However, it reduces complexity in the locking interfaces and cuts back on the potential number of required lockfiles. Using a single synchronization file may not be practical in large installations. If that is found to be the case, then this will be reworked. =head1 ROLLREC INTERFACES The interfaces to the B module are given below. =over 4 =item I This routine adds a new I to the I file and the internal representation of the file contents. The I is added to both the I<%rollrecs> hash table and the I<@rollreclines> array. Entries are only added if they are defined for Is. I is the type of the I. This must be either "roll" or "skip". I is the name of the I. I is a reference to a hash table that contains the name/value I fields. The keys of the hash table are always converted to lowercase, but the entry values are left as given. Timestamp fields are added at the end of the I. These fields have the key values I and I. A blank line is added after the final line of the new I. The I file is not written after I, though it is internally marked as having been modified. =item I This interface saves the internal version of the I file (opened with I) and closes the file handle. =item I This routine returns a boolean indicating if this open rollrec is current, as defined by the version number in the I. Versions 0, 1, and 2 are considered to be equivalent. Return values are: 1 rollrec is current 0 rollrec is obsolete 0 rollrec has an invalid version The last condition shouldn't ever happen and it could be argued that a failure value should be returned. However, an easy two-value boolean function was wanted, not a three-value function. =item I This routine deletes a I from the set of Is loaded into memory by the B module. The I is deleted from both the I<%rollrecs> hash table and the I<@rollreclines> array. The I file is not written after I, though the collection of Is is internally marked as having been modified. Only the I itself is deleted. Any associated comments and blank lines surrounding it are left intact. Return values are: 0 successful rollrec deletion -1 unknown name =item I Deletes the given field from the specified I. The file is B written after updating the value, but the internal file-modified flag is set. The value is saved in both I<%rollrecs> and in I<@rollreclines>. Return values: 0 - failure (rollrec not found or rollrec does not contain the field) 1 - success =item I This routine removes a I file from use by a program. The internally stored data are deleted and the I file handle is closed. However, modified data are not saved prior to closing the file handle. Thus, modified and new data will be lost. =item I This routine returns a boolean flag indicating if the I named in I exists. =item I I returns a reference to the I specified in I. =item I I returns a reference to the I given in the current file. This interface is the only way for a calling program to retrieve this information. =item I I locks the I lockfile. An exclusive lock is requested, so the execution will suspend until the lock is available. If the I synchronization file does not exist, it will be created. If the process can't create the synchronization file, an error will be returned. Success or failure is returned. =item I This interface merges the specified I files. It reads each file and parses them into a I hash table and a file-contents array. The resulting merge is written to the file named by I. If another I is already open, it is saved and closed prior to opening the new I. If I is an existing I file, its contents will be merged with the other files passed to I. If the file does not exist, I will create it and merge the remaining files into it. The I can affect how the merging will work. If the I is doesn't exist or is empty, then a simple I will be added to the file. No part of the Is will be merged into that of the I. If the file does exist but doesn't have an I B, then then the source's I is copied to the target. The files' Is must either have the same version or the versions must all be less than the version of the I. Upon success, I returns the number of Is read from the file. Failure return values: -1 no rollrec files were given to rollrec_merge -2 unable to create target rollrec file -3 unable to read first rollrec file -4 an error occurred while reading the rollrec names -5 rollrec files were duplicated in the list of rollrec files =item I This routine returns a list of the I names from the file. The name of the I is not included in this list. =item I This interface reads the specified I file and parses it into a I hash table and a file-contents array. I B be called prior to any of the other B calls. If another I is already open, it is saved and closed prior to opening the new I. I attempts to open the I file for reading and writing. If this fails, then it attempts to open the file for reading only. I is a front-end for I. It sets up the module's saved data in preparation for reading a new I file. These house-keeping actions are not performed by I. Upon success, I returns the number of Is read from the file. Failure return values: -1 specified rollrec file doesn't exit -2 unable to open rollrec file -3 duplicate rollrec names in file =item I This interface reads the specified file handle to a I file and parses the file contents into a I hash table and a file-contents array. The hash table and file-contents array are B cleared prior to adding data to them. The I argument indicates whether the call will be merging a I file with a previously read I or if it will be reading a fresh I file. Upon success, I returns zero. Failure return values: -1 duplicate rollrec names in file =item I Set the type of the specified I record. The file is B written after updating the value, but the internal file-modified flag is set. The value is saved in both I<%rollrecs> and in I<@rollreclines>. I is the name of the I that will be modified. I is the new type of the I, which must be either "roll" or "skip". Return values: 0 - failure (invalid record type or rollrec not found) 1 - success =item I This routine returns the value of a specified field in a given I. I is the name of the particular I to consult. I is the field name within that I. For example, the current I file contains the following I. roll "example.com" zonefile "db.example.com" The call: rollrec_recval("example.com","zonefile") will return the value "db.example.com". =item I This routine renames the I named by I to I. The actual effect is to change the name in the I or I line to I. The name is changed in the internal version of the the I file only. The file itself is not changed, but must be saved by calling either I, I, or I. I must be the name of an existing I. Conversely, I must not name an existing I. Return values: 0 - success -1 - old_rollrec_name was null or empty -2 - new_rollrec_name was null or empty -3 - old_rollrec_name is not an existing rollrec -4 - new_rollrec_name is already a rollrec -5 - internal error that should never happen =item I Set the phase-start timestamp in the I specified by I to the current time. If the optional I parameter is given and it is zero, then the phase-start timestamp is set to a null value. The file is B written after updating the value. =item I Set the value of a name/field pair in a specified I. The file is B written after updating the value, but the internal file-modified flag is set. The value is saved in both I<%rollrecs> and in I<@rollreclines>. I is the name of the I that will be modified. If the named I does not exist, it will be created as a "roll"-type I. I is the I field which will be modified. I is the new value for the field. =item I Move a set of I entries from the current I file to a new file. The moved I entries are removed both from the current file and from the internal module data representing that file. The I parameter holds the name of the new I file. If this file doesn't exist, it will be created. If it does exist, the I entries will be appended to that file. I is a list of I entries that will be moved from the current file to the file named in I. If some of the given I names are invalid, the valid names will be moved to the new file and the invalid names will be returned in a list to the caller. Only the I entries themselves will be moved to the new I file. Any associated comments will be left in the current I file. I-splitting gets interesting with the addition of the I. If the I file doesn't exist, the source B file's I is copied to the target file. If the file does exist but doesn't have an I, then then the source's I is copied to the target. If the target file exists and has an I, then the two files must have matching version numbers. On success, the count of moved I entries is returned. Error returns are given below. Failure return values: -1 - no target rollrec file given in new_rollrec_file -2 - no rollrec names given in rollrec_names -3 - none of the rollrec names given are existing rollrecs -4 - unable to open new_rollrec_file -5 - invalid rollrec names were specified in rollrec_names, followed by the list of bad names -6 - target's info rollrec has previous version than current -7 - target's info rollrec has (undefined) later version than current -8 - target's info rollrec exists without version number =item I I unlocks the I synchronization file. =item I This interface saves the internal version of the I file (opened with I). It does not close the file handle. As an efficiency measure, an internal modification flag is checked prior to writing the file. If the program has not modified the contents of the I file, it is not rewritten. I gets an exclusive lock on the I file while writing. =item I This interface returns a list of the zones in the zonegroup (named by I<$zonegroupname>) defined in the current I file. Null is returned if there are no zones in the zonegroup. While this is using the term "zone", it is actually referring to the name of the rollrec entries. For a particular rollrec entry, the rollrec name is usually the same as the zone name, but this is not a requirement. =item I This interface returns a list of the rollctl commands whose behavior changes when they are used with the I<-group> option. =item I This interface returns a hash table of the zonegroups defined in the current I file. The hash key is the name of the zonegroup; the hash value is the number of zones in the zonegroup. Null is returned if there are no zonegroups in the I file. While this is using the term "zone", it is actually referring to the name of the rollrec entries. For a particular rollrec entry, the rollrec name is usually the same as the zone name, but this is not a requirement. =back =head1 ROLLREC INTERNAL INTERFACES The interfaces described in this section are intended for internal use by the B module. However, there are situations where external entities may have need of them. Use with caution, as misuse may result in damaged or lost I files. =over 4 =item I This routine initializes the internal I data. Pending changes will be lost. An open I file handle will remain open, though the data are no longer held internally. A new I file must be read in order to use the B interfaces again. =item I This routine returns the name of the default I file. =back =head1 ROLLREC DEBUGGING INTERFACES The following interfaces display information about the currently parsed I file. They are intended to be used for debugging and testing, but may be useful at other times. =over 4 =item I This routine prints the I file as it is stored internally in a hash table. The Is are printed in alphabetical order, with the fields alphabetized for each I. New Is and I fields are alphabetized along with current Is and fields. Comments from the I file are not included with the hash table. =item I This routine prints the I file as it is stored internally in an array. The Is are printed in the order given in the file, with the fields ordered in the same manner. New Is are appended to the end of the array. I fields added to existing Is are added at the beginning of the I entry. Comments and vertical whitespace are preserved as given in the I file. =back =head1 COPYRIGHT Copyright 2006-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B, B, B B, B =cut dnssec-tools-2.2/tools/modules/conf.pm.in0000664000237200023720000006153712544611342020640 0ustar hardakerhardaker# -*- perl -*- # Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING # file distributed with this software for details # # DNSSEC Tools # # DNSSEC-Tools configuration routines. # # The routines in this module perform configuration operations. # Some routines access the DNSSEC-Tools configuration file, while # others validate the execution environment. # # Entries in the configuration file are of the "key value" format. # Comments may be included by prefacing them with the '#' or ';' # comment characters. # # An example configuration file follows: # # # Sample configuration entries. # algorithm rsasha1 # Encryption algorithm. # ksk_length 2048 ; KSK key length. # package Net::DNS::SEC::Tools::conf; require Exporter; use strict; our $VERSION = "2.1"; our $MODULE_VERSION = "2.1.0"; our @ISA = qw(Exporter); our @EXPORT = qw( boolconvert cmdcheck dt_confcheck getconfdir getconffile setconffile getlocalstatedir makelocalstatedir getprefixdir parseconfig runpacked erraction err ERR_EXIT ERR_MSG ERR_SILENT ); our @COMMANDS = qw( keyarch keygen rndc rollchk zonecheck zonesign zonesigner ); our %CMD_PACKAGES = ( "dnssec-keygen" => "BIND (9.3.1 or later)", "rndc" => "BIND (9.3.1 or later)", "named-checkzone" => "BIND (9.3.1 or later)", "dnssec-signzone" => "BIND (9.3.1 or later)", "keyarch" => "DNSSEC-Tools (1.4 or later)", "rollctl" => "DNSSEC-Tools (1.4 or later)", "rollerd" => "DNSSEC-Tools (1.4 or later)", "zonesigner" => "DNSSEC-Tools (1.4 or later)", ); our $prefixdir = $ENV{'DT_PREFIX'} || "@prefix@"; our $sysconfdir = $ENV{'DT_SYSCONFDIR'} || "@expanded_sysconfdir@"; # Local state directory. our $STATEDIR = $ENV{'DT_STATEDIR'} || "@expanded_localstatedir@"; our $CONFFILE = "${sysconfdir}/dnssec-tools/dnssec-tools.conf"; # Configuration file. our $conffile = $CONFFILE; ############################################################################### # # Error actions this is intended for use by DNSSEC-Tools library routines. # my $ERR_SILENT = 1; # Don't do anything on error. my $ERR_MSG = 2; # Print a message on error. my $ERR_EXIT = 3; # Print a message and exit. my $erraction = $ERR_SILENT; # Action to take on errors. sub ERR_EXIT { return($ERR_EXIT); }; sub ERR_MSG { return($ERR_MSG); }; sub ERR_SILENT { return($ERR_SILENT); }; #-------------------------------------------------------------------------- # # Routine: parseconfig() # # Purpose: Read a configuration file and parse it into pieces. The # lines are tokenized and then stored in the config hash table. # # Config entries are of the "variable value" form. The first # non-blank token is taken as the name of the configuration # parameter and is the hash key into %dnssec_conf. Anything # after that token is put into a space-separated tokenized form # and added to the %dnssec_conf. If a line contains a comment # character (a '#' or a ';') then anything from that character # to the end of the line is ignored. Empty lines and lines # starting with a comment character are entirely ignored. # sub parseconfig { my $numargs = @_; my %dnssec_conf = (); # # Find the right configuration file to open. # my $conffiletoread = $conffile; if($numargs != -1) { $conffiletoread = shift; # allow for an undefined argument to still read the default $conffiletoread = $conffile if (!defined($conffiletoread)); } # # Make sure the config file actually exists. If not, # we'll quietly return. # return if(! -e $conffiletoread); # # Open up the config file. # if(open(CONF,"< $conffiletoread") == 0) { err("unable to open $conffiletoread\n",-1); return; } # # Read each line from the file, tokenize the line, and add it # to the config hash table. # while() { my $arrlen; # Length of the token array. my $val = ""; # Concatenated value tokens. my $var; # Variable token. my @arr; # Array of tokens from the config line. # # Split the line into a pile of tokens. # chop; @arr = split(/[ \t]/); $arrlen = @arr; $var = shift @arr; # # Skip any comments. # if(($var =~ /^[;#]/) || ($var eq "")) { next; } # # Concatenate the remaining tokens, separated by a single # space. If we hit a comment character, we'll stop there. # We could use join() instead of an explicit loop, but this # way we get to have mid-line comments. # for(my $ind=0;$ind<$arrlen;$ind++) { my $newval = $arr[$ind]; # New value chunk. last if($newval =~ /^[#;]/); next if(($newval eq "") || ($newval =~ /[ \t]+/)); $newval =~ s/^[ \t]+//; $newval =~ s/[ \t]+$//; $val .= $newval . " "; } # # Get rid of any leading or trailing spaces. # $val =~ s/^[ \t]*//; $val =~ s/[ \t]*$//; # # Add this variable/value pair to the configuration hash table. # $dnssec_conf{$var} = $val; } # # Close the configuration file and return the config hash. # close(CONF); return(%dnssec_conf); } ####################################################################### # # Routine: cmdcheck() # # Purpose: Ensure that the needed commands are available and executable. # If any of the commands either don't exist or aren't executable, # then an error message will be given and the process will exit. # If all is well, everything will proceed quietly onwards. # # When running packed, we'll force the command paths to be in # the package directory. We'll also make them executable, since # PAR seems to ignore original file permissions. # # Things that make you go "hmmm....": # Is it *really* a good idea for a library routine # to exit on error, rather than just giving an # error return? # sub cmdcheck { my $ropts = shift; # Options hash reference. my %opts = %$ropts; # Options hash. my $cmd; # Command path. my $packed = runpacked(); # Packed-running flag. # # Check each of these commands for existence and executability. # foreach my $bcmd (@COMMANDS) { my $pkg; # Package for this command. # # Only check the defined commands. # next if(!exists($opts{$bcmd})); $cmd = $opts{$bcmd}; # # If we're running packed, check for the packed version of # the command. # if($packed) { $cmd = "$ENV{'PAR_TEMP'}/inc/$cmd"; } # # Get the package for this command name. # $pkg = $CMD_PACKAGES{$opts{$bcmd}}; # # Check command name's existence. # if($cmd eq "") { err("command \"$bcmd\" does not exist; please install $pkg\n",3); return(0); } # # Check command's existence. # if(! -e $cmd) { err("command \"$cmd\" does not exist; please install $pkg\n",3); return(0); } # # If we're running packed, force the packed BIND files # to be executable. # if($packed) { chmod 0755, $cmd; } # # Check command's executability. # if(! -x $cmd) { err("$cmd not executable\n",3); return(0); } } return(1); } ####################################################################### # # Routine: dt_confcheck() # # Purpose: Ensure that some required conditions are met by the # DNSSEC-Tools configuration. A running count of violated # conditions is kept, and that count is the return code. # An err() error message may (or may not) be printed. # # The following tests will be run: # # - The dnssec-tools sysconf directory exists. # - The dnssec-tools sysconf directory is a directory. # - The dnssec-tools directory exists. # - The dnssec-tools directory is a directory. # - The dnssec-tools config file exists. # - The dnssec-tools config file is a regular file. # - The dnssec-tools config file isn't empty. # - The local state directory name isn't longer than 75 # characters (to allow for the rollmgr command socket.) # - The local state directory is a directory. # - The local state directory can be created if necessary. # - The local state directory's dnssec-tools subdirectory # can be created if necessary, or is writable if it # already exists. # - The local state directory's run subdirectory can be # created if necessary, or is writable if it already # exists. # # Return Values: # 0 - no errors were found # > 0 - some number of configuration checks failed # sub dt_confcheck { my $errout = shift; # Error output flag. my $olderr; # Old error flag. my $ret = 0; # Return code. my $sdir; # Local state directory. # # Set the error flag according to the $errout argument. # $olderr = $errout ? ERR_MSG : ERR_SILENT; $olderr = erraction($olderr); # # Ensure the DNSSEC-Tools system config directory exists and is # a directory. # if(! -e $sysconfdir) { err("$sysconfdir does not exist\n",1); $ret++; } elsif(! -d $sysconfdir) { err("$sysconfdir is not a directory\n",1); $ret++; } # # Ensure the DNSSEC-Tools config directory exists and is a directory. # if(! -e "$sysconfdir/dnssec-tools") { err("$sysconfdir/dnssec-tools does not exist\n",1); $ret++; } elsif(! -d "$sysconfdir/dnssec-tools") { err("$sysconfdir/dnssec-tools is not a directory\n",1); $ret++; } # # Ensure the DNSSEC-Tools config file exists and is a file. # if(! -e $CONFFILE) { err("$CONFFILE does not exist\n",1); $ret++; } elsif(! -f $CONFFILE) { err("$CONFFILE is not a regular file\n",1); $ret++; } elsif(-z $CONFFILE) { err("$CONFFILE is empty\n",1); $ret++; } # # The local state directory must be shorter than 76 characters to # allow for the rollmgr command socket. # # This only matters for rollerd and rollctl. They use a Unix domain # socket, which has a hard-coded maximum length of 104 characters. # The local state directory name is appended with # "/dnssec-tools/rollmgr.socket", so the two combined must be no more # than 104 bytes. # $sdir = getlocalstatedir(); if(length($sdir) > 76) { err("local state directory name is too long, it must be less than 77 characters\n",1); $ret++; } # # Run a bunch of checks on the local state directory. If it doesn't # exist, we'll make sure the parent is writable so that we'll be # able to create it. If it does exist, we'll make sure that the # directories already exist, may be created if they don't exist, and # are writable if they do exist. # if(-e $sdir) { # # Ensure the local state directory is a directory. # if(! -d "$sdir") { err("\"$sdir\" is not a directory\n",0); $ret++; } else { # # If we can't write the local state directory, we'll # ensure its subdirectories exist and are writable. # if(! -w "$sdir") { if(! -e "$sdir/dnssec-tools") { err("unable to create $sdir/dnssec-tools\n",0); $ret++; } elsif(! -w "$sdir/dnssec-tools") { err("unable to write $sdir/dnssec-tools\n",0); $ret++; } if(! -e "$sdir/run") { err("unable to create $sdir/run\n",0); $ret++; } elsif(! -w "$sdir/run") { err("unable to write $sdir/run\n",0); $ret++; } } else { # # If we can write the local state directory, # we'll be sure its subdirectories are writable # if they already exist. # if(( -e "$sdir/dnssec-tools") && (! -w "$sdir/dnssec-tools")) { err("$sdir/dnssec-tools is not writable\n",0); $ret++; } if(( -e "$sdir/run") && (! -w "$sdir/run")) { err("$sdir/run is not writable\n",0); $ret++; } } } } else { my $pdir = $sdir; # State directory's parent. # # If the local state directory doesn't exist, we'll make # sure we can write its parent. # $pdir =~ s/(\/[^\/]*?)$/\//; if(! -w $pdir) { err("unable to create state directory $sdir\n",0); $ret++; } } # # Reset the error flag to its previous value. # erraction($olderr); # # Return the count of failed tests. # return($ret); } ####################################################################### # # Routine: boolconvert() # # Purpose: Converts a textual boolean value from the configuration file # into a numeric boolean. # sub boolconvert { my $bval = shift; # Boolean to convert. # # Handle the simple case of zero. # return(0) if($bval eq "0"); # # Now deal with the acceptable false text cases. # return(0) if(($bval =~ /no/i) || ($bval =~ /n/i) || ($bval =~ /f/i) || ($bval =~ /false/i)); # # Next we'll handle the acceptable true text cases. # return(1) if(($bval =~ /yes/i) || ($bval =~ /y/i) || ($bval =~ /t/i) || ($bval =~ /true/i)); # # And now the positive values. # return(1) if($bval > 0); # # Anything else is false. return(0); } ####################################################################### # # Routine: getprefixdir() # # Purpose: Return the prefix directory name. # sub getprefixdir { my $dir; # DNSSEC-Tools prefix directory. $dir = $prefixdir; return($dir); } ####################################################################### # # Routine: getconfdir() # # Purpose: Return the configuration directory name. # sub getconfdir { my $dir; # DNSSEC-Tools configuration directory. $conffile =~ /^(.*)\/.*$/; $dir = $1; return($dir); } ####################################################################### # # Routine: getconffile() # # Purpose: Return the configuration file name. # sub getconffile { return($conffile); } ####################################################################### # # Routine: setconffile() # # Purpose: Set the configuration file name. # sub setconffile { my $newconf = shift; return(0) if(! -f $newconf); $conffile = $newconf; return(1); } ####################################################################### # # Routine: getlocalstatedir() # # Purpose: Return the local state directory name. # sub getlocalstatedir { return($STATEDIR); } ####################################################################### # # Routine: runpacked() # # Purpose: Return a boolean indicating we're running packed or regular. # sub runpacked { return(defined($ENV{'PAR_TEMP'})); } ####################################################################### # # Routine: makelocalstatedir(subpath) # # Purpose: Create the local state directory (and an optional) subdirectory) # and return its name. Create the directory/subdirectory iff it # doesn't exist and if the File::Path module is available. # sub makelocalstatedir { my $subdir = shift; # Optional subdirectory. my $statedir = getlocalstatedir(); # Local state directory. my $subpath = $statedir; # Path w/ subdirectory. my $errorlist; # Path creation errors. # # Build the path to the caller's subdirectory. # $subpath = "$statedir/$subdir" if(defined($subdir)); # # Return success if the path exists and is a directory. # Return failure if the path exists and isn't a directory. # if(-e $subpath) { return($subpath) if(-d $subpath); return(''); } # # If File::Path is unavailable, we'll return an error. # if((eval { require File::Path; }) != 1) { print STDERR "Perl module File::Path is required, but could not be found\n"; exit(1); } import File::Path; # # Create the subdirectory. # mkpath($subpath, { error => \$errorlist }); # # Display error messages for any problems encountered and # return an error. # if($#$errorlist > -1) { my $errstr = ''; # Error string. $errstr = "Errors creating path: $subpath:\n"; $errstr .= " (set DT_STATEDIR to change the location)\n"; foreach my $err (@$errorlist) { my ($file, $msg) = each %$err; $errstr .= " $file: $msg\n"; } err($errstr,1); } # # Return the path of the subdirectory. # return($subpath); } ####################################################################### # # Routine: erraction() # # Purpose: Set the action to take on error. # sub erraction { my $newact = shift; # Action to take on error. my $curact; # Current error action. # # Save the current error action. # $curact = $erraction; # # If this is a valid error action, we'll set the action. # if(($newact == $ERR_SILENT) || ($newact == $ERR_MSG) || ($newact == $ERR_EXIT)) { $erraction = $newact; } # # Return the saved action. # return($curact); } ####################################################################### # # Routine: err() # # Purpose: Report an error. Maybe. # sub err { my $errstr = shift; # Error message. my $errret = shift; # Error return code. return if($erraction == $ERR_SILENT); print STDERR "$errstr"; exit($errret) if(($erraction == $ERR_EXIT) && ($errret >= 0)); } 1; ############################################################################# =pod =head1 NAME Net::DNS::SEC::Tools::conf - DNSSEC-Tools configuration routines. =head1 SYNOPSIS use Net::DNS::SEC::Tools::conf; %dtconf = parseconfig(); %dtconf = parseconfig("localzone.keyrec"); cmdcheck(\%options_hashref); $conferrs = dt_confcheck(); $prefixdir = getprefixdir(); $confdir = getconfdir(); $conffile = getconffile(); setconffile("dt-local.conf"); $statedir = getlocalstatedir(); $statedir = makelocalstatedir(); $statesub = makelocalstatedir("logs/zones"); $packed = runpacked(); erraction(ERR_MSG); err("unable to open keyrec file",1); =head1 DESCRIPTION The routines in this module perform configuration operations. Some routines access the DNSSEC-Tools configuration file, while others validate the execution environment. The DNSSEC tools have a configuration file for commonly used values. These values are the defaults for a variety of things, such as encryption algorithm and encryption key length. The B module provides methods for accessing the configuration data in this file. B is the filename for the DNSSEC tools configuration file. The full path depends on how DNSSEC-Tools was configured; see the DIRECTORIES section for the complete path. The paths required by B are set at DNSSEC-Tools configuration time. The DNSSEC tools configuration file consists of a set of configuration value entries, with only one entry per line. Each entry has the "keyword value" format. During parsing, the line is broken into tokens, with tokens being separated by spaces and tabs. The first token in a line is taken to be the keyword. All other tokens in that line are concatenated into a single string, with a space separating each token. The untokenized string is added to a hash table, with the keyword as the value's key. Comments may be included by prefacing them with the '#' or ';' comment characters. These comments can encompass an entire line or may follow a configuration entry. If a comment shares a line with an entry, value tokenization stops just prior to the comment character. An example configuration file follows: # Sample configuration entries. algorithm rsasha1 # Encryption algorithm. ksk_length 2048 ; KSK key length. Another aspect of DNSSEC-Tools configuration is the error action used by the DNSSEC-Tools Perl modules. The action dictates whether an error condition will only give an error return, print an error message to STDERR, or print an error message and exit. The I and I interfaces are used for these operations. =head1 INTERFACES =over 4 =item I This routine performs a number of configuration checks to ensure the environment is sufficient to support the DNSSEC-Tools configuration. If I is 0, then the checks are performed quietly; otherwise, error messages will be printed. The checks are: * The dnssec-tools sysconf directory exists. * The dnssec-tools sysconf directory is a directory. * The dnssec-tools directory exists. * The dnssec-tools directory is a directory. * The dnssec-tools config file exists. * The dnssec-tools config file is a regular file. * The dnssec-tools config file isn't empty. * The local state directory name isn't longer than 75 characters (to allow for the rollmgr command socket.) * The local state directory is a directory. * The local state directory can be created if necessary. * The local state directory's dnssec-tools subdirectory can be created if necessary, or is writable if it already exists. * The local state directory's run subdirectory can be created if necessary, or is writable if it already exists. Return Values: 0 no errors were found >0 some number of configuration checks failed =item I This routine reads and parses the system's DNSSEC tools configuration file. The parsed contents are put into a hash table, which is returned to the caller. =item I This routine reads and parses a caller-specified DNSSEC tools configuration file. The parsed contents are put into a hash table, which is returned to the caller. The routine quietly returns if the configuration file does not exist. =item I This routine ensures that the needed commands are available and executable. If any of the commands either don't exist or aren't executable, then an error message will be given and the process will exit. If all is well, everything will proceed quietly onwards. The commands keys currently checked are I, I, and I. The pathnames for these commands are found in the given options hash referenced by I<%options_hashref>. If the hash doesn't contain an entry for one of those commands, it is not checked. If this routine is called from a PAR-packed script, then it will look in the package directory for the commands. It will also set their file modes to 0755, as PAR appears to ignore file modes when packaging programs. =item I This routine returns the name of the DNSSEC-Tools configuration directory. =item I This routine returns the name of the DNSSEC-Tools configuration file. =item I This routine sets the name of the DNSSEC-Tools configuration file. Return values: 1 returned on success 0 returned if the specified configuration file does not exist or is not a regular file =item I This routine returns the name of the DNSSEC-Tools prefix directory. =item I This routine returns the name of the local state directory. =item I This routine returns a boolean indicating if the executing command is running from a PAR-packed script. =item I This routine makes the local state directory and returns its name. The directory is created only if it doesn't exist already. If the optional I subdirectory is specified, then that directory is created within the local state directory. In this case, the path of I is returned. I may consist of several intermediate directories, as well as the terminal directory. For example, I will create the B hierarchy within the local state directory. I uses the I module, which is available on all modern Perl versions. An empty string is returned if there are any errors. The following errors may be encountered: * I could not be loaded * Unable to create the local state directory * Unable to create a component of I * Full path (local state directory and I) already exists and is not a directory =item I This routine converts configuration values into appropriate boolean values. The following text conversions are made: 1 - 'true', 't', 'yes', 'y' 0 - 'false', 'f', 'no', 'n' All other text values are converted to 0. Positive values are converted to 1. Negative values are converted to 0. =item I This interface sets the error action for DNSSEC-Tools Perl modules. The valid actions are: ERR_SILENT Do not print an error message, do not exit. ERR_MSG Print an error message, do not exit. ERR_EXIT Print an error message, exit. ERR_SILENT is the default action. The previously set error action is returned. =item I The I interface is used by the DNSSEC-Tools Perl modules to report an error and exit, depending on the error action. The first argument is an error message to print -- if the error action allows error messages to be printed. The second argument is an exit code -- if the error action requires that the process exit. =back =head1 DIRECTORIES The default directories for this installation are: prefix : @prefix@ sysconf : @expanded_sysconfdir@ localstatedir : @expanded_localstatedir@ DNSSEC-Tools configuration file: @expanded_sysconfdir@/dnssec-tools These can be overridden using the following environmental variables: prefix : DT_PREFIX sysconf : DT_SYSCONFDIR localstatedir : DT_STATEDIR =head1 COPYRIGHT Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. =head1 AUTHOR Wayne Morrison, tewok@tislabs.com =head1 SEE ALSO B =cut dnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/0000775000237200023720000000000012544611342022437 5ustar hardakerhardakerdnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/const-c.inc0000664000237200023720000017011512544611342024505 0ustar hardakerhardaker#define PERL_constant_NOTFOUND 1 #define PERL_constant_NOTDEF 2 #define PERL_constant_ISIV 3 #define PERL_constant_ISNO 4 #define PERL_constant_ISNV 5 #define PERL_constant_ISPV 6 #define PERL_constant_ISPVN 7 #define PERL_constant_ISSV 8 #define PERL_constant_ISUNDEF 9 #define PERL_constant_ISUV 10 #define PERL_constant_ISYES 11 #ifndef NVTYPE typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ #endif #ifndef aTHX_ #define aTHX_ /* 5.6 or later define this for threading support. */ #endif #ifndef pTHX_ #define pTHX_ /* 5.6 or later define this for threading support. */ #endif static int constant_8 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_CRIT LOG_INFO SR_UNSET */ /* Offset 6 gives the best switch position. */ switch (name[6]) { case 'E': if (memEQ(name, "SR_UNSET", 8)) { /* ^ */ #ifdef SR_UNSET *iv_return = SR_UNSET; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'F': if (memEQ(name, "LOG_INFO", 8)) { /* ^ */ #ifdef LOG_INFO *iv_return = LOG_INFO; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "LOG_CRIT", 8)) { /* ^ */ #ifdef LOG_CRIT *iv_return = LOG_CRIT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_9 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_ALERT LOG_DEBUG LOG_EMERG VAL_BOGUS */ /* Offset 4 gives the best switch position. */ switch (name[4]) { case 'A': if (memEQ(name, "LOG_ALERT", 9)) { /* ^ */ #ifdef LOG_ALERT *iv_return = LOG_ALERT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'B': if (memEQ(name, "VAL_BOGUS", 9)) { /* ^ */ #ifdef VAL_BOGUS *iv_return = VAL_BOGUS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "LOG_DEBUG", 9)) { /* ^ */ #ifdef LOG_DEBUG *iv_return = LOG_DEBUG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "LOG_EMERG", 9)) { /* ^ */ #ifdef LOG_EMERG *iv_return = LOG_EMERG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_10 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_NOTICE MAX_PROOFS SR_FORMERR SR_NOTIMPL SR_REFUSED VAL_EINVAL VAL_ENOENT VAL_ENOMEM VAL_ENOSYS */ /* Offset 8 gives the best switch position. */ switch (name[8]) { case 'A': if (memEQ(name, "VAL_EINVAL", 10)) { /* ^ */ #ifdef VAL_EINVAL *iv_return = VAL_EINVAL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'C': if (memEQ(name, "LOG_NOTICE", 10)) { /* ^ */ #ifdef LOG_NOTICE *iv_return = LOG_NOTICE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "SR_REFUSED", 10)) { /* ^ */ #ifdef SR_REFUSED *iv_return = SR_REFUSED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_ENOMEM", 10)) { /* ^ */ #ifdef VAL_ENOMEM *iv_return = VAL_ENOMEM; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'F': if (memEQ(name, "MAX_PROOFS", 10)) { /* ^ */ #ifdef MAX_PROOFS *iv_return = MAX_PROOFS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_ENOENT", 10)) { /* ^ */ #ifdef VAL_ENOENT *iv_return = VAL_ENOENT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'P': if (memEQ(name, "SR_NOTIMPL", 10)) { /* ^ */ #ifdef SR_NOTIMPL *iv_return = SR_NOTIMPL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "SR_FORMERR", 10)) { /* ^ */ #ifdef SR_FORMERR *iv_return = SR_FORMERR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Y': if (memEQ(name, "VAL_ENOSYS", 10)) { /* ^ */ #ifdef VAL_ENOSYS *iv_return = VAL_ENOSYS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_11 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LOG_WARNING SR_NXDOMAIN SR_SERVFAIL VAL_AC_INIT VAL_AS_DONE VAL_EACCESS VAL_NOTRUST VAL_SUCCESS */ /* Offset 5 gives the best switch position. */ switch (name[5]) { case 'A': if (memEQ(name, "LOG_WARNING", 11)) { /* ^ */ #ifdef LOG_WARNING *iv_return = LOG_WARNING; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_EACCESS", 11)) { /* ^ */ #ifdef VAL_EACCESS *iv_return = VAL_EACCESS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'C': if (memEQ(name, "VAL_AC_INIT", 11)) { /* ^ */ #ifdef VAL_AC_INIT *iv_return = VAL_AC_INIT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "SR_NXDOMAIN", 11)) { /* ^ */ #ifdef SR_NXDOMAIN *iv_return = SR_NXDOMAIN; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'O': if (memEQ(name, "VAL_NOTRUST", 11)) { /* ^ */ #ifdef VAL_NOTRUST *iv_return = VAL_NOTRUST; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "SR_SERVFAIL", 11)) { /* ^ */ #ifdef SR_SERVFAIL *iv_return = SR_SERVFAIL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (memEQ(name, "VAL_AS_DONE", 11)) { /* ^ */ #ifdef VAL_AS_DONE *iv_return = VAL_AS_DONE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "VAL_SUCCESS", 11)) { /* ^ */ #ifdef VAL_SUCCESS *iv_return = VAL_SUCCESS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_12 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. NS_MAXCDNAME SR_NO_ANSWER VAL_AC_TRUST VAL_AC_UNSET VAL_NO_ERROR */ /* Offset 7 gives the best switch position. */ switch (name[7]) { case 'D': if (memEQ(name, "NS_MAXCDNAME", 12)) { /* ^ */ #ifdef NS_MAXCDNAME *iv_return = NS_MAXCDNAME; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "VAL_NO_ERROR", 12)) { /* ^ */ #ifdef VAL_NO_ERROR *iv_return = VAL_NO_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "SR_NO_ANSWER", 12)) { /* ^ */ #ifdef SR_NO_ANSWER *iv_return = SR_NO_ANSWER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'T': if (memEQ(name, "VAL_AC_TRUST", 12)) { /* ^ */ #ifdef VAL_AC_TRUST *iv_return = VAL_AC_TRUST; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "VAL_AC_UNSET", 12)) { /* ^ */ #ifdef VAL_AC_UNSET *iv_return = VAL_AC_UNSET; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_13 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_CALL_ERROR SR_TSIG_ERROR VAL_DNS_ERROR VAL_DONT_KNOW VAL_NO_POLICY VAL_PINSECURE ZONE_USE_TSIG */ /* Offset 4 gives the best switch position. */ switch (name[4]) { case 'A': if (memEQ(name, "SR_CALL_ERROR", 13)) { /* ^ */ #ifdef SR_CALL_ERROR *iv_return = SR_CALL_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "VAL_DNS_ERROR", 13)) { /* ^ */ #ifdef VAL_DNS_ERROR *iv_return = VAL_DNS_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_DONT_KNOW", 13)) { /* ^ */ #ifdef VAL_DONT_KNOW *iv_return = VAL_DONT_KNOW; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_NO_POLICY", 13)) { /* ^ */ #ifdef VAL_NO_POLICY *iv_return = VAL_NO_POLICY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'P': if (memEQ(name, "VAL_PINSECURE", 13)) { /* ^ */ #ifdef VAL_PINSECURE *iv_return = VAL_PINSECURE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (memEQ(name, "SR_TSIG_ERROR", 13)) { /* ^ */ #ifdef SR_TSIG_ERROR *iv_return = SR_TSIG_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '_': if (memEQ(name, "ZONE_USE_TSIG", 13)) { /* ^ */ #ifdef ZONE_USE_TSIG *iv_return = ZONE_USE_TSIG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_14 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. VAL_AC_NO_LINK VAL_BARE_RRSIG VAL_FROM_QUERY VAL_FROM_UNSET VAL_OOB_ANSWER VAL_QFLAGS_ANY */ /* Offset 9 gives the best switch position. */ switch (name[9]) { case 'N': if (memEQ(name, "VAL_OOB_ANSWER", 14)) { /* ^ */ #ifdef VAL_OOB_ANSWER *iv_return = VAL_OOB_ANSWER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Q': if (memEQ(name, "VAL_FROM_QUERY", 14)) { /* ^ */ #ifdef VAL_FROM_QUERY *iv_return = VAL_FROM_QUERY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "VAL_BARE_RRSIG", 14)) { /* ^ */ #ifdef VAL_BARE_RRSIG *iv_return = VAL_BARE_RRSIG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (memEQ(name, "VAL_QFLAGS_ANY", 14)) { /* ^ */ #ifdef VAL_QFLAGS_ANY *iv_return = VAL_QFLAGS_ANY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "VAL_FROM_UNSET", 14)) { /* ^ */ #ifdef VAL_FROM_UNSET *iv_return = VAL_FROM_UNSET; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '_': if (memEQ(name, "VAL_AC_NO_LINK", 14)) { /* ^ */ #ifdef VAL_AC_NO_LINK *iv_return = VAL_AC_NO_LINK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_15 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_HEADER_ERROR SR_MEMORY_ERROR VAL_AC_BAD_BASE VAL_AC_LAST_BAD VAL_AC_VERIFIED VAL_BOGUS_PROOF VAL_FROM_ANSWER VAL_QUERY_ASYNC VAL_AS_INFLIGHT */ /* Offset 7 gives the best switch position. */ switch (name[7]) { case 'B': if (memEQ(name, "VAL_AC_BAD_BASE", 15)) { /* ^ */ #ifdef VAL_AC_BAD_BASE *iv_return = VAL_AC_BAD_BASE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "SR_HEADER_ERROR", 15)) { /* ^ */ #ifdef SR_HEADER_ERROR *iv_return = SR_HEADER_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "VAL_AS_INFLIGHT", 15)) { /* ^ */ #ifdef VAL_AS_INFLIGHT *iv_return = VAL_AS_INFLIGHT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "VAL_AC_LAST_BAD", 15)) { /* ^ */ #ifdef VAL_AC_LAST_BAD *iv_return = VAL_AC_LAST_BAD; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'M': if (memEQ(name, "VAL_FROM_ANSWER", 15)) { /* ^ */ #ifdef VAL_FROM_ANSWER *iv_return = VAL_FROM_ANSWER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "SR_MEMORY_ERROR", 15)) { /* ^ */ #ifdef SR_MEMORY_ERROR *iv_return = SR_MEMORY_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_QUERY_ASYNC", 15)) { /* ^ */ #ifdef VAL_QUERY_ASYNC *iv_return = VAL_QUERY_ASYNC; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "VAL_BOGUS_PROOF", 15)) { /* ^ */ #ifdef VAL_BOGUS_PROOF *iv_return = VAL_BOGUS_PROOF; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'V': if (memEQ(name, "VAL_AC_VERIFIED", 15)) { /* ^ */ #ifdef VAL_AC_VERIFIED *iv_return = VAL_AC_VERIFIED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_16 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_NO_ANSWER_YET VAL_AC_DNS_ERROR VAL_AC_FAIL_BASE VAL_AC_PINSECURE VAL_BAD_ARGUMENT VAL_QUERY_NO_DLV ZONE_USE_NOTHING */ /* Offset 13 gives the best switch position. */ switch (name[13]) { case 'A': if (memEQ(name, "VAL_AC_FAIL_BASE", 16)) { /* ^ */ #ifdef VAL_AC_FAIL_BASE *iv_return = VAL_AC_FAIL_BASE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "VAL_QUERY_NO_DLV", 16)) { /* ^ */ #ifdef VAL_QUERY_NO_DLV *iv_return = VAL_QUERY_NO_DLV; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "VAL_BAD_ARGUMENT", 16)) { /* ^ */ #ifdef VAL_BAD_ARGUMENT *iv_return = VAL_BAD_ARGUMENT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "ZONE_USE_NOTHING", 16)) { /* ^ */ #ifdef ZONE_USE_NOTHING *iv_return = ZONE_USE_NOTHING; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "VAL_AC_DNS_ERROR", 16)) { /* ^ */ #ifdef VAL_AC_DNS_ERROR *iv_return = VAL_AC_DNS_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "VAL_AC_PINSECURE", 16)) { /* ^ */ #ifdef VAL_AC_PINSECURE *iv_return = VAL_AC_PINSECURE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Y': if (memEQ(name, "SR_NO_ANSWER_YET", 16)) { /* ^ */ #ifdef SR_NO_ANSWER_YET *iv_return = SR_NO_ANSWER_YET; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_17 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_INTERNAL_ERROR VAL_AC_BARE_RRSIG VAL_AC_CAN_VERIFY VAL_AC_DS_MISSING VAL_AC_DS_NOMATCH VAL_AC_ERROR_BASE VAL_AC_INVALID_DS VAL_AC_LAST_ERROR VAL_AC_LAST_STATE VAL_AS_NO_ANSWERS VAL_NO_PERMISSION VAL_OUT_OF_MEMORY VAL_QUERY_RECURSE VAL_QUERY_ITERATE VAL_INDETERMINATE */ /* Offset 7 gives the best switch position. */ switch (name[7]) { case 'B': if (memEQ(name, "VAL_AC_BARE_RRSIG", 17)) { /* ^ */ #ifdef VAL_AC_BARE_RRSIG *iv_return = VAL_AC_BARE_RRSIG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'C': if (memEQ(name, "VAL_AC_CAN_VERIFY", 17)) { /* ^ */ #ifdef VAL_AC_CAN_VERIFY *iv_return = VAL_AC_CAN_VERIFY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "VAL_AC_DS_MISSING", 17)) { /* ^ */ #ifdef VAL_AC_DS_MISSING *iv_return = VAL_AC_DS_MISSING; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_DS_NOMATCH", 17)) { /* ^ */ #ifdef VAL_AC_DS_NOMATCH *iv_return = VAL_AC_DS_NOMATCH; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "VAL_AC_ERROR_BASE", 17)) { /* ^ */ #ifdef VAL_AC_ERROR_BASE *iv_return = VAL_AC_ERROR_BASE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } else if (memEQ(name, "VAL_INDETERMINATE", 17)) { /* ^ */ #ifdef VAL_INDETERMINATE *iv_return = VAL_INDETERMINATE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "VAL_AC_INVALID_DS", 17)) { /* ^ */ #ifdef VAL_AC_INVALID_DS *iv_return = VAL_AC_INVALID_DS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "VAL_AC_LAST_ERROR", 17)) { /* ^ */ #ifdef VAL_AC_LAST_ERROR *iv_return = VAL_AC_LAST_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_LAST_STATE", 17)) { /* ^ */ #ifdef VAL_AC_LAST_STATE *iv_return = VAL_AC_LAST_STATE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_AS_NO_ANSWERS", 17)) { /* ^ */ #ifdef VAL_AS_NO_ANSWERS *iv_return = VAL_AS_NO_ANSWERS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'P': if (memEQ(name, "VAL_NO_PERMISSION", 17)) { /* ^ */ #ifdef VAL_NO_PERMISSION *iv_return = VAL_NO_PERMISSION; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "SR_INTERNAL_ERROR", 17)) { /* ^ */ #ifdef SR_INTERNAL_ERROR *iv_return = SR_INTERNAL_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_QUERY_RECURSE", 17)) { /* ^ */ #ifdef VAL_QUERY_RECURSE *iv_return = VAL_QUERY_RECURSE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_QUERY_ITERATE", 17)) { /* ^ */ #ifdef VAL_QUERY_ITERATE *iv_return = VAL_QUERY_ITERATE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '_': if (memEQ(name, "VAL_OUT_OF_MEMORY", 17)) { /* ^ */ #ifdef VAL_OUT_OF_MEMORY *iv_return = VAL_OUT_OF_MEMORY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_18 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. LIBSRES_NS_STAGGER SR_ZI_STATUS_UNSET VAL_AC_INVALID_KEY VAL_AC_SIGNING_KEY VAL_AC_TRUST_NOCHK VAL_AC_TRUST_POINT VAL_BOGUS_PROVABLE VAL_CONF_NOT_FOUND VAL_FROM_AUTHORITY VAL_INTERNAL_ERROR VAL_TRUSTED_ANSWER VAL_UNTRUSTED_ZONE */ /* Offset 13 gives the best switch position. */ switch (name[13]) { case 'A': if (memEQ(name, "LIBSRES_NS_STAGGER", 18)) { /* ^ */ #ifdef LIBSRES_NS_STAGGER *iv_return = LIBSRES_NS_STAGGER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "VAL_AC_INVALID_KEY", 18)) { /* ^ */ #ifdef VAL_AC_INVALID_KEY *iv_return = VAL_AC_INVALID_KEY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "VAL_INTERNAL_ERROR", 18)) { /* ^ */ #ifdef VAL_INTERNAL_ERROR *iv_return = VAL_INTERNAL_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'F': if (memEQ(name, "VAL_CONF_NOT_FOUND", 18)) { /* ^ */ #ifdef VAL_CONF_NOT_FOUND *iv_return = VAL_CONF_NOT_FOUND; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'G': if (memEQ(name, "VAL_AC_SIGNING_KEY", 18)) { /* ^ */ #ifdef VAL_AC_SIGNING_KEY *iv_return = VAL_AC_SIGNING_KEY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_AC_TRUST_NOCHK", 18)) { /* ^ */ #ifdef VAL_AC_TRUST_NOCHK *iv_return = VAL_AC_TRUST_NOCHK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_TRUSTED_ANSWER", 18)) { /* ^ */ #ifdef VAL_TRUSTED_ANSWER *iv_return = VAL_TRUSTED_ANSWER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'O': if (memEQ(name, "VAL_FROM_AUTHORITY", 18)) { /* ^ */ #ifdef VAL_FROM_AUTHORITY *iv_return = VAL_FROM_AUTHORITY; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'P': if (memEQ(name, "VAL_AC_TRUST_POINT", 18)) { /* ^ */ #ifdef VAL_AC_TRUST_POINT *iv_return = VAL_AC_TRUST_POINT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "SR_ZI_STATUS_UNSET", 18)) { /* ^ */ #ifdef SR_ZI_STATUS_UNSET *iv_return = SR_ZI_STATUS_UNSET; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } else if (memEQ(name, "VAL_POL_GOPT_UNSET", 18)) { /* ^ */ #ifdef VAL_POL_GOPT_UNSET *iv_return = VAL_POL_GOPT_UNSET; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'V': if (memEQ(name, "VAL_BOGUS_PROVABLE", 18)) { /* ^ */ #ifdef VAL_BOGUS_PROVABLE *iv_return = VAL_BOGUS_PROVABLE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '_': if (memEQ(name, "VAL_UNTRUSTED_ZONE", 18)) { /* ^ */ #ifdef VAL_UNTRUSTED_ZONE *iv_return = VAL_UNTRUSTED_ZONE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_19 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. VAL_AC_DATA_MISSING VAL_AC_LAST_FAILURE VAL_AC_NOT_VERIFIED VAL_AC_TRUST_ANCHOR VAL_AS_CB_COMPLETED VAL_AS_IGNORE_CACHE VAL_AS_NO_CALLBACKS VAL_FROM_ADDITIONAL VAL_NOT_IMPLEMENTED VAL_POL_GOPT_ENABLE VAL_QFLAGS_USERMASK VAL_QUERY_AC_DETAIL VAL_QUERY_USING_DLV */ /* Offset 11 gives the best switch position. */ switch (name[11]) { case 'A': if (memEQ(name, "VAL_AS_NO_CALLBACKS", 19)) { /* ^ */ #ifdef VAL_AS_NO_CALLBACKS *iv_return = VAL_AS_NO_CALLBACKS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'C': if (memEQ(name, "VAL_QUERY_AC_DETAIL", 19)) { /* ^ */ #ifdef VAL_QUERY_AC_DETAIL *iv_return = VAL_QUERY_AC_DETAIL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "VAL_FROM_ADDITIONAL", 19)) { /* ^ */ #ifdef VAL_FROM_ADDITIONAL *iv_return = VAL_FROM_ADDITIONAL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "VAL_NOT_IMPLEMENTED", 19)) { /* ^ */ #ifdef VAL_NOT_IMPLEMENTED *iv_return = VAL_NOT_IMPLEMENTED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "CTX_DYN_POL_RES_NRD", 19)) { /* ^ */ #ifdef VAL_NOT_IMPLEMENTED *iv_return = VAL_NOT_IMPLEMENTED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "CTX_DYN_POL_VAL_OVR", 19)) { /* ^ */ #ifdef VAL_NOT_IMPLEMENTED *iv_return = VAL_NOT_IMPLEMENTED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "CTX_DYN_POL_RES_OVR", 19)) { /* ^ */ #ifdef VAL_NOT_IMPLEMENTED *iv_return = VAL_NOT_IMPLEMENTED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "CTX_DYN_POL_GLO_OVR", 19)) { /* ^ */ #ifdef VAL_NOT_IMPLEMENTED *iv_return = VAL_NOT_IMPLEMENTED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'O': if (memEQ(name, "VAL_AS_CB_COMPLETED", 19)) { /* ^ */ #ifdef VAL_AS_CB_COMPLETED *iv_return = VAL_AS_CB_COMPLETED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "VAL_AS_IGNORE_CACHE", 19)) { /* ^ */ #ifdef VAL_AS_IGNORE_CACHE *iv_return = VAL_AS_IGNORE_CACHE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (memEQ(name, "VAL_QUERY_USING_DLV", 19)) { /* ^ */ #ifdef VAL_QUERY_USING_DLV *iv_return = VAL_QUERY_USING_DLV; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'T': if (memEQ(name, "VAL_AC_TRUST_ANCHOR", 19)) { /* ^ */ #ifdef VAL_AC_TRUST_ANCHOR *iv_return = VAL_AC_TRUST_ANCHOR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_POL_GOPT_ENABLE", 19)) { /* ^ */ #ifdef VAL_POL_GOPT_ENABLE *iv_return = VAL_POL_GOPT_ENABLE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "VAL_QFLAGS_USERMASK", 19)) { /* ^ */ #ifdef VAL_QFLAGS_USERMASK *iv_return = VAL_QFLAGS_USERMASK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'V': if (memEQ(name, "VAL_AC_NOT_VERIFIED", 19)) { /* ^ */ #ifdef VAL_AC_NOT_VERIFIED *iv_return = VAL_AC_NOT_VERIFIED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '_': if (memEQ(name, "VAL_AC_DATA_MISSING", 19)) { /* ^ */ #ifdef VAL_AC_DATA_MISSING *iv_return = VAL_AC_DATA_MISSING; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_LAST_FAILURE", 19)) { /* ^ */ #ifdef VAL_AC_LAST_FAILURE *iv_return = VAL_AC_LAST_FAILURE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_20 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_DNS_GENERIC_ERROR SR_ZI_STATUS_LEARNED VAL_AC_INVALID_RRSIG VAL_AC_RRSIG_EXPIRED VAL_AC_RRSIG_MISSING VAL_AC_VERIFIED_LINK VAL_CONF_PARSE_ERROR VAL_INCOMPLETE_PROOF VAL_IRRELEVANT_PROOF VAL_NONEXISTENT_NAME VAL_NONEXISTENT_TYPE VAL_POL_GOPT_DISABLE VAL_UNTRUSTED_ANSWER VAL_VALIDATED_ANSWER VAL_QUERY_SKIP_CACHE */ /* Offset 8 gives the best switch position. */ switch (name[8]) { case 'A': if (memEQ(name, "SR_ZI_STATUS_LEARNED", 20)) { /* ^ */ #ifdef SR_ZI_STATUS_LEARNED *iv_return = SR_ZI_STATUS_LEARNED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (memEQ(name, "VAL_VALIDATED_ANSWER", 20)) { /* ^ */ #ifdef VAL_VALIDATED_ANSWER *iv_return = VAL_VALIDATED_ANSWER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "SR_DNS_GENERIC_ERROR", 20)) { /* ^ */ #ifdef SR_DNS_GENERIC_ERROR *iv_return = SR_DNS_GENERIC_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_VERIFIED_LINK", 20)) { /* ^ */ #ifdef VAL_AC_VERIFIED_LINK *iv_return = VAL_AC_VERIFIED_LINK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'G': if (memEQ(name, "VAL_POL_GOPT_DISABLE", 20)) { /* ^ */ #ifdef VAL_POL_GOPT_DISABLE *iv_return = VAL_POL_GOPT_DISABLE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "VAL_IRRELEVANT_PROOF", 20)) { /* ^ */ #ifdef VAL_IRRELEVANT_PROOF *iv_return = VAL_IRRELEVANT_PROOF; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'M': if (memEQ(name, "VAL_INCOMPLETE_PROOF", 20)) { /* ^ */ #ifdef VAL_INCOMPLETE_PROOF *iv_return = VAL_INCOMPLETE_PROOF; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_AC_INVALID_RRSIG", 20)) { /* ^ */ #ifdef VAL_AC_INVALID_RRSIG *iv_return = VAL_AC_INVALID_RRSIG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "VAL_AC_RRSIG_EXPIRED", 20)) { /* ^ */ #ifdef VAL_AC_RRSIG_EXPIRED *iv_return = VAL_AC_RRSIG_EXPIRED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_RRSIG_MISSING", 20)) { /* ^ */ #ifdef VAL_AC_RRSIG_MISSING *iv_return = VAL_AC_RRSIG_MISSING; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (memEQ(name, "VAL_UNTRUSTED_ANSWER", 20)) { /* ^ */ #ifdef VAL_UNTRUSTED_ANSWER *iv_return = VAL_UNTRUSTED_ANSWER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'X': if (memEQ(name, "VAL_NONEXISTENT_NAME", 20)) { /* ^ */ #ifdef VAL_NONEXISTENT_NAME *iv_return = VAL_NONEXISTENT_NAME; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_NONEXISTENT_TYPE", 20)) { /* ^ */ #ifdef VAL_NONEXISTENT_TYPE *iv_return = VAL_NONEXISTENT_TYPE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Y': if (memEQ(name, "VAL_QUERY_SKIP_CACHE", 20)) { /* ^ */ #ifdef VAL_QUERY_SKIP_CACHE *iv_return = VAL_QUERY_SKIP_CACHE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case '_': if (memEQ(name, "VAL_CONF_PARSE_ERROR", 20)) { /* ^ */ #ifdef VAL_CONF_PARSE_ERROR *iv_return = VAL_CONF_PARSE_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_21 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_EDNS_VERSION_ERROR SR_RCV_INTERNAL_ERROR SR_UNSUPP_EDNS0_LABEL VAL_AC_DNSKEY_MISSING VAL_AC_DNSKEY_NOMATCH VAL_AC_NEGATIVE_PROOF VAL_AC_RRSIG_VERIFIED VAL_AC_UNTRUSTED_ZONE VAL_AC_WAIT_FOR_RRSIG VAL_AC_WAIT_FOR_TRUST VAL_AC_WCARD_VERIFIED VAL_AS_NO_NEW_QUERIES VAL_IGNORE_VALIDATION VAL_POL_GOPT_OVERRIDE VAL_QFLAGS_CACHE_MASK VAL_QUERY_IGNORE_SKEW */ /* Offset 20 gives the best switch position. */ switch (name[20]) { case 'D': if (memEQ(name, "VAL_AC_RRSIG_VERIFIE", 20)) { /* D */ #ifdef VAL_AC_RRSIG_VERIFIED *iv_return = VAL_AC_RRSIG_VERIFIED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_WCARD_VERIFIE", 20)) { /* D */ #ifdef VAL_AC_WCARD_VERIFIED *iv_return = VAL_AC_WCARD_VERIFIED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "VAL_AC_UNTRUSTED_ZON", 20)) { /* E */ #ifdef VAL_AC_UNTRUSTED_ZONE *iv_return = VAL_AC_UNTRUSTED_ZONE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_POL_GOPT_OVERRID", 20)) { /* E */ #ifdef VAL_POL_GOPT_OVERRIDE *iv_return = VAL_POL_GOPT_OVERRIDE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'F': if (memEQ(name, "VAL_AC_NEGATIVE_PROO", 20)) { /* F */ #ifdef VAL_AC_NEGATIVE_PROOF *iv_return = VAL_AC_NEGATIVE_PROOF; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'G': if (memEQ(name, "VAL_AC_DNSKEY_MISSIN", 20)) { /* G */ #ifdef VAL_AC_DNSKEY_MISSING *iv_return = VAL_AC_DNSKEY_MISSING; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_WAIT_FOR_RRSI", 20)) { /* G */ #ifdef VAL_AC_WAIT_FOR_RRSIG *iv_return = VAL_AC_WAIT_FOR_RRSIG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'H': if (memEQ(name, "VAL_AC_DNSKEY_NOMATC", 20)) { /* H */ #ifdef VAL_AC_DNSKEY_NOMATCH *iv_return = VAL_AC_DNSKEY_NOMATCH; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'K': if (memEQ(name, "VAL_QFLAGS_CACHE_MAS", 20)) { /* K */ #ifdef VAL_QFLAGS_CACHE_MASK *iv_return = VAL_QFLAGS_CACHE_MASK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "SR_UNSUPP_EDNS0_LABE", 20)) { /* L */ #ifdef SR_UNSUPP_EDNS0_LABEL *iv_return = SR_UNSUPP_EDNS0_LABEL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_IGNORE_VALIDATIO", 20)) { /* N */ #ifdef VAL_IGNORE_VALIDATION *iv_return = VAL_IGNORE_VALIDATION; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "SR_EDNS_VERSION_ERRO", 20)) { /* R */ #ifdef SR_EDNS_VERSION_ERROR *iv_return = SR_EDNS_VERSION_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "SR_RCV_INTERNAL_ERRO", 20)) { /* R */ #ifdef SR_RCV_INTERNAL_ERROR *iv_return = SR_RCV_INTERNAL_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (memEQ(name, "VAL_AS_NO_NEW_QUERIE", 20)) { /* S */ #ifdef VAL_AS_NO_NEW_QUERIES *iv_return = VAL_AS_NO_NEW_QUERIES; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'T': if (memEQ(name, "VAL_AC_WAIT_FOR_TRUS", 20)) { /* T */ #ifdef VAL_AC_WAIT_FOR_TRUST *iv_return = VAL_AC_WAIT_FOR_TRUST; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'W': if (memEQ(name, "VAL_QUERY_IGNORE_SKE", 20)) { /* W */ #ifdef VAL_QUERY_IGNORE_SKEW *iv_return = VAL_QUERY_IGNORE_SKEW; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_22 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_SEND_INTERNAL_ERROR SR_TSIG_INTERNAL_ERROR SR_ZI_STATUS_PERMANENT VAL_AC_DONT_GO_FURTHER VAL_QUERY_GLUE_REQUEST */ /* Offset 4 gives the best switch position. */ switch (name[4]) { case 'A': if (memEQ(name, "VAL_AC_DONT_GO_FURTHER", 22)) { /* ^ */ #ifdef VAL_AC_DONT_GO_FURTHER *iv_return = VAL_AC_DONT_GO_FURTHER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "SR_SEND_INTERNAL_ERROR", 22)) { /* ^ */ #ifdef SR_SEND_INTERNAL_ERROR *iv_return = SR_SEND_INTERNAL_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "SR_ZI_STATUS_PERMANENT", 22)) { /* ^ */ #ifdef SR_ZI_STATUS_PERMANENT *iv_return = SR_ZI_STATUS_PERMANENT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Q': if (memEQ(name, "VAL_QUERY_GLUE_REQUEST", 22)) { /* ^ */ #ifdef VAL_QUERY_GLUE_REQUEST *iv_return = VAL_QUERY_GLUE_REQUEST; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (memEQ(name, "SR_TSIG_INTERNAL_ERROR", 22)) { /* ^ */ #ifdef SR_TSIG_INTERNAL_ERROR *iv_return = SR_TSIG_INTERNAL_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_23 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. VAL_FLAG_CHAIN_COMPLETE VAL_PINSECURE_UNTRUSTED VAL_QFLAGS_NOCACHE_MASK VAL_QUERY_DONT_VALIDATE VAL_QUERY_SKIP_RESOLVER */ /* Offset 12 gives the best switch position. */ switch (name[12]) { case 'E': if (memEQ(name, "VAL_PINSECURE_UNTRUSTED", 23)) { /* ^ */ #ifdef VAL_PINSECURE_UNTRUSTED *iv_return = VAL_PINSECURE_UNTRUSTED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (memEQ(name, "VAL_FLAG_CHAIN_COMPLETE", 23)) { /* ^ */ #ifdef VAL_FLAG_CHAIN_COMPLETE *iv_return = VAL_FLAG_CHAIN_COMPLETE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_QUERY_SKIP_RESOLVER", 23)) { /* ^ */ #ifdef VAL_QUERY_SKIP_RESOLVER *iv_return = VAL_QUERY_SKIP_RESOLVER; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_QUERY_DONT_VALIDATE", 23)) { /* ^ */ #ifdef VAL_QUERY_DONT_VALIDATE *iv_return = VAL_QUERY_DONT_VALIDATE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'O': if (memEQ(name, "VAL_QFLAGS_NOCACHE_MASK", 23)) { /* ^ */ #ifdef VAL_QFLAGS_NOCACHE_MASK *iv_return = VAL_QFLAGS_NOCACHE_MASK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_24 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. VAL_AC_IGNORE_VALIDATION VAL_AC_WRONG_LABEL_COUNT VAL_AS_CTX_USER_SUPPLIED VAL_QUERY_EDNS0_FALLBACK VAL_RESOURCE_UNAVAILABLE VAL_QUERY_SKIP_ANS_CACHE */ /* Offset 22 gives the best switch position. */ switch (name[22]) { case 'C': if (memEQ(name, "VAL_QUERY_EDNS0_FALLBACK", 24)) { /* ^ */ #ifdef VAL_QUERY_EDNS0_FALLBACK *iv_return = VAL_QUERY_EDNS0_FALLBACK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (memEQ(name, "VAL_AS_CTX_USER_SUPPLIED", 24)) { /* ^ */ #ifdef VAL_AS_CTX_USER_SUPPLIED *iv_return = VAL_AS_CTX_USER_SUPPLIED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'H': if (memEQ(name, "VAL_QUERY_SKIP_ANS_CACHE", 24)) { /* ^ */ #ifdef VAL_QUERY_SKIP_ANS_CACHE *iv_return = VAL_QUERY_SKIP_ANS_CACHE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'L': if (memEQ(name, "VAL_RESOURCE_UNAVAILABLE", 24)) { /* ^ */ #ifdef VAL_RESOURCE_UNAVAILABLE *iv_return = VAL_RESOURCE_UNAVAILABLE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_AC_WRONG_LABEL_COUNT", 24)) { /* ^ */ #ifdef VAL_AC_WRONG_LABEL_COUNT *iv_return = VAL_AC_WRONG_LABEL_COUNT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'O': if (memEQ(name, "VAL_AC_IGNORE_VALIDATION", 24)) { /* ^ */ #ifdef VAL_AC_IGNORE_VALIDATION *iv_return = VAL_AC_IGNORE_VALIDATION; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_25 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. SR_MKQUERY_INTERNAL_ERROR SR_NAME_EXPANSION_FAILURE VAL_AC_RRSIG_NOTYETACTIVE */ /* Offset 15 gives the best switch position. */ switch (name[15]) { case 'O': if (memEQ(name, "SR_NAME_EXPANSION_FAILURE", 25)) { /* ^ */ #ifdef SR_NAME_EXPANSION_FAILURE *iv_return = SR_NAME_EXPANSION_FAILURE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "SR_MKQUERY_INTERNAL_ERROR", 25)) { /* ^ */ #ifdef SR_MKQUERY_INTERNAL_ERROR *iv_return = SR_MKQUERY_INTERNAL_ERROR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'T': if (memEQ(name, "VAL_AC_RRSIG_NOTYETACTIVE", 25)) { /* ^ */ #ifdef VAL_AC_RRSIG_NOTYETACTIVE *iv_return = VAL_AC_RRSIG_NOTYETACTIVE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_26 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. VAL_AC_RRSIG_VERIFIED_SKEW VAL_AC_RRSIG_VERIFY_FAILED VAL_AC_WCARD_VERIFIED_SKEW VAL_QUERY_CHECK_ALL_RRSIGS*/ /* Offset 8 gives the best switch position. */ switch (name[8]) { case 'C': if (memEQ(name, "VAL_AC_WCARD_VERIFIED_SKEW", 26)) { /* ^ */ #ifdef VAL_AC_WCARD_VERIFIED_SKEW *iv_return = VAL_AC_WCARD_VERIFIED_SKEW; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "VAL_AC_RRSIG_VERIFIED_SKEW", 26)) { /* ^ */ #ifdef VAL_AC_RRSIG_VERIFIED_SKEW *iv_return = VAL_AC_RRSIG_VERIFIED_SKEW; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (memEQ(name, "VAL_AC_RRSIG_VERIFY_FAILED", 26)) { /* ^ */ #ifdef VAL_AC_RRSIG_VERIFY_FAILED *iv_return = VAL_AC_RRSIG_VERIFY_FAILED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Y': if (memEQ(name, "VAL_QUERY_CHECK_ALL_RRSIGS", 26)) { /* ^ */ #ifdef VAL_QUERY_CHECK_ALL_RRSIGS *iv_return = VAL_QUERY_CHECK_ALL_RRSIGS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant_30 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. VAL_AC_ALGORITHM_NOT_SUPPORTED VAL_AC_UNKNOWN_DNSKEY_PROTOCOL VAL_MASKED_FLAG_CHAIN_COMPLETE */ /* Offset 23 gives the best switch position. */ switch (name[23]) { case 'O': if (memEQ(name, "VAL_MASKED_FLAG_CHAIN_COMPLETE", 30)) { /* ^ */ #ifdef VAL_MASKED_FLAG_CHAIN_COMPLETE *iv_return = VAL_MASKED_FLAG_CHAIN_COMPLETE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'P': if (memEQ(name, "VAL_AC_ALGORITHM_NOT_SUPPORTED", 30)) { /* ^ */ #ifdef VAL_AC_ALGORITHM_NOT_SUPPORTED *iv_return = VAL_AC_ALGORITHM_NOT_SUPPORTED; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'R': if (memEQ(name, "VAL_AC_UNKNOWN_DNSKEY_PROTOCOL", 30)) { /* ^ */ #ifdef VAL_AC_UNKNOWN_DNSKEY_PROTOCOL *iv_return = VAL_AC_UNKNOWN_DNSKEY_PROTOCOL; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } static int constant (pTHX_ const char *name, STRLEN len, IV *iv_return) { /* Initially switch on the length of the name. */ /* When generated this function returned values for the list of names given in this section of perl code. Rather than manually editing these functions to add or remove constants, which would result in this comment and section of code becoming inaccurate, we recommend that you edit this section of code, and use it to regenerate a new set of constant functions which you then use to replace the originals. Regenerate these constant functions by feeding this entire source file to perl -x #!/usr/bin/perl -w use ExtUtils::Constant qw (constant_types C_constant XS_constant); my $types = {map {($_, 1)} qw(IV)}; my @names = (qw(LIBSRES_NS_STAGGER LOG_ALERT LOG_CRIT LOG_DEBUG LOG_EMERG LOG_ERR LOG_INFO LOG_NOTICE LOG_WARNING MAX_PROOFS NS_MAXCDNAME SOCKET SR_CALL_ERROR SR_DNS_GENERIC_ERROR SR_EDNS_VERSION_ERROR SR_FORMERR SR_HEADER_ERROR SR_INTERNAL_ERROR SR_MEMORY_ERROR SR_MKQUERY_INTERNAL_ERROR SR_NAME_EXPANSION_FAILURE SR_NOTIMPL SR_NO_ANSWER SR_NO_ANSWER_YET SR_NXDOMAIN SR_RCV_INTERNAL_ERROR SR_REFUSED SR_SEND_INTERNAL_ERROR SR_SERVFAIL SR_TSIG_ERROR SR_TSIG_INTERNAL_ERROR SR_UNSET SR_UNSUPP_EDNS0_LABEL SR_ZI_STATUS_LEARNED SR_ZI_STATUS_PERMANENT SR_ZI_STATUS_UNSET VAL_AC_ALGORITHM_NOT_SUPPORTED VAL_AC_BAD_BASE VAL_AC_BARE_RRSIG VAL_AC_CAN_VERIFY VAL_AC_DATA_MISSING VAL_AC_DNSKEY_MISSING VAL_AC_DNSKEY_NOMATCH VAL_AC_DNS_ERROR VAL_AC_DONT_GO_FURTHER VAL_AC_DS_MISSING VAL_AC_DS_NOMATCH VAL_AC_ERROR_BASE VAL_AC_FAIL_BASE VAL_AC_IGNORE_VALIDATION VAL_AC_INIT VAL_AC_INVALID_DS VAL_AC_INVALID_KEY VAL_AC_INVALID_RRSIG VAL_AC_LAST_BAD VAL_AC_LAST_ERROR VAL_AC_LAST_FAILURE VAL_AC_LAST_STATE VAL_AC_NEGATIVE_PROOF VAL_AC_NOT_VERIFIED VAL_AC_NO_LINK VAL_AC_PINSECURE VAL_AC_RRSIG_ALGORITHM_MISMATCH VAL_AC_RRSIG_EXPIRED VAL_AC_RRSIG_MISSING VAL_AC_RRSIG_NOTYETACTIVE VAL_AC_RRSIG_VERIFIED VAL_AC_RRSIG_VERIFIED_SKEW VAL_AC_RRSIG_VERIFY_FAILED VAL_AC_SIGNING_KEY VAL_AC_TRUST VAL_AC_TRUST_ANCHOR VAL_AC_TRUST_NOCHK VAL_AC_TRUST_POINT VAL_AC_UNKNOWN_ALGORITHM_LINK VAL_AC_UNKNOWN_DNSKEY_PROTOCOL VAL_AC_UNSET VAL_AC_UNTRUSTED_ZONE VAL_AC_VERIFIED VAL_AC_VERIFIED_LINK VAL_AC_WAIT_FOR_RRSIG VAL_AC_WAIT_FOR_TRUST VAL_AC_WCARD_VERIFIED VAL_AC_WCARD_VERIFIED_SKEW VAL_AC_WRONG_LABEL_COUNT VAL_AS_CB_COMPLETED VAL_AS_CTX_USER_SUPPLIED VAL_AS_DONE VAL_AS_IGNORE_CACHE VAL_AS_NO_ANSWERS VAL_AS_NO_CALLBACKS VAL_AS_NO_NEW_QUERIES VAL_BAD_ARGUMENT VAL_BARE_RRSIG VAL_INDETERMINATE VAL_BOGUS VAL_BOGUS_PROOF VAL_BOGUS_PROVABLE VAL_CONF_NOT_FOUND VAL_CONF_PARSE_ERROR VAL_DNS_ERROR VAL_DONT_KNOW VAL_EACCESS VAL_EINVAL VAL_ENOENT VAL_ENOMEM VAL_ENOSYS VAL_FLAG_CHAIN_COMPLETE VAL_FROM_ADDITIONAL VAL_FROM_ANSWER VAL_FROM_AUTHORITY VAL_FROM_QUERY VAL_FROM_UNSET VAL_IGNORE_VALIDATION VAL_INCOMPLETE_PROOF VAL_INTERNAL_ERROR VAL_IRRELEVANT_PROOF VAL_MASKED_FLAG_CHAIN_COMPLETE VAL_NONEXISTENT_NAME VAL_NONEXISTENT_NAME_NOCHAIN VAL_NONEXISTENT_TYPE VAL_NONEXISTENT_TYPE_NOCHAIN VAL_NOTRUST VAL_NOT_IMPLEMENTED VAL_NO_ERROR VAL_NO_PERMISSION VAL_NO_POLICY VAL_OOB_ANSWER VAL_OUT_OF_MEMORY VAL_PINSECURE VAL_PINSECURE_UNTRUSTED VAL_POL_GOPT_DISABLE VAL_POL_GOPT_ENABLE VAL_POL_GOPT_OVERRIDE VAL_QFLAGS_ANY VAL_QFLAGS_CACHE_MASK VAL_QFLAGS_NOCACHE_MASK VAL_QFLAGS_USERMASK VAL_QUERY_AC_DETAIL VAL_QUERY_ASYNC VAL_QUERY_DONT_VALIDATE VAL_QUERY_EDNS0_FALLBACK VAL_QUERY_GLUE_REQUEST VAL_QUERY_NO_DLV VAL_QUERY_CHECK_ALL_RRSIGS VAL_QUERY_NO_EDNS0_FALLBACK VAL_QUERY_RECURSE VAL_QUERY_ITERATE VAL_QUERY_USING_DLV VAL_RESOURCE_UNAVAILABLE VAL_SUCCESS VAL_TRUSTED_ANSWER VAL_UNTRUSTED_ANSWER VAL_UNTRUSTED_ZONE VAL_VALIDATED_ANSWER ZONE_USE_NOTHING ZONE_USE_TSIG)); print constant_types(), "\n"; # macro defs foreach (C_constant ("Net-DNS-Sec-Validator", 'constant', 'IV', $types, undef, 3, @names) ) { print $_, "\n"; # C constant subs } print "\n#### XS Section:\n"; print XS_constant ("Net-DNS-Sec-Validator", $types); __END__ */ switch (len) { case 7: if (memEQ(name, "LOG_ERR", 7)) { #ifdef LOG_ERR *iv_return = LOG_ERR; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 8: return constant_8 (aTHX_ name, iv_return); break; case 9: return constant_9 (aTHX_ name, iv_return); break; case 10: return constant_10 (aTHX_ name, iv_return); break; case 11: return constant_11 (aTHX_ name, iv_return); break; case 12: return constant_12 (aTHX_ name, iv_return); break; case 13: return constant_13 (aTHX_ name, iv_return); break; case 14: return constant_14 (aTHX_ name, iv_return); break; case 15: return constant_15 (aTHX_ name, iv_return); break; case 16: return constant_16 (aTHX_ name, iv_return); break; case 17: return constant_17 (aTHX_ name, iv_return); break; case 18: return constant_18 (aTHX_ name, iv_return); break; case 19: return constant_19 (aTHX_ name, iv_return); break; case 20: return constant_20 (aTHX_ name, iv_return); break; case 21: return constant_21 (aTHX_ name, iv_return); break; case 22: return constant_22 (aTHX_ name, iv_return); break; case 23: return constant_23 (aTHX_ name, iv_return); break; case 24: return constant_24 (aTHX_ name, iv_return); break; case 25: return constant_25 (aTHX_ name, iv_return); break; case 26: return constant_26 (aTHX_ name, iv_return); break; case 27: /* Names all of length 27. */ /* VAL_QUERY_NO_EDNS0_FALLBACK VAL_QUERY_MARK_FOR_DELETION */ /* Offset 10 gives the best switch position. */ switch (name[10]) { case 'M': if (memEQ(name, "VAL_QUERY_MARK_FOR_DELETION", 27)) { /* ^ */ #ifdef VAL_QUERY_MARK_FOR_DELETION *iv_return = VAL_QUERY_MARK_FOR_DELETION; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'N': if (memEQ(name, "VAL_QUERY_NO_EDNS0_FALLBACK", 27)) { /* ^ */ #ifdef VAL_QUERY_NO_EDNS0_FALLBACK *iv_return = VAL_QUERY_NO_EDNS0_FALLBACK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } break; case 28: /* Names all of length 28. */ /* VAL_NONEXISTENT_NAME_NOCHAIN VAL_NONEXISTENT_TYPE_NOCHAIN */ /* Offset 18 gives the best switch position. */ switch (name[18]) { case 'M': if (memEQ(name, "VAL_NONEXISTENT_NAME_NOCHAIN", 28)) { /* ^ */ #ifdef VAL_NONEXISTENT_NAME_NOCHAIN *iv_return = VAL_NONEXISTENT_NAME_NOCHAIN; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'P': if (memEQ(name, "VAL_NONEXISTENT_TYPE_NOCHAIN", 28)) { /* ^ */ #ifdef VAL_NONEXISTENT_TYPE_NOCHAIN *iv_return = VAL_NONEXISTENT_TYPE_NOCHAIN; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } break; case 29: if (memEQ(name, "VAL_AC_UNKNOWN_ALGORITHM_LINK", 29)) { #ifdef VAL_AC_UNKNOWN_ALGORITHM_LINK *iv_return = VAL_AC_UNKNOWN_ALGORITHM_LINK; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 30: return constant_30 (aTHX_ name, iv_return); break; case 31: if (memEQ(name, "VAL_AC_RRSIG_ALGORITHM_MISMATCH", 31)) { #ifdef VAL_AC_RRSIG_ALGORITHM_MISMATCH *iv_return = VAL_AC_RRSIG_ALGORITHM_MISMATCH; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; } return PERL_constant_NOTFOUND; } dnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/t/0000775000237200023720000000000012544611342022702 5ustar hardakerhardakerdnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/t/basic.t0000664000237200023720000000726212544611342024157 0ustar hardakerhardaker#!./perl BEGIN { unless(grep /blib/, @INC) { chdir 't' if -d 't'; @INC = '../lib' if -d '../lib'; } } use Test; BEGIN { $n = 54; plan tests => $n } use Net::DNS::SEC::Validator; use Net::DNS::Packet; use Net::hostent; use Net::addrinfo; use Socket qw(:all); require "./defines.pl"; sub isnum { my $n = shift; return $n =~ /^\d+$/; } ok(isnum(Net::DNS::SEC::Validator::VAL_SUCCESS)); ok(isnum(Net::DNS::SEC::Validator::VAL_AC_VERIFIED)); ok(isnum(Net::DNS::SEC::Validator::SR_DNS_GENERIC_ERROR)); ok(isnum(Net::DNS::SEC::Validator::SR_NXDOMAIN)); ok(isnum(VAL_SUCCESS)); ok(isnum(VAL_AC_VERIFIED)); ok(isnum(SR_DNS_GENERIC_ERROR)); ok(isnum(SR_NXDOMAIN)); $validator = new Net::DNS::SEC::Validator(); ok(defined($validator)); $validator = new Net::DNS::SEC::Validator(policy => ":", dnsval_conf=> $dnsval_conf, root_hints=> $root_hints, resolv_conf=> $resolv_conf, ); ok(defined($validator)); $r = $validator->policy(":"); ok($r); $r = $validator->policy("validate_tools:"); ok($r); $r = $validator->dnsval_conf(); ok($r eq $dnsval_conf); $r = $validator->root_hints(); ok($r eq $root_hints); $r = $validator->resolv_conf(); ok($r eq $resolv_conf); $validator = new Net::DNS::SEC::Validator( ); @r = $validator->getaddrinfo("good-A.test.dnssec-tools.org"); ok(@r); ok(defined $r[0] and ref($r[0]) eq 'Net::addrinfo'); # there are 3x2 of these foreach $a (@r) { ok($validator->istrusted($a->val_status)); ok($validator->isvalidated($a->val_status)); } $r =$validator->getaddrinfo("pastdate-AAAA.pastdate-ds.test.dnssec-tools.org"); ok(not $validator->istrusted($r->val_status)); $r = $validator->getaddrinfo("nosig-A.futuredate-ds.test.dnssec-tools.org"); ok(not $validator->istrusted($r->val_status)); $r = $validator->getaddrinfo("pastdate-A.futuredate-ds.test.dnssec-tools.org"); ok(not $validator->istrusted($r->val_status)); $r = $validator->getaddrinfo("good-A.pastdate-ds.test.dnssec-tools.org"); ok(not $validator->istrusted($r->val_status)); @r = $validator->getaddrinfo("good-cname-to-good-A.test.dnssec-tools.org"); ok(@r); foreach $a (@r) { ok($validator->istrusted($a->val_status)); } @r = $validator->getaddrinfo("good-cname-to-badsign-A.test.dnssec-tools.org"); ok(@r); $r = $validator->res_query("good-AAAA.test.dnssec-tools.org", "IN", "AAAA"); ok($r); ($pkt, $err) = new Net::DNS::Packet(\$r); ok(not $err); $r = $validator->res_query("good-A.test.dnssec-tools.org", "IN", "A"); ok($r); ($pkt, $err) = new Net::DNS::Packet(\$r); ok(not $err); $r = $validator->res_query("good-A.good-ns.test.dnssec-tools.org", "IN", "A"); ok($r); ($pkt, $err) = new Net::DNS::Packet(\$r); ok(not $err); $r = $validator->res_query("good-A.test.dnssec-tools.org", "IN", "AAAA"); ok(not defined $r); ok($validator->{error}); ok($validator->{errorStr}); ok($validator->{valStatus}); ok($validator->{valStatusStr}); $r = $validator->gethostbyname("good-A.good-ns.test.dnssec-tools.org"); ok(ref $r eq 'Net::hostent'); $r = $validator->gethostbyname("good-AAAA.test.dnssec-tools.org"); ok(not defined $r); $r = $validator->gethostbyname("good-AAAA.test.dnssec-tools.org", AF_INET6); ok(ref $r eq 'Net::hostent'); $r = $validator->gethostbyname("good-A.test.dnssec-tools.org"); ok(ref $r eq 'Net::hostent'); $r = $validator->gethostbyname("www.dnssec-tools.org"); ok(ref $r eq 'Net::hostent'); $r = $validator->res_query("dnssec-tools.org", "IN", "MX"); ok($r); ($pkt, $err) = new Net::DNS::Packet(\$r); ok(not $err); # this be locally trusted but not validated $r = $validator->res_query("dnssec-tools.org", "IN", "MX"); ok($r); ok($validator->{valStatus} == VAL_TRUSTED_ANSWER); ok($validator->istrusted()); ok(!$validator->isvalidated()); dnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/MANIFEST0000664000237200023720000000014612544611342023571 0ustar hardakerhardakerMakefile.PL MANIFEST MANIFEST.SKIP README Validator.pm Validator.xs const-c.inc const-xs.inc t/basic.tdnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/MANIFEST.SKIP0000664000237200023720000000000012544611342024323 0ustar hardakerhardakerdnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/Validator.xs0000664000237200023720000010035112544611342024740 0ustar hardakerhardaker/* -*- C -*- Validator.xs -- Perl 5 interface to the Dnssec-Tools validating resolver written by G. S. Marzot (marz@users.sourceforge.net) Copyright (c) 2006-2008 SPARTA, Inc. All rights reserved. Copyright (c) 2006-2007 G. S. Marzot. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "validator/validator-config.h" #include "validator/resolver.h" #include "validator/validator.h" #define PVAL_BUFSIZE (16*1024) #define ADDRINFO_TYPE 0 #define VAL_ADDRINFO_TYPE 1 typedef struct libval_context ValContext; typedef struct val_global_opt ValContextGlOpt; typedef struct val_context_opt ValContextOpt; typedef struct val_cb_params_s ValCBParams; typedef struct val_async_status_s ValAsyncStatus; struct _pval_async_cbdata { SV *cb; SV *cb_data; }; #if 0 static void print_addrinfo(int type, void *ainfo, char *obuf) { struct sockaddr_in *s_inaddr = NULL; struct sockaddr_in6 *s_in6addr = NULL; struct addrinfo *a = (struct addrinfo *) ainfo; char buf[INET6_ADDRSTRLEN]; while (a != NULL) { printf("{\n"); printf("\tFlags: %d [", a->ai_flags); if (a->ai_flags & AI_PASSIVE) printf("AI_PASSIVE "); if (a->ai_flags & AI_CANONNAME) printf("AI_CANONNAME "); if (a->ai_flags & AI_NUMERICHOST) printf("AI_NUMERICHOST "); if (a->ai_flags & AI_V4MAPPED) printf("AI_V4MAPPED "); if (a->ai_flags & AI_ALL) printf("AI_ALL "); if (a->ai_flags & AI_ADDRCONFIG) printf("AI_ADDRCONFIG "); // if (a->ai_flags & AI_NUMERICSERV) printf("AI_NUMERICSERV "); printf("]\n"); printf("\tFamily: %d [%s]\n", a->ai_family, (a->ai_family == AF_UNSPEC) ? "AF_UNSPEC" : (a->ai_family == AF_INET) ? "AF_INET" : (a->ai_family == AF_INET6) ? "AF_INET6" : "Unknown"); printf("\tSockType: %d [%s]\n", a->ai_socktype, (a->ai_socktype == SOCK_STREAM) ? "SOCK_STREAM" : (a->ai_socktype == SOCK_DGRAM) ? "SOCK_DGRAM" : (a->ai_socktype == SOCK_RAW) ? "SOCK_RAW" : "Unknown"); printf("\tProtocol: %d [%s]\n", a->ai_protocol, (a->ai_protocol == IPPROTO_IP) ? "IPPROTO_IP" : (a->ai_protocol == IPPROTO_TCP) ? "IPPROTO_TCP" : (a->ai_protocol == IPPROTO_UDP) ? "IPPROTO_UDP" : "Unknown"); printf("\tAddrLen: %d\n", a->ai_addrlen); if (a->ai_addr != NULL) { printf("\tAddrPtr: %p\n", a->ai_addr); if (a->ai_family == AF_INET) { s_inaddr = (struct sockaddr_in *) (a->ai_addr); printf("\tAddr: %s\n", inet_ntop(AF_INET, &(s_inaddr->sin_addr), buf, INET6_ADDRSTRLEN)); } else if (a->ai_family == AF_INET6) { s_in6addr = (struct sockaddr_in6 *) (a->ai_addr); printf("\tAddr: %s\n", inet_ntop(AF_INET6, &(s_in6addr->sin6_addr), buf, INET6_ADDRSTRLEN)); } else printf ("\tAddr: Cannot parse address. Unknown protocol family\n"); } else printf("\tAddr: (null)\n"); if (a->ai_canonname) { printf("\tCanonName: %s\n", a->ai_canonname); strcpy(obuf, a->ai_canonname); } else { printf("\tCanonName: (null)\n"); strcpy(obuf, ""); } if (type == VAL_ADDRINFO_TYPE) { printf("\tValStatus: %s\n", p_val_error(((struct val_addrinfo *) a)-> ai_val_status)); } printf("}\n"); a = (struct addrinfo *) (a->ai_next); } } static int not_here(s) char *s; { croak("%s not implemented on this architecture", s); return -1; } #endif static struct addrinfo *ainfo_sv2c(SV *ainfo_ref, struct addrinfo *ainfo_ptr) { if (ainfo_ptr) { bzero(ainfo_ptr, sizeof(struct addrinfo)); if (ainfo_ref && SvROK(ainfo_ref)) { SV **flags_svp = hv_fetch((HV*)SvRV(ainfo_ref), "flags", 5, 1); SV **family_svp = hv_fetch((HV*)SvRV(ainfo_ref), "family", 6, 1); SV **socktype_svp = hv_fetch((HV*)SvRV(ainfo_ref), "socktype", 8, 1); SV **protocol_svp = hv_fetch((HV*)SvRV(ainfo_ref), "protocol", 8, 1); SV **addr_svp = hv_fetch((HV*)SvRV(ainfo_ref), "addr", 4, 1); SV **canonname_svp = hv_fetch((HV*)SvRV(ainfo_ref), "canonname", 9, 1); ainfo_ptr->ai_flags = (SvOK(*flags_svp) ? SvIV(*flags_svp) : 0); ainfo_ptr->ai_family = (SvOK(*family_svp) ? SvIV(*family_svp) : 0); ainfo_ptr->ai_socktype = (SvOK(*socktype_svp) ? SvIV(*socktype_svp) : 0); ainfo_ptr->ai_protocol = (SvOK(*protocol_svp) ? SvIV(*protocol_svp) : 0); if (SvOK(*addr_svp)) { ainfo_ptr->ai_addr = (struct sockaddr *) SvPV_nolen(*addr_svp); // borrowed ainfo_ptr->ai_addrlen = SvLEN(*addr_svp); } else { ainfo_ptr->ai_addr = NULL; ainfo_ptr->ai_addrlen = 0; } ainfo_ptr->ai_canonname = (SvOK(*canonname_svp) ? SvPV_nolen(*canonname_svp) : NULL); // borrowed // fprintf(stderr, "ainfo_ptr->ai_flags = %d\n", ainfo_ptr->ai_flags); // fprintf(stderr, "ainfo_ptr->ai_family = %d\n", ainfo_ptr->ai_family); // fprintf(stderr, "ainfo_ptr->ai_socktype = %d\n", ainfo_ptr->ai_socktype); // fprintf(stderr, "ainfo_ptr->ai_protocol = %d\n", ainfo_ptr->ai_protocol); // fprintf(stderr, "ainfo_ptr->ai_addrlen = %d\n", ainfo_ptr->ai_addrlen); // fprintf(stderr,"ainfo_ptr->ai_canonname=%s\n",ainfo_ptr->ai_canonname); } else { ainfo_ptr = NULL; } } return ainfo_ptr; } SV *rr_c2sv(char *name, int type, int class, long ttl, size_t len, u_char *data) { dSP ; SV *rr = &PL_sv_undef; ENTER ; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSVpv("Net::DNS::RR", 0))) ; XPUSHs(sv_2mortal(newSVpv((char*)name, 0))) ; XPUSHs(sv_2mortal(newSVpv(p_sres_type(type), 0))) ; XPUSHs(sv_2mortal(newSVpv(p_class(class), 0))) ; XPUSHs(sv_2mortal(newSVnv(ttl))) ; XPUSHs(sv_2mortal(newSViv(len))) ; XPUSHs(sv_2mortal(newRV(sv_2mortal(newSVpvn((char*)data, len))))) ; XPUSHs(sv_2mortal(newSViv(0))) ; PUTBACK; call_method("new_from_data", G_SCALAR|G_EVAL); if (SvTRUE(ERRSV)) { /* Try the decode function */ u_char *buf = NULL; size_t buflen = 0; if(VAL_NO_ERROR != val_create_rr_otw(name, type, class, ttl, len, data, &buflen, &buf)) { goto err; } POPs; // remove the undef value from the top of the stack SPAGAIN ; PUSHMARK(SP); XPUSHs(sv_2mortal(newSVpv("Net::DNS::RR", 0))) ; XPUSHs(sv_2mortal(newRV(sv_2mortal(newSVpvn((char*)buf, buflen))))) ; PUTBACK; call_method("decode", G_SCALAR); free(buf); } SPAGAIN ; rr = newSVsv(POPs); PUTBACK ; err: FREETMPS ; LEAVE ; return rr; } SV *rrset_c2sv(struct val_rrset_rec *rrs_ptr) { HV *rrset_hv = newHV(); SV *rrset_hv_ref = newRV_noinc((SV*)rrset_hv); AV *rrs_avd = newAV(); SV *rrs_avd_ref = newRV_noinc((SV*)rrs_avd); AV *rrs_avs = newAV(); SV *rrs_avs_ref = newRV_noinc((SV*)rrs_avs); HV *rr_hv; SV *rr_hv_ref; struct val_rr_rec *rr; char name_buf[INET6_ADDRSTRLEN + 1]; if (rrs_ptr) { (void)hv_store(rrset_hv, "name", strlen("name"), newSVpv(rrs_ptr->val_rrset_name, strlen(rrs_ptr->val_rrset_name)), 0); (void)hv_store(rrset_hv, "class", strlen("class"), newSVpv(p_class(rrs_ptr->val_rrset_class), 0), 0); (void)hv_store(rrset_hv, "type", strlen("type"), newSVpv(p_sres_type(rrs_ptr->val_rrset_type), 0), 0); (void)hv_store(rrset_hv, "ttl", strlen("ttl"), newSVnv(rrs_ptr->val_rrset_ttl),0); for (rr = rrs_ptr->val_rrset_data; rr; rr = rr->rr_next) { rr_hv = newHV(); rr_hv_ref = newRV_noinc((SV*)rr_hv); (void)hv_store(rr_hv, "rrdata", strlen("rrdata"), rr_c2sv(rrs_ptr->val_rrset_name, rrs_ptr->val_rrset_type, rrs_ptr->val_rrset_class, rrs_ptr->val_rrset_ttl, rr->rr_rdata_length, rr->rr_rdata), 0); (void)hv_store(rr_hv, "rrstatus", strlen("rrstatus"), newSViv(rr->rr_status),0); av_push(rrs_avd, rr_hv_ref); } (void)hv_store(rrset_hv, "data", strlen("data"), rrs_avd_ref, 0); for (rr = rrs_ptr->val_rrset_sig; rr; rr = rr->rr_next) { rr_hv = newHV(); rr_hv_ref = newRV_noinc((SV*)rr_hv); (void)hv_store(rr_hv, "rrdata", strlen("rrdata"), rr_c2sv(rrs_ptr->val_rrset_name, ns_t_rrsig, rrs_ptr->val_rrset_class, rrs_ptr->val_rrset_ttl, rr->rr_rdata_length, rr->rr_rdata), 0); (void)hv_store(rr_hv, "rrstatus", strlen("rrstatus"), newSViv(rr->rr_status),0); av_push(rrs_avs, rr_hv_ref); } (void)hv_store(rrset_hv, "sigs", strlen("sigs"), rrs_avs_ref, 0); val_get_ns_string(rrs_ptr->val_rrset_server, name_buf, sizeof(name_buf)); (void)hv_store(rrset_hv, "respserv", strlen("respserv"), newSVpv(name_buf, strlen(name_buf)), 0); } return rrset_hv_ref; } SV *ac_c2sv(struct val_authentication_chain *ac_ptr) { AV *ac_av = newAV(); SV *ac_av_ref = newRV_noinc((SV*)ac_av); struct val_authentication_chain *t; t = ac_ptr; while(t) { HV *ac_hv = newHV(); SV *ac_hv_ref = newRV_noinc((SV*)ac_hv); (void)hv_store(ac_hv, "status", strlen("status"), newSViv(t->val_ac_status), 0); (void)hv_store(ac_hv, "rrset", strlen("rrset"), rrset_c2sv(t->val_ac_rrset), 0); av_push(ac_av, ac_hv_ref); t = t->val_ac_trust; } return ac_av_ref; } SV *rc_c2sv(struct val_result_chain *rc_ptr) { int i; AV *rc_av = newAV(); SV *rc_av_ref = newRV_noinc((SV*)rc_av); HV *result_hv; SV *result_hv_ref; AV *proofs_av; SV *proofs_av_ref; while (rc_ptr) { result_hv = newHV(); result_hv_ref = newRV_noinc((SV*)result_hv); (void)hv_store(result_hv, "status", strlen("status"), newSViv(rc_ptr->val_rc_status), 0); /* fprintf(stderr, "rc status == %d\n", rc_ptr->val_rc_status); XXX */ if (rc_ptr->val_rc_answer != NULL) { (void)hv_store(result_hv, "answer", strlen("answer"), ac_c2sv(rc_ptr->val_rc_answer), 0); } else { (void)hv_store(result_hv, "rrset", strlen("rrset"), rrset_c2sv(rc_ptr->val_rc_rrset), 0); } proofs_av = newAV(); proofs_av_ref = newRV_noinc((SV*)proofs_av); for(i=0; i < rc_ptr->val_rc_proof_count && rc_ptr->val_rc_proof_count < MAX_PROOFS; i++) { av_push(proofs_av, ac_c2sv(rc_ptr->val_rc_proofs[i])); } (void)hv_store(result_hv, "proofs", strlen("proofs"), proofs_av_ref, 0); av_push(rc_av, result_hv_ref); rc_ptr = rc_ptr->val_rc_next; } return rc_av_ref; } SV *ainfo_c2sv(struct addrinfo *ainfo_ptr) { AV *ainfo_av = newAV(); SV *ainfo_av_ref = newRV_noinc((SV*)ainfo_av); for (;ainfo_ptr != NULL; ainfo_ptr = ainfo_ptr->ai_next) { HV *ainfo_hv = newHV(); SV *ainfo_hv_ref = newRV_noinc((SV*)ainfo_hv); sv_bless(ainfo_hv_ref, gv_stashpv("Net::addrinfo",0)); // fprintf(stderr,"::ainfo_ptr->ai_flags=%d\n", ainfo_ptr->ai_flags); // fprintf(stderr,"::ainfo_ptr->ai_family=%d\n", ainfo_ptr->ai_family); // fprintf(stderr,"::ainfo_ptr->ai_socktype=%d\n", ainfo_ptr->ai_socktype); // fprintf(stderr,"::ainfo_ptr->ai_protocol=%d\n", ainfo_ptr->ai_protocol); // fprintf(stderr,"::ainfo_ptr->ai_addrlen=%d\n", ainfo_ptr->ai_addrlen); //fprintf(stderr,"::ainfo_ptr->ai_canonname=%s\n",ainfo_ptr->ai_canonname); (void)hv_store(ainfo_hv, "flags", strlen("flags"), newSViv(ainfo_ptr->ai_flags), 0); (void)hv_store(ainfo_hv, "family", strlen("family"), newSViv(ainfo_ptr->ai_family), 0); (void)hv_store(ainfo_hv, "socktype", strlen("socktype"), newSViv(ainfo_ptr->ai_socktype), 0); (void)hv_store(ainfo_hv, "protocol", strlen("protocol"), newSViv(ainfo_ptr->ai_protocol), 0); (void)hv_store(ainfo_hv, "addr", strlen("addr"), newSVpv((char*)ainfo_ptr->ai_addr, ainfo_ptr->ai_addrlen), 0); (void)hv_store(ainfo_hv, "canonname", strlen("canonname"), (ainfo_ptr->ai_canonname ? newSVpv(ainfo_ptr->ai_canonname, strlen(ainfo_ptr->ai_canonname)) : &PL_sv_undef), 0); av_push(ainfo_av, ainfo_hv_ref); } return ainfo_av_ref; } SV *hostent_c2sv(struct hostent *hent_ptr) { AV *hent_av; SV *hent_av_ref; AV *hent_aliases_av; SV *hent_aliases_av_ref; AV *hent_addrs_av; SV *hent_addrs_av_ref; int i; if (hent_ptr == NULL) return &PL_sv_undef; hent_av = newAV(); hent_av_ref = newRV_noinc((SV*)hent_av); sv_bless(hent_av_ref, gv_stashpv("Net::hostent",0)); av_push(hent_av, newSVpv(hent_ptr->h_name,0)); hent_aliases_av = newAV(); hent_aliases_av_ref = newRV_noinc((SV*)hent_aliases_av); av_push(hent_av, hent_aliases_av_ref); if (hent_ptr->h_aliases) { for (i = 0; hent_ptr->h_aliases[i] != 0; i++) { av_push(hent_aliases_av, newSVpv(hent_ptr->h_aliases[i],0)); } } av_push(hent_av, newSViv(hent_ptr->h_addrtype)); av_push(hent_av, newSViv(hent_ptr->h_length)); hent_addrs_av = newAV(); hent_addrs_av_ref = newRV_noinc((SV*)hent_addrs_av); av_push(hent_av, hent_addrs_av_ref); for (i = 0; hent_ptr->h_addr_list[i] != 0; i++) { av_push(hent_addrs_av, newSVpvn(hent_ptr->h_addr_list[i], hent_ptr->h_length)); } return hent_av_ref; } int _pval_async_cb(ValAsyncStatus *as, int event, ValContext *ctx, void *callback_data, ValCBParams *cbp) { dSP; SV *res = &PL_sv_undef; int ret = -1; struct _pval_async_cbdata *cbd = (struct _pval_async_cbdata *)callback_data; if (cbp && cbp->results) { ret = cbp->retval; res = rc_c2sv(cbp->results); val_free_result_chain(cbp->results); cbp->results = NULL; } ENTER ; SAVETMPS; PUSHMARK(SP); XPUSHs(cbd->cb_data); XPUSHs(sv_2mortal(newSViv(ret))); XPUSHs(res); PUTBACK; call_sv(cbd->cb, G_DISCARD); FREETMPS ; LEAVE ; SvREFCNT_dec(res); SvREFCNT_dec(cbd->cb_data); SvREFCNT_dec(cbd->cb); free(cbd); return 0; } #include "const-c.inc" MODULE = Net::DNS::SEC::Validator PACKAGE = Net::DNS::SEC::Validator PREFIX = pval INCLUDE: const-xs.inc ValContext * pval_create_context(policy) char * policy CODE: { ValContext *vc_ptr=NULL; int result = val_create_context(policy, &vc_ptr); RETVAL = (result ? NULL : vc_ptr); } OUTPUT: RETVAL ValContext * pval_create_context_with_conf(policy,dnsval_conf,resolv_conf,root_hints) char * policy = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); char * dnsval_conf = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); char * resolv_conf = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); char * root_hints = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); CODE: { ValContext *vc_ptr=NULL; // fprintf(stderr,"pval_create_context_with_conf:%s:%s:%s\n",dnsval_conf,resolv_conf,root_hints); //val_log_add_optarg("7:stderr", 1); /* XXX */ int result = val_create_context_with_conf(policy, dnsval_conf, resolv_conf, root_hints, &vc_ptr); // fprintf(stderr,"pval_create_context_with_confresult=%d):%lx\n",result,vc_ptr); RETVAL = (result ? NULL : vc_ptr); } OUTPUT: RETVAL ValContext * pval_create_context_ex(optref) SV * optref = (SvOK($arg) ? $arg : NULL); CODE: { ValContext *vc_ptr=NULL; ValContextOpt opt; ValContextGlOpt gopt; char *label; // Find the policy label SV **label_svp = hv_fetch((HV*)SvRV(optref), "policy", 6, 1); label = (SvOK(*label_svp) ? SvPV_nolen(*label_svp) : ":"); // Context options SV **vc_qflags_svp = hv_fetch((HV*)SvRV(optref), "qflags", 6, 1); opt.vc_qflags = (SvOK(*vc_qflags_svp) ? SvIV(*vc_qflags_svp) : 0); SV **vc_valpol_svp = hv_fetch((HV*)SvRV(optref), "valpol", 6, 1); opt.vc_valpol = (SvOK(*vc_valpol_svp) ? SvPV_nolen(*vc_valpol_svp) : NULL); SV **vc_nslist_svp = hv_fetch((HV*)SvRV(optref), "nslist", 6, 1); opt.vc_nslist = (SvOK(*vc_nslist_svp) ? SvPV_nolen(*vc_nslist_svp) : NULL); SV **dnsval_conf_svp = hv_fetch((HV*)SvRV(optref), "dnsval_conf", 11, 1); opt.vc_val_conf = (SvOK(*dnsval_conf_svp) ? SvPV_nolen(*dnsval_conf_svp) : NULL); SV **resolv_conf_svp = hv_fetch((HV*)SvRV(optref), "resolv_conf", 11, 1); opt.vc_res_conf = (SvOK(*resolv_conf_svp) ? SvPV_nolen(*resolv_conf_svp) : NULL); SV **root_conf_svp = hv_fetch((HV*)SvRV(optref), "root_hints", 10, 1); opt.vc_root_conf = (SvOK(*root_conf_svp) ? SvPV_nolen(*root_conf_svp) : NULL); // Set the policy override flags to override resolver information, // but only if it was defined SV **vc_polflags_svp = hv_fetch((HV*)SvRV(optref), "polflags", 8, 1); if (SvOK(*vc_polflags_svp)) { opt.vc_polflags = SvIV(*vc_polflags_svp); } else if (opt.vc_nslist != NULL) { opt.vc_polflags = CTX_DYN_POL_RES_OVR; } else { opt.vc_polflags = 0; } // Global options SV **local_is_trusted_svp = hv_fetch((HV*)SvRV(optref), "local_is_trusted", 16, 1); gopt.local_is_trusted = (SvOK(*local_is_trusted_svp) ? SvIV(*local_is_trusted_svp) : VAL_POL_GOPT_UNSET); SV **edns0_size_svp = hv_fetch((HV*)SvRV(optref), "edns0_size", 10, 1); gopt.edns0_size = (SvOK(*edns0_size_svp) ? SvIV(*edns0_size_svp) : VAL_POL_GOPT_UNSET); SV **env_policy_svp = hv_fetch((HV*)SvRV(optref), "env_policy", 10, 1); gopt.env_policy = (SvOK(*env_policy_svp) ? SvIV(*env_policy_svp) : VAL_POL_GOPT_UNSET); SV **app_policy_svp = hv_fetch((HV*)SvRV(optref), "app_policy", 10, 1); gopt.app_policy = (SvOK(*app_policy_svp) ? SvIV(*app_policy_svp) : VAL_POL_GOPT_UNSET); SV **log_target_svp = hv_fetch((HV*)SvRV(optref), "log_target", 10, 1); gopt.log_target = (SvOK(*log_target_svp) ? SvPV_nolen(*log_target_svp) : NULL); SV **closest_ta_only_svp = hv_fetch((HV*)SvRV(optref), "closest_ta_only", 15, 1); gopt.closest_ta_only = (SvOK(*closest_ta_only_svp) ? SvIV(*closest_ta_only_svp) : VAL_POL_GOPT_UNSET); SV **rec_fallback_svp = hv_fetch((HV*)SvRV(optref), "rec_fallback", 12, 1); gopt.rec_fallback = (SvOK(*rec_fallback_svp) ? SvIV(*rec_fallback_svp) : VAL_POL_GOPT_UNSET); SV **max_refresh_svp = hv_fetch((HV*)SvRV(optref), "max_refresh", 11, 1); gopt.max_refresh = (SvOK(*max_refresh_svp) ? (long)SvIV(*max_refresh_svp) : VAL_POL_GOPT_UNSET); SV **proto_svp = hv_fetch((HV*)SvRV(optref), "proto", 5, 1); gopt.proto = (SvOK(*proto_svp) ? SvIV(*proto_svp) : VAL_POL_GOPT_UNSET); SV **timeout_svp = hv_fetch((HV*)SvRV(optref), "timeout", 7, 1); gopt.timeout = (SvOK(*timeout_svp) ? SvIV(*timeout_svp) : VAL_POL_GOPT_UNSET); SV **retry_svp = hv_fetch((HV*)SvRV(optref), "retry", 5, 1); gopt.retry = (SvOK(*retry_svp) ? SvIV(*retry_svp) : VAL_POL_GOPT_UNSET); opt.vc_gopt = &gopt; int result = val_create_context_ex(label, &opt, &vc_ptr); // fprintf(stderr,"pval_create_context_with_confresult=%d):%lx\n",result,vc_ptr); RETVAL = (result ? NULL : vc_ptr); } OUTPUT: RETVAL SV * pval_getaddrinfo(self,node=NULL,service=NULL,hints_ref=NULL) SV * self char * node = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); char * service = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); SV * hints_ref = (SvOK($arg) ? $arg : NULL); CODE: { ValContext * ctx; SV ** ctx_ref; SV ** error_svp; SV ** error_str_svp; SV ** val_status_svp; SV ** val_status_str_svp; struct addrinfo hints; struct addrinfo * hints_ptr = NULL; struct addrinfo * ainfo_ptr = NULL; val_status_t val_status; int res; ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); error_svp = hv_fetch((HV*)SvRV(self), "error", 5, 1); error_str_svp = hv_fetch((HV*)SvRV(self), "errorStr", 8, 1); val_status_svp = hv_fetch((HV*)SvRV(self), "valStatus", 9, 1); val_status_str_svp = hv_fetch((HV*)SvRV(self), "valStatusStr", 12, 1); sv_setiv(*error_svp, 0); sv_setpv(*error_str_svp, ""); sv_setiv(*val_status_svp, 0); sv_setpv(*val_status_str_svp, ""); hints_ptr = ainfo_sv2c(hints_ref, &hints); res = val_getaddrinfo(ctx, node, service, hints_ptr, &ainfo_ptr, &val_status); if (res == 0) { if (val_getaddrinfo_has_status(res)) { sv_setiv(*val_status_svp, val_status); sv_setpv(*val_status_str_svp, p_val_status(val_status)); } RETVAL = ainfo_c2sv(ainfo_ptr); } else { sv_setiv(*error_svp, res); sv_setpv(*error_str_svp, gai_strerror(res)); RETVAL = &PL_sv_undef; } freeaddrinfo(ainfo_ptr); } OUTPUT: RETVAL SV * pval_gethostbyname(self,name,af=AF_INET) SV * self char * name = (SvOK($arg) ? (char *)SvPV_nolen($arg) : "localhost"); int af = (SvOK($arg) ? SvIV($arg) : AF_INET); CODE: { ValContext *ctx; SV ** ctx_ref; SV ** error_svp; SV ** error_str_svp; SV ** val_status_svp; SV ** val_status_str_svp; char buf[PVAL_BUFSIZE]; struct hostent *result = NULL; struct hostent hentry; int herrno = 0; val_status_t val_status; int res; bzero(&hentry, sizeof(struct hostent)); bzero(buf, PVAL_BUFSIZE); ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); error_svp = hv_fetch((HV*)SvRV(self), "error", 5, 1); error_str_svp = hv_fetch((HV*)SvRV(self), "errorStr", 8, 1); val_status_svp = hv_fetch((HV*)SvRV(self), "valStatus", 9, 1); val_status_str_svp = hv_fetch((HV*)SvRV(self), "valStatusStr", 12, 1); sv_setiv(*error_svp, 0); sv_setpv(*error_str_svp, ""); sv_setiv(*val_status_svp, 0); sv_setpv(*val_status_str_svp, ""); res = val_gethostbyname2_r(ctx, name, af, &hentry, buf, PVAL_BUFSIZE, &result, &herrno, &val_status); sv_setiv(*val_status_svp, val_status); sv_setpv(*val_status_str_svp, p_val_status(val_status)); if (res) { RETVAL = &PL_sv_undef; sv_setiv(*error_svp, herrno); sv_setpv(*error_str_svp, hstrerror(herrno)); } else { RETVAL = hostent_c2sv(result); } } OUTPUT: RETVAL SV * pval_res_query(self,dname,class,type) SV * self char * dname int class int type CODE: { ValContext *ctx; SV ** error_svp; SV ** error_str_svp; SV ** val_status_svp; SV ** val_status_str_svp; SV ** ctx_ref; int res; unsigned char buf[PVAL_BUFSIZE]; val_status_t val_status; bzero(buf, PVAL_BUFSIZE); ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); error_svp = hv_fetch((HV*)SvRV(self), "error", 5, 1); error_str_svp = hv_fetch((HV*)SvRV(self), "errorStr", 8, 1); val_status_svp = hv_fetch((HV*)SvRV(self), "valStatus", 9, 1); val_status_str_svp = hv_fetch((HV*)SvRV(self), "valStatusStr", 12, 1); sv_setiv(*error_svp, 0); sv_setpv(*error_str_svp, ""); sv_setiv(*val_status_svp, 0); sv_setpv(*val_status_str_svp, ""); // fprintf(stderr,"before:%p:%s:%d:%d:%d:%d\n",ctx,dname,class,type,res,val_status); res = val_res_query(ctx, dname, class, type, buf, PVAL_BUFSIZE, &val_status); // fprintf(stderr,"after:%p:%s:%d:%d:%d:%d:%d:%s\n",ctx,dname,class,type,res,val_status,h_errno,hstrerror(h_errno)); sv_setiv(*val_status_svp, val_status); sv_setpv(*val_status_str_svp, p_val_status(val_status)); if (res == -1) { RETVAL = &PL_sv_undef; sv_setiv(*error_svp, h_errno); // this is not thread safe sv_setpv(*error_str_svp, hstrerror(h_errno)); } else { RETVAL =newSVpvn((char*)buf, res); } } OUTPUT: RETVAL SV * pval_resolve_and_check(self,domain,class,type,flags) SV * self char * domain int class int type int flags CODE: { ValContext * ctx; SV ** ctx_ref; SV ** error_svp; SV ** error_str_svp; SV ** val_status_svp; SV ** val_status_str_svp; struct val_result_chain * val_rc_ptr = NULL; int res; //fprintf(stderr, "here we are at the start\n"); ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); error_svp = hv_fetch((HV*)SvRV(self), "error", 5, 1); error_str_svp = hv_fetch((HV*)SvRV(self), "errorStr", 8, 1); val_status_svp = hv_fetch((HV*)SvRV(self), "valStatus", 9, 1); val_status_str_svp = hv_fetch((HV*)SvRV(self), "valStatusStr", 12, 1); sv_setiv(*error_svp, 0); sv_setpv(*error_str_svp, ""); sv_setiv(*val_status_svp, 0); sv_setpv(*val_status_str_svp, ""); RETVAL = &PL_sv_undef; //fprintf(stderr, "here we are way before\n"); //fprintf(stderr, "here we are before\n"); res = val_resolve_and_check(ctx, domain, class, type, (u_int32_t) flags, &val_rc_ptr); //fprintf(stderr, "here we are after\n"); val_log_authentication_chain(ctx, LOG_DEBUG, domain, class, type, val_rc_ptr); if (res == 0) { RETVAL = rc_c2sv(val_rc_ptr); } else { sv_setiv(*error_svp, res); sv_setpv(*error_str_svp, p_val_err(res)); } val_free_result_chain(val_rc_ptr); } OUTPUT: RETVAL const char * pval_ac_status(err) int err CODE: { RETVAL = p_ac_status(err); } OUTPUT: RETVAL const char * pval_val_status(err) int err CODE: { RETVAL = p_val_status(err); } OUTPUT: RETVAL const char * pval_val_error(err) int err CODE: { RETVAL = p_val_err(err); } OUTPUT: RETVAL int pval_istrusted(err) int err CODE: { RETVAL = val_istrusted(err); } OUTPUT: RETVAL int pval_isvalidated(err) int err CODE: { RETVAL = val_isvalidated(err); } OUTPUT: RETVAL char * pval_gai_strerror(err) int err CODE: { RETVAL = (char*)gai_strerror(err); } OUTPUT: RETVAL char * pval_resolv_conf_get() CODE: { RETVAL = resolv_conf_get(); } OUTPUT: RETVAL int pval_resolv_conf_set(file) char *file CODE: { RETVAL = resolv_conf_set(file); } OUTPUT: RETVAL char * pval_root_hints_get() CODE: { RETVAL = root_hints_get(); } OUTPUT: RETVAL int pval_root_hints_set(file) char *file CODE: { RETVAL = root_hints_set(file); } OUTPUT: RETVAL char * pval_dnsval_conf_get() CODE: { RETVAL = dnsval_conf_get(); } OUTPUT: RETVAL int pval_dnsval_conf_set(file) char *file CODE: { RETVAL = dnsval_conf_set(file); } OUTPUT: RETVAL int pval_ns_mapto_zone(self,zone,addr,recursive) SV * self char * zone = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); char * addr = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); int recursive = (SvOK($arg) ? SvIV($arg) : 0); CODE: { ValContext * ctx; SV ** ctx_ref; ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); RETVAL = val_context_store_ns_for_zone(ctx, zone, addr, recursive); } OUTPUT: RETVAL SV * pval_async_submit(self,domain,class,type,flags, cbref, cbparam) SV * self char *domain = (SvOK($arg) ? (char *)SvPV_nolen($arg) : NULL); int class int type int flags SV *cbref = (SvOK($arg) ? $arg : NULL); SV *cbparam = (SvOK($arg) ? $arg : NULL); CODE: { SV **ctx_ref; ValContext *ctx; int ret; int inflight = 0; ValAsyncStatus *vas = NULL; AV * results = newAV(); struct _pval_async_cbdata *cbd = (struct _pval_async_cbdata *)malloc(sizeof(struct _pval_async_cbdata)); ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); cbd->cb = newSVsv(cbref); cbd->cb_data = newSVsv(cbparam); ret = val_async_submit(ctx, domain, class, type, flags, _pval_async_cb, cbd, &vas); inflight = (val_async_getflags(vas) & VAL_AS_INFLIGHT)? 1 : 0; av_push(results, newSViv(ret)); av_push(results, newSViv(inflight)); RETVAL = newRV_noinc((SV *)results); } OUTPUT: RETVAL SV * pval_async_gather(self,active,timeout) SV* self SV* active int timeout = (SvOK($arg) ? SvIV($arg):10); INIT: CODE: { SV **ctx_ref; AV *active_arr; AV *updated; SV *fd_cur = NULL; ValContext *ctx; int ret; fd_set activefds; struct timeval tv; int nfds = -1; int fd; int i; AV * results = newAV(); tv.tv_sec = timeout; tv.tv_usec = 0; FD_ZERO(&activefds); ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); // Update list of sockets that are ready for current validator // context ret = val_async_select_info(ctx, &activefds, &nfds, &tv); // Initialize the descriptors that are already set if ((SvROK(active)) && (SvTYPE(SvRV(active)) == SVt_PVAV)) { active_arr = (AV*) SvRV(active); while (av_len(active_arr) >= 0) { fd_cur = (SV*)av_shift((AV*)active_arr); fd = SvIV(fd_cur); FD_SET(fd, &activefds); nfds = (fd > nfds)? fd : nfds; } } updated = newAV(); for (i = 0 ; i <= nfds ; i++) { if (FD_ISSET(i, &activefds)) { fd_cur = newSViv(i); av_push(updated, fd_cur); } } av_push(results, newSViv(ret)); av_push(results, newRV_noinc((SV*) updated)); av_push(results, newSVnv(tv.tv_sec + tv.tv_usec/1000000)); RETVAL = newRV_noinc((SV *)results); } OUTPUT: RETVAL SV * pval_async_check(self,active) SV* self SV* active CODE: { SV **ctx_ref; AV *active_arr; SV *fd_cur = NULL; AV *updated; ValContext *ctx; int ret; fd_set activefds; int nfds = 0; int fd; int i; AV * results = newAV(); FD_ZERO(&activefds); // Initialize the descriptors that are already set if ((SvROK(active)) && (SvTYPE(SvRV(active)) == SVt_PVAV)) { active_arr = (AV*) SvRV(active); while (av_len(active_arr) >= 0) { fd_cur = (SV*)av_shift((AV*)active_arr); fd = SvIV(fd_cur); FD_SET(fd, &activefds); nfds = (fd > nfds)? fd : nfds; } } ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); //ret = val_async_check(ctx, &activefds, &nfds, 0); ret = val_async_check_wait(ctx, &activefds, &nfds, NULL, 0); updated = newAV(); for (i = 0 ; i <= nfds ; i++) { if (FD_ISSET(i, &activefds)) { fd_cur = newSViv(i); av_push(updated, fd_cur); } } av_push(results, newSViv(ret)); av_push(results, newRV_noinc((SV*) updated)); RETVAL = newRV_noinc((SV *)results); } OUTPUT: RETVAL int pval_async_gather_check_wait(self,timeout) SV * self int timeout = (SvOK($arg) ? SvIV($arg) : 10); CODE: { SV **ctx_ref; ValContext *ctx; int ret; fd_set activefds; int nfds = 0; struct timeval tv; tv.tv_sec = timeout; tv.tv_usec = 0; ctx_ref = hv_fetch((HV*)SvRV(self), "_ctx_ptr", 8, 1); ctx = (ValContext *)SvIV((SV*)SvRV(*ctx_ref)); FD_ZERO(&activefds); //ret = val_async_check_wait(ctx, NULL, NULL, &tv); val_async_select_info(ctx, &activefds, &nfds, &tv); ret = select(nfds+1, &activefds, NULL, NULL, &tv); if (ret >= 0) { ret = val_async_check(ctx, &activefds, &nfds, 0); } RETVAL = ret; } OUTPUT: RETVAL MODULE = Net::DNS::SEC::Validator PACKAGE = ValContextPtr PREFIX = vc_ void vc_DESTROY(vc_ptr) ValContext *vc_ptr CODE: { val_free_context( vc_ptr ); vc_ptr = NULL; } dnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/examples.pl0000664000237200023720000001105112544611342024610 0ustar hardakerhardaker#!/usr/bin/perl use Net::DNS::SEC::Validator; use Net::DNS::Packet; use Data::Dumper; my $flags = VAL_QUERY_AC_DETAIL|VAL_QUERY_CHECK_ALL_RRSIGS; sub print_result { my $tc = shift; my $ret = shift; my $a = shift; print "*******************************\n"; print "Completed = $tc Retval = $ret\n"; if (!$a) { print "Result = NULL\n"; return; } #print "\Result: " . Data::Dumper::Dumper($a) . "\n"; foreach $h (@$a) { my $ans = ${$h}{answer}; print "Status: " . ${$h}{status} . "\n"; foreach $ac (@$ans) { my $acr = ${$ac}{rrset}; my $acd = ${$acr}{data}; my $acs = ${$acr}{sigs}; my $serv = ${$acr}{respserv}; print "Answer AC status: " . ${$ac}{status} . "\n"; print "Response received from: " . $serv . "\n"; foreach $d (@$acd) { print "\tData RR status: " . Net::DNS::SEC::Validator::_ac_status(${$d}{rrstatus}) . "\n"; my $rr = ${$d}{rrdata}; if ($rr) { print "\tData RR name: " . $rr->name() . "\n"; print "\tData RR class: " . $rr->class() . "\n"; print "\tData RR type: " . $rr->type() . "\n"; print "\tData RR ttl: " . $rr->ttl() . "\n"; print "\tData RR data: " . $rr->rdatastr() . "\n"; } } foreach $d (@$acs) { print "\tSig RR status: " . Net::DNS::SEC::Validator::_ac_status(${$d}{rrstatus}) . "\n"; my $rr = ${$d}{rrdata}; if ($rr) { print "\tSig RR name: " . $rr->name . "\n"; print "\tSig RR class: " . $rr->class . "\n"; print "\tSig RR type: " . $rr->type . "\n"; print "\tSig RR ttl: " . $rr->ttl . "\n"; print "\tSig RR data: " . $rr->rdatastr() . "\n"; } } } # foreach $ac (${$h}{proofs}) { # print "Proof = " . Data::Dumper::Dumper($ac) . "\n"; # } } print "\n"; } ################################################## =pod $val1 = new Net::DNS::SEC::Validator( nslist => "8.8.8.8", log_target => "7:stderr", rec_fallback => 0, policy => ":", ); $r = $val1->res_query("good-a.test.dnssec-tools.org", "IN", "A"); my ($pkt, $err) = new Net::DNS::Packet(\$r); print ($val1->istrusted ? "result is trusted\n" : "result is NOT trusted\n"); $pkt->print; =cut ################################################## =pod my $val2 = new Net::DNS::SEC::Validator( nslist => "8.8.8.8", log_target => "7:stderr", rec_fallback => 0, policy => ":", ); $a = $val2->resolve_and_check("badsign-a.test.dnssec-tools.org", "IN", "A", 0); print_result("Test case sync 1", 0, $a); $a = $val2->resolve_and_check("good-cname-to-good-A.test.dnssec-tools.org", "IN", "A", $flags); print_result("Test case sync 2", 0, $a); =cut ################################################## my $val3 = new Net::DNS::SEC::Validator( nslist => "8.8.8.8", # log_target => "7:stderr", rec_fallback => 0, policy => ":", edns0_size => 1492, ); #$val3->map_ns("dnssec-tools.org", "168.150.236.43"); $val3->async_submit("good-a.test.dnssec-tools.org", "IN", "A", $flags, \&print_result, "async 1 "); $val3->async_submit("badsign-a.test.dnssec-tools.org", "IN", "A", $flags, \&print_result, "async 2"); $val3->async_submit("www.dnssec-tools.org", "IN", "A", $flags, \&print_result, "async 3"); $val3->async_submit("www.dnssec-deployment.org", "IN", "A", $flags, \&print_result, "async 4"); $val3->async_submit("good-cname-to-good-A.test.dnssec-tools.org", "IN", "A", $flags, \&print_result, "V1-4/4"); $val3->async_submit("dnssec-tools.org", "IN", "DNSKEY", $flags, \&print_result, "async 5"); my @valarr = ($val3); my $DEFAULT_TMOUT = 10; my $done = 0; while (!$done) { my $readfds = []; my $ref; my $ret; my $timeout = $DEFAULT_TMOUT; $done = 1; foreach my $val (@valarr) { $ref = $val->async_gather($readfds, $timeout); $ret = $ref->[0]; $readfds = $ref->[1]; $timeout = $ref->[2]; } @readyarr = IO::Select->new(@$readfds)->can_read($timeout); my $readyref = \@readyarr; foreach my $val (@valarr) { my $pending; $ref = $val->async_check($readyref); $pending = $ref->[0]; $readyref = $ref->[1]; if ($pending > 0) { $done = 0; } } } dnssec-tools-2.2/tools/modules/Net-DNS-SEC-Validator/README0000664000237200023720000001642412544611342023326 0ustar hardakerhardaker The Perl Net::DNS::SEC::Validator Extension Module Contents: Introduction: Availability: Contact: Release Notes: Installation: Operational Description: Upgrading: Copyright: Introduction: This Perl module is designed to implement and export functionality provided by the validating DNS resolver library, libval(3). The functions are provided through an easy-to-use object oriented interface. The interface is designed for the higher level user, hiding some of the complexity of validating resolvers. Nevertheless, application interface behavior can be customized through configuration files provided by libval(3) and extensive error codes returned. Details of DNSSEC and associated resolver behavior may be found in the core DNSSEC RFCs (4033-4035). Availability: The most recent release of this module can be found bundled with the latest DNSSEC-Tools distribution available from: http://www.dnssec-tools.org/resources/download.html This module should also be available through CPAN http://www.cpan.org Contact: The following mailing list should be consider the primary support mechanism for this module: dnssec-tools-users@lists.sourceforge.net mail list For bugs use: dnssec-tools-bugs@lists.sourceforge.net mail list Release Notes: The initial beta release of this extension module has been developed against perl-5.8.8. Only high level API functions are provided. Lower level API functions will be provided in a future release. Known Bugs: See the DNSSEC-Tools Bug Database: http://www.dnssec-tools.org/trac/ Installation: Libval(3) and related dnssec-tools headers and configuration files should first be installed. Also Net::addrinfo and Net::DNS modules should be installed. perl Makefile.PL make make test (must have access to DNS) make install (requires root privilege) Operational Description: Contructor: To create a validator object use the Net::DNS::SEC::Validator->new() method. This method optionally takes a policy label (policy => 'label'), or default to using the default label in the libval(3) dnsval.conf file. Data Fields: $validator->{error} => the latest method error code $validator->{errorStr} => the latest method error string $validator->{valStatus} => the val_status of last call (if single) $validator->{valStatusStr} => the val_status string of last call Methods: $validator->getaddrinfo([,[,]]) where => is the node name or numeric address being queried => is the name or number represting the service (note: or may be undef, but not both) => a Net::addrinfo object specying flags, family, etc. returns: an array of Net::addrinfo objects (augmented with a 'val_status' field). On error, returns an empty array. in scalar context returns first Net::addrinfo object, or undef on error. $validator->gethostbyname([,]) where => is the node name or numeric address being queried => the address family of returned entry (default: AF_INET) returns: A Net::hostent object. Validator valStatus/valStatusStr fields will be updated. On error, undef is returned and validator object error/errorStr fields are updated. $validator->res_query([,[,]]) where => is the node name or numeric address being queried => is the DNS class of the record being queried (default: IN) => is the DNS record type being queried (defailt A) returns: A packed DNS query result is returned on success. This object is suitable to be passed to the Net::DNS::Packet(\$result) interface for parsing. Validator valStatus/valStatusStr fields will be updated. On error, undef is returned and validator object error/errorStr fields are updated. $validator->resolve_and_check([, [, [, ]]]) where => is the node name or numeric address being queried => is the DNS class of the record being queried (default: IN) => is the DNS record type being queried (defailt A) => are the libval resolve_and_check control flags returns: returns a complex data structure of all answers and proofs related to given query: result = [{status, , }, ...] proofs = [, ...] answer = auth_chain = {status, , } trust = rrset = {, } data = {rrstatus, } sigs = {rrstatus, } rrdata = [Net::DNS::RR, ...] On error undef will be returned and validator object error/errorStr fields are updated. $validator->policy([