summaryrefslogtreecommitdiffabout
path: root/configure.ac
blob: 149657def8bdda9784c7878c3d14a71282ef5d94 (plain)
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
# This file is part of GNU Pies.  -*- autoconf -*-
# Copyright (C) 2009-2019 Sergey Poznyakoff
#
# GNU Pies is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Pies is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Pies.  If not, see <http://www.gnu.org/licenses/>.

AC_PREREQ([2.63])
AC_INIT([GNU Pies], [1.3.92], [bug-pies@gnu.org.ua])
AC_CONFIG_SRCDIR([src/pies.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 std-options silent-rules])

# Enable silent rules by default:
AM_SILENT_RULES([yes])

# Checks for programs.
AC_PROG_CC
gl_EARLY
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_YACC
AC_PROG_LEX

# Checks for libraries.
AC_CHECK_LIB(crypt, crypt)
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(gethostbyaddr, nsl)

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h\
 string.h sys/socket.h sys/time.h syslog.h unistd.h utmp.h utmpx.h\
 crypt.h shadow.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL

IU_CHECK_MEMBERS([struct msghdr.msg_control, struct msghdr.msg_accrights], , ,
                 [#include <sys/types.h>
	          #include <sys/socket.h>])

IU_CHECK_MEMBERS([struct utmp.ut_tv, struct utmp.ut_name,
                  struct utmp.ut_user, struct utmp.ut_time,
		  struct utmp.ut_host], , ,
		  [#include <utmp.h>])
		    
if test "$ac_cv_header_utmpx_h" = yes; then		  
  IU_CHECK_MEMBERS([struct utmpx.ut_tv, struct utmpx.ut_name,
                    struct utmpx.ut_user, struct utmpx.ut_time,
		    struct utmpx.ut_host], , ,
		    [#include <utmpx.h>])
fi
		  
# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_CHECK_FUNCS([alarm dup2 gethostbyname memmove memset select setenv socket strchr strcspn strtol strtoul sysconf getdtablesize vsyslog])

# Gnulib
gl_INIT

# Grecs
GRECS_SETUP([grecs],[tree-api tests git2chg getopt json sockaddr-list parser-meta1])
GRECS_HOST_PROJECT_INCLUDES='-I$(top_srcdir)/gnu -I$(top_builddir)/gnu'

# Test for setproctitle
MF_PROCTITLE

# Gettext.
AM_ICONV
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.19])

# PAM
status_pam=maybe
AC_ARG_ENABLE([pam],
              AC_HELP_STRING([--enable-pam],
                             [enable PAM]),
              [
case "${enableval}" in
  yes) status_pam=yes ;;
  no)  status_pam=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-pam]) ;;
esac],[status_pam=maybe])

AC_SUBST(PAM_LIBS)
if test "$status_pam" != "no"; then
  AC_CHECK_HEADERS(security/pam_appl.h)
  if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
    AC_CHECK_LIB(dl, dlopen, [PAM_LIBS="-ldl"])
    AC_CHECK_LIB(pam, pam_start,
	         [status_pam=yes
		  PAM_LIBS="-lpam $PAM_LIBS"],
	         [status_pam=no], $PAM_LIBS)
  else
    status_pam=no
  fi
fi

AM_CONDITIONAL([PAM_COND], [test $status_pam = yes])
if test $status_pam = yes; then
    AC_DEFINE_UNQUOTED(WITH_PAM, 1, [PAM support enabled])
fi    

# Build inetd
AC_ARG_ENABLE([inetd],
              AC_HELP_STRING([--enable-inetd],
	                     [build and install a replacement for SBINDIR/inetd]),
	      [case $enableval in
	       yes) AC_SUBST([INETD], [inetd]);;
	       no)  ;;
	       esac])

sysvinit_status=maybe
AC_ARG_ENABLE([sysvinit],
 AC_HELP_STRING([--enable-sysvinit],
                [compile the SystemV init support]),
 [sysvinit_status=$enableval])

if test $sysvinit_status = "maybe"; then
  AC_TRY_COMPILE([#ifdef  HAVE_UTMPX_H
# include <utmpx.h>
#else
# include <utmp.h>
#endif
],
[int x = RUN_LVL;],
[sysvinit_status=yes],
[sysvinit_status=no])
fi

test $sysvinit_status = "no"
PIES_SYSVINIT_ENABLED=$?
AC_DEFINE_UNQUOTED([PIES_SYSVINIT_ENABLED],[$PIES_SYSVINIT_ENABLED],
                   [whether SystemV init support is compiled])
AM_CONDITIONAL([PIES_COND_SYSVINIT],[test $sysvinit_status = "yes"])

AH_BOTTOM([
# ifndef ATTRIBUTE_NORETURN
#  define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
# endif
])

AC_SUBST([DEFAULT_PIES_CONTROL_URL],['unix:///tmp/$${PIES_INSTANCE}.ctl'])
AC_ARG_VAR([DEFAULT_PIES_CONTROL_URL],
           [URL of the default control socket])
AC_SUBST([DEFAULT_INIT_CONTROL_URL],['unix:///dev/init.ctl'])
AC_ARG_VAR([DEFAULT_INIT_CONTROL_URL],
           [URL of the default control socket])
AC_SUBST([EMERGENCY_SHELL],['/sbin/sulogin'])
AC_ARG_VAR([EMERGENCY_SHELL],[Filename of the emergency shell])
	   
IMPRIMATUR_INIT

# Initialize the test suite.
AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/Makefile tests/atlocal]) 
AM_MISSING_PROG([AUTOM4TE], [autom4te])

AC_CONFIG_COMMANDS([status],[
cat <<EOF

Configuration summary:

URL of the control API ............................. $control_url
PAM support ........................................ $status_pam
SystemV initialization support ..................... $sysvinit_status
EOF
if test $sysvinit_status = "yes"; then
  cat <<EOF
URL of the SystemV init ............................ $sysvinit_control_url
Emergency shell .................................... $emergency_shell
EOF
fi
echo
],
[sysvinit_status=$sysvinit_status
control_url=`echo "$DEFAULT_PIES_CONTROL_URL" | sed 's/\\\$/\\\\\$/g'`
sysvinit_control_url=$DEFAULT_INIT_CONTROL_URL
emergency_shell=$EMERGENCY_SHELL
status_pam=$status_pam
])

AC_CONFIG_FILES([Makefile
                 gnu/Makefile
                 lib/Makefile
                 src/Makefile
		 ident/Makefile
                 doc/Makefile
		 po/Makefile.in])
AC_OUTPUT

Return to:

Send suggestions and report system problems to the System administrator.