Release v.5.0.0
[screen.git] / src / configure.ac
blob976b1e0909c853953b97353b4f3bc58937d7691c
1 AC_INIT([GNU Screen],[5.0.0],[https://savannah.gnu.org/bugs/?group=screen],[screen],[https://www.gnu.org/software/screen/])
2 AC_PREREQ([2.71])
4 AC_CONFIG_HEADERS([config.h])
7 AC_DEFINE_UNQUOTED([VERSION_MAJOR], 
8         [`echo $PACKAGE_VERSION | cut -d . -f 1`],
9         [Major version of GNU screen])
10 AC_DEFINE_UNQUOTED([VERSION_MINOR],
11         [`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`],
12         [Minor version of GNU screen])
13 AC_DEFINE_UNQUOTED([VERSION_REVISION],
14         [`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`],
15         [Micro revision of GNU screen])
18 AH_TEMPLATE([HAVE_EXECVPE], [system has execvpe() defined])
19 AH_TEMPLATE([HAVE_OPENPTY], [system has openpty() defined])
21 dnl -
22 AH_TEMPLATE([ENABLE_UTMP], [Enable utmp support])
23 AH_TEMPLATE([HAVE_UTEMPTER], [system has utempter helper binary])
24 AH_TEMPLATE([HAVE_UT_EXIT], [utmpx struct has ut_exit field])
25 AH_TEMPLATE([HAVE_UT_HOST], [utmpx struct has ut_host field])
27 dnl -
28 AH_TEMPLATE([ENABLE_PAM], [Enable Pluggable Authentication Modules support])
30 dnl -
31 AH_TEMPLATE([ENABLE_TELNET], [Enable built-in telnet client])
33 dnl -
34 AH_TEMPLATE([SOCKET_DIR], [Path to socket directory])
36 dnl -
37 AH_TEMPLATE([SYSTEM_SCREENRC], [Path to system screenrc])
39 dnl - pty settings
40 AH_TEMPLATE([PTY_MODE], [Default mode for pty devices])
41 AH_TEMPLATE([PTY_GROUP], [Default group for pty devices])
42 AH_TEMPLATE([PTY_ROFS], [pty devices are on read only filesystem])
45 dnl
46 dnl Check for sane compiler
47 dnl
49 AC_USE_SYSTEM_EXTENSIONS
50 AC_PROG_CC
51 AC_PROG_AWK
52 AC_PROG_INSTALL
53 AC_USE_SYSTEM_EXTENSIONS
55 dnl
56 dnl Check various system stuff
57 dnl
59 dnl check for execvpe()
60 AC_CHECK_FUNCS([execvpe])
62 dnl
63 AC_CHECK_FUNCS([seteuid setegid setreuid setresuid])
65 dnl curses compatible lib, we do forward declaration ourselves, only need to link to proper library
66 AC_SEARCH_LIBS([tgetent], [curses termcap termlib ncursesw tinfow ncurses tinfo], [], [
67         AC_MSG_ERROR([unable to find tgetent() function])
70 dnl check for crypt()
71 AC_SEARCH_LIBS([crypt], [crypt], [], [
72         AC_MSG_ERROR([unable to find crypt() function])
75 dnl
76 AC_CHECK_HEADERS(pty.h util.h libutil.h)
77 AC_SEARCH_LIBS([openpty], [util openpty bsd], [
78         AC_DEFINE(HAVE_OPENPTY)
79 ], [
80         AC_MSG_ERROR([unable to find openpty() function])
83 dnl
84 AC_SEARCH_LIBS([socket], [network], [], [
85         AC_MSG_ERROR([unable to find socket() function])
88 dnl
89 AC_CHECK_HEADERS(langinfo.h)
91 dnl
92 AC_CHECK_HEADERS(dirent.h)
94 dnl
95 dnl Check user changeable stuff
96 dnl
98 AC_ARG_ENABLE(pam, AS_HELP_STRING([--enable-pam],
99               [enable PAM support (default: enabled)]),
100               [enable_pam=$enableval],
101               [enable_pam=yes])
102 AC_ARG_ENABLE(utmp, AS_HELP_STRING([--enable-utmp],
103               [enable utmp support (default: disabled)]),
104               [enable_utmp=$enableval],
105               [enable_utmp=no])
106 AC_ARG_ENABLE(telnet, AS_HELP_STRING([--enable-telnet],
107               [enable telnet support (default: disabled)]),
108               [enable_telnet=$enableval],
109               [enable_telnet=no])
110 AC_ARG_ENABLE(socket-dir, AS_HELP_STRING([--enable-socket-dir],
111               [enable global socket directory (default: disabled)]),
112               [enable_socket_dir=$enableval],
113               [enable_socket_dir=no])
115 AC_ARG_WITH(system_screenrc, AS_HELP_STRING([--with-system_screenrc],
116             [set location of system screenrc (default: /etc/screenrc)]),
117             [with_system_screenrc=$withval],
118             [with_system_screenrc=/etc/screenrc])
119 AC_ARG_WITH(pty-mode, AS_HELP_STRING([--with-pty-mode],
120             [set pty mode (default: 0622)]),
121             [with_pty_mode=$withval],
122             [with_pty_mode=0622])
123 AC_ARG_WITH(pty-group, AS_HELP_STRING([--with-pty-group],
124             [set pty group (default: 5)]),
125             [with_pty_group=$withval],
126             [with_pty_group=5])
127 AC_ARG_WITH(pty-rofs, AS_HELP_STRING([--with-pty-rofs],
128             [set rofs handling (default: no)]),
129             [with_pty_rofs=$withval],
130             [with_pty_rofs=no])
132 dnl -- enable_pam
134 AS_IF([test "x$enable_pam" = "xyes"], [
135         AC_MSG_CHECKING(for PAM support)
136         oldlibs="$LIBS"
137         LIBS="$LIBS -lpam"
138         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <security/pam_appl.h>]], [[
139                 pam_start(0, 0, 0, 0);
140                 pam_authenticate(0, 0);
141                 pam_end(0,0);
142         ]])],[AC_MSG_RESULT(yes);
143         AC_DEFINE(ENABLE_PAM)],[AC_MSG_ERROR(no);LIBS="$oldlibs"])
146 dnl -- enable_utmp
148 AS_IF([test "x$enable_utmp" = "xyes"], [
149         AC_CHECK_HEADERS(utmpx.h, have_utmpx=yes, have_utmpx=no)
150         AS_IF([test "x$have_utmpx" != "xyes"],
151               AC_MSG_ERROR(Missing utmpx.h))
153         AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
154         AS_IF([test "x$have_utempter" = "xyes"], [
155                 AC_DEFINE(HAVE_UTEMPTER)
156                 LIBS="$LIBS -lutempter"
157         ])
159         AC_MSG_CHECKING(if utmpx struct has ut_host field)
160         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <utmpx.h>]], [[
161                 struct utmpx u;
162                 u.ut_host[0] = 0;
163         ]])],[AC_MSG_RESULT(yes)
164         AC_DEFINE(HAVE_UT_HOST)],[AC_MSG_RESULT(no)])
166         AC_MSG_CHECKING(if utmpx struct has ut_exit field)
167         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <utmpx.h>]], [[
168                 struct utmpx u;
169                 u.ut_exit.e_exit;
170         ]])],[AC_MSG_RESULT(yes)
171         AC_DEFINE(HAVE_UT_EXIT)],[AC_MSG_RESULT(no)])
173         AC_DEFINE(ENABLE_UTMP)
176 dnl -- enable_telnet
178 AS_IF([test "x$enable_telnet" = "xyes"], [
179         AC_DEFINE(ENABLE_TELNET)
182 dnl -- enable_socket_dir
184 AS_IF([test "x$enable_socket_dir" != "xno"], [
185         AS_IF([test "x$enable_socket_dir" = "xyes"],
186               [enable_socket_dir="/run/screen"]
187         )
188         AC_DEFINE_UNQUOTED(SOCKET_DIR, "$enable_socket_dir")
191 dnl -- with_sysscreenrc
192 AC_DEFINE_UNQUOTED(SYSTEM_SCREENRC, "$with_system_screenrc")
194 dnl -- with_pty_mode
195 AC_DEFINE_UNQUOTED(PTY_MODE, $with_pty_mode)
197 dnl -- with_pty_group
198 AC_DEFINE_UNQUOTED(PTY_GROUP, $with_pty_group)
200 dnl -- with_pty_rofs
201 AS_IF([test "x$with_pty_rofs" = "xyes"], [
202         AC_DEFINE(PTY_ROFS)
206 dnl Generate files from *.in ones
209 AC_CONFIG_FILES([Makefile doc/Makefile])
210 AC_OUTPUT
213 dnl Print out config
216 echo ""
217 echo "Configuration:"
218 echo ""
219 echo " PAM support: .............................. $enable_pam"
220 echo " telnet support: ........................... $enable_telnet"
221 echo " utmp support: ............................. $enable_utmp"
222 echo " global socket directory: .................. $enable_socket_dir"
223 echo ""
224 echo " system screenrc location: ................. $with_system_screenrc"
225 echo " pty mode: ................................. $with_pty_mode"
226 echo " pty group: ................................ $with_pty_group"
227 echo " pty on read only file system: ............. $with_pty_rofs"
228 echo ""
230 AS_IF([test "x$enable_pam" != "xyes"], [
231         echo "!!! WARNING !!!"
232         echo "YOU ARE DISABLING PAM SUPPORT!"
233         echo "FOR screen TO WORK IT WILL NEED TO RUN AS SUID root BINARY"
234         echo "THIS CONFIGURATION IS _HIGHLY_ NOT RECOMMENDED!"
235         echo "!!! WARNING !!!"