1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
|
dnl OpenVAS
dnl $Id$
dnl Description: autoconf script for the OpenVAS-libraries
dnl
dnl Authors:
dnl Renaud Deraison <deraison@nessus.org> (Original pre-fork development)
dnl
dnl Copyright:
dnl Based on work Copyright (C) 1998 - 2006 Tenable Network Security, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License version 2,
dnl as published by the Free Software Foundation
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dnl
dnl Supported options :
dnl
dnl --enable-release
AC_INIT(.root-dir)
AC_REVISION($Revision$)dnl
AC_PREREQ(2.50)
PWDD=`pwd`
VERSION=`cat VERSION`
save_IFS="${IFS}"
IFS=.
read OPENVASLIBS_MAJOR OPENVASLIBS_MINOR OPENVASLIBS_PATCH OPENVASLIBS_RC <VERSION
IFS="${save_IFS}"
OPENVASLIBS_DATE=\"`date '+%b %d, %Y'`\"
expr 0 + $OPENVASLIBS_MAJOR + $OPENVASLIBS_MINOR + $OPENVASLIBS_PATCH + 0 >/dev/null ||
AC_MSG_ERROR([ *** Panic: Corrupt version file])
version=$OPENVASLIBS_MAJOR.$OPENVASLIBS_MINOR.$OPENVASLIBS_PATCH
dnl A tribute to libtool: more fiddling around wirh versions
OPENVASLIBS_SUPER=`expr $OPENVASLIBS_MAJOR + $OPENVASLIBS_MINOR`
dnl Set up the main lines of the config script
AC_CONFIG_HEADER(include/config.h)
AC_PREFIX_DEFAULT("/usr/local")
AC_LANG_C
dnl Set some defaults, enable with keyword 'yes'
GCC_NO_PIPE=no
dnl some compiler option
AC_ARG_ENABLE(gccpipe,[ --enable-gccpipe use \"gcc -pipe\" for compilation, where possible],
[case $enable_gccpipe in
n*|N*) GCC_NO_PIPE=yes ;;
y*|Y*) unset GCC_NO_PIPE ;;
esac])
test x$GCC_NO_PIPE = xno && unset GCC_NO_PIPE
dnl Check for several programs
AC_PROG_CC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
# test, whether the compiler understands the -pipe command
# (thanks to Tatu Illonen: ssh/configure.in)
CC_NOPIPE="$CC"
if test -z "$GCC_NO_PIPE" -a -n "$GCC"; then
AC_MSG_CHECKING([if the compiler understands -pipe])
CC="$CC -pipe"
AC_TRY_COMPILE(,,
AC_MSG_RESULT(yes),
CC="$CC_NOPIPE"
AC_MSG_RESULT(no))
fi
AC_PROG_MAKE_SET
AC_PROG_INSTALL
echo "$INSTALL" | egrep "^\./" 2>&1 > /dev/null &&
{
INSTALL="$PWDD/install-sh"
}
INSTALL_DIR="$INSTALL -d"
dnl Check for glib
dnl GLIB needs to be quoted in the next line otherwise m4 tries to expand it#
PKG_CHECK_MODULES([GLIB], glib-2.0 >= 2.6.0, HAVE_GLIB="yes", AC_MSG_ERROR("glib >= 2.6.0 not found"))
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_CHECK_HEADER(gcrypt.h, LIBS="-lgcrypt $LIBS", AC_MSG_ERROR("gcrypt.h not found"))
dnl Check for extra libraries
AC_CHECK_LIB(resolv, dn_expand, LIBS="-lresolv $LIBS",
[AC_CHECK_LIB(resolv, __dn_expand, LIBS="-lresolv $LIBS",
AC_MSG_ERROR(you need to install resolve library with development files))])
AC_CHECK_LIB(gnutls, gnutls_init, LIBS="-lgnutls $LIBS",
AC_MSG_ERROR(you need to install gnutls library with development files))
AC_CHECK_LIB(pcap, pcap_restart, LIBS="-lpcap $LIBS",
AC_MSG_ERROR(you need to install pcap library with development files))
# These libraries break stuff under IRIX
if test "`uname`" != "IRIX" ;
then
AC_HAVE_LIBRARY(socket, [socket_lib="-lsocket";LIBS="-lsocket $LIBS";])
AC_HAVE_LIBRARY(nsl, [nsl_lib="-lnsl";LIBS="-lnsl $LIBS";])
fi
dnl User options
AC_ARG_ENABLE(release,[ --enable-release set the compiler flags to -O6],
CFLAGS="-O6")
debug_ssl=""
AC_ARG_ENABLE(debug-ssl,[ --enable-debug-ssl produce verbose output regarding SSL],
debug_ssl="-DDEBUG_SSL=1")
AC_ARG_ENABLE(debug,[ --enable-debug set the compiler flags to -g],
debug_cflags="-DDEBUG -g")
AC_ARG_WITH(egd,
[ --with-egd=/path specifies the path to the EGD socket],
[
egdpath="$withval"
AC_DEFINE_UNQUOTED(EGD_PATH, "$egdpath")
])
AC_C_BIGENDIAN
AC_ARG_ENABLE(ptmx,[ --enable-ptmx force using/disabling the /dev/ptmx multiplexer],
[case $enable_ptmx in
n*|N*) USE_PTMX=no ;;
*) USE_PTMX=yes ;;
esac])
AC_ARG_ENABLE(openpty,[ --enable-openpty if present, use/disable openpty for creating ptys],
[case $enable_openpty in
n*|N*) USE_OPENPTY=no ;;
*) USE_OPENPTY=yes ;;
esac])
dnl Check for several headers
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_CHECK_HEADERS(linux/msg.h sys/msg.h sys/ipc.h)
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/sockio.h sys/socketio.h sys/uio.h)
AC_CHECK_HEADERS(sys/param.h netinet/in_systm.h)
AC_CHECK_HEADERS(netinet/in.h,,,[#include <sys/types.h>])
AC_CHECK_HEADERS(netinet/in_systm.h,,,[#include <sys/types.h>])
AC_CHECK_HEADERS(netinet/ip.h,,,[#include <sys/types.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>])
AC_CHECK_HEADERS(netinet/ip_icmp.h,,,[#include <sys/types.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>])
AC_CHECK_HEADERS(netinet/ip.h netinet/udp.h netinet/protocols.h netinet/ip_udp.h netinet/ip_tcp.h netinet/tcpip.h ,,,[#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip_var.h>
#include <netinet/udp.h>
#include <netinet/tcp.h>])
AC_CHECK_HEADERS(sys/socket.h sys/resource.h)
AC_CHECK_HEADERS(net/if.h,,,[#include <sys/socket.h>])
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(rpc/rpc.h dlfcn.h sys/un.h memory.h ctype.h errno.h)
AC_CHECK_HEADERS(sys/types.h stdlib.h stdio.h pthread.h sys/filio.h pwd.h)
AC_CHECK_HEADERS(assert.h netdb.h arpa/inet.h setjmp.h)
AC_CHECK_HEADERS(poll.h sys/poll.h fcntl.h signal.h sys/termio.h)
AC_CHECK_HEADERS(sys/stat.h stat.h sys/mman.h termio.h termios.h sgtty.h)
AC_CHECK_HEADERS(ptem.h sys/ptem.h ldterm.h sys/ldterm.h stropts.h values.h)
AC_CHECK_HEADERS(sys/param.h sys/sysctl.h limits.h)
dnl ./configure fails to determine the existence of some
dnl headers under IRIX
case "$host" in
*-irix*)
AC_DEFINE(HAVE_SYS_SOCKET_H)
AC_DEFINE(HAVE_NETINET_IP_H)
AC_DEFINE(HAVE_NETINET_TCP_H)
;;
*)
;;
esac
case "$host" in
*-hpux*)
AC_DEFINE(HPUX)
;;
esac
dnl Check for several functions
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(sigaction sysctl setproctitle setitimer)
AC_CHECK_FUNCS(lstat memmove gettimeofday gethrtime getrusage rand)
AC_CHECK_FUNCS(strchr memcpy select poll unlockpt)
AC_CHECK_FUNCS(vsnprintf snprintf vasnprintf vasprintf asprintf asnprintf)
AC_CHECK_FUNCS(bzero bcopy setsid)
AC_CHECK_FUNCS(addr2ascii inet_neta lrand48 setitimer sendmsg recvmsg)
# disable openpty() upon request, only
if test x$USE_OPENPTY != xno -a x$USE_PTMX != xyes ; then
AC_CHECK_LIB(util,openpty,LIBS="-lutil $LIBS")
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $LIBS"
AC_CHECK_FUNCS(openpty,FOUND_OPENPTY=yes)
LDFLAGS=$save_LDFLAGS
# undef the request for openpty as it is not available
if test x$FOUND_OPENPTY != xyes ;then
USE_OPENPTY=no
fi
fi
dnl check for pty multiplexer device
if test x$USE_PTMX = x ; then
AC_MSG_CHECKING(for "/dev/ptmx" as a character device)
test -c "/dev/ptmx"
else
AC_MSG_CHECKING(for "/dev/ptmx" to exist by config argument)
test x$USE_PTMX = xyes
fi
if test $? = 0 ; then
if test x$USE_OPENPTY = xyes ; then
AC_MSG_RESULT([unsing openpty(), instead])
else
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEV_PTMX)
HAVE_DEV_PTMX=yes
fi
else AC_MSG_RESULT(no)
fi
dnl check for pty multiplexer libraries, needed
test x$HAVE_DEV_PTMX = xyes &&
AC_CHECK_FUNCS(grantpt ptsname,,test x$USE_PTMX = xyes && AC_ERROR([
*** You loose: /dev/ptmx needs to be supported by grantpt() and ptsname().
]))
AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON))
AC_CHECK_LIB(resolv, inet_aton, AC_DEFINE(HAVE_INET_ATON))
AC_CHECK_LIB(nsl, inet_aton, AC_DEFINE(HAVE_INET_ATON))
llib="";
AC_CHECK_LIB(l, yylex, llib=-ll)
test -z "$llib" &&
{
AC_CHECK_LIB(fl, yylex, llib=-lfl)
}
test -z "$llib" &&
{
AC_CHECK_LIB(l, lex_init, llib=-ll)
test -z "$llib" &&
{
AC_CHECK_LIB(fl, lex_init, llib=-lfl)
}
}
dnl This test is from the configure.in of Unix Network Programming second
dnl edition example code by W. Richard Stevens
dnl ##################################################################
dnl Check if sockaddr{} has sa_len member.
dnl
AC_CACHE_CHECK(if sockaddr{} has sa_len member, ac_cv_sockaddr_has_sa_len,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/socket.h>],
[unsigned int i = sizeof(((struct sockaddr *)0)->sa_len)],
ac_cv_sockaddr_has_sa_len=yes,
ac_cv_sockaddr_has_sa_len=no))
if test $ac_cv_sockaddr_has_sa_len = yes ; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
fi
AC_CACHE_CHECK(if struct ifmap exists, ac_cv_ifmap,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/socket.h>
# include <net/if.h>],
[unsigned int i = sizeof(struct ifmap)],
ac_cv_have_ifmap=yes,
ac_cv_have_ifmap=no))
if test $ac_cv_have_ifmap = yes ; then
AC_DEFINE(HAVE_STRUCT_IFMAP)
fi
AC_CHECK_TYPE(time_t,int)
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
darwin=`uname`
test "$darwin" = "Darwin" && {
AC_MSG_CHECKING(for the useability of arpa/nameser_compat.h)
AC_TRY_COMPILE([
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser_compat.h>
#include <resolv.h>
], [static int i; i = 0;],
[AC_MSG_RESULT(yes)
HAVE_TIMEVAL=yes
AC_DEFINE(USE_ARPA_NAMESER_COMPAT_H)],
[AC_MSG_RESULT(no)
])
}
dnl this routine has been adopted from the GNU emacs20 distrubution
AC_MSG_CHECKING(for struct timeval)
AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
[AC_MSG_RESULT(yes)
HAVE_TIMEVAL=yes
AC_DEFINE(HAVE_TIMEVAL)],
[AC_MSG_RESULT(no)
HAVE_TIMEVAL=no])
AC_MSG_CHECKING(if optind is defined in a library already)
AC_TRY_COMPILE([#include <stdio.h>], [extern int optind;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_OPTIND)],
[AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(if msg_accrights exists in msghdr)
AC_TRY_COMPILE([#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>], [int main() { struct msghdr msg; msg.msg_accrights = 0;}],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)],
[AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(if msg_control exists in msghdr)
AC_TRY_COMPILE([#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>], [int main() { struct msghdr msg; msg.msg_control = 0;}],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)],
[AC_MSG_RESULT(no)
])
dnl Check for the number of arguments for gettimeofday (), this routine
dnl has been adopted from the GNU emacs20 distrubution
if test "x$HAVE_TIMEVAL" = xyes; then
AC_MSG_CHECKING([whether gettimeofday can't accept two arguments])
AC_TRY_LINK([
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
],
[
struct timeval time;
struct timezone dummy;
gettimeofday (&time, &dummy);
],
[AC_MSG_RESULT(no)],
[AC_MSG_RESULT(yes)
AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT)])
fi
dnl Define several paths
AC_SYS_LONG_FILE_NAMES
EXTRA=$LIBS
case "$host" in
*-darwin*)
AC_DEFINE(DARWIN)
;;
*-netbsd*)
AC_DEFINE(NETBSD)
;;
*-openbsd*)
AC_DEFINE(OPENBSD)
;;
*-sgi-irix5*)
AC_DEFINE(IRIX)
;;
*-sgi-irix6*)
AC_DEFINE(IRIX)
;;
*-solaris2.0*)
AC_DEFINE(SOLARIS)
;;
*-solaris2.1*)
AC_DEFINE(SOLARIS)
;;
*-solaris2.2*)
AC_DEFINE(SOLARIS)
;;
*-solaris2.3*)
AC_DEFINE(SOLARIS)
;;
*-solaris2.4*)
AC_DEFINE(SOLARIS)
;;
*-solaris2.5.1)
AC_DEFINE(SOLARIS)
;;
*-solaris*)
AC_DEFINE(SOLARIS)
;;
*-sunos4*)
AC_DEFINE(SUNOS)
;;
*-linux*)
AC_DEFINE(LINUX)
;;
*-freebsd*)
AC_DEFINE(FREEBSD)
;;
*-bsdi*)
AC_DEFINE(BSDI)
;;
esac
case "$host" in
*-freebsd*|*-bsdi*|*-netbsd*)
AC_DEFINE(BSD_BYTE_ORDERING)
esac
dnl Final step : substitute what we want to
AC_SUBST(CC_NOPIPE)
AC_SUBST(PWD)
AC_SUBST(PWDD)
AC_SUBST(CFLAGS)
AC_SUBST(INSTALL_DIR)
AC_SUBST(INSTALL)
AC_SUBST(EXTRA)
AC_SUBST(debug_cflags)
AC_SUBST(with_ws2_32)
AC_SUBST(llib)
AC_SUBST(version)
AC_SUBST(egdpath)
AC_SUBST(debug_ssl)
AC_SUBST(OPENVASLIBS_MAJOR)
AC_SUBST(OPENVASLIBS_MINOR)
AC_SUBST(OPENVASLIBS_SUPER)
AC_SUBST(OPENVASLIBS_PATCH)
AC_SUBST(OPENVASLIBS_DATE)
AC_SUBST(VERSION)
AC_SUBST(ac_configure_args)
dnl And we put everything in THREE files
AC_OUTPUT(openvas-libraries.tmpl libopenvas-config include/libvers.h)
AC_MSG_RESULT([
Configuration successful. Now type
make
to build. Then
make install
to install.
])
test -c /dev/bpf0 -a ! -c /dev/bpf40 &&
AC_MSG_RESULT([
*** You appear to be running a BPF-enabled operating system.
(BPF stands for 'Berkeley Packet Filter')
BPFs are used to capture incoming packets without using the operating system.
OpenVAS uses those for some of its security checks and port scanners.
However, you seem to not have enough bpfs, (we recommand that you get about
100 of them) so OpenVAS might miss some hosts or produce inaccurate port scans.
If you can not create more bpfs, there once was a feature 'enable-bpf-sharing'
which has been removed (see OpenVAS Change Reuqest 5). Please report on the
OpenVAS Mailing Lists if this causes a problem to you.
Please read README.BPF before continuing])
exit 0
|