]> andersk Git - test.git/blame - configure.ac
Fix a pointer aliasing violation by explicitly breaking aliasing with a
[test.git] / configure.ac
CommitLineData
7460295f 1AC_PREREQ(2.57)
bf1ec4d2
MG
2
3dnl This is the one location where the authoritative version number is stored
9be467c0 4AC_INIT(shellinabox, 2.10, markus@shellinabox.com)
14a75598 5VCS_REVISION=220
fe338aa8
MG
6AC_SUBST(VCS_REVISION)
7AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
8 [Most recent revision number in the version control system])
bf1ec4d2
MG
9
10dnl Set up autoconf/automake for building C libraries and binaries with GCC
c593cf68 11CFLAGS="${CFLAGS:--Os}"
7460295f 12AM_INIT_AUTOMAKE
bdd01e84 13AM_CONFIG_HEADER(config.h)
7460295f 14AC_PROG_CC
c593cf68 15AC_LANG_WERROR
7460295f
MG
16AC_PROG_INSTALL
17AC_PROG_LIBTOOL
18AC_SUBST(LIBTOOL_DEPS)
19AC_C_CONST
20AC_PROG_GCC_TRADITIONAL
bf1ec4d2
MG
21
22dnl Check for header files that do not exist on all platforms
ac96c090
MG
23AC_CHECK_HEADERS([libutil.h pthread.h pty.h strings.h sys/prctl.h sys/uio.h \
24 util.h utmp.h utmpx.h])
bf1ec4d2
MG
25
26dnl Most systems require linking against libutil.so in order to get login_tty()
a3876a41
MG
27AC_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
32dnl Use strlcat() instead of strncat() to avoid spurious warnings
33AC_CHECK_FUNCS([strlcat])
34
35dnl Prefer thread-safe functions, if available
4101fea2
MG
36AC_CHECK_FUNCS([getgrgid_r getgrnam_r gethostbyname_r getpwnam_r getpwuid_r \
37 openpty strcasestr ])
572ac014 38
bf1ec4d2 39dnl We prefer ptsname_r(), but will settle for ptsname() if necessary
29135474
MG
40AC_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
51dnl Apparently, some systems define sigwait() but fail to implement it
52AC_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
bc83b450
MG
58dnl Not every system has support for isnan()
59AC_TRY_LINK([#include <math.h>],
9b08d350 60 [if (isnan(0.0)) return 1;],
bc83b450
MG
61 [AC_DEFINE(HAVE_ISNAN, 1,
62 Define to 1 if you have support for isnan)])
63
e7fe02f0
MG
64dnl Even if utmpx.h exists, not all systems have support for updwtmpx()
65AC_TRY_LINK([#include <utmp.h>],
66 [updwtmp(0, 0);],
67 [AC_DEFINE(HAVE_UPDWTMP, 1,
68 Define to 1 if you have support for updwtmp)])
69AC_TRY_LINK([#include <utmpx.h>],
70 [updwtmpx(0, 0);],
71 [AC_DEFINE(HAVE_UPDWTMPX, 1,
72 Define to 1 if you have support for updwtmpx)])
73
2eb60237
MG
74dnl On some systems, calling /bin/login does not work. Disable the LOGIN
75dnl feature, if the user tells us that it does not do the right thing.
76AC_ARG_ENABLE(login,
77 [ --disable-login on some systems (e.g. Fedora), calling /bin/login
78 does not work well. If you know that your system
79 suffers from this problem, set this option to
80 remove support for the LOGIN keyword in the
81 service description.])
82if test "x$enable_login" != xno; then
83 AC_DEFINE(HAVE_BIN_LOGIN, 1,
84 Set if you want support for calling /bin/login)
85fi
86
bf1ec4d2
MG
87dnl We automatically detect SSL support, but allow users to disable it
88AC_ARG_ENABLE(ssl,
89 [ --disable-ssl if available at built-time, support for SSL
90 connections will be enabled. It can still be
91 disabled at run-time, either on the daemon's
92 command line or if the operating system does not
93 have the OpenSSL libraries available.])
94
95dnl We automatically detect PAM support, but allow users to disable it
96AC_ARG_ENABLE(pam,
97 [ --disable-pam PAM support is necessary in order to authenticate
98 users for running programs other than their default
99 login shell.])
100
101dnl We try to always use dlopen() instead of linking libraries dynamically, as
102dnl this reduces the hard run-time dependencies that our binary has. But we
103dnl allow users to disable this feature.
104AC_ARG_ENABLE(runtime-loading,
105 [ --disable-runtime-loading ShellInABox will try to load the OpenSSL, and PAM
106 libraries at run-time, if it has been compiled with
107 support for these libraries, and if the operating
108 system supports dynamic loading of libraries. This
109 allows you to install the same binary on different
110 systems independent of whether they have OpenSSL
111 and PAM enabled. If you would rather directly link
112 these libraries into the binary, thus making them a
113 hard dependency, then disable runtime-loading.])
114
115dnl Only test for OpenSSL headers, if not explicitly disabled
116if test "x$enable_ssl" != xno; then
117 AC_CHECK_HEADERS([openssl/bio.h openssl/err.h openssl/ssl.h])
118fi
119
120dnl Only test for PAM headers, if not explicitly disabled
121if test "x$enable_pam" != xno; then
122 AC_CHECK_HEADERS([security/pam_appl.h security/pam_client.h \
123 security/pam_misc.h ])
124fi
125
126dnl Only test for dlopen(), if not explicitly disabled. Add required libdl.so
127dnl library if necessary. Also, if dlopen() is not available on this system,
128dnl explicitly disable runtime loading.
129if test "x$enable_runtime_loading" != xno; then
130 AC_CHECK_FUNCS(dlopen, [],
131 [AC_CHECK_LIB(dl, dlopen,
132 [LIBS="-ldl $LIBS"
133 AC_DEFINE(HAVE_DLOPEN)],
134 [enable_runtime_loading=no])])
135fi
136
137dnl If runtime loading has been disabled, add OpenSSL and PAM as hard
138dnl dependencies.
139if test "x$enable_runtime_loading" == xno; then
140 dnl Link against OpenSSL libraries, unless SSL support has been disabled
141 if test "x$enable_ssl" != xno; then
572ac014
MG
142 AC_CHECK_HEADER(openssl/bio.h,
143 [AC_CHECK_HEADER(openssl/err.h,
10d0a6b0 144 [AC_CHECK_HEADER(openssl/ssl.h, [LIBS="-lssl -lcrypto $LIBS"])])])
bf1ec4d2
MG
145 fi
146
147 dnl Link against PAM libraries, unless PAM support has been disabled
148 if test "x$enable_pam" != xno; then
149 AC_CHECK_HEADER(security/pam_appl.h, [LIBS="-lpam $LIBS"])
150 AC_CHECK_HEADER(security/pam_misc.h, [LIBS="-lpam_misc $LIBS"])
151 fi
152fi
153
33aa8fe1
MG
154AC_CHECK_LIB(z, deflate, [
155 AC_CHECK_HEADER(zlib.h, [LIBS="-lz $LIBS"
156 AC_DEFINE(HAVE_ZLIB, 1,
157 Define to 1 if zlib development files are installed)
158])])
159
bf1ec4d2 160dnl Generate output files
7460295f
MG
161AC_CONFIG_FILES([Makefile])
162AC_OUTPUT
This page took 0.11097 seconds and 5 git commands to generate.