dnl @(#) $Id: aclocal.m4,v 1.7 2002/10/05 20:06:37 leres Exp $ (LBL)
dnl
dnl Copyright (c) 1997, 1998, 2002
dnl	The Regents of the University of California.  All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that: (1) source code distributions
dnl retain the above copyright notice and this paragraph in its entirety, (2)
dnl distributions including binary code include the above copyright notice and
dnl this paragraph in its entirety in the documentation or other materials
dnl provided with the distribution, and (3) all advertising materials mentioning
dnl features or use of this software display the following acknowledgement:
dnl ``This product includes software developed by the University of California,
dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
dnl the University nor the names of its contributors may be used to endorse
dnl or promote products derived from this software without specific prior
dnl written permission.
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
dnl

dnl
dnl Pull in standard LBL macros
dnl
builtin(include, lbl-aclocal.m4)dnl

dnl
dnl Checks to see if declaring syslog() and openlog() as returning int
dnl is compatible with <syslog.h> and <stdlib.h>, or if we should not
dnl declare them explicitly.
dnl
dnl usage:
dnl
dnl	AC_BRO_SYSLOG_INT
dnl
dnl results:
dnl
dnl	SYSLOG_INT (either defined or not defined)
dnl
AC_DEFUN(AC_BRO_SYSLOG_INT,
    [AC_LANG_CPLUSPLUS
    AC_MSG_CHECKING(if syslog returns int)
    AC_CACHE_VAL(ac_cv_bro_syslog_int,
	AC_TRY_COMPILE([
#	include <stdlib.h>
#	include <syslog.h>
	    extern "C" {
		int openlog(const char* ident, int logopt, int facility);
		int syslog(int priority, const char* message_fmt, ...);
		int closelog();
	    }],,
	    ac_cv_bro_syslog_int=yes,
	    ac_cv_bro_syslog_int=no))
    AC_MSG_RESULT($ac_cv_bro_syslog_int)
    if test $ac_cv_bro_syslog_int = yes ; then
	    AC_DEFINE(SYSLOG_INT,,[should we declare syslog() and openlog()])
    fi])


dnl
dnl Checks to see if we should explicitly declare socket() and friends.
dnl
dnl usage:
dnl
dnl	AC_BRO_SOCK_DECL
dnl
dnl results:
dnl
dnl	DO_SOCK_DECL (either defined or not defined)
dnl
AC_DEFUN(AC_BRO_SOCK_DECL,
    [AC_LANG_C
    AC_MSG_CHECKING(if we should declare socket and friends)
    AC_CACHE_VAL(ac_cv_bro_sock_decl,
	AC_TRY_COMPILE([
#	include <sys/types.h>
#	include <sys/socket.h>
	extern int socket(int, int, int);
	extern int connect(int, const struct sockaddr *, int);
	extern int send(int, const void *, int, int);
	extern int recvfrom(int, void *, int, int, struct sockaddr *, int *);
	    ],,
	    ac_cv_bro_sock_decl=yes,
	    ac_cv_bro_sock_decl=no))
    AC_MSG_RESULT($ac_cv_bro_sock_decl)
    if test $ac_cv_bro_sock_decl = yes ; then
	    AC_DEFINE(DO_SOCK_DECL,,[should explicitly declare socket() and friends])
    fi])
