]>
Commit | Line | Data |
---|---|---|
7460295f | 1 | AC_PREREQ(2.57) |
bf1ec4d2 MG |
2 | |
3 | dnl This is the one location where the authoritative version number is stored | |
409b969b | 4 | AC_INIT(shellinabox, 2.9, markus@shellinabox.com) |
a0673b07 | 5 | VCS_REVISION=162 |
fe338aa8 MG |
6 | AC_SUBST(VCS_REVISION) |
7 | AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", | |
8 | [Most recent revision number in the version control system]) | |
bf1ec4d2 MG |
9 | |
10 | dnl Set up autoconf/automake for building C libraries and binaries with GCC | |
c593cf68 | 11 | CFLAGS="${CFLAGS:--Os}" |
7460295f | 12 | AM_INIT_AUTOMAKE |
bdd01e84 | 13 | AM_CONFIG_HEADER(config.h) |
7460295f | 14 | AC_PROG_CC |
c593cf68 | 15 | AC_LANG_WERROR |
7460295f MG |
16 | AC_PROG_INSTALL |
17 | AC_PROG_LIBTOOL | |
18 | AC_SUBST(LIBTOOL_DEPS) | |
19 | AC_C_CONST | |
20 | AC_PROG_GCC_TRADITIONAL | |
bf1ec4d2 MG |
21 | |
22 | dnl Check for header files that do not exist on all platforms | |
572ac014 MG |
23 | AC_CHECK_HEADERS([libutil.h pthread.h pty.h sys/prctl.h sys/uio.h util.h \ |
24 | utmp.h utmpx.h]) | |
bf1ec4d2 MG |
25 | |
26 | dnl Most systems require linking against libutil.so in order to get login_tty() | |
a3876a41 MG |
27 | AC_CHECK_FUNCS(login_tty, [], |
28 | [AC_CHECK_LIB(util, login_tty, | |
29 | [LIBS="-lutil $LIBS" | |
30 | AC_DEFINE(HAVE_LOGIN_TTY)])]) | |
bf1ec4d2 | 31 | |
572ac014 MG |
32 | dnl Use strlcat() instead of strncat() to avoid spurious warnings |
33 | AC_CHECK_FUNCS([strlcat]) | |
34 | ||
35 | dnl Prefer thread-safe functions, if available | |
297cee07 MG |
36 | AC_CHECK_FUNCS([getgrgid_r getgrnam_r getpwnam_r getpwuid_r openpty \ |
37 | strcasestr ]) | |
572ac014 | 38 | |
bf1ec4d2 | 39 | dnl We prefer ptsname_r(), but will settle for ptsname() if necessary |
29135474 MG |
40 | AC_TRY_LINK([#ifndef _XOPEN_SOURCE |
41 | #define _XOPEN_SOURCE | |
42 | #endif | |
43 | #ifndef _GNU_SOURCE | |
44 | #define _GNU_SOURCE | |
45 | #endif | |
46 | #include <stdlib.h>], | |
c593cf68 | 47 | [char buf[10]; ptsname_r(0, buf, sizeof(buf));], |
29135474 MG |
48 | [AC_DEFINE(HAVE_PTSNAME_R, 1, |
49 | Define to 1 if you have a re-entrant version of ptsname)]) | |
bf1ec4d2 | 50 | |
572ac014 MG |
51 | dnl Apparently, some systems define sigwait() but fail to implement it |
52 | AC_TRY_LINK([#include <pthread.h> | |
53 | #include <signal.h>], | |
54 | [sigset_t s; int n; sigwait(&s, &n);], | |
55 | [AC_DEFINE(HAVE_SIGWAIT, 1, | |
56 | Define to 1 if you have a working sigwait)]) | |
57 | ||
bf1ec4d2 MG |
58 | dnl We automatically detect SSL support, but allow users to disable it |
59 | AC_ARG_ENABLE(ssl, | |
60 | [ --disable-ssl if available at built-time, support for SSL | |
61 | connections will be enabled. It can still be | |
62 | disabled at run-time, either on the daemon's | |
63 | command line or if the operating system does not | |
64 | have the OpenSSL libraries available.]) | |
65 | ||
66 | dnl We automatically detect PAM support, but allow users to disable it | |
67 | AC_ARG_ENABLE(pam, | |
68 | [ --disable-pam PAM support is necessary in order to authenticate | |
69 | users for running programs other than their default | |
70 | login shell.]) | |
71 | ||
72 | dnl We try to always use dlopen() instead of linking libraries dynamically, as | |
73 | dnl this reduces the hard run-time dependencies that our binary has. But we | |
74 | dnl allow users to disable this feature. | |
75 | AC_ARG_ENABLE(runtime-loading, | |
76 | [ --disable-runtime-loading ShellInABox will try to load the OpenSSL, and PAM | |
77 | libraries at run-time, if it has been compiled with | |
78 | support for these libraries, and if the operating | |
79 | system supports dynamic loading of libraries. This | |
80 | allows you to install the same binary on different | |
81 | systems independent of whether they have OpenSSL | |
82 | and PAM enabled. If you would rather directly link | |
83 | these libraries into the binary, thus making them a | |
84 | hard dependency, then disable runtime-loading.]) | |
85 | ||
86 | dnl Only test for OpenSSL headers, if not explicitly disabled | |
87 | if test "x$enable_ssl" != xno; then | |
88 | AC_CHECK_HEADERS([openssl/bio.h openssl/err.h openssl/ssl.h]) | |
89 | fi | |
90 | ||
91 | dnl Only test for PAM headers, if not explicitly disabled | |
92 | if test "x$enable_pam" != xno; then | |
93 | AC_CHECK_HEADERS([security/pam_appl.h security/pam_client.h \ | |
94 | security/pam_misc.h ]) | |
95 | fi | |
96 | ||
97 | dnl Only test for dlopen(), if not explicitly disabled. Add required libdl.so | |
98 | dnl library if necessary. Also, if dlopen() is not available on this system, | |
99 | dnl explicitly disable runtime loading. | |
100 | if test "x$enable_runtime_loading" != xno; then | |
101 | AC_CHECK_FUNCS(dlopen, [], | |
102 | [AC_CHECK_LIB(dl, dlopen, | |
103 | [LIBS="-ldl $LIBS" | |
104 | AC_DEFINE(HAVE_DLOPEN)], | |
105 | [enable_runtime_loading=no])]) | |
106 | fi | |
107 | ||
108 | dnl If runtime loading has been disabled, add OpenSSL and PAM as hard | |
109 | dnl dependencies. | |
110 | if test "x$enable_runtime_loading" == xno; then | |
111 | dnl Link against OpenSSL libraries, unless SSL support has been disabled | |
112 | if test "x$enable_ssl" != xno; then | |
572ac014 MG |
113 | AC_CHECK_HEADER(openssl/bio.h, |
114 | [AC_CHECK_HEADER(openssl/err.h, | |
10d0a6b0 | 115 | [AC_CHECK_HEADER(openssl/ssl.h, [LIBS="-lssl -lcrypto $LIBS"])])]) |
bf1ec4d2 MG |
116 | fi |
117 | ||
118 | dnl Link against PAM libraries, unless PAM support has been disabled | |
119 | if test "x$enable_pam" != xno; then | |
120 | AC_CHECK_HEADER(security/pam_appl.h, [LIBS="-lpam $LIBS"]) | |
121 | AC_CHECK_HEADER(security/pam_misc.h, [LIBS="-lpam_misc $LIBS"]) | |
122 | fi | |
123 | fi | |
124 | ||
33aa8fe1 MG |
125 | AC_CHECK_LIB(z, deflate, [ |
126 | AC_CHECK_HEADER(zlib.h, [LIBS="-lz $LIBS" | |
127 | AC_DEFINE(HAVE_ZLIB, 1, | |
128 | Define to 1 if zlib development files are installed) | |
129 | ])]) | |
130 | ||
bf1ec4d2 | 131 | dnl Generate output files |
7460295f MG |
132 | AC_CONFIG_FILES([Makefile]) |
133 | AC_OUTPUT |