1# This file is part of GNU Pies. -*- autoconf -*- 2# Copyright (C) 2009-2020 Sergey Poznyakoff 3# 4# GNU Pies is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 3, or (at your option) 7# any later version. 8# 9# GNU Pies is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. 16 17AC_PREREQ([2.63]) 18AC_INIT([GNU Pies], [1.5], [bug-pies@gnu.org.ua]) 19AC_CONFIG_SRCDIR([src/pies.h]) 20AC_CONFIG_AUX_DIR([build-aux]) 21AC_CONFIG_HEADERS([config.h]) 22AM_INIT_AUTOMAKE([1.15 gnits tar-ustar dist-bzip2 std-options silent-rules]) 23 24# Enable silent rules by default: 25AM_SILENT_RULES([yes]) 26 27# Checks for programs. 28AC_PROG_CC 29gl_EARLY 30AC_PROG_MAKE_SET 31AC_PROG_RANLIB 32AC_PROG_YACC 33AC_PROG_LEX 34 35# Checks for libraries. 36AC_CHECK_LIB(crypt, crypt) 37AC_SEARCH_LIBS(socket, socket) 38AC_SEARCH_LIBS(gethostbyaddr, nsl) 39 40# Checks for header files. 41AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h\ 42 string.h sys/socket.h sys/time.h syslog.h unistd.h utmp.h utmpx.h\ 43 crypt.h shadow.h]) 44 45# Checks for typedefs, structures, and compiler characteristics. 46AC_TYPE_UID_T 47AC_TYPE_MODE_T 48AC_TYPE_PID_T 49AC_TYPE_SIZE_T 50AC_TYPE_SIGNAL 51 52IU_CHECK_MEMBERS([struct msghdr.msg_control, struct msghdr.msg_accrights], , , 53 [#include <sys/types.h> 54 #include <sys/socket.h>]) 55 56IU_CHECK_MEMBERS([struct utmp.ut_tv, struct utmp.ut_name, 57 struct utmp.ut_user, struct utmp.ut_time, 58 struct utmp.ut_host], , , 59 [#include <utmp.h>]) 60 61if test "$ac_cv_header_utmpx_h" = yes; then 62 IU_CHECK_MEMBERS([struct utmpx.ut_tv, struct utmpx.ut_name, 63 struct utmpx.ut_user, struct utmpx.ut_time, 64 struct utmpx.ut_host], , , 65 [#include <utmpx.h>]) 66fi 67 68# Checks for library functions. 69AC_FUNC_CHOWN 70AC_FUNC_FORK 71AC_CHECK_FUNCS([alarm dup2 gethostbyname memmove memset select setenv socket strchr strcspn strtol strtoul sysconf getdtablesize vsyslog]) 72 73# Gnulib 74gl_INIT 75 76# Grecs 77GRECS_SETUP([grecs],[tree-api tests git2chg getopt json sockaddr-list parser-meta1]) 78GRECS_HOST_PROJECT_INCLUDES='-I$(top_srcdir)/gnu -I$(top_builddir)/gnu' 79 80# Test for setproctitle 81MF_PROCTITLE 82 83# Gettext. 84AM_ICONV 85AM_GNU_GETTEXT([external], [need-formatstring-macros]) 86AM_GNU_GETTEXT_VERSION([0.19]) 87 88# PAM 89status_pam=maybe 90AC_ARG_ENABLE([pam], 91 AC_HELP_STRING([--enable-pam], 92 [enable PAM]), 93 [ 94case "${enableval}" in 95 yes) status_pam=yes ;; 96 no) status_pam=no ;; 97 *) AC_MSG_ERROR([bad value ${enableval} for --enable-pam]) ;; 98esac],[status_pam=maybe]) 99 100AC_SUBST(PAM_LIBS) 101if test "$status_pam" != "no"; then 102 AC_CHECK_HEADERS(security/pam_appl.h) 103 if test "$ac_cv_header_security_pam_appl_h" = "yes"; then 104 AC_CHECK_LIB(dl, dlopen, [PAM_LIBS="-ldl"]) 105 AC_CHECK_LIB(pam, pam_start, 106 [status_pam=yes 107 PAM_LIBS="-lpam $PAM_LIBS"], 108 [status_pam=no], $PAM_LIBS) 109 else 110 status_pam=no 111 fi 112fi 113 114AM_CONDITIONAL([PAM_COND], [test $status_pam = yes]) 115if test $status_pam = yes; then 116 AC_DEFINE_UNQUOTED(WITH_PAM, 1, [PAM support enabled]) 117fi 118 119# Build inetd 120AC_ARG_ENABLE([inetd], 121 AC_HELP_STRING([--enable-inetd], 122 [build and install a replacement for SBINDIR/inetd]), 123 [case $enableval in 124 yes) AC_SUBST([INETD], [inetd]);; 125 no) ;; 126 esac]) 127 128sysvinit_status=maybe 129AC_ARG_ENABLE([sysvinit], 130 AC_HELP_STRING([--enable-sysvinit], 131 [compile the SystemV init support]), 132 [sysvinit_status=$enableval]) 133 134if test $sysvinit_status = "maybe"; then 135 AC_TRY_COMPILE([#ifdef HAVE_UTMPX_H 136# include <utmpx.h> 137#else 138# include <utmp.h> 139#endif 140], 141[int x = RUN_LVL;], 142[sysvinit_status=yes], 143[sysvinit_status=no]) 144fi 145 146test $sysvinit_status = "no" 147PIES_SYSVINIT_ENABLED=$? 148AC_DEFINE_UNQUOTED([PIES_SYSVINIT_ENABLED],[$PIES_SYSVINIT_ENABLED], 149 [whether SystemV init support is compiled]) 150AM_CONDITIONAL([PIES_COND_SYSVINIT],[test $sysvinit_status = "yes"]) 151 152AH_BOTTOM([ 153# ifndef ATTRIBUTE_NORETURN 154# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) 155# endif 156]) 157 158# ################################# 159# Select interface used to close file descriptors greater than or 160# equal to the given one. 161# 162# Variants: 163# 1. closefrom call (FreeBSD) 164# 2. F_CLOSEM fcntl (NetBSD, AIX, IRIX) 165# 3. proc_pidinfo call (Darwin) 166# 4. /proc/self/fd filesystem (Linux) 167# 5. Brute force 168# 169# The defines created here direct conditionalal compilation in 170# lib/closefds.c 171 172AC_CHECK_FUNCS([closefrom]) 173AC_CHECK_DECL([F_CLOSEM], 174 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], 175 [Use F_CLOSEM fcntl for mu_close_fds]), 176 [], 177 [#include <limits.h> 178 #include <fcntl.h> 179]) 180 181AC_CHECK_HEADERS([libproc.h]) 182AC_CHECK_FUNCS([proc_pidinfo]) 183 184if test -d "/proc/self/fd" ; then 185 AC_DEFINE([HAVE_PROC_SELF_FD], [1], [Define if you have /proc/self/fd]) 186fi 187 188# ############################## 189 190AC_SUBST([DEFAULT_PIES_CONTROL_URL],['unix:///tmp/$${PIES_INSTANCE}.ctl']) 191AC_ARG_VAR([DEFAULT_PIES_CONTROL_URL], 192 [URL of the default control socket]) 193AC_SUBST([DEFAULT_INIT_CONTROL_URL],['unix:///dev/init.ctl']) 194AC_ARG_VAR([DEFAULT_INIT_CONTROL_URL], 195 [URL of the default control socket]) 196AC_SUBST([EMERGENCY_SHELL],['/sbin/sulogin']) 197AC_ARG_VAR([EMERGENCY_SHELL],[Filename of the emergency shell]) 198 199IMPRIMATUR_INIT 200 201# Initialize the test suite. 202AC_CONFIG_TESTDIR(tests) 203AC_CONFIG_FILES([tests/Makefile tests/atlocal]) 204AM_MISSING_PROG([AUTOM4TE], [autom4te]) 205 206AC_CONFIG_COMMANDS([status],[ 207cat <<EOF 208 209Configuration summary: 210 211URL of the control API ............................. $control_url 212PAM support ........................................ $status_pam 213SystemV initialization support ..................... $sysvinit_status 214EOF 215if test $sysvinit_status = "yes"; then 216 cat <<EOF 217URL of the SystemV init ............................ $sysvinit_control_url 218Emergency shell .................................... $emergency_shell 219EOF 220fi 221echo 222], 223[sysvinit_status=$sysvinit_status 224control_url=`echo "$DEFAULT_PIES_CONTROL_URL" | sed 's/\\\$/\\\\\$/g'` 225sysvinit_control_url=$DEFAULT_INIT_CONTROL_URL 226emergency_shell=$EMERGENCY_SHELL 227status_pam=$status_pam 228]) 229 230AC_CONFIG_FILES([Makefile 231 gnu/Makefile 232 lib/Makefile 233 src/Makefile 234 ident/Makefile 235 doc/Makefile 236 po/Makefile.in]) 237AC_OUTPUT 238