diff -u -r webalizer-2.01-10.noGeoIP/Makefile.std webalizer-2.01-10/Makefile.std --- webalizer-2.01-10.noGeoIP/Makefile.std 2007-01-23 23:06:31.000000000 -0800 +++ webalizer-2.01-10/Makefile.std 2006-07-09 01:39:19.000000000 -0700 @@ -41,6 +41,10 @@ # Some might need this instead (Solaris?!?) #LIBS = -lgd -lpng -lz -lm -ldb -lnsl -lsocket +# Now, if you want to use GeoIP feature... Uncoment this: +#DEFS = -DUSE_GEOIP -DETCDIR=\"${ETCDIR}\" +#LIBS = -lgd -lpng -lz -lm -lGeoIP + # If your GD lib was compiled with X/truetype, use this # or some variation of it: diff -u -r webalizer-2.01-10.noGeoIP/configure webalizer-2.01-10/configure --- webalizer-2.01-10.noGeoIP/configure 2000-10-06 00:51:48.000000000 -0700 +++ webalizer-2.01-10/configure 2004-07-21 00:01:56.000000000 -0700 @@ -34,8 +34,14 @@ ac_help="$ac_help --with-dblib=DIR Alternate location for db library" ac_help="$ac_help +--with-geoip-inc=DIR Alternate location for GeoIP headers" +ac_help="$ac_help +--with-geoip-lib=DIR Alternate location for GeoIP library" +ac_help="$ac_help --enable-dns Enable DNS lookup code" ac_help="$ac_help +--enable-geoip Enable GeoIP country lookup" +ac_help="$ac_help --with-language=language Use 'language' (default is english)" # Initialize some variables set by options. @@ -557,7 +563,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:561: checking for $ac_word" >&5 +echo "configure:567: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -587,7 +593,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:591: checking for $ac_word" >&5 +echo "configure:597: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -638,7 +644,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:642: checking for $ac_word" >&5 +echo "configure:648: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -670,7 +676,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:674: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:680: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -681,12 +687,12 @@ cat > conftest.$ac_ext << EOF -#line 685 "configure" +#line 691 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -712,12 +718,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:716: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:722: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:721: checking whether we are using GNU C" >&5 +echo "configure:727: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -726,7 +732,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -745,7 +751,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:749: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:755: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -777,7 +783,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:781: checking whether ln -s works" >&5 +echo "configure:787: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -828,7 +834,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:832: checking for a BSD compatible install" >&5 +echo "configure:838: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -881,7 +887,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:885: checking how to run the C preprocessor" >&5 +echo "configure:891: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -896,13 +902,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -913,13 +919,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -930,13 +936,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -961,14 +967,14 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:965: checking whether char is unsigned" >&5 +echo "configure:971: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -1123,6 +1129,20 @@ fi +# Check whether --with-geoip-inc or --without-geoip-inc was given. +if test "${with_geoip_inc+set}" = set; then + withval="$with_geoip_inc" + EXTRA_GEOIPINC="${withval}" +fi + + +# Check whether --with-geoip-lib or --without-geoip-lib was given. +if test "${with_geoip_lib+set}" = set; then + withval="$with_geoip_lib" + EXTRA_GEOIPLIB="${withval}" +fi + + # Check whether --enable-dns or --disable-dns was given. if test "${enable_dns+set}" = set; then enableval="$enable_dns" @@ -1130,17 +1150,24 @@ fi +# Check whether --enable-geoip or --disable-geoip was given. +if test "${enable_geoip+set}" = set; then + enableval="$enable_geoip" + USE_GEOIP="yes" +fi + + if test "$USE_DNS" = "yes"; then if test "$HAVE_DB" = ""; then for ac_func in dbopen do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1139: checking for $ac_func" >&5 +echo "configure:1166: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1190,14 +1217,14 @@ if test $ac_cv_func_dbopen = no; then echo $ac_n "checking for library containing dbopen""... $ac_c" 1>&6 -echo "configure:1194: checking for library containing dbopen" >&5 +echo "configure:1221: checking for library containing dbopen" >&5 if eval "test \"`echo '$''{'ac_cv_search_dbopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_dbopen="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_dbopen="none required" else @@ -1219,7 +1246,7 @@ test "$ac_cv_search_dbopen" = "no" && for i in db db1; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_dbopen="-l$i" break @@ -1265,17 +1292,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1269: checking for $ac_hdr" >&5 +echo "configure:1296: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1305,17 +1332,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1309: checking for $ac_hdr" >&5 +echo "configure:1336: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1346: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1345,12 +1372,12 @@ for ac_func in socket do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1349: checking for $ac_func" >&5 +echo "configure:1376: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1399,7 +1426,7 @@ if test $ac_cv_func_socket = no; then echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:1403: checking for main in -lsocket" >&5 +echo "configure:1430: checking for main in -lsocket" >&5 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1407,14 +1434,14 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1439,17 +1466,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1443: checking for $ac_hdr" >&5 +echo "configure:1470: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1453: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1476,7 +1503,7 @@ done echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:1480: checking for main in -lnsl" >&5 +echo "configure:1507: checking for main in -lnsl" >&5 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1484,14 +1511,14 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1514,7 +1541,7 @@ fi echo $ac_n "checking for main in -l44bsd""... $ac_c" 1>&6 -echo "configure:1518: checking for main in -l44bsd" >&5 +echo "configure:1545: checking for main in -l44bsd" >&5 ac_lib_var=`echo 44bsd'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1522,14 +1549,14 @@ ac_save_LIBS="$LIBS" LIBS="-l44bsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1551,7 +1578,7 @@ echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:1555: checking for main in -lm" >&5 +echo "configure:1582: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1559,14 +1586,14 @@ ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1588,7 +1615,7 @@ echo $ac_n "checking for main in -lz""... $ac_c" 1>&6 -echo "configure:1592: checking for main in -lz" >&5 +echo "configure:1619: checking for main in -lz" >&5 ac_lib_var=`echo z'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1596,14 +1623,14 @@ ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1628,7 +1655,7 @@ { echo "configure: error: z library not found... please install zlib." 1>&2; exit 1; } else echo $ac_n "checking for gzrewind in -lz""... $ac_c" 1>&6 -echo "configure:1632: checking for gzrewind in -lz" >&5 +echo "configure:1659: checking for gzrewind in -lz" >&5 ac_lib_var=`echo z'_'gzrewind | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1636,7 +1663,7 @@ ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1674,7 +1701,7 @@ fi echo $ac_n "checking for main in -lpng""... $ac_c" 1>&6 -echo "configure:1678: checking for main in -lpng" >&5 +echo "configure:1705: checking for main in -lpng" >&5 ac_lib_var=`echo png'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1682,14 +1709,14 @@ ac_save_LIBS="$LIBS" LIBS="-lpng $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1717,7 +1744,7 @@ if test "$EXTRA_GD" = ""; then if test "$EXTRA_GDLIB" = ""; then echo $ac_n "checking for gdImagePng in -lgd""... $ac_c" 1>&6 -echo "configure:1721: checking for gdImagePng in -lgd" >&5 +echo "configure:1748: checking for gdImagePng in -lgd" >&5 ac_lib_var=`echo gd'_'gdImagePng | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1725,7 +1752,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1763,7 +1790,7 @@ if test "$HAVE_LIBGD" = ""; then echo $ac_n "checking for libgd.a""... $ac_c" 1>&6 -echo "configure:1767: checking for libgd.a" >&5 +echo "configure:1794: checking for libgd.a" >&5 if eval "test \"`echo '$''{'ac_cv_GDLOC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1791,7 +1818,7 @@ if test "$GDLOC" = ""; then echo $ac_n "checking for libgd.so""... $ac_c" 1>&6 -echo "configure:1795: checking for libgd.so" >&5 +echo "configure:1822: checking for libgd.so" >&5 if eval "test \"`echo '$''{'ac_cv_GDLOC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1827,7 +1854,7 @@ echo $ac_n "checking for gd.h""... $ac_c" 1>&6 -echo "configure:1831: checking for gd.h" >&5 +echo "configure:1858: checking for gd.h" >&5 if eval "test \"`echo '$''{'ac_cv_GDLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1856,21 +1883,136 @@ { echo "configure: error: gd headers not found... please install gd." 1>&2; exit 1; } fi +if test "$USE_GEOIP" = "yes"; then + +echo $ac_n "checking for GeoIP.h""... $ac_c" 1>&6 +echo "configure:1890: checking for GeoIP.h" >&5 +if eval "test \"`echo '$''{'ac_cv_GEOIPINC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_GEOIPINC="" +fi + +INPATH=$ac_cv_GEOIPINC +if test "$INPATH" = ""; then + for i in ${PREFIX}/include /usr/local/include /usr/include /include ${prefix}/include ./ ${EXTRA_GEOIPINC}; do + if test -f "$i/GeoIP.h"; then + INPATH=$i + fi + done +fi + +if test "$INPATH" = ""; then +echo "$ac_t""no" 1>&6 +GEOIPINC="" +else +echo "$ac_t""$INPATH" 1>&6 +GEOIPINC=$INPATH +fi +ac_cv_GEOIPINC=$GEOIPINC + + if test "$GEOIPINC" = ""; then + { echo "configure: error: GeoIP headers not found... please install GeoIP." 1>&2; exit 1; } + else + CFLAGS="-I${GEOIPINC} ${CFLAGS}" + fi + + +echo $ac_n "checking for libGeoIP.a""... $ac_c" 1>&6 +echo "configure:1923: checking for libGeoIP.a" >&5 +if eval "test \"`echo '$''{'ac_cv_GEOIPLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_GEOIPLIB="" +fi + +INPATH=$ac_cv_GEOIPLIB +if test "$INPATH" = ""; then + for i in ${PREFIX}/lib /usr/local/lib /usr/lib /lib ${prefix}/lib ./ ${EXTRA_GEOIPLIB}; do + if test -f "$i/libGeoIP.a"; then + INPATH=$i + fi + done +fi + +if test "$INPATH" = ""; then +echo "$ac_t""no" 1>&6 +GEOIPLIB="" +else +echo "$ac_t""$INPATH" 1>&6 +GEOIPLIB=$INPATH +fi +ac_cv_GEOIPLIB=$GEOIPLIB + + if test "$GEOIPLIB" = ""; then + { echo "configure: error: GeoIP library not found... please install GeoIP." 1>&2; exit 1; } + else + LDFLAGS="-L${GEOIPLIB} ${LDFLAGS}" + fi + + echo $ac_n "checking for GeoIP_new in -lGeoIP""... $ac_c" 1>&6 +echo "configure:1955: checking for GeoIP_new in -lGeoIP" >&5 +ac_lib_var=`echo GeoIP'_'GeoIP_new | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lGeoIP $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="-lGeoIP ${LIBS}" +else + echo "$ac_t""no" 1>&6 +LIBGEOIP="no" +fi + + if test "$LIBGEOIP" = "no"; then + { echo "configure: error: GeoIP library not functional... please install GeoIP." 1>&2; exit 1; } + else + OPTS="-DUSE_GEOIP ${OPTS}" + fi +fi + for ac_hdr in getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1864: checking for $ac_hdr" >&5 +echo "configure:2006: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1901,17 +2043,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1905: checking for $ac_hdr" >&5 +echo "configure:2047: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1940,7 +2082,7 @@ fi echo $ac_n "checking default config dir""... $ac_c" 1>&6 -echo "configure:1944: checking default config dir" >&5 +echo "configure:2086: checking default config dir" >&5 if test "$CACHE_ETC" = "yes"; then if eval "test \"`echo '$''{'ac_cv_etcdir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1965,7 +2107,7 @@ if test "$WEBALIZER_LANG" = "no"; then WEBALIZER_LANG=english; fi echo $ac_n "checking for language file""... $ac_c" 1>&6 -echo "configure:1969: checking for language file" >&5 +echo "configure:2111: checking for language file" >&5 if test "$LANG_CACHE" = "yes"; then if eval "test \"`echo '$''{'ac_cv_language'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2147,6 +2289,8 @@ s%@CPP@%$CPP%g s%@GDLOC@%$GDLOC%g s%@GDLIB@%$GDLIB%g +s%@GEOIPINC@%$GEOIPINC%g +s%@GEOIPLIB@%$GEOIPLIB%g s%@ETCDIR@%$ETCDIR%g CEOF diff -u -r webalizer-2.01-10.noGeoIP/configure.in webalizer-2.01-10/configure.in --- webalizer-2.01-10.noGeoIP/configure.in 2000-10-06 00:51:49.000000000 -0700 +++ webalizer-2.01-10/configure.in 2004-07-21 00:01:56.000000000 -0700 @@ -62,10 +62,20 @@ AC_ARG_WITH(dblib,--with-dblib=DIR Alternate location for db library, LDFLAGS="-L${withval} ${LDFLAGS}"; HAVE_DB="yes", HAVE_DB="") +AC_ARG_WITH(geoip-inc,--with-geoip-inc=DIR Alternate location for GeoIP headers, +EXTRA_GEOIPINC="${withval}") + +AC_ARG_WITH(geoip-lib,--with-geoip-lib=DIR Alternate location for GeoIP library, +EXTRA_GEOIPLIB="${withval}") + dnl enable-dns forces use of DNS code AC_ARG_ENABLE(dns,--enable-dns Enable DNS lookup code, USE_DNS="yes") +dnl enable-geoip forces use of GeoIP library +AC_ARG_ENABLE(geoip,--enable-geoip Enable GeoIP country lookup, +USE_GEOIP="yes") + dnl DNS library check if test "$USE_DNS" = "yes"; then if test "$HAVE_DB" = ""; then @@ -146,6 +156,32 @@ AC_MSG_ERROR(gd headers not found... please install gd.) fi +dnl Check GeoIP if user wants it +if test "$USE_GEOIP" = "yes"; then + dnl Check for GeoIP headers + AC_FIND_PATH(GEOIPINC,GeoIP.h,"", ${PREFIX}/include /usr/local/include /usr/include /include ${prefix}/include ./ ${EXTRA_GEOIPINC}) + if test "$GEOIPINC" = ""; then + AC_MSG_ERROR(GeoIP headers not found... please install GeoIP.) + else + CFLAGS="-I${GEOIPINC} ${CFLAGS}" + fi + + dnl Check for GeoIP library + AC_FIND_PATH(GEOIPLIB,libGeoIP.a,"", ${PREFIX}/lib /usr/local/lib /usr/lib /lib ${prefix}/lib ./ ${EXTRA_GEOIPLIB}) + if test "$GEOIPLIB" = ""; then + AC_MSG_ERROR(GeoIP library not found... please install GeoIP.) + else + LDFLAGS="-L${GEOIPLIB} ${LDFLAGS}" + fi + + AC_CHECK_LIB(GeoIP, GeoIP_new, LIBS="-lGeoIP ${LIBS}", LIBGEOIP="no") + if test "$LIBGEOIP" = "no"; then + AC_MSG_ERROR(GeoIP library not functional... please install GeoIP.) + else + OPTS="-DUSE_GEOIP ${OPTS}" + fi +fi + dnl additonal platform specific checks AC_CHECK_HEADERS(getopt.h) if test "$HAVE_LIBM" = "1"; then diff -u -r webalizer-2.01-10.noGeoIP/output.c webalizer-2.01-10/output.c --- webalizer-2.01-10.noGeoIP/output.c 2007-01-23 23:06:31.000000000 -0800 +++ webalizer-2.01-10/output.c 2006-11-05 02:37:57.000000000 -0800 @@ -59,6 +59,12 @@ #define CLK_TCK _SC_CLK_TCK #endif +/* GeoIP stuff */ +#ifdef USE_GEOIP +#include +extern GeoIP *gi; +#endif /* USE_GEOIP */ + #include "webalizer.h" /* main header */ #include "lang.h" #include "hashtab.h" @@ -2273,7 +2279,7 @@ int ctry_fnd; u_int64_t idx; HNODEPTR hptr; - char *domain; + char *domain, *country = NULL; u_int64_t pie_data[10]; char *pie_legend[10]; char pie_title[48]; @@ -2281,6 +2287,12 @@ extern int ctry_graph; /* include external flag */ +#ifdef USE_GEOIP + const char *result; + char code[3]; + code[2]='\0'; +#endif /* USE_GEOIP */ + /* scan hash table adding up domain totals */ for (i=0;istring+strlen(hptr->string)-1; while ( (*domain!='.')&&(domain!=hptr->string)) domain--; - if ((domain==hptr->string)||(isdigit((int)*++domain))) - { - ctry[0].count+=hptr->count; - ctry[0].files+=hptr->files; - ctry[0].xfer +=hptr->xfer; - } - else + if (domain==hptr->string) + country=NULL; + else if (isdigit((int)*++domain)) { - ctry_fnd=0; - idx=ctry_idx(domain); +#ifdef USE_GEOIP + if (use_geoip) + { + result = GeoIP_country_code_by_addr(gi, hptr->string); + if ((result == NULL)||((result[0]=='-')&&(result[1]=='-'))) + country=NULL; + else + { + code[0]=tolower(result[0]); + code[1]=tolower(result[1]); + + country=code; + } + } + else + country=NULL; + +#else + country=NULL; +#endif /* USE_GEOIP */ + } + else + { + country=domain; + } + + ctry_fnd=0; + if (country!=NULL) + { + idx=ctry_idx(country); for (j=0;ctry[j].desc;j++) { if (idx==ctry[j].idx) @@ -2312,12 +2348,19 @@ break; } } - if (!ctry_fnd) - { - ctry[0].count+=hptr->count; - ctry[0].files+=hptr->files; - ctry[0].xfer +=hptr->xfer; - } + } + if ((!ctry_fnd)||(country==NULL)) + { +#ifdef USE_GEOIP + if (use_geoip && debug_mode) + fprintf(stderr, "--> unresolved country for '%s' (GeoIP says %s:%s)\n", + hptr->string, + GeoIP_country_code_by_addr(gi, hptr->string), + GeoIP_country_name_by_addr(gi, hptr->string)); +#endif /* USE_GEOIP */ + ctry[0].count+=hptr->count; + ctry[0].files+=hptr->files; + ctry[0].xfer +=hptr->xfer; } } hptr=hptr->next; diff -u -r webalizer-2.01-10.noGeoIP/sample.conf webalizer-2.01-10/sample.conf --- webalizer-2.01-10.noGeoIP/sample.conf 2000-09-28 20:51:42.000000000 -0700 +++ webalizer-2.01-10/sample.conf 2004-07-21 00:01:56.000000000 -0700 @@ -568,4 +568,12 @@ #DumpUsers no #DumpSearchStr no +# If you compiled Webalizer with GeoIP library, it becomes enabled +# by default. But if you wish to disable it, just set GeoIP to 'no'. +# You may also want to specify database file path manually, if you +# don't have one installed on system (in case of static build). + +#GeoIP yes +#GeoIPDatabase /usr/local/share/GeoIP/GeoIP.dat + # End of configuration file... Have a nice day! diff -u -r webalizer-2.01-10.noGeoIP/webalizer.c webalizer-2.01-10/webalizer.c --- webalizer-2.01-10.noGeoIP/webalizer.c 2007-01-23 23:06:31.000000000 -0800 +++ webalizer-2.01-10/webalizer.c 2006-10-01 03:27:46.000000000 -0700 @@ -71,6 +71,11 @@ #endif /* HAVE_DB_185_H */ #endif /* USE_DNS */ +#ifdef USE_GEOIP +#include +#define GEOIP_FLAGS GEOIP_MEMORY_CACHE +#endif /* USE_GEOIP */ + #include "webalizer.h" /* main header */ #include "output.h" #include "parser.h" @@ -140,6 +145,12 @@ char *dns_cache = NULL; /* DNS cache file name */ int dns_children = 0; /* DNS children (0=don't do)*/ +#ifdef USE_GEOIP +int use_geoip = 1; /* Use GeoIP library */ +char *geoip_dbase = NULL; /* Use specific GeoIP dbase */ +GeoIP *gi = NULL; /* GeoIP handle */ +#endif /* USE_GEOIP */ + #if defined(MODIFY_LOG_LINES) int strip_abs_url = 0; /* 1 => remove host part of URLs */ int ignore_rel_url = 0; /* 1 => ignore non-abs URLs */ @@ -220,7 +231,7 @@ time_t now; /* used by cur_time funct */ struct tm *tp; /* to generate timestamp */ -char timestamp[32]; /* for the reports */ +char timestamp[64]; /* for the reports */ gzFile gzlog_fp; /* gzip logfile pointer */ FILE *log_fp; /* regular logfile pointer */ @@ -277,16 +288,22 @@ /* add default index. alias */ add_nlist("index.",&index_alias); +#ifndef WIN32 sprintf(tmp_buf,"%s/webalizer.conf",ETCDIR); /* check for default config file */ if (!access("webalizer.conf",F_OK)) get_config("webalizer.conf"); else if (!access(tmp_buf,F_OK)) get_config(tmp_buf); +#endif /* WIN32 */ /* get command line options */ opterr = 0; /* disable parser errors */ +#ifndef USE_GEOIP while ((i=getopt(argc,argv,"a:A:c:C:dD:e:E:fF:g:GhHiI:j:J:l:Lm:M:n:N:o:pP:qQr:R:s:S:t:Tu:U:vVx:XYzZ"))!=EOF) +#else + while ((i=getopt(argc,argv,"a:A:c:C:dD:e:E:fF:g:GhHiI:j:J:l:Lm:M:n:N:o:pP:qQr:R:s:S:t:Tu:U:vVwW:x:XYzZ"))!=EOF) +#endif /* USE_GEOIP */ { switch (i) { @@ -331,6 +348,10 @@ case 'U': ntop_urls=atoi(optarg); break; /* Top urls */ case 'v': case 'V': print_version(); break; /* Version */ +#ifdef USE_GEOIP + case 'w': use_geoip=0; break; /* Disable GeoIP */ + case 'W': geoip_dbase=optarg; break; /* Use GeoIP database */ +#endif /* USE_GEOIP */ case 'x': html_ext=optarg; break; /* HTML file extension */ case 'X': hide_sites=1; break; /* Hide ind. sites */ case 'Y': ctry_graph=0; break; /* Supress ctry graph */ @@ -464,6 +485,27 @@ } } +#ifdef USE_GEOIP + /* Open GeoIP database */ + if (use_geoip) + { + if (geoip_dbase!=NULL) + { + if (verbose>1) printf("Using GeoIP database %s\n", geoip_dbase); + gi=GeoIP_open(geoip_dbase, GEOIP_FLAGS); + } + else + { + if (verbose>1) printf("Using default GeoIP database\n"); + gi=GeoIP_new(GEOIP_FLAGS); + } + + /* GeoIP already prints error (in English!) */ + if (gi==NULL) + exit(1); + } +#endif /* USE_GEOIP */ + /* switch directories if needed */ if (out_dir) { @@ -1391,6 +1433,10 @@ if (dns_db) close_cache(); #endif +#ifdef USE_GEOIP + if (gi) GeoIP_delete(gi); +#endif /* USE_GEOIP */ + /* Whew, all done! Exit with completion status (0) */ exit(0); } @@ -1558,6 +1604,10 @@ "DNSChildren", /* DNS Children (0=no DNS) 85 */ "DailyGraph", /* Daily Graph (0=no) 86 */ "DailyStats", /* Daily Stats (0=no) 87 */ +#ifdef USE_GEOIP + "GeoIP", /* Use GeoIP library (0=no) 88 */ + "GeoIPDatabase", /* GeoIP database 89 */ +#endif /* USE_GEOIP */ "HideDir", /* URL path dirs to hide 90 */ "DumpDirs", /* Dump dirs tab file 91 */ "TopDirs", /* Top dirs 92 */ @@ -1706,8 +1756,13 @@ #endif /* USE_DNS */ case 86: daily_graph=(value[0]=='n')?0:1; break; /* HourlyGraph */ case 87: daily_stats=(value[0]=='n')?0:1; break; /* HourlyStats */ +#ifdef USE_GEOIP + case 88: use_geoip=(value[0]=='n')?0:1; break; /* GeoIP */ + case 89: geoip_dbase=save_opt(value); break; /* GeoIPDatabase */ +#else case 88: /* Disable use of GeoIP if not enabled */ case 89: printf("%s '%s' (%s)\n",msg_bad_key,keyword,fname); break; +#endif /* USE_GEOIP */ case 90: add_nlist(value,&hidden_dirs); break; /* HideDir */ case 91: dump_dirs=(value[0]=='y')?1:0; break; /* DumpDirs? */ case 92: ntop_dirs = atoi(value); break; /* TopDirs */ @@ -1805,10 +1860,20 @@ printf("Mod date: %s Options: ",moddate); #ifdef USE_DNS printf("DNS "); -#else +#endif +#ifdef USE_GEOIP + printf("GeoIP "); +#endif /* USE_GEOIP */ + +#if !((defined(USE_DNS)) || (defined(USE_GEOIP))) printf("none"); #endif + +#ifndef WIN32 printf("\nDefault config dir: %s\n\n",ETCDIR); +#else + printf("\nNo default config dir (Win32 Build)\n\n"); +#endif /* WIN32 */ } else printf("\n"); exit(1); diff -u -r webalizer-2.01-10.noGeoIP/webalizer.h webalizer-2.01-10/webalizer.h --- webalizer-2.01-10.noGeoIP/webalizer.h 2007-01-23 23:06:31.000000000 -0800 +++ webalizer-2.01-10/webalizer.h 2006-10-01 05:54:45.000000000 -0700 @@ -127,6 +127,10 @@ #endif /* INADDR_NONE */ #endif +#ifdef WIN32 +#include +#endif + /* Response code structure */ struct response_code { char *desc; /* response code struct */ u_int64_t count; }; @@ -196,6 +200,11 @@ extern char *dns_cache ; /* DNS cache file name */ extern int dns_children ; /* # of DNS children */ +#ifdef USE_GEOIP +extern int use_geoip ; /* Use GeoIP library */ +extern char *geoip_dbase ; /* Use specific GeoIP dbase */ +#endif + #if defined(MODIFY_LOG_LINES) extern int strip_abs_url; /* 1 => remove host part of URLs */ extern int ignore_rel_url; /* 1 => ignore non-abs URLs */