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 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
|
AC_INIT(src/version.h)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE( osiris, 4.0.0 )
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
dnl check for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
OS_NAME=`uname`
AUTOHEADER=echo
if test "x$prefix" = "xNONE" ; then
prefix="/usr/local"
prefix_nondefault="NONE"
fi
dnl disabled bcause of problems with osi_readdir().
dnl AC_SYS_LARGEFILE
dnl check for OpenSSL library and headers.
AC_ARG_WITH(ssl-dir,
[ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
[
if test "x$withval" != "xno" ; then
tryssldir=$withval
fi
]
)
if test "x$prefix_nondefault" != "xNONE" ; then
tryssldir="$tryssldir $prefix"
fi
dnl check for non-default osiris root config and cert directory
AC_ARG_WITH([root-dir],
AC_HELP_STRING([--with-root-dir=DIR],
[Specify osiris data root (default $PREFIX/osiris)]),
with_root_dir=$withval,
with_root_dir='')
if test -z "${with_root_dir}" ; then
case "${OS_NAME}" in
MINGW32*)
with_root_dir="\\\\WINNT\\\\osiris"
;;
CYGWIN*)
with_root_dir="\\\\WINNT\\\\osiris"
;;
*)
with_root_dir="${prefix}/osiris"
;;
esac
fi
AC_DEFINE_UNQUOTED(OSIRIS_ROOT_DIR,"$with_root_dir",[Osiris data root])
case "${OS_NAME}" in
MINGW32*)
AC_DEFINE_UNQUOTED(PATH_SYSTEM_ROOT_CERT_FILE,"${with_root_dir}\\\\osiris_root.pem",[Osiris root cert file location])
;;
CYGWIN*)
AC_DEFINE_UNQUOTED(PATH_SYSTEM_ROOT_CERT_FILE,"${with_root_dir}\\\\osiris_root.pem",[Osiris root cert file location])
;;
*)
AC_DEFINE_UNQUOTED(PATH_SYSTEM_ROOT_CERT_FILE,"${with_root_dir}/osiris_root.pem"
,[Osiris root cert file location])
;;
esac
dnl set osiris username for priv separation and possible chroot
AC_ARG_WITH([osiris-user],
AC_HELP_STRING([--with-osiris-user=USERNAME],
[Specify osiris username (default "osiris")]),
with_osiris_user=$withval,
with_osiris_user='')
if test -z "${with_osiris_user}" ; then
with_osiris_user="osiris"
fi
AC_DEFINE_UNQUOTED(OSIRIS_USERNAME,"$with_osiris_user",[Osiris username])
dnl check for non-default osiris management daemon root config/cert/data directory
AC_ARG_WITH([md-root-dir],
AC_HELP_STRING([--with-md-root-dir=DIR],
[Specify osiris management data root (default $root_dir)]),
with_md_root_dir=$withval,
with_md_root_dir='')
if test -z "${with_md_root_dir}" ; then
with_md_root_dir="$with_root_dir"
fi
AC_DEFINE_UNQUOTED(OSIRISMD_ROOT_DIR,"$with_md_root_dir",[Osiris management data root])
dnl check for non-default osiris management daemon config directory
AC_ARG_WITH([md-conf-dir],
AC_HELP_STRING([--with-md-conf-dir=DIR],
[Specify osiris management config dir (default $md_root_dir)]),
with_md_conf_dir=$withval,
with_md_conf_dir='')
if test -z "${with_md_conf_dir}" ; then
with_md_conf_dir="$with_md_root_dir"
fi
AC_DEFINE_UNQUOTED(OSIRISMD_CONF_DIR,"$with_md_conf_dir",[Osiris management configuration dir])
dnl set osiris management daemon username
AC_ARG_WITH([osiris-md-user],
AC_HELP_STRING([--with-osiris-md-user=USERNAME],
[Specify osiris management daemon username (default $osiris_user)]),
with_osiris_md_user=$withval,
with_osiris_md_user='')
if test -z "${with_osiris_md_user}" ; then
with_osiris_md_user="$with_osiris_user"
fi
AC_DEFINE_UNQUOTED(OSIRISMD_USERNAME,"$with_osiris_md_user",[Osiris management daemon username])
AC_DEFUN([AC_TYPE_SOCKLEN_T], [
dnl Since the old-style (autoconf 2.13) macro AC_CHECK_TYPE(type, replacement)
dnl only checks in <sys/types.h> we have to be more awkward:
dnl We have to check for socklen_t in <sys/types.h> -- if it's not defined
dnl there, we also look in <sys/socket.h> (a more common place)
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
[
#include <sys/types.h>
#include <sys/socket.h>
])
])
AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
# GOD DAMN FUCKING STATIC BINARIES ON SOLARIS CAN EAT MY ASS.
case "$OS_NAME" in
SunOS*)
LIBS="$saved_LIBS $ssldir/lib/libssl.a $ssldir/lib/libcrypto.a -lsocket -lnsl -lresolv"
;;
CYGWIN*)
LIBS="$saved_LIBS -lssl -lcrypto -lgdi32"
;;
MINGW*)
LIBS="$saved_LIBS -lssl -lcrypto -lgdi32"
;;
*)
LIBS="$saved_LIBS -lssl -lcrypto"
;;
esac
# Skip directories if they don't exist
if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
continue;
fi
if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
# Try to use $ssldir/lib if it exists, otherwise
# $ssldir
if test -d "$ssldir/lib" ; then
LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir/lib $LDFLAGS"
fi
else
LDFLAGS="-L$ssldir $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir $LDFLAGS"
fi
fi
# Try to use $ssldir/include if it exists, otherwise
# $ssldir
if test -d "$ssldir/include" ; then
CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
else
CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
fi
fi
# Basic test to check for compatible version and correct linking
AC_TRY_RUN(
[
#include <string.h>
#include <openssl/rand.h>
int main(void)
{
char a[2048];
memset(a, 0, sizeof(a));
RAND_add(a, sizeof(a), sizeof(a));
return(RAND_status() <= 0);
}
],
[
found_crypto=1
break;
], []
)
if test ! -z "$found_crypto" ; then
break;
fi
done
if test -z "$found_crypto" ; then
AC_MSG_ERROR([Could not find working OpenSSL library, please install.])
fi
if test -z "$ssldir" ; then
ssldir="(system)"
fi
ac_cv_openssldir=$ssldir
])
if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
# AC_DEFINE(HAVE_OPENSSL)
dnl Need to recover ssldir - test above runs in subshell
ssldir=$ac_cv_openssldir
if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
# Try to use $ssldir/lib if it exists, otherwise
# $ssldir
if test -d "$ssldir/lib" ; then
LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir/lib $LDFLAGS"
fi
else
LDFLAGS="-L$ssldir $saved_LDFLAGS"
if test ! -z "$need_dash_r" ; then
LDFLAGS="-R$ssldir $LDFLAGS"
fi
fi
# Try to use $ssldir/include if it exists, otherwise
# $ssldir
if test -d "$ssldir/include" ; then
CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
else
CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
fi
fi
fi
dnl GOD DAMN FUCKING STATIC BINARY SOLARIS SHIT
case "$OS_NAME" in
SunOS*)
LIBS="$saved_LIBS $ssldir/lib/libssl.a $ssldir/lib/libcrypto.a"
;;
MINGW*)
LIBS="$saved_LIBS -lssl -lcrypto -mno-cygwin -lwsock32 -lnetapi32 -lgdi32 -liphlpapi -lpsapi"
;;
CYGWIN*)
LIBS="$saved_LIBS -lssl -lcrypto -mno-cygwin -lwsock32 -lnetapi32 -lgdi32 -liphlpapi -lpsapi"
;;
*)
LIBS="$saved_LIBS -lssl -lcrypto"
;;
esac
dnl configure local copy of Berkely DB:
DB_CONFIG_ARGS="--enable-shared=no --enable-static=yes"
case "${OS_NAME}" in
MINGW32*)
DB_CONFIG_ARGS="${DB_CONFIG_ARGS} --enable-mingw"
;;
CYGWIN*)
DB_CONFIG_ARGS="${DB_CONFIG_ARGS} --enable-mingw"
;;
*)
;;
esac
echo "CONFIGURING LOCAL COPY OF BERKELY DB..."
cd ./src/db-4.2.52/build_unix && ../dist/configure ${DB_CONFIG_ARGS} && cd ../../..
echo "DONE CONFIGURING LOCAL COPY OF BERKELY DB."
dnl look for __FUNCTION__ can be used.
AC_CACHE_CHECK([for __FUNCTION__ macro],iproxy_cv_HAVE_FUNCTION_MACRO,[
AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
iproxy_cv_HAVE_FUNCTION_MACRO=yes,iproxy_cv_HAVE_FUNCTION_MACRO=no)])
if test x"$iproxy_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
AC_DEFINE([HAVE_FUNCTION_MACRO], [], [function macro])
fi
dnl look at msghdr structure a little more closely.
AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
ac_cv_have_accrights_in_msghdr, [
AC_TRY_RUN(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int main() {
#ifdef msg_accrights
exit(1);
#endif
struct msghdr m;
m.msg_accrights = 0;
exit(0);
}
],
[ ac_cv_have_accrights_in_msghdr="yes" ],
[ ac_cv_have_accrights_in_msghdr="no" ]
)
])
if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR,1,access rights in msghdr)
fi
AC_CACHE_CHECK([for msg_control field in struct msghdr],
ac_cv_have_control_in_msghdr, [
AC_TRY_RUN(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int main() {
#ifdef msg_control
exit(1);
#endif
struct msghdr m;
m.msg_control = 0;
exit(0);
}
],
[ ac_cv_have_control_in_msghdr="yes" ],
[ ac_cv_have_control_in_msghdr="no" ]
)
])
if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
AC_DEFINE(HAVE_CONTROL_IN_MSGHDR,1,ancillary data style fd pass)
fi
dnl check for fancy cli option.
AC_MSG_CHECKING([for --enable-fancy-cli])
AC_ARG_ENABLE(fancy-cli,
[ --enable-fancy-cli Enable code necessary to enable command completion \
and command history features in the Osiris CLI. ],
[
if test "x$enableval" = "xyes" ; then
ac_cv_enable_fancy_cli="yes"
else
ac_cv_enable_fancy_cli="no"
fi
])
if test "x$ac_cv_enable_fancy_cli" = "xyes" ; then
AC_DEFINE( FANCY_CLI,1,experimental cli features)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl check for network libs.
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_CHECK_LIB(resolv, inet_aton, LIBS="$LIBS -lresolv")
dnl check for readline lib for CLI.
CHECK_READLINE
case $OS_NAME in
FreeBSD*)
AC_DEFINE_UNQUOTED( SYSTEM_FREEBSD, 1, FreeBSD )
;;
OpenBSD)
AC_DEFINE_UNQUOTED( SYSTEM_OPENBSD, 1, OpenBSD )
;;
MINGW32*)
AC_DEFINE_UNQUOTED( _WIN32_IE, 0x0500, MingW32 )
;;
CYGWIN*)
AC_DEFINE_UNQUOTED( _WIN32_IE, 0x0500, MingW32 )
;;
Linux)
AC_DEFINE_UNQUOTED( SYSTEM_LINUX, 1, Linux )
rc=`grep -c krb5 /usr/include/openssl/ssl.h`
if test $rc -ne 0; then
CPPFLAGS="-I/usr/kerberos/include/ ${CPPFLAGS}"
fi
;;
BSD*)
AC_DEFINE_UNQUOTED( SYSTEM_BSDOS, 1, Some BSD )
;;
Darwin*)
AC_DEFINE_UNQUOTED( SYSTEM_DARWIN, 1, Darwin or Mac OS X )
;;
SunOS*)
AC_DEFINE_UNQUOTED( SYSTEM_SUNOS, 1, Sun )
;;
OSF1*)
AC_DEFINE_UNQUOTED( SYSTEM_OSF1, 1, OSF1 )
;;
IRIX*)
AC_DEFINE_UNQUOTED( SYSTEM_IRIX, 1, Irix )
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
;;
AIX*)
AC_DEFINE_UNQUOTED( SYSTEM_AIX, 1, AIX )
;;
*)
;;
esac
dnl check for pthreads.
AC_HAVE_LIBRARY(pthread, LOAD_LIBS="$LOAD_LIBS -lpthread")
AC_CHECK_LIB(pthread, pthread_create)
dnl check for types we need to have.
AC_CHECK_TYPES(u_int16_t)
AC_CHECK_TYPES(u_int32_t)
AC_CHECK_TYPES(u_int64_t)
AC_CHECK_TYPES(sig_atomic_t)
AC_TYPE_SOCKLEN_T
dnl replace functions that we don't have.
AC_REPLACE_FUNCS(inet_ntop)
AC_REPLACE_FUNCS(inet_pton)
AC_REPLACE_FUNCS(strptime)
AC_REPLACE_FUNCS(strcasestr)
AC_REPLACE_FUNCS(socketpair)
dnl check for functions.
AC_CHECK_FUNCS(sendmsg)
AC_CHECK_FUNCS(recvmsg)
AC_CHECK_FUNCS(pipe)
AC_CHECK_FUNCS(nice)
AC_CHECK_FUNCS(getdirentries)
AC_CHECK_FUNCS(gethostbyaddr)
AC_CHECK_FUNCS(getdents)
AC_CHECK_FUNCS(getpwent)
AC_CHECK_FUNCS(getgrent)
AC_CHECK_FUNCS(setpriority)
AC_CHECK_FUNCS(sigset)
AC_CHECK_FUNCS(scandir)
AC_CHECK_FUNCS(alphasort)
AC_CHECK_FUNCS(dirfd)
AC_CHECK_FUNCS(setsid)
dnl check for header files
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(features.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(sys/utsname.h)
AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(sys/uio.h)
AC_CHECK_HEADERS(sys/sysctl.h)
AC_CHECK_HEADERS(dirent.h)
AC_CHECK_HEADERS(netinet/in.h)
dnl define whether or not we use privsep.
AC_MSG_CHECKING(if we can use privilege separation)
dnl we need: socketpair, getdirentries, sys/uio.h, sendmsg, and recvmsg.
if ( test "$ac_cv_func_getdirentries" = "yes" ||
test "$ac_cv_func_getdents" = "yes" ) &&
test "$ac_cv_func_sendmsg" = "yes" &&
test "$ac_cv_func_recvmsg" = "yes" &&
test "$ac_cv_func_socketpair" = "yes" ; then
AC_DEFINE( USE_PRIVSEP,1,use privilege separation)
CONFIG_USE_PRIVSEP="yes"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
CONFIG_USE_PRIVESEP="no"
echo ""
echo "**************************************************************"
echo ""
echo " WARNING: this system does not have the required methods "
echo " to support privilege separation. This means the osiris "
echo " scanning daemon will run as root."
echo ""
echo "**************************************************************"
echo ""
fi
AC_HEADER_STDC
AC_C_BIGENDIAN
AC_SUBST(prefix)
AC_SUBST(with_root_dir)
AC_SUBST(with_osiris_user)
AC_SUBST(with_md_root_dir)
AC_SUBST(with_md_conf_dir)
AC_SUBST(with_osiris_md_user)
if test "x$GCC" != "xyes" ; then
CFLAGS="$CFLAGS"
else
CFLAGS="-Wall $CFLAGS"
fi
AC_OUTPUT( Makefile \
src/Makefile \
src/libosiris/Makefile \
src/libfileapi/Makefile \
src/libosirisdb/Makefile \
src/libosirisctl/Makefile \
src/libosirism/Makefile \
src/cli/Makefile \
src/osirisd/modules/Makefile \
src/osirisd/Makefile \
src/osirismd/Makefile \
src/tools/Makefile \
src/db-4.2.52/Makefile \
src/install/install.sh )
chmod ug+x src/install/install.sh
echo ""
echo "Osiris (c) 2000-2006 Brian Wotring"
echo "-----------------------------------------------------"
echo ""
echo " ==> Configuration Complete. "
echo " ==> Osiris has been configured with the following options:"
echo ""
echo " Host: ${host}"
echo " Compiler: ${CC}"
echo " Compiler flags: ${CFLAGS}"
echo " Preprocessor flags: ${CPPFLAGS}"
echo " Linker flags: ${LDFLAGS}"
echo " Libraries: ${LIBS}"
echo " Privlege Separation: ${CONFIG_USE_PRIVSEP}"
echo " SSL Location: ${ssldir}"
echo " Osiris Root Directory: ${with_root_dir}"
echo " Osiris user: ${with_osiris_user}"
echo " Osiris MD Directory: ${with_md_root_dir}"
echo " Osiris MD user: ${with_osiris_md_user}"
echo " Osiris MD config dir: ${with_md_conf_dir}"
cd ./src/osirisd/modules;./genmods.sh;cd ../../..
echo " ==> use one of the following targets:"
echo ""
echo " all: make everything, agent, CLI and management console."
echo " agent: create scan agent installer package."
echo " console: create management console installer package."
echo " install: run installation script."
echo " clean: remove object files."
echo ""
|