1 dnl Copyright © 2021, 2023 Nick Bowler
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
9 dnl Expands AC_CHECK_HEADERS([syslog.h])
11 dnl Then, if syslog.h is available, checks that a program can be linked
12 dnl against the syslog family of functions.
14 dnl If successful, the cache variable dx_cv_have_syslog is set to "yes".
15 dnl Otherwise, dx_cv_have_syslog is set to "no".
16 AC_DEFUN([DX_CHECK_SYSLOG],
17 [AC_CHECK_HEADERS([syslog.h], [], [], [@&t@])
18 AS_IF([test x"$ac_cv_header_syslog_h" = x"yes"],
19 [AC_CACHE_CHECK([for syslog], [dx_cv_have_syslog],
20 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <syslog.h>],
21 [openlog("conftest", LOG_PID, LOG_USER);
22 syslog(LOG_ERR, "%s", "hello");
23 closelog();])], [dx_cv_have_syslog=yes], [dx_cv_have_syslog=no])])])
24 AS_IF([test x"$dx_cv_have_syslog" = x"yes"],
25 [AC_DEFINE([HAVE_SYSLOG], [1],
26 [Define to 1 if syslog et al. are available.])])])