diff --git a/CHANGELOG b/CHANGELOG index 3428c265f..92fb3f790 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ #Nmap Changelog ($Id$); -*-text-*- +o [GH#2088][GH#1176][Zenmap] Updated Zenmap to Python 3 and PyGObject. [Jakub KulĂ­k] + o [GH#2541] UDP port scan (-sU) and version scan (-sV) now both use the same data source, nmap-service-probes, for data payloads. Previously, the nmap-payloads file was used for port scan. Port scan responses will be used diff --git a/configure b/configure index 284ef53c3..fdfb07a1b 100755 --- a/configure +++ b/configure @@ -1,9 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. +# Generated by GNU Autoconf 2.71. # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -14,14 +15,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (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 +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -31,46 +34,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. 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 +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; 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 || @@ -79,13 +82,6 @@ if test "${PATH_SEPARATOR+set}" != set; then 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 #(( @@ -94,8 +90,12 @@ case $0 in #(( 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -107,30 +107,10 @@ 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 + printf "%s\n" "$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. @@ -152,20 +132,22 @@ 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 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +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 : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (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 +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -185,42 +167,52 @@ 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 : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || 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 \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop 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=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac 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 + 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 : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 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 : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -228,14 +220,21 @@ fi 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 $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + 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 @@ -253,18 +252,19 @@ 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 +printf "%s\n" "$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." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, $0: 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." @@ -291,6 +291,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -308,6 +309,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -322,7 +331,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -331,7 +340,7 @@ $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" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -370,12 +379,13 @@ as_fn_executable_p () # 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 : +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 +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -387,18 +397,27 @@ fi # as_fn_append # 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 : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -410,9 +429,9 @@ 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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -439,7 +458,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -483,7 +502,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits 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; } + { printf "%s\n" "$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 @@ -497,6 +516,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -510,6 +533,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -575,50 +605,46 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= +PACKAGE_NAME='' +PACKAGE_TARNAME='' +PACKAGE_VERSION='' +PACKAGE_STRING='' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' ac_unique_file="nmap.cc" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # 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_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= enable_option_checking=no ac_subst_vars='LTLIBOBJS LIBOBJS @@ -649,6 +675,7 @@ LUA_BUILD LIBLUADIR LIBLUA_LIBS NOLUA +CPP DNET_DIST_CLEAN DNET_CLEAN DNET_BUILD @@ -702,9 +729,6 @@ PYTHON_EXEC_PREFIX PYTHON_PREFIX PYTHON_VERSION PYTHON -EGREP -GREP -CPP LUA_CFLAGS STRIP AWK @@ -805,8 +829,8 @@ CPPFLAGS CXX CXXFLAGS CCC -CPP -PYTHON' +PYTHON +CPP' ac_subdirs_all='nping libpcap libpcre @@ -883,8 +907,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -925,9 +947,9 @@ do 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" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -951,9 +973,9 @@ do 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" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1164,9 +1186,9 @@ do 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" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1180,9 +1202,9 @@ do 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" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1226,9 +1248,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$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 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1244,7 +1266,7 @@ 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 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1308,7 +1330,7 @@ $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" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1488,8 +1510,8 @@ Some influential environment variables: you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags - CPP C preprocessor PYTHON the Python interpreter + 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. @@ -1510,9 +1532,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$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|/||'` + ac_top_builddir_sub=`printf "%s\n" "$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/ ;; @@ -1540,7 +1562,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1548,7 +1571,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1558,9 +1581,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1577,14 +1600,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam 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 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1592,14 +1615,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$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 : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1615,14 +1639,14 @@ fi ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam 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 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1630,14 +1654,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1653,14 +1678,14 @@ fi 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 + rm -f conftest.$ac_objext conftest.beam 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 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1668,17 +1693,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$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 : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1693,134 +1719,43 @@ fi } # ac_fn_c_try_link -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () +# 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 - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_header_mongrel +} # ac_fn_c_check_header_compile # ac_fn_c_try_run LINENO # ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. +# Try to run 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 @@ -1830,25 +1765,26 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$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 +printf "%s\n" "$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 : + printf "%s\n" "$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 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status @@ -1859,56 +1795,28 @@ fi } # ac_fn_c_try_run -# 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_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { #ifndef $as_decl_name #ifdef __cplusplus @@ -1922,19 +1830,22 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_decl +} # ac_fn_check_decl # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- @@ -1942,11 +1853,12 @@ $as_echo "$ac_res" >&6; } 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1954,16 +1866,9 @@ else #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 + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1981,35 +1886,94 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func + +# 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\"" +printf "%s\n" "$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 + printf "%s\n" "$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_nop + printf "%s\n" "$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_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + 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 $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -2042,8 +2006,12 @@ 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" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2078,7 +2046,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2113,11 +2081,13 @@ done # 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=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2128,8 +2098,8 @@ trap 'exit_status=$? 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;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2153,7 +2123,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2161,14 +2131,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2176,15 +2146,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2192,8 +2162,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2207,63 +2177,48 @@ 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 +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # 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 + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files 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;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$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;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$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 @@ -2273,19 +2228,650 @@ 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*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 do not provoke an error unfortunately, instead are silently treated + as an "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 is necessary to write \x00 == 0 to get something + that is 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 **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="install-sh config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$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. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2296,12 +2882,12 @@ for ac_var in $ac_precious_vars; do 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -2310,24 +2896,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$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=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2337,11 +2923,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2356,17 +2943,18 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 -$as_echo_n "checking whether NLS is requested... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +printf %s "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. -if test "${enable_nls+set}" = set; then : +if test ${enable_nls+y} +then : enableval=$enable_nls; USE_NLS=$enableval -else +else $as_nop USE_NLS=yes fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 -$as_echo "$USE_NLS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +printf "%s\n" "$USE_NLS" >&6; } @@ -2375,7 +2963,8 @@ trace_no_use="" # Check whether --with-localdirs was given. -if test "${with_localdirs+set}" = set; then : +if test ${with_localdirs+y} +then : withval=$with_localdirs; case "$with_localdirs" in yes) user_localdirs=1 @@ -2385,7 +2974,7 @@ if test "${with_localdirs+set}" = set; then : ;; esac -else +else $as_nop user_localdirs=0 fi @@ -2422,55 +3011,30 @@ pcredir=libpcre ac_config_headers="$ac_config_headers nmap_config.h" -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. -# 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 + # 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 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` + 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 +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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; @@ -2489,21 +3053,22 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop 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 + 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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -2522,6 +3087,15 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2530,11 +3104,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2542,11 +3117,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2557,11 +3136,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2570,11 +3149,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2582,11 +3162,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2597,11 +3181,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2609,8 +3193,8 @@ fi 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2623,11 +3207,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2635,11 +3220,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2650,11 +3239,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2663,11 +3252,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2676,15 +3266,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac 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 + 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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2700,18 +3294,18 @@ if test $ac_prog_rejected = yes; then # 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+' '}$@" + 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2722,11 +3316,12 @@ if test -z "$CC"; then 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2734,11 +3329,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2749,11 +3348,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2766,11 +3365,12 @@ if test -z "$CC"; then 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2778,11 +3378,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2793,11 +3397,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2809,8 +3413,8 @@ done 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2818,25 +3422,129 @@ esac fi fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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}clang" + printf "%s\n" "$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +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;} +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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="clang" + printf "%s\n" "$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$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 + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$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 +printf "%s\n" "$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 +for ac_option in --version -v -V -qversion -version; 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 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2846,7 +3554,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -2854,7 +3562,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2866,9 +3574,9 @@ 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[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$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.*" @@ -2889,11 +3597,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$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 : + printf "%s\n" "$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, @@ -2910,7 +3619,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2926,44 +3635,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop 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 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$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;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$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; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "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 +printf "%s\n" "$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 : + printf "%s\n" "$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 @@ -2977,15 +3688,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) 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;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -2994,7 +3705,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3006,8 +3717,8 @@ _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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3015,10 +3726,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3026,39 +3737,40 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$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. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3072,11 +3784,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$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 : + printf "%s\n" "$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 @@ -3085,31 +3798,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$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;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3119,29 +3833,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam 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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3150,57 +3868,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3215,94 +3936,144 @@ 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_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop 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; -} +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +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 : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam 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 : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3312,32 +4083,34 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_inline=$ac_kw fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -3363,11 +4136,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3375,11 +4149,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3390,11 +4168,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3403,11 +4181,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3415,11 +4194,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3430,11 +4213,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -3442,8 +4225,8 @@ fi 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3456,11 +4239,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3468,11 +4252,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3483,11 +4271,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3496,11 +4284,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3509,15 +4298,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac 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 + 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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3533,18 +4326,18 @@ if test $ac_prog_rejected = yes; then # 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+' '}$@" + 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3555,11 +4348,12 @@ if test -z "$CC"; then 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3567,11 +4361,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3582,11 +4380,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3599,11 +4397,12 @@ if test -z "$CC"; then 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3611,11 +4410,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3626,11 +4429,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3642,8 +4445,8 @@ done 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3651,25 +4454,129 @@ esac fi fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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}clang" + printf "%s\n" "$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +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;} +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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="clang" + printf "%s\n" "$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$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 + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$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 +printf "%s\n" "$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 +for ac_option in --version -v -V -qversion -version; 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 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3679,20 +4586,21 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3702,29 +4610,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam 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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3733,57 +4645,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3798,94 +4713,144 @@ 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_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop 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; -} +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +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 : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam 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 : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3894,6 +4859,12 @@ 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 + + + + + + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3904,15 +4875,16 @@ if test -z "$CXX"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -3920,11 +4892,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3935,11 +4911,11 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3948,15 +4924,16 @@ fi fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -3964,11 +4941,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3979,11 +4960,11 @@ fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3995,8 +4976,8 @@ done 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -4006,7 +4987,7 @@ fi fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +printf "%s\n" "$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 @@ -4016,7 +4997,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -4026,20 +5007,21 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -4049,29 +5031,33 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -4080,57 +5066,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes -else +else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -else +else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -4145,6 +5134,100 @@ else CXXFLAGS= fi fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4154,11 +5237,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -4166,11 +5250,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + 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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4181,11 +5269,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4194,11 +5282,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -4206,11 +5295,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4221,11 +5314,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -4233,8 +5326,8 @@ fi 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -4243,7 +5336,8 @@ else RANLIB="$ac_cv_prog_RANLIB" fi -# Find a good install program. We prefer a C program (faster), + + # 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 @@ -4257,20 +5351,25 @@ fi # 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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "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 +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop 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]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -4280,13 +5379,13 @@ case $as_dir/ in #(( # 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 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 + 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 + 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 @@ -4294,12 +5393,12 @@ case $as_dir/ in #(( 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" && + 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" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -4315,7 +5414,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -4325,8 +5424,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -4340,11 +5439,12 @@ 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -4352,11 +5452,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + 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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4367,11 +5471,11 @@ 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; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4389,8 +5493,8 @@ fi CFLAGS="$CFLAGS -Wall" # Remember that all following tests will run with this CXXFLAGS by default -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __func__" >&5 -$as_echo_n "checking for __func__... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __func__" >&5 +printf %s "checking for __func__... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4398,55 +5502,57 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #include int -main () +main (void) { printf ("%s", __func__); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_func=yes -else +else $as_nop have_func=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "x$have_func" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5 -$as_echo_n "checking for __FUNCTION__... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5 +printf %s "checking for __FUNCTION__... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { printf ("%s", __FUNCTION__); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_function=yes -else +else $as_nop have_function=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "x$have_function" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - $as_echo "#define __func__ __FUNCTION__" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + printf "%s\n" "#define __func__ __FUNCTION__" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - $as_echo "#define __func__ __FILE__" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + printf "%s\n" "#define __func__ __FILE__" >>confdefs.h fi fi @@ -4454,11 +5560,12 @@ 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_path_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $STRIP in [\\/]* | ?:[\\/]*) ac_cv_path_STRIP="$STRIP" # Let the user override the test with a path. @@ -4468,11 +5575,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac 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_STRIP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_STRIP="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4484,11 +5595,11 @@ esac fi STRIP=$ac_cv_path_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4497,11 +5608,12 @@ if test -z "$ac_cv_path_STRIP"; then ac_pt_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_path_ac_pt_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $ac_pt_STRIP in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_STRIP="$ac_pt_STRIP" # Let the user override the test with a path. @@ -4511,11 +5623,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac 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_ac_pt_STRIP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_STRIP="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4527,11 +5643,11 @@ esac fi ac_pt_STRIP=$ac_cv_path_ac_pt_STRIP if test -n "$ac_pt_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_STRIP" >&5 -$as_echo "$ac_pt_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_STRIP" >&5 +printf "%s\n" "$ac_pt_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_pt_STRIP" = x; then @@ -4539,8 +5655,8 @@ fi 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_pt_STRIP @@ -4559,48 +5675,49 @@ LUA_CFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" case "$host" in *alpha-dec-osf*) -$as_echo "#define DEC 1" >>confdefs.h +printf "%s\n" "#define DEC 1" >>confdefs.h ;; *-netbsd* | *-knetbsd*-gnu) -$as_echo "#define NETBSD 1" >>confdefs.h +printf "%s\n" "#define NETBSD 1" >>confdefs.h LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support ;; *-openbsd*) -$as_echo "#define OPENBSD 1" >>confdefs.h +printf "%s\n" "#define OPENBSD 1" >>confdefs.h LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support ;; *-freebsd* | *-kfreebsd*-gnu | *-dragonfly*) -$as_echo "#define FREEBSD 1" >>confdefs.h +printf "%s\n" "#define FREEBSD 1" >>confdefs.h LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support ;; *-bsdi*) -$as_echo "#define BSDI 1" >>confdefs.h +printf "%s\n" "#define BSDI 1" >>confdefs.h ;; *-sgi-irix5* | *-sgi-irix6*) -$as_echo "#define IRIX 1" >>confdefs.h +printf "%s\n" "#define IRIX 1" >>confdefs.h ;; *-hpux*) -$as_echo "#define HPUX 1" >>confdefs.h +printf "%s\n" "#define HPUX 1" >>confdefs.h # To link with libnet and NM (/usr/lib/libnm.sl) library # on HP-UX 11.11 (other versions?) Mikhail Zakharov (zmey20000@yahoo.com) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for open_mib in -lnm" >&5 -$as_echo_n "checking for open_mib in -lnm... " >&6; } -if ${ac_cv_lib_nm_open_mib+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for open_mib in -lnm" >&5 +printf %s "checking for open_mib in -lnm... " >&6; } +if test ${ac_cv_lib_nm_open_mib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lnm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4609,33 +5726,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 open_mib (); int -main () +main (void) { return open_mib (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_nm_open_mib=yes -else +else $as_nop ac_cv_lib_nm_open_mib=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nm_open_mib" >&5 -$as_echo "$ac_cv_lib_nm_open_mib" >&6; } -if test "x$ac_cv_lib_nm_open_mib" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNM 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nm_open_mib" >&5 +printf "%s\n" "$ac_cv_lib_nm_open_mib" >&6; } +if test "x$ac_cv_lib_nm_open_mib" = xyes +then : + printf "%s\n" "#define HAVE_LIBNM 1" >>confdefs.h LIBS="-lnm $LIBS" @@ -4644,11 +5758,12 @@ fi ;; *-aix*) # use some AIX specific libraries - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for odm_initialize in -lodm" >&5 -$as_echo_n "checking for odm_initialize in -lodm... " >&6; } -if ${ac_cv_lib_odm_odm_initialize+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for odm_initialize in -lodm" >&5 +printf %s "checking for odm_initialize in -lodm... " >&6; } +if test ${ac_cv_lib_odm_odm_initialize+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lodm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4657,43 +5772,41 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 odm_initialize (); int -main () +main (void) { return odm_initialize (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_odm_odm_initialize=yes -else +else $as_nop ac_cv_lib_odm_odm_initialize=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_odm_odm_initialize" >&5 -$as_echo "$ac_cv_lib_odm_odm_initialize" >&6; } -if test "x$ac_cv_lib_odm_odm_initialize" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBODM 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_odm_odm_initialize" >&5 +printf "%s\n" "$ac_cv_lib_odm_odm_initialize" >&6; } +if test "x$ac_cv_lib_odm_odm_initialize" = xyes +then : + printf "%s\n" "#define HAVE_LIBODM 1" >>confdefs.h LIBS="-lodm $LIBS" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _system_configuration in -lcfg" >&5 -$as_echo_n "checking for _system_configuration in -lcfg... " >&6; } -if ${ac_cv_lib_cfg__system_configuration+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _system_configuration in -lcfg" >&5 +printf %s "checking for _system_configuration in -lcfg... " >&6; } +if test ${ac_cv_lib_cfg__system_configuration+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcfg $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4702,43 +5815,41 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 _system_configuration (); int -main () +main (void) { return _system_configuration (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_cfg__system_configuration=yes -else +else $as_nop ac_cv_lib_cfg__system_configuration=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cfg__system_configuration" >&5 -$as_echo "$ac_cv_lib_cfg__system_configuration" >&6; } -if test "x$ac_cv_lib_cfg__system_configuration" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBCFG 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cfg__system_configuration" >&5 +printf "%s\n" "$ac_cv_lib_cfg__system_configuration" >&6; } +if test "x$ac_cv_lib_cfg__system_configuration" = xyes +then : + printf "%s\n" "#define HAVE_LIBCFG 1" >>confdefs.h LIBS="-lcfg $LIBS" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt_r in -lcrypt" >&5 -$as_echo_n "checking for crypt_r in -lcrypt... " >&6; } -if ${ac_cv_lib_crypt_crypt_r+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for crypt_r in -lcrypt" >&5 +printf %s "checking for crypt_r in -lcrypt... " >&6; } +if test ${ac_cv_lib_crypt_crypt_r+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4747,33 +5858,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 crypt_r (); int -main () +main (void) { return crypt_r (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_crypt_crypt_r=yes -else +else $as_nop ac_cv_lib_crypt_crypt_r=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt_r" >&5 -$as_echo "$ac_cv_lib_crypt_crypt_r" >&6; } -if test "x$ac_cv_lib_crypt_crypt_r" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBCRYPT 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt_r" >&5 +printf "%s\n" "$ac_cv_lib_crypt_crypt_r" >&6; } +if test "x$ac_cv_lib_crypt_crypt_r" = xyes +then : + printf "%s\n" "#define HAVE_LIBCRYPT 1" >>confdefs.h LIBS="-lcrypt $LIBS" @@ -4781,80 +5889,81 @@ fi ;; *-solaris2.1[1-9]*) - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h # Solaris 11 and later use BPF packet capture rather than DLPI. -$as_echo "#define SOLARIS_BPF_PCAP_CAPTURE 1" >>confdefs.h +printf "%s\n" "#define SOLARIS_BPF_PCAP_CAPTURE 1" >>confdefs.h ;; *-solaris2.0*) - $as_echo "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-solaris2.[1-9][0-9]*) - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-solaris2.1*) - $as_echo "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-solaris2.2*) - $as_echo "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-solaris2.3*) - $as_echo "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-solaris2.4*) - $as_echo "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-solaris2.5.1) - $as_echo "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-solaris*) - $as_echo "#define SOLARIS 1" >>confdefs.h + printf "%s\n" "#define SOLARIS 1" >>confdefs.h ;; *-sunos4*) -$as_echo "#define SUNOS 1" >>confdefs.h +printf "%s\n" "#define SUNOS 1" >>confdefs.h -$as_echo "#define SPRINTF_RETURNS_STRING 1" >>confdefs.h +printf "%s\n" "#define SPRINTF_RETURNS_STRING 1" >>confdefs.h ;; *-linux*) -$as_echo "#define LINUX 1" >>confdefs.h +printf "%s\n" "#define LINUX 1" >>confdefs.h LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support ;; *-apple-darwin*) -$as_echo "#define MACOSX 1" >>confdefs.h +printf "%s\n" "#define MACOSX 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 -$as_echo_n "checking for main in -lm... " >&6; } -if ${ac_cv_lib_m_main+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 +printf %s "checking for main in -lm... " >&6; } +if test ${ac_cv_lib_m_main+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4862,28 +5971,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext int -main () +main (void) { return main (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_m_main=yes -else +else $as_nop ac_cv_lib_m_main=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 -$as_echo "$ac_cv_lib_m_main" >&6; } -if test "x$ac_cv_lib_m_main" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBM 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 +printf "%s\n" "$ac_cv_lib_m_main" >&6; } +if test "x$ac_cv_lib_m_main" = xyes +then : + printf "%s\n" "#define HAVE_LIBM 1" >>confdefs.h LIBS="-lm $LIBS" @@ -4896,444 +6005,88 @@ 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 +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - 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 + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h 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 + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item fi -else - ac_cv_path_GREP=$GREP -fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h 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" +ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" +if test "x$ac_cv_header_pwd_h" = xyes +then : + printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h - -{ $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 +ac_fn_c_check_header_compile "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default" +if test "x$ac_cv_header_termios_h" = xyes +then : + printf "%s\n" "#define HAVE_TERMIOS_H 1" >>confdefs.h - 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" +ac_fn_c_check_header_compile "$LINENO" "sys/sockio.h" "ac_cv_header_sys_sockio_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sockio_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SOCKIO_H 1" >>confdefs.h - -{ $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 +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h -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* +ac_fn_c_check_header_compile "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_stat_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_STAT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h 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 +ac_fn_c_check_header_compile "$LINENO" "linux/rtnetlink.h" "ac_cv_header_linux_rtnetlink_h" "#include " -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 +if test "x$ac_cv_header_linux_rtnetlink_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_RTNETLINK_H 1" >>confdefs.h fi -done - - -for ac_header in pwd.h termios.h sys/sockio.h stdint.h sys/stat.h fcntl.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h fi -done - -for ac_header in linux/rtnetlink.h -do : - ac_fn_c_check_header_compile "$LINENO" "linux/rtnetlink.h" "ac_cv_header_linux_rtnetlink_h" "#include -" -if test "x$ac_cv_header_linux_rtnetlink_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LINUX_RTNETLINK_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/socket.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_socket_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_SOCKET_H 1 -_ACEOF - -fi - -done - -for ac_header in net/if.h -do : - ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "#include +ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "#include #ifdef STDC_HEADERS # include # include @@ -5347,21 +6100,19 @@ do : #endif " -if test "x$ac_cv_header_net_if_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NET_IF_H 1 -_ACEOF +if test "x$ac_cv_header_net_if_h" = xyes +then : + printf "%s\n" "#define HAVE_NET_IF_H 1" >>confdefs.h fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5 -$as_echo_n "checking for library containing setsockopt... " >&6; } -if ${ac_cv_search_setsockopt+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5 +printf %s "checking for library containing setsockopt... " >&6; } +if test ${ac_cv_search_setsockopt+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5369,55 +6120,58 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 setsockopt (); int -main () +main (void) { return setsockopt (); ; return 0; } _ACEOF -for ac_lib in '' socket; do +for ac_lib in '' socket +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_setsockopt=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_setsockopt+:} false; then : + if test ${ac_cv_search_setsockopt+y} +then : break fi done -if ${ac_cv_search_setsockopt+:} false; then : +if test ${ac_cv_search_setsockopt+y} +then : -else +else $as_nop ac_cv_search_setsockopt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setsockopt" >&5 -$as_echo "$ac_cv_search_setsockopt" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setsockopt" >&5 +printf "%s\n" "$ac_cv_search_setsockopt" >&6; } ac_res=$ac_cv_search_setsockopt -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 -$as_echo_n "checking for library containing gethostbyname... " >&6; } -if ${ac_cv_search_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 +printf %s "checking for library containing gethostbyname... " >&6; } +if test ${ac_cv_search_gethostbyname+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5425,66 +6179,68 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 gethostbyname (); int -main () +main (void) { return gethostbyname (); ; return 0; } _ACEOF -for ac_lib in '' nsl; do +for ac_lib in '' nsl +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_gethostbyname=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_gethostbyname+:} false; then : + if test ${ac_cv_search_gethostbyname+y} +then : break fi done -if ${ac_cv_search_gethostbyname+:} false; then : +if test ${ac_cv_search_gethostbyname+y} +then : -else +else $as_nop ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 -$as_echo "$ac_cv_search_gethostbyname" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 +printf "%s\n" "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if AF_INET6 IPPROTO_RAW sockets include the packet header" >&5 -$as_echo_n "checking if AF_INET6 IPPROTO_RAW sockets include the packet header... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if AF_INET6 IPPROTO_RAW sockets include the packet header" >&5 +printf %s "checking if AF_INET6 IPPROTO_RAW sockets include the packet header... " >&6; } # This should be replaced with a better test, if possible. case "$host" in *-linux*) -$as_echo "#define HAVE_IPV6_IPPROTO_RAW 1" >>confdefs.h +printf "%s\n" "#define HAVE_IPV6_IPPROTO_RAW 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } ;; esac @@ -5498,13 +6254,13 @@ $as_echo "no" >&6; } if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 2.4" >&5 -$as_echo_n "checking whether $PYTHON version is >= 2.4... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 3" >&5 +printf %s "checking whether $PYTHON version is >= 3... " >&6; } prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.4'.split('.'))) + [0, 0, 0] +minver = list(map(int, '3'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] @@ -5513,31 +6269,33 @@ sys.exit(sys.hexversion < minverhex)" ($PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + (exit $ac_status); } +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } as_fn_error $? "Python interpreter is too old" "$LINENO" 5 fi am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.4" >&5 -$as_echo_n "checking for a Python interpreter with version >= 2.4... " >&6; } -if ${am_cv_pathless_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 3" >&5 +printf %s "checking for a Python interpreter with version >= 3... " >&6; } +if test ${am_cv_pathless_PYTHON+y} +then : + printf %s "(cached) " >&6 +else $as_nop - for am_cv_pathless_PYTHON in python2 python2.7 python2.6 python2.5 python2.4 python none; do + for am_cv_pathless_PYTHON in python3 python none; do test "$am_cv_pathless_PYTHON" = none && break prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.4'.split('.'))) + [0, 0, 0] +minver = list(map(int, '3'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] @@ -5546,24 +6304,26 @@ sys.exit(sys.hexversion < minverhex)" ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : + (exit $ac_status); } +then : break fi done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 -$as_echo "$am_cv_pathless_PYTHON" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 +printf "%s\n" "$am_cv_pathless_PYTHON" >&6; } # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. set dummy $am_cv_pathless_PYTHON; 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_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PYTHON+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. @@ -5573,11 +6333,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac 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_PYTHON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PYTHON="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5589,11 +6353,11 @@ esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +printf "%s\n" "$PYTHON" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5607,15 +6371,16 @@ fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 -$as_echo_n "checking for $am_display_PYTHON version... " >&6; } -if ${am_cv_python_version+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 +printf %s "checking for $am_display_PYTHON version... " >&6; } +if test ${am_cv_python_version+y} +then : + printf %s "(cached) " >&6 +else $as_nop am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 -$as_echo "$am_cv_python_version" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 +printf "%s\n" "$am_cv_python_version" >&6; } PYTHON_VERSION=$am_cv_python_version @@ -5626,15 +6391,16 @@ $as_echo "$am_cv_python_version" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 -$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } -if ${am_cv_python_platform+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 +printf %s "checking for $am_display_PYTHON platform... " >&6; } +if test ${am_cv_python_platform+y} +then : + printf %s "(cached) " >&6 +else $as_nop am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 -$as_echo "$am_cv_python_platform" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 +printf "%s\n" "$am_cv_python_platform" >&6; } PYTHON_PLATFORM=$am_cv_python_platform @@ -5659,11 +6425,12 @@ except ImportError: pass" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 -$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } -if ${am_cv_python_pythondir+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 +printf %s "checking for $am_display_PYTHON script directory... " >&6; } +if test ${am_cv_python_pythondir+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix @@ -5694,8 +6461,8 @@ sys.stdout.write(sitedir)"` esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 -$as_echo "$am_cv_python_pythondir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 +printf "%s\n" "$am_cv_python_pythondir" >&6; } pythondir=$am_cv_python_pythondir @@ -5703,11 +6470,12 @@ $as_echo "$am_cv_python_pythondir" >&6; } pkgpythondir=\${pythondir}/$PACKAGE - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 -$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } -if ${am_cv_python_pyexecdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 +printf %s "checking for $am_display_PYTHON extension module directory... " >&6; } +if test ${am_cv_python_pyexecdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix @@ -5738,8 +6506,8 @@ sys.stdout.write(sitedir)"` esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 -$as_echo "$am_cv_python_pyexecdir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 +printf "%s\n" "$am_cv_python_pyexecdir" >&6; } pyexecdir=$am_cv_python_pyexecdir @@ -5751,31 +6519,28 @@ $as_echo "$am_cv_python_pyexecdir" >&6; } fi -HAVE_PYTHON2=false -if test $HAVE_PYTHON && test "x${PYTHON_VERSION%%.*}" = "x2"; then - HAVE_PYTHON2=true -fi NDIFFDIR=ndiff # Do they want Ndiff? # Check whether --with-ndiff was given. -if test "${with_ndiff+set}" = set; then : +if test ${with_ndiff+y} +then : withval=$with_ndiff; -else +else $as_nop with_ndiff=check fi -if $HAVE_PYTHON2 ; then : ; +if $HAVE_PYTHON ; then : ; else if test "$with_ndiff" = "check" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not building Ndiff because Python 2.x with x>=4 was not found" >&5 -$as_echo "$as_me: WARNING: Not building Ndiff because Python 2.x with x>=4 was not found" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Ndiff because Python was not found" >&5 +printf "%s\n" "$as_me: WARNING: Not building Ndiff because Python was not found" >&2;} elif test "$with_ndiff" = "yes"; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "--with-ndiff requires Python 2.x with x>=4 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "--with-ndiff requires Python See \`config.log' for more details" "$LINENO" 5; } fi with_ndiff=no @@ -5810,22 +6575,23 @@ ZENMAPDIR=zenmap # Do they want Zenmap? # Check whether --with-zenmap was given. -if test "${with_zenmap+set}" = set; then : +if test ${with_zenmap+y} +then : withval=$with_zenmap; -else +else $as_nop with_zenmap=check fi -if $HAVE_PYTHON2 ; then : ; +if $HAVE_PYTHON ; then : ; else if test "$with_zenmap" = "check"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not building Zenmap because Python 2.x with x>=4 was not found" >&5 -$as_echo "$as_me: WARNING: Not building Zenmap because Python 2.x with x>=4 was not found" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Zenmap because Python was not found" >&5 +printf "%s\n" "$as_me: WARNING: Not building Zenmap because Python was not found" >&2;} elif test "$with_zenmap" = "yes"; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "--with-zenmap requires Python 2.x with x>=4 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "--with-zenmap requires Python See \`config.log' for more details" "$LINENO" 5; } fi with_zenmap=no @@ -5860,9 +6626,10 @@ NPINGDIR=nping # Do they want Nping? # Check whether --with-nping was given. -if test "${with_nping+set}" = set; then : +if test ${with_nping+y} +then : withval=$with_nping; -else +else $as_nop with_nping=check fi @@ -5894,11 +6661,12 @@ fi # OpenSSL and NSE C modules can require dlopen -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if ${ac_cv_search_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +printf %s "checking for library containing dlopen... " >&6; } +if test ${ac_cv_search_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5906,46 +6674,48 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 () +main (void) { return dlopen (); ; return 0; } _ACEOF -for ac_lib in '' dl; do +for ac_lib in '' dl +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_dlopen=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_dlopen+:} false; then : + if test ${ac_cv_search_dlopen+y} +then : break fi done -if ${ac_cv_search_dlopen+:} false; then : +if test ${ac_cv_search_dlopen+y} +then : -else +else $as_nop ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +printf "%s\n" "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi @@ -5956,7 +6726,8 @@ use_openssl="yes" specialssldir="" # Check whether --with-openssl was given. -if test "${with_openssl+set}" = set; then : +if test ${with_openssl+y} +then : withval=$with_openssl; case "$with_openssl" in yes) ;; @@ -5976,10 +6747,11 @@ fi # If they didn't specify it, we try to find it if test "$use_openssl" = "yes"; then - ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default" -if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default" +if test "x$ac_cv_header_openssl_ssl_h" = xyes +then : -else +else $as_nop use_openssl="no" if test -n "$specialssldir"; then as_fn_error $? "Specific OpenSSL location was requested but openssl/ssl.h was not found. Try correcting the --with-openssl=DIR argument." "$LINENO" 5 @@ -5987,21 +6759,21 @@ else if test "$with_openssl" = "yes"; then as_fn_error $? "OpenSSL was explicitly requested but openssl/ssl.h was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." "$LINENO" 5 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5 -$as_echo "$as_me: WARNING: Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5 +printf "%s\n" "$as_me: WARNING: Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;} fi - fi # use_openssl="yes" given explicitly in next 2 rules to avoid adding lib to $LIBS if test "$use_openssl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BIO_int_ctrl in -lcrypto" >&5 -$as_echo_n "checking for BIO_int_ctrl in -lcrypto... " >&6; } -if ${ac_cv_lib_crypto_BIO_int_ctrl+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BIO_int_ctrl in -lcrypto" >&5 +printf %s "checking for BIO_int_ctrl in -lcrypto... " >&6; } +if test ${ac_cv_lib_crypto_BIO_int_ctrl+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6010,32 +6782,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 BIO_int_ctrl (); int -main () +main (void) { return BIO_int_ctrl (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_crypto_BIO_int_ctrl=yes -else +else $as_nop ac_cv_lib_crypto_BIO_int_ctrl=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_BIO_int_ctrl" >&5 -$as_echo "$ac_cv_lib_crypto_BIO_int_ctrl" >&6; } -if test "x$ac_cv_lib_crypto_BIO_int_ctrl" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_BIO_int_ctrl" >&5 +printf "%s\n" "$ac_cv_lib_crypto_BIO_int_ctrl" >&6; } +if test "x$ac_cv_lib_crypto_BIO_int_ctrl" = xyes +then : use_openssl="yes" -else +else $as_nop use_openssl="no" if test -n "$specialssldir"; then as_fn_error $? "Specific OpenSSL location was requested but libcrypto was not found. Try correcting the --with-openssl=DIR argument." "$LINENO" 5 @@ -6043,19 +6814,20 @@ else if test "$with_openssl" = "yes"; then as_fn_error $? "OpenSSL was explicitly requested but libcrypto was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." "$LINENO" 5 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5 -$as_echo "$as_me: WARNING: Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5 +printf "%s\n" "$as_me: WARNING: Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;} fi fi if test "$use_openssl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5 -$as_echo_n "checking for SSL_new in -lssl... " >&6; } -if ${ac_cv_lib_ssl_SSL_new+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5 +printf %s "checking for SSL_new in -lssl... " >&6; } +if test ${ac_cv_lib_ssl_SSL_new+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lssl -lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6064,32 +6836,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 SSL_new (); int -main () +main (void) { return SSL_new (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_ssl_SSL_new=yes -else +else $as_nop ac_cv_lib_ssl_SSL_new=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5 -$as_echo "$ac_cv_lib_ssl_SSL_new" >&6; } -if test "x$ac_cv_lib_ssl_SSL_new" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5 +printf "%s\n" "$ac_cv_lib_ssl_SSL_new" >&6; } +if test "x$ac_cv_lib_ssl_SSL_new" = xyes +then : use_openssl="yes" -else +else $as_nop use_openssl="no" if test -n "$specialssldir"; then as_fn_error $? "Specific OpenSSL location was requested but libssl was not found. Try correcting the --with-openssl=DIR argument." "$LINENO" 5 @@ -6097,8 +6868,8 @@ else if test "$with_openssl" = "yes"; then as_fn_error $? "OpenSSL was explicitly requested but libssl was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl." "$LINENO" 5 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5 -$as_echo "$as_me: WARNING: Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&5 +printf "%s\n" "$as_me: WARNING: Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;} fi @@ -6108,7 +6879,7 @@ OPENSSL_LIBS= if test "$use_openssl" = "yes"; then trace_use="$trace_use openssl" -$as_echo "#define HAVE_OPENSSL 1" >>confdefs.h +printf "%s\n" "#define HAVE_OPENSSL 1" >>confdefs.h OPENSSL_LIBS="-lssl -lcrypto" else @@ -6124,17 +6895,20 @@ test "${with_libpcap+set}" != "set" && with_libpcap=yes # Check whether --with-libpcap was given. -if test "${with_libpcap+set}" = set; then : +if test ${with_libpcap+y} +then : withval=$with_libpcap; case "$with_libpcap" in yes) - ac_fn_c_check_header_mongrel "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" -if test "x$ac_cv_header_pcap_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_h" = xyes +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_create in -lpcap" >&5 -$as_echo_n "checking for pcap_create in -lpcap... " >&6; } -if ${ac_cv_lib_pcap_pcap_create+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcap_create in -lpcap" >&5 +printf %s "checking for pcap_create in -lpcap... " >&6; } +if test ${ac_cv_lib_pcap_pcap_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpcap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6143,36 +6917,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 pcap_create (); int -main () +main (void) { return pcap_create (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_pcap_pcap_create=yes -else +else $as_nop ac_cv_lib_pcap_pcap_create=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_create" >&5 -$as_echo "$ac_cv_lib_pcap_pcap_create" >&6; } -if test "x$ac_cv_lib_pcap_pcap_create" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_create" >&5 +printf "%s\n" "$ac_cv_lib_pcap_pcap_create" >&6; } +if test "x$ac_cv_lib_pcap_pcap_create" = xyes +then : have_libpcap=yes fi fi - ;; included) have_libpcap=no @@ -6184,14 +6956,16 @@ fi CPPFLAGS="-I$with_libpcap/include $CPPFLAGS" LDFLAGS="-L$with_libpcap/lib $LDFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" -if test "x$ac_cv_header_pcap_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_h" = xyes +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_create in -lpcap" >&5 -$as_echo_n "checking for pcap_create in -lpcap... " >&6; } -if ${ac_cv_lib_pcap_pcap_create+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcap_create in -lpcap" >&5 +printf %s "checking for pcap_create in -lpcap... " >&6; } +if test ${ac_cv_lib_pcap_pcap_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpcap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6200,30 +6974,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 pcap_create (); int -main () +main (void) { return pcap_create (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_pcap_pcap_create=yes -else +else $as_nop ac_cv_lib_pcap_pcap_create=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_create" >&5 -$as_echo "$ac_cv_lib_pcap_pcap_create" >&6; } -if test "x$ac_cv_lib_pcap_pcap_create" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_create" >&5 +printf "%s\n" "$ac_cv_lib_pcap_pcap_create" >&6; } +if test "x$ac_cv_lib_pcap_pcap_create" = xyes +then : have_libpcap=yes LIBPCAP_INC=$with_libpcap/include LIBPCAP_LIB=$with_libpcap/lib @@ -6232,7 +7005,6 @@ fi fi - LDFLAGS=$_ldflags CPPFLAGS=$_cppflags ;; @@ -6254,26 +7026,113 @@ if test $have_libpcap = yes; then # link with -lpcap for the purposes of this test LIBS_OLD="$LIBS" LIBS="$LIBS -lpcap" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - for ac_header in sys/ioccom.h sys/time.h net/bpf.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +int +main (void) +{ +(void) strchr; + ; + return 0; +} _ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + + + ac_fn_c_check_header_compile "$LINENO" "sys/ioccom.h" "ac_cv_header_sys_ioccom_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ioccom_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_IOCCOM_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "net/bpf.h" "ac_cv_header_net_bpf_h" "$ac_includes_default" +if test "x$ac_cv_header_net_bpf_h" = xyes +then : + printf "%s\n" "#define HAVE_NET_BPF_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libpcap is suitable" >&5 -$as_echo_n "checking if libpcap is suitable... " >&6; } - if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling -- assuming yes" >&5 -$as_echo "cross-compiling -- assuming yes" >&6; }; have_libpcap=yes -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libpcap is suitable" >&5 +printf %s "checking if libpcap is suitable... " >&6; } + if test "$cross_compiling" = yes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cross-compiling -- assuming yes" >&5 +printf "%s\n" "cross-compiling -- assuming yes" >&6; }; have_libpcap=yes +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6292,14 +7151,16 @@ int main() { } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6330,31 +7191,32 @@ int main() { } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : - ac_fn_c_check_decl "$LINENO" "pcap_get_selectable_fd" "ac_cv_have_decl_pcap_get_selectable_fd" "#include -" -if test "x$ac_cv_have_decl_pcap_get_selectable_fd" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; }; have_libpcap=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no -- pcap_get_selectable_fd not declared" >&5 -$as_echo "no -- pcap_get_selectable_fd not declared" >&6; }; have_libpcap=no + ac_fn_check_decl "$LINENO" "pcap_get_selectable_fd" "ac_cv_have_decl_pcap_get_selectable_fd" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_pcap_get_selectable_fd" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; }; have_libpcap=yes +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no -- pcap_get_selectable_fd not declared" >&5 +printf "%s\n" "no -- pcap_get_selectable_fd not declared" >&6; }; have_libpcap=no fi - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no -- BPF_TIMEOUT BIOCSRTIMEOUT bug (64-bit OS X)" >&5 -$as_echo "no -- BPF_TIMEOUT BIOCSRTIMEOUT bug (64-bit OS X)" >&6; }; have_libpcap=no +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no -- BPF_TIMEOUT BIOCSRTIMEOUT bug (64-bit OS X)" >&5 +printf "%s\n" "no -- BPF_TIMEOUT BIOCSRTIMEOUT bug (64-bit OS X)" >&6; }; have_libpcap=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; have_libpcap=no +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; }; have_libpcap=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -6377,32 +7239,28 @@ if test $have_libpcap != yes; then PCAP_CLEAN="clean-pcap" PCAP_DIST_CLEAN="distclean-pcap" -$as_echo "#define PCAP_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define PCAP_INCLUDED 1" >>confdefs.h -$as_echo "#define HAVE_PCAP_SET_IMMEDIATE_MODE 1" >>confdefs.h +printf "%s\n" "#define HAVE_PCAP_SET_IMMEDIATE_MODE 1" >>confdefs.h else # We assume our included libpcap doesn't need this check-and-define # link with -lpcap for the purposes of this test LIBS_OLD="$LIBS" LIBS="$LIBS -lpcap" - for ac_func in pcap_set_immediate_mode -do : ac_fn_c_check_func "$LINENO" "pcap_set_immediate_mode" "ac_cv_func_pcap_set_immediate_mode" -if test "x$ac_cv_func_pcap_set_immediate_mode" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PCAP_SET_IMMEDIATE_MODE 1 -_ACEOF +if test "x$ac_cv_func_pcap_set_immediate_mode" = xyes +then : + printf "%s\n" "#define HAVE_PCAP_SET_IMMEDIATE_MODE 1" >>confdefs.h fi -done # Restore libs LIBS="$LIBS_OLD" -$as_echo "#define HAVE_LIBPCAP 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBPCAP 1" >>confdefs.h LIBPCAP_LIBS="-lpcap" PCAP_BUILD="" @@ -6422,7 +7280,8 @@ LIBPCREDIR=libpcre # First we test whether they specified libpcre explicitly # Check whether --with-libpcre was given. -if test "${with_libpcre+set}" = set; then : +if test ${with_libpcre+y} +then : withval=$with_libpcre; case "$with_libpcre" in yes) ;; @@ -6441,13 +7300,15 @@ fi # If they didn't specify it, we try to find it if test $have_pcre != yes -a $requested_included_pcre != yes ; then - ac_fn_c_check_header_mongrel "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default" -if test "x$ac_cv_header_pcre_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_version in -lpcre" >&5 -$as_echo_n "checking for pcre_version in -lpcre... " >&6; } -if ${ac_cv_lib_pcre_pcre_version+:} false; then : - $as_echo_n "(cached) " >&6 -else + ac_fn_c_check_header_compile "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default" +if test "x$ac_cv_header_pcre_h" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre_version in -lpcre" >&5 +printf %s "checking for pcre_version in -lpcre... " >&6; } +if test ${ac_cv_lib_pcre_pcre_version+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6456,41 +7317,42 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 pcre_version (); int -main () +main (void) { return pcre_version (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_pcre_pcre_version=yes -else +else $as_nop ac_cv_lib_pcre_pcre_version=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_version" >&5 -$as_echo "$ac_cv_lib_pcre_pcre_version" >&6; } -if test "x$ac_cv_lib_pcre_pcre_version" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_version" >&5 +printf "%s\n" "$ac_cv_lib_pcre_pcre_version" >&6; } +if test "x$ac_cv_lib_pcre_pcre_version" = xyes +then : have_pcre=yes fi -else - ac_fn_c_check_header_mongrel "$LINENO" "pcre/pcre.h" "ac_cv_header_pcre_pcre_h" "$ac_includes_default" -if test "x$ac_cv_header_pcre_pcre_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_version in -lpcre" >&5 -$as_echo_n "checking for pcre_version in -lpcre... " >&6; } -if ${ac_cv_lib_pcre_pcre_version+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + ac_fn_c_check_header_compile "$LINENO" "pcre/pcre.h" "ac_cv_header_pcre_pcre_h" "$ac_includes_default" +if test "x$ac_cv_header_pcre_pcre_h" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre_version in -lpcre" >&5 +printf %s "checking for pcre_version in -lpcre... " >&6; } +if test ${ac_cv_lib_pcre_pcre_version+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6499,30 +7361,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 pcre_version (); int -main () +main (void) { return pcre_version (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_pcre_pcre_version=yes -else +else $as_nop ac_cv_lib_pcre_pcre_version=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_version" >&5 -$as_echo "$ac_cv_lib_pcre_pcre_version" >&6; } -if test "x$ac_cv_lib_pcre_pcre_version" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_version" >&5 +printf "%s\n" "$ac_cv_lib_pcre_pcre_version" >&6; } +if test "x$ac_cv_lib_pcre_pcre_version" = xyes +then : have_pcre=yes fi @@ -6530,10 +7391,8 @@ fi fi - fi - fi # If we still don't have it, we use our own @@ -6546,22 +7405,17 @@ if test $have_pcre != yes ; then PCRE_CLEAN="clean-pcre" PCRE_DIST_CLEAN="distclean-pcre" -$as_echo "#define PCRE_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define PCRE_INCLUDED 1" >>confdefs.h else # We only need to check for and use this if we are NOT using included pcre - for ac_header in pcre/pcre.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "pcre/pcre.h" "ac_cv_header_pcre_pcre_h" "$ac_includes_default" -if test "x$ac_cv_header_pcre_pcre_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PCRE_PCRE_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "pcre/pcre.h" "ac_cv_header_pcre_pcre_h" "$ac_includes_default" +if test "x$ac_cv_header_pcre_pcre_h" = xyes +then : + printf "%s\n" "#define HAVE_PCRE_PCRE_H 1" >>confdefs.h fi -done - LIBPCRE_LIBS="-lpcre" PCRE_BUILD="" PCRE_CLEAN="" @@ -6584,7 +7438,8 @@ test "${with_libz+set}" != "set" && with_libz="yes" # Check whether --with-libz was given. -if test "${with_libz+set}" = set; then : +if test ${with_libz+y} +then : withval=$with_libz; case "$with_libz" in yes) @@ -6603,14 +7458,16 @@ if test "${with_libz+set}" = set; then : LDFLAGS="-L$with_libz/lib $LDFLAGS" ac_configure_args="$ac_configure_args '--with-libz-prefix=$with_libz'" - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +if test "x$ac_cv_header_zlib_h" = xyes +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -$as_echo_n "checking for gzread in -lz... " >&6; } -if ${ac_cv_lib_z_gzread+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 +printf %s "checking for gzread in -lz... " >&6; } +if test ${ac_cv_lib_z_gzread+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6619,30 +7476,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 gzread (); int -main () +main (void) { return gzread (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_z_gzread=yes -else +else $as_nop ac_cv_lib_z_gzread=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -$as_echo "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 +printf "%s\n" "$ac_cv_lib_z_gzread" >&6; } +if test "x$ac_cv_lib_z_gzread" = xyes +then : have_libz=yes ZLIB_INC=$with_libz/include ZLIB_LIB=$with_libz/lib @@ -6652,7 +7508,6 @@ fi fi - LDFLAGS=$_ldflags CPPFLAGS=$_cppflags ;; @@ -6667,14 +7522,16 @@ if test $with_libz != no; then # If they didn't specify it, we try to find it if test $have_libz != yes -a $requested_included_libz != yes; then - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +if test "x$ac_cv_header_zlib_h" = xyes +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -$as_echo_n "checking for gzread in -lz... " >&6; } -if ${ac_cv_lib_z_gzread+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 +printf %s "checking for gzread in -lz... " >&6; } +if test ${ac_cv_lib_z_gzread+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6683,37 +7540,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 gzread (); int -main () +main (void) { return gzread (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_z_gzread=yes -else +else $as_nop ac_cv_lib_z_gzread=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -$as_echo "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 +printf "%s\n" "$ac_cv_lib_z_gzread" >&6; } +if test "x$ac_cv_lib_z_gzread" = xyes +then : have_libz="yes" fi fi - fi if test $have_libz != yes; then @@ -6729,7 +7584,7 @@ fi ZLIB_CLEAN="clean-zlib" ZLIB_DIST_CLEAN="distclean-zlib" -$as_echo "#define ZLIB_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define ZLIB_INCLUDED 1" >>confdefs.h else ZLIB_LIBS="-lz" @@ -6738,7 +7593,7 @@ $as_echo "#define ZLIB_INCLUDED 1" >>confdefs.h ZLIB_DIST_CLEAN="" fi -$as_echo "#define HAVE_LIBZ 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h else trace_no_use="$trace_no_use zlib" @@ -6762,7 +7617,8 @@ test "${with_libssh2+set}" != "set" && with_libssh2="yes" # Check whether --with-libssh2 was given. -if test "${with_libssh2+set}" = set; then : +if test ${with_libssh2+y} +then : withval=$with_libssh2; case "$with_libssh2" in yes) ;; @@ -6779,14 +7635,16 @@ if test "${with_libssh2+set}" = set; then : CPPFLAGS="-I$with_libssh2/include $CPPFLAGS" LDFLAGS="-L$with_libssh2/lib $LDFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" -if test "x$ac_cv_header_libssh2_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" +if test "x$ac_cv_header_libssh2_h" = xyes +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2_version in -lssh2" >&5 -$as_echo_n "checking for libssh2_version in -lssh2... " >&6; } -if ${ac_cv_lib_ssh2_libssh2_version+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libssh2_version in -lssh2" >&5 +printf %s "checking for libssh2_version in -lssh2... " >&6; } +if test ${ac_cv_lib_ssh2_libssh2_version+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lssh2 -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6795,34 +7653,33 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 libssh2_version (); int -main () +main (void) { return libssh2_version (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_ssh2_libssh2_version=yes -else +else $as_nop ac_cv_lib_ssh2_libssh2_version=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_version" >&5 -$as_echo "$ac_cv_lib_ssh2_libssh2_version" >&6; } -if test "x$ac_cv_lib_ssh2_libssh2_version" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_version" >&5 +printf "%s\n" "$ac_cv_lib_ssh2_libssh2_version" >&6; } +if test "x$ac_cv_lib_ssh2_libssh2_version" = xyes +then : have_libssh2=yes LIBSSH2_INC=$with_libssh2/include LIBSSH2_LIB=$with_libssh2/lib -else +else $as_nop LDFLAGS=$_ldflags CPPFLAGS=$_cppflags fi @@ -6831,7 +7688,6 @@ fi fi - ;; esac @@ -6844,14 +7700,16 @@ if test $use_libssh2 = yes -a $use_openssl = yes; then # If they didn't specify it, we try to find it if test $have_libssh2 != yes -a $requested_included_libssh2 != yes; then - ac_fn_c_check_header_mongrel "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" -if test "x$ac_cv_header_libssh2_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" +if test "x$ac_cv_header_libssh2_h" = xyes +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2_version in -lssh2" >&5 -$as_echo_n "checking for libssh2_version in -lssh2... " >&6; } -if ${ac_cv_lib_ssh2_libssh2_version+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libssh2_version in -lssh2" >&5 +printf %s "checking for libssh2_version in -lssh2... " >&6; } +if test ${ac_cv_lib_ssh2_libssh2_version+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lssh2 -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6860,37 +7718,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 libssh2_version (); int -main () +main (void) { return libssh2_version (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_ssh2_libssh2_version=yes -else +else $as_nop ac_cv_lib_ssh2_libssh2_version=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_version" >&5 -$as_echo "$ac_cv_lib_ssh2_libssh2_version" >&6; } -if test "x$ac_cv_lib_ssh2_libssh2_version" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_version" >&5 +printf "%s\n" "$ac_cv_lib_ssh2_libssh2_version" >&6; } +if test "x$ac_cv_lib_ssh2_libssh2_version" = xyes +then : have_libssh2="yes" fi fi - fi # If we still don't have it, we use our own @@ -6904,7 +7760,7 @@ fi LIBSSH2_CLEAN="clean-libssh2" LIBSSH2_DIST_CLEAN="distclean-libssh2" -$as_echo "#define LIBSSH2_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define LIBSSH2_INCLUDED 1" >>confdefs.h else LIBSSH2_LIBS="-lssh2" @@ -6913,7 +7769,7 @@ $as_echo "#define LIBSSH2_INCLUDED 1" >>confdefs.h LIBSSH2_DIST_CLEAN="" fi -$as_echo "#define HAVE_LIBSSH2 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBSSH2 1" >>confdefs.h else use_libssh2="no" @@ -6942,7 +7798,8 @@ LIBDNETDIR=libdnet-stripped # made many improvements and fixes to our version of dnet. # Check whether --with-libdnet was given. -if test "${with_libdnet+set}" = set; then : +if test ${with_libdnet+y} +then : withval=$with_libdnet; case "$with_libdnet" in yes) ;; @@ -6968,7 +7825,7 @@ if test $have_dnet != yes ; then DNET_CLEAN="clean-dnet" DNET_DIST_CLEAN="distclean-dnet" -$as_echo "#define DNET_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define DNET_INCLUDED 1" >>confdefs.h else LIBDNET_LIBS="-ldnet" @@ -6992,7 +7849,8 @@ no_lua=no # First we test whether they specified liblua explicitly # Check whether --with-liblua was given. -if test "${with_liblua+set}" = set; then : +if test ${with_liblua+y} +then : withval=$with_liblua; case "$with_liblua" in yes) ;; @@ -7004,7 +7862,7 @@ if test "${with_liblua+set}" = set; then : LUA_DIST_CLEAN="distclean-lua" have_lua="yes" -$as_echo "#define LUA_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define LUA_INCLUDED 1" >>confdefs.h ;; no) @@ -7034,24 +7892,25 @@ else # If they didn't specify it, we try to find it if test $have_lua != yes; then - for ac_header in lua5.3/lua.h lua/5.3/lua.h lua.h lua/lua.h + for ac_header in lua5.3/lua.h lua/5.3/lua.h lua.h lua/lua.h do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_Header=`printf "%s\n" "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 +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF break fi done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lua_isyieldable" >&5 -$as_echo_n "checking for library containing lua_isyieldable... " >&6; } -if ${ac_cv_search_lua_isyieldable+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing lua_isyieldable" >&5 +printf %s "checking for library containing lua_isyieldable... " >&6; } +if test ${ac_cv_search_lua_isyieldable+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7059,46 +7918,48 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 lua_isyieldable (); int -main () +main (void) { return lua_isyieldable (); ; return 0; } _ACEOF -for ac_lib in '' lua5.3 lua53 lua; do +for ac_lib in '' lua5.3 lua53 lua +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib -lm $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_lua_isyieldable=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_lua_isyieldable+:} false; then : + if test ${ac_cv_search_lua_isyieldable+y} +then : break fi done -if ${ac_cv_search_lua_isyieldable+:} false; then : +if test ${ac_cv_search_lua_isyieldable+y} +then : -else +else $as_nop ac_cv_search_lua_isyieldable=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lua_isyieldable" >&5 -$as_echo "$ac_cv_search_lua_isyieldable" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lua_isyieldable" >&5 +printf "%s\n" "$ac_cv_search_lua_isyieldable" >&6; } ac_res=$ac_cv_search_lua_isyieldable -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" have_lua=yes fi @@ -7110,9 +7971,142 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu # We need Lua 5.3 exactly - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua version == 503" >&5 -$as_echo_n "checking for lua version == 503... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lua version == 503" >&5 +printf %s "checking for lua version == 503... " >&6; } + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "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 test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" 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. + # 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. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # 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 $as_nop + # 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$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. + # 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. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # 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 $as_nop + # 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_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$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 + + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_LUA5_3_LUA_H @@ -7130,7 +8124,7 @@ $as_echo_n "checking for lua version == 503... " >&6; } #endif int -main () +main (void) { if(LUA_VERSION_NUM != 503) return 1; ; @@ -7138,9 +8132,10 @@ if(LUA_VERSION_NUM != 503) return 1; } _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : have_lua=yes -else +else $as_nop have_lua=no fi rm -f conftest.err conftest.i conftest.$ac_ext @@ -7158,19 +8153,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # if we didn't find we use our own if test $have_lua != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } CPPFLAGS="-I\$(top_srcdir)/$LIBLUADIR $CPPFLAGS" LIBLUA_LIBS="\$(top_srcdir)/$LIBLUADIR/liblua.a" LUA_BUILD="build-lua" LUA_CLEAN="clean-lua" LUA_DIST_CLEAN="distclean-lua" -$as_echo "#define LUA_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define LUA_INCLUDED 1" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi INSTALLNSE="install-nse" @@ -7195,7 +8190,8 @@ have_liblinear=no # First we test whether they specified liblinear explicitly # Check whether --with-liblinear was given. -if test "${with_liblinear+set}" = set; then : +if test ${with_liblinear+y} +then : withval=$with_liblinear; case "$with_liblinear" in yes) ;; @@ -7219,18 +8215,18 @@ fi # If they didn't specify it, we try to find it if test $have_liblinear != yes; then - for ac_header in linear.h + for ac_header in linear.h do : - ac_fn_c_check_header_mongrel "$LINENO" "linear.h" "ac_cv_header_linear_h" "$ac_includes_default" -if test "x$ac_cv_header_linear_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LINEAR_H 1 -_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for predict in -llinear" >&5 -$as_echo_n "checking for predict in -llinear... " >&6; } -if ${ac_cv_lib_linear_predict+:} false; then : - $as_echo_n "(cached) " >&6 -else + ac_fn_c_check_header_compile "$LINENO" "linear.h" "ac_cv_header_linear_h" "$ac_includes_default" +if test "x$ac_cv_header_linear_h" = xyes +then : + printf "%s\n" "#define HAVE_LINEAR_H 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for predict in -llinear" >&5 +printf %s "checking for predict in -llinear... " >&6; } +if test ${ac_cv_lib_linear_predict+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-llinear -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7239,30 +8235,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 predict (); int -main () +main (void) { return predict (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_linear_predict=yes -else +else $as_nop ac_cv_lib_linear_predict=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_linear_predict" >&5 -$as_echo "$ac_cv_lib_linear_predict" >&6; } -if test "x$ac_cv_lib_linear_predict" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_linear_predict" >&5 +printf "%s\n" "$ac_cv_lib_linear_predict" >&6; } +if test "x$ac_cv_lib_linear_predict" = xyes +then : have_liblinear=yes; LIBLINEAR_LIBS="-llinear"; break fi @@ -7271,7 +8266,6 @@ fi done - LIBLINEAR_BUILD="" LIBLINEAR_CLEAN="" LIBLINEAR_DIST_CLEAN="" @@ -7279,19 +8273,19 @@ fi # if we didn't find we use our own if test $have_liblinear != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } CPPFLAGS="-I\$(top_srcdir)/$LIBLINEARDIR $CPPFLAGS" LIBLINEAR_LIBS="\$(top_srcdir)/$LIBLINEARDIR/liblinear.a" LIBLINEAR_BUILD="build-liblinear" LIBLINEAR_CLEAN="clean-liblinear" LIBLINEAR_DIST_CLEAN="distclean-liblinear" -$as_echo "#define LIBLINEAR_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define LIBLINEAR_INCLUDED 1" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi @@ -7302,11 +8296,12 @@ fi #dnl check endedness - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +printf %s "checking whether byte ordering is bigendian... " >&6; } +if test ${ac_cv_c_bigendian+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7317,7 +8312,8 @@ else typedef int dummy; _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. @@ -7341,7 +8337,7 @@ if ac_fn_c_try_compile "$LINENO"; then : fi done fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7350,7 +8346,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main () +main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ @@ -7362,7 +8358,8 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7370,7 +8367,7 @@ if ac_fn_c_try_compile "$LINENO"; then : #include int -main () +main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian @@ -7380,14 +8377,15 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_bigendian=yes -else +else $as_nop ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). @@ -7396,7 +8394,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main () +main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros @@ -7406,14 +8404,15 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { #ifndef _BIG_ENDIAN not big endian @@ -7423,31 +8422,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_bigendian=yes -else +else $as_nop ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -short int ascii_mm[] = +unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = + unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } - short int ebcdic_ii[] = + unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = + unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; @@ -7455,14 +8456,15 @@ short int ascii_mm[] = extern int foo; int -main () +main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi @@ -7475,13 +8477,13 @@ if ac_fn_c_try_compile "$LINENO"; then : fi fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { /* Are we little or big endian? From Harbison&Steele. */ @@ -7497,9 +8499,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_c_bigendian=no -else +else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -7508,17 +8511,17 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h + printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h +printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) @@ -7527,61 +8530,64 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct in_addr is a wacky huge structure (some Sun boxes)" >&5 -$as_echo_n "checking if struct in_addr is a wacky huge structure (some Sun boxes)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if struct in_addr is a wacky huge structure (some Sun boxes)" >&5 +printf %s "checking if struct in_addr is a wacky huge structure (some Sun boxes)... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { struct in_addr i; i._S_un._S_addr; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : \ - $as_echo "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h + printf "%s\n" "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h \ - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop \ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int -main () +main (void) { struct in_addr i; i.S_un.S_addr; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : \ - $as_echo "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h + printf "%s\n" "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h \ - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop \ - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; }; fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct icmp exists" >&5 -$as_echo_n "checking if struct icmp exists... " >&6; } -if ${ac_cv_struct_icmp_exists+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if struct icmp exists" >&5 +printf %s "checking if struct icmp exists... " >&6; } +if test ${ac_cv_struct_icmp_exists+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7595,33 +8601,35 @@ else #include #include int -main () +main (void) { unsigned int i = sizeof(struct icmp) ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_struct_icmp_exists=yes -else +else $as_nop ac_cv_struct_icmp_exists=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_icmp_exists" >&5 -$as_echo "$ac_cv_struct_icmp_exists" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_icmp_exists" >&5 +printf "%s\n" "$ac_cv_struct_icmp_exists" >&6; } if test $ac_cv_struct_icmp_exists = yes ; then -$as_echo "#define HAVE_STRUCT_ICMP 1" >>confdefs.h +printf "%s\n" "#define HAVE_STRUCT_ICMP 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct ip exists" >&5 -$as_echo_n "checking if struct ip exists... " >&6; } -if ${ac_cv_struct_ip_exists+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if struct ip exists" >&5 +printf %s "checking if struct ip exists... " >&6; } +if test ${ac_cv_struct_ip_exists+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7634,33 +8642,35 @@ else #define _BSD_SOURCE #include int -main () +main (void) { unsigned int i = sizeof(struct ip) ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_struct_ip_exists=yes -else +else $as_nop ac_cv_struct_ip_exists=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_ip_exists" >&5 -$as_echo "$ac_cv_struct_ip_exists" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_ip_exists" >&5 +printf "%s\n" "$ac_cv_struct_ip_exists" >&6; } if test $ac_cv_struct_ip_exists = yes ; then -$as_echo "#define HAVE_STRUCT_IP 1" >>confdefs.h +printf "%s\n" "#define HAVE_STRUCT_IP 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct ip has ip_sum member" >&5 -$as_echo_n "checking if struct ip has ip_sum member... " >&6; } -if ${ac_cv_ip_has_ip_sum+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if struct ip has ip_sum member" >&5 +printf %s "checking if struct ip has ip_sum member... " >&6; } +if test ${ac_cv_ip_has_ip_sum+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7674,38 +8684,35 @@ else #include #include int -main () +main (void) { unsigned int i = sizeof(((struct ip *)0)->ip_sum) ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_ip_has_ip_sum=yes -else +else $as_nop ac_cv_ip_has_ip_sum=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ip_has_ip_sum" >&5 -$as_echo "$ac_cv_ip_has_ip_sum" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ip_has_ip_sum" >&5 +printf "%s\n" "$ac_cv_ip_has_ip_sum" >&6; } if test $ac_cv_ip_has_ip_sum = yes ; then -$as_echo "#define HAVE_IP_IP_SUM 1" >>confdefs.h +printf "%s\n" "#define HAVE_IP_IP_SUM 1" >>confdefs.h fi -for ac_func in strerror -do : - ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" -if test "x$ac_cv_func_strerror" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRERROR 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes +then : + printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h fi -done @@ -7715,8 +8722,8 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of 6th argument to recvfrom()" >&5 -$as_echo_n "checking for type of 6th argument to recvfrom()... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for type of 6th argument to recvfrom()" >&5 +printf %s "checking for type of 6th argument to recvfrom()... " >&6; } recvfrom6_t= for t in socklen_t int; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7727,7 +8734,7 @@ $as_echo_n "checking for type of 6th argument to recvfrom()... " >&6; } #include #include int -main () +main (void) { $t arg; @@ -7736,26 +8743,25 @@ recvfrom (0, NULL, 0, 0, NULL, &arg); return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : recvfrom6_t="$t" break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done if test "x$recvfrom6_t" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find type for 6th argument to recvfrom(). Using socklen_t ptr" >&5 -$as_echo "$as_me: WARNING: Cannot find type for 6th argument to recvfrom(). Using socklen_t ptr" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find type for 6th argument to recvfrom(). Using socklen_t ptr" >&5 +printf "%s\n" "$as_me: WARNING: Cannot find type for 6th argument to recvfrom(). Using socklen_t ptr" >&2;} recvfrom6_t="socklen_t" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $recvfrom6_t" >&5 -$as_echo "$recvfrom6_t" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $recvfrom6_t" >&5 +printf "%s\n" "$recvfrom6_t" >&6; } -cat >>confdefs.h <<_ACEOF -#define recvfrom6_t $recvfrom6_t -_ACEOF +printf "%s\n" "#define recvfrom6_t $recvfrom6_t" >>confdefs.h ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -7767,7 +8773,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --with-libnbase was given. -if test "${with_libnbase+set}" = set; then : +if test ${with_libnbase+y} +then : withval=$with_libnbase; case "$with_libnbase" in yes) ;; @@ -7776,7 +8783,7 @@ if test "${with_libnbase+set}" = set; then : NBASE_BUILD="" ;; esac -else +else $as_nop NBASE_BUILD="build-nbase" NBASEDIR="nbase" @@ -7799,7 +8806,8 @@ NSOCK_BUILD="build-nsock" NSOCK_CHECK="check-nsock" # Check whether --with-libnsock was given. -if test "${with_libnsock+set}" = set; then : +if test ${with_libnsock+y} +then : withval=$with_libnsock; case "$with_libnsock" in yes) ;; @@ -7829,9 +8837,10 @@ NCATDIR="ncat" # Check whether --with-ncat was given. -if test "${with_ncat+set}" = set; then : +if test ${with_ncat+y} +then : withval=$with_ncat; -else +else $as_nop with_ncat=check fi @@ -7893,8 +8902,8 @@ _ACEOF 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;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -7924,15 +8933,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -7946,8 +8955,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -7964,7 +8973,7 @@ 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"` + ac_i=`printf "%s\n" "$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" @@ -7981,8 +8990,8 @@ LTLIBOBJS=$ac_ltlibobjs 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;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -8005,14 +9014,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (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 +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -8022,46 +9033,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. 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 +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; 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 || @@ -8070,13 +9081,6 @@ if test "${PATH_SEPARATOR+set}" != set; then 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 #(( @@ -8085,8 +9089,12 @@ case $0 in #(( 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -8098,30 +9106,10 @@ 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 + printf "%s\n" "$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] @@ -8134,13 +9122,14 @@ 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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -8167,18 +9156,20 @@ 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 : +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 +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -8190,12 +9181,13 @@ fi # as_fn_append # 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 : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -8226,7 +9218,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -8248,6 +9240,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -8261,6 +9257,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -8302,7 +9304,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -8311,7 +9313,7 @@ $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" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8374,7 +9376,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -8432,14 +9434,16 @@ $config_headers Report bugs to the package provider." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -8478,15 +9482,15 @@ do -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 ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$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"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -8494,7 +9498,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -8503,7 +9507,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -8531,7 +9535,7 @@ 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 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -8545,7 +9549,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -8572,8 +9576,8 @@ done # 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_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree @@ -8909,7 +9913,7 @@ do 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 + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -8917,17 +9921,17 @@ do # 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' + printf "%s\n" "$*" | 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$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" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -8944,7 +9948,7 @@ $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" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8968,9 +9972,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$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|/||'` + ac_top_builddir_sub=`printf "%s\n" "$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/ ;; @@ -9027,8 +10031,8 @@ ac_sed_dataroot=' 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$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=' @@ -9071,9 +10075,9 @@ 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' + { printf "%s\n" "$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' +printf "%s\n" "$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" @@ -9089,20 +10093,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -9182,7 +10186,7 @@ if test "$no_recursion" != yes; then ;; *) case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac @@ -9192,7 +10196,7 @@ if test "$no_recursion" != yes; then # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" @@ -9213,17 +10217,17 @@ if test "$no_recursion" != yes; then 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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + printf "%s\n" "$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|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$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|/||'` + ac_top_builddir_sub=`printf "%s\n" "$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/ ;; @@ -9253,17 +10257,15 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" - # Check for guested configure; otherwise get Cygnus style configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi @@ -9276,8 +10278,8 @@ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +printf "%s\n" "$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\"" || @@ -9288,8 +10290,8 @@ $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cach 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi @@ -9326,3 +10328,4 @@ fi if test "x$use_libssh2" != "xyes"; then echo "WARNING: You are compiling without LibSSH2" fi + diff --git a/configure.ac b/configure.ac index 7b0714eb8..41f232f18 100644 --- a/configure.ac +++ b/configure.ac @@ -230,23 +230,19 @@ AC_SEARCH_LIBS(gethostbyname, nsl) dnl Check IPv6 raw sending flavor. CHECK_IPV6_IPPROTO_RAW -m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python2 python2.7 python2.6 python2.5 python2.4 python]) -AM_PATH_PYTHON([2.4], [HAVE_PYTHON=true], [HAVE_PYTHON=false]) -HAVE_PYTHON2=false -if test $HAVE_PYTHON && test "x${PYTHON_VERSION%%.*}" = "x2"; then - HAVE_PYTHON2=true -fi +m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python]) +AM_PATH_PYTHON([3], [HAVE_PYTHON=true], [HAVE_PYTHON=false]) NDIFFDIR=ndiff # Do they want Ndiff? AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check]) -if $HAVE_PYTHON2 ; then : ; +if $HAVE_PYTHON ; then : ; else if test "$with_ndiff" = "check" ; then - AC_MSG_WARN([Not building Ndiff because Python 2.x with x>=4 was not found]) + AC_MSG_WARN([Not building Ndiff because Python was not found]) elif test "$with_ndiff" = "yes"; then - AC_MSG_FAILURE([--with-ndiff requires Python 2.x with x>=4]) + AC_MSG_FAILURE([--with-ndiff requires Python]) fi with_ndiff=no fi @@ -280,12 +276,12 @@ ZENMAPDIR=zenmap # Do they want Zenmap? AC_ARG_WITH(zenmap, AC_HELP_STRING([--without-zenmap], [Skip installation of the Zenmap graphical frontend]), [], [with_zenmap=check]) -if $HAVE_PYTHON2 ; then : ; +if $HAVE_PYTHON ; then : ; else if test "$with_zenmap" = "check"; then - AC_MSG_WARN([Not building Zenmap because Python 2.x with x>=4 was not found]) + AC_MSG_WARN([Not building Zenmap because Python was not found]) elif test "$with_zenmap" = "yes"; then - AC_MSG_FAILURE([--with-zenmap requires Python 2.x with x>=4]) + AC_MSG_FAILURE([--with-zenmap requires Python]) fi with_zenmap=no fi diff --git a/zenmap/install_scripts/utils/version_update.py b/zenmap/install_scripts/utils/version_update.py index 9b19bdf11..327e97f12 100644 --- a/zenmap/install_scripts/utils/version_update.py +++ b/zenmap/install_scripts/utils/version_update.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -75,7 +74,7 @@ NAME_PY = os.path.join("zenmapCore", "Name.py") def update_date(base_dir): name_file = os.path.join(base_dir, NAME_PY) - print ">>> Updating %s" % name_file + print(">>> Updating %s" % name_file) nf = open(name_file, "r") ncontent = nf.read() nf.close() @@ -89,22 +88,22 @@ def update_date(base_dir): def update_version(base_dir, version): - print ">>> Updating %s" % os.path.join(base_dir, VERSION) + print(">>> Updating %s" % os.path.join(base_dir, VERSION)) vf = open(os.path.join(base_dir, VERSION), "wb") - print >> vf, version + print(version, file=vf) vf.close() - print ">>> Updating %s" % os.path.join(base_dir, VERSION_PY) + print(">>> Updating %s" % os.path.join(base_dir, VERSION_PY)) vf = open(os.path.join(base_dir, VERSION_PY), "w") - print >> vf, "VERSION = \"%s\"" % version + print("VERSION = \"%s\"" % version, file=vf) vf.close() if __name__ == "__main__": if len(sys.argv) != 2: - print >> sys.stderr, "Usage: %s " % sys.argv[0] + print("Usage: %s " % sys.argv[0], file=sys.stderr) sys.exit(1) version = sys.argv[1] - print ">>> Updating version number to \"%s\"" % version + print(">>> Updating version number to \"%s\"" % version) update_version(".", version) update_date(".") diff --git a/zenmap/radialnet/bestwidgets/__init__.py b/zenmap/radialnet/bestwidgets/__init__.py index 969c40e07..63cc178f1 100644 --- a/zenmap/radialnet/bestwidgets/__init__.py +++ b/zenmap/radialnet/bestwidgets/__init__.py @@ -57,9 +57,12 @@ # * * # ***************************************************************************/ -import gtk +import gi -gtk_version_major, gtk_version_minor, gtk_version_release = gtk.gtk_version +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + +gtk_version_major, gtk_version_minor, gtk_version_release = gi.version_info #from boxes import BWHBox, BWVBox, BWTable, BWStatusbar, BWScrolledWindow #from buttons import BWStockButton, BWToggleStockButton diff --git a/zenmap/radialnet/bestwidgets/boxes.py b/zenmap/radialnet/bestwidgets/boxes.py index b3e9842aa..c2c7ea9b7 100644 --- a/zenmap/radialnet/bestwidgets/boxes.py +++ b/zenmap/radialnet/bestwidgets/boxes.py @@ -57,13 +57,16 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk __all__ = ('BWBox', 'BWHBox', 'BWVBox', 'BWStatusbar', 'BWTable', 'BWScrolledWindow') -class BWBox(gtk.Box): +class BWBox(Gtk.Box): """ """ def bw_pack_start_expand_fill(self, widget, padding=0): @@ -97,40 +100,44 @@ class BWBox(gtk.Box): self.pack_end(widget, False, False, padding) -class BWHBox(gtk.HBox, BWBox): +class BWHBox(BWBox): """ """ def __init__(self, homogeneous=False, spacing=12): """ """ - gtk.HBox.__init__(self, homogeneous, spacing) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, + homogeneous=homogeneous, spacing=spacing) -class BWVBox(gtk.VBox, BWBox): +class BWVBox(BWBox): """ """ def __init__(self, homogeneous=False, spacing=12): """ """ - gtk.VBox.__init__(self, homogeneous, spacing) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, + homogeneous=homogeneous, spacing=spacing) -class BWStatusbar(gtk.Statusbar, BWBox): +class BWStatusbar(Gtk.Statusbar, BWBox): """ """ def __init__(self, homogeneous=False, spacing=12): """ """ - gtk.HBox.__init__(self, homogeneous, spacing) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, + homogeneous=homogeneous, spacing=spacing) -class BWTable(gtk.Table, BWBox): +class BWTable(Gtk.Table, BWBox): """ """ def __init__(self, rows=1, columns=1, homogeneous=False): """ """ - gtk.Table.__init__(self, rows, columns, homogeneous) + Gtk.Table.__init__(self, n_rows=rows, n_columns=columns, + homogeneous=homogeneous) self.bw_set_spacing(12) self.__rows = rows @@ -154,8 +161,8 @@ class BWTable(gtk.Table, BWBox): def bw_attach_next(self, child, - xoptions=gtk.EXPAND | gtk.FILL, - yoptions=gtk.EXPAND | gtk.FILL, + xoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, + yoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, xpadding=0, ypadding=0): """ @@ -185,13 +192,13 @@ class BWTable(gtk.Table, BWBox): self.__last_point = (row, column) -class BWScrolledWindow(gtk.ScrolledWindow): +class BWScrolledWindow(Gtk.ScrolledWindow): """ """ def __init__(self): """ """ - gtk.ScrolledWindow.__init__(self) - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - self.set_shadow_type(gtk.SHADOW_NONE) + Gtk.ScrolledWindow.__init__(self) + self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) + self.set_shadow_type(Gtk.ShadowType.NONE) self.set_border_width(6) diff --git a/zenmap/radialnet/bestwidgets/buttons.py b/zenmap/radialnet/bestwidgets/buttons.py index a5e0aeae1..14c853842 100644 --- a/zenmap/radialnet/bestwidgets/buttons.py +++ b/zenmap/radialnet/bestwidgets/buttons.py @@ -57,34 +57,37 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class BWStockButton(gtk.Button): +class BWStockButton(Gtk.Button): """ """ - def __init__(self, stock, text=None, size=gtk.ICON_SIZE_BUTTON): + def __init__(self, stock, text=None, size=Gtk.IconSize.BUTTON): """ """ - gtk.Button.__init__(self, text) + Gtk.Button.__init__(self, label=text) self.__size = size - self.__image = gtk.Image() + self.__image = Gtk.Image() self.__image.set_from_stock(stock, self.__size) self.set_image(self.__image) -class BWToggleStockButton(gtk.ToggleButton): +class BWToggleStockButton(Gtk.ToggleButton): """ """ - def __init__(self, stock, text=None, size=gtk.ICON_SIZE_BUTTON): + def __init__(self, stock, text=None, size=Gtk.IconSize.BUTTON): """ """ - gtk.ToggleButton.__init__(self, text) + Gtk.ToggleButton.__init__(self, label=text) self.__size = size - self.__image = gtk.Image() + self.__image = Gtk.Image() self.__image.set_from_stock(stock, self.__size) self.set_image(self.__image) diff --git a/zenmap/radialnet/bestwidgets/comboboxes.py b/zenmap/radialnet/bestwidgets/comboboxes.py index 94b28f923..265b7dd1c 100644 --- a/zenmap/radialnet/bestwidgets/comboboxes.py +++ b/zenmap/radialnet/bestwidgets/comboboxes.py @@ -57,19 +57,21 @@ # * * # ***************************************************************************/ -import gtk -import gobject +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject -class BWChangeableComboBoxEntry(gtk.ComboBoxEntry): +class BWChangeableComboBoxEntry(Gtk.ComboBoxText): """ """ def __init__(self): """ """ - self.__liststore = gtk.ListStore(gobject.TYPE_STRING) + self.__liststore = Gtk.ListStore.new([str]) - gtk.ComboBoxEntry.__init__(self, self.__liststore, 0) + Gtk.ComboBoxText.__init__(self, model=self.__liststore, has_entry=True) self.connect("changed", self.__changed) self.get_child().connect("changed", self.__entry_changed) @@ -114,22 +116,22 @@ if __name__ == "__main__": """ combo.append_text('New') - window = gtk.Window() - window.connect("destroy", lambda w: gtk.main_quit()) + window = Gtk.Window() + window.connect("destroy", lambda w: Gtk.main_quit()) - box = gtk.HBox() + box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) combo = BWChangeableComboBoxEntry() combo.append_text('New') combo.set_active(0) - button = gtk.Button('More') + button = Gtk.Button.new_with_label('More') button.connect("clicked", button_clicked, combo) - box.pack_start(button, False, False) - box.pack_start(combo, True, True) + box.pack_start(button, False, False, 0) + box.pack_start(combo, True, True, 0) window.add(box) window.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/radialnet/bestwidgets/expanders.py b/zenmap/radialnet/bestwidgets/expanders.py index 8eea56851..f83deccae 100644 --- a/zenmap/radialnet/bestwidgets/expanders.py +++ b/zenmap/radialnet/bestwidgets/expanders.py @@ -57,22 +57,25 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from radialnet.bestwidgets.labels import BWSectionLabel -class BWExpander(gtk.Expander): +class BWExpander(Gtk.Expander): """ """ def __init__(self, label=''): """ """ - gtk.Expander.__init__(self) + Gtk.Expander.__init__(self) self.__label = BWSectionLabel(label) self.set_label_widget(self.__label) - self.__alignment = gtk.Alignment(0, 0, 1, 1) + self.__alignment = Gtk.Alignment.new(0, 0, 1, 1) self.__alignment.set_padding(12, 0, 24, 0) self.add(self.__alignment) diff --git a/zenmap/radialnet/bestwidgets/frames.py b/zenmap/radialnet/bestwidgets/frames.py index d4e76dc20..1e5f12230 100644 --- a/zenmap/radialnet/bestwidgets/frames.py +++ b/zenmap/radialnet/bestwidgets/frames.py @@ -57,21 +57,24 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk -class BWFrame(gtk.Frame): +class BWFrame(Gtk.Frame): """ """ def __init__(self, label=''): """ """ - gtk.Frame.__init__(self) + Gtk.Frame.__init__(self) self.set_border_width(3) - self.set_shadow_type(gtk.SHADOW_NONE) + self.set_shadow_type(Gtk.ShadowType.NONE) - self.__alignment = gtk.Alignment(0, 0, 1, 1) + self.__alignment = Gtk.Alignment.new(0, 0, 1, 1) self.__alignment.set_padding(12, 0, 24, 0) self.add(self.__alignment) diff --git a/zenmap/radialnet/bestwidgets/labels.py b/zenmap/radialnet/bestwidgets/labels.py index 3876183d4..c2505bfdc 100644 --- a/zenmap/radialnet/bestwidgets/labels.py +++ b/zenmap/radialnet/bestwidgets/labels.py @@ -57,33 +57,36 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class BWLabel(gtk.Label): +class BWLabel(Gtk.Label): """ """ def __init__(self, text=''): """ """ - gtk.Label.__init__(self) + Gtk.Label.__init__(self) self.set_text(text) - self.set_justify(gtk.JUSTIFY_LEFT) + self.set_justify(Gtk.Justification.LEFT) self.set_alignment(0, 0.50) self.set_line_wrap(True) -class BWSectionLabel(gtk.Label): +class BWSectionLabel(Gtk.Label): """ """ def __init__(self, text=''): """ """ - gtk.Label.__init__(self) + Gtk.Label.__init__(self) self.set_markup('' + text + '') - self.set_justify(gtk.JUSTIFY_LEFT) + self.set_justify(Gtk.Justification.LEFT) self.set_alignment(0, 0.50) self.set_line_wrap(True) diff --git a/zenmap/radialnet/bestwidgets/textview.py b/zenmap/radialnet/bestwidgets/textview.py index 4707ec397..c954d2da6 100644 --- a/zenmap/radialnet/bestwidgets/textview.py +++ b/zenmap/radialnet/bestwidgets/textview.py @@ -57,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from radialnet.bestwidgets.boxes import * @@ -76,8 +79,8 @@ class BWTextView(BWScrolledWindow): def __create_widgets(self): """ """ - self.__textbuffer = gtk.TextBuffer() - self.__textview = gtk.TextView(self.__textbuffer) + self.__textbuffer = Gtk.TextBuffer() + self.__textview = Gtk.TextView.new_with_buffer(self.__textbuffer) self.add_with_viewport(self.__textview) @@ -128,7 +131,7 @@ class BWTextEditor(BWScrolledWindow): """ """ BWScrolledWindow.__init__(self) - self.connect('expose_event', self.__expose) + self.connect('draw', self.__draw) self.__auto_scroll = False @@ -139,12 +142,12 @@ class BWTextEditor(BWScrolledWindow): """ self.__hbox = BWHBox(spacing=6) - self.__textbuffer = gtk.TextBuffer() - self.__textview = gtk.TextView(self.__textbuffer) + self.__textbuffer = Gtk.TextBuffer() + self.__textview = Gtk.TextView.new_with_buffer(self.__textbuffer) - self.__linebuffer = gtk.TextBuffer() - self.__lineview = gtk.TextView(self.__linebuffer) - self.__lineview.set_justification(gtk.JUSTIFY_RIGHT) + self.__linebuffer = Gtk.TextBuffer() + self.__lineview = Gtk.TextView.new_with_buffer(self.__linebuffer) + self.__lineview.set_justification(Gtk.Justification.RIGHT) self.__lineview.set_editable(False) self.__lineview.set_sensitive(False) @@ -153,7 +156,7 @@ class BWTextEditor(BWScrolledWindow): self.add_with_viewport(self.__hbox) - def __expose(self, widget, event): + def __draw(self, widget, event): """ """ # code to fix a gtk issue that don't show text correctly diff --git a/zenmap/radialnet/bestwidgets/windows.py b/zenmap/radialnet/bestwidgets/windows.py index 2a9b84a52..0f16ba856 100644 --- a/zenmap/radialnet/bestwidgets/windows.py +++ b/zenmap/radialnet/bestwidgets/windows.py @@ -57,21 +57,24 @@ # * * # ***************************************************************************/ -import gtk -from radialnet.bestwidgets import gtk_version_minor +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk PRIMARY_TEXT_MARKUP = '%s' -class BWAlertDialog(gtk.MessageDialog): +class BWAlertDialog(Gtk.MessageDialog): """ """ - def __init__(self, parent=None, flags=0, type=gtk.MESSAGE_INFO, - buttons=gtk.BUTTONS_OK, + def __init__(self, parent=None, flags=0, type=Gtk.MessageType.INFO, + buttons=Gtk.ButtonsType.OK, primary_text=None, secondary_text=None): - gtk.MessageDialog.__init__(self, parent, flags, type, buttons) + Gtk.MessageDialog.__init__(self, parent=parent, flags=flags, + message_type=type, buttons=buttons) self.connect('response', self.__destroy) @@ -81,10 +84,7 @@ class BWAlertDialog(gtk.MessageDialog): self.set_markup(PRIMARY_TEXT_MARKUP % primary_text) if secondary_text: - - # GTK up to version 2.4 does not have secondary_text - if gtk_version_minor > 4: - self.format_secondary_text(secondary_text) + self.format_secondary_text(secondary_text) def __destroy(self, dialog, id): """ @@ -92,14 +92,14 @@ class BWAlertDialog(gtk.MessageDialog): self.destroy() -class BWWindow(gtk.Window): +class BWWindow(Gtk.Window): """ """ - def __init__(self, type=gtk.WINDOW_TOPLEVEL): + def __init__(self, type=Gtk.WindowType.TOPLEVEL): """ """ - gtk.Window.__init__(self, type) + Gtk.Window.__init__(self, type=type) self.set_border_width(5) -BWMainWindow = gtk.Window +BWMainWindow = Gtk.Window diff --git a/zenmap/radialnet/core/ArgvHandle.py b/zenmap/radialnet/core/ArgvHandle.py index 480919412..b389b72c8 100644 --- a/zenmap/radialnet/core/ArgvHandle.py +++ b/zenmap/radialnet/core/ArgvHandle.py @@ -97,4 +97,4 @@ if __name__ == '__main__': h = ArgvHandle(sys.argv) - print h.get_last_value() + print(h.get_last_value()) diff --git a/zenmap/radialnet/core/Coordinate.py b/zenmap/radialnet/core/Coordinate.py index 562c52989..df125239a 100644 --- a/zenmap/radialnet/core/Coordinate.py +++ b/zenmap/radialnet/core/Coordinate.py @@ -206,5 +206,5 @@ if __name__ == "__main__": polar = PolarCoordinate(1, math.pi) cartesian = CartesianCoordinate(-1, 0) - print polar.to_cartesian() - print cartesian.to_polar() + print(polar.to_cartesian()) + print(cartesian.to_polar()) diff --git a/zenmap/radialnet/core/Interpolation.py b/zenmap/radialnet/core/Interpolation.py index 22d942417..282617e79 100644 --- a/zenmap/radialnet/core/Interpolation.py +++ b/zenmap/radialnet/core/Interpolation.py @@ -113,7 +113,7 @@ class Linear2DInterpolator: a_pass = 0 b_pass = 0 - self.__interpolated_points = range(number_of_pass) + self.__interpolated_points = list(range(number_of_pass)) for i in range(0, number_of_pass): @@ -138,7 +138,7 @@ class Linear2DInterpolator: a_pass = float(af - ai) / number_of_pass b_pass = float(bf - bi) / number_of_pass - self.__interpolated_points = range(number_of_pass) + self.__interpolated_points = list(range(number_of_pass)) for i in range(1, number_of_pass + 1): self.__interpolated_points[i - 1] = (ai + a_pass * i, @@ -156,4 +156,4 @@ if __name__ == "__main__": i.set_start_point(0, 0) i.set_final_point(1, 1) - print len(i.get_points(10)), i.get_points(10) + print(len(i.get_points(10)), i.get_points(10)) diff --git a/zenmap/radialnet/gui/Application.py b/zenmap/radialnet/gui/Application.py index 21ad011d6..2ae84dd1f 100644 --- a/zenmap/radialnet/gui/Application.py +++ b/zenmap/radialnet/gui/Application.py @@ -57,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from radialnet.util.integration import make_graph_from_nmap_parser from radialnet.core.Info import INFO @@ -111,9 +114,9 @@ class Application(BWMainWindow): self.add(self.__vbox) self.set_title(" ".join([INFO['name'], INFO['version']])) - self.set_position(gtk.WIN_POS_CENTER) + self.set_position(Gtk.WindowPosition.CENTER) self.show_all() - self.connect('destroy', gtk.main_quit) + self.connect('destroy', Gtk.main_quit) self.__radialnet.set_no_show_all(True) self.__control.set_no_show_all(True) @@ -155,4 +158,4 @@ class Application(BWMainWindow): def start(self): """ """ - gtk.main() + Gtk.main() diff --git a/zenmap/radialnet/gui/ControlWidget.py b/zenmap/radialnet/gui/ControlWidget.py index 033a09b52..68f14a187 100644 --- a/zenmap/radialnet/gui/ControlWidget.py +++ b/zenmap/radialnet/gui/ControlWidget.py @@ -57,9 +57,12 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GLib, Gdk, GObject + import math -import gobject import radialnet.util.geometry as geometry @@ -107,14 +110,6 @@ class ControlWidget(BWVBox): self.bw_pack_start_noexpand_nofill(self.__view) -def try_set_tooltip_text(widget, text): - try: - widget.set_tooltip_text(text) - except AttributeError: - # The set_tooltip_text method was introduced in PyGTK 2.12. - pass - - class ControlAction(BWExpander): """ """ @@ -135,39 +130,35 @@ class ControlAction(BWExpander): self.__tbox.bw_set_spacing(0) self.__vbox = BWVBox() - self.__jump_to = gtk.RadioToolButton(None, gtk.STOCK_JUMP_TO) - try_set_tooltip_text(self.__jump_to, 'Change focus') + self.__jump_to = Gtk.RadioToolButton(group=None, + stock_id=Gtk.STOCK_JUMP_TO) + self.__jump_to.set_tooltip_text('Change focus') self.__jump_to.connect('toggled', self.__change_pointer, RadialNet.POINTER_JUMP_TO) - try: - # gtk.STOCK_INFO is available only in PyGTK 2.8 and later. - info_icon = gtk.STOCK_INFO - except AttributeError: - self.__info = gtk.RadioToolButton(self.__jump_to, None) - self.__info.set_label(_("Info")) - else: - self.__info = gtk.RadioToolButton(self.__jump_to, info_icon) - try_set_tooltip_text(self.__info, 'Show information') + self.__info = Gtk.RadioToolButton(group=self.__jump_to, + stock_id=Gtk.STOCK_INFO) + self.__info.set_tooltip_text('Show information') self.__info.connect('toggled', self.__change_pointer, RadialNet.POINTER_INFO) - self.__group = gtk.RadioToolButton(self.__jump_to, gtk.STOCK_ADD) - try_set_tooltip_text(self.__group, 'Group children') + self.__group = Gtk.RadioToolButton(group=self.__jump_to, + stock_id=Gtk.STOCK_ADD) + self.__group.set_tooltip_text('Group children') self.__group.connect('toggled', self.__change_pointer, RadialNet.POINTER_GROUP) - self.__region = gtk.RadioToolButton(self.__jump_to, - gtk.STOCK_SELECT_COLOR) - try_set_tooltip_text(self.__region, 'Fill region') + self.__region = Gtk.RadioToolButton(group=self.__jump_to, + stock_id=Gtk.STOCK_SELECT_COLOR) + self.__region.set_tooltip_text('Fill region') self.__region.connect('toggled', self.__change_pointer, RadialNet.POINTER_FILL) - self.__region_color = gtk.combo_box_new_text() + self.__region_color = Gtk.ComboBoxText.new() self.__region_color.append_text(_('Red')) self.__region_color.append_text(_('Yellow')) self.__region_color.append_text(_('Green')) @@ -205,13 +196,13 @@ class ControlAction(BWExpander): self.radialnet.set_region_color(self.__region_color.get_active()) -class ControlVariableWidget(gtk.DrawingArea): +class ControlVariableWidget(Gtk.DrawingArea): """ """ def __init__(self, name, value, update, increment=1): """ """ - gtk.DrawingArea.__init__(self) + Gtk.DrawingArea.__init__(self) self.__variable_name = name self.__value = value @@ -226,18 +217,17 @@ class ControlVariableWidget(gtk.DrawingArea): self.__last_value = self.__value() - self.connect('expose_event', self.expose) + self.connect('draw', self.draw) self.connect('button_press_event', self.button_press) self.connect('button_release_event', self.button_release) self.connect('motion_notify_event', self.motion_notify) - self.add_events(gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.BUTTON_RELEASE_MASK | - gtk.gdk.MOTION_NOTIFY | - gtk.gdk.POINTER_MOTION_HINT_MASK | - gtk.gdk.POINTER_MOTION_MASK) + self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | + Gdk.EventMask.BUTTON_RELEASE_MASK | + Gdk.EventMask.POINTER_MOTION_HINT_MASK | + Gdk.EventMask.POINTER_MOTION_MASK) - gobject.timeout_add(REFRESH_RATE, self.verify_value) + GLib.timeout_add(REFRESH_RATE, self.verify_value) def verify_value(self): """ @@ -257,14 +247,14 @@ class ControlVariableWidget(gtk.DrawingArea): if self.__button_is_clicked(pointer) and event.button == 1: - event.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2)) + event.window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2)) self.__active_increment = True self.__increment_value() def button_release(self, widget, event): """ """ - event.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)) + event.window.set_cursor(Gdk.Cursor(Gdk.CursorType.LEFT_PTR)) self.__active_increment = False self.__pointer_position = 0 @@ -291,67 +281,66 @@ class ControlVariableWidget(gtk.DrawingArea): self.queue_draw() - def expose(self, widget, event): + def draw(self, widget, context): """ Drawing callback @type widget: GtkWidget @param widget: Gtk widget superclass - @type event: GtkEvent - @param event: Gtk event of widget + @type context: cairo.Context + @param context: cairo context class @rtype: boolean @return: Indicator of the event propagation """ self.set_size_request(100, 30) - self.context = widget.window.cairo_create() - self.__draw() + self.__draw(context) return True - def __draw(self): + def __draw(self, context): """ """ allocation = self.get_allocation() - self.__center_of_widget = (allocation.width / 2, - allocation.height / 2) + self.__center_of_widget = (allocation.width // 2, + allocation.height // 2) xc, yc = self.__center_of_widget # draw line - self.context.set_line_width(1) - self.context.set_dash([1, 2]) - self.context.move_to(self.__radius, + context.set_line_width(1) + context.set_dash([1, 2]) + context.move_to(self.__radius, yc + self.__radius) - self.context.line_to(2 * xc - 5, + context.line_to(2 * xc - 5, yc + self.__radius) - self.context.stroke() + context.stroke() # draw text - self.context.set_dash([1, 0]) - self.context.set_font_size(10) + context.set_dash([1, 0]) + context.set_font_size(10) - self.context.move_to(5, yc - self.__radius) - self.context.show_text(self.__variable_name) + context.move_to(5, yc - self.__radius) + context.show_text(self.__variable_name) - width = self.context.text_extents(str(self.__value()))[2] - self.context.move_to(2 * xc - width - 5, yc - self.__radius) - self.context.show_text(str(self.__value())) + width = context.text_extents(str(self.__value()))[2] + context.move_to(2 * xc - width - 5, yc - self.__radius) + context.show_text(str(self.__value())) - self.context.set_line_width(1) - self.context.stroke() + context.set_line_width(1) + context.stroke() # draw node - self.context.arc(xc + self.__pointer_position, + context.arc(xc + self.__pointer_position, yc + self.__radius, self.__radius, 0, 2 * math.pi) if self.__active_increment: - self.context.set_source_rgb(0.0, 0.0, 0.0) + context.set_source_rgb(0.0, 0.0, 0.0) else: - self.context.set_source_rgb(1.0, 1.0, 1.0) - self.context.fill_preserve() - self.context.set_source_rgb(0.0, 0.0, 0.0) - self.context.stroke() + context.set_source_rgb(1.0, 1.0, 1.0) + context.fill_preserve() + context.set_source_rgb(0.0, 0.0, 0.0) + context.stroke() def __button_is_clicked(self, pointer): """ @@ -370,7 +359,7 @@ class ControlVariableWidget(gtk.DrawingArea): if self.__active_increment: - gobject.timeout_add(self.__increment_time, + GLib.timeout_add(self.__increment_time, self.__increment_value) def set_value_function(self, value): @@ -410,18 +399,20 @@ class ControlVariable(BWHBox): self.__set_function, self.__increment_pass) - self.__left_button = gtk.Button() + self.__left_button = Gtk.Button() self.__left_button.set_size_request(20, 20) - self.__left_arrow = gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_NONE) + self.__left_arrow = Gtk.Image.new_from_icon_name("pan-start-symbolic", + Gtk.IconSize.BUTTON); self.__left_button.add(self.__left_arrow) self.__left_button.connect('pressed', self.__pressed, -self.__increment_pass) self.__left_button.connect('released', self.__released) - self.__right_button = gtk.Button() + self.__right_button = Gtk.Button() self.__right_button.set_size_request(20, 20) - self.__right_arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE) + self.__right_arrow = Gtk.Image.new_from_icon_name("pan-end-symbolic", + Gtk.IconSize.BUTTON); self.__right_button.add(self.__right_arrow) self.__right_button.connect('pressed', self.__pressed, @@ -446,7 +437,7 @@ class ControlVariable(BWHBox): self.__set_function(self.__get_function() + increment) self.__control.verify_value() - gobject.timeout_add(self.__increment_time, + GLib.timeout_add(self.__increment_time, self.__increment_function, increment) @@ -475,29 +466,28 @@ class ControlFisheye(BWVBox): """ self.__params = BWHBox() - self.__fisheye_label = gtk.Label(_('Fisheye on ring')) + self.__fisheye_label = Gtk.Label.new(_('Fisheye on ring')) self.__fisheye_label.set_use_markup(True) - self.__ring = gtk.Adjustment(0, 0, self.__ring_max_value, 0.01, 0.01) + self.__ring = Gtk.Adjustment.new(0, 0, self.__ring_max_value, 0.01, 0.01, 0) - self.__ring_spin = gtk.SpinButton(self.__ring) + self.__ring_spin = Gtk.SpinButton(adjustment=self.__ring) self.__ring_spin.set_digits(2) - self.__ring_scale = gtk.HScale(self.__ring) + self.__ring_scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=self.__ring) self.__ring_scale.set_size_request(100, -1) self.__ring_scale.set_digits(2) - self.__ring_scale.set_value_pos(gtk.POS_LEFT) + self.__ring_scale.set_value_pos(Gtk.PositionType.LEFT) self.__ring_scale.set_draw_value(False) - self.__ring_scale.set_update_policy(gtk.UPDATE_CONTINUOUS) - self.__interest_label = gtk.Label(_('with interest factor')) - self.__interest = gtk.Adjustment(0, 0, 10, 0.01) - self.__interest_spin = gtk.SpinButton(self.__interest) + self.__interest_label = Gtk.Label.new(_('with interest factor')) + self.__interest = Gtk.Adjustment.new(0, 0, 10, 0.01, 0, 0) + self.__interest_spin = Gtk.SpinButton(adjustment=self.__interest) self.__interest_spin.set_digits(2) - self.__spread_label = gtk.Label(_('and spread factor')) - self.__spread = gtk.Adjustment(0, -1.0, 1.0, 0.01, 0.01) - self.__spread_spin = gtk.SpinButton(self.__spread) + self.__spread_label = Gtk.Label.new(_('and spread factor')) + self.__spread = Gtk.Adjustment.new(0, -1.0, 1.0, 0.01, 0.01, 0) + self.__spread_spin = Gtk.SpinButton(adjustment=self.__spread) self.__spread_spin.set_digits(2) self.__params.bw_pack_start_noexpand_nofill(self.__fisheye_label) @@ -514,7 +504,7 @@ class ControlFisheye(BWVBox): self.__interest.connect('value_changed', self.__change_interest) self.__spread.connect('value_changed', self.__change_spread) - gobject.timeout_add(REFRESH_RATE, self.__update_fisheye) + GLib.timeout_add(REFRESH_RATE, self.__update_fisheye) def __update_fisheye(self): """ @@ -532,7 +522,7 @@ class ControlFisheye(BWVBox): elif value > ring_max_value: value = ring_max_value - self.__ring.set_all(value, 1, ring_max_value, 0.01, 0.01, 0) + self.__ring.configure(value, 1, ring_max_value, 0.01, 0.01, 0) self.__ring_max_value = ring_max_value self.__ring_scale.queue_draw() @@ -611,9 +601,10 @@ class ControlInterpolation(BWExpander): """ self.__vbox = BWVBox() - self.__cartesian_radio = gtk.RadioButton(None, _('Cartesian')) - self.__polar_radio = gtk.RadioButton( - self.__cartesian_radio, _('Polar')) + self.__cartesian_radio = Gtk.RadioButton(group=None, + label=_('Cartesian')) + self.__polar_radio = Gtk.RadioButton(group=self.__cartesian_radio, + label=_('Polar')) self.__cartesian_radio.connect('toggled', self.__change_system, RadialNet.INTERPOLATION_CARTESIAN) @@ -626,14 +617,12 @@ class ControlInterpolation(BWExpander): self.__system_box.bw_pack_start_noexpand_nofill(self.__cartesian_radio) self.__frames_box = BWHBox() - self.__frames_label = gtk.Label(_('Frames')) + self.__frames_label = Gtk.Label.new(_('Frames')) self.__frames_label.set_alignment(0.0, 0.5) - self.__frames = gtk.Adjustment(self.radialnet.get_number_of_frames(), - 1, - 1000, - 1) + self.__frames = Gtk.Adjustment.new( + self.radialnet.get_number_of_frames(), 1, 1000, 1, 0, 0) self.__frames.connect('value_changed', self.__change_frames) - self.__frames_spin = gtk.SpinButton(self.__frames) + self.__frames_spin = Gtk.SpinButton(adjustment=self.__frames) self.__frames_box.bw_pack_start_expand_fill(self.__frames_label) self.__frames_box.bw_pack_start_noexpand_nofill(self.__frames_spin) @@ -642,7 +631,7 @@ class ControlInterpolation(BWExpander): self.bw_add(self.__vbox) - gobject.timeout_add(REFRESH_RATE, self.__update_animation) + GLib.timeout_add(REFRESH_RATE, self.__update_animation) def __update_animation(self): """ @@ -694,12 +683,12 @@ class ControlLayout(BWExpander): """ self.__hbox = BWHBox() - self.__layout = gtk.combo_box_new_text() + self.__layout = Gtk.ComboBoxText() self.__layout.append_text(_('Symmetric')) self.__layout.append_text(_('Weighted')) self.__layout.set_active(self.radialnet.get_layout()) self.__layout.connect('changed', self.__change_layout) - self.__force = gtk.ToolButton(gtk.STOCK_REFRESH) + self.__force = Gtk.ToolButton(Gtk.STOCK_REFRESH) self.__force.connect('clicked', self.__force_update) self.__hbox.bw_pack_start_expand_fill(self.__layout) @@ -755,13 +744,11 @@ class ControlRingGap(BWVBox): self.radialnet.get_ring_gap, self.radialnet.set_ring_gap) - self.__label = gtk.Label(_('Lower ring gap')) + self.__label = Gtk.Label.new(_('Lower ring gap')) self.__label.set_alignment(0.0, 0.5) - self.__adjustment = gtk.Adjustment(self.radialnet.get_min_ring_gap(), - 0, - 50, - 1) - self.__spin = gtk.SpinButton(self.__adjustment) + self.__adjustment = Gtk.Adjustment.new( + self.radialnet.get_min_ring_gap(), 0, 50, 1, 0, 0) + self.__spin = Gtk.SpinButton(adjustment=self.__adjustment) self.__spin.connect('value_changed', self.__change_lower) self.__lower_hbox = BWHBox() @@ -786,8 +773,8 @@ class ControlOptions(BWScrolledWindow): """ BWScrolledWindow.__init__(self) - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) - self.set_shadow_type(gtk.SHADOW_NONE) + self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) + self.set_shadow_type(Gtk.ShadowType.NONE) self.radialnet = radialnet @@ -798,8 +785,7 @@ class ControlOptions(BWScrolledWindow): def __create_widgets(self): """ """ - self.__liststore = gtk.ListStore(gobject.TYPE_BOOLEAN, - gobject.TYPE_STRING) + self.__liststore = Gtk.ListStore.new([bool, str]) self.__liststore.append([None, OPTIONS[0]]) self.__liststore.append([None, OPTIONS[1]]) @@ -809,24 +795,24 @@ class ControlOptions(BWScrolledWindow): self.__liststore.append([None, OPTIONS[5]]) self.__liststore.append([None, OPTIONS[6]]) - self.__cell_toggle = gtk.CellRendererToggle() + self.__cell_toggle = Gtk.CellRendererToggle() self.__cell_toggle.set_property('activatable', True) self.__cell_toggle.connect('toggled', self.__change_option, self.__liststore) - self.__column_toggle = gtk.TreeViewColumn('', self.__cell_toggle) + self.__column_toggle = Gtk.TreeViewColumn(cell_renderer=self.__cell_toggle) self.__column_toggle.add_attribute(self.__cell_toggle, 'active', 0) self.__column_toggle.set_cell_data_func(self.__cell_toggle, self.__cell_toggle_data_method) - self.__cell_text = gtk.CellRendererText() + self.__cell_text = Gtk.CellRendererText() - self.__column_text = gtk.TreeViewColumn(None, - self.__cell_text, + self.__column_text = Gtk.TreeViewColumn(title=None, + cell_renderer=self.__cell_text, text=1) self.__column_text.set_cell_data_func(self.__cell_text, self.__cell_text_data_method) - self.__treeview = gtk.TreeView(self.__liststore) + self.__treeview = Gtk.TreeView.new_with_model(self.__liststore) self.__treeview.set_enable_search(True) self.__treeview.set_search_column(1) self.__treeview.set_headers_visible(False) @@ -835,15 +821,15 @@ class ControlOptions(BWScrolledWindow): self.add_with_viewport(self.__treeview) - gobject.timeout_add(REFRESH_RATE, self.__update_options) + GObject.timeout_add(REFRESH_RATE, self.__update_options) - def __cell_toggle_data_method(self, column, cell, model, it): + def __cell_toggle_data_method(self, column, cell, model, it, data): if not self.enable_labels and model.get_value(it, 1) == 'hostname': cell.set_property('activatable', False) else: cell.set_property('activatable', True) - def __cell_text_data_method(self, column, cell, model, it): + def __cell_text_data_method(self, column, cell, model, it, data): if not self.enable_labels and model.get_value(it, 1) == 'hostname': cell.set_property('strikethrough', True) else: @@ -935,13 +921,13 @@ class ControlView(BWExpander): self.bw_add(self.__vbox) -class ControlNavigation(gtk.DrawingArea): +class ControlNavigation(Gtk.DrawingArea): """ """ def __init__(self, radialnet): """ """ - gtk.DrawingArea.__init__(self) + Gtk.DrawingArea.__init__(self) self.radialnet = radialnet @@ -972,7 +958,7 @@ class ControlNavigation(gtk.DrawingArea): self.__rotate_clicked = False self.__move_clicked = None - self.connect('expose_event', self.expose) + self.connect('draw', self.draw) self.connect('button_press_event', self.button_press) self.connect('button_release_event', self.button_release) self.connect('motion_notify_event', self.motion_notify) @@ -981,23 +967,21 @@ class ControlNavigation(gtk.DrawingArea): self.connect('key_press_event', self.key_press) self.connect('key_release_event', self.key_release) - self.add_events(gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.BUTTON_RELEASE_MASK | - gtk.gdk.ENTER_NOTIFY | - gtk.gdk.LEAVE_NOTIFY | - gtk.gdk.MOTION_NOTIFY | - gtk.gdk.NOTHING | - gtk.gdk.KEY_PRESS_MASK | - gtk.gdk.KEY_RELEASE_MASK | - gtk.gdk.POINTER_MOTION_HINT_MASK | - gtk.gdk.POINTER_MOTION_MASK) + self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | + Gdk.EventMask.BUTTON_RELEASE_MASK | + Gdk.EventMask.ENTER_NOTIFY_MASK | + Gdk.EventMask.LEAVE_NOTIFY_MASK | + Gdk.EventMask.KEY_PRESS_MASK | + Gdk.EventMask.KEY_RELEASE_MASK | + Gdk.EventMask.POINTER_MOTION_HINT_MASK | + Gdk.EventMask.POINTER_MOTION_MASK) self.__rotate_node.set_coordinate(40, self.radialnet.get_rotation()) def key_press(self, widget, event): """ """ - # key = gtk.gdk.keyval_name(event.keyval) + # key = Gdk.keyval_name(event.keyval) self.queue_draw() @@ -1006,7 +990,7 @@ class ControlNavigation(gtk.DrawingArea): def key_release(self, widget, event): """ """ - # key = gtk.gdk.keyval_name(event.keyval) + # key = Gdk.keyval_name(event.keyval) self.queue_draw() @@ -1040,20 +1024,20 @@ class ControlNavigation(gtk.DrawingArea): if self.__rotate_is_clicked(pointer): - event.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2)) + event.window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2)) self.__rotating = True direction = self.__move_is_clicked(pointer) if direction is not None and self.__moving is None: - event.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2)) + event.window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2)) self.__moving = direction self.__move_in_direction(direction) if self.__center_is_clicked(pointer): - event.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2)) + event.window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2)) self.__centering = True self.__move_position = (0, 0) self.radialnet.set_translation(self.__move_position) @@ -1077,7 +1061,7 @@ class ControlNavigation(gtk.DrawingArea): self.__rotating = False # stop rotate self.__move_factor = 1 - event.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)) + event.window.set_cursor(Gdk.Cursor(Gdk.CursorType.LEFT_PTR)) self.queue_draw() @@ -1114,24 +1098,23 @@ class ControlNavigation(gtk.DrawingArea): return False - def expose(self, widget, event): + def draw(self, widget, context): """ Drawing callback @type widget: GtkWidget @param widget: Gtk widget superclass - @type event: GtkEvent - @param event: Gtk event of widget + @type context: cairo.Context + @param context: cairo context class @rtype: boolean @return: Indicator of the event propagation """ self.set_size_request(120, 130) - self.context = widget.window.cairo_create() - self.__draw() + self.__draw(context) return False - def __draw_rotate_control(self): + def __draw_rotate_control(self, context): """ """ xc, yc = self.__center_of_widget @@ -1139,100 +1122,99 @@ class ControlNavigation(gtk.DrawingArea): x, y = self.__rotate_node.to_cartesian() # draw text - self.context.set_font_size(10) - self.context.move_to(xc - 49, yc - 48) - self.context.show_text(_("Navigation")) + context.set_font_size(10) + context.move_to(xc - 49, yc - 48) + context.show_text(_("Navigation")) - width = self.context.text_extents(str(int(t)))[2] - self.context.move_to(xc + 49 - width - 2, yc - 48) - self.context.show_text(str(round(t, 1))) - self.context.set_line_width(1) - self.context.stroke() + width = context.text_extents(str(int(t)))[2] + context.move_to(xc + 49 - width - 2, yc - 48) + context.show_text(str(round(t, 1))) + context.set_line_width(1) + context.stroke() # draw arc - self.context.set_dash([1, 2]) - self.context.arc(xc, yc, 40, 0, 2 * math.pi) - self.context.set_source_rgb(0.0, 0.0, 0.0) - self.context.set_line_width(1) - self.context.stroke() + context.set_dash([1, 2]) + context.arc(xc, yc, 40, 0, 2 * math.pi) + context.set_source_rgb(0.0, 0.0, 0.0) + context.set_line_width(1) + context.stroke() # draw node - self.context.set_dash([1, 0]) - self.context.arc(xc + x, yc - y, self.__rotate_radius, 0, 2 * math.pi) + context.set_dash([1, 0]) + context.arc(xc + x, yc - y, self.__rotate_radius, 0, 2 * math.pi) if self.__rotating: - self.context.set_source_rgb(0.0, 0.0, 0.0) - + context.set_source_rgb(0.0, 0.0, 0.0) else: - self.context.set_source_rgb(1.0, 1.0, 1.0) + context.set_source_rgb(1.0, 1.0, 1.0) - self.context.fill_preserve() - self.context.set_source_rgb(0.0, 0.0, 0.0) - self.context.set_line_width(1) - self.context.stroke() + context.fill_preserve() + context.set_source_rgb(0.0, 0.0, 0.0) + context.set_line_width(1) + context.stroke() return False - def __draw_move_control(self): + def __draw_move_control(self, context): """ """ xc, yc = self.__center_of_widget pc = PolarCoordinate() - self.context.set_dash([1, 1]) - self.context.arc(xc, yc, 23, 0, 2 * math.pi) - self.context.set_source_rgb(0.0, 0.0, 0.0) - self.context.set_line_width(1) - self.context.stroke() + context.set_dash([1, 1]) + context.arc(xc, yc, 23, 0, 2 * math.pi) + context.set_source_rgb(0.0, 0.0, 0.0) + context.set_line_width(1) + context.stroke() for i in range(8): pc.set_coordinate(23, 45 * i) x, y = pc.to_cartesian() - self.context.set_dash([1, 1]) - self.context.move_to(xc, yc) - self.context.line_to(xc + x, yc - y) - self.context.stroke() + context.set_dash([1, 1]) + context.move_to(xc, yc) + context.line_to(xc + x, yc - y) + context.stroke() - self.context.set_dash([1, 0]) - self.context.arc( + context.set_dash([1, 0]) + context.arc( xc + x, yc - y, self.__move_radius, 0, 2 * math.pi) if i == self.__moving: - self.context.set_source_rgb(0.0, 0.0, 0.0) + context.set_source_rgb(0.0, 0.0, 0.0) else: - self.context.set_source_rgb(1.0, 1.0, 1.0) - self.context.fill_preserve() - self.context.set_source_rgb(0.0, 0.0, 0.0) - self.context.set_line_width(1) - self.context.stroke() + context.set_source_rgb(1.0, 1.0, 1.0) + context.fill_preserve() + context.set_source_rgb(0.0, 0.0, 0.0) + context.set_line_width(1) + context.stroke() - self.context.arc(xc, yc, 6, 0, 2 * math.pi) + context.arc(xc, yc, 6, 0, 2 * math.pi) if self.__centering: - self.context.set_source_rgb(0.0, 0.0, 0.0) + context.set_source_rgb(0.0, 0.0, 0.0) else: - self.context.set_source_rgb(1.0, 1.0, 1.0) - self.context.fill_preserve() - self.context.set_source_rgb(0.0, 0.0, 0.0) - self.context.set_line_width(1) - self.context.stroke() + context.set_source_rgb(1.0, 1.0, 1.0) + context.fill_preserve() + context.set_source_rgb(0.0, 0.0, 0.0) + context.set_line_width(1) + context.stroke() return False - def __draw(self): + def __draw(self, context): """ Drawing method """ # Getting allocation reference allocation = self.get_allocation() - self.__center_of_widget = (allocation.width / 2, - allocation.height / 2) + self.__center_of_widget = (allocation.width // 2, + allocation.height // 2) - self.__draw_rotate_control() - self.__draw_move_control() + self.__draw_rotate_control(context) + self.__draw_move_control(context) return False @@ -1251,7 +1233,7 @@ class ControlNavigation(gtk.DrawingArea): if self.__move_factor < self.__move_factor_limit: self.__move_factor += 1 - gobject.timeout_add(self.__move_pass, + GObject.timeout_add(self.__move_pass, self.__move_in_direction, direction) diff --git a/zenmap/radialnet/gui/Dialogs.py b/zenmap/radialnet/gui/Dialogs.py index 112d0417f..aa3196eee 100644 --- a/zenmap/radialnet/gui/Dialogs.py +++ b/zenmap/radialnet/gui/Dialogs.py @@ -57,19 +57,22 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from radialnet.core.Info import INFO from radialnet.gui.Image import Pixmaps -class AboutDialog(gtk.AboutDialog): +class AboutDialog(Gtk.AboutDialog): """ """ def __init__(self): """ """ - gtk.AboutDialog.__init__(self) + Gtk.AboutDialog.__init__(self) self.set_name(INFO['name']) self.set_version(INFO['version']) diff --git a/zenmap/radialnet/gui/HostsViewer.py b/zenmap/radialnet/gui/HostsViewer.py index 0feee8996..c7131fccd 100644 --- a/zenmap/radialnet/gui/HostsViewer.py +++ b/zenmap/radialnet/gui/HostsViewer.py @@ -57,9 +57,12 @@ # * * # ***************************************************************************/ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + import re -import gtk -import gobject from radialnet.bestwidgets.windows import BWMainWindow @@ -73,7 +76,7 @@ HOSTS_HEADER = ['ID', '#', 'Hosts'] DIMENSION = (700, 400) -IP_RE = re.compile('^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$') +IP_RE = re.compile(r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$') class HostsViewer(BWMainWindow): @@ -87,7 +90,7 @@ class HostsViewer(BWMainWindow): self.set_default_size(DIMENSION[0], DIMENSION[1]) self.__nodes = nodes - self.__default_view = gtk.Label(_("No node selected")) + self.__default_view = Gtk.Label.new(_("No node selected")) self.__view = self.__default_view self.__create_widgets() @@ -95,7 +98,7 @@ class HostsViewer(BWMainWindow): def __create_widgets(self): """ """ - self.__panel = gtk.HPaned() + self.__panel = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL) self.__panel.set_border_width(6) self.__list = HostsList(self, self.__nodes) @@ -121,15 +124,15 @@ class HostsViewer(BWMainWindow): self.__panel.add2(self.__view) -class HostsList(gtk.ScrolledWindow): +class HostsList(Gtk.ScrolledWindow): """ """ def __init__(self, parent, nodes): """ """ super(HostsList, self).__init__() - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - self.set_shadow_type(gtk.SHADOW_NONE) + self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) + self.set_shadow_type(Gtk.ShadowType.NONE) self.__parent = parent self.__nodes = nodes @@ -139,15 +142,11 @@ class HostsList(gtk.ScrolledWindow): def __create_widgets(self): """ """ - self.__cell = gtk.CellRendererText() + self.__cell = Gtk.CellRendererText() - self.__hosts_store = gtk.ListStore(gobject.TYPE_INT, - gobject.TYPE_INT, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_BOOLEAN) + self.__hosts_store = Gtk.ListStore.new([int, int, str, str, bool]) - self.__hosts_treeview = gtk.TreeView(self.__hosts_store) + self.__hosts_treeview = Gtk.TreeView.new_with_model(self.__hosts_store) self.__hosts_treeview.connect('cursor-changed', self.__cursor_callback) for i in range(len(self.__nodes)): @@ -169,8 +168,8 @@ class HostsList(gtk.ScrolledWindow): for i in range(0, len(HOSTS_HEADER)): - column = gtk.TreeViewColumn(HOSTS_HEADER[i], - self.__cell, + column = Gtk.TreeViewColumn(title=HOSTS_HEADER[i], + cell_renderer=self.__cell, text=i) self.__hosts_column.append(column) @@ -207,7 +206,7 @@ class HostsList(gtk.ScrolledWindow): self.__parent.change_notebook(node) - def __host_sort(self, treemodel, iter1, iter2): + def __host_sort(self, treemodel, iter1, iter2, *_): """ """ value1 = treemodel.get_value(iter1, 2) diff --git a/zenmap/radialnet/gui/Image.py b/zenmap/radialnet/gui/Image.py index 35300d595..b5be6a361 100644 --- a/zenmap/radialnet/gui/Image.py +++ b/zenmap/radialnet/gui/Image.py @@ -57,8 +57,12 @@ # * * # ***************************************************************************/ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GdkPixbuf + import os -import gtk import array from zenmapCore.Paths import Path @@ -74,8 +78,8 @@ def get_pixels_for_cairo_image_surface(pixbuf): containing the icon pixels of a gtk.gdk.Pixbuf that can be used by cairo.ImageSurface.create_for_data() method. """ - data = array.ArrayType('c') - format = pixbuf.get_rowstride() / pixbuf.get_width() + data = array.array('B') + image_format = pixbuf.get_rowstride() // pixbuf.get_width() i = 0 j = 0 @@ -83,16 +87,16 @@ def get_pixels_for_cairo_image_surface(pixbuf): b, g, r = pixbuf.get_pixels()[i:i + FORMAT_RGB] - if format == FORMAT_RGBA: + if image_format == FORMAT_RGBA: a = pixbuf.get_pixels()[i + FORMAT_RGBA - 1] - elif format == FORMAT_RGB: - a = '\xff' + elif image_format == FORMAT_RGB: + a = 255 else: raise TypeError('unknown image format') - data[j:j + FORMAT_RGBA] = array.ArrayType('c', [r, g, b, a]) + data[j:j + FORMAT_RGBA] = array.array('B', [r, g, b, a]) - i += format + i += image_format j += FORMAT_RGBA return (FORMAT_RGBA * pixbuf.get_width(), data) @@ -122,7 +126,7 @@ class Image: file = self.get_icon(icon, image_type) self.__cache[icon + image_type] = \ - gtk.gdk.pixbuf_new_from_file(file) + GdkPixbuf.Pixbuf.new_from_file(file) return self.__cache[icon + image_type] diff --git a/zenmap/radialnet/gui/LegendWindow.py b/zenmap/radialnet/gui/LegendWindow.py index 3b5522857..403c825ed 100644 --- a/zenmap/radialnet/gui/LegendWindow.py +++ b/zenmap/radialnet/gui/LegendWindow.py @@ -57,8 +57,11 @@ # * * # ***************************************************************************/ -import gtk -import pango +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk, Pango + import math import cairo @@ -69,7 +72,9 @@ DIMENSION_NORMAL = (350, 450) def draw_pixmap(context, x, y, name, label): - context.set_source_pixbuf(Pixmaps().get_pixbuf(name), x, y) + # This is pretty hideous workaround + Gdk.cairo_set_source_pixbuf(context, Pixmaps().get_pixbuf(name), x, y) + #context.set_source_pixbuf() context.paint() context.move_to(x + 50, y + 10) context.set_source_rgb(0, 0, 0) @@ -124,117 +129,116 @@ def draw_line(context, x, y, dash, color, label): context.show_text(label) -class LegendWindow(gtk.Window): +class LegendWindow(Gtk.Window): """ """ def __init__(self): """ """ - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + Gtk.Window.__init__(self, type=Gtk.WindowType.TOPLEVEL) self.set_default_size(DIMENSION_NORMAL[0], DIMENSION_NORMAL[1]) - self.__title_font = pango.FontDescription("Monospace Bold") + self.__title_font = Pango.FontDescription("Monospace Bold") self.set_title(_("Topology Legend")) - self.vbox = gtk.VBox() + self.vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) self.add(self.vbox) - self.drawing_area = gtk.DrawingArea() - self.vbox.pack_start(self.drawing_area) - self.drawing_area.connect("expose-event", self.expose_event_handler) - self.more_uri = gtk.LinkButton( + self.drawing_area = Gtk.DrawingArea() + self.vbox.pack_start(self.drawing_area, True, True, 0) + self.drawing_area.connect("draw", self.draw_event_handler) + self.more_uri = Gtk.LinkButton.new_with_label( "https://nmap.org/book/zenmap-topology.html#zenmap-topology-legend", - label=_("View full legend online")) - self.vbox.pack_start(self.more_uri, False, False) + _("View full legend online")) + self.vbox.pack_start(self.more_uri, False, False, 0) - def expose_event_handler(self, widget, event): + def draw_event_handler(self, widget, graphic_context): """ """ - self.graphic_context = widget.window.cairo_create() x, y = 45, 20 - draw_heading(self.graphic_context, x, y, _("Hosts")) + draw_heading(graphic_context, x, y, _("Hosts")) # white circle y += 20 - draw_circle(self.graphic_context, x, y, 3, (1, 1, 1), + draw_circle(graphic_context, x, y, 3, (1, 1, 1), _("host was not port scanned")) # green circle y += 20 - draw_circle(self.graphic_context, x, y, 4, (0, 1, 0), + draw_circle(graphic_context, x, y, 4, (0, 1, 0), _("host with fewer than 3 open ports")) # yellow circle y += 20 - draw_circle(self.graphic_context, x, y, 5, (1, 1, 0), + draw_circle(graphic_context, x, y, 5, (1, 1, 0), _("host with 3 to 6 open ports")) # red circle y += 20 - draw_circle(self.graphic_context, x, y, 6, (1, 0, 0), + draw_circle(graphic_context, x, y, 6, (1, 0, 0), _("host with more than 6 open ports")) # green square y += 20 rx = x - 20 - draw_square(self.graphic_context, rx, y, 10, (0, 1, 0)) + draw_square(graphic_context, rx, y, 10, (0, 1, 0)) rx += 10 + 5 # yellow square - draw_square(self.graphic_context, rx, y, 12, (1, 1, 0)) + draw_square(graphic_context, rx, y, 12, (1, 1, 0)) rx += 12 + 5 # red square - draw_square(self.graphic_context, rx, y, 14, (1, 0, 0)) + draw_square(graphic_context, rx, y, 14, (1, 0, 0)) - self.graphic_context.move_to(x + 50, y + 5) - self.graphic_context.set_source_rgb(0, 0, 0) - self.graphic_context.show_text(_("host is a router, switch, or WAP")) + graphic_context.move_to(x + 50, y + 5) + graphic_context.set_source_rgb(0, 0, 0) + graphic_context.show_text(_("host is a router, switch, or WAP")) # connections between hosts y += 30 - draw_heading(self.graphic_context, x, y, _("Traceroute connections")) + draw_heading(graphic_context, x, y, _("Traceroute connections")) y += 20 - self.graphic_context.move_to(x, y) - self.graphic_context.show_text(_("Thicker line means higher round-trip time")) + graphic_context.move_to(x, y) + graphic_context.show_text(_("Thicker line means higher round-trip time")) # primary traceroute (blue line) y += 20 - draw_line(self.graphic_context, x, y, [], (0, 0, 1), + draw_line(graphic_context, x, y, [], (0, 0, 1), _("primary traceroute connection")) # Alternate route (orange line) y += 20 - draw_line(self.graphic_context, x, y, [], (1, 0.5, 0), + draw_line(graphic_context, x, y, [], (1, 0.5, 0), _("alternate path")) # no traceroute y += 20 - draw_line(self.graphic_context, x, y, [4.0, 2.0], (0, 0, 0), + draw_line(graphic_context, x, y, [4.0, 2.0], (0, 0, 0), _("no traceroute information")) # missing traceroute y += 20 - self.graphic_context.set_source_rgb(0.5, 0.7, 0.95) - self.graphic_context.move_to(x - 15, y) - self.graphic_context.arc(x - 25, y, 5, 0, 2 * math.pi) - self.graphic_context.stroke_preserve() - draw_line(self.graphic_context, x, y, [4.0, 2.0], (0.5, 0.7, 0.95), + graphic_context.set_source_rgb(0.5, 0.7, 0.95) + graphic_context.move_to(x - 15, y) + graphic_context.arc(x - 25, y, 5, 0, 2 * math.pi) + graphic_context.stroke_preserve() + draw_line(graphic_context, x, y, [4.0, 2.0], (0.5, 0.7, 0.95), _("missing traceroute hop")) # special purpose hosts y += 30 - draw_heading(self.graphic_context, x, y, _("Additional host icons")) + draw_heading(graphic_context, x, y, _("Additional host icons")) # router image y += 20 - draw_pixmap(self.graphic_context, x, y, "router", _("router")) + draw_pixmap(graphic_context, x, y, "router", _("router")) # switch image y += 20 - draw_pixmap(self.graphic_context, x, y, "switch", _("switch")) + draw_pixmap(graphic_context, x, y, "switch", _("switch")) # wap image y += 20 - draw_pixmap(self.graphic_context, x, y, "wireless", + draw_pixmap(graphic_context, x, y, "wireless", _("wireless access point")) # firewall image y += 20 - draw_pixmap(self.graphic_context, x, y, "firewall", _("firewall")) + draw_pixmap(graphic_context, x, y, "firewall", _("firewall")) # host with filtered ports y += 20 - draw_pixmap(self.graphic_context, x, y, "padlock", + draw_pixmap(graphic_context, x, y, "padlock", _("host with some filtered ports")) diff --git a/zenmap/radialnet/gui/NodeNotebook.py b/zenmap/radialnet/gui/NodeNotebook.py index 4800b5c2d..bdf25df3e 100644 --- a/zenmap/radialnet/gui/NodeNotebook.py +++ b/zenmap/radialnet/gui/NodeNotebook.py @@ -57,9 +57,10 @@ # * * # ***************************************************************************/ -import gtk -import pango -import gobject +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject, Pango from radialnet.bestwidgets.boxes import BWVBox, BWHBox, BWScrolledWindow, BWTable from radialnet.bestwidgets.expanders import BWExpander @@ -109,14 +110,14 @@ def get_service_color(state): return color -class NodeNotebook(gtk.Notebook): +class NodeNotebook(Gtk.Notebook): """ """ def __init__(self, node): """ """ - gtk.Notebook.__init__(self) - self.set_tab_pos(gtk.POS_TOP) + Gtk.Notebook.__init__(self) + self.set_tab_pos(Gtk.PositionType.TOP) self.__node = node @@ -136,25 +137,25 @@ class NodeNotebook(gtk.Notebook): self.append_page(self.__trace_page, BWLabel(_('Traceroute'))) -class ServicesPage(gtk.Notebook): +class ServicesPage(Gtk.Notebook): """ """ def __init__(self, node): """ """ - gtk.Notebook.__init__(self) + Gtk.Notebook.__init__(self) self.set_border_width(6) - self.set_tab_pos(gtk.POS_TOP) + self.set_tab_pos(Gtk.PositionType.TOP) self.__node = node - self.__font = pango.FontDescription('Monospace') + self.__font = Pango.FontDescription('Monospace') self.__create_widgets() def __create_widgets(self): """ """ - self.__cell = gtk.CellRendererText() + self.__cell = Gtk.CellRendererText() # texteditor widgets self.__texteditor = BWTextEditor() @@ -162,7 +163,7 @@ class ServicesPage(gtk.Notebook): self.__texteditor.bw_set_editable(False) self.__texteditor.set_border_width(0) - self.__select_combobox = gtk.combo_box_new_text() + self.__select_combobox = Gtk.ComboBoxText() self.__select_combobox.connect('changed', self.__change_text_value) self.__viewer = BWVBox(spacing=6) @@ -179,15 +180,15 @@ class ServicesPage(gtk.Notebook): self.__ports_scroll = BWScrolledWindow() - self.__ports_store = gtk.TreeStore(gobject.TYPE_INT, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_BOOLEAN) + self.__ports_store = Gtk.TreeStore.new([GObject.TYPE_INT, + GObject.TYPE_STRING, + GObject.TYPE_STRING, + GObject.TYPE_STRING, + GObject.TYPE_STRING, + GObject.TYPE_STRING, + GObject.TYPE_BOOLEAN]) - self.__ports_treeview = gtk.TreeView(self.__ports_store) + self.__ports_treeview = Gtk.TreeView.new_with_model(self.__ports_store) for port in self.__node.get_info('ports'): @@ -257,8 +258,8 @@ class ServicesPage(gtk.Notebook): for i in range(len(PORTS_HEADER)): - column = gtk.TreeViewColumn(PORTS_HEADER[i], - self.__cell, + column = Gtk.TreeViewColumn(title=PORTS_HEADER[i], + cell_renderer=self.__cell, text=i) self.__ports_column.append(column) @@ -280,13 +281,13 @@ class ServicesPage(gtk.Notebook): self.__xports_scroll = BWScrolledWindow() - self.__xports_store = gtk.TreeStore(gobject.TYPE_INT, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_BOOLEAN) + self.__xports_store = Gtk.TreeStore.new([GObject.TYPE_INT, + GObject.TYPE_STRING, + GObject.TYPE_STRING, + GObject.TYPE_STRING, + GObject.TYPE_BOOLEAN]) - self.__xports_treeview = gtk.TreeView(self.__xports_store) + self.__xports_treeview = Gtk.TreeView.new_with_model(self.__xports_store) for xports in self.__node.get_info('extraports'): @@ -309,8 +310,8 @@ class ServicesPage(gtk.Notebook): for i in range(len(EXTRAPORTS_HEADER)): - column = gtk.TreeViewColumn(EXTRAPORTS_HEADER[i], - self.__cell, + column = Gtk.TreeViewColumn(title=EXTRAPORTS_HEADER[i], + cell_renderer=self.__cell, text=i) self.__xports_column.append(column) @@ -354,7 +355,7 @@ class SystemPage(BWScrolledWindow): BWScrolledWindow.__init__(self) self.__node = node - self.__font = pango.FontDescription('Monospace') + self.__font = Pango.FontDescription('Monospace') self.__create_widgets() @@ -364,21 +365,21 @@ class SystemPage(BWScrolledWindow): self.__vbox = BWVBox() self.__vbox.set_border_width(6) - self.__cell = gtk.CellRendererText() + self.__cell = Gtk.CellRendererText() self.__general_frame = BWExpander(_('General information')) self.__sequences_frame = BWExpander(_('Sequences')) self.__os_frame = BWExpander(_('Operating System')) - self.__sequences_frame.bw_add(gtk.Label(_('No sequence information.'))) - self.__os_frame.bw_add(gtk.Label(_('No OS information.'))) + self.__sequences_frame.bw_add(Gtk.Label.new(_('No sequence information.'))) + self.__os_frame.bw_add(Gtk.Label.new(_('No OS information.'))) # general information widgets self.__general = BWTable(3, 2) self.__address_label = BWSectionLabel(_('Address:')) - self.__address_list = gtk.combo_box_entry_new_text() - self.__address_list.child.set_editable(False) + self.__address_list = Gtk.ComboBoxText.new_with_entry() + self.__address_list.get_child().set_editable(False) for address in self.__node.get_info('addresses'): @@ -393,15 +394,15 @@ class SystemPage(BWScrolledWindow): self.__address_list.set_active(0) self.__general.bw_attach_next(self.__address_label, - yoptions=gtk.FILL, - xoptions=gtk.FILL) - self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL) + yoptions=Gtk.AttachOptions.FILL, + xoptions=Gtk.AttachOptions.FILL) + self.__general.bw_attach_next(self.__address_list, yoptions=Gtk.AttachOptions.FILL) if self.__node.get_info('hostnames') is not None: self.__hostname_label = BWSectionLabel(_('Hostname:')) - self.__hostname_list = gtk.combo_box_entry_new_text() - self.__hostname_list.child.set_editable(False) + self.__hostname_list = Gtk.ComboBoxText.new_with_entry() + self.__hostname_list.get_child().set_editable(False) for hostname in self.__node.get_info('hostnames'): @@ -411,10 +412,10 @@ class SystemPage(BWScrolledWindow): self.__hostname_list.set_active(0) self.__general.bw_attach_next(self.__hostname_label, - yoptions=gtk.FILL, - xoptions=gtk.FILL) + yoptions=Gtk.AttachOptions.FILL, + xoptions=Gtk.AttachOptions.FILL) self.__general.bw_attach_next(self.__hostname_list, - yoptions=gtk.FILL) + yoptions=Gtk.AttachOptions.FILL) if self.__node.get_info('uptime') is not None: @@ -430,10 +431,10 @@ class SystemPage(BWScrolledWindow): self.__uptime_value.set_line_wrap(False) self.__general.bw_attach_next(self.__uptime_label, - yoptions=gtk.FILL, - xoptions=gtk.FILL) + yoptions=Gtk.AttachOptions.FILL, + xoptions=Gtk.AttachOptions.FILL) self.__general.bw_attach_next(self.__uptime_value, - yoptions=gtk.FILL) + yoptions=Gtk.AttachOptions.FILL) self.__general_frame.bw_add(self.__general) self.__general_frame.set_expanded(True) @@ -444,7 +445,7 @@ class SystemPage(BWScrolledWindow): self.__create_sequences_widget(sequences)) # operating system information widgets - self.__os = gtk.Notebook() + self.__os = Gtk.Notebook() os = self.__node.get_info('os') @@ -454,12 +455,8 @@ class SystemPage(BWScrolledWindow): self.__match_scroll = BWScrolledWindow() - self.__match_store = gtk.ListStore(gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_INT, - gobject.TYPE_BOOLEAN) - - self.__match_treeview = gtk.TreeView(self.__match_store) + self.__match_store = Gtk.ListStore.new([str, str, int, bool]) + self.__match_treeview = Gtk.TreeView.new_with_model(self.__match_store) for os_match in os['matches']: @@ -473,8 +470,8 @@ class SystemPage(BWScrolledWindow): for i in range(len(OSMATCH_HEADER)): - column = gtk.TreeViewColumn(OSMATCH_HEADER[i], - self.__cell, + column = Gtk.TreeViewColumn(title=OSMATCH_HEADER[i], + cell_renderer=self.__cell, text=i) self.__match_column.append(column) @@ -496,14 +493,8 @@ class SystemPage(BWScrolledWindow): self.__class_scroll = BWScrolledWindow() - self.__class_store = gtk.ListStore(gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_BOOLEAN) - - self.__class_treeview = gtk.TreeView(self.__class_store) + self.__class_store = Gtk.ListStore.new([str, str, str, str, str, bool]) + self.__class_treeview = Gtk.TreeView.new_with_model(self.__class_store) for os_class in os['classes']: @@ -520,8 +511,8 @@ class SystemPage(BWScrolledWindow): for i in range(len(OSCLASS_HEADER)): - column = gtk.TreeViewColumn(OSCLASS_HEADER[i], - self.__cell, + column = Gtk.TreeViewColumn(title=OSCLASS_HEADER[i], + cell_renderer=self.__cell, text=i) self.__class_column.append(column) @@ -547,8 +538,8 @@ class SystemPage(BWScrolledWindow): self.__fp_ports = BWHBox() self.__fp_label = BWSectionLabel(_('Used ports:')) - self.__fp_ports_list = gtk.combo_box_entry_new_text() - self.__fp_ports_list.child.set_editable(False) + self.__fp_ports_list = Gtk.ComboBoxText.new_with_entry() + self.__fp_ports_list.get_child().set_editable(False) self.__fp_vbox = BWVBox() @@ -601,7 +592,7 @@ class SystemPage(BWScrolledWindow): table.attach(tcp_class, 1, 2, 1, 2) - tcp_values = gtk.combo_box_entry_new_text() + tcp_values = Gtk.ComboBoxText.new_with_entry() for value in tcp['values']: tcp_values.append_text(value) @@ -626,7 +617,7 @@ class SystemPage(BWScrolledWindow): table.attach(ip_id_class, 1, 2, 2, 3) - ip_id_values = gtk.combo_box_entry_new_text() + ip_id_values = Gtk.ComboBoxText.new_with_entry() for value in ip_id['values']: ip_id_values.append_text(value) @@ -644,7 +635,7 @@ class SystemPage(BWScrolledWindow): if tcp_ts['values'] is not None: - tcp_ts_values = gtk.combo_box_entry_new_text() + tcp_ts_values = Gtk.ComboBoxText.new_with_entry() for value in tcp_ts['values']: tcp_ts_values.append_text(value) @@ -678,8 +669,8 @@ class TraceroutePage(BWVBox): hops = trace.get("hops") if hops is None or len(hops) == 0: - self.__trace_label = gtk.Label(NO_TRACE_TEXT) - self.pack_start(self.__trace_label, True, True) + self.__trace_label = Gtk.Label.new(NO_TRACE_TEXT) + self.pack_start(self.__trace_label, True, True, 0) else: @@ -687,19 +678,13 @@ class TraceroutePage(BWVBox): hops = self.__node.get_info('trace')['hops'] ttls = [int(i['ttl']) for i in hops] - self.__cell = gtk.CellRendererText() + self.__cell = Gtk.CellRendererText() self.__trace_scroll = BWScrolledWindow() self.__trace_scroll.set_border_width(0) - self.__trace_store = gtk.ListStore(gobject.TYPE_INT, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_BOOLEAN) - - self.__trace_treeview = gtk.TreeView(self.__trace_store) + self.__trace_store = Gtk.ListStore.new([int, str, str, str, str, bool]) + self.__trace_treeview = Gtk.TreeView.new_with_model(self.__trace_store) count = 0 @@ -729,8 +714,8 @@ class TraceroutePage(BWVBox): for i in range(len(TRACE_HEADER)): - column = gtk.TreeViewColumn(TRACE_HEADER[i], - self.__cell, + column = Gtk.TreeViewColumn(title=TRACE_HEADER[i], + cell_renderer=self.__cell, text=i) self.__trace_column.append(column) diff --git a/zenmap/radialnet/gui/NodeWindow.py b/zenmap/radialnet/gui/NodeWindow.py index a82743a52..446ac8669 100644 --- a/zenmap/radialnet/gui/NodeWindow.py +++ b/zenmap/radialnet/gui/NodeWindow.py @@ -57,8 +57,10 @@ # * * # ***************************************************************************/ -import gtk -import pango +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk, Pango import radialnet.util.drawing as drawing @@ -78,13 +80,13 @@ class NodeWindow(BWWindow): def __init__(self, node, position): """ """ - BWWindow.__init__(self, gtk.WINDOW_TOPLEVEL) + BWWindow.__init__(self, Gtk.WindowType.TOPLEVEL) self.move(position[0], position[1]) self.set_default_size(DIMENSION_NORMAL[0], DIMENSION_NORMAL[1]) self.__node = node - self.__title_font = pango.FontDescription('Monospace Bold') + self.__title_font = Pango.FontDescription('Monospace Bold') self.__icon = Application() self.__create_widgets() @@ -100,14 +102,14 @@ class NodeWindow(BWWindow): # create head elements # icon with node's score color - self.__color_box = gtk.EventBox() - self.__color_image = gtk.Image() + self.__color_box = Gtk.EventBox() + self.__color_image = Gtk.Image() self.__color_image.set_from_file(self.__icon.get_icon('border')) self.__color_box.add(self.__color_image) self.__color_box.set_size_request(15, 15) r, g, b = drawing.cairo_to_gdk_color( self.__node.get_draw_info('color')) - self.__color_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(r, g, b)) + self.__color_box.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(r, g, b)) # title with the node ip and hostname self.__title = self.__node.get_host().get_hostname() diff --git a/zenmap/radialnet/gui/RadialNet.py b/zenmap/radialnet/gui/RadialNet.py index 75465588a..60bb76eac 100644 --- a/zenmap/radialnet/gui/RadialNet.py +++ b/zenmap/radialnet/gui/RadialNet.py @@ -57,10 +57,15 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GLib, Gdk + import math import cairo -import gobject + +from functools import reduce import radialnet.util.geometry as geometry import radialnet.util.misc as misc @@ -102,7 +107,7 @@ FILE_TYPE_PS = 3 FILE_TYPE_SVG = 4 -class RadialNet(gtk.DrawingArea): +class RadialNet(Gtk.DrawingArea): """ Radial network visualization widget """ @@ -162,7 +167,7 @@ class RadialNet(gtk.DrawingArea): super(RadialNet, self).__init__() - self.connect('expose_event', self.expose) + self.connect('draw', self.draw) self.connect('button_press_event', self.button_press) self.connect('button_release_event', self.button_release) self.connect('motion_notify_event', self.motion_notify) @@ -172,19 +177,17 @@ class RadialNet(gtk.DrawingArea): self.connect('key_release_event', self.key_release) self.connect('scroll_event', self.scroll_event) - self.add_events(gtk.gdk.BUTTON_PRESS_MASK | - gtk.gdk.BUTTON_RELEASE_MASK | - gtk.gdk.ENTER_NOTIFY | - gtk.gdk.LEAVE_NOTIFY | - gtk.gdk.MOTION_NOTIFY | - gtk.gdk.NOTHING | - gtk.gdk.KEY_PRESS_MASK | - gtk.gdk.KEY_RELEASE_MASK | - gtk.gdk.POINTER_MOTION_HINT_MASK | - gtk.gdk.POINTER_MOTION_MASK | - gtk.gdk.SCROLL_MASK) + self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | + Gdk.EventMask.BUTTON_RELEASE_MASK | + Gdk.EventMask.ENTER_NOTIFY_MASK | + Gdk.EventMask.LEAVE_NOTIFY_MASK | + Gdk.EventMask.KEY_PRESS_MASK | + Gdk.EventMask.KEY_RELEASE_MASK | + Gdk.EventMask.POINTER_MOTION_HINT_MASK | + Gdk.EventMask.POINTER_MOTION_MASK | + Gdk.EventMask.SCROLL_MASK) - self.set_flags(gtk.CAN_FOCUS) + self.set_can_focus(True) self.grab_focus() def graph_is_not_empty(function): @@ -536,10 +539,10 @@ class RadialNet(gtk.DrawingArea): def scroll_event(self, widget, event): """ """ - if event.direction == gtk.gdk.SCROLL_UP: + if event.direction == Gdk.ScrollDirection.UP: self.set_scale(self.__scale + 0.01) - if event.direction == gtk.gdk.SCROLL_DOWN: + if event.direction == Gdk.ScrollDirection.DOWN: self.set_scale(self.__scale - 0.01) self.queue_draw() @@ -549,7 +552,7 @@ class RadialNet(gtk.DrawingArea): def key_press(self, widget, event): """ """ - key = gtk.gdk.keyval_name(event.keyval) + key = Gdk.keyval_name(event.keyval) if key == 'KP_Add': self.set_ring_gap(self.__ring_gap + 1) @@ -571,7 +574,7 @@ class RadialNet(gtk.DrawingArea): def key_release(self, widget, event): """ """ - key = gtk.gdk.keyval_name(event.keyval) + key = Gdk.keyval_name(event.keyval) if key == 'c': self.__translation = (0, 0) @@ -710,7 +713,8 @@ class RadialNet(gtk.DrawingArea): if result is not None: - xw, yw = self.window.get_origin() + # first returned value is not meaningful and should be ignored + _, xw, yw = self.get_window().get_origin() node, point = result x, y = point @@ -792,19 +796,16 @@ class RadialNet(gtk.DrawingArea): return False - def expose(self, widget, event): + def draw(self, widget, context): """ Drawing callback @type widget: GtkWidget @param widget: Gtk widget superclass - @type event: GtkEvent - @param event: Gtk event of widget + @type context: cairo.Context + @param context: cairo context class @rtype: boolean @return: Indicator of the event propagation """ - context = widget.window.cairo_create() - - context.rectangle(*event.area) context.set_source_rgb(1.0, 1.0, 1.0) context.fill() @@ -820,8 +821,8 @@ class RadialNet(gtk.DrawingArea): # getting allocation reference allocation = self.get_allocation() - self.__center_of_widget = (allocation.width / 2, - allocation.height / 2) + self.__center_of_widget = (allocation.width // 2, + allocation.height // 2) xc, yc = self.__center_of_widget @@ -1453,9 +1454,9 @@ class RadialNet(gtk.DrawingArea): self.__calc_node_positions() # steps for slow-in/slow-out animation - steps = range(self.__number_of_frames) + steps = list(range(self.__number_of_frames)) - for i in range(len(steps) / 2): + for i in range(len(steps) // 2): steps[self.__number_of_frames - 1 - i] = steps[i] # normalize angles and calculate interpolated points @@ -1572,7 +1573,7 @@ class RadialNet(gtk.DrawingArea): # animation continue condition if index < self.__number_of_frames - 1: - gobject.timeout_add(self.__animation_rate, # time to recall + GLib.timeout_add(self.__animation_rate, # time to recall self.__livens_up, # recursive call index + 1) # next iteration else: diff --git a/zenmap/radialnet/gui/SaveDialog.py b/zenmap/radialnet/gui/SaveDialog.py index 18369c127..e1e278330 100644 --- a/zenmap/radialnet/gui/SaveDialog.py +++ b/zenmap/radialnet/gui/SaveDialog.py @@ -57,7 +57,11 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + import os.path import radialnet.gui.RadialNet as RadialNet import zenmapGUI.FileChoosers @@ -84,16 +88,16 @@ class SaveDialog(zenmapGUI.FileChoosers.UnicodeFileChooserDialog): """ """ super(SaveDialog, self).__init__(title=_("Save Topology"), - action=gtk.FILE_CHOOSER_ACTION_SAVE, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_SAVE, gtk.RESPONSE_OK)) + action=Gtk.FileChooserAction.SAVE, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_SAVE, Gtk.ResponseType.OK)) - types_store = gtk.ListStore(str, object, str) + types_store = Gtk.ListStore.new([str, object, str]) for type in TYPES: types_store.append(type) - self.__combo = gtk.ComboBox(types_store) - cell = gtk.CellRendererText() + self.__combo = Gtk.ComboBox.new_with_model(types_store) + cell = Gtk.CellRendererText() self.__combo.pack_start(cell, True) self.__combo.add_attribute(cell, "text", 0) @@ -103,9 +107,9 @@ class SaveDialog(zenmapGUI.FileChoosers.UnicodeFileChooserDialog): self.connect("response", self.__response_cb) hbox = HIGHBox() - label = gtk.Label(_("Select File Type:")) - hbox.pack_end(self.__combo, False) - hbox.pack_end(label, False) + label = Gtk.Label.new(_("Select File Type:")) + hbox.pack_end(self.__combo, False, True, 0) + hbox.pack_end(label, False, True, 0) self.set_extra_widget(hbox) self.set_do_overwrite_confirmation(True) @@ -131,7 +135,7 @@ class SaveDialog(zenmapGUI.FileChoosers.UnicodeFileChooserDialog): def __response_cb(self, widget, response_id): """Intercept the "response" signal to check if someone used the "By extension" file type with an unknown extension.""" - if response_id == gtk.RESPONSE_OK and self.get_filetype() is None: + if response_id == Gtk.ResponseType.OK and self.get_filetype() is None: ext = self.__get_extension() if ext == "": filename = self.get_filename() or "" diff --git a/zenmap/radialnet/gui/Toolbar.py b/zenmap/radialnet/gui/Toolbar.py index 460315669..cb5a81eab 100644 --- a/zenmap/radialnet/gui/Toolbar.py +++ b/zenmap/radialnet/gui/Toolbar.py @@ -57,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from radialnet.bestwidgets.buttons import BWStockButton, BWToggleStockButton from radialnet.gui.SaveDialog import SaveDialog @@ -73,13 +76,13 @@ HIDE = False REFRESH_RATE = 500 -class ToolsMenu(gtk.Menu): +class ToolsMenu(Gtk.Menu): """ """ def __init__(self, radialnet): """ """ - gtk.Menu.__init__(self) + Gtk.Menu.__init__(self) self.radialnet = radialnet @@ -88,10 +91,10 @@ class ToolsMenu(gtk.Menu): def __create_items(self): """ """ - self.__hosts = gtk.ImageMenuItem(_('Hosts viewer')) + self.__hosts = Gtk.ImageMenuItem.new_with_label(_('Hosts viewer')) self.__hosts.connect("activate", self.__hosts_viewer_callback) - self.__hosts_image = gtk.Image() - self.__hosts_image.set_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_MENU) + self.__hosts_image = Gtk.Image() + self.__hosts_image.set_from_stock(Gtk.STOCK_INDEX, Gtk.IconSize.MENU) self.__hosts.set_image(self.__hosts_image) self.append(self.__hosts) @@ -116,13 +119,13 @@ class ToolsMenu(gtk.Menu): self.__hosts.set_sensitive(False) -class Toolbar(gtk.HBox): +class Toolbar(Gtk.Box): """ """ def __init__(self, radialnet, window, control, fisheye): """ """ - gtk.HBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) #self.set_style(gtk.TOOLBAR_BOTH_HORIZ) #self.set_tooltips(True) @@ -157,22 +160,22 @@ class Toolbar(gtk.HBox): #self.__tools_button.set_menu(self.__tools_menu) #self.__tools_button.connect('clicked', self.__tools_callback) - self.__save_button = BWStockButton(gtk.STOCK_SAVE, _("Save Graphic")) + self.__save_button = BWStockButton(Gtk.STOCK_SAVE, _("Save Graphic")) self.__save_button.connect("clicked", self.__save_image_callback) - self.__hosts_button = BWStockButton(gtk.STOCK_INDEX, _("Hosts Viewer")) + self.__hosts_button = BWStockButton(Gtk.STOCK_INDEX, _("Hosts Viewer")) self.__hosts_button.connect("clicked", self.__hosts_viewer_callback) self.__control = BWToggleStockButton( - gtk.STOCK_PROPERTIES, _("Controls")) + Gtk.STOCK_PROPERTIES, _("Controls")) self.__control.connect('clicked', self.__control_callback) self.__control.set_active(False) - self.__fisheye = BWToggleStockButton(gtk.STOCK_ZOOM_FIT, _("Fisheye")) + self.__fisheye = BWToggleStockButton(Gtk.STOCK_ZOOM_FIT, _("Fisheye")) self.__fisheye.connect('clicked', self.__fisheye_callback) self.__fisheye.set_active(False) - self.__legend_button = BWStockButton(gtk.STOCK_INDEX, _("Legend")) + self.__legend_button = BWStockButton(Gtk.STOCK_INDEX, _("Legend")) self.__legend_button.connect('clicked', self.__legend_callback) #self.__fullscreen = gtk.ToggleToolButton(gtk.STOCK_FULLSCREEN) @@ -187,8 +190,8 @@ class Toolbar(gtk.HBox): #self.__about.connect('clicked', self.__about_callback) #self.__about.set_tooltip(self.__tooltips, _('About RadialNet')) - self.__separator = gtk.SeparatorToolItem() - self.__expander = gtk.SeparatorToolItem() + self.__separator = Gtk.SeparatorToolItem() + self.__expander = Gtk.SeparatorToolItem() self.__expander.set_expand(True) self.__expander.set_draw(False) @@ -202,11 +205,11 @@ class Toolbar(gtk.HBox): #self.insert(self.__about, 7) #self.pack_start(self.__tools_button, False) - self.pack_start(self.__hosts_button, False) - self.pack_start(self.__fisheye, False) - self.pack_start(self.__control, False) - self.pack_end(self.__save_button, False) - self.pack_end(self.__legend_button, False) + self.pack_start(self.__hosts_button, False, True, 0) + self.pack_start(self.__fisheye, False, True, 0) + self.pack_start(self.__control, False, True, 0) + self.pack_end(self.__save_button, False, True, 0) + self.pack_end(self.__legend_button, False, True, 0) def disable_controls(self): """ @@ -246,17 +249,17 @@ class Toolbar(gtk.HBox): response = self.__save_chooser.run() - if response == gtk.RESPONSE_OK: + if response == Gtk.ResponseType.OK: filename = self.__save_chooser.get_filename() filetype = self.__save_chooser.get_filetype() try: self.radialnet.save_drawing_to_file(filename, filetype) - except Exception, e: + except Exception as e: alert = HIGAlertDialog(parent=self.__save_chooser, - type=gtk.MESSAGE_ERROR, + type=Gtk.MessageType.ERROR, message_format=_("Error saving snapshot"), - secondary_text=unicode(e)) + secondary_text=str(e)) alert.run() alert.destroy() diff --git a/zenmap/radialnet/radialnet.pyw b/zenmap/radialnet/radialnet.pyw index 7ee312e7c..232e79f36 100755 --- a/zenmap/radialnet/radialnet.pyw +++ b/zenmap/radialnet/radialnet.pyw @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # vim: set fileencoding=utf-8 : # ***********************IMPORTANT NMAP LICENSE TERMS************************ diff --git a/zenmap/radialnet/util/drawing.py b/zenmap/radialnet/util/drawing.py index 616477c47..8f1c546f6 100644 --- a/zenmap/radialnet/util/drawing.py +++ b/zenmap/radialnet/util/drawing.py @@ -61,7 +61,7 @@ def cairo_to_gdk_color(color): """ """ - new_color = range(len(color)) + new_color = list(range(len(color))) for i in range(len(color)): new_color[i] = int(color[i] * 65535) diff --git a/zenmap/setup.py b/zenmap/setup.py index 7609f998c..c15412b3c 100755 --- a/zenmap/setup.py +++ b/zenmap/setup.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -59,8 +58,8 @@ # ***************************************************************************/ import sys -if sys.version_info[0] != 2: - sys.exit("Sorry, Zenmap requires Python 2") +if sys.version_info[0] != 3: + sys.exit("Sorry, Zenmap requires Python 3") import errno import os @@ -127,7 +126,7 @@ data_files = [ ] # Add i18n files to data_files list -os.path.walk(locale_dir, mo_find, data_files) +os.walk(locale_dir, mo_find, data_files) # path_startswith and path_strip_prefix are used to deal with the installation @@ -213,7 +212,7 @@ class my_install(install): self.install_scripts, "uninstall_" + APP_NAME) uninstaller = """\ -#!/usr/bin/env python +#!/usr/bin/env python3 import errno, os, os.path, sys print 'Uninstall %(name)s %(version)s' @@ -266,7 +265,7 @@ for file in files: print "Removing '%s'." % file try: os.remove(file) - except OSError, e: + except OSError as e: print >> sys.stderr, ' Error: %s.' % str(e) # Delete the directories. First reverse-sort the normalized paths by # length so that child directories are deleted before their parents. @@ -276,7 +275,7 @@ for dir in dirs: try: print "Removing the directory '%s'." % dir os.rmdir(dir) - except OSError, e: + except OSError as e: if e.errno == errno.ENOTEMPTY: print "Directory '%s' not empty; not removing." % dir else: @@ -288,7 +287,7 @@ for dir in dirs: uninstaller_file.close() # Set exec bit for uninstaller - mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0555) & 07777 + mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0o555) & 0o7777 os.chmod(uninstaller_filename, mode) def set_modules_path(self): @@ -442,7 +441,7 @@ class my_uninstall(Command): # Read the list of installed files. try: f = open(INSTALLED_FILES_NAME, "r") - except IOError, e: + except IOError as e: if e.errno == errno.ENOENT: log.error("Couldn't open the installation record '%s'. " "Have you installed yet?" % INSTALLED_FILES_NAME) @@ -465,7 +464,7 @@ class my_uninstall(Command): try: if not self.dry_run: os.remove(file) - except OSError, e: + except OSError as e: log.error(str(e)) # Delete the directories. First reverse-sort the normalized paths by # length so that child directories are deleted before their parents. @@ -476,7 +475,7 @@ class my_uninstall(Command): log.info("Removing the directory '%s'." % dir) if not self.dry_run: os.rmdir(dir) - except OSError, e: + except OSError as e: if e.errno == errno.ENOTEMPTY: log.info("Directory '%s' not empty; not removing." % dir) else: diff --git a/zenmap/share/zenmap/locale/xgettext-profile_editor.py b/zenmap/share/zenmap/locale/xgettext-profile_editor.py index 3c498e69a..c18c636e8 100755 --- a/zenmap/share/zenmap/locale/xgettext-profile_editor.py +++ b/zenmap/share/zenmap/locale/xgettext-profile_editor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This program acts like xgettext, specialized to extract strings from Zenmap's # profile_editor.xml file. @@ -21,10 +21,10 @@ def escape(s): def output_msgid(msgid, locator): - print - print u"#: %s:%d" % (locator.getSystemId(), locator.getLineNumber()) - print u"msgid", escape(msgid) - print u"msgstr", escape(u"") + print() + print("#: %s:%d" % (locator.getSystemId(), locator.getLineNumber())) + print("msgid", escape(msgid)) + print("msgstr", escape("")) class Handler (xml.sax.handler.ContentHandler): @@ -32,12 +32,12 @@ class Handler (xml.sax.handler.ContentHandler): self.locator = locator def startElement(self, name, attrs): - if name == u"group": - output_msgid(attrs[u"name"], self.locator) - if attrs.get(u"short_desc"): - output_msgid(attrs[u"short_desc"], self.locator) - if attrs.get(u"label"): - output_msgid(attrs[u"label"], self.locator) + if name == "group": + output_msgid(attrs["name"], self.locator) + if attrs.get("short_desc"): + output_msgid(attrs["short_desc"], self.locator) + if attrs.get("label"): + output_msgid(attrs["label"], self.locator) opts, filenames = getopt.gnu_getopt(sys.argv[1:], "D:", ["directory="]) for o, a in opts: diff --git a/zenmap/test/run_tests.py b/zenmap/test/run_tests.py index 1802939c8..214df6dd3 100644 --- a/zenmap/test/run_tests.py +++ b/zenmap/test/run_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import unittest diff --git a/zenmap/zenmap b/zenmap/zenmap index b427aca51..2bd4ef0ca 100755 --- a/zenmap/zenmap +++ b/zenmap/zenmap @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -111,15 +110,15 @@ if INSTALL_LIB is not None and is_secure_dir(INSTALL_LIB): try: import zenmapGUI.App -except ImportError, e: - print >> sys.stderr, """\ +except ImportError as e: + print("""\ Could not import the zenmapGUI.App module: %s. -I checked in these directories:""" % repr(e.message) +I checked in these directories:""" % repr(e.message), file=sys.stderr) for dir in sys.path: - print >> sys.stderr, " %s" % dir - print >> sys.stderr, """\ + print(" %s" % dir, file=sys.stderr) + print("""\ If you installed Zenmap in another directory, you may have to add the -modules directory to the PYTHONPATH environment variable.""" +modules directory to the PYTHONPATH environment variable.""", file=sys.stderr) sys.exit(1) if __name__ == '__main__': diff --git a/zenmap/zenmapCore/BasePaths.py b/zenmap/zenmapCore/BasePaths.py index 19e9a56d1..d72e395cf 100644 --- a/zenmap/zenmapCore/BasePaths.py +++ b/zenmap/zenmapCore/BasePaths.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -65,7 +64,7 @@ import sys from zenmapCore.Name import APP_NAME -def fs_dec(s): +def fs_dec(s): # This is unused now """Decode s from the filesystem decoding, handling various possible errors.""" enc = sys.getfilesystemencoding() @@ -88,7 +87,7 @@ def fs_enc(u): # systems like Windows where the file system encoding is different from the # result of sys.getdefaultencoding(). So we call os.path.expanduser with a # plain string and decode it from the filesystem encoding. -HOME = fs_dec(os.path.expanduser("~")) +HOME = os.path.expanduser("~") # The base_paths dict in this file gives symbolic names to various files. For # example, use base_paths.target_list instead of 'target_list.txt'. diff --git a/zenmap/zenmapCore/DelayedObject.py b/zenmap/zenmapCore/DelayedObject.py index 6c4c869df..419809a7f 100644 --- a/zenmap/zenmapCore/DelayedObject.py +++ b/zenmap/zenmapCore/DelayedObject.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapCore/Diff.py b/zenmap/zenmapCore/Diff.py index 98d1ba96a..f37e96564 100644 --- a/zenmap/zenmapCore/Diff.py +++ b/zenmap/zenmapCore/Diff.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapCore/I18N.py b/zenmap/zenmapCore/I18N.py index 68614577b..e45e14125 100644 --- a/zenmap/zenmapCore/I18N.py +++ b/zenmap/zenmapCore/I18N.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -103,10 +102,10 @@ def install_gettext(locale_dir): else: t = gettext.translation( APP_NAME, locale_dir, languages=get_locales(), fallback=True) - t.install(unicode=True) + t.install() # Install a dummy _ function so modules can safely use it after importing this # module, even if they don't install the gettext version. -import __builtin__ -__builtin__.__dict__["_"] = lambda s: s +import builtins +builtins.__dict__["_"] = lambda s: s diff --git a/zenmap/zenmapCore/NSEDocParser.py b/zenmap/zenmapCore/NSEDocParser.py index 38e476170..c7b79d6f9 100644 --- a/zenmap/zenmapCore/NSEDocParser.py +++ b/zenmap/zenmapCore/NSEDocParser.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapCore/Name.py b/zenmap/zenmapCore/Name.py index c2c3c3bd4..b1bd815d4 100644 --- a/zenmap/zenmapCore/Name.py +++ b/zenmap/zenmapCore/Name.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -69,7 +68,7 @@ APP_DOWNLOAD_SITE = "https://nmap.org/download.html" APP_DOCUMENTATION_SITE = "https://nmap.org/book/zenmap.html" APP_COPYRIGHT = "Copyright 2005-2022 Nmap Software LLC" -NMAP_DISPLAY_NAME = u"Nmap" +NMAP_DISPLAY_NAME = "Nmap" NMAP_WEB_SITE = "https://nmap.org" UMIT_DISPLAY_NAME = "Umit" diff --git a/zenmap/zenmapCore/NetworkInventory.py b/zenmap/zenmapCore/NetworkInventory.py index 2d86d31e3..fc232ce3a 100644 --- a/zenmap/zenmapCore/NetworkInventory.py +++ b/zenmap/zenmapCore/NetworkInventory.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -63,7 +62,7 @@ import unittest import zenmapCore import zenmapCore.NmapParser from zenmapGUI.SearchGUI import SearchParser -from SearchResult import HostSearch +from .SearchResult import HostSearch class NetworkInventory(object): @@ -255,13 +254,13 @@ class NetworkInventory(object): return self.scans def get_hosts(self): - return self.hosts.values() + return list(self.hosts.values()) def get_hosts_up(self): - return filter(lambda h: h.get_state() == 'up', self.hosts.values()) + return [h for h in list(self.hosts.values()) if h.get_state() == 'up'] def get_hosts_down(self): - return filter(lambda h: h.get_state() == 'down', self.hosts.values()) + return [h for h in list(self.hosts.values()) if h.get_state() == 'down'] def open_from_file(self, path): """Loads a scan from the given file.""" @@ -353,7 +352,7 @@ class NetworkInventory(object): a list of (full-path) filenames that were used to save the scans.""" self._generate_filenames(path) - for scan, filename in self.filenames.iteritems(): + for scan, filename in self.filenames.items(): f = open(os.path.join(path, filename), "w") scan.write_xml(f) f.close() @@ -367,7 +366,7 @@ class NetworkInventory(object): # For now, this saves each scan making up the inventory separately in # the database. from time import time - from cStringIO import StringIO + from io import StringIO from zenmapCore.UmitDB import Scans for parsed in self.get_scans(): @@ -424,15 +423,13 @@ class FilteredNetworkInventory(NetworkInventory): def get_hosts_up(self): if len(self.search_dict) > 0: - return filter(lambda h: h.get_state() == 'up', - self.filtered_hosts) + return [h for h in self.filtered_hosts if h.get_state() == 'up'] else: return NetworkInventory.get_hosts_up(self) def get_hosts_down(self): if len(self.search_dict) > 0: - return filter(lambda h: h.get_state() == 'down', - self.filtered_hosts) + return [h for h in self.filtered_hosts if h.get_state() == 'down'] else: return NetworkInventory.get_hosts_down(self) @@ -508,10 +505,10 @@ class FilteredNetworkInventory(NetworkInventory): self.filter_text = filter_text.lower() self.search_parser.update(self.filter_text) self.filtered_hosts = [] - for hostname, host in self.hosts.iteritems(): + for hostname, host in self.hosts.items(): # For each host in this scan # Test each given operator against the current host - for operator, args in self.search_dict.iteritems(): + for operator, args in self.search_dict.items(): if not self._match_all_args(host, operator, args): # No match => we discard this scan_result break @@ -582,7 +579,7 @@ class NetworkInventoryTest(unittest.TestCase): inv.remove_scan(scan_3) except Exception: pass - self.assertEqual(added_ips, inv.hosts.keys()) + self.assertEqual(added_ips, list(inv.hosts.keys())) self.assertEqual(host_a.hostnames, ["a"]) self.assertEqual(host_b.hostnames, ["b"]) @@ -646,7 +643,7 @@ if __name__ == "__main__": inventory1.add_scan(scan2) for host in inventory1.get_hosts(): - print "%s" % host.ip["addr"], + print("%s" % host.ip["addr"], end=' ') #if len(host.hostnames) > 0: # print "[%s]:" % host.hostnames[0]["hostname"] #else: @@ -662,12 +659,12 @@ if __name__ == "__main__": inventory1.remove_scan(scan2) print for host in inventory1.get_hosts(): - print "%s" % host.ip["addr"], + print("%s" % host.ip["addr"], end=' ') inventory1.add_scan(scan2) print for host in inventory1.get_hosts(): - print "%s" % host.ip["addr"], + print("%s" % host.ip["addr"], end=' ') dir = "/home/ndwi/scanz/top01" inventory1.save_to_dir(dir) @@ -675,6 +672,6 @@ if __name__ == "__main__": inventory2 = NetworkInventory() inventory2.open_from_dir(dir) - print + print() for host in inventory2.get_hosts(): - print "%s" % host.ip["addr"], + print("%s" % host.ip["addr"], end=' ') diff --git a/zenmap/zenmapCore/NmapCommand.py b/zenmap/zenmapCore/NmapCommand.py index 2fb7430c7..e6768dc83 100644 --- a/zenmap/zenmapCore/NmapCommand.py +++ b/zenmap/zenmapCore/NmapCommand.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -73,7 +72,7 @@ import zenmapCore.I18N # lgtm[py/unused-import] try: import subprocess -except ImportError, e: +except ImportError as e: raise ImportError(str(e) + ".\n" + _("Python 2.4 or later is required.")) import zenmapCore.Paths @@ -183,7 +182,7 @@ class NmapCommand(object): if self.xml_is_temp: try: os.remove(self.xml_output_filename) - except OSError, e: + except OSError as e: if e.errno != errno.ENOENT: raise diff --git a/zenmap/zenmapCore/NmapOptions.py b/zenmap/zenmapCore/NmapOptions.py index 895cdebbe..296c7b05c 100644 --- a/zenmap/zenmapCore/NmapOptions.py +++ b/zenmap/zenmapCore/NmapOptions.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This is an Nmap command line parser. It has two main parts: # @@ -539,7 +539,7 @@ class NmapOptions(object): return self.d.setdefault(self.canonicalize_name(key), default) def handle_result(self, result): - if isinstance(result, basestring): + if isinstance(result, str): # A positional argument. self.target_specs.append(result) return @@ -640,7 +640,7 @@ class NmapOptions(object): self["-d"] = int(arg) except ValueError: if reduce(lambda x, y: x and y, - map(lambda z: z == "d", arg), True): + [z == "d" for z in arg], True): self.setdefault("-d", 0) self["-d"] += len(arg) + 1 else: @@ -720,7 +720,7 @@ class NmapOptions(object): self["-v"] = -1 except ValueError: if reduce(lambda x, y: x and y, - map(lambda z: z == "v", arg), True): + [z == "v" for z in arg], True): self.setdefault("-v", 0) self["-v"] += len(arg) + 1 else: @@ -763,7 +763,7 @@ class NmapOptions(object): opt_list.append("-T%s" % str(self["-T"])) if self["-O"] is not None: - if isinstance(self["-O"], basestring): + if isinstance(self["-O"], str): opt_list.append("-O%s" % self["-O"]) elif self["-O"]: opt_list.append("-O") @@ -815,7 +815,7 @@ class NmapOptions(object): if self[ping_option] is not None: opt_list.append(ping_option + self[ping_option]) if self["-PB"] is not None: - if isinstance(self["-PB"], basestring): + if isinstance(self["-PB"], str): opt_list.append("-PB" + self["-PB"]) elif self["-PB"]: opt_list.append("-PB") diff --git a/zenmap/zenmapCore/NmapParser.py b/zenmap/zenmapCore/NmapParser.py index f4a9dd7b4..3968cd112 100644 --- a/zenmap/zenmapCore/NmapParser.py +++ b/zenmap/zenmapCore/NmapParser.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -63,11 +62,7 @@ import time import socket import copy -# Use the faster cStringIO if available, fallback on StringIO if not -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO +from io import StringIO # Prevent loading PyXML import xml @@ -558,12 +553,7 @@ in epoch format!") return ports def get_formatted_date(self): - try: - return time.strftime("%B %d, %Y - %H:%M", self.get_date()).decode( - locale.getpreferredencoding()) - except LookupError: - # encoding or locale not found - return time.asctime(self.get_date()).decode('ascii') + return time.strftime("%B %d, %Y - %H:%M", self.get_date()) def get_scanner(self): return self.nmap['nmaprun'].get('scanner', '') @@ -1333,25 +1323,25 @@ if __name__ == '__main__': np.parse_file(file_to_parse) for host in np.hosts: - print "%s:" % host.ip["addr"] - print " Comment:", repr(host.comment) - print " TCP sequence:", repr(host.tcpsequence) - print " TCP TS sequence:", repr(host.tcptssequence) - print " IP ID sequence:", repr(host.ipidsequence) - print " Uptime:", repr(host.uptime) - print " OS Match:", repr(host.osmatches) - print " Ports:" + print("%s:" % host.ip["addr"]) + print(" Comment:", repr(host.comment)) + print(" TCP sequence:", repr(host.tcpsequence)) + print(" TCP TS sequence:", repr(host.tcptssequence)) + print(" IP ID sequence:", repr(host.ipidsequence)) + print(" Uptime:", repr(host.uptime)) + print(" OS Match:", repr(host.osmatches)) + print(" Ports:") for p in host.ports: - print "\t%s" % repr(p) - print " Ports used:", repr(host.ports_used) - print " OS Matches:", repr(host.osmatches) - print " Hostnames:", repr(host.hostnames) - print " IP:", repr(host.ip) - print " IPv6:", repr(host.ipv6) - print " MAC:", repr(host.mac) - print " State:", repr(host.state) + print("\t%s" % repr(p)) + print(" Ports used:", repr(host.ports_used)) + print(" OS Matches:", repr(host.osmatches)) + print(" Hostnames:", repr(host.hostnames)) + print(" IP:", repr(host.ip)) + print(" IPv6:", repr(host.ipv6)) + print(" MAC:", repr(host.mac)) + print(" State:", repr(host.state)) if "hops" in host.trace: - print " Trace:" + print(" Trace:") for hop in host.trace["hops"]: - print " ", repr(hop) - print + print(" ", repr(hop)) + print() diff --git a/zenmap/zenmapCore/Paths.py b/zenmap/zenmapCore/Paths.py index b4eabf966..682fb2f47 100644 --- a/zenmap/zenmapCore/Paths.py +++ b/zenmap/zenmapCore/Paths.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,7 +65,7 @@ import os.path import sys import shutil -from zenmapCore.BasePaths import base_paths, fs_dec +from zenmapCore.BasePaths import base_paths from zenmapCore.Name import APP_NAME @@ -79,14 +78,14 @@ def get_prefix(): frozen = getattr(sys, "frozen", None) if frozen == "macosx_app" or "Zenmap.app" in sys.executable: # A py2app .app bundle. - return os.path.join(dirname(fs_dec(sys.executable)), "..", "Resources") + return os.path.join(dirname(sys.executable), "..", "Resources") elif frozen is not None: # Assume a py2exe executable. - return dirname(fs_dec(sys.executable)) + return dirname(sys.executable) else: # Normal script execution. Look in the current directory to allow # running from the distribution. - return os.path.abspath(os.path.dirname(fs_dec(sys.argv[0]))) + return os.path.abspath(os.path.dirname(sys.argv[0])) prefix = get_prefix() @@ -182,7 +181,7 @@ def create_dir(path): directory already exists.""" try: os.makedirs(path) - except OSError, e: + except OSError as e: if e.errno != errno.EEXIST: raise @@ -224,19 +223,19 @@ def return_if_exists(path, create=False): Path = Paths() if __name__ == '__main__': - print ">>> SAVED DIRECTORIES:" - print ">>> LOCALE DIR:", Path.locale_dir - print ">>> PIXMAPS DIR:", Path.pixmaps_dir - print ">>> CONFIG DIR:", Path.config_dir - print - print ">>> FILES:" - print ">>> USER CONFIG FILE:", Path.user_config_file - print ">>> CONFIG FILE:", Path.user_config_file - print ">>> TARGET_LIST:", Path.target_list - print ">>> PROFILE_EDITOR:", Path.profile_editor - print ">>> SCAN_PROFILE:", Path.scan_profile - print ">>> RECENT_SCANS:", Path.recent_scans - print ">>> OPTIONS:", Path.options - print - print ">>> DB:", Path.db - print ">>> VERSION:", Path.version + print(">>> SAVED DIRECTORIES:") + print(">>> LOCALE DIR:", Path.locale_dir) + print(">>> PIXMAPS DIR:", Path.pixmaps_dir) + print(">>> CONFIG DIR:", Path.config_dir) + print() + print(">>> FILES:") + print(">>> USER CONFIG FILE:", Path.user_config_file) + print(">>> CONFIG FILE:", Path.user_config_file) + print(">>> TARGET_LIST:", Path.target_list) + print(">>> PROFILE_EDITOR:", Path.profile_editor) + print(">>> SCAN_PROFILE:", Path.scan_profile) + print(">>> RECENT_SCANS:", Path.recent_scans) + print(">>> OPTIONS:", Path.options) + print() + print(">>> DB:", Path.db) + print(">>> VERSION:", Path.version) diff --git a/zenmap/zenmapCore/RecentScans.py b/zenmap/zenmapCore/RecentScans.py index 9bac8519b..d6c981dae 100644 --- a/zenmap/zenmapCore/RecentScans.py +++ b/zenmap/zenmapCore/RecentScans.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -113,7 +112,7 @@ recent_scans = RecentScans() if __name__ == "__main__": r = RecentScans() - print ">>> Getting empty list:", r.get_recent_scans_list() - print ">>> Adding recent scan bla:", r.add_recent_scan("bla") - print ">>> Getting recent scan list:", r.get_recent_scans_list() + print(">>> Getting empty list:", r.get_recent_scans_list()) + print(">>> Adding recent scan bla:", r.add_recent_scan("bla")) + print(">>> Getting recent scan list:", r.get_recent_scans_list()) del r diff --git a/zenmap/zenmapCore/ScriptArgsParser.py b/zenmap/zenmapCore/ScriptArgsParser.py index bed411b2f..cc3cdfb61 100644 --- a/zenmap/zenmapCore/ScriptArgsParser.py +++ b/zenmap/zenmapCore/ScriptArgsParser.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -188,21 +188,21 @@ if __name__ == '__main__': for test, expected in TESTS: args_dict = parse_script_args_dict(test) - print args_dict + print(args_dict) args = parse_script_args(test) if args == expected: - print "PASS", test + print("PASS", test) continue - print "FAIL", test + print("FAIL", test) if args is None: - print "Parsing error" + print("Parsing error") else: - print "%d args" % len(args) + print("%d args" % len(args)) for a, v in args: - print a, "=", v + print(a, "=", v) if expected is None: - print "Expected parsing error" + print("Expected parsing error") else: - print "Expected %d args" % len(expected) + print("Expected %d args" % len(expected)) for a, v in expected: - print a, "=", v + print(a, "=", v) diff --git a/zenmap/zenmapCore/ScriptMetadata.py b/zenmap/zenmapCore/ScriptMetadata.py index 55feeba5b..d3f956a0d 100644 --- a/zenmap/zenmapCore/ScriptMetadata.py +++ b/zenmap/zenmapCore/ScriptMetadata.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -438,16 +438,16 @@ def get_script_entries(scripts_dir, nselib_dir): if __name__ == '__main__': import sys for entry in get_script_entries(sys.argv[1], sys.argv[2]): - print "*" * 75 - print "Filename:", entry.filename - print "Categories:", entry.categories - print "License:", entry.license - print "Author:", entry.author - print "URL:", entry.url - print "Description:", entry.description - print "Arguments:", [x[0] for x in entry.arguments] - print "Output:" - print entry.output - print "Usage:" - print entry.usage - print "*" * 75 + print("*" * 75) + print("Filename:", entry.filename) + print("Categories:", entry.categories) + print("License:", entry.license) + print("Author:", entry.author) + print("URL:", entry.url) + print("Description:", entry.description) + print("Arguments:", [x[0] for x in entry.arguments]) + print("Output:") + print(entry.output) + print("Usage:") + print(entry.usage) + print("*" * 75) diff --git a/zenmap/zenmapCore/SearchResult.py b/zenmap/zenmapCore/SearchResult.py index d2cbe88d3..86dd70dde 100644 --- a/zenmap/zenmapCore/SearchResult.py +++ b/zenmap/zenmapCore/SearchResult.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -61,11 +60,10 @@ import os import os.path import re -import StringIO +import io import unittest from glob import glob -from types import StringTypes from zenmapCore.Name import APP_NAME from zenmapCore.NmapOptions import NmapOptions @@ -170,7 +168,7 @@ class SearchResult(object): self.parsed_scan = scan_result # Test each given operator against the current parsed result - for operator, args in kargs.iteritems(): + for operator, args in kargs.items(): if not self._match_all_args(operator, args): # No match => we discard this scan_result break @@ -319,7 +317,7 @@ class SearchResult(object): return True # Transform a comma-delimited string containing ports into a list - ports = filter(lambda not_empty: not_empty, ports.split(",")) + ports = [not_empty for not_empty in ports.split(",") if not_empty] # Check if they're parsable, if not return False silently for port in ports: @@ -356,7 +354,7 @@ class SearchResult(object): log.debug("Match port:%s" % ports) # Transform a comma-delimited string containing ports into a list - ports = filter(lambda not_empty: not_empty, ports.split(",")) + ports = [not_empty for not_empty in ports.split(",") if not_empty] for host in self.parsed_scan.get_hosts(): for port in ports: @@ -442,11 +440,11 @@ class SearchDB(SearchResult, object): log.debug(">>> Nmap xml output: %s" % scan.nmap_xml_output) try: - buffer = StringIO.StringIO(scan.nmap_xml_output) + buffer = io.StringIO(scan.nmap_xml_output) parsed = NmapParser() parsed.parse(buffer) buffer.close() - except Exception, e: + except Exception as e: log.warning(">>> Error loading scan with ID %u from database: " "%s" % (scan.scans_id, str(e))) else: @@ -462,7 +460,7 @@ class SearchDir(SearchResult, object): log.debug(">>> SearchDir initialized") self.search_directory = search_directory - if isinstance(file_extensions, StringTypes): + if isinstance(file_extensions, str): self.file_extensions = file_extensions.split(";") elif isinstance(file_extensions, list): self.file_extensions = file_extensions diff --git a/zenmap/zenmapCore/StringPool.py b/zenmap/zenmapCore/StringPool.py index 02141bb56..691c8e5e0 100644 --- a/zenmap/zenmapCore/StringPool.py +++ b/zenmap/zenmapCore/StringPool.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapCore/TargetList.py b/zenmap/zenmapCore/TargetList.py index 00cb300f0..6fe17e984 100644 --- a/zenmap/zenmapCore/TargetList.py +++ b/zenmap/zenmapCore/TargetList.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -114,7 +113,7 @@ target_list = TargetList() if __name__ == "__main__": t = TargetList() - print ">>> Getting empty list:", t.get_target_list() - print ">>> Adding target 127.0.0.1:", t.add_target("127.0.0.3") - print ">>> Getting target list:", t.get_target_list() + print(">>> Getting empty list:", t.get_target_list()) + print(">>> Adding target 127.0.0.1:", t.add_target("127.0.0.3")) + print(">>> Getting target list:", t.get_target_list()) del t diff --git a/zenmap/zenmapCore/UmitConf.py b/zenmap/zenmapCore/UmitConf.py index 206539ea3..a94272c44 100644 --- a/zenmap/zenmapCore/UmitConf.py +++ b/zenmap/zenmapCore/UmitConf.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -60,9 +59,8 @@ import re -from types import StringTypes -from ConfigParser import DuplicateSectionError, NoSectionError, NoOptionError -from ConfigParser import Error as ConfigParser_Error +from configparser import DuplicateSectionError, NoSectionError, NoOptionError +from configparser import Error as ConfigParser_Error from zenmapCore.Paths import Path from zenmapCore.UmitLogging import log @@ -107,7 +105,7 @@ class SearchConfig(UmitConfigParser, object): self.search_db = True def _get_it(self, p_name, default): - return config_parser.get(self.section_name, p_name, default) + return config_parser.get(self.section_name, p_name, fallback=default) def _set_it(self, p_name, value): config_parser.set(self.section_name, p_name, value) @@ -117,10 +115,8 @@ class SearchConfig(UmitConfigParser, object): attr == "True" or \ attr == "true" or \ attr == "1": - - return 1 - - return 0 + return "True" + return "False" def get_directory(self): return self._get_it("directory", "") @@ -134,7 +130,7 @@ class SearchConfig(UmitConfigParser, object): def set_file_extension(self, file_extension): if isinstance(file_extension, list): self._set_it("file_extension", ";".join(file_extension)) - elif isinstance(file_extension, StringTypes): + elif isinstance(file_extension, str): self._set_it("file_extension", file_extension) def get_save_time(self): @@ -143,7 +139,7 @@ class SearchConfig(UmitConfigParser, object): def set_save_time(self, save_time): if isinstance(save_time, list): self._set_it("save_time", ";".join(save_time)) - elif isinstance(save_time, StringTypes): + elif isinstance(save_time, str): self._set_it("save_time", save_time) def get_store_results(self): @@ -272,7 +268,7 @@ class WindowConfig(UmitConfigParser, object): self.height = self.default_height def _get_it(self, p_name, default): - return config_parser.get(self.section_name, p_name, default) + return config_parser.get(self.section_name, p_name, fallback=default) def _set_it(self, p_name, value): config_parser.set(self.section_name, p_name, value) @@ -401,7 +397,7 @@ class NmapOutputHighlight(object): try: return self.sanity_settings([ config_parser.get( - property_name, prop, True) for prop in self.setts]) + property_name, prop, raw=True) for prop in self.setts]) except Exception: settings = [] prop_settings = self.default_highlights[p_name] @@ -420,7 +416,7 @@ class NmapOutputHighlight(object): property_name = "%s_highlight" % property_name settings = self.sanity_settings(list(settings)) - for pos in xrange(len(settings)): + for pos in range(len(settings)): config_parser.set(property_name, self.setts[pos], settings[pos]) def sanity_settings(self, settings): @@ -437,13 +433,13 @@ class NmapOutputHighlight(object): settings[1] = self.boolean_sanity(settings[1]) settings[2] = self.boolean_sanity(settings[2]) - tuple_regex = "[\(\[]\s?(\d+)\s?,\s?(\d+)\s?,\s?(\d+)\s?[\)\]]" - if isinstance(settings[3], basestring): + tuple_regex = r"[\(\[]\s?(\d+)\s?,\s?(\d+)\s?,\s?(\d+)\s?[\)\]]" + if isinstance(settings[3], str): settings[3] = [ int(t) for t in re.findall(tuple_regex, settings[3])[0] ] - if isinstance(settings[4], basestring): + if isinstance(settings[4], str): settings[4] = [ int(h) for h in re.findall(tuple_regex, settings[4])[0] ] @@ -542,57 +538,57 @@ class NmapOutputHighlight(object): "underline": str(False), "text": [0, 0, 0], "highlight": [65535, 65535, 65535], - "regex": "\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}\s.{1,4}"}, + "regex": r"\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}\s.{1,4}"}, "hostname": { "bold": str(True), "italic": str(True), "underline": str(True), "text": [0, 111, 65535], "highlight": [65535, 65535, 65535], - "regex": "(\w{2,}://)*[\w-]{2,}\.[\w-]{2,}" - "(\.[\w-]{2,})*(/[[\w-]{2,}]*)*"}, + "regex": r"(\w{2,}://)*[\w-]{2,}\.[\w-]{2,}" + r"(\.[\w-]{2,})*(/[[\w-]{2,}]*)*"}, "ip": { "bold": str(True), "italic": str(False), "underline": str(False), "text": [0, 0, 0], "highlight": [65535, 65535, 65535], - "regex": "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"}, + "regex": r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"}, "port_list": { "bold": str(True), "italic": str(False), "underline": str(False), "text": [0, 1272, 28362], "highlight": [65535, 65535, 65535], - "regex": "PORT\s+STATE\s+SERVICE(\s+VERSION)?[^\n]*"}, + "regex": r"PORT\s+STATE\s+SERVICE(\s+VERSION)?[^\n]*"}, "open_port": { "bold": str(True), "italic": str(False), "underline": str(False), "text": [0, 41036, 2396], "highlight": [65535, 65535, 65535], - "regex": "\d{1,5}/.{1,5}\s+open\s+.*"}, + "regex": r"\d{1,5}/.{1,5}\s+open\s+.*"}, "closed_port": { "bold": str(False), "italic": str(False), "underline": str(False), "text": [65535, 0, 0], "highlight": [65535, 65535, 65535], - "regex": "\d{1,5}/.{1,5}\s+closed\s+.*"}, + "regex": r"\d{1,5}/.{1,5}\s+closed\s+.*"}, "filtered_port": { "bold": str(False), "italic": str(False), "underline": str(False), "text": [38502, 39119, 0], "highlight": [65535, 65535, 65535], - "regex": "\d{1,5}/.{1,5}\s+filtered\s+.*"}, + "regex": r"\d{1,5}/.{1,5}\s+filtered\s+.*"}, "details": { "bold": str(True), "italic": str(False), "underline": str(True), "text": [0, 0, 0], "highlight": [65535, 65535, 65535], - "regex": "^(\w{2,}[\s]{,3}){,4}:"} + "regex": r"^(\w{2,}[\s]{,3}){,4}:"} } diff --git a/zenmap/zenmapCore/UmitConfigParser.py b/zenmap/zenmapCore/UmitConfigParser.py index 31be351f8..0754e9fa0 100644 --- a/zenmap/zenmapCore/UmitConfigParser.py +++ b/zenmap/zenmapCore/UmitConfigParser.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,7 @@ # * * # ***************************************************************************/ -from ConfigParser import ConfigParser, DEFAULTSECT, NoOptionError, \ +from configparser import ConfigParser, DEFAULTSECT, NoOptionError, \ NoSectionError from zenmapCore.UmitLogging import log @@ -74,7 +73,7 @@ class UmitConfigParser(ConfigParser): if not self.has_section(section): self.add_section(section) - ConfigParser.set(self, section, option, value) + ConfigParser.set(self, section, option, str(value)) self.save_changes() def read(self, filename): @@ -104,15 +103,13 @@ class UmitConfigParser(ConfigParser): if self._defaults: fp.write("[%s]\n" % DEFAULTSECT) - items = self._defaults.items() - items.sort() + items = sorted(self._defaults.items()) for (key, value) in items: fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") - sects = self._sections.keys() - sects.sort() + sects = sorted(self._sections.keys()) for section in sects: fp.write("[%s]\n" % section) diff --git a/zenmap/zenmapCore/UmitDB.py b/zenmap/zenmapCore/UmitDB.py index a07d2ff26..9aa84680b 100644 --- a/zenmap/zenmapCore/UmitDB.py +++ b/zenmap/zenmapCore/UmitDB.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,20 +57,10 @@ # * * # ***************************************************************************/ +import sqlite3 import sys from hashlib import md5 - -sqlite = None -try: - from pysqlite2 import dbapi2 as sqlite -except ImportError: - try: - # In case this script is been running under python2.5 with sqlite3 - import sqlite3 as sqlite - except ImportError: - raise ImportError(_("No module named dbapi2.pysqlite2 or sqlite3")) - from time import time from zenmapCore.Paths import Path @@ -84,7 +73,7 @@ try: umitdb = Path.db except Exception: import os.path - from BasePaths import base_paths + from .BasePaths import base_paths umitdb = os.path.join(Path.user_config_dir, base_paths["db"]) Path.db = umitdb @@ -102,28 +91,7 @@ if not exists(umitdb) or \ umitdb = ":memory:" using_memory = True -if isinstance(umitdb, str): - fs_enc = sys.getfilesystemencoding() - if fs_enc is None: - fs_enc = "UTF-8" - umitdb = umitdb.decode(fs_enc) - -# pysqlite 2.4.0 doesn't handle a unicode database name, though earlier and -# later versions do. Encode to UTF-8 as pysqlite would do internally anyway. -umitdb = umitdb.encode("UTF-8") - -connection = sqlite.connect(umitdb) - -# By default pysqlite will raise an OperationalError when trying to return a -# TEXT data type that is not UTF-8 (it always tries to decode text in order to -# return a unicode object). We store XML in the database, which may have a -# different encoding, so instruct pysqlite to return a plain str for TEXT data -# types, and not to attempt any decoding. -try: - connection.text_factory = str -except AttributeError: - # However, text_factory is available only in pysqlite 2.1.0 and later. - pass +connection = sqlite3.connect(umitdb) class Table(object): @@ -170,7 +138,7 @@ class Table(object): sql = sql[:][:-2] sql += ") VALUES (" - for v in xrange(len(kargs.values())): + for v in range(len(kargs.values())): sql += "?, " sql = sql[:][:-2] @@ -258,7 +226,7 @@ class Scans(Table, object): raise Exception("Can't save result without xml output") if not self.verify_digest( - md5(kargs["nmap_xml_output"]).hexdigest()): + md5(kargs["nmap_xml_output"].encode("UTF-8")).hexdigest()): raise Exception("XML output registered already!") self.scans_id = self.insert(**kargs) @@ -302,7 +270,7 @@ class Scans(Table, object): def set_nmap_xml_output(self, nmap_xml_output): self.set_item("nmap_xml_output", nmap_xml_output) - self.set_item("digest", md5(nmap_xml_output).hexdigest()) + self.set_item("digest", md5(nmap_xml_output.encode("UTF-8")).hexdigest()) def get_date(self): return self.get_item("date") @@ -328,7 +296,7 @@ def verify_db(): cursor = connection.cursor() try: cursor.execute("SELECT scans_id FROM scans WHERE date = 0") - except sqlite.OperationalError: + except sqlite3.OperationalError: u = UmitDB() u.create_db() verify_db() @@ -354,5 +322,5 @@ if __name__ == "__main__": sql = "SELECT * FROM scans;" u.cursor.execute(sql) - print "Scans:", + print("Scans:", end=' ') pprint(u.cursor.fetchall()) diff --git a/zenmap/zenmapCore/UmitLogging.py b/zenmap/zenmapCore/UmitLogging.py index bccfab782..ad0899b05 100644 --- a/zenmap/zenmapCore/UmitLogging.py +++ b/zenmap/zenmapCore/UmitLogging.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapCore/UmitOptionParser.py b/zenmap/zenmapCore/UmitOptionParser.py index e50786078..948980f56 100644 --- a/zenmap/zenmapCore/UmitOptionParser.py +++ b/zenmap/zenmapCore/UmitOptionParser.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapCore/__init__.py b/zenmap/zenmapCore/__init__.py index 64288607f..ce946574e 100644 --- a/zenmap/zenmapCore/__init__.py +++ b/zenmap/zenmapCore/__init__.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapGUI/About.py b/zenmap/zenmapGUI/About.py index b9364d531..0994f9f78 100644 --- a/zenmap/zenmapGUI/About.py +++ b/zenmap/zenmapGUI/About.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,11 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + import webbrowser from zenmapGUI.higwidgets.higdialogs import HIGDialog @@ -84,7 +87,7 @@ xml.__path__ = [x for x in xml.__path__ if "_xmlplus" not in x] from xml.sax.saxutils import escape -class _program_entry(gtk.VBox): +class _program_entry(Gtk.Box): """A little box containing labels with a program's name and description and a clickable link to its web site.""" @@ -93,34 +96,30 @@ class _program_entry(gtk.VBox): NAME_WEB_SITE_SPACING = 20 def __init__(self, name=None, web_site=None, description=None): - gtk.VBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) - self.hbox = gtk.HBox(False, self.NAME_WEB_SITE_SPACING) - self.pack_start(self.hbox) + self.hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, + self.NAME_WEB_SITE_SPACING) + self.pack_start(self.hbox, True, True, 0) if name is not None: - name_label = gtk.Label() + name_label = Gtk.Label() name_label.set_markup( '%s' % escape( name)) - self.hbox.pack_start(name_label, False) + self.hbox.pack_start(name_label, False, True, 0) if web_site is not None: - try: - web_site_button = gtk.LinkButton(web_site) - web_site_button.connect("clicked", self._link_button_open) - except AttributeError: - # LinkButton was only introduced in PyGTK 2.10. - web_site_button = gtk.Label(web_site) - web_site_button.set_selectable(True) - self.hbox.pack_start(web_site_button, False) + web_site_button = Gtk.LinkButton.new(web_site) + web_site_button.connect("clicked", self._link_button_open) + self.hbox.pack_start(web_site_button, False, True, 0) if description is not None: - description_label = gtk.Label() + description_label = Gtk.Label() description_label.set_alignment(0.0, 0.0) description_label.set_line_wrap(True) description_label.set_text(description) - self.pack_start(description_label) + self.pack_start(description_label, True, True, 0) def _link_button_open(self, widget): webbrowser.open(widget.get_uri()) @@ -128,7 +127,7 @@ class _program_entry(gtk.VBox): class About(HIGDialog): """An about dialog showing information about the program. It is meant to - have roughly the same feel as gtk.AboutDialog.""" + have roughly the same feel as Gtk.AboutDialog.""" def __init__(self): HIGDialog.__init__(self) self.set_title(_("About %s and %s") % ( @@ -137,44 +136,43 @@ class About(HIGDialog): self.vbox.set_border_width(12) self.vbox.set_spacing(12) - label = gtk.Label() + label = Gtk.Label() label.set_markup( '%s %s' % ( escape(APP_DISPLAY_NAME), escape(VERSION))) label.set_selectable(True) - self.vbox.pack_start(label) + self.vbox.pack_start(label, True, True, 0) - label = gtk.Label() + label = Gtk.Label() label.set_markup( '%s' % (escape(APP_COPYRIGHT))) - self.vbox.pack_start(label) + self.vbox.pack_start(label, True, True, 0) entry = _program_entry(NMAP_DISPLAY_NAME, NMAP_WEB_SITE, _( "%s is a free and open source utility for network exploration " "and security auditing.") % NMAP_DISPLAY_NAME) - self.vbox.pack_start(entry) + self.vbox.pack_start(entry, True, True, 0) entry = _program_entry(APP_DISPLAY_NAME, APP_WEB_SITE, _( "%s is a multi-platform graphical %s frontend and results viewer. " "It was originally derived from %s.") % ( APP_DISPLAY_NAME, NMAP_DISPLAY_NAME, UMIT_DISPLAY_NAME)) - self.vbox.pack_start(entry) + self.vbox.pack_start(entry, True, True, 0) entry = _program_entry(UMIT_DISPLAY_NAME, UMIT_WEB_SITE, _( "%s is an %s GUI created as part of the Nmap/Google Summer " "of Code program.") % (UMIT_DISPLAY_NAME, NMAP_DISPLAY_NAME)) - button = gtk.Button(_("%s credits") % UMIT_DISPLAY_NAME) + button = Gtk.Button.new_with_label(_("%s credits") % UMIT_DISPLAY_NAME) button.connect("clicked", self._show_umit_credits) - entry.hbox.pack_start(button, False) - self.vbox.pack_start(entry) + entry.hbox.pack_start(button, False, True, 0) + self.vbox.pack_start(entry, True, True, 0) self.vbox.show_all() - close_button = self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL) - self.set_default_response(gtk.RESPONSE_CANCEL) + close_button = self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CANCEL) + self.set_default_response(Gtk.ResponseType.CANCEL) close_button.grab_focus() - self.set_has_separator(False) self.set_resizable(False) self._umit_credits_dialog = None @@ -208,7 +206,7 @@ class UmitCredits(HIGWindow): HIGWindow.__init__(self) self.set_title(_("%s credits") % UMIT_DISPLAY_NAME) self.set_size_request(-1, 250) - self.set_position(gtk.WIN_POS_CENTER) + self.set_position(Gtk.WindowPosition.CENTER) self.__create_widgets() self.__packing() @@ -218,7 +216,7 @@ class UmitCredits(HIGWindow): self.vbox = HIGVBox() self.hbox = HIGHBox() self.notebook = HIGNotebook() - self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE) + self.btn_close = HIGButton(stock=Gtk.STOCK_CLOSE) self.written_by_scroll = HIGScrolledWindow() self.written_by_text = HIGTextView() @@ -248,35 +246,35 @@ class UmitCredits(HIGWindow): self.hbox._pack_noexpand_nofill(self.btn_close) self.notebook.append_page( - self.written_by_scroll, gtk.Label(_("Written by"))) + self.written_by_scroll, Gtk.Label.new(_("Written by"))) self.notebook.append_page( - self.design_scroll, gtk.Label(_("Design"))) + self.design_scroll, Gtk.Label.new(_("Design"))) self.notebook.append_page( - self.soc2007_scroll, gtk.Label(_("SoC 2007"))) + self.soc2007_scroll, Gtk.Label.new(_("SoC 2007"))) self.notebook.append_page( - self.contributors_scroll, gtk.Label(_("Contributors"))) + self.contributors_scroll, Gtk.Label.new(_("Contributors"))) self.notebook.append_page( - self.translation_scroll, gtk.Label(_("Translation"))) + self.translation_scroll, Gtk.Label.new(_("Translation"))) self.notebook.append_page( - self.nokia_scroll, gtk.Label(_("Maemo"))) + self.nokia_scroll, Gtk.Label.new(_("Maemo"))) self.written_by_scroll.add(self.written_by_text) - self.written_by_text.set_wrap_mode(gtk.WRAP_NONE) + self.written_by_text.set_wrap_mode(Gtk.WrapMode.NONE) self.design_scroll.add(self.design_text) - self.design_text.set_wrap_mode(gtk.WRAP_NONE) + self.design_text.set_wrap_mode(Gtk.WrapMode.NONE) self.soc2007_scroll.add(self.soc2007_text) - self.soc2007_text.set_wrap_mode(gtk.WRAP_NONE) + self.soc2007_text.set_wrap_mode(Gtk.WrapMode.NONE) self.contributors_scroll.add(self.contributors_text) - self.contributors_text.set_wrap_mode(gtk.WRAP_NONE) + self.contributors_text.set_wrap_mode(Gtk.WrapMode.NONE) self.translation_scroll.add(self.translation_text) - self.translation_text.set_wrap_mode(gtk.WRAP_NONE) + self.translation_text.set_wrap_mode(Gtk.WrapMode.NONE) self.nokia_scroll.add(self.nokia_text) - self.nokia_text.set_wrap_mode(gtk.WRAP_NONE) + self.nokia_text.set_wrap_mode(Gtk.WrapMode.NONE) self.btn_close.connect('clicked', lambda x, y=None: self.destroy()) @@ -365,6 +363,6 @@ Adriano Monteiro Marques """) if __name__ == '__main__': about = About() about.show() - about.connect("response", lambda widget, response: gtk.main_quit()) + about.connect("response", lambda widget, response: Gtk.main_quit()) - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/App.py b/zenmap/zenmapGUI/App.py index a4fa82332..bcfb37a34 100644 --- a/zenmap/zenmapGUI/App.py +++ b/zenmap/zenmapGUI/App.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -62,7 +61,7 @@ import imp import os import signal import sys -import ConfigParser +import configparser import shutil # Cause an exception if PyGTK can't open a display. Normally this just @@ -74,7 +73,9 @@ import shutil import warnings warnings.filterwarnings("error", module="gtk", append="True") try: - import gtk + import gi + gi.require_version("Gtk", "3.0") + from gi.repository import Gtk, Gdk except Exception: # On Mac OS X 10.5, X11 is supposed to be automatically launched on demand. # It works by setting the DISPLAY environment variable to something like @@ -86,7 +87,9 @@ except Exception: # startup scripts, and for some reason the first connection (the one that # caused the launch) is rejected. But somehow subsequent connections work # fine! So if the import fails, try one more time. - import gtk + import gi + gi.require_version("Gtk", "3.0") + from gi.repository import Gtk, Gdk warnings.resetwarnings() from zenmapGUI.higwidgets.higdialogs import HIGAlertDialog @@ -103,17 +106,17 @@ from zenmapCore.Name import APP_DISPLAY_NAME from zenmapGUI.higwidgets.higdialogs import HIGAlertDialog # A global list of open scan windows. When the last one is destroyed, we call -# gtk.main_quit. +# Gtk.main_quit. open_windows = [] def _destroy_callback(window): open_windows.remove(window) if len(open_windows) == 0: - gtk.main_quit() + Gtk.main_quit() try: from zenmapCore.UmitDB import UmitDB - except ImportError, e: + except ImportError as e: log.debug(">>> Not cleaning up database: %s." % str(e)) else: # Cleaning up data base @@ -160,29 +163,31 @@ def install_excepthook(): # produces a warning, but the lack of a display eventually causes a # segmentation fault. See http://live.gnome.org/PyGTK/WhatsNew210. warnings.filterwarnings("error", module="gtk") - import gtk + import gi + gi.require_version("Gtk", "3.0") + from gi.repository import Gtk, Gdk warnings.resetwarnings() - gtk.gdk.threads_enter() + Gdk.threads_enter() from zenmapGUI.higwidgets.higdialogs import HIGAlertDialog from zenmapGUI.CrashReport import CrashReport if type == ImportError: - d = HIGAlertDialog(type=gtk.MESSAGE_ERROR, + d = HIGAlertDialog(type=Gtk.MessageType.ERROR, message_format=_("Import error"), secondary_text=_("""A required module was not found. -""" + unicode(value))) +""" + str(value))) d.run() d.destroy() else: c = CrashReport(type, value, tb) c.show_all() - gtk.main() + Gtk.main() - gtk.gdk.threads_leave() + Gdk.threads_leave() - gtk.main_quit() + Gtk.main_quit() sys.excepthook = excepthook @@ -215,7 +220,7 @@ def run(): # template directory. create_user_config_dir( Path.user_config_dir, Path.config_dir) - except (IOError, OSError), e: + except (IOError, OSError) as e: error_dialog = HIGAlertDialog( message_format=_( "Error creating the per-user configuration directory"), @@ -239,7 +244,7 @@ scan profiles. Check for access to the directory and try again.""") % ( try: # Read the ~/.zenmap/zenmap.conf configuration file. zenmapCore.UmitConf.config_parser.read(Path.user_config_file) - except ConfigParser.ParsingError, e: + except configparser.ParsingError as e: # ParsingError can leave some values as lists instead of strings. Just # blow it all away if we have this problem. zenmapCore.UmitConf.config_parser = zenmapCore.UmitConf.config_parser.__class__() @@ -258,7 +263,7 @@ until it is repaired.""") % (Path.user_config_file, str(e), APP_DISPLAY_NAME) error_dialog.destroy() global_config_path = os.path.join(Path.config_dir, APP_NAME + '.conf') repair_dialog = HIGAlertDialog( - type=gtk.MESSAGE_QUESTION, + type=Gtk.MessageType.QUESTION, message_format=_("Restore default configuration?"), secondary_text=_("""\ To avoid further errors parsing the configuration file %s, \ @@ -267,9 +272,9 @@ you can copy the default configuration from %s. Do this now? \ """) % (Path.user_config_file, global_config_path), ) - repair_dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) - repair_dialog.set_default_response(gtk.RESPONSE_CANCEL) - if repair_dialog.run() == gtk.RESPONSE_OK: + repair_dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) + repair_dialog.set_default_response(Gtk.ResponseType.CANCEL) + if repair_dialog.run() == Gtk.ResponseType.OK: shutil.copyfile(global_config_path, Path.user_config_file) log.debug(">>> Copy %s to %s." % (global_config_path, Path.user_config_file)) repair_dialog.destroy() @@ -316,13 +321,13 @@ Do this now? \ if main_is_frozen(): # This is needed by py2exe - gtk.gdk.threads_init() - gtk.gdk.threads_enter() + Gdk.threads_init() + Gdk.threads_enter() - gtk.main() + Gtk.main() if main_is_frozen(): - gtk.gdk.threads_leave() + Gdk.threads_leave() class NonRootWarning (HIGAlertDialog): diff --git a/zenmap/zenmapGUI/BugReport.py b/zenmap/zenmapGUI/BugReport.py index 8943155ad..06be52129 100644 --- a/zenmap/zenmapGUI/BugReport.py +++ b/zenmap/zenmapGUI/BugReport.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.higwidgets.higboxes import HIGVBox @@ -74,11 +76,12 @@ xml.__path__ = [x for x in xml.__path__ if "_xmlplus" not in x] from xml.sax.saxutils import escape -class BugReport(gtk.Window, object): +class BugReport(Gtk.Window, object): def __init__(self): - gtk.Window.__init__(self) + Gtk.Window.__init__(self) self.set_title(_('How to Report a Bug')) - self.set_position(gtk.WIN_POS_CENTER_ALWAYS) + self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) + self.set_resizable(False) self._create_widgets() self._pack_widgets() @@ -86,16 +89,17 @@ class BugReport(gtk.Window, object): def _create_widgets(self): self.vbox = HIGVBox() - self.button_box = gtk.HButtonBox() + self.button_box = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL) - self.text = gtk.Label() + self.text = Gtk.Label() - self.btn_ok = gtk.Button(stock=gtk.STOCK_OK) + self.btn_ok = Gtk.Button.new_from_stock(Gtk.STOCK_OK) def _pack_widgets(self): self.vbox.set_border_width(6) self.text.set_line_wrap(True) + self.text.set_max_width_chars(50) self.text.set_markup(_("""\ How to report a bug @@ -124,8 +128,8 @@ https://nmap.org/data/HACKING. Patches may be sent to nmap-dev \ }) self.vbox.add(self.text) - self.button_box.set_layout(gtk.BUTTONBOX_END) - self.button_box.pack_start(self.btn_ok) + self.button_box.set_layout(Gtk.ButtonBoxStyle.END) + self.button_box.pack_start(self.btn_ok, True, True, 0) self.vbox._pack_noexpand_nofill(self.button_box) self.add(self.vbox) @@ -140,6 +144,6 @@ https://nmap.org/data/HACKING. Patches may be sent to nmap-dev \ if __name__ == "__main__": w = BugReport() w.show_all() - w.connect("delete-event", lambda x, y: gtk.main_quit()) + w.connect("delete-event", lambda x, y: Gtk.main_quit()) - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/CrashReport.py b/zenmap/zenmapGUI/CrashReport.py index 6b84a0248..ecb4fe8c3 100644 --- a/zenmap/zenmapGUI/CrashReport.py +++ b/zenmap/zenmapGUI/CrashReport.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,8 +57,12 @@ # * * # ***************************************************************************/ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk + import sys -import gtk import traceback from zenmapGUI.higwidgets.higdialogs import HIGDialog @@ -81,9 +84,9 @@ from xml.sax.saxutils import escape class CrashReport(HIGDialog): def __init__(self, type, value, tb): HIGDialog.__init__(self) - gtk.Window.__init__(self) + Gtk.Window.__init__(self) self.set_title(_('Crash Report')) - self.set_position(gtk.WIN_POS_CENTER_ALWAYS) + self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) self._create_widgets() self._pack_widgets() @@ -94,58 +97,59 @@ class CrashReport(HIGDialog): self.description_text.get_buffer().set_text(text) def _create_widgets(self): - self.button_box = gtk.HButtonBox() - self.button_box_ok = gtk.HButtonBox() + self.button_box = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL) + self.button_box_ok = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL) - self.description_scrolled = gtk.ScrolledWindow() - self.description_text = gtk.TextView() + self.description_scrolled = Gtk.ScrolledWindow() + self.description_text = Gtk.TextView() self.description_text.set_editable(False) - self.bug_text = gtk.Label() + self.bug_text = Gtk.Label() self.bug_text.set_markup(_('An unexpected error has crashed ' '%(app_name)s. Please copy the stack trace below and send it to ' 'the dev@nmap.org mailing list. ' '(More about the list.' ') The developers will see your report and try to fix the problem.' ) % {"app_name": escape(APP_DISPLAY_NAME)}) - self.email_frame = gtk.Frame() - self.email_label = gtk.Label() + self.email_frame = Gtk.Frame() + self.email_label = Gtk.Label() self.email_label.set_markup(_('Copy and email to ' 'dev@nmap.org:')) - self.btn_copy = gtk.Button(stock=gtk.STOCK_COPY) - self.btn_ok = gtk.Button(stock=gtk.STOCK_OK) + self.btn_copy = Gtk.Button.new_from_stock(Gtk.STOCK_COPY) + self.btn_ok = Gtk.Button.new_from_stock(Gtk.STOCK_OK) self.hbox = HIGHBox() def _pack_widgets(self): self.description_scrolled.add(self.description_text) self.description_scrolled.set_policy( - gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.description_scrolled.set_size_request(400, 150) - self.description_text.set_wrap_mode(gtk.WRAP_WORD) + self.description_text.set_wrap_mode(Gtk.WrapMode.WORD) + self.bug_text.set_max_width_chars(60) self.bug_text.set_line_wrap(True) self.email_label.set_line_wrap(True) self.email_frame.set_label_widget(self.email_label) - self.email_frame.set_shadow_type(gtk.SHADOW_NONE) + self.email_frame.set_shadow_type(Gtk.ShadowType.NONE) self.hbox.set_border_width(6) self.vbox.set_border_width(6) self.hbox._pack_expand_fill(self.bug_text) - self.button_box.set_layout(gtk.BUTTONBOX_START) - self.button_box_ok.set_layout(gtk.BUTTONBOX_END) + self.button_box.set_layout(Gtk.ButtonBoxStyle.START) + self.button_box_ok.set_layout(Gtk.ButtonBoxStyle.END) - self.button_box.pack_start(self.btn_copy) - self.button_box_ok.pack_start(self.btn_ok) + self.button_box.pack_start(self.btn_copy, True, True, 0) + self.button_box_ok.pack_start(self.btn_ok, True, True, 0) - self.vbox.pack_start(self.hbox) - self.vbox.pack_start(self.email_frame) - self.vbox.pack_start(self.description_scrolled) - self.vbox.pack_start(self.button_box) - self.action_area.pack_start(self.button_box_ok) + self.vbox.pack_start(self.hbox, True, True, 0) + self.vbox.pack_start(self.email_frame, True, True, 0) + self.vbox.pack_start(self.description_scrolled, True, True, 0) + self.vbox.pack_start(self.button_box, True, True, 0) + self.action_area.pack_start(self.button_box_ok, True, True, 0) def _connect_widgets(self): self.btn_ok.connect("clicked", self.close) @@ -154,21 +158,21 @@ class CrashReport(HIGDialog): def get_description(self): buff = self.description_text.get_buffer() - return buff.get_text(buff.get_start_iter(), buff.get_end_iter()) + return buff.get_text(buff.get_start_iter(), buff.get_end_iter(), include_hidden_chars=True) def copy(self, widget=None, event=None): - clipboard = gtk.clipboard_get() - clipboard.set_text(self.get_description()) + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + clipboard.set_text(self.get_description(), -1) clipboard.store() def close(self, widget=None, event=None): self.destroy() - gtk.main_quit() + Gtk.main_quit() sys.exit(0) if __name__ == "__main__": c = CrashReport(None, None, None) c.show_all() - c.connect("delete-event", lambda x, y: gtk.main_quit()) + c.connect("delete-event", lambda x, y: Gtk.main_quit()) - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/DiffCompare.py b/zenmap/zenmapGUI/DiffCompare.py index d86a5a4aa..825b86f1a 100644 --- a/zenmap/zenmapGUI/DiffCompare.py +++ b/zenmap/zenmapGUI/DiffCompare.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,8 +57,11 @@ # * * # ***************************************************************************/ -import gobject -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject, GLib + import os import os.path import sys @@ -94,11 +96,12 @@ class ScanChooser(HIGVBox): has changed.""" __gsignals__ = { - "changed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()) + "changed": (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ()) } def __init__(self, scans, title): - self.__gobject_init__() + HIGVBox.__init__(self) + self.title = title self.scan_dict = {} @@ -126,13 +129,12 @@ class ScanChooser(HIGVBox): self.lbl_scan = HIGSectionLabel(self.title) self.hbox = HIGHBox() self.table = HIGTable() - self.list_scan = gtk.ListStore(str) - self.combo_scan = gtk.ComboBoxEntry(self.list_scan, 0) - self.btn_open_scan = gtk.Button(stock=gtk.STOCK_OPEN) - self.exp_scan = gtk.Expander(_("Scan Output")) - self.scrolled = gtk.ScrolledWindow() - self.txt_scan_result = gtk.TextView() - self.txg_tag = gtk.TextTag("scan_style") + self.combo_scan = Gtk.ComboBoxText.new_with_entry() + self.btn_open_scan = Gtk.Button.new_from_stock(Gtk.STOCK_OPEN) + self.exp_scan = Gtk.Expander.new(_("Scan Output")) + self.scrolled = Gtk.ScrolledWindow() + self.txt_scan_result = Gtk.TextView() + self.txg_tag = Gtk.TextTag.new("scan_style") def get_buffer(self): return self.txt_scan_result.get_buffer() @@ -166,14 +168,14 @@ class ScanChooser(HIGVBox): self.scrolled.add_with_viewport(self.txt_scan_result) # Setting scrolled window - self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + self.scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) def _set_text_view(self): self.txg_table = self.txt_scan_result.get_buffer().get_tag_table() self.txg_table.add(self.txg_tag) self.txg_tag.set_property("family", "Monospace") - self.txt_scan_result.set_wrap_mode(gtk.WRAP_WORD) + self.txt_scan_result.set_wrap_mode(Gtk.WrapMode.WORD) self.txt_scan_result.set_editable(False) self.txt_scan_result.get_buffer().connect( "changed", self._text_changed_cb) @@ -187,7 +189,7 @@ class ScanChooser(HIGVBox): response = file_chooser.run() file_chosen = file_chooser.get_filename() file_chooser.destroy() - if response == gtk.RESPONSE_OK: + if response == Gtk.ResponseType.OK: try: parser = NmapParser() parser.parse_file(file_chosen) @@ -214,7 +216,7 @@ class ScanChooser(HIGVBox): scan_name = os.path.split(file_chosen)[-1] self.add_scan(scan_name, parser) - self.combo_scan.set_active(len(self.list_scan) - 1) + self.combo_scan.set_active(len(self.combo_scan.get_model()) - 1) def add_scan(self, scan_name, parser): scan_id = 1 @@ -223,7 +225,7 @@ class ScanChooser(HIGVBox): new_scan_name = "%s (%s)" % (scan_name, scan_id) scan_id += 1 - self.list_scan.append([new_scan_name]) + self.combo_scan.append_text(new_scan_name) self.scan_dict[new_scan_name] = parser def _text_changed_cb(self, widget): @@ -234,7 +236,7 @@ class ScanChooser(HIGVBox): def get_parsed_scan(self): """Return the currently selected scan's parsed output as an NmapParser object, or None if no valid scan is selected.""" - selected_scan = self.combo_scan.child.get_text() + selected_scan = self.combo_scan.get_active_text() return self.scan_dict.get(selected_scan) def get_nmap_output(self): @@ -249,9 +251,9 @@ class ScanChooser(HIGVBox): parsed_scan = property(get_parsed_scan) -class DiffWindow(gtk.Window): +class DiffWindow(Gtk.Window): def __init__(self, scans): - gtk.Window.__init__(self) + Gtk.Window.__init__(self) self.set_title(_("Compare Results")) self.ndiff_process = None # We allow the user to start a new diff before the old one has @@ -265,11 +267,11 @@ class DiffWindow(gtk.Window): self.diff_view = DiffView() self.diff_view.set_size_request(-1, 100) self.hbox_buttons = HIGHBox() - self.progress = gtk.ProgressBar() - self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE) + self.progress = Gtk.ProgressBar() + self.btn_close = HIGButton(stock=Gtk.STOCK_CLOSE) self.hbox_selection = HIGHBox() - self.scan_chooser_a = ScanChooser(scans, _(u"A Scan")) - self.scan_chooser_b = ScanChooser(scans, _(u"B Scan")) + self.scan_chooser_a = ScanChooser(scans, _("A Scan")) + self.scan_chooser_b = ScanChooser(scans, _("B Scan")) self._pack_widgets() self._connect_widgets() @@ -282,20 +284,20 @@ class DiffWindow(gtk.Window): def _pack_widgets(self): self.main_vbox.set_border_width(6) - self.hbox_selection.pack_start(self.scan_chooser_a, True, True) - self.hbox_selection.pack_start(self.scan_chooser_b, True, True) + self.hbox_selection.pack_start(self.scan_chooser_a, True, True, 0) + self.hbox_selection.pack_start(self.scan_chooser_b, True, True, 0) - self.main_vbox.pack_start(self.hbox_selection, False) + self.main_vbox.pack_start(self.hbox_selection, False, True, 0) - scroll = gtk.ScrolledWindow() - scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + scroll = Gtk.ScrolledWindow() + scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll.add(self.diff_view) - self.main_vbox.pack_start(scroll, True, True) + self.main_vbox.pack_start(scroll, True, True, 0) self.progress.hide() self.progress.set_no_show_all(True) - self.hbox_buttons.pack_start(self.progress, False) - self.hbox_buttons.pack_end(self.btn_close, False) + self.hbox_buttons.pack_start(self.progress, False, True, 0) + self.hbox_buttons.pack_end(self.btn_close, False, True, 0) self.main_vbox._pack_noexpand_nofill(self.hbox_buttons) @@ -337,7 +339,7 @@ class DiffWindow(gtk.Window): else: self.progress.show() if self.timer_id is None: - self.timer_id = gobject.timeout_add( + self.timer_id = GLib.timeout_add( NDIFF_CHECK_TIMEOUT, self.check_ndiff_process) def check_ndiff_process(self): @@ -362,7 +364,7 @@ class DiffWindow(gtk.Window): if status == 0 or status == 1: # Successful completion. try: - diff = self.ndiff_process.get_scan_diff() + diff = self.ndiff_process.get_scan_diff().decode("utf-8") except zenmapCore.Diff.NdiffParseException as e: alert = HIGAlertDialog( message_format=_("Error parsing ndiff output"), @@ -401,13 +403,13 @@ class DiffWindow(gtk.Window): self.destroy() -class DiffView(gtk.TextView): +class DiffView(Gtk.TextView): REMOVE_COLOR = "#ffaaaa" ADD_COLOR = "#ccffcc" """A widget displaying a zenmapCore.Diff.ScanDiff.""" def __init__(self): - gtk.TextView.__init__(self) + Gtk.TextView.__init__(self) self.set_editable(False) buff = self.get_buffer() @@ -418,7 +420,7 @@ class DiffView(gtk.TextView): buff.create_tag("+", font="Monospace", background=self.ADD_COLOR) def clear(self): - self.get_buffer().set_text(u"") + self.get_buffer().set_text("") def show_diff(self, diff): self.clear() @@ -451,6 +453,6 @@ if __name__ == "__main__": "Parsed 4": parsed4}) dw.show_all() - dw.connect("delete-event", lambda x, y: gtk.main_quit()) + dw.connect("delete-event", lambda x, y: Gtk.main_quit()) - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/FileChoosers.py b/zenmap/zenmapGUI/FileChoosers.py index 7dca7ac06..d98022235 100644 --- a/zenmap/zenmapGUI/FileChoosers.py +++ b/zenmap/zenmapGUI/FileChoosers.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,27 +57,31 @@ # * * # ***************************************************************************/ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + import os.path import sys -import gtk import zenmapCore.I18N # lgtm[py/unused-import] RESPONSE_OPEN_DIRECTORY = 1 -class AllFilesFileFilter(gtk.FileFilter): +class AllFilesFileFilter(Gtk.FileFilter): def __init__(self): - gtk.FileFilter.__init__(self) + Gtk.FileFilter.__init__(self) pattern = "*" self.add_pattern(pattern) self.set_name(_("All files (%s)") % pattern) -class ResultsFileFilter(gtk.FileFilter): +class ResultsFileFilter(Gtk.FileFilter): def __init__(self): - gtk.FileFilter.__init__(self) + Gtk.FileFilter.__init__(self) patterns = ["*.xml"] for pattern in patterns: @@ -86,9 +89,9 @@ class ResultsFileFilter(gtk.FileFilter): self.set_name(_("Nmap XML files (%s)") % ", ".join(patterns)) -class ScriptFileFilter(gtk.FileFilter): +class ScriptFileFilter(Gtk.FileFilter): def __init__(self): - gtk.FileFilter.__init__(self) + Gtk.FileFilter.__init__(self) patterns = ["*.nse"] for pattern in patterns: @@ -96,7 +99,7 @@ class ScriptFileFilter(gtk.FileFilter): self.set_name(_("NSE scripts (%s)") % ", ".join(patterns)) -class UnicodeFileChooserDialog(gtk.FileChooserDialog): +class UnicodeFileChooserDialog(Gtk.FileChooserDialog): """This is a base class for file choosers. It is designed to ease the retrieval of Unicode file names. On most platforms, the file names returned are encoded in the encoding given by sys.getfilesystemencoding(). On @@ -104,7 +107,7 @@ class UnicodeFileChooserDialog(gtk.FileChooserDialog): results in a file not found error. The get_filename method of this class handles the decoding automatically.""" def get_filename(self): - filename = gtk.FileChooserDialog.get_filename(self) + filename = Gtk.FileChooserDialog.get_filename(self) if sys.platform == "win32": encoding = "UTF-8" else: @@ -118,13 +121,13 @@ class UnicodeFileChooserDialog(gtk.FileChooserDialog): class AllFilesFileChooserDialog(UnicodeFileChooserDialog): def __init__(self, title="", parent=None, - action=gtk.FILE_CHOOSER_ACTION_OPEN, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OPEN, gtk.RESPONSE_OK), backend=None): + action=Gtk.FileChooserAction.OPEN, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_OPEN, Gtk.ResponseType.OK), backend=None): - gtk.FileChooserDialog.__init__(self, title, parent, - action, buttons) - self.set_default_response(gtk.RESPONSE_OK) + UnicodeFileChooserDialog.__init__(self, title=title, parent=parent, + action=action, buttons=buttons) + self.set_default_response(Gtk.ResponseType.OK) self.add_filter(AllFilesFileFilter()) @@ -132,40 +135,40 @@ class ResultsFileSingleChooserDialog(UnicodeFileChooserDialog): """This results file choose only allows the selection of single files, not directories.""" def __init__(self, title="", parent=None, - action=gtk.FILE_CHOOSER_ACTION_OPEN, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OPEN, gtk.RESPONSE_OK), backend=None): + action=Gtk.FileChooserAction.OPEN, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_OPEN, Gtk.ResponseType.OK), backend=None): - UnicodeFileChooserDialog.__init__(self, title, parent, - action, buttons) - self.set_default_response(gtk.RESPONSE_OK) + UnicodeFileChooserDialog.__init__(self, title=title, parent=parent, + action=action, buttons=buttons) + self.set_default_response(Gtk.ResponseType.OK) for f in (ResultsFileFilter(), AllFilesFileFilter()): self.add_filter(f) class ResultsFileChooserDialog(UnicodeFileChooserDialog): def __init__(self, title="", parent=None, - action=gtk.FILE_CHOOSER_ACTION_OPEN, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + action=Gtk.FileChooserAction.OPEN, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Open Directory", RESPONSE_OPEN_DIRECTORY, - gtk.STOCK_OPEN, gtk.RESPONSE_OK), backend=None): + Gtk.STOCK_OPEN, Gtk.ResponseType.OK), backend=None): - UnicodeFileChooserDialog.__init__(self, title, parent, - action, buttons) - self.set_default_response(gtk.RESPONSE_OK) + UnicodeFileChooserDialog.__init__(self, title=title, parent=parent, + action=action, buttons=buttons) + self.set_default_response(Gtk.ResponseType.OK) for f in (ResultsFileFilter(), AllFilesFileFilter()): self.add_filter(f) class ScriptFileChooserDialog(UnicodeFileChooserDialog): def __init__(self, title="", parent=None, - action=gtk.FILE_CHOOSER_ACTION_OPEN, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OPEN, gtk.RESPONSE_OK), backend=None): + action=Gtk.FileChooserAction.OPEN, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_OPEN, Gtk.ResponseType.OK), backend=None): - UnicodeFileChooserDialog.__init__(self, title, parent, - action, buttons) - self.set_default_response(gtk.RESPONSE_OK) + UnicodeFileChooserDialog.__init__(self, title=title, parent=parent, + action=action, buttons=buttons) + self.set_default_response(Gtk.ResponseType.OK) self.set_select_multiple(True) for f in (ScriptFileFilter(), AllFilesFileFilter()): self.add_filter(f) @@ -185,32 +188,33 @@ class SaveResultsFileChooserDialog(UnicodeFileChooserDialog): } def __init__(self, title="", parent=None, - action=gtk.FILE_CHOOSER_ACTION_SAVE, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_SAVE, gtk.RESPONSE_OK), backend=None): + action=Gtk.FileChooserAction.SAVE, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_SAVE, Gtk.ResponseType.OK), backend=None): - UnicodeFileChooserDialog.__init__(self, title, parent, action, buttons) + UnicodeFileChooserDialog.__init__(self, title=title, parent=parent, + action=action, buttons=buttons) - types_store = gtk.ListStore(str, str, str) + types_store = Gtk.ListStore.new([str, str, str]) for type in self.TYPES: types_store.append(type) - self.combo = gtk.ComboBox(types_store) - cell = gtk.CellRendererText() + self.combo = Gtk.ComboBox.new_with_model(types_store) + cell = Gtk.CellRendererText() self.combo.pack_start(cell, True) self.combo.add_attribute(cell, "text", 0) self.combo.connect("changed", self.combo_changed_cb) self.combo.set_active(1) - hbox = gtk.HBox(False, 6) - hbox.pack_end(self.combo, False) - hbox.pack_end(gtk.Label(_("Select File Type:")), False) + hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 6) + hbox.pack_end(self.combo, False, True, 0) + hbox.pack_end(Gtk.Label.new(_("Select File Type:")), False, True, 0) hbox.show_all() self.set_extra_widget(hbox) self.set_do_overwrite_confirmation(True) - self.set_default_response(gtk.RESPONSE_OK) + self.set_default_response(Gtk.ResponseType.OK) def combo_changed_cb(self, combo): filename = self.get_filename() or "" @@ -243,19 +247,21 @@ class SaveResultsFileChooserDialog(UnicodeFileChooserDialog): class DirectoryChooserDialog(UnicodeFileChooserDialog): def __init__(self, title="", parent=None, - action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OPEN, gtk.RESPONSE_OK), backend=None): + action=Gtk.FileChooserAction.SELECT_FOLDER, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_OPEN, Gtk.ResponseType.OK), backend=None): - UnicodeFileChooserDialog.__init__(self, title, parent, action, buttons) - self.set_default_response(gtk.RESPONSE_OK) + UnicodeFileChooserDialog.__init__(self, title=title, parent=parent, + action=action, buttons=buttons) + self.set_default_response(Gtk.ResponseType.OK) class SaveToDirectoryChooserDialog(UnicodeFileChooserDialog): def __init__(self, title="", parent=None, - action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_SAVE, gtk.RESPONSE_OK), backend=None): + action=Gtk.FileChooserAction.SELECT_FOLDER, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_SAVE, Gtk.ResponseType.OK), backend=None): - UnicodeFileChooserDialog.__init__(self, title, parent, action, buttons) - self.set_default_response(gtk.RESPONSE_OK) + UnicodeFileChooserDialog.__init__(self, title=title, parent=parent, + action=action, buttons=buttons) + self.set_default_response(Gtk.ResponseType.OK) diff --git a/zenmap/zenmapGUI/FilterBar.py b/zenmap/zenmapGUI/FilterBar.py index a8d315632..6b8f7eef0 100644 --- a/zenmap/zenmapGUI/FilterBar.py +++ b/zenmap/zenmapGUI/FilterBar.py @@ -1,5 +1,7 @@ -import gtk -import gobject +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject from zenmapGUI.higwidgets.higboxes import HIGHBox from zenmapGUI.higwidgets.higlabels import HintWindow @@ -10,30 +12,30 @@ class FilterBar(HIGHBox): entering a string that restricts the set of visible hosts.""" __gsignals__ = { - "changed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()) + "changed": (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ()) } def __init__(self): HIGHBox.__init__(self) - self.information_label = gtk.Label() - self.entry = gtk.Entry() + self.information_label = Gtk.Label() + self.entry = Gtk.Entry() - self.pack_start(self.information_label, False) + self.pack_start(self.information_label, False, True, 0) self.information_label.show() - label = gtk.Label(_("Host Filter:")) - self.pack_start(label, False) + label = Gtk.Label.new(_("Host Filter:")) + self.pack_start(label, False, True, 0) label.show() - self.pack_start(self.entry, True, True) + self.pack_start(self.entry, True, True, 0) self.entry.show() - help_button = gtk.Button() - icon = gtk.Image() - icon.set_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_BUTTON) + help_button = Gtk.Button() + icon = Gtk.Image() + icon.set_from_stock(Gtk.STOCK_INFO, Gtk.IconSize.BUTTON) help_button.add(icon) help_button.connect("clicked", self._help_button_clicked) - self.pack_start(help_button, False) + self.pack_start(help_button, False, True, 0) help_button.show_all() self.entry.connect("changed", lambda x: self.emit("changed")) @@ -42,7 +44,7 @@ class FilterBar(HIGHBox): self.entry.grab_focus() def get_filter_string(self): - return self.entry.get_text().decode("UTF-8") + return self.entry.get_text() def set_filter_string(self, filter_string): return self.entry.set_text(filter_string) diff --git a/zenmap/zenmapGUI/Icons.py b/zenmap/zenmapGUI/Icons.py index 46e018e97..bc4de7a14 100644 --- a/zenmap/zenmapGUI/Icons.py +++ b/zenmap/zenmapGUI/Icons.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,8 +57,11 @@ # * * # ***************************************************************************/ -import gtk -import gobject +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GLib, GdkPixbuf + import re import os.path @@ -93,7 +95,7 @@ if pixmap_path: def get_pixmap_file_names(icon_name, size): yield '%s_%s.png' % (icon_name, size) - iconfactory = gtk.IconFactory() + iconfactory = Gtk.IconFactory() for icon_name in icon_names: for type, size in (('icon', '32'), ('logo', '75')): key = '%s_%s' % (icon_name, type) @@ -101,9 +103,9 @@ if pixmap_path: for file_name in get_pixmap_file_names(icon_name, size): file_path = os.path.join(pixmap_path, file_name) try: - pixbuf = gtk.gdk.pixbuf_new_from_file(file_path) + pixbuf = GdkPixbuf.Pixbuf.new_from_file(file_path) break - except gobject.GError: + except GLib.GError: # Try again. pass else: @@ -113,7 +115,7 @@ if pixmap_path: ', '.join(get_pixmap_file_names(icon_name, size)), pixmap_path)) continue - iconset = gtk.IconSet(pixbuf) + iconset = Gtk.IconSet(pixbuf=pixbuf) iconfactory.add(key, iconset) log.debug('Register %s icon name for file %s' % (key, file_path)) iconfactory.add_default() diff --git a/zenmap/zenmapGUI/MainWindow.py b/zenmap/zenmapGUI/MainWindow.py index ce7729280..7f4c11f9f 100644 --- a/zenmap/zenmapGUI/MainWindow.py +++ b/zenmap/zenmapGUI/MainWindow.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk import sys import os @@ -87,7 +89,6 @@ from zenmapGUI.SearchWindow import SearchWindow from zenmapGUI.BugReport import BugReport from zenmapCore.Name import APP_DISPLAY_NAME, APP_DOCUMENTATION_SITE -from zenmapCore.BasePaths import fs_enc from zenmapCore.Paths import Path from zenmapCore.RecentScans import recent_scans from zenmapCore.UmitLogging import log @@ -106,22 +107,21 @@ if is_maemo(): hildon.Window.__init__(self) self.set_resizable(False) self.set_border_width(0) - self.vbox = gtk.VBox() + self.vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) self.vbox.set_border_width(0) - self.vbox.set_spacing(0) else: class UmitScanWindow(HIGMainWindow): def __init__(self): HIGMainWindow.__init__(self) - self.vbox = gtk.VBox() + self.vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) def can_print(): """Return true if we have printing operations (PyGTK 2.10 or later) or false otherwise.""" try: - gtk.PrintOperation + Gtk.PrintOperation except AttributeError: return False else: @@ -140,7 +140,7 @@ class ScanWindow(UmitScanWindow): self.scan_interface = ScanInterface() - self.main_accel_group = gtk.AccelGroup() + self.main_accel_group = Gtk.AccelGroup() self.add_accel_group(self.main_accel_group) @@ -158,12 +158,12 @@ class ScanWindow(UmitScanWindow): def _create_ui_manager(self): """Creates the UI Manager and a default set of actions, and builds the menus using those actions.""" - self.ui_manager = gtk.UIManager() + self.ui_manager = Gtk.UIManager() # See info on ActionGroup at: # * http://www.pygtk.org/pygtk2reference/class-gtkactiongroup.html # * http://www.gtk.org/api/2.6/gtk/GtkActionGroup.html - self.main_action_group = gtk.ActionGroup('MainActionGroup') + self.main_action_group = Gtk.ActionGroup.new('MainActionGroup') # See info on Action at: # * http://www.pygtk.org/pygtk2reference/class-gtkaction.html @@ -177,39 +177,33 @@ class ScanWindow(UmitScanWindow): # _('Open the results of a previous scan'), # lambda x: True) - # gtk.STOCK_ABOUT is only available in PyGTK 2.6 and later. - try: - about_icon = gtk.STOCK_ABOUT - except AttributeError: - about_icon = None - self.main_actions = [ # Top level ('Scan', None, _('Sc_an'), None), ('Save Scan', - gtk.STOCK_SAVE, + Gtk.STOCK_SAVE, _('_Save Scan'), None, _('Save current scan results'), self._save_scan_results_cb), ('Save All Scans to Directory', - gtk.STOCK_SAVE, + Gtk.STOCK_SAVE, _('Save All Scans to _Directory'), "s", _('Save all scans into a directory'), self._save_to_directory_cb), ('Open Scan', - gtk.STOCK_OPEN, + Gtk.STOCK_OPEN, _('_Open Scan'), None, _('Open the results of a previous scan'), self._load_scan_results_cb), ('Append Scan', - gtk.STOCK_ADD, + Gtk.STOCK_ADD, _('_Open Scan in This Window'), None, _('Append a saved scan to the list of scans in this window.'), @@ -219,56 +213,56 @@ class ScanWindow(UmitScanWindow): ('Tools', None, _('_Tools'), None), ('New Window', - gtk.STOCK_NEW, + Gtk.STOCK_NEW, _('_New Window'), "N", _('Open a new scan window'), self._new_scan_cb), ('Close Window', - gtk.STOCK_CLOSE, + Gtk.STOCK_CLOSE, _('Close Window'), "w", _('Close this scan window'), self._exit_cb), ('Print...', - gtk.STOCK_PRINT, + Gtk.STOCK_PRINT, _('Print...'), None, _('Print the current scan'), self._print_cb), ('Quit', - gtk.STOCK_QUIT, + Gtk.STOCK_QUIT, _('Quit'), "q", _('Quit the application'), self._quit_cb), ('New Profile', - gtk.STOCK_JUSTIFY_LEFT, + Gtk.STOCK_JUSTIFY_LEFT, _('New _Profile or Command'), 'p', _('Create a new scan profile using the current command'), self._new_scan_profile_cb), ('Search Scan', - gtk.STOCK_FIND, + Gtk.STOCK_FIND, _('Search Scan Results'), 'f', _('Search for a scan result'), self._search_scan_result), ('Filter Hosts', - gtk.STOCK_FIND, + Gtk.STOCK_FIND, _('Filter Hosts'), 'l', _('Search for host by criteria'), self._filter_cb), ('Edit Profile', - gtk.STOCK_PROPERTIES, + Gtk.STOCK_PROPERTIES, _('_Edit Selected Profile'), 'e', _('Edit selected scan profile'), @@ -278,7 +272,7 @@ class ScanWindow(UmitScanWindow): ('Profile', None, _('_Profile'), None), ('Compare Results', - gtk.STOCK_DND_MULTIPLE, + Gtk.STOCK_DND_MULTIPLE, _('Compare Results'), "D", _('Compare Scan Results using Diffies'), @@ -289,7 +283,7 @@ class ScanWindow(UmitScanWindow): ('Help', None, _('_Help'), None), ('Report a bug', - gtk.STOCK_DIALOG_INFO, + Gtk.STOCK_DIALOG_INFO, _('_Report a bug'), 'b', _("Report a bug"), @@ -297,7 +291,7 @@ class ScanWindow(UmitScanWindow): ), ('About', - about_icon, + Gtk.STOCK_ABOUT, _('_About'), None, _("About %s") % APP_DISPLAY_NAME, @@ -305,7 +299,7 @@ class ScanWindow(UmitScanWindow): ), ('Show Help', - gtk.STOCK_HELP, + Gtk.STOCK_HELP, _('_Help'), None, _('Shows the application help'), @@ -410,7 +404,7 @@ class ScanWindow(UmitScanWindow): log.debug(">>> Saving result into database...") try: scan_interface.inventory.save_to_db() - except Exception, e: + except Exception as e: alert = HIGAlertDialog( message_format=_("Can't save to database"), secondary_text=_("Can't store unsaved scans to the " @@ -445,7 +439,7 @@ class ScanWindow(UmitScanWindow): menubar = self.ui_manager.get_widget('/menubar') if is_maemo(): - menu = gtk.Menu() + menu = Gtk.Menu() for child in menubar.get_children(): child.reparent(menu) self.set_menu(menu) @@ -474,7 +468,7 @@ class ScanWindow(UmitScanWindow): filename = None response = self._results_filechooser_dialog.run() - if response == gtk.RESPONSE_OK: + if response == Gtk.ResponseType.OK: filename = self._results_filechooser_dialog.get_filename() elif response == RESPONSE_OPEN_DIRECTORY: filename = self._results_filechooser_dialog.get_filename() @@ -537,7 +531,7 @@ class ScanWindow(UmitScanWindow): try: # Parse result scan_interface.load_from_file(filename) - except Exception, e: + except Exception as e: alert = HIGAlertDialog(message_format=_('Error loading file'), secondary_text=str(e)) alert.run() @@ -596,20 +590,20 @@ class ScanWindow(UmitScanWindow): dlg = HIGDialog( title="Choose a scan to save", parent=self, - flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_SAVE, gtk.RESPONSE_OK)) - dlg.vbox.pack_start(gtk.Label( + flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_SAVE, Gtk.ResponseType.OK)) + dlg.vbox.pack_start(Gtk.Label.new( "You have %u scans loaded in the current view.\n" "Select the scan which you would like to save." % num_scans), - False) - scan_combo = gtk.combo_box_new_text() + False, True, 0) + scan_combo = Gtk.ComboBoxText() for scan in self.scan_interface.inventory.get_scans(): scan_combo.append_text(scan.nmap_command) scan_combo.set_active(0) - dlg.vbox.pack_start(scan_combo, False) + dlg.vbox.pack_start(scan_combo, False, True, 0) dlg.vbox.show_all() - if dlg.run() == gtk.RESPONSE_OK: + if dlg.run() == Gtk.ResponseType.OK: selected = scan_combo.get_active() dlg.destroy() else: @@ -627,7 +621,7 @@ class ScanWindow(UmitScanWindow): response = self._save_results_filechooser_dialog.run() filename = None - if (response == gtk.RESPONSE_OK): + if (response == Gtk.ResponseType.OK): filename = self._save_results_filechooser_dialog.get_filename() format = self._save_results_filechooser_dialog.get_format() # add .xml to filename if there is no other extension @@ -664,12 +658,12 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) # display a directory chooser dialog dir_chooser = SaveToDirectoryChooserDialog( title=_("Choose a directory to save scans into")) - if dir_chooser.run() == gtk.RESPONSE_OK: + if dir_chooser.run() == Gtk.ResponseType.OK: self._save_all(self.scan_interface, dir_chooser.get_filename()) dir_chooser.destroy() def _about_cb_response(self, dialog, response_id): - if response_id == gtk.RESPONSE_DELETE_EVENT: + if response_id == Gtk.ResponseType.DELETE_EVENT: self._about_dialog = None else: self._about_dialog.hide() @@ -687,7 +681,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) filenames = scan_interface.inventory.save_to_dir(directory) for scan in scan_interface.inventory.get_scans(): scan.unsaved = False - except Exception, ex: + except Exception as ex: alert = HIGAlertDialog(message_format=_('Can\'t save file'), secondary_text=str(ex)) alert.run() @@ -700,7 +694,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) for filename in filenames: recent_scans.add_recent_scan(filename) recent_scans.save() - except (OSError, IOError), e: + except (OSError, IOError) as e: alert = HIGAlertDialog( message_format=_( "Can't save recent scan information"), @@ -718,7 +712,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) scan_interface.inventory.save_to_file( saved_filename, selected_index, format) scan_interface.inventory.get_scans()[selected_index].unsaved = False # noqa - except (OSError, IOError), e: + except (OSError, IOError) as e: alert = HIGAlertDialog( message_format=_("Can't save file"), secondary_text=_("Can't open file to write.\n%s") % str(e)) @@ -735,7 +729,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) try: recent_scans.add_recent_scan(saved_filename) recent_scans.save() - except (OSError, IOError), e: + except (OSError, IOError) as e: alert = HIGAlertDialog( message_format=_( "Can't save recent scan information"), @@ -772,7 +766,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) pe.show_all() def _help_cb(self, action): - show_help() + self.show_help() def _exit_cb(self, *args): """Closes the window, prompting for confirmation if necessary. If one @@ -781,9 +775,9 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) if self.scan_interface.changed: log.debug("Found changes on closing window") dialog = HIGDialog( - buttons=(_('Close anyway').encode('utf-8'), - gtk.RESPONSE_CLOSE, gtk.STOCK_CANCEL, - gtk.RESPONSE_CANCEL)) + buttons=(_('Close anyway'), + Gtk.ResponseType.CLOSE, Gtk.STOCK_CANCEL, + Gtk.ResponseType.CANCEL)) alert = HIGEntryLabel('%s' % _("Unsaved changes")) @@ -797,22 +791,22 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) vbox.set_border_width(5) vbox.set_spacing(12) - image = gtk.Image() + image = Gtk.Image() image.set_from_stock( - gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG) + Gtk.STOCK_DIALOG_QUESTION, Gtk.IconSize.DIALOG) - vbox.pack_start(alert) - vbox.pack_start(text) - hbox.pack_start(image) - hbox.pack_start(vbox) + vbox.pack_start(alert, True, True, 0) + vbox.pack_start(text, True, True, 0) + hbox.pack_start(image, True, True, 0) + hbox.pack_start(vbox, True, True, 0) - dialog.vbox.pack_start(hbox) + dialog.vbox.pack_start(hbox, True, True, 0) dialog.vbox.show_all() response = dialog.run() dialog.destroy() - if response == gtk.RESPONSE_CANCEL: + if response == Gtk.ResponseType.CANCEL: return True search_config = SearchConfig() @@ -822,9 +816,9 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) elif self.scan_interface.num_scans_running() > 0: log.debug("Trying to close a window with a running scan") dialog = HIGDialog( - buttons=(_('Close anyway').encode('utf-8'), - gtk.RESPONSE_CLOSE, gtk.STOCK_CANCEL, - gtk.RESPONSE_CANCEL)) + buttons=(_('Close anyway'), + Gtk.ResponseType.CLOSE, Gtk.STOCK_CANCEL, + Gtk.ResponseType.CANCEL)) alert = HIGEntryLabel('%s' % _("Trying to close")) @@ -839,24 +833,24 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) vbox.set_border_width(5) vbox.set_spacing(12) - image = gtk.Image() + image = Gtk.Image() image.set_from_stock( - gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG) + Gtk.STOCK_DIALOG_WARNING, Gtk.IconSize.DIALOG) - vbox.pack_start(alert) - vbox.pack_start(text) - hbox.pack_start(image) - hbox.pack_start(vbox) + vbox.pack_start(alert, True, True, 0) + vbox.pack_start(text, True, True, 0) + hbox.pack_start(image, True, True, 0) + hbox.pack_start(vbox, True, True, 0) - dialog.vbox.pack_start(hbox) + dialog.vbox.pack_start(hbox, True, True, 0) dialog.vbox.show_all() response = dialog.run() dialog.destroy() - if response == gtk.RESPONSE_CLOSE: + if response == Gtk.ResponseType.CLOSE: self.scan_interface.kill_all_scans() - elif response == gtk.RESPONSE_CANCEL: + elif response == Gtk.ResponseType.CANCEL: return True window = WindowConfig() @@ -902,29 +896,26 @@ This scan has not been run yet. Start the scan with the "Scan" button first.')) self.diff_window.show_all() -def show_help(): - import urllib - import webbrowser + def show_help(self): + import urllib.request + import webbrowser - new = 0 - if sys.hexversion >= 0x2050000: - new = 2 + doc_path = abspath(join(Path.docs_dir, "help.html")) + url = "file:" + urllib.request.pathname2url(doc_path) - doc_path = abspath(join(Path.docs_dir, "help.html")) - url = "file:" + urllib.pathname2url(fs_enc(doc_path)) - try: - webbrowser.open(url, new=new) - except OSError, e: - d = HIGAlertDialog(parent=self, - message_format=_("Can't find documentation files"), - secondary_text=_("""\ + try: + webbrowser.open(url, new=2) + except OSError as e: + d = HIGAlertDialog(parent=self, + message_format=_("Can't find documentation files"), + secondary_text=_("""\ There was an error loading the documentation file %s (%s). See the \ online documentation at %s.\ -""") % (doc_path, unicode(e), APP_DOCUMENTATION_SITE)) - d.run() - d.destroy() +""") % (doc_path, str(e), APP_DOCUMENTATION_SITE)) + d.run() + d.destroy() if __name__ == '__main__': w = ScanWindow() w.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/NmapOutputProperties.py b/zenmap/zenmapGUI/NmapOutputProperties.py index ecaa8ccd2..a5fa6a8b5 100644 --- a/zenmap/zenmapGUI/NmapOutputProperties.py +++ b/zenmap/zenmapGUI/NmapOutputProperties.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,9 +57,10 @@ # * * # ***************************************************************************/ -import gtk -import gtk.gdk -import pango +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk import zenmapCore.I18N # lgtm[py/unused-import] from zenmapCore.UmitConf import NmapOutputHighlight @@ -76,7 +76,7 @@ from zenmapGUI.higwidgets.higbuttons import HIGButton, HIGToggleButton class NmapOutputProperties(HIGDialog): def __init__(self, nmap_output_view): HIGDialog.__init__(self, _("Nmap Output Properties"), - buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)) + buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)) self.nmap_highlight = NmapOutputHighlight() @@ -90,7 +90,7 @@ class NmapOutputProperties(HIGDialog): self.properties_notebook = HIGNotebook() def __pack_widgets(self): - self.vbox.pack_start(self.properties_notebook) + self.vbox.pack_start(self.properties_notebook, True, True, 0) def highlight_tab(self): # Creating highlight tab main box @@ -121,8 +121,8 @@ class NmapOutputProperties(HIGDialog): self.property_names[p].append(settings[0]) self.property_names[p].append(settings[1]) self.property_names[p].append(settings[2]) - self.property_names[p].append(gtk.gdk.Color(*settings[3])) - self.property_names[p].append(gtk.gdk.Color(*settings[4])) + self.property_names[p].append(Gdk.Color(*settings[3])) + self.property_names[p].append(Gdk.Color(*settings[4])) self.property_names[p].append(settings[5]) # Creating properties and related widgets and attaching it to main @@ -152,12 +152,12 @@ class NmapOutputProperties(HIGDialog): y2 += 1 # Packing main table into main vbox - self.highlight_main_vbox.pack_start(self.highlight_main_table) + self.highlight_main_vbox.pack_start(self.highlight_main_table, True, True, 0) # Adding color tab self.properties_notebook.append_page( self.highlight_main_vbox, - gtk.Label(_("Highlight definitions"))) + Gtk.Label.new(_("Highlight definitions"))) class HighlightProperty(object): @@ -180,13 +180,13 @@ class HighlightProperty(object): def __create_widgets(self): self.property_name_label = HIGEntryLabel("") self.example_label = HIGEntryLabel("") - self.bold_tg_button = HIGToggleButton("", gtk.STOCK_BOLD) - self.italic_tg_button = HIGToggleButton("", gtk.STOCK_ITALIC) - self.underline_tg_button = HIGToggleButton("", gtk.STOCK_UNDERLINE) + self.bold_tg_button = HIGToggleButton("", Gtk.STOCK_BOLD) + self.italic_tg_button = HIGToggleButton("", Gtk.STOCK_ITALIC) + self.underline_tg_button = HIGToggleButton("", Gtk.STOCK_UNDERLINE) self.text_color_button = HIGButton( - _("Text"), stock=gtk.STOCK_SELECT_COLOR) + _("Text"), stock=Gtk.STOCK_SELECT_COLOR) self.highlight_color_button = HIGButton( - _("Highlight"), stock=gtk.STOCK_SELECT_COLOR) + _("Highlight"), stock=Gtk.STOCK_SELECT_COLOR) def __connect_buttons(self): self.bold_tg_button.connect("toggled", self.update_example) @@ -201,13 +201,13 @@ class HighlightProperty(object): # Text color dialog def text_color_dialog(self, widget): - color_dialog = gtk.ColorSelectionDialog( + color_dialog = Gtk.ColorSelectionDialog.new( "%s %s" % (self.label, _("text color"))) - color_dialog.colorsel.set_current_color(self.text_color) + color_dialog.get_color_selection().set_current_color(self.text_color) - color_dialog.ok_button.connect( + color_dialog.props.ok_button.connect( "clicked", self.text_color_dialog_ok, color_dialog) - color_dialog.cancel_button.connect( + color_dialog.props.cancel_button.connect( "clicked", self.text_color_dialog_cancel, color_dialog) color_dialog.connect( "delete-event", self.text_color_dialog_close, color_dialog) @@ -215,7 +215,7 @@ class HighlightProperty(object): color_dialog.run() def text_color_dialog_ok(self, widget, color_dialog): - self.text_color = color_dialog.colorsel.get_current_color() + self.text_color = color_dialog.get_color_selection().get_current_color() color_dialog.destroy() self.update_example() @@ -228,13 +228,13 @@ class HighlightProperty(object): ######################################### # Highlight color dialog def highlight_color_dialog(self, widget): - color_dialog = gtk.ColorSelectionDialog( + color_dialog = Gtk.ColorSelectionDialog.new( "%s %s" % (self.property_name, _("highlight color"))) - color_dialog.colorsel.set_current_color(self.highlight_color) + color_dialog.get_color_selection().set_current_color(self.highlight_color) - color_dialog.ok_button.connect( + color_dialog.props.ok_button.connect( "clicked", self.highlight_color_dialog_ok, color_dialog) - color_dialog.cancel_button.connect( + color_dialog.props.cancel_button.connect( "clicked", self.highlight_color_dialog_cancel, color_dialog) color_dialog.connect( @@ -244,7 +244,7 @@ class HighlightProperty(object): color_dialog.run() def highlight_color_dialog_ok(self, widget, color_dialog): - self.highlight_color = color_dialog.colorsel.get_current_color() + self.highlight_color = color_dialog.get_color_selection().get_current_color() color_dialog.destroy() self.update_example() @@ -255,41 +255,23 @@ class HighlightProperty(object): color_dialog.destroy() def update_example(self, widget=None): - start = 0 - end = len(self.example) - - attributes = pango.AttrList() - - attributes.insert( - pango.AttrForeground(self.text_color.red, - self.text_color.green, self.text_color.blue, start, end)) - attributes.insert(pango.AttrBackground(self.highlight_color.red, - self.highlight_color.green, - self.highlight_color.blue, - start, end)) + label = self.example_label.get_text() # Bold verification if self.bold_tg_button.get_active(): - attributes.insert(pango.AttrWeight(pango.WEIGHT_HEAVY, start, end)) - else: - attributes.insert( - pango.AttrWeight(pango.WEIGHT_NORMAL, start, end)) + label = "" + label + "" # Italic verification if self.italic_tg_button.get_active(): - attributes.insert(pango.AttrStyle(pango.STYLE_ITALIC, start, end)) - else: - attributes.insert(pango.AttrStyle(pango.STYLE_NORMAL, start, end)) + label = "" + label + "" # Underline verification if self.underline_tg_button.get_active(): - attributes.insert( - pango.AttrUnderline(pango.UNDERLINE_SINGLE, start, end)) - else: - attributes.insert( - pango.AttrUnderline(pango.UNDERLINE_NONE, start, end)) + label = "" + label + "" - self.example_label.set_attributes(attributes) + self.example_label.modify_fg(Gtk.StateType.NORMAL, self.text_color) + self.example_label.modify_bg(Gtk.StateType.NORMAL, self.highlight_color) + self.example_label.set_markup(label) def show_bold(self, widget): self.example_label.set_markup("<>") @@ -339,4 +321,4 @@ class HighlightProperty(object): if __name__ == "__main__": n = NmapOutputProperties(None) n.run() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/NmapOutputViewer.py b/zenmap/zenmapGUI/NmapOutputViewer.py index 38016b0c3..aebb73a26 100644 --- a/zenmap/zenmapGUI/NmapOutputViewer.py +++ b/zenmap/zenmapGUI/NmapOutputViewer.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,10 +57,12 @@ # * * # ***************************************************************************/ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk, Pango, GLib + import gobject -import gtk -import gtk.gdk -import pango import re import zenmapCore.I18N # lgtm[py/unused-import] @@ -71,13 +72,13 @@ from zenmapCore.UmitConf import NmapOutputHighlight from zenmapGUI.NmapOutputProperties import NmapOutputProperties -class NmapOutputViewer (gtk.VBox): +class NmapOutputViewer(Gtk.Box): HIGHLIGHT_PROPERTIES = ["details", "date", "hostname", "ip", "port_list", "open_port", "closed_port", "filtered_port"] def __init__(self, refresh=1, stop=1): self.nmap_highlight = NmapOutputHighlight() - gtk.VBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) # Creating widgets self.__create_widgets() @@ -95,7 +96,7 @@ class NmapOutputViewer (gtk.VBox): self.refreshing = True # Adding widgets to the VBox - self.pack_start(self.scrolled, expand=True, fill=True) + self.pack_start(self.scrolled, True, True, 0) # The NmapCommand instance, if any, whose output is shown in this # display. @@ -105,17 +106,17 @@ class NmapOutputViewer (gtk.VBox): def __create_widgets(self): # Creating widgets - self.scrolled = gtk.ScrolledWindow() - self.text_view = gtk.TextView() + self.scrolled = Gtk.ScrolledWindow() + self.text_view = Gtk.TextView() def __set_scrolled_window(self): # Seting scrolled window self.scrolled.set_border_width(5) self.scrolled.add(self.text_view) - self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + self.scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) def __set_text_view(self): - self.text_view.set_wrap_mode(gtk.WRAP_WORD) + self.text_view.set_wrap_mode(Gtk.WrapMode.WORD) self.text_view.set_editable(False) self.tag_font = self.text_view.get_buffer().create_tag(None) @@ -125,29 +126,27 @@ class NmapOutputViewer (gtk.VBox): tag = self.text_view.get_buffer().create_tag(property) if settings[0]: - tag.set_property("weight", pango.WEIGHT_HEAVY) + tag.set_property("weight", Pango.Weight.HEAVY) else: - tag.set_property("weight", pango.WEIGHT_NORMAL) + tag.set_property("weight", Pango.Weight.NORMAL) if settings[1]: - tag.set_property("style", pango.STYLE_ITALIC) + tag.set_property("style", Pango.Style.ITALIC) else: - tag.set_property("style", pango.STYLE_NORMAL) + tag.set_property("style", Pango.Style.NORMAL) if settings[2]: - tag.set_property("underline", pango.UNDERLINE_SINGLE) + tag.set_property("underline", Pango.Underline.SINGLE) else: - tag.set_property("underline", pango.UNDERLINE_NONE) + tag.set_property("underline", Pango.Underline.NONE) text_color = settings[3] highlight_color = settings[4] tag.set_property( - "foreground", gtk.color_selection_palette_to_string( - [gtk.gdk.Color(*text_color), ])) + "foreground", Gdk.Color(*text_color).to_string()) tag.set_property( - "background", gtk.color_selection_palette_to_string( - [gtk.gdk.Color(*highlight_color), ])) + "background", Gdk.Color(*highlight_color).to_string()) def go_to_host(self, host): """Go to host line on nmap output result""" @@ -155,7 +154,7 @@ class NmapOutputViewer (gtk.VBox): start_iter = buff.get_start_iter() found_tuple = start_iter.forward_search( - "\nNmap scan report for %s\n" % host, gtk.TEXT_SEARCH_TEXT_ONLY + "\nNmap scan report for %s\n" % host, Gtk.TextSearchFlags.TEXT_ONLY ) if found_tuple is None: return @@ -219,7 +218,7 @@ class NmapOutputViewer (gtk.VBox): if not self.nmap_highlight.enable: return - text = buf.get_text(start_iter, end_iter) + text = buf.get_text(start_iter, end_iter, include_hidden_chars=True) for property in self.HIGHLIGHT_PROPERTIES: settings = self.nmap_highlight.__getattribute__(property) @@ -243,7 +242,7 @@ class NmapOutputViewer (gtk.VBox): The current output is extracted from the command object.""" self.command_execution = command if command is not None: - self.text_view.get_buffer().set_text(u"") + self.text_view.get_buffer().set_text("") self.output_file_pointer = 0 else: self.output_file_pointer = None @@ -297,7 +296,7 @@ class NmapOutputViewer (gtk.VBox): v_adj = self.scrolled.get_vadjustment() if new_output and v_adj is not None: # Find out if the view is already scrolled to the bottom. - at_end = (v_adj.value >= v_adj.upper - v_adj.page_size) + at_end = (v_adj.get_value() >= v_adj.get_upper() - v_adj.get_page_size()) buf = self.text_view.get_buffer() prev_end_mark = buf.create_mark( @@ -318,6 +317,6 @@ class NmapOutputViewer (gtk.VBox): # text causes a scroll bar to appear and reflow the text, # making the text a bit taller. self.text_view.scroll_mark_onscreen(self.end_mark) - gobject.idle_add( + GLib.idle_add( lambda: self.text_view.scroll_mark_onscreen( self.end_mark)) diff --git a/zenmap/zenmapGUI/OptionBuilder.py b/zenmap/zenmapGUI/OptionBuilder.py index 87ae12684..7ba397282 100644 --- a/zenmap/zenmapGUI/OptionBuilder.py +++ b/zenmap/zenmapGUI/OptionBuilder.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,8 +57,10 @@ # * * # ***************************************************************************/ -import gobject -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject # Prevent loading PyXML @@ -101,9 +102,9 @@ def get_option_check_auxiliary_widget(option, ops, check): assert False, "Unknown option %s" % option -class OptionEntry(gtk.Entry): +class OptionEntry(Gtk.Entry): def __init__(self, option, ops, check): - gtk.Entry.__init__(self) + Gtk.Entry.__init__(self) self.option = option self.ops = ops self.check = check @@ -121,18 +122,18 @@ class OptionEntry(gtk.Entry): def check_toggled_cb(self, check): if check.get_active(): - self.ops[self.option] = self.get_text().decode("UTF-8") + self.ops[self.option] = self.get_text() else: self.ops[self.option] = None def changed_cb(self, widget): self.check.set_active(True) - self.ops[self.option] = self.get_text().decode("UTF-8") + self.ops[self.option] = self.get_text() -class OptionExtras(gtk.Entry): +class OptionExtras(Gtk.Entry): def __init__(self, option, ops, check): - gtk.Entry.__init__(self) + Gtk.Entry.__init__(self) self.ops = ops self.check = check self.connect("changed", self.changed_cb) @@ -149,18 +150,19 @@ class OptionExtras(gtk.Entry): def check_toggled_cb(self, check): if check.get_active(): - self.ops.extras = [self.get_text().decode("UTF-8")] + self.ops.extras = [self.get_text()] else: self.ops.extras = [] def changed_cb(self, widget): self.check.set_active(True) - self.ops.extras = [self.get_text().decode("UTF-8")] + self.ops.extras = [self.get_text()] -class OptionLevel(gtk.SpinButton): +class OptionLevel(Gtk.SpinButton): def __init__(self, option, ops, check): - gtk.SpinButton.__init__(self, gtk.Adjustment(0, 0, 10, 1), 0.0, 0) + adjustment = Gtk.Adjustment.new(0, 0, 10, 1, 0, 0) + Gtk.SpinButton.__init__(self, adjustment=adjustment, climb_rate=0.0, digits=0) self.option = option self.ops = ops self.check = check @@ -188,22 +190,22 @@ class OptionLevel(gtk.SpinButton): self.ops[self.option] = int(self.get_adjustment().get_value()) -class OptionFile(gtk.HBox): +class OptionFile(Gtk.Box): __gsignals__ = { - "changed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()) + "changed": (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ()) } def __init__(self, option, ops, check): - gtk.HBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.option = option self.ops = ops self.check = check - self.entry = gtk.Entry() - self.pack_start(self.entry, True, True) - button = HIGButton(stock=gtk.STOCK_OPEN) - self.pack_start(button, False) + self.entry = Gtk.Entry() + self.pack_start(self.entry, True, True, 0) + button = HIGButton(stock=Gtk.STOCK_OPEN) + self.pack_start(button, False, True, 0) button.connect("clicked", self.clicked_cb) @@ -222,36 +224,36 @@ class OptionFile(gtk.HBox): def check_toggled_cb(self, check): if check.get_active(): - self.ops[self.option] = self.entry.get_text().decode("UTF-8") + self.ops[self.option] = self.entry.get_text() else: self.ops[self.option] = None def changed_cb(self, widget): self.check.set_active(True) - self.ops[self.option] = self.entry.get_text().decode("UTF-8") + self.ops[self.option] = self.entry.get_text() def clicked_cb(self, button): dialog = AllFilesFileChooserDialog(_("Choose file")) - if dialog.run() == gtk.RESPONSE_OK: + if dialog.run() == Gtk.ResponseType.OK: self.entry.set_text(dialog.get_filename()) dialog.destroy() -class TargetEntry(gtk.Entry): +class TargetEntry(Gtk.Entry): def __init__(self, ops): - gtk.Entry.__init__(self) + Gtk.Entry.__init__(self) self.ops = ops self.connect("changed", self.changed_cb) self.update() def update(self): - self.set_text(u" ".join(self.ops.target_specs)) + self.set_text(" ".join(self.ops.target_specs)) def changed_cb(self, widget): self.ops.target_specs = self.get_targets() def get_targets(self): - return split_quoted(self.get_text().decode("UTF-8")) + return split_quoted(self.get_text()) class OptionTab(object): @@ -275,29 +277,29 @@ class OptionTab(object): self.widgets_list.append(widget) def __parse_target(self, target_element): - label = _(target_element.getAttribute(u'label')) + label = _(target_element.getAttribute('label')) label_widget = HIGEntryLabel(label) target_widget = TargetEntry(self.ops) target_widget.connect("changed", self.update_target) return label_widget, target_widget def __parse_option_list(self, option_list_element): - children = option_list_element.getElementsByTagName(u'option') + children = option_list_element.getElementsByTagName('option') label_widget = HIGEntryLabel( - _(option_list_element.getAttribute(u'label'))) + _(option_list_element.getAttribute('label'))) option_list_widget = OptionList(self.ops) for child in children: - option = child.getAttribute(u'option') - argument = child.getAttribute(u'argument') - label = _(child.getAttribute(u'label')) + option = child.getAttribute('option') + argument = child.getAttribute('argument') + label = _(child.getAttribute('label')) option_list_widget.append(option, argument, label) self.profilehelp.add_label(option, label) self.profilehelp.add_shortdesc( - option, _(child.getAttribute(u'short_desc'))) + option, _(child.getAttribute('short_desc'))) self.profilehelp.add_example( - option, child.getAttribute(u'example')) + option, child.getAttribute('example')) option_list_widget.update() @@ -306,10 +308,10 @@ class OptionTab(object): return label_widget, option_list_widget def __parse_option_check(self, option_check): - option = option_check.getAttribute(u'option') - label = _(option_check.getAttribute(u'label')) - short_desc = _(option_check.getAttribute(u'short_desc')) - example = option_check.getAttribute(u'example') + option = option_check.getAttribute('option') + label = _(option_check.getAttribute('label')) + short_desc = _(option_check.getAttribute('short_desc')) + example = option_check.getAttribute('example') self.profilehelp.add_label(option, label) self.profilehelp.add_shortdesc(option, short_desc) @@ -331,7 +333,7 @@ class OptionTab(object): return check, auxiliary_widget def fill_table(self, table, expand_fill=True): - yopt = (0, gtk.EXPAND | gtk.FILL)[expand_fill] + yopt = (0, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL)[expand_fill] for y, widget in enumerate(self.widgets_list): if widget[1] is None: table.attach(widget[0], 0, 2, y, y + 1, yoptions=yopt) @@ -427,12 +429,12 @@ class OptionBuilder(object): dic = {} for group in self.groups: grp = self.xml.getElementsByTagName(group)[0] - dic[group] = grp.getAttribute(u'label') + dic[group] = grp.getAttribute('label') return dic def __parse_groups(self): - return [g_name.getAttribute(u'name') for g_name in - self.xml.getElementsByTagName(u'groups')[0].getElementsByTagName(u'group')] # noqa + return [g_name.getAttribute('name') for g_name in + self.xml.getElementsByTagName('groups')[0].getElementsByTagName('group')] # noqa def __parse_tabs(self): dic = {} @@ -448,14 +450,14 @@ class OptionBuilder(object): return dic -class OptionList(gtk.ComboBox): +class OptionList(Gtk.ComboBox): def __init__(self, ops): self.ops = ops - self.list = gtk.ListStore(str, str, str) - gtk.ComboBox.__init__(self, self.list) + self.list = Gtk.ListStore.new([str, str, str]) + Gtk.ComboBox.__init__(self, model=self.list) - cell = gtk.CellRendererText() + cell = Gtk.CellRendererText() self.pack_start(cell, True) self.add_attribute(cell, 'text', 2) @@ -487,12 +489,12 @@ class OptionList(gtk.ComboBox): self.options.append(option) -class OptionCheck(gtk.CheckButton): +class OptionCheck(Gtk.CheckButton): def __init__(self, option, label): opt = label if option is not None and option != "": opt += " (%s)" % option - gtk.CheckButton.__init__(self, opt, use_underline=False) + Gtk.CheckButton.__init__(self, label=opt, use_underline=False) self.option = option diff --git a/zenmap/zenmapGUI/Print.py b/zenmap/zenmapGUI/Print.py index 0475ecf6e..574a0200e 100644 --- a/zenmap/zenmapGUI/Print.py +++ b/zenmap/zenmapGUI/Print.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -71,15 +70,17 @@ # Add options to the print dialog to control the font, coloring, and anything # else. This might go in a separate Print Setup dialog. -import gtk -import gobject -import pango +import gi -MONOSPACE_FONT_DESC = pango.FontDescription("Monospace 12") +gi.require_version("Gtk", "3.0") +gi.require_version("PangoCairo", "1.0") +from gi.repository import Gtk, GLib, Pango, PangoCairo + +MONOSPACE_FONT_DESC = Pango.FontDescription("Monospace 12") -class PrintState (object): - """This is the userdatum passed to gtk.PrintOperation callbacks.""" +class PrintState(object): + """This is the userdatum passed to Gtk.PrintOperation callbacks.""" def __init__(self, inventory, entry): """entry is a ScansListStoreEntry.""" @@ -90,7 +91,7 @@ class PrintState (object): # Still running, failed, or cancelled. output = entry.command.get_output() if not output: - output = u"\n" + output = "\n" self.lines = output.splitlines() def begin_print(self, op, context): @@ -98,14 +99,14 @@ class PrintState (object): # Typeset a dummy line to get the exact line height. layout = context.create_pango_layout() layout.set_font_description(MONOSPACE_FONT_DESC) - layout.set_text("dummy") + layout.set_text("dummy", -1) line = layout.get_line(0) - # get_extents()[1][3] is the height of the logical rectangle. - line_height = line.get_extents()[1][3] / float(pango.SCALE) + # get_extents()[1].height is the height of the logical rectangle. + line_height = line.get_extents()[1].height / Pango.SCALE page_height = context.get_height() self.lines_per_page = int(page_height / line_height) - op.set_n_pages((len(self.lines) - 1) / self.lines_per_page + 1) + op.set_n_pages((len(self.lines) - 1) // self.lines_per_page + 1) def draw_page(self, op, context, page_nr): this_page_lines = self.lines[ @@ -115,21 +116,21 @@ class PrintState (object): # Do no wrapping. layout.set_width(-1) layout.set_font_description(MONOSPACE_FONT_DESC) - text = "\n".join(this_page_lines).encode("utf8") - layout.set_text(text) + text = "\n".join(this_page_lines) + layout.set_text(text, -1) cr = context.get_cairo_context() - cr.show_layout(layout) + PangoCairo.show_layout(cr, layout) def run_print_operation(inventory, entry): - op = gtk.PrintOperation() + op = Gtk.PrintOperation() state = PrintState(inventory, entry) op.connect("begin-print", state.begin_print) op.connect("draw-page", state.draw_page) try: - op.run(gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG, None) - except gobject.GError: + op.run(Gtk.PrintOperationAction.PRINT_DIALOG, None) + except GLib.GError: # Canceling the print operation can result in the error # GError: Error from StartDoc # http://seclists.org/nmap-dev/2012/q4/161 diff --git a/zenmap/zenmapGUI/ProfileCombo.py b/zenmap/zenmapGUI/ProfileCombo.py index 0cd1a2fbe..0a3697e02 100644 --- a/zenmap/zenmapGUI/ProfileCombo.py +++ b/zenmap/zenmapGUI/ProfileCombo.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,31 +57,31 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapCore.UmitConf import CommandProfile import zenmapCore.I18N # lgtm[py/unused-import] -class ProfileCombo(gtk.ComboBoxEntry, object): +class ProfileCombo(Gtk.ComboBoxText, object): def __init__(self): - gtk.ComboBoxEntry.__init__(self, gtk.ListStore(str), 0) + Gtk.ComboBoxText.__init__(self, has_entry=True) - self.completion = gtk.EntryCompletion() - self.child.set_completion(self.completion) + self.completion = Gtk.EntryCompletion() + self.get_child().set_completion(self.completion) self.completion.set_model(self.get_model()) self.completion.set_text_column(0) self.update() def set_profiles(self, profiles): - list = self.get_model() - for i in range(len(list)): - iter = list.get_iter_root() - del(list[iter]) + self.remove_all() for command in profiles: - list.append([command]) + self.append_text(command) def update(self): profile = CommandProfile() @@ -93,18 +92,19 @@ class ProfileCombo(gtk.ComboBoxEntry, object): self.set_profiles(profiles) def get_selected_profile(self): - return self.child.get_text() + return self.get_child().get_text() def set_selected_profile(self, profile): - self.child.set_text(profile) + self.get_child().set_text(profile) selected_profile = property(get_selected_profile, set_selected_profile) if __name__ == "__main__": - w = gtk.Window() + w = Gtk.Window() p = ProfileCombo() p.update() w.add(p) - w.show_all() - gtk.main() + w.connect("delete-event", lambda x, y: Gtk.main_quit()) + w.show_all() + Gtk.main() diff --git a/zenmap/zenmapGUI/ProfileEditor.py b/zenmap/zenmapGUI/ProfileEditor.py index e300132eb..d38a897b7 100644 --- a/zenmap/zenmapGUI/ProfileEditor.py +++ b/zenmap/zenmapGUI/ProfileEditor.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.higwidgets.higwindows import HIGWindow from zenmapGUI.higwidgets.higboxes import HIGVBox, HIGHBox, HIGSpacer, \ @@ -83,7 +85,7 @@ class ProfileEditor(HIGWindow): HIGWindow.__init__(self) self.connect("delete_event", self.exit) self.set_title(_('Profile Editor')) - self.set_position(gtk.WIN_POS_CENTER) + self.set_position(Gtk.WindowPosition.CENTER) self.deletable = deletable self.profile_name = profile_name @@ -130,7 +132,7 @@ class ProfileEditor(HIGWindow): self.update_command() def command_entry_changed_cb(self, widget): - command_string = self.command_entry.get_text().decode("UTF-8") + command_string = self.command_entry.get_text() self.ops.parse_string(command_string) self.inhibit_command_update = True self.option_builder.update() @@ -167,20 +169,21 @@ class ProfileEditor(HIGWindow): self.lower_box = HIGHBox() #self.main_vbox = HIGVBox() - self.command_entry = gtk.Entry() + self.command_entry = Gtk.Entry() self.command_entry_changed_cb_id = self.command_entry.connect( "changed", self.command_entry_changed_cb) self.scan_button = HIGButton(_("Scan")) self.scan_button.connect("clicked", self.run_scan) - self.notebook = gtk.Notebook() + self.notebook = Gtk.Notebook() # Profile info page self.profile_info_vbox = HIGVBox() self.profile_info_label = HIGSectionLabel(_('Profile Information')) self.profile_name_label = HIGEntryLabel(_('Profile name')) - self.profile_name_entry = gtk.Entry() + self.profile_name_label.set_line_wrap(False) + self.profile_name_entry = Gtk.Entry() self.profile_name_entry.connect( 'enter-notify-event', self.update_help_name) self.profile_description_label = HIGEntryLabel(_('Description')) @@ -193,13 +196,13 @@ class ProfileEditor(HIGWindow): # Buttons self.buttons_hbox = HIGHBox() - self.cancel_button = HIGButton(stock=gtk.STOCK_CANCEL) + self.cancel_button = HIGButton(stock=Gtk.STOCK_CANCEL) self.cancel_button.connect('clicked', self.exit) - self.delete_button = HIGButton(stock=gtk.STOCK_DELETE) + self.delete_button = HIGButton(stock=Gtk.STOCK_DELETE) self.delete_button.connect('clicked', self.delete_profile) - self.save_button = HIGButton(_("Save Changes"), stock=gtk.STOCK_SAVE) + self.save_button = HIGButton(_("Save Changes"), stock=Gtk.STOCK_SAVE) self.save_button.connect('clicked', self.save_profile) ### @@ -228,7 +231,7 @@ class ProfileEditor(HIGWindow): self.middle_box._pack_expand_fill(self.help_vbox) # Packing buttons to lower box - self.lower_box.pack_end(self.buttons_hbox) + self.lower_box.pack_end(self.buttons_hbox, True, True, 0) # Packing the three vertical boxes to the main box self.main_whole_box._pack_noexpand_nofill(self.upper_box) @@ -238,7 +241,7 @@ class ProfileEditor(HIGWindow): # Packing profile information tab on notebook self.notebook.append_page( - self.profile_info_vbox, gtk.Label(_('Profile'))) + self.profile_info_vbox, Gtk.Label.new(_('Profile'))) self.profile_info_vbox.set_border_width(5) table = HIGTable() self.profile_info_vbox._pack_noexpand_nofill(self.profile_info_label) @@ -292,7 +295,7 @@ class ProfileEditor(HIGWindow): else: hbox = tab.get_hmain_box() vbox.pack_start(hbox, True, True, 0) - self.notebook.append_page(vbox, gtk.Label(tab_name)) + self.notebook.append_page(vbox, Gtk.Label.new(tab_name)) def save_profile(self, widget): if self.overwrite: @@ -314,7 +317,7 @@ class ProfileEditor(HIGWindow): buf = self.profile_description_text.get_buffer() description = buf.get_text( - buf.get_start_iter(), buf.get_end_iter()) + buf.get_start_iter(), buf.get_end_iter(), include_hidden_chars=True) try: self.profile.add_profile( @@ -347,11 +350,11 @@ class ProfileEditor(HIGWindow): def delete_profile(self, widget=None, extra=None): if self.deletable: - dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, - gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) + dialog = HIGDialog(buttons=(Gtk.STOCK_OK, Gtk.ResponseType.OK, + Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)) alert = HIGEntryLabel('' + _("Deleting Profile") + '') text = HIGEntryLabel(_( - 'Your profile is going to be deleted! ClickOk to continue, ' + 'Your profile is going to be deleted! Click Ok to continue, ' 'or Cancel to go back to Profile Editor.')) hbox = HIGHBox() hbox.set_border_width(5) @@ -361,21 +364,21 @@ class ProfileEditor(HIGWindow): vbox.set_border_width(5) vbox.set_spacing(12) - image = gtk.Image() + image = Gtk.Image() image.set_from_stock( - gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG) + Gtk.STOCK_DIALOG_WARNING, Gtk.IconSize.DIALOG) - vbox.pack_start(alert) - vbox.pack_start(text) - hbox.pack_start(image) - hbox.pack_start(vbox) + vbox.pack_start(alert, True, True, 0) + vbox.pack_start(text, True, True, 0) + hbox.pack_start(image, True, True, 0) + hbox.pack_start(vbox, True, True, 0) - dialog.vbox.pack_start(hbox) + dialog.vbox.pack_start(hbox, True, True, 0) dialog.vbox.show_all() response = dialog.run() dialog.destroy() - if response == gtk.RESPONSE_CANCEL: + if response == Gtk.ResponseType.CANCEL: return True self.profile.remove_profile(self.profile_name) @@ -383,7 +386,7 @@ class ProfileEditor(HIGWindow): self.destroy() def run_scan(self, widget=None): - command_string = self.command_entry.get_text().decode("UTF-8") + command_string = self.command_entry.get_text() self.scan_interface.command_toolbar.command = command_string self.scan_interface.start_scan_cb() self.exit() @@ -399,4 +402,4 @@ class ProfileEditor(HIGWindow): if __name__ == '__main__': p = ProfileEditor() p.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/ProfileHelp.py b/zenmap/zenmapGUI/ProfileHelp.py index 0d20d8d75..7781b68c4 100644 --- a/zenmap/zenmapGUI/ProfileHelp.py +++ b/zenmap/zenmapGUI/ProfileHelp.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapGUI/ScanHostDetailsPage.py b/zenmap/zenmapGUI/ScanHostDetailsPage.py index 0f39f3973..a63a5fd39 100644 --- a/zenmap/zenmapGUI/ScanHostDetailsPage.py +++ b/zenmap/zenmapGUI/ScanHostDetailsPage.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.higwidgets.higexpanders import HIGExpander from zenmapGUI.higwidgets.higboxes import HIGVBox, HIGHBox,\ @@ -121,21 +123,21 @@ class HostDetails(HIGVBox): self.set_comment(host.comment) def __create_widgets(self): - self.host_status_expander = gtk.Expander( + self.host_status_expander = Gtk.Expander.new( '' + _('Host Status') + '') - self.address_expander = gtk.Expander('' + _('Addresses') + '') - self.hostnames_expander = gtk.Expander('' + _('Hostnames') + '') - self.os_expander = gtk.Expander('' + _('Operating System') + '') - self.portsused_expander = gtk.Expander( + self.address_expander = Gtk.Expander.new('' + _('Addresses') + '') + self.hostnames_expander = Gtk.Expander.new('' + _('Hostnames') + '') + self.os_expander = Gtk.Expander.new('' + _('Operating System') + '') + self.portsused_expander = Gtk.Expander.new( '' + _('Ports used') + '') - self.osclass_expander = gtk.Expander('' + _('OS Classes') + '') - self.tcp_expander = gtk.Expander('' + _('TCP Sequence') + '') - self.ip_expander = gtk.Expander('' + _('IP ID Sequence') + '') - self.tcpts_expander = gtk.Expander( + self.osclass_expander = Gtk.Expander.new('' + _('OS Classes') + '') + self.tcp_expander = Gtk.Expander.new('' + _('TCP Sequence') + '') + self.ip_expander = Gtk.Expander.new('' + _('IP ID Sequence') + '') + self.tcpts_expander = Gtk.Expander.new( '' + _('TCP TS Sequence') + '') - self.comment_expander = gtk.Expander('' + _('Comments') + '') - self.os_image = gtk.Image() - self.vulnerability_image = gtk.Image() + self.comment_expander = Gtk.Expander.new('' + _('Comments') + '') + self.os_image = Gtk.Image() + self.vulnerability_image = Gtk.Image() # Host Status expander self.host_state_label = HIGEntryLabel(_('State:')) @@ -235,9 +237,9 @@ class HostDetails(HIGVBox): table.attach(self.lastboot_label, 0, 1, 6, 7) table.attach(self.info_lastboot_label, 1, 2, 6, 7) - table.attach(self.os_image, 2, 4, 0, 3, xoptions=1, yoptions=0) + table.attach(self.os_image, 2, 4, 0, 3, xoptions=Gtk.AttachOptions.EXPAND) table.attach( - self.vulnerability_image, 2, 4, 4, 7, xoptions=1, yoptions=0) + self.vulnerability_image, 2, 4, 4, 7, xoptions=Gtk.AttachOptions.EXPAND) table.set_col_spacing(1, 50) @@ -245,10 +247,10 @@ class HostDetails(HIGVBox): self._pack_noexpand_nofill(self.host_status_expander) def set_os_image(self, image): - self.os_image.set_from_stock(image, gtk.ICON_SIZE_DIALOG) + self.os_image.set_from_stock(image, Gtk.IconSize.DIALOG) def set_vulnerability_image(self, image): - self.vulnerability_image.set_from_stock(image, gtk.ICON_SIZE_DIALOG) + self.vulnerability_image.set_from_stock(image, Gtk.IconSize.DIALOG) def set_addresses(self, address): self.address_expander.set_use_markup(True) @@ -306,7 +308,7 @@ class HostDetails(HIGVBox): self.os_expander.set_use_markup(True) self.os_expander.set_expanded(True) table, hbox = self.create_table_hbox() - progress = gtk.ProgressBar() + progress = Gtk.ProgressBar() if 'accuracy' in os: progress.set_fraction(float(os['accuracy']) / 100.0) @@ -375,7 +377,7 @@ class HostDetails(HIGVBox): table.attach(HIGEntryLabel(o['osfamily']), 2, 3, y1, y2) table.attach(HIGEntryLabel(o['osgen']), 3, 4, y1, y2) - progress = gtk.ProgressBar() + progress = Gtk.ProgressBar() progress.set_text(o['accuracy'] + '%') progress.set_fraction(float(o['accuracy']) / 100.0) table.attach(progress, 4, 5, y1, y2) @@ -389,7 +391,7 @@ class HostDetails(HIGVBox): self.tcp_expander.set_use_markup(True) table, hbox = self.create_table_hbox() - combo = gtk.combo_box_new_text() + combo = Gtk.ComboBoxText() for v in tcpseq['values'].split(','): combo.append_text(v) @@ -410,7 +412,7 @@ class HostDetails(HIGVBox): self.ip_expander.set_use_markup(True) table, hbox = self.create_table_hbox() - combo = gtk.combo_box_new_text() + combo = Gtk.ComboBoxText() for i in ipseq['values'].split(','): combo.append_text(i) @@ -429,7 +431,7 @@ class HostDetails(HIGVBox): self.tcpts_expander.set_use_markup(True) table, hbox = self.create_table_hbox() - combo = gtk.combo_box_new_text() + combo = Gtk.ComboBoxText() for i in tcptsseq['values'].split(','): combo.append_text(i) @@ -450,13 +452,13 @@ class HostDetails(HIGVBox): hbox = HIGHBox() - self.comment_scrolled = gtk.ScrolledWindow() + self.comment_scrolled = Gtk.ScrolledWindow() self.comment_scrolled.set_border_width(5) self.comment_scrolled.set_policy( - gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) - self.comment_txt_vw = gtk.TextView() - self.comment_txt_vw.set_wrap_mode(gtk.WRAP_WORD) + self.comment_txt_vw = Gtk.TextView() + self.comment_txt_vw.set_wrap_mode(Gtk.WrapMode.WORD) self.comment_txt_vw.get_buffer().set_text(comment) self.comment_scrolled.add(self.comment_txt_vw) diff --git a/zenmap/zenmapGUI/ScanHostsView.py b/zenmap/zenmapGUI/ScanHostsView.py index ca82b19f7..a8ce802cd 100644 --- a/zenmap/zenmapGUI/ScanHostsView.py +++ b/zenmap/zenmapGUI/ScanHostsView.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.higwidgets.higboxes import HIGVBox from zenmapGUI.Icons import get_os_icon @@ -71,14 +73,16 @@ def treemodel_get_addrs_for_sort(model, iter): # Used to sort hosts by address. -def cmp_treemodel_addr(model, iter_a, iter_b): +def cmp_treemodel_addr(model, iter_a, iter_b, *_): + def cmp(a, b): + return (a > b) - (a < b) addrs_a = treemodel_get_addrs_for_sort(model, iter_a) addrs_b = treemodel_get_addrs_for_sort(model, iter_b) return cmp(addrs_a, addrs_b) -class ScanHostsView(HIGVBox, object): - HOST_MODE, SERVICE_MODE = range(2) +class ScanHostsView(HIGVBox): + HOST_MODE, SERVICE_MODE = list(range(2)) def __init__(self, scan_interface): HIGVBox.__init__(self) @@ -103,31 +107,31 @@ class ScanHostsView(HIGVBox, object): def _create_widgets(self): # Mode buttons - self.host_mode_button = gtk.ToggleButton(_("Hosts")) - self.service_mode_button = gtk.ToggleButton(_("Services")) - self.buttons_box = gtk.HBox() + self.host_mode_button = Gtk.ToggleButton.new_with_label(_("Hosts")) + self.service_mode_button = Gtk.ToggleButton.new_with_label(_("Services")) + self.buttons_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) # Main window vbox self.main_vbox = HIGVBox() # Host list - self.host_list = gtk.ListStore(object, str, str) + self.host_list = Gtk.ListStore.new([object, str, str]) self.host_list.set_sort_func(1000, cmp_treemodel_addr) - self.host_list.set_sort_column_id(1000, gtk.SORT_ASCENDING) - self.host_view = gtk.TreeView(self.host_list) - self.pic_column = gtk.TreeViewColumn(_('OS')) - self.host_column = gtk.TreeViewColumn(_('Host')) - self.os_cell = gtk.CellRendererPixbuf() - self.host_cell = gtk.CellRendererText() + self.host_list.set_sort_column_id(1000, Gtk.SortType.ASCENDING) + self.host_view = Gtk.TreeView.new_with_model(self.host_list) + self.pic_column = Gtk.TreeViewColumn(title=_('OS')) + self.host_column = Gtk.TreeViewColumn(title=_('Host')) + self.os_cell = Gtk.CellRendererPixbuf() + self.host_cell = Gtk.CellRendererText() # Service list - self.service_list = gtk.ListStore(str) - self.service_list.set_sort_column_id(0, gtk.SORT_ASCENDING) - self.service_view = gtk.TreeView(self.service_list) - self.service_column = gtk.TreeViewColumn(_('Service')) - self.service_cell = gtk.CellRendererText() + self.service_list = Gtk.ListStore.new([str]) + self.service_list.set_sort_column_id(0, Gtk.SortType.ASCENDING) + self.service_view = Gtk.TreeView.new_with_model(self.service_list) + self.service_column = Gtk.TreeViewColumn(title=_('Service')) + self.service_cell = Gtk.CellRendererText() - self.scrolled = gtk.ScrolledWindow() + self.scrolled = Gtk.ScrolledWindow() def _pack_widgets(self): self.main_vbox.set_spacing(0) @@ -138,8 +142,8 @@ class ScanHostsView(HIGVBox, object): self.host_mode_button.set_active(True) self.buttons_box.set_border_width(5) - self.buttons_box.pack_start(self.host_mode_button) - self.buttons_box.pack_start(self.service_mode_button) + self.buttons_box.pack_start(self.host_mode_button, True, True, 0) + self.buttons_box.pack_start(self.service_mode_button, True, True, 0) def _connect_widgets(self): self.host_mode_button.connect("toggled", self.host_mode) @@ -173,14 +177,14 @@ class ScanHostsView(HIGVBox, object): def _set_scrolled(self): self.scrolled.set_border_width(5) self.scrolled.set_size_request(150, -1) - self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + self.scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) def _set_service_list(self): self.service_view.set_enable_search(True) self.service_view.set_search_column(0) selection = self.service_view.get_selection() - selection.set_mode(gtk.SELECTION_MULTIPLE) + selection.set_mode(Gtk.SelectionMode.MULTIPLE) self.service_view.append_column(self.service_column) self.service_column.set_resizable(True) @@ -194,7 +198,7 @@ class ScanHostsView(HIGVBox, object): self.host_view.set_search_column(1) selection = self.host_view.get_selection() - selection.set_mode(gtk.SELECTION_MULTIPLE) + selection.set_mode(Gtk.SelectionMode.MULTIPLE) self.host_view.append_column(self.pic_column) self.host_view.append_column(self.host_column) @@ -228,7 +232,7 @@ class ScanHostsView(HIGVBox, object): # Treeview?" sort_column_id = self.host_list.get_sort_column_id() self.host_list.set_default_sort_func(lambda *args: -1) - self.host_list.set_sort_column_id(-1, gtk.SORT_ASCENDING) + self.host_list.set_sort_column_id(-1, Gtk.SortType.ASCENDING) self.host_view.freeze_child_notify() self.host_view.set_model(None) @@ -275,8 +279,10 @@ class ScanHostsView(HIGVBox, object): self.service_list.append([service]) if __name__ == "__main__": - w = gtk.Window() + w = Gtk.Window() h = ScanHostsView(None) w.add(h) + + w.connect("delete-event", lambda x, y: Gtk.main_quit()) w.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/ScanInterface.py b/zenmap/zenmapGUI/ScanInterface.py index dace32fb1..1cc272518 100644 --- a/zenmap/zenmapGUI/ScanInterface.py +++ b/zenmap/zenmapGUI/ScanInterface.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,9 +57,12 @@ # * * # ***************************************************************************/ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GLib + import errno -import gtk -import gobject import os import time import sys @@ -220,19 +222,19 @@ class ScanInterface(HIGVBox): def filter_changed(self, filter_bar): # Restart the timer to start the filter. if self.filter_timeout_id: - gobject.source_remove(self.filter_timeout_id) - self.filter_timeout_id = gobject.timeout_add( + GLib.source_remove(self.filter_timeout_id) + self.filter_timeout_id = GLib.timeout_add( self.FILTER_DELAY, self.filter_hosts, filter_bar.get_filter_string()) def filter_hosts(self, filter_string): - start = time.clock() + start = time.perf_counter() self.inventory.apply_filter(filter_string) - filter_time = time.clock() - start + filter_time = time.perf_counter() - start # Update the gui - start = time.clock() + start = time.perf_counter() self.update_ui() - gui_time = time.clock() - start + gui_time = time.perf_counter() - start if filter_time + gui_time > 0.0: log.debug("apply_filter %g ms update_ui %g ms (%.0f%% filter)" % @@ -368,7 +370,7 @@ class ScanInterface(HIGVBox): if target != '': try: self.toolbar.add_new_target(target) - except IOError, e: + except IOError as e: # We failed to save target_list.txt; treat it as read-only. # Probably it's owned by root and this is a normal user. log.debug(">>> Error saving %s: %s" % ( @@ -381,7 +383,7 @@ class ScanInterface(HIGVBox): "Maybe the selected/typed profile doesn't exist. " "Please check the profile name or type the nmap " "command you would like to execute."), - type=gtk.MESSAGE_ERROR) + type=Gtk.MessageType.ERROR) warn_dialog.run() warn_dialog.destroy() return @@ -431,7 +433,7 @@ class ScanInterface(HIGVBox): pass # Create TreeRowReferences because those persist while we change # the model. - selected_refs.append(gtk.TreeRowReference(model, path)) + selected_refs.append(Gtk.TreeRowReference.new(model, path)) # Delete the entries from the ScansListStore. for ref in selected_refs: model.remove(model.get_iter(ref.get_path())) @@ -463,11 +465,11 @@ class ScanInterface(HIGVBox): completion.""" try: command_execution = NmapCommand(command) - except IOError, e: + except IOError as e: warn_dialog = HIGAlertDialog( message_format=_("Error building command"), secondary_text=_("Error message: %s") % str(e), - type=gtk.MESSAGE_ERROR) + type=Gtk.MessageType.ERROR) warn_dialog.run() warn_dialog.destroy() return @@ -475,8 +477,8 @@ class ScanInterface(HIGVBox): try: command_execution.run_scan() - except OSError, e: - text = unicode(e.strerror, errors='replace') + except OSError as e: + text = str(e.strerror, errors='replace') # Handle ENOENT specially. if e.errno == errno.ENOENT: # nmap_command_path comes from zenmapCore.NmapCommand. @@ -488,7 +490,7 @@ class ScanInterface(HIGVBox): if fsencoding: path_env = path_env.decode(fsencoding, 'replace') default_paths = path_env.split(os.pathsep) - text += u"\n\n{}\n\n{}".format( + text += "\n\n{}\n\n{}".format( _("This means that the nmap executable was " "not found in your system PATH, which is"), path_env or _("") @@ -498,23 +500,23 @@ class ScanInterface(HIGVBox): p not in default_paths)] if len(extra_paths) > 0: if len(extra_paths) == 1: - text += u"\n\n" + _("plus the extra directory") + text += "\n\n" + _("plus the extra directory") else: - text += u"\n\n" + _("plus the extra directories") - text += u"\n\n" + os.pathsep.join(extra_paths) + text += "\n\n" + _("plus the extra directories") + text += "\n\n" + os.pathsep.join(extra_paths) else: - text += u" (%d)" % e.errno + text += " (%d)" % e.errno warn_dialog = HIGAlertDialog( message_format=_("Error executing command"), - secondary_text=text, type=gtk.MESSAGE_ERROR) + secondary_text=text, type=Gtk.MessageType.ERROR) warn_dialog.run() warn_dialog.destroy() return - except Exception, e: + except Exception as e: warn_dialog = HIGAlertDialog( message_format=_("Error executing command"), - secondary_text=unicode(str(e), errors='replace'), - type=gtk.MESSAGE_ERROR) + secondary_text=str(e), + type=Gtk.MessageType.ERROR) warn_dialog.run() warn_dialog.destroy() return @@ -530,7 +532,7 @@ class ScanInterface(HIGVBox): self.scan_result.refresh_nmap_output() # Add a timeout function - self.verify_thread_timeout_id = gobject.timeout_add( + self.verify_thread_timeout_id = GLib.timeout_add( NMAP_OUTPUT_REFRESH_INTERVAL, self.verify_execution) def verify_execution(self): @@ -569,12 +571,12 @@ class ScanInterface(HIGVBox): parsed = NmapParser() try: parsed.parse_file(command.get_xml_output_filename()) - except IOError, e: + except IOError as e: # It's possible to run Nmap without generating an XML output file, # like with "nmap -V". if e.errno != errno.ENOENT: raise - except xml.sax.SAXParseException, e: + except xml.sax.SAXParseException as e: try: # Some options like --iflist cause Nmap to emit an empty XML # file. Ignore the exception in this case. @@ -587,7 +589,7 @@ class ScanInterface(HIGVBox): secondary_text=_( "There was an error while parsing the XML file " "generated from the scan:\n\n%s""") % str(e), - type=gtk.MESSAGE_ERROR) + type=Gtk.MessageType.ERROR) warn_dialog.run() warn_dialog.destroy() else: @@ -596,13 +598,13 @@ class ScanInterface(HIGVBox): self.scan_result.refresh_nmap_output() try: self.inventory.add_scan(parsed) - except Exception, e: + except Exception as e: warn_dialog = HIGAlertDialog( message_format=_("Cannot merge scan"), secondary_text=_( "There was an error while merging the new scan's " "XML:\n\n%s") % str(e), - type=gtk.MESSAGE_ERROR) + type=Gtk.MessageType.ERROR) warn_dialog.run() warn_dialog.destroy() parsed.set_xml_is_temp(command.xml_is_temp) @@ -864,20 +866,20 @@ class ScanInterface(HIGVBox): host_page.thaw() -class ScanResult(gtk.HPaned): +class ScanResult(Gtk.Paned): """This is the pane that has the "Host"/"Service" column (ScanHostsView) on the left and the "Nmap Output"/"Ports / Hosts"/etc. (ScanResultNotebook) on the right. It's the part of the interface below the toolbar.""" def __init__(self, inventory, scans_store, scan_interface=None): - gtk.HPaned.__init__(self) + Gtk.Paned.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.scan_host_view = ScanHostsView(scan_interface) self.scan_result_notebook = ScanResultNotebook(inventory, scans_store) - self.filter_toggle_button = gtk.ToggleButton(_("Filter Hosts")) + self.filter_toggle_button = Gtk.ToggleButton.new_with_label(_("Filter Hosts")) - vbox = gtk.VBox() - vbox.pack_start(self.scan_host_view, True, True) - vbox.pack_start(self.filter_toggle_button, False) + vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) + vbox.pack_start(self.scan_host_view, True, True, 0) + vbox.pack_start(self.filter_toggle_button, False, True, 0) self.pack1(vbox) self.pack2(self.scan_result_notebook, True, False) @@ -923,11 +925,11 @@ class ScanResultNotebook(HIGNotebook): self.scans_list.scans_list.connect( "row-activated", self._scan_row_activated) - self.append_page(self.nmap_output_page, gtk.Label(_('Nmap Output'))) - self.append_page(self.open_ports_page, gtk.Label(_('Ports / Hosts'))) - self.append_page(self.topology_page, gtk.Label(_('Topology'))) - self.append_page(self.host_details_page, gtk.Label(_('Host Details'))) - self.append_page(self.scans_list_page, gtk.Label(_('Scans'))) + self.append_page(self.nmap_output_page, Gtk.Label.new(_('Nmap Output'))) + self.append_page(self.open_ports_page, Gtk.Label.new(_('Ports / Hosts'))) + self.append_page(self.topology_page, Gtk.Label.new(_('Topology'))) + self.append_page(self.host_details_page, Gtk.Label.new(_('Host Details'))) + self.append_page(self.scans_list_page, Gtk.Label.new(_('Scans'))) def host_mode(self): self.open_ports.host.host_mode() @@ -948,7 +950,7 @@ class ScanResultNotebook(HIGNotebook): self.topology = TopologyPage(inventory) self.scans_list = ScanScanListPage(scans_store) - self.no_selected = gtk.Label(_('No host selected.')) + self.no_selected = Gtk.Label.new(_('No host selected.')) self.host_details = self.no_selected self.open_ports_page.add(self.open_ports) diff --git a/zenmap/zenmapGUI/ScanNmapOutputPage.py b/zenmap/zenmapGUI/ScanNmapOutputPage.py index 24a76b5b1..fdc031472 100644 --- a/zenmap/zenmapGUI/ScanNmapOutputPage.py +++ b/zenmap/zenmapGUI/ScanNmapOutputPage.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,9 +57,11 @@ # * * # ***************************************************************************/ -import gtk -import gobject -import pango +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject, GdkPixbuf, Pango + import os from zenmapGUI.higwidgets.higboxes import HIGHBox, HIGVBox @@ -74,14 +75,14 @@ import zenmapCore.I18N # lgtm[py/unused-import] def scan_entry_data_func(widget, cell_renderer, model, iter): """Set the properties of a cell renderer for a scan entry.""" - cell_renderer.set_property("ellipsize", pango.ELLIPSIZE_END) - cell_renderer.set_property("style", pango.STYLE_NORMAL) + cell_renderer.set_property("ellipsize", Pango.EllipsizeMode.END) + cell_renderer.set_property("style", Pango.Style.NORMAL) cell_renderer.set_property("strikethrough", False) entry = model.get_value(iter, 0) if entry is None: return if entry.running: - cell_renderer.set_property("style", pango.STYLE_ITALIC) + cell_renderer.set_property("style", Pango.Style.ITALIC) elif entry.finished: pass elif entry.failed or entry.canceled: @@ -89,21 +90,21 @@ def scan_entry_data_func(widget, cell_renderer, model, iter): cell_renderer.set_property("text", entry.get_command_string()) -class Throbber(gtk.Image): +class Throbber(Gtk.Image): """This is a little progress indicator that animates while a scan is running.""" try: - still = gtk.gdk.pixbuf_new_from_file( + still = GdkPixbuf.Pixbuf.new_from_file( os.path.join(Path.pixmaps_dir, "throbber.png")) - anim = gtk.gdk.PixbufAnimation( + anim = GdkPixbuf.PixbufAnimation( os.path.join(Path.pixmaps_dir, "throbber.gif")) - except Exception, e: + except Exception as e: log.debug("Error loading throbber images: %s." % str(e)) still = None anim = None def __init__(self): - gtk.Image.__init__(self) + Gtk.Image.__init__(self) self.set_from_pixbuf(self.still) self.animating = False @@ -127,7 +128,7 @@ class ScanNmapOutputPage(HIGVBox): the combo box selection changes.""" __gsignals__ = { - "changed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()) + "changed": (GObject.SignalFlags.RUN_FIRST, GObject.TYPE_NONE, ()) } def __init__(self, scans_store): @@ -140,8 +141,8 @@ class ScanNmapOutputPage(HIGVBox): hbox = HIGHBox() - self.scans_list = gtk.ComboBox(scans_store) - cell = gtk.CellRendererText() + self.scans_list = Gtk.ComboBox.new_with_model(scans_store) + cell = Gtk.CellRendererText() self.scans_list.pack_start(cell, True) self.scans_list.set_cell_data_func(cell, scan_entry_data_func) hbox._pack_expand_fill(self.scans_list) @@ -153,7 +154,7 @@ class ScanNmapOutputPage(HIGVBox): self.throbber = Throbber() hbox._pack_noexpand_nofill(self.throbber) - self.details_button = gtk.Button(_("Details")) + self.details_button = Gtk.Button.new_with_label(_("Details")) self.details_button.connect("clicked", self._show_details) hbox._pack_noexpand_nofill(self.details_button) @@ -227,7 +228,7 @@ class ScanNmapOutputPage(HIGVBox): if not entry.finished: return if self._details_windows.get(entry) is None: - window = gtk.Window() + window = Gtk.Window() window.add(ScanRunDetailsPage(entry.parsed)) def close_details(details, event, entry): diff --git a/zenmap/zenmapGUI/ScanOpenPortsPage.py b/zenmap/zenmapGUI/ScanOpenPortsPage.py index d8af50475..98f2e0d42 100644 --- a/zenmap/zenmapGUI/ScanOpenPortsPage.py +++ b/zenmap/zenmapGUI/ScanOpenPortsPage.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.higwidgets.higboxes import HIGVBox @@ -68,9 +70,9 @@ import zenmapCore.I18N # lgtm[py/unused-import] def findout_service_icon(port_info): if port_info["port_state"] in ["open", "open|filtered"]: - return gtk.STOCK_YES + return Gtk.STOCK_YES else: - return gtk.STOCK_NO + return Gtk.STOCK_NO def get_version_string(d): @@ -90,42 +92,44 @@ def get_version_string(d): def get_addrs(host): if host is None: - return None + return [] return host.get_addrs_for_sort() def cmp_addrs(host_a, host_b): + def cmp(a, b): + return (a > b) - (a < b) return cmp(get_addrs(host_a), get_addrs(host_b)) -def cmp_port_list_addr(model, iter_a, iter_b): +def cmp_port_list_addr(model, iter_a, iter_b, *_): host_a = model.get_value(iter_a, 0) host_b = model.get_value(iter_b, 0) return cmp_addrs(host_a, host_b) -def cmp_port_tree_addr(model, iter_a, iter_b): +def cmp_port_tree_addr(model, iter_a, iter_b, *_): host_a = model.get_value(iter_a, 0) host_b = model.get_value(iter_b, 0) return cmp_addrs(host_a, host_b) -def cmp_host_list_addr(model, iter_a, iter_b): +def cmp_host_list_addr(model, iter_a, iter_b, *_): host_a = model.get_value(iter_a, 2) host_b = model.get_value(iter_b, 2) return cmp_addrs(host_a, host_b) -def cmp_host_tree_addr(model, iter_a, iter_b): +def cmp_host_tree_addr(model, iter_a, iter_b, *_): host_a = model.get_value(iter_a, 2) host_b = model.get_value(iter_b, 2) return cmp_addrs(host_a, host_b) -class ScanOpenPortsPage(gtk.ScrolledWindow): +class ScanOpenPortsPage(Gtk.ScrolledWindow): def __init__(self): - gtk.ScrolledWindow.__init__(self) - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + Gtk.ScrolledWindow.__init__(self) + self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.__create_widgets() @@ -150,65 +154,65 @@ class HostOpenPorts(HIGVBox): # host hostname icon port protocol state service version # The hostname column is shown only when more than one host is selected # (hence port_tree not port_list is used). - self.port_list = gtk.ListStore( - object, str, str, int, str, str, str, str) - self.port_tree = gtk.TreeStore( - object, str, str, int, str, str, str, str) + self.port_list = Gtk.ListStore.new([ + object, str, str, int, str, str, str, str]) + self.port_tree = Gtk.TreeStore.new([ + object, str, str, int, str, str, str, str]) self.port_list.set_sort_func(1000, cmp_port_list_addr) - self.port_list.set_sort_column_id(1000, gtk.SORT_ASCENDING) + self.port_list.set_sort_column_id(1000, Gtk.SortType.ASCENDING) self.port_tree.set_sort_func(1000, cmp_port_tree_addr) - self.port_tree.set_sort_column_id(1000, gtk.SORT_ASCENDING) + self.port_tree.set_sort_column_id(1000, Gtk.SortType.ASCENDING) - self.port_view = gtk.TreeView(self.port_list) + self.port_view = Gtk.TreeView.new_with_model(self.port_list) - self.cell_icon = gtk.CellRendererPixbuf() - self.cell_port = gtk.CellRendererText() + self.cell_icon = Gtk.CellRendererPixbuf() + self.cell_port = Gtk.CellRendererText() - self.port_columns['hostname'] = gtk.TreeViewColumn(_('Host')) - self.port_columns['icon'] = gtk.TreeViewColumn('') - self.port_columns['port_number'] = gtk.TreeViewColumn(_('Port')) - self.port_columns['protocol'] = gtk.TreeViewColumn(_('Protocol')) - self.port_columns['state'] = gtk.TreeViewColumn(_('State')) - self.port_columns['service'] = gtk.TreeViewColumn(_('Service')) - self.port_columns['version'] = gtk.TreeViewColumn(_('Version')) + self.port_columns['hostname'] = Gtk.TreeViewColumn(title=_('Host')) + self.port_columns['icon'] = Gtk.TreeViewColumn(title='') + self.port_columns['port_number'] = Gtk.TreeViewColumn(title=_('Port')) + self.port_columns['protocol'] = Gtk.TreeViewColumn(title=_('Protocol')) + self.port_columns['state'] = Gtk.TreeViewColumn(title=_('State')) + self.port_columns['service'] = Gtk.TreeViewColumn(title=_('Service')) + self.port_columns['version'] = Gtk.TreeViewColumn(title=_('Version')) # Host services view self.host_columns = {} # service icon host hostname port protocol state version # service is shown only when more than one service is selected (hence # host_tree not host_list is used). - self.host_list = gtk.ListStore( - str, str, object, str, int, str, str, str) - self.host_tree = gtk.TreeStore( - str, str, object, str, int, str, str, str) + self.host_list = Gtk.ListStore.new([ + str, str, object, str, int, str, str, str]) + self.host_tree = Gtk.TreeStore.new([ + str, str, object, str, int, str, str, str]) self.host_list.set_sort_func(1000, cmp_host_list_addr) - self.host_list.set_sort_column_id(1000, gtk.SORT_ASCENDING) + self.host_list.set_sort_column_id(1000, Gtk.SortType.ASCENDING) self.host_tree.set_sort_func(1000, cmp_host_tree_addr) - self.host_tree.set_sort_column_id(1000, gtk.SORT_ASCENDING) + self.host_tree.set_sort_column_id(1000, Gtk.SortType.ASCENDING) - self.host_view = gtk.TreeView(self.host_list) + self.host_view = Gtk.TreeView.new_with_model(self.host_list) - self.cell_host_icon = gtk.CellRendererPixbuf() - self.cell_host = gtk.CellRendererText() + self.cell_host_icon = Gtk.CellRendererPixbuf() + self.cell_host = Gtk.CellRendererText() - self.host_columns['service'] = gtk.TreeViewColumn(_('Service')) - self.host_columns['icon'] = gtk.TreeViewColumn('') - self.host_columns['hostname'] = gtk.TreeViewColumn(_('Hostname')) - self.host_columns['protocol'] = gtk.TreeViewColumn(_('Protocol')) - self.host_columns['port_number'] = gtk.TreeViewColumn(_('Port')) - self.host_columns['state'] = gtk.TreeViewColumn(_('State')) - self.host_columns['version'] = gtk.TreeViewColumn(_('Version')) + self.host_columns['service'] = Gtk.TreeViewColumn(title=_('Service')) + self.host_columns['icon'] = Gtk.TreeViewColumn(title='') + self.host_columns['hostname'] = Gtk.TreeViewColumn(title=_('Hostname')) + self.host_columns['protocol'] = Gtk.TreeViewColumn(title=_('Protocol')) + self.host_columns['port_number'] = Gtk.TreeViewColumn(title=_('Port')) + self.host_columns['state'] = Gtk.TreeViewColumn(title=_('State')) + self.host_columns['version'] = Gtk.TreeViewColumn(title=_('Version')) - self.scroll_ports_hosts = gtk.ScrolledWindow() + self.scroll_ports_hosts = Gtk.ScrolledWindow() def _set_host_list(self): self.host_view.set_enable_search(True) self.host_view.set_search_column(2) selection = self.host_view.get_selection() - selection.set_mode(gtk.SELECTION_MULTIPLE) + selection.set_mode(Gtk.SelectionMode.MULTIPLE) columns = ["service", "icon", "hostname", "port_number", "protocol", "state", "version"] @@ -247,14 +251,14 @@ class HostOpenPorts(HIGVBox): self.host_columns['service'].set_visible(False) self.scroll_ports_hosts.set_policy( - gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) def _set_port_list(self): self.port_view.set_enable_search(True) self.port_view.set_search_column(3) selection = self.port_view.get_selection() - selection.set_mode(gtk.SELECTION_MULTIPLE) + selection.set_mode(Gtk.SelectionMode.MULTIPLE) self.port_view.append_column(self.port_columns['hostname']) self.port_view.append_column(self.port_columns['icon']) @@ -297,7 +301,7 @@ class HostOpenPorts(HIGVBox): self.port_columns['hostname'].set_visible(False) self.scroll_ports_hosts.set_policy( - gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) def port_mode(self): child = self.scroll_ports_hosts.get_child() @@ -425,28 +429,29 @@ class HostOpenPorts(HIGVBox): def clear_port_list(self): for i in range(len(self.port_list)): - iter = self.port_list.get_iter_root() + iter = self.port_list.get_iter_first() del(self.port_list[iter]) def clear_host_list(self): for i in range(len(self.host_list)): - iter = self.host_list.get_iter_root() + iter = self.host_list.get_iter_first() del(self.host_list[iter]) def clear_port_tree(self): for i in range(len(self.port_tree)): - iter = self.port_tree.get_iter_root() + iter = self.port_tree.get_iter_first() del(self.port_tree[iter]) def clear_host_tree(self): for i in range(len(self.host_tree)): - iter = self.host_tree.get_iter_root() + iter = self.host_tree.get_iter_first() del(self.host_tree[iter]) if __name__ == "__main__": - w = gtk.Window() + w = Gtk.Window() h = HostOpenPorts() w.add(h) - w.show_all() - gtk.main() + w.connect("delete-event", lambda x, y: Gtk.main_quit()) + w.show_all() + Gtk.main() diff --git a/zenmap/zenmapGUI/ScanRunDetailsPage.py b/zenmap/zenmapGUI/ScanRunDetailsPage.py index 9a217746e..fe9388ac3 100644 --- a/zenmap/zenmapGUI/ScanRunDetailsPage.py +++ b/zenmap/zenmapGUI/ScanRunDetailsPage.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,11 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + from zenmapGUI.higwidgets.higboxes import HIGVBox, HIGHBox,\ hig_box_space_holder from zenmapGUI.higwidgets.higtables import HIGTable @@ -86,7 +89,7 @@ class ScanRunDetailsPage(HIGVBox): self.debug_label = HIGEntryLabel(_('Debug level:')) self.info_debug_label = HIGEntryLabel(na) - self.command_expander = gtk.Expander( + self.command_expander = Gtk.Expander.new( "" + _("Command Info") + "") self.command_expander.set_use_markup(True) @@ -140,7 +143,7 @@ class ScanRunDetailsPage(HIGVBox): self.closed_label = HIGEntryLabel(_('Closed ports:')) self.info_closed_label = HIGEntryLabel(na) - self.general_expander = gtk.Expander( + self.general_expander = Gtk.Expander.new( "" + _("General Info") + "") self.general_expander.set_use_markup(True) @@ -202,7 +205,7 @@ class ScanRunDetailsPage(HIGVBox): self.info_closed_label.set_text(str(scan.get_closed_ports())) for scaninfo in scan.get_scaninfo(): - exp = gtk.Expander('%s - %s' % ( + exp = Gtk.Expander.new('%s - %s' % ( _('Scan Info'), scaninfo['type'].capitalize())) exp.set_use_markup(True) @@ -241,7 +244,7 @@ class ScanRunDetailsPage(HIGVBox): def make_services_display(self, services): """Return a widget displaying a list of services like 1-1027,1029-1033,1040,1043,1050,1058-1059,1067-1068,1076,1080""" - combo = gtk.combo_box_new_text() + combo = Gtk.ComboBoxText() for i in services.split(","): combo.append_text(i) @@ -256,8 +259,8 @@ if __name__ == "__main__": parsed = NmapParser() parsed.parse_file(filename) run_details = ScanRunDetailsPage(parsed) - window = gtk.Window() + window = Gtk.Window() window.add(run_details) - window.connect("delete-event", lambda *args: gtk.main_quit()) + window.connect("delete-event", lambda *args: Gtk.main_quit()) window.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/ScanScanListPage.py b/zenmap/zenmapGUI/ScanScanListPage.py index 1c28e61ed..6670c02bb 100644 --- a/zenmap/zenmapGUI/ScanScanListPage.py +++ b/zenmap/zenmapGUI/ScanScanListPage.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,8 +57,10 @@ # * * # ***************************************************************************/ -import gtk -import pango +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Pango from zenmapGUI.higwidgets.higboxes import HIGHBox, HIGVBox from zenmapGUI.higwidgets.higbuttons import HIGButton @@ -67,7 +68,7 @@ from zenmapGUI.higwidgets.higscrollers import HIGScrolledWindow import zenmapCore.I18N # lgtm[py/unused-import] -def status_data_func(widget, cell_renderer, model, iter): +def status_data_func(widget, cell_renderer, model, iter, data): entry = model.get_value(iter, 0) if entry.running: status = _("Running") @@ -83,9 +84,9 @@ def status_data_func(widget, cell_renderer, model, iter): cell_renderer.set_property("text", status) -def command_data_func(widget, cell_renderer, model, iter): +def command_data_func(widget, cell_renderer, model, iter, data): entry = model.get_value(iter, 0) - cell_renderer.set_property("ellipsize", pango.ELLIPSIZE_END) + cell_renderer.set_property("ellipsize", Pango.EllipsizeMode.END) cell_renderer.set_property("text", entry.get_command_string()) @@ -100,19 +101,19 @@ class ScanScanListPage(HIGVBox): scans_store.connect("row-changed", self._row_changed) - self.scans_list = gtk.TreeView(scans_store) + self.scans_list = Gtk.TreeView.new_with_model(scans_store) self.scans_list.get_selection().connect( "changed", self._selection_changed) - status_col = gtk.TreeViewColumn(_("Status")) - cell = gtk.CellRendererText() - status_col.pack_start(cell) + status_col = Gtk.TreeViewColumn(title=_("Status")) + cell = Gtk.CellRendererText() + status_col.pack_start(cell, True) status_col.set_cell_data_func(cell, status_data_func) self.scans_list.append_column(status_col) - command_col = gtk.TreeViewColumn(_("Command")) - cell = gtk.CellRendererText() - command_col.pack_start(cell) + command_col = Gtk.TreeViewColumn(title=_("Command")) + cell = Gtk.CellRendererText() + command_col.pack_start(cell, True) command_col.set_cell_data_func(cell, command_data_func) self.scans_list.append_column(command_col) @@ -120,25 +121,25 @@ class ScanScanListPage(HIGVBox): scrolled_window.set_border_width(0) scrolled_window.add(self.scans_list) - self.pack_start(scrolled_window, True, True) + self.pack_start(scrolled_window, True, True, 0) hbox = HIGHBox() - buttonbox = gtk.HButtonBox() - buttonbox.set_layout(gtk.BUTTONBOX_START) + buttonbox = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL) + buttonbox.set_layout(Gtk.ButtonBoxStyle.START) buttonbox.set_spacing(4) - self.append_button = HIGButton(_("Append Scan"), gtk.STOCK_ADD) - buttonbox.pack_start(self.append_button, False) + self.append_button = HIGButton(_("Append Scan"), Gtk.STOCK_ADD) + buttonbox.pack_start(self.append_button, False, True, 0) - self.remove_button = HIGButton(_("Remove Scan"), gtk.STOCK_REMOVE) - buttonbox.pack_start(self.remove_button, False) + self.remove_button = HIGButton(_("Remove Scan"), Gtk.STOCK_REMOVE) + buttonbox.pack_start(self.remove_button, False, True, 0) - self.cancel_button = HIGButton(_("Cancel Scan"), gtk.STOCK_CANCEL) - buttonbox.pack_start(self.cancel_button, False) + self.cancel_button = HIGButton(_("Cancel Scan"), Gtk.STOCK_CANCEL) + buttonbox.pack_start(self.cancel_button, False, True, 0) - hbox.pack_start(buttonbox, padding=4) + hbox.pack_start(buttonbox, True, True, 4) - self.pack_start(hbox, False, padding=4) + self.pack_start(hbox, False, True, 4) self._update() diff --git a/zenmap/zenmapGUI/ScanToolbar.py b/zenmap/zenmapGUI/ScanToolbar.py index d5dcfe238..00b1acf18 100644 --- a/zenmap/zenmapGUI/ScanToolbar.py +++ b/zenmap/zenmapGUI/ScanToolbar.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.higwidgets.higboxes import HIGHBox from zenmapGUI.higwidgets.higlabels import HIGEntryLabel @@ -77,14 +79,14 @@ class ScanCommandToolbar(HIGHBox): HIGHBox.__init__(self) self.command_label = HIGEntryLabel(_("Command:")) - self.command_entry = gtk.Entry() + self.command_entry = Gtk.Entry() self._pack_noexpand_nofill(self.command_label) self._pack_expand_fill(self.command_entry) def get_command(self): """Retrieve command entry""" - return self.command_entry.get_text().decode("UTF-8") + return self.command_entry.get_text() def set_command(self, command): """Set a command entry""" @@ -108,10 +110,8 @@ class ScanToolbar(HIGHBox): self._create_target() self._create_profile() - self.scan_button = gtk.Button(_("Scan")) - #self.scan_button = HIGButton(_("Scan "), gtk.STOCK_MEDIA_PLAY) - self.cancel_button = gtk.Button(_("Cancel")) - #self.cancel_button = HIGButton(_("Cancel "), gtk.STOCK_CANCEL) + self.scan_button = Gtk.Button.new_with_label(_("Scan")) + self.cancel_button = Gtk.Button.new_with_label(_("Cancel")) self._pack_noexpand_nofill(self.target_label) self._pack_expand_fill(self.target_entry) @@ -123,11 +123,11 @@ class ScanToolbar(HIGHBox): self._pack_noexpand_nofill(self.cancel_button) # Skip over the dropdown arrow so you can tab to the profile entry. - self.target_entry.set_focus_chain((self.target_entry.child,)) + self.target_entry.set_focus_chain((self.target_entry.get_child(),)) - self.target_entry.child.connect('activate', + self.target_entry.get_child().connect('activate', lambda x: self.profile_entry.grab_focus()) - self.profile_entry.child.connect('activate', + self.profile_entry.get_child().connect('activate', lambda x: self.scan_button.clicked()) def _create_target(self): @@ -152,7 +152,7 @@ class ScanToolbar(HIGHBox): def get_selected_target(self): """Return currently selected target""" - return self.target_entry.selected_target.decode("UTF-8") + return self.target_entry.selected_target def set_selected_target(self, target): """Modify currently selected target""" @@ -177,16 +177,16 @@ class ScanToolbar(HIGHBox): selected_target = property(get_selected_target, set_selected_target) if __name__ == "__main__": - w = gtk.Window() - box = gtk.VBox() + w = Gtk.Window() + box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) w.add(box) stool = ScanToolbar() sctool = ScanCommandToolbar() - box.pack_start(stool) - box.pack_start(sctool) + box.pack_start(stool, True, True, 0) + box.pack_start(sctool, True, True, 0) - w.connect("delete-event", lambda x, y: gtk.main_quit()) + w.connect("delete-event", lambda x, y: Gtk.main_quit()) w.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/ScansListStore.py b/zenmap/zenmapGUI/ScansListStore.py index b1b8edb7b..7bc698ab8 100644 --- a/zenmap/zenmapGUI/ScansListStore.py +++ b/zenmap/zenmapGUI/ScansListStore.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk class ScansListStoreEntry(object): @@ -66,7 +68,7 @@ class ScansListStoreEntry(object): otherwise represented by very different classes.""" # Possible states for the scan to be in. - UNINITIALIZED, RUNNING, FINISHED, FAILED, CANCELED = range(5) + UNINITIALIZED, RUNNING, FINISHED, FAILED, CANCELED = list(range(5)) def __init__(self): self.state = self.UNINITIALIZED @@ -101,11 +103,11 @@ class ScansListStoreEntry(object): canceled = property(lambda self: self.state == self.CANCELED) -class ScansListStore(gtk.ListStore): - """This is a specialization of a gtk.ListStore that holds running, +class ScansListStore(Gtk.ListStore): + """This is a specialization of a Gtk.ListStore that holds running, completed, and failed scans.""" def __init__(self): - gtk.ListStore.__init__(self, object) + Gtk.ListStore.__init__(self, object) def add_running_scan(self, command): """Add a running NmapCommand object to the list of scans.""" diff --git a/zenmap/zenmapGUI/ScriptInterface.py b/zenmap/zenmapGUI/ScriptInterface.py index 1e2a663f8..d2443a29b 100644 --- a/zenmap/zenmapGUI/ScriptInterface.py +++ b/zenmap/zenmapGUI/ScriptInterface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -59,11 +59,14 @@ # This module is responsible for interface present under "Scripting" tab. -import gobject -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GLib + +import os import sys import tempfile -import os # Prevent loading PyXML import xml @@ -90,7 +93,7 @@ paths_config = PathsConfig() def text_buffer_insert_nsedoc(buf, nsedoc): """Inserts NSEDoc at the end of the buffer, with markup turned into proper tags.""" - if not buf.tag_table.lookup("NSEDOC_CODE_TAG"): + if not buf.get_tag_table().lookup("NSEDOC_CODE_TAG"): buf.create_tag("NSEDOC_CODE_TAG", font="Monospace") for event in zenmapCore.NSEDocParser.nsedoc_parse(nsedoc): if event.type == "paragraph_start": @@ -102,7 +105,7 @@ def text_buffer_insert_nsedoc(buf, nsedoc): elif event.type == "list_end": pass elif event.type == "list_item_start": - buf.insert(buf.get_end_iter(), u"\u2022\u00a0") # bullet nbsp + buf.insert(buf.get_end_iter(), "\u2022\u00a0") # bullet nbsp elif event.type == "list_item_end": buf.insert(buf.get_end_iter(), "\n") elif event.type == "text": @@ -123,28 +126,28 @@ class ScriptHelpXMLContentHandler (xml.sax.handler.ContentHandler): self.nselib_dir = None def startElement(self, name, attrs): - if name == u"directory": - if u"name" not in attrs: + if name == "directory": + if "name" not in attrs: raise ValueError( - u'"directory" element did not have "name" attribute') - dirname = attrs[u"name"] - if u"path" not in attrs: + '"directory" element did not have "name" attribute') + dirname = attrs["name"] + if "path" not in attrs: raise ValueError( - u'"directory" element did not have "path" attribute') - path = attrs[u"path"].encode("raw_unicode_escape").decode( + '"directory" element did not have "path" attribute') + path = attrs["path"].encode("raw_unicode_escape").decode( sys.getfilesystemencoding()) - if dirname == u"scripts": + if dirname == "scripts": self.scripts_dir = path - elif dirname == u"nselib": + elif dirname == "nselib": self.nselib_dir = path else: # Ignore. pass - elif name == u"script": - if u"filename" not in attrs: + elif name == "script": + if "filename" not in attrs: raise ValueError( - u'"script" element did not have "filename" attribute') - self.script_filenames.append(attrs[u"filename"]) + '"script" element did not have "filename" attribute') + self.script_filenames.append(attrs["filename"]) @staticmethod def parse_nmap_script_help(f): @@ -179,21 +182,21 @@ class ScriptInterface: self.prev_script_spec = None self.focusedentry = None - self.liststore = gtk.ListStore(str, "gboolean", object) + self.liststore = Gtk.ListStore.new([str, bool, object]) - self.file_liststore = gtk.ListStore(str, "gboolean") + self.file_liststore = Gtk.ListStore.new([str, bool]) # Arg name, arg value, (name, desc) tuple. - self.arg_liststore = gtk.ListStore(str, str, object) + self.arg_liststore = Gtk.ListStore.new([str, str, object]) # This is what is shown initially. After the initial Nmap run to get # the list of script is finished, this will be replaced with a TreeView # showing the scripts or an error message. - self.script_list_container = gtk.VBox() - self.script_list_container.pack_start(self.make_please_wait_widget()) + self.script_list_container = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) + self.script_list_container.pack_start(self.make_please_wait_widget(), True, True, 0) self.hmainbox.pack_start(self.script_list_container, False, False, 0) - self.nmap_error_widget = gtk.Label(_( + self.nmap_error_widget = Gtk.Label.new(_( "There was an error getting the list of scripts from Nmap. " "Try upgrading Nmap.")) self.nmap_error_widget.set_line_wrap(True) @@ -231,7 +234,7 @@ class ScriptInterface: nmap_process = NmapCommand(command_string) try: nmap_process.run_scan(stderr=stderr) - except Exception, e: + except Exception as e: callback(False, None) stderr.close() return @@ -239,7 +242,7 @@ class ScriptInterface: self.script_list_widget.set_sensitive(False) - gobject.timeout_add( + GLib.timeout_add( self.NMAP_DELAY, self.script_list_timer_callback, nmap_process, callback) @@ -269,16 +272,16 @@ class ScriptInterface: for child in self.script_list_container.get_children(): self.script_list_container.remove(child) if status and self.handle_initial_script_list_output(process): - self.script_list_container.pack_start(self.script_list_widget) + self.script_list_container.pack_start(self.script_list_widget, True, True, 0) else: - self.script_list_container.pack_start(self.nmap_error_widget) + self.script_list_container.pack_start(self.nmap_error_widget, True, True, 0) def handle_initial_script_list_output(self, process): process.stdout_file.seek(0) try: handler = ScriptHelpXMLContentHandler.parse_nmap_script_help( process.stdout_file) - except (ValueError, xml.sax.SAXParseException), e: + except (ValueError, xml.sax.SAXParseException) as e: log.debug("--script-help parse exception: %s" % str(e)) return False @@ -339,7 +342,7 @@ class ScriptInterface: try: handler = ScriptHelpXMLContentHandler.parse_nmap_script_help( process.stdout_file) - except (ValueError, xml.sax.SAXParseException), e: + except (ValueError, xml.sax.SAXParseException) as e: log.debug("--script-help parse exception: %s" % str(e)) return False @@ -375,8 +378,8 @@ class ScriptInterface: involving the creation of a subprocess, we don't do it for every typed character.""" if self.script_list_timeout_id: - gobject.source_remove(self.script_list_timeout_id) - self.script_list_timeout_id = gobject.timeout_add( + GLib.source_remove(self.script_list_timeout_id) + self.script_list_timeout_id = GLib.timeout_add( self.SCRIPT_LIST_DELAY, self.update_script_list_from_spec, spec) @@ -413,34 +416,34 @@ A list of arguments that affect the selected script. Enter a value by \ clicking in the value field beside the argument name.""") def make_please_wait_widget(self): - vbox = gtk.VBox() - label = gtk.Label(_("Please wait.")) + vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) + label = Gtk.Label.new(_("Please wait.")) label.set_line_wrap(True) - vbox.pack_start(label) + vbox.pack_start(label, True, True, 0) return vbox def make_script_list_widget(self): """Creates and packs widgets associated with left hand side of Interface.""" - vbox = gtk.VBox() + vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) scrolled_window = HIGScrolledWindow() - scrolled_window.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS) + scrolled_window.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS) # Expand only vertically. scrolled_window.set_size_request(175, -1) - listview = gtk.TreeView(self.liststore) + listview = Gtk.TreeView.new_with_model(self.liststore) listview.set_headers_visible(False) listview.connect("enter-notify-event", self.update_help_ls_cb) selection = listview.get_selection() selection.connect("changed", self.selection_changed_cb) - cell = gtk.CellRendererText() - togglecell = gtk.CellRendererToggle() + cell = Gtk.CellRendererText() + togglecell = Gtk.CellRendererToggle() togglecell.set_property("activatable", True) togglecell.connect("toggled", self.toggled_cb, self.liststore) - col = gtk.TreeViewColumn(_('Names')) - col.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY) + col = Gtk.TreeViewColumn(title=_('Names')) + col.set_sizing(Gtk.TreeViewColumnSizing.GROW_ONLY) col.set_resizable(True) - togglecol = gtk.TreeViewColumn(None, togglecell) + togglecol = Gtk.TreeViewColumn(title=None, cell_renderer=togglecell) togglecol.add_attribute(togglecell, "active", 1) listview.append_column(togglecol) listview.append_column(col) @@ -452,40 +455,40 @@ clicking in the value field beside the argument name.""") self.file_scrolled_window = HIGScrolledWindow() self.file_scrolled_window.set_policy( - gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS) + Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS) self.file_scrolled_window.set_size_request(175, -1) self.file_scrolled_window.hide() self.file_scrolled_window.set_no_show_all(True) - self.file_listview = gtk.TreeView(self.file_liststore) + self.file_listview = Gtk.TreeView.new_with_model(self.file_liststore) self.file_listview.set_headers_visible(False) - col = gtk.TreeViewColumn(None) + col = Gtk.TreeViewColumn(title=None) self.file_listview.append_column(col) - cell = gtk.CellRendererToggle() + cell = Gtk.CellRendererToggle() col.pack_start(cell, True) cell.set_property("activatable", True) col.add_attribute(cell, "active", 1) cell.connect("toggled", self.toggled_cb, self.file_liststore) - col = gtk.TreeViewColumn(None) + col = Gtk.TreeViewColumn(title=None) self.file_listview.append_column(col) - cell = gtk.CellRendererText() - col.pack_start(cell) + cell = Gtk.CellRendererText() + col.pack_start(cell, True) col.add_attribute(cell, "text", 0) self.file_listview.show_all() self.file_scrolled_window.add(self.file_listview) - vbox.pack_start(self.file_scrolled_window, False) + vbox.pack_start(self.file_scrolled_window, False, True, 0) hbox = HIGHBox(False, 2) - self.remove_file_button = HIGButton(stock=gtk.STOCK_REMOVE) + self.remove_file_button = HIGButton(stock=Gtk.STOCK_REMOVE) self.remove_file_button.connect( "clicked", self.remove_file_button_clicked_cb) self.remove_file_button.set_sensitive(False) - hbox.pack_end(self.remove_file_button) - add_file_button = HIGButton(stock=gtk.STOCK_ADD) + hbox.pack_end(self.remove_file_button, True, True, 0) + add_file_button = HIGButton(stock=Gtk.STOCK_ADD) add_file_button.connect("clicked", self.add_file_button_clicked_cb) - hbox.pack_end(add_file_button) + hbox.pack_end(add_file_button, True, True, 0) vbox.pack_start(hbox, False, False, 0) @@ -541,35 +544,35 @@ clicking in the value field beside the argument name.""") """Creates and packs widgets related to displaying the description box.""" sw = HIGScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) - sw.set_shadow_type(gtk.SHADOW_OUT) + sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) + sw.set_shadow_type(Gtk.ShadowType.OUT) sw.set_border_width(5) - text_view = gtk.TextView() + text_view = Gtk.TextView() text_view.connect("enter-notify-event", self.update_help_desc_cb) self.text_buffer = text_view.get_buffer() self.text_buffer.create_tag("Usage", font="Monospace") self.text_buffer.create_tag("Output", font="Monospace") - text_view.set_wrap_mode(gtk.WRAP_WORD) + text_view.set_wrap_mode(Gtk.WrapMode.WORD) text_view.set_editable(False) - text_view.set_justification(gtk.JUSTIFY_LEFT) + text_view.set_justification(Gtk.Justification.LEFT) sw.add(text_view) return sw def make_arguments_widget(self): """Creates and packs widgets related to arguments box.""" - vbox = gtk.VBox() - vbox.pack_start(gtk.Label(_("Arguments")), False, False, 0) + vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) + vbox.pack_start(Gtk.Label.new(_("Arguments")), False, False, 0) arg_window = HIGScrolledWindow() - arg_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) - arg_window.set_shadow_type(gtk.SHADOW_OUT) + arg_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) + arg_window.set_shadow_type(Gtk.ShadowType.OUT) - arg_listview = gtk.TreeView(self.arg_liststore) + arg_listview = Gtk.TreeView.new_with_model(self.arg_liststore) arg_listview.connect("motion-notify-event", self.update_help_arg_cb) - argument = gtk.CellRendererText() - self.value = gtk.CellRendererText() + argument = Gtk.CellRendererText() + self.value = Gtk.CellRendererText() self.value.connect("edited", self.value_edited_cb, self.arg_liststore) - arg_col = gtk.TreeViewColumn("Arguments\t") - val_col = gtk.TreeViewColumn("values") + arg_col = Gtk.TreeViewColumn(title="Arguments\t") + val_col = Gtk.TreeViewColumn(title="values") arg_listview.append_column(arg_col) arg_listview.append_column(val_col) arg_col.pack_start(argument, True) @@ -626,11 +629,7 @@ clicking in the value field beside the argument name.""") def update_help_arg_cb(self, treeview, event): """Callback method for displaying argument help.""" wx, wy = treeview.get_pointer() - try: - x, y = treeview.convert_widget_to_bin_window_coords(wx, wy) - except AttributeError: - # convert_widget_to_bin_window_coords was introduced in PyGTK 2.12. - return + x, y = treeview.convert_widget_to_bin_window_coords(wx, wy) path = treeview.get_path_at_pos(x, y) if not path or not self.focusedentry: self.help_buf.set_text("") @@ -654,7 +653,7 @@ clicking in the value field beside the argument name.""") response = self.script_file_chooser.run() filenames = self.script_file_chooser.get_filenames() self.script_file_chooser.hide() - if response != gtk.RESPONSE_OK: + if response != Gtk.ResponseType.OK: return for filename in filenames: self.file_liststore.append([filename, True]) @@ -675,7 +674,7 @@ clicking in the value field beside the argument name.""") def set_description(self, entry): """Sets the content that is to be displayed in the description box.""" - self.text_buffer.set_text(u"") + self.text_buffer.set_text("") self.text_buffer.insert(self.text_buffer.get_end_iter(), """\ Categories: %(cats)s diff --git a/zenmap/zenmapGUI/SearchGUI.py b/zenmap/zenmapGUI/SearchGUI.py index 9f42f7c21..be812c660 100644 --- a/zenmap/zenmapGUI/SearchGUI.py +++ b/zenmap/zenmapGUI/SearchGUI.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,11 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + import re import copy @@ -140,12 +143,12 @@ class SearchParser(object): self.search_gui.init_search_dirs(self.search_dict.pop("dir", [])) -class SearchGUI(gtk.VBox, object): +class SearchGUI(Gtk.Box, object): """This class is a VBox that holds the search entry field and buttons on top, and the results list on the bottom. The "Cancel" and "Open" buttons are a part of the SearchWindow class, not SearchGUI.""" def __init__(self, search_window): - gtk.VBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self._create_widgets() self._pack_widgets() @@ -168,7 +171,7 @@ class SearchGUI(gtk.VBox, object): if self.options["search_db"]: try: self.search_db = SearchDB() - except ImportError, e: + except ImportError as e: self.search_db = SearchDummy() self.no_db_warning.show() self.no_db_warning.set_text( @@ -250,25 +253,26 @@ class SearchGUI(gtk.VBox, object): # Search box and buttons self.search_top_hbox = HIGHBox() self.search_label = HIGSectionLabel(_("Search:")) - self.search_entry = gtk.Entry() + self.search_entry = Gtk.Entry() self.expressions_btn = HIGToggleButton( - _("Expressions "), gtk.STOCK_EDIT) + _("Expressions "), Gtk.STOCK_EDIT) # The quick reference tooltip button - self.search_tooltip_btn = HIGButton(" ", gtk.STOCK_INFO) + self.search_tooltip_btn = HIGButton(" ", Gtk.STOCK_INFO) # The expression VBox. This is only visible once the user clicks on - # "Expressions" - self.expr_vbox = gtk.VBox() + # "Expressions". The expressions (if any) should be tightly packed so + # that they don't take too much screen real-estate + self.expr_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) # Results section - self.result_list = gtk.ListStore(str, str, int) # title, date, id - self.result_view = gtk.TreeView(self.result_list) - self.result_scrolled = gtk.ScrolledWindow() - self.result_title_column = gtk.TreeViewColumn(_("Scan")) - self.result_date_column = gtk.TreeViewColumn(_("Date")) + self.result_list = Gtk.ListStore.new([str, str, int]) # title, date, id + self.result_view = Gtk.TreeView.new_with_model(self.result_list) + self.result_scrolled = Gtk.ScrolledWindow() + self.result_title_column = Gtk.TreeViewColumn(title=_("Scan")) + self.result_date_column = Gtk.TreeViewColumn(title=_("Date")) - self.no_db_warning = gtk.Label() + self.no_db_warning = Gtk.Label() self.no_db_warning.set_line_wrap(True) self.no_db_warning.set_no_show_all(True) @@ -277,26 +281,22 @@ class SearchGUI(gtk.VBox, object): def _pack_widgets(self): # Packing label, search box and buttons self.search_top_hbox.set_spacing(4) - self.search_top_hbox.pack_start(self.search_label, False) - self.search_top_hbox.pack_start(self.search_entry, True) - self.search_top_hbox.pack_start(self.expressions_btn, False) - self.search_top_hbox.pack_start(self.search_tooltip_btn, False) - - # The expressions (if any) should be tightly packed so that they don't - # take too much screen real-estate - self.expr_vbox.set_spacing(0) + self.search_top_hbox.pack_start(self.search_label, False, True, 0) + self.search_top_hbox.pack_start(self.search_entry, True, True, 0) + self.search_top_hbox.pack_start(self.expressions_btn, False, True, 0) + self.search_top_hbox.pack_start(self.search_tooltip_btn, False, True, 0) # Packing the result section self.result_scrolled.add(self.result_view) self.result_scrolled.set_policy( - gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) # Packing it all together self.set_spacing(4) - self.pack_start(self.search_top_hbox, False) - self.pack_start(self.expr_vbox, False) - self.pack_start(self.result_scrolled, True) - self.pack_start(self.no_db_warning, False) + self.pack_start(self.search_top_hbox, False, True, 0) + self.pack_start(self.expr_vbox, False, True, 0) + self.pack_start(self.result_scrolled, True, True, 0) + self.pack_start(self.no_db_warning, False, True, 0) def _connect_events(self): self.search_entry.connect("changed", self.update_search_entry) @@ -313,7 +313,7 @@ class SearchGUI(gtk.VBox, object): # This is the first time the user has clicked on "Show Expressions" # and the search entry box is empty, so we add a single Criterion # row - self.expr_vbox.pack_start(Criterion(self)) + self.expr_vbox.pack_start(Criterion(self), True, True, 0) if self.expressions_btn.get_active(): # The Expressions GUI is about to be displayed. It needs to reflect @@ -336,12 +336,12 @@ class SearchGUI(gtk.VBox, object): # We compare the search entry field to the Expressions GUI. Every # (operator, value) pair must be present in the GUI after this loop # is done. - for op, args in self.search_dict.iteritems(): + for op, args in self.search_dict.items(): for arg in args: if (op not in gui_ops) or (arg not in gui_ops[op]): # We need to add this pair to the GUI self.expr_vbox.pack_start( - Criterion(self, op, arg), False) + Criterion(self, op, arg), False, True, 0) # Now we check if there are any leftover criterion rows that aren't # present in the search_dict (for example, if a user has deleted @@ -353,7 +353,7 @@ class SearchGUI(gtk.VBox, object): criterion.destroy() # If we have deleted all rows, add an empty one if len(self.expr_vbox.get_children()) == 0: - self.expr_vbox.pack_start(Criterion(self)) + self.expr_vbox.pack_start(Criterion(self), True, True, 0) # Display all elements self.expr_vbox.show_all() @@ -361,7 +361,7 @@ class SearchGUI(gtk.VBox, object): # The Expressions GUI is about to be hidden. No updates to the # search entry field are necessary, since it gets updated on every # change in one of the criterion rows. - self.expr_vbox.hide_all() + self.expr_vbox.hide() self.search_entry.set_sensitive(True) def close(self): @@ -375,7 +375,7 @@ class SearchGUI(gtk.VBox, object): # Make a new Criteria row and insert it after the calling row criteria = Criterion(self, "keyword") - self.expr_vbox.pack_start(criteria, False) + self.expr_vbox.pack_start(criteria, False, True, 0) self.expr_vbox.reorder_child(criteria, caller_index + 1) criteria.show_all() @@ -431,7 +431,7 @@ class SearchGUI(gtk.VBox, object): self.append_result(result) matched += 1 - for search_dir in self.search_dirs.itervalues(): + for search_dir in self.search_dirs.values(): total += len(search_dir.get_scan_results()) for result in search_dir.search(**self.search_dict): self.append_result(result) @@ -448,7 +448,7 @@ class SearchGUI(gtk.VBox, object): def clear_result_list(self): for i in range(len(self.result_list)): - iter = self.result_list.get_iter_root() + iter = self.result_list.get_iter_first() del(self.result_list[iter]) def append_result(self, parsed_result): @@ -481,7 +481,7 @@ class SearchGUI(gtk.VBox, object): self.result_view.set_search_column(0) selection = self.result_view.get_selection() - selection.set_mode(gtk.SELECTION_MULTIPLE) + selection.set_mode(Gtk.SelectionMode.MULTIPLE) self.result_view.append_column(self.result_title_column) self.result_view.append_column(self.result_date_column) @@ -496,7 +496,7 @@ class SearchGUI(gtk.VBox, object): self.result_title_column.set_reorderable(True) self.result_date_column.set_reorderable(True) - cell = gtk.CellRendererText() + cell = Gtk.CellRendererText() self.result_title_column.pack_start(cell, True) self.result_date_column.pack_start(cell, True) @@ -507,7 +507,7 @@ class SearchGUI(gtk.VBox, object): selected_results = property(get_selected_results) -class Criterion(gtk.HBox): +class Criterion(Gtk.Box): """This class holds one criterion row, represented as an HBox. It holds a ComboBox and a Subcriterion's subclass instance, depending on the selected entry in the ComboBox. For example, when the 'Target' option is selected, a @@ -517,7 +517,7 @@ class Criterion(gtk.HBox): def __init__(self, search_window, operator="keyword", argument=""): """A reference to the search window is passed so that we can call add_criterion and remove_criterion.""" - gtk.HBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.search_window = search_window self.default_operator = operator @@ -544,17 +544,17 @@ class Criterion(gtk.HBox): def _create_widgets(self): # A ComboBox containing the list of operators - self.operator_combo = gtk.combo_box_new_text() + self.operator_combo = Gtk.ComboBoxText() # Sort all the keys from combo_entries and make an entry for each of # them - sorted_entries = self.combo_entries.keys() + sorted_entries = list(self.combo_entries.keys()) sorted_entries.sort() for name in sorted_entries: self.operator_combo.append_text(name) # Select the default operator - for entry, operators in self.combo_entries.iteritems(): + for entry, operators in self.combo_entries.items(): for operator in operators: if operator == self.default_operator: self.operator_combo.set_active(sorted_entries.index(entry)) @@ -565,14 +565,14 @@ class Criterion(gtk.HBox): self.default_operator, self.default_argument) # The "add" and "remove" buttons - self.add_btn = HIGButton(" ", gtk.STOCK_ADD) - self.remove_btn = HIGButton(" ", gtk.STOCK_REMOVE) + self.add_btn = HIGButton(" ", Gtk.STOCK_ADD) + self.remove_btn = HIGButton(" ", Gtk.STOCK_REMOVE) def _pack_widgets(self): - self.pack_start(self.operator_combo, False) - self.pack_start(self.subcriterion, True, True) - self.pack_start(self.add_btn, False) - self.pack_start(self.remove_btn, False) + self.pack_start(self.operator_combo, False, True, 0) + self.pack_start(self.subcriterion, True, True, 0) + self.pack_start(self.add_btn, False, True, 0) + self.pack_start(self.remove_btn, False, True, 0) def _connect_events(self): self.operator_combo.connect("changed", self.operator_changed) @@ -619,7 +619,7 @@ class Criterion(gtk.HBox): self.subcriterion = self.new_subcriterion(operator) # Pack it, and place it on the right side of the ComboBox - self.pack_start(self.subcriterion, True, True) + self.pack_start(self.subcriterion, True, True, 0) self.reorder_child(self.subcriterion, 1) # Notify the search window about the change @@ -632,12 +632,12 @@ class Criterion(gtk.HBox): argument = property(get_argument) -class Subcriterion(gtk.HBox): +class Subcriterion(Gtk.Box): """This class is a base class for all subcriterion types. Depending on the criterion selected in the Criterion's ComboBox, a subclass of Subcriterion is created to display the appropriate GUI.""" def __init__(self): - gtk.HBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.operator = "" self.argument = "" @@ -662,12 +662,12 @@ class SimpleSubcriterion(Subcriterion): self._connect_widgets() def _create_widgets(self): - self.entry = gtk.Entry() + self.entry = Gtk.Entry() if self.argument: self.entry.set_text(self.argument) def _pack_widgets(self): - self.pack_start(self.entry, True) + self.pack_start(self.entry, True, True, 0) def _connect_widgets(self): self.entry.connect("changed", self.entry_changed) @@ -690,13 +690,13 @@ class PortSubcriterion(Subcriterion): self._connect_widgets() def _create_widgets(self): - self.entry = gtk.Entry() + self.entry = Gtk.Entry() if self.argument: self.entry.set_text(self.argument) - self.label = gtk.Label(" is ") + self.label = Gtk.Label.new(" is ") - self.port_state_combo = gtk.combo_box_new_text() + self.port_state_combo = Gtk.ComboBoxText() states = ["open", "scanned", "closed", "filtered", "unfiltered", "open|filtered", "closed|filtered"] for state in states: @@ -705,9 +705,9 @@ class PortSubcriterion(Subcriterion): states.index(self.operator.replace("_", "|"))) def _pack_widgets(self): - self.pack_start(self.entry, True) - self.pack_start(self.label, False) - self.pack_start(self.port_state_combo, False) + self.pack_start(self.entry, True, True, 0) + self.pack_start(self.label, False, True, 0) + self.pack_start(self.port_state_combo, False, True, 0) def _connect_widgets(self): self.entry.connect("changed", self.entry_changed) @@ -734,14 +734,14 @@ class DirSubcriterion(Subcriterion): self._connect_widgets() def _create_widgets(self): - self.dir_entry = gtk.Entry() + self.dir_entry = Gtk.Entry() if self.argument: self.dir_entry.set_text(self.argument) - self.chooser_btn = HIGButton("Choose...", gtk.STOCK_OPEN) + self.chooser_btn = HIGButton("Choose...", Gtk.STOCK_OPEN) def _pack_widgets(self): - self.pack_start(self.dir_entry, True) - self.pack_start(self.chooser_btn, False) + self.pack_start(self.dir_entry, True, True, 0) + self.pack_start(self.chooser_btn, False, True, 0) def _connect_widgets(self): self.chooser_btn.connect("clicked", self.choose_clicked) @@ -751,7 +751,7 @@ class DirSubcriterion(Subcriterion): # Display a directory chooser dialog chooser_dlg = DirectoryChooserDialog("Include folder in search") - if chooser_dlg.run() == gtk.RESPONSE_OK: + if chooser_dlg.run() == Gtk.ResponseType.OK: self.dir_entry.set_text(chooser_dlg.get_filename()) chooser_dlg.destroy() @@ -801,7 +801,7 @@ class DateSubcriterion(Subcriterion): self.argument += "~" * self.fuzzies def _create_widgets(self): - self.date_criterion_combo = gtk.combo_box_new_text() + self.date_criterion_combo = Gtk.ComboBoxText() self.date_criterion_combo.append_text("is") self.date_criterion_combo.append_text("after") self.date_criterion_combo.append_text("before") @@ -814,8 +814,8 @@ class DateSubcriterion(Subcriterion): self.date_button = HIGButton() def _pack_widgets(self): - self.pack_start(self.date_criterion_combo, False) - self.pack_start(self.date_button, True) + self.pack_start(self.date_criterion_combo, False, True, 0) + self.pack_start(self.date_button, True, True, 0) def _connect_widgets(self): self.date_criterion_combo.connect( @@ -835,7 +835,7 @@ class DateSubcriterion(Subcriterion): def update_button(self, widget): cal_date = widget.get_date() - # Add 1 to month because gtk.Calendar date is zero-based. + # Add 1 to month because Gtk.Calendar date is zero-based. self.date = datetime.date(cal_date[0], cal_date[1] + 1, cal_date[2]) # Set the argument, using the search format @@ -866,12 +866,12 @@ class DateSubcriterion(Subcriterion): _date = datetime.date.today() -class DateCalendar(gtk.Window, object): +class DateCalendar(Gtk.Window, object): def __init__(self): - gtk.Window.__init__(self, gtk.WINDOW_POPUP) - self.set_position(gtk.WIN_POS_MOUSE) + Gtk.Window.__init__(self, type=Gtk.WindowType.POPUP) + self.set_position(Gtk.WindowPosition.MOUSE) - self.calendar = gtk.Calendar() + self.calendar = Gtk.Calendar() self.add(self.calendar) def connect_calendar(self, update_button_cb): diff --git a/zenmap/zenmapGUI/SearchWindow.py b/zenmap/zenmapGUI/SearchWindow.py index b43bb3b55..bbdf56ad6 100644 --- a/zenmap/zenmapGUI/SearchWindow.py +++ b/zenmap/zenmapGUI/SearchWindow.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.SearchGUI import SearchGUI @@ -81,17 +83,17 @@ if is_maemo(): def _pack_widgets(self): pass else: - class BaseSearchWindow(gtk.Window): + class BaseSearchWindow(Gtk.Window): def __init__(self): - gtk.Window.__init__(self) + Gtk.Window.__init__(self) self.set_title(_("Search Scans")) - self.set_position(gtk.WIN_POS_CENTER) + self.set_position(Gtk.WindowPosition.CENTER) def _pack_widgets(self): self.vbox.set_border_width(4) -class SearchWindow(BaseSearchWindow, object): +class SearchWindow(BaseSearchWindow): def __init__(self, load_method, append_method): BaseSearchWindow.__init__(self) @@ -107,34 +109,33 @@ class SearchWindow(BaseSearchWindow, object): def _create_widgets(self): self.vbox = HIGVBox() - self.bottom_hbox = gtk.HBox() - self.bottom_label = gtk.Label() - self.btn_box = gtk.HButtonBox() - self.btn_open = HIGButton(stock=gtk.STOCK_OPEN) - self.btn_append = HIGButton(_("Append"), gtk.STOCK_ADD) - self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE) + self.bottom_hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 4) + self.bottom_label = Gtk.Label() + self.btn_box = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL) + self.btn_open = HIGButton(stock=Gtk.STOCK_OPEN) + self.btn_append = HIGButton(_("Append"), Gtk.STOCK_ADD) + self.btn_close = HIGButton(stock=Gtk.STOCK_CLOSE) self.search_gui = SearchGUI(self) def _pack_widgets(self): BaseSearchWindow._pack_widgets(self) - self.btn_box.set_layout(gtk.BUTTONBOX_END) + self.btn_box.set_layout(Gtk.ButtonBoxStyle.END) self.btn_box.set_spacing(4) - self.btn_box.pack_start(self.btn_close) - self.btn_box.pack_start(self.btn_append) - self.btn_box.pack_start(self.btn_open) + self.btn_box.pack_start(self.btn_close, True, True, 0) + self.btn_box.pack_start(self.btn_append, True, True, 0) + self.btn_box.pack_start(self.btn_open, True, True, 0) self.bottom_label.set_alignment(0.0, 0.5) self.bottom_label.set_use_markup(True) - self.bottom_hbox.set_spacing(4) - self.bottom_hbox.pack_start(self.bottom_label, True) - self.bottom_hbox.pack_start(self.btn_box, False) + self.bottom_hbox.pack_start(self.bottom_label, True, True, 0) + self.bottom_hbox.pack_start(self.btn_box, False, True, 0) self.vbox.set_spacing(4) - self.vbox.pack_start(self.search_gui, True, True) - self.vbox.pack_start(self.bottom_hbox, False) + self.vbox.pack_start(self.search_gui, True, True, 0) + self.vbox.pack_start(self.bottom_hbox, False, True, 0) self.add(self.vbox) @@ -179,6 +180,6 @@ class SearchWindow(BaseSearchWindow, object): if __name__ == "__main__": - search = SearchWindow(lambda x: gtk.main_quit(), lambda x: gtk.main_quit()) + search = SearchWindow(lambda x: Gtk.main_quit(), lambda x: Gtk.main_quit()) search.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/TargetCombo.py b/zenmap/zenmapGUI/TargetCombo.py index bfd78b8d0..dda93a01d 100644 --- a/zenmap/zenmapGUI/TargetCombo.py +++ b/zenmap/zenmapGUI/TargetCombo.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,48 +57,49 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapCore.TargetList import target_list -class TargetCombo(gtk.ComboBoxEntry): +class TargetCombo(Gtk.ComboBoxText): def __init__(self): - gtk.ComboBoxEntry.__init__(self, gtk.ListStore(str), 0) + Gtk.ComboBoxText.__init__(self, has_entry=True) - self.completion = gtk.EntryCompletion() - self.child.set_completion(self.completion) + self.completion = Gtk.EntryCompletion() + self.get_child().set_completion(self.completion) self.completion.set_model(self.get_model()) self.completion.set_text_column(0) self.update() def update(self): - t_model = self.get_model() - for i in range(len(t_model)): - iter = t_model.get_iter_root() - del(t_model[iter]) + self.remove_all() t_list = target_list.get_target_list() for target in t_list[:15]: - t_model.append([target.replace('\n', '')]) + self.append_text(target.replace('\n', '')) def add_new_target(self, target): target_list.add_target(target) self.update() def get_selected_target(self): - return self.child.get_text() + return self.get_child().get_text() def set_selected_target(self, target): - self.child.set_text(target) + self.get_child().set_text(target) selected_target = property(get_selected_target, set_selected_target) if __name__ == "__main__": - w = gtk.Window() + w = Gtk.Window() t = TargetCombo() w.add(t) - w.show_all() - gtk.main() + w.connect("delete-event", lambda x, y: Gtk.main_quit()) + w.show_all() + Gtk.main() diff --git a/zenmap/zenmapGUI/TopologyPage.py b/zenmap/zenmapGUI/TopologyPage.py index f6a69046b..f83ae7429 100644 --- a/zenmap/zenmapGUI/TopologyPage.py +++ b/zenmap/zenmapGUI/TopologyPage.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,7 +57,10 @@ # * * # ***************************************************************************/ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk from zenmapGUI.higwidgets.higboxes import HIGVBox @@ -84,9 +86,8 @@ class TopologyPage(HIGVBox): self._pack_widgets() def _create_widgets(self): - self.rn_hbox = gtk.HBox() - self.rn_hbox.set_spacing(4) - self.rn_vbox = gtk.VBox() + self.rn_hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 4) + self.rn_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) # RadialNet's widgets self.radialnet = RadialNet.RadialNet(RadialNet.LAYOUT_WEIGHTED) @@ -102,11 +103,11 @@ class TopologyPage(HIGVBox): self.radialnet.set_no_show_all(True) self.slow_vbox = HIGVBox() - self.slow_label = gtk.Label() - self.slow_vbox.pack_start(self.slow_label, False, False) - show_button = gtk.Button(_("Show the topology anyway")) + self.slow_label = Gtk.Label() + self.slow_vbox.pack_start(self.slow_label, False, False, 0) + show_button = Gtk.Button.new_with_label(_("Show the topology anyway")) show_button.connect("clicked", self.show_anyway) - self.slow_vbox.pack_start(show_button, False, False) + self.slow_vbox.pack_start(show_button, False, False, 0) self.slow_vbox.show_all() self.slow_vbox.set_no_show_all(True) self.slow_vbox.hide() @@ -114,17 +115,17 @@ class TopologyPage(HIGVBox): self.radialnet.show() def _pack_widgets(self): - self.rn_hbox.pack_start(self.display_panel, True, True) - self.rn_hbox.pack_start(self.control, False) + self.rn_hbox.pack_start(self.display_panel, True, True, 0) + self.rn_hbox.pack_start(self.control, False, True, 0) - self.rn_vbox.pack_start(self.rn_hbox, True, True) - self.rn_vbox.pack_start(self.fisheye, False) + self.rn_vbox.pack_start(self.rn_hbox, True, True, 0) + self.rn_vbox.pack_start(self.fisheye, False, True, 0) - self.pack_start(self.rn_toolbar, False, False) - self.pack_start(self.rn_vbox, True, True) + self.pack_start(self.rn_toolbar, False, False, 0) + self.pack_start(self.rn_vbox, True, True, 0) - self.display_panel.pack_start(self.slow_vbox, True, False) - self.display_panel.pack_start(self.radialnet, True, True) + self.display_panel.pack_start(self.slow_vbox, True, False, 0) + self.display_panel.pack_start(self.radialnet, True, True, 0) def add_scan(self, scan): """Parses a given XML file and adds the parsed result to the network diff --git a/zenmap/zenmapGUI/__init__.py b/zenmap/zenmapGUI/__init__.py index 64288607f..ce946574e 100644 --- a/zenmap/zenmapGUI/__init__.py +++ b/zenmap/zenmapGUI/__init__.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * diff --git a/zenmap/zenmapGUI/higwidgets/__init__.py b/zenmap/zenmapGUI/higwidgets/__init__.py index ef813d9eb..46e9de63a 100644 --- a/zenmap/zenmapGUI/higwidgets/__init__.py +++ b/zenmap/zenmapGUI/higwidgets/__init__.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -68,17 +67,17 @@ This is mostly implemented by subclassing from the GTK classes, and providing defaults that better match the HIG specifications/recommendations. """ -from gtkutils import * -from higboxes import * -from higbuttons import * -from higdialogs import * -from higentries import * -from higexpanders import * -from higlabels import * -from higlogindialogs import * -from higprogressbars import * -from higscrollers import * -from higspinner import * -from higtables import * -from higtextviewers import * -from higwindows import * +from .gtkutils import * +from .higboxes import * +from .higbuttons import * +from .higdialogs import * +from .higentries import * +from .higexpanders import * +from .higlabels import * +from .higlogindialogs import * +from .higprogressbars import * +from .higscrollers import * +from .higspinner import * +from .higtables import * +from .higtextviewers import * +from .higwindows import * diff --git a/zenmap/zenmapGUI/higwidgets/gtkutils.py b/zenmap/zenmapGUI/higwidgets/gtkutils.py index 69e204149..f2ff31e21 100644 --- a/zenmap/zenmapGUI/higwidgets/gtkutils.py +++ b/zenmap/zenmapGUI/higwidgets/gtkutils.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -65,43 +64,34 @@ higwidgets/gtkutils.py """ __all__ = ['gtk_version_major', 'gtk_version_minor', 'gtk_version_release', - 'gtk_constant_name', 'gobject_register'] + 'gtk_constant_name'] -import gtk -import gobject +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk # version information -gtk_version_major, gtk_version_minor, gtk_version_release = gtk.gtk_version -assert gtk_version_major == 2 +gtk_version_major, gtk_version_minor, gtk_version_release = gi.version_info +assert gtk_version_major == 3 def gtk_constant_name(group, value): """ Returns the (py)GTK+ name of a constant, given its group name """ - group_response = {-1: 'gtk.RESPONSE_NONE', - -2: 'gtk.RESPONSE_REJECT', - -3: 'gtk.RESPONSE_ACCEPT', - -4: 'gtk.RESPONSE_DELETE_EVENT', - -5: 'gtk.RESPONSE_OK', - -6: 'gtk.RESPONSE_CANCEL', - -7: 'gtk.RESPONSE_CLOSE', - -8: 'gtk.RESPONSE_YES', - -9: 'gtk.RESPONSE_NO', - -10: 'gtk.RESPONSE_APPLY', - -11: 'gtk.RESPONSE_HELP'} + group_response = {-1: 'Gtk.ResponseType.NONE', + -2: 'Gtk.ResponseType.REJECT', + -3: 'Gtk.ResponseType.ACCEPT', + -4: 'Gtk.ResponseType.DELETE_EVENT', + -5: 'Gtk.ResponseType.OK', + -6: 'Gtk.ResponseType.CANCEL', + -7: 'Gtk.ResponseType.CLOSE', + -8: 'Gtk.ResponseType.YES', + -9: 'Gtk.ResponseType.NO', + -10: 'Gtk.ResponseType.APPLY', + -11: 'Gtk.ResponseType.HELP'} groups = {'response': group_response} return groups.get(group, {}).get(value, 'Error: constant value not found') - - -def gobject_register(klass): - """ - Register a given object by calling gobject.type_register. - - Actually gobject.type_register is only called if the pygtk version in use - is not 2.8 at least. - """ - if gtk_version_minor < 8: - gobject.type_register(klass) diff --git a/zenmap/zenmapGUI/higwidgets/higboxes.py b/zenmap/zenmapGUI/higwidgets/higboxes.py index b798d552b..5d1a236b5 100644 --- a/zenmap/zenmapGUI/higwidgets/higboxes.py +++ b/zenmap/zenmapGUI/higwidgets/higboxes.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,29 +65,39 @@ higwidgets/higboxes.py __all__ = ['HIGHBox', 'HIGVBox'] -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class HIGBox(gtk.Box): +class HIGBox(Gtk.Box): def _pack_noexpand_nofill(self, widget): - self.pack_start(widget, expand=False, fill=False) + self.pack_start(widget, False, False, 0) def _pack_expand_fill(self, widget): - self.pack_start(widget, expand=True, fill=True) + self.pack_start(widget, True, True, 0) + + def add(self, widget): + # Make default packing arguments same as before (Gtk.Box has expand + # set to False by default). + self.pack_start(widget, True, True, 0) -class HIGHBox(gtk.HBox, HIGBox): +class HIGHBox(HIGBox): def __init__(self, homogeneous=False, spacing=12): - gtk.HBox.__init__(self, homogeneous, spacing) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, + homogeneous=homogeneous, spacing=spacing) pack_section_label = HIGBox._pack_noexpand_nofill pack_label = HIGBox._pack_noexpand_nofill pack_entry = HIGBox._pack_expand_fill -class HIGVBox(gtk.VBox, HIGBox): +class HIGVBox(HIGBox): def __init__(self, homogeneous=False, spacing=12): - gtk.VBox.__init__(self, homogeneous, spacing) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, + homogeneous=homogeneous, spacing=spacing) # Packs a widget as a line, so it doesn't expand vertically pack_line = HIGBox._pack_noexpand_nofill @@ -110,4 +119,4 @@ class HIGSpacer(HIGHBox): def hig_box_space_holder(): - return gtk.Label(" ") + return Gtk.Label.new(" ") diff --git a/zenmap/zenmapGUI/higwidgets/higbuttons.py b/zenmap/zenmapGUI/higwidgets/higbuttons.py index 56beb6e23..8807a9efb 100644 --- a/zenmap/zenmapGUI/higwidgets/higbuttons.py +++ b/zenmap/zenmapGUI/higwidgets/higbuttons.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -64,52 +63,57 @@ higwidgets/higbuttons.py button related classes """ -__all__ = ['HIGMixButton', 'HIGButton'] +__all__ = ['HIGButton', 'HIGToggleButton'] -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class HIGMixButton (gtk.HBox): +class HIGMixButton(Gtk.Box): def __init__(self, title, stock): - gtk.HBox.__init__(self, False, 4) - self.img = gtk.Image() - self.img.set_from_stock(stock, gtk.ICON_SIZE_BUTTON) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, + homogeneous=False, spacing=4) + self.img = Gtk.Image() + self.img.set_from_stock(stock, Gtk.IconSize.BUTTON) - self.lbl = gtk.Label(title) + self.lbl = Gtk.Label.new(title) - self.hbox1 = gtk.HBox(False, 2) + self.hbox1 = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 2) + self.hbox1.set_homogeneous(False) self.hbox1.pack_start(self.img, False, False, 0) self.hbox1.pack_start(self.lbl, False, False, 0) - self.align = gtk.Alignment(0.5, 0.5, 0, 0) - self.pack_start(self.align) - self.pack_start(self.hbox1) + self.align = Gtk.Alignment.new(0.5, 0.5, 0, 0) + self.pack_start(self.align, True, True, 0) + self.pack_start(self.hbox1, True, True, 0) -class HIGButton (gtk.Button): +class HIGButton(Gtk.Button): def __init__(self, title="", stock=None): if title and stock: - gtk.Button.__init__(self) + Gtk.Button.__init__(self) content = HIGMixButton(title, stock) self.add(content) elif title and not stock: - gtk.Button.__init__(self, title) + Gtk.Button.__init__(self, label=title) elif stock: - gtk.Button.__init__(self, stock=stock) + Gtk.Button.__init__(self, stock=stock) else: - gtk.Button.__init__(self) + Gtk.Button.__init__(self) -class HIGToggleButton(gtk.ToggleButton): +class HIGToggleButton(Gtk.ToggleButton): def __init__(self, title="", stock=None): if title and stock: - gtk.ToggleButton.__init__(self) + Gtk.ToggleButton.__init__(self) content = HIGMixButton(title, stock) self.add(content) elif title and not stock: - gtk.ToggleButton.__init__(self, title) + Gtk.ToggleButton.__init__(self, label=title) elif stock: - gtk.ToggleButton.__init__(self, stock) + Gtk.ToggleButton.__init__(self, stock=stock) self.set_use_stock(True) else: - gtk.ToggleButton.__init__(self) + Gtk.ToggleButton.__init__(self) diff --git a/zenmap/zenmapGUI/higwidgets/higdialogs.py b/zenmap/zenmapGUI/higwidgets/higdialogs.py index f51128368..ee9aa33ef 100644 --- a/zenmap/zenmapGUI/higwidgets/higdialogs.py +++ b/zenmap/zenmapGUI/higwidgets/higdialogs.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,23 +65,27 @@ higwidgets/higdialogs.py __all__ = ['HIGDialog', 'HIGAlertDialog'] -import gtk +import gi -from gtkutils import gtk_version_minor +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class HIGDialog(gtk.Dialog): +class HIGDialog(Gtk.Dialog): """ HIGFied Dialog """ def __init__(self, title='', parent=None, flags=0, buttons=()): - gtk.Dialog.__init__(self, title, parent, flags, buttons) + Gtk.Dialog.__init__(self, title=title, parent=parent, flags=flags) self.set_border_width(5) self.vbox.set_border_width(2) self.vbox.set_spacing(6) + if buttons: + self.add_buttons(*buttons) -class HIGAlertDialog(gtk.MessageDialog): + +class HIGAlertDialog(Gtk.MessageDialog): """ HIGfied Alert Dialog. @@ -90,15 +93,16 @@ class HIGAlertDialog(gtk.MessageDialog): http://developer.gnome.org/projects/gup/hig/2.0/windows-alert.html """ - def __init__(self, parent=None, flags=0, type=gtk.MESSAGE_INFO, + def __init__(self, parent=None, flags=0, type=Gtk.MessageType.INFO, # HIG mandates that every Alert should have an "affirmative # button that dismisses the alert and performs the action # suggested" - buttons=gtk.BUTTONS_OK, + buttons=Gtk.ButtonsType.OK, message_format=None, secondary_text=None): - gtk.MessageDialog.__init__(self, parent, flags, type, buttons) + Gtk.MessageDialog.__init__(self, parent=parent, flags=flags, + message_type=type, buttons=buttons) self.set_resizable(False) @@ -109,11 +113,7 @@ class HIGAlertDialog(gtk.MessageDialog): self.set_markup( "%s" % message_format) if secondary_text: - # GTK up to version 2.4 does not have secondary_text - try: - self.format_secondary_text(secondary_text) - except Exception: - pass + self.format_secondary_text(secondary_text) if __name__ == '__main__': @@ -122,14 +122,14 @@ if __name__ == '__main__': # HIGDialog d = HIGDialog(title='HIGDialog', - buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) + buttons=(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)) dialog_label = HIGDialogLabel('A HIGDialogLabel on a HIGDialog') dialog_label.show() - d.vbox.pack_start(dialog_label) + d.vbox.pack_start(dialog_label, True, True, 0) entry_label = HIGEntryLabel('A HIGEntryLabel on a HIGDialog') entry_label.show() - d.vbox.pack_start(entry_label) + d.vbox.pack_start(entry_label, True, True, 0) d.run() d.destroy() diff --git a/zenmap/zenmapGUI/higwidgets/higentries.py b/zenmap/zenmapGUI/higwidgets/higentries.py index e55709ef9..e303baa3b 100644 --- a/zenmap/zenmapGUI/higwidgets/higentries.py +++ b/zenmap/zenmapGUI/higwidgets/higentries.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -64,11 +63,14 @@ higwidgets/higentries.py entries related classes """ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk __all__ = ('HIGTextEntry', 'HIGPasswordEntry') -HIGTextEntry = gtk.Entry +HIGTextEntry = Gtk.Entry class HIGPasswordEntry(HIGTextEntry): diff --git a/zenmap/zenmapGUI/higwidgets/higexpanders.py b/zenmap/zenmapGUI/higwidgets/higexpanders.py index 6ac4d1771..bcee0d9cb 100644 --- a/zenmap/zenmapGUI/higwidgets/higexpanders.py +++ b/zenmap/zenmapGUI/higwidgets/higexpanders.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,14 +65,17 @@ higwidgets/higexpanders.py __all__ = ['HIGExpander'] -import gtk +import gi -from higboxes import HIGHBox, hig_box_space_holder +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + +from .higboxes import HIGHBox, hig_box_space_holder -class HIGExpander(gtk.Expander): +class HIGExpander(Gtk.Expander): def __init__(self, label): - gtk.Expander.__init__(self) + Gtk.Expander.__init__(self) self.set_use_markup(True) self.set_label(label) diff --git a/zenmap/zenmapGUI/higwidgets/higframe.py b/zenmap/zenmapGUI/higwidgets/higframe.py index bbc1e464a..dd333b24f 100644 --- a/zenmap/zenmapGUI/higwidgets/higframe.py +++ b/zenmap/zenmapGUI/higwidgets/higframe.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,18 +65,21 @@ higwidgets/higframe.py __all__ = ['HIGFrame'] -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class HIGFrame(gtk.Frame): +class HIGFrame(Gtk.Frame): """ Frame without border with bold label. """ def __init__(self, label=None): - gtk.Frame.__init__(self) + Gtk.Frame.__init__(self) - self.set_shadow_type(gtk.SHADOW_NONE) - self._flabel = gtk.Label() + self.set_shadow_type(Gtk.ShadowType.NONE) + self._flabel = Gtk.Label() self._set_label(label) self.set_label_widget(self._flabel) @@ -86,20 +88,20 @@ class HIGFrame(gtk.Frame): # Demo if __name__ == "__main__": - w = gtk.Window() + w = Gtk.Window() hframe = HIGFrame("Sample HIGFrame") - aalign = gtk.Alignment(0, 0, 0, 0) + aalign = Gtk.Alignment.new(0, 0, 0, 0) aalign.set_padding(12, 0, 24, 0) - abox = gtk.VBox() + abox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) aalign.add(abox) hframe.add(aalign) w.add(hframe) - for i in xrange(5): - abox.pack_start(gtk.Label("Sample %d" % i), False, False, 3) + for i in range(5): + abox.pack_start(Gtk.Label.new("Sample %d" % i), False, False, 3) - w.connect('destroy', lambda d: gtk.main_quit()) + w.connect('destroy', lambda d: Gtk.main_quit()) w.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/higwidgets/higlabels.py b/zenmap/zenmapGUI/higwidgets/higlabels.py index 0fbd11f47..5677f09ae 100644 --- a/zenmap/zenmapGUI/higwidgets/higlabels.py +++ b/zenmap/zenmapGUI/higwidgets/higlabels.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -68,45 +67,49 @@ __all__ = [ 'HIGSectionLabel', 'HIGHintSectionLabel', 'HIGEntryLabel', 'HIGDialogLabel' ] -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk -class HIGSectionLabel(gtk.Label): +class HIGSectionLabel(Gtk.Label): """ Bold label, used to define sections """ def __init__(self, text=None): - gtk.Label.__init__(self) + Gtk.Label.__init__(self) if text: self.set_markup("%s" % (text)) - self.set_justify(gtk.JUSTIFY_LEFT) - self.set_alignment(0, 0.50) + self.set_justify(Gtk.Justification.LEFT) + self.props.xalign = 0 + self.props.yalign = 0.5 self.set_line_wrap(True) -class HIGHintSectionLabel(gtk.HBox, object): +class HIGHintSectionLabel(Gtk.Box, object): """ Bold label used to define sections, with a little icon that shows up a hint when mouse is over it. """ def __init__(self, text=None, hint=None): - gtk.HBox.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.label = HIGSectionLabel(text) self.hint = Hint(hint) - self.pack_start(self.label, False, False) + self.pack_start(self.label, False, False, 0) self.pack_start(self.hint, False, False, 5) -class Hint(gtk.EventBox, object): +class Hint(Gtk.EventBox, object): def __init__(self, hint): - gtk.EventBox.__init__(self) + Gtk.EventBox.__init__(self) self.hint = hint - self.hint_image = gtk.Image() - self.hint_image.set_from_stock( - gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_SMALL_TOOLBAR) + self.hint_image = Gtk.Image() + self.hint_image.set_from_icon_name( + "dialog-information", Gtk.IconSize.SMALL_TOOLBAR) self.add(self.hint_image) @@ -117,23 +120,27 @@ class Hint(gtk.EventBox, object): hint_window.show_all() -class HintWindow(gtk.Window): +class HintWindow(Gtk.Window): def __init__(self, hint): - gtk.Window.__init__(self, gtk.WINDOW_POPUP) - self.set_position(gtk.WIN_POS_MOUSE) - bg_color = gtk.gdk.color_parse("#fbff99") + Gtk.Window.__init__(self, type=Gtk.WindowType.POPUP) + self.set_position(Gtk.WindowPosition.MOUSE) + self.set_resizable(False) - self.modify_bg(gtk.STATE_NORMAL, bg_color) + bg_color = Gdk.RGBA() + bg_color.parse("#fbff99") + self.override_background_color(Gtk.StateFlags.NORMAL, bg_color) - self.event = gtk.EventBox() - self.event.modify_bg(gtk.STATE_NORMAL, bg_color) + self.event = Gtk.EventBox() + self.event.override_background_color(Gtk.StateFlags.NORMAL, bg_color) self.event.set_border_width(10) self.event.connect("button-press-event", self.close) - self.hint_label = gtk.Label(hint) + self.hint_label = Gtk.Label.new(hint) self.hint_label.set_use_markup(True) self.hint_label.set_line_wrap(True) - self.hint_label.set_alignment(0.0, 0.5) + self.hint_label.set_max_width_chars(52) + self.hint_label.props.xalign = 0 + self.hint_label.props.yalign = 0.5 self.event.add(self.hint_label) self.add(self.event) @@ -142,33 +149,34 @@ class HintWindow(gtk.Window): self.destroy() -class HIGEntryLabel(gtk.Label): +class HIGEntryLabel(Gtk.Label): """ Simple label, like the ones used to label entries """ def __init__(self, text=None): - gtk.Label.__init__(self, text) - self.set_justify(gtk.JUSTIFY_LEFT) - self.set_alignment(0, 0.50) + Gtk.Label.__init__(self, label=text) + self.set_justify(Gtk.Justification.LEFT) + self.props.xalign = 0 + self.props.yalign = 0.5 self.set_use_markup(True) self.set_line_wrap(True) -class HIGDialogLabel(gtk.Label): +class HIGDialogLabel(Gtk.Label): """ Centered, line-wrappable label, usually used on dialogs. """ def __init__(self, text=None): - gtk.Label.__init__(self, text) - self.set_justify(gtk.JUSTIFY_CENTER) + Gtk.Label.__init__(self, label=text) + self.set_justify(Gtk.Justification.CENTER) self.set_use_markup(True) self.set_line_wrap(True) if __name__ == "__main__": - w = gtk.Window() + w = Gtk.Window() h = HIGHintSectionLabel("Label", "Hint") w.add(h) - w.connect("delete-event", lambda x, y: gtk.main_quit()) + w.connect("delete-event", lambda x, y: Gtk.main_quit()) w.show_all() - gtk.main() + Gtk.main() diff --git a/zenmap/zenmapGUI/higwidgets/higlogindialogs.py b/zenmap/zenmapGUI/higwidgets/higlogindialogs.py index dd91690db..a9e822c3c 100644 --- a/zenmap/zenmapGUI/higwidgets/higlogindialogs.py +++ b/zenmap/zenmapGUI/higwidgets/higlogindialogs.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,12 +65,15 @@ higwidgets/higlogindialog.py __all__ = ['HIGLoginDialog'] -import gtk +import gi -from higdialogs import HIGDialog -from higlabels import HIGEntryLabel -from higtables import HIGTable -from higentries import HIGTextEntry, HIGPasswordEntry +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + +from .higdialogs import HIGDialog +from .higlabels import HIGEntryLabel +from .higtables import HIGTable +from .higentries import HIGTextEntry, HIGPasswordEntry class HIGLoginDialog(HIGDialog): @@ -79,8 +81,8 @@ class HIGLoginDialog(HIGDialog): A dialog that asks for basic login information (username / password) """ def __init__(self, title='Login', - buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)): + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)): HIGDialog.__init__(self, title, buttons=buttons) self.username_label = HIGEntryLabel("Username:") @@ -98,8 +100,8 @@ class HIGLoginDialog(HIGDialog): self.username_password_table.attach_entry(self.password_entry, 1, 2, 1, 2) - self.vbox.pack_start(self.username_password_table, False, False) - self.set_default_response(gtk.RESPONSE_ACCEPT) + self.vbox.pack_start(self.username_password_table, False, False, 0) + self.set_default_response(Gtk.ResponseType.ACCEPT) def run(self): self.show_all() @@ -112,5 +114,5 @@ if __name__ == '__main__': # HIGLoginDialog d = HIGLoginDialog() response_value = d.run() - print gtk_constant_name('response', response_value) + print(gtk_constant_name('response', response_value)) d.destroy() diff --git a/zenmap/zenmapGUI/higwidgets/hignotebooks.py b/zenmap/zenmapGUI/higwidgets/hignotebooks.py index 8e4fe38c2..ede36510f 100644 --- a/zenmap/zenmapGUI/higwidgets/hignotebooks.py +++ b/zenmap/zenmapGUI/higwidgets/hignotebooks.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -58,26 +57,28 @@ # * * # ***************************************************************************/ -import gtk -import gobject +import gi -from higboxes import HIGHBox -from higbuttons import HIGButton +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject + +from .higboxes import HIGHBox +from .higbuttons import HIGButton -class HIGNotebook(gtk.Notebook): +class HIGNotebook(Gtk.Notebook): def __init__(self): - gtk.Notebook.__init__(self) + Gtk.Notebook.__init__(self) self.popup_enable() class HIGClosableTabLabel(HIGHBox): __gsignals__ = { - 'close-clicked': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()) + 'close-clicked': (GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, ()) } def __init__(self, label_text=""): - gobject.GObject.__init__(self) + GObject.GObject.__init__(self) #HIGHBox.__init__(self, spacing=4) self.label_text = label_text @@ -86,12 +87,12 @@ class HIGClosableTabLabel(HIGHBox): #self.property_map = {"label_text" : self.label.get_label} def __create_widgets(self): - self.label = gtk.Label(self.label_text) - self.close_image = gtk.Image() - self.close_image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_BUTTON) + self.label = Gtk.Label.new(self.label_text) + self.close_image = Gtk.Image() + self.close_image.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.BUTTON) self.close_button = HIGButton() self.close_button.set_size_request(20, 20) - self.close_button.set_relief(gtk.RELIEF_NONE) + self.close_button.set_relief(Gtk.ReliefStyle.NONE) self.close_button.set_focus_on_click(False) self.close_button.add(self.close_image) @@ -124,6 +125,6 @@ class HIGClosableTabLabel(HIGHBox): def set_label(self, label): self.label.set_text(label) -gobject.type_register(HIGClosableTabLabel) +GObject.type_register(HIGClosableTabLabel) HIGAnimatedTabLabel = HIGClosableTabLabel diff --git a/zenmap/zenmapGUI/higwidgets/higprogressbars.py b/zenmap/zenmapGUI/higwidgets/higprogressbars.py index d665596d0..a861f7b53 100644 --- a/zenmap/zenmapGUI/higwidgets/higprogressbars.py +++ b/zenmap/zenmapGUI/higwidgets/higprogressbars.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,9 +65,12 @@ higwidgets/higprogressbars.py __all__ = ['HIGLabeledProgressBar'] -import gtk +import gi -from higboxes import HIGHBox +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk + +from .higboxes import HIGHBox class HIGLabeledProgressBar(HIGHBox): @@ -77,7 +79,7 @@ class HIGLabeledProgressBar(HIGHBox): if label: self.label = HIGEntryLabel(label) self.pack_label(self.label) - self.progress_bar = gtk.ProgressBar() + self.progress_bar = Gtk.ProgressBar() self.progress_bar.set_size_request(80, 16) self.pack_label(self.progress_bar) diff --git a/zenmap/zenmapGUI/higwidgets/higscrollers.py b/zenmap/zenmapGUI/higwidgets/higscrollers.py index 47aa41f58..c366b4a6f 100644 --- a/zenmap/zenmapGUI/higwidgets/higscrollers.py +++ b/zenmap/zenmapGUI/higwidgets/higscrollers.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,11 +65,14 @@ higwidgets/higscrollers.py __all__ = ['HIGScrolledWindow'] -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class HIGScrolledWindow(gtk.ScrolledWindow): +class HIGScrolledWindow(Gtk.ScrolledWindow): def __init__(self): - gtk.ScrolledWindow.__init__(self) - self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + Gtk.ScrolledWindow.__init__(self) + self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.set_border_width(5) diff --git a/zenmap/zenmapGUI/higwidgets/higspinner.py b/zenmap/zenmapGUI/higwidgets/higspinner.py index f9790ac57..179610b1c 100644 --- a/zenmap/zenmapGUI/higwidgets/higspinner.py +++ b/zenmap/zenmapGUI/higwidgets/higspinner.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,10 +65,10 @@ higwidgets/higspinner.py __all__ = ['HIGSpinner'] -import gtk -import gobject +import gi -from gtkutils import gobject_register +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GLib, Gdk, GdkPixbuf class HIGSpinnerImages: @@ -132,15 +131,15 @@ class HIGSpinnerImages: new_animated = [] for p in self.animated_pixbufs: new_animated.append(p.scale_simple(width, height, - gtk.gdk.INTERP_BILINEAR)) + GdkPixbuf.InterpType.BILINEAR)) self.animated_pixbufs = new_animated for k in self.static_pixbufs: self.static_pixbufs[k] = self.static_pixbufs[k].scale_simple( - width, height, gtk.gdk.INTERP_BILINEAR) + width, height, GdkPixbuf.InterpType.BILINEAR) self.rest_pixbuf = self.rest_pixbuf.scale_simple( - width, height, gtk.gdk.INTERP_BILINEAR) + width, height, GdkPixbuf.InterpType.BILINEAR) self.images_width = width self.images_height = height @@ -156,7 +155,7 @@ class HIGSpinnerCache: self.spinner_images = HIGSpinnerImages() # These are on Private member in the C implementation - self.icon_theme = gtk.IconTheme() + self.icon_theme = Gtk.IconTheme() self.originals = None self.images = None @@ -203,7 +202,7 @@ class HIGSpinnerCache: def load_animated_from_filename(self, filename, size): # grid_pixbuf is a pixbuf that holds the entire - grid_pixbuf = gtk.gdk.pixbuf_new_from_file(filename) + grid_pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) grid_width = grid_pixbuf.get_width() grid_height = grid_pixbuf.get_height() @@ -221,7 +220,7 @@ class HIGSpinnerCache: self.load_static_from_filename(filename) def load_static_from_filename(self, filename, key_name=None): - icon_pixbuf = gtk.gdk.pixbuf_new_from_file(filename) + icon_pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) if key_name is None: key_name = filename.split(".")[0] @@ -257,7 +256,7 @@ class HIGSpinnerCache: image_format) -class HIGSpinner(gtk.EventBox): +class HIGSpinner(Gtk.EventBox): """Simple spinner, such as the one found in webbrowsers and file managers. You can construct it with the optional parameters: @@ -266,11 +265,11 @@ class HIGSpinner(gtk.EventBox): * height, the height that will be set for the images """ - __gsignals__ = {'expose-event': 'override', - 'size-request': 'override'} + #__gsignals__ = {'expose-event': 'override', + # 'size-request': 'override'} def __init__(self): - gtk.EventBox.__init__(self) + Gtk.EventBox.__init__(self) #self.set_events(self.get_events()) @@ -325,13 +324,13 @@ class HIGSpinner(gtk.EventBox): def start(self): """Starts the animation""" if self.timer_task == 0: - self.timer_task = gobject.timeout_add(self.timeout, + self.timer_task = GLib.timeout_add(self.timeout, self.__bump_frame) def pause(self): """Pauses the animation""" if self.timer_task != 0: - gobject.source_remove(self.timer_task) + GLib.source_remove(self.timer_task) self.timer_task = 0 self.queue_draw() @@ -359,26 +358,29 @@ class HIGSpinner(gtk.EventBox): width = self.current_pixbuf.get_width() height = self.current_pixbuf.get_height() - x_offset = (self.allocation.width - width) / 2 - y_offset = (self.allocation.height - height) / 2 + x_offset = (self.allocation.width - width) // 2 + y_offset = (self.allocation.height - height) // 2 - pix_area = gtk.gdk.Rectangle(x_offset + self.allocation.x, - y_offset + self.allocation.y, - width, height) + pix_area = Gdk.Rectangle(x_offset + self.allocation.x, + y_offset + self.allocation.y, + width, height) dest = event.area.intersect(pix_area) - # If a graphic context doesn't not exist yet, create one - if self.gc is None: - self.gc = gtk.gdk.GC(self.window) - #gc = self.gc - - self.window.draw_pixbuf(self.gc, - self.current_pixbuf, - dest.x - x_offset - self.allocation.x, - dest.y - y_offset - self.allocation.y, - dest.x, dest.y, - dest.width, dest.height) +# # If a graphic context doesn't not exist yet, create one +# if self.gc is None: +# self.gc = gtk.gdk.GC(self.window) +# #gc = self.gc +# +# cairo = self.window.cairo_create() +# +# +# self.window.draw_pixbuf(self.gc, +# self.current_pixbuf, +# dest.x - x_offset - self.allocation.x, +# dest.y - y_offset - self.allocation.y, +# dest.x, dest.y, +# dest.width, dest.height) def do_size_request(self, requisition): # http://www.pygtk.org/pygtk2reference/class-gtkrequisition.html @@ -386,5 +388,3 @@ class HIGSpinner(gtk.EventBox): # FIXME, this should really come from the pixbuf size + margins requisition.width = self.cache.spinner_images.images_width requisition.height = self.cache.spinner_images.images_height - -gobject_register(HIGSpinner) diff --git a/zenmap/zenmapGUI/higwidgets/higtables.py b/zenmap/zenmapGUI/higwidgets/higtables.py index 1ff918c56..5561f43e7 100644 --- a/zenmap/zenmapGUI/higwidgets/higtables.py +++ b/zenmap/zenmapGUI/higwidgets/higtables.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,13 +65,16 @@ higwidgets/higlogindialog.py __all__ = ['HIGTable'] -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk #from higlabels import * #from higentries import * -class HIGTable(gtk.Table): +class HIGTable(Gtk.Table): """ A HIGFied table """ @@ -82,7 +84,7 @@ class HIGTable(gtk.Table): # - Generic attach function that detects the widget type def __init__(self, rows=1, columns=1, homogeneous=False): - gtk.Table.__init__(self, rows, columns, homogeneous) + Gtk.Table.__init__(self, n_rows=rows, n_columns=columns, homogeneous=homogeneous) self.set_row_spacings(6) self.set_col_spacings(12) @@ -90,7 +92,7 @@ class HIGTable(gtk.Table): self.columns = columns def attach_label(self, widget, x0, x, y0, y): - self.attach(widget, x0, x, y0, y, xoptions=gtk.FILL) + self.attach(widget, x0, x, y0, y, xoptions=Gtk.AttachOptions.FILL) def attach_entry(self, widget, x0, x, y0, y): - self.attach(widget, x0, x, y0, y, xoptions=gtk.FILL | gtk.EXPAND) + self.attach(widget, x0, x, y0, y, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND) diff --git a/zenmap/zenmapGUI/higwidgets/higtextviewers.py b/zenmap/zenmapGUI/higwidgets/higtextviewers.py index 028d6ea3b..0bd38d841 100644 --- a/zenmap/zenmapGUI/higwidgets/higtextviewers.py +++ b/zenmap/zenmapGUI/higwidgets/higtextviewers.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -66,11 +65,14 @@ higwidgets/higtextviewers.py __all__ = ['HIGTextView'] -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk -class HIGTextView(gtk.TextView): +class HIGTextView(Gtk.TextView): def __init__(self, text=''): - gtk.TextView.__init__(self) - self.set_wrap_mode(gtk.WRAP_WORD) + Gtk.TextView.__init__(self) + self.set_wrap_mode(Gtk.WrapMode.WORD) self.get_buffer().set_text(text) diff --git a/zenmap/zenmapGUI/higwidgets/higwindows.py b/zenmap/zenmapGUI/higwidgets/higwindows.py index 63800f6d4..ac4f74a94 100644 --- a/zenmap/zenmapGUI/higwidgets/higwindows.py +++ b/zenmap/zenmapGUI/higwidgets/higwindows.py @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # ***********************IMPORTANT NMAP LICENSE TERMS************************ # * * @@ -64,17 +63,20 @@ higwidgets/higwindows.py window related classes """ -import gtk +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk __all__ = ('HIGWindow', 'HIGMainWindow') -class HIGWindow(gtk.Window): +class HIGWindow(Gtk.Window): """HIGFied Window""" - def __init__(self, type=gtk.WINDOW_TOPLEVEL): - gtk.Window.__init__(self, type) + def __init__(self, type=Gtk.WindowType.TOPLEVEL): + Gtk.Window.__init__(self, type=type) self.set_border_width(5) # The Application main window should have no borders... # so it should be really a gtk.Window -HIGMainWindow = gtk.Window +HIGMainWindow = Gtk.Window