]> andersk Git - openssh.git/blob - configure.in
- Fix broken autoconf typedef detection. Report from Marc G.
[openssh.git] / configure.in
1 AC_INIT(ssh.c)
2
3 AC_CONFIG_HEADER(config.h)
4 AC_CANONICAL_HOST
5
6 dnl Checks for programs.
7 AC_PROG_CC
8 AC_PROG_CPP
9 AC_PROG_RANLIB
10 AC_PROG_INSTALL
11 AC_CHECK_PROG(AR, ar, ar)
12 AC_PATH_PROG(PERL, perl)
13 AC_SUBST(PERL)
14 AC_PATH_PROG(xauth_path, xauth)
15
16 dnl Use ip address instead of hostname in $DISPLAY
17 AC_ARG_WITH(rsh,
18         [  --with-rsh=PATH         Specify path to remote shell program ],
19         [
20                 if test "x$withval" != "$xno" ; then
21                         AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
22                 fi
23         ],
24         [
25                 AC_PATH_PROG(rsh_path, rsh)
26         ]
27 )
28
29 if test ! -z "$xauth_path" ; then
30         AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
31 fi
32 if test ! -z "$rsh_path" ; then
33         AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
34 fi
35
36 dnl Checks for compiler characteristics
37 if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi
38
39 AC_C_INLINE
40
41 dnl Check for some target-specific stuff
42 case "$host" in
43 *-*-hpux10*)
44         if test -z "$GCC"; then
45                 CFLAGS="$CFLAGS -Aa"
46         fi
47         CFLAGS="$CFLAGS -D_HPUX_SOURCE"
48         AC_DEFINE(IPADDR_IN_DISPLAY)
49         AC_DEFINE(USE_UTMPX)
50         AC_MSG_CHECKING(for HPUX trusted system password database)
51         if test -f /tcb/files/auth/system/default; then
52                 AC_MSG_RESULT(yes)
53                 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
54                 LIBS="$LIBS -lsec"
55         else
56                 AC_MSG_RESULT(no)
57                 AC_DEFINE(DISABLE_SHADOW)
58         fi
59         ;;
60 *-*-solaris*)
61         AC_DEFINE(USE_UTMPX)
62         ;;
63 *-*-irix5*)
64         AC_DEFINE(CRYPT_H_BREAKS_BUILD)
65 #       CFLAGS="$CFLAGS -shared"
66         no_libsocket=1
67         no_libnsl=1
68         ;;
69 esac
70
71 dnl Check for OpenSSL/SSLeay directories.
72 AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
73 for ssldir in /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local $prefix /usr/pkg ; do
74         if test -f "$ssldir/include/openssl/crypto.h"; then
75                 AC_DEFINE(HAVE_OPENSSL)
76                 GOT_SSL="yes"
77                 break
78         fi
79         if test -f "$ssldir/include/ssl/crypto.h"; then
80                 AC_DEFINE(HAVE_SSL)
81                 GOT_SSL="yes"
82                 break
83         fi
84 done
85 if test -z "$GOT_SSL" ; then
86         AC_MSG_ERROR([Could not find SSLeay / OpenSSL libraries, please install])       
87 fi
88 AC_SUBST(ssldir)
89 AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
90 if test "$ssldir" != "/usr"; then
91         CFLAGS="$CFLAGS -I$ssldir/include"
92         LDFLAGS="$LDFLAGS -L$ssldir/lib"
93 fi
94 AC_MSG_RESULT($ssldir)
95
96 dnl Check for RSAref library.
97 AC_MSG_CHECKING([for RSAref library])
98 saved_LIBS="$LIBS"
99 LIBS="$saved_LIBS -lRSAglue -lrsaref"
100 AC_TRY_LINK([], [],
101 [AC_MSG_RESULT(yes);
102  AC_DEFINE(RSAREF)],
103 [AC_MSG_RESULT(no)]; LIBS="$saved_LIBS")
104
105 dnl Checks for libraries.
106 AC_CHECK_LIB(crypto, CRYPTO_lock, ,AC_MSG_ERROR([*** libcrypto missing - please install first ***]))
107 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
108 AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
109 AC_CHECK_LIB(crypt, crypt, , )
110
111 if test -z "$no_libsocket" ; then
112         AC_CHECK_LIB(nsl, yp_match, , )
113 fi
114 if test -z "$no_libnsl" ; then
115         AC_CHECK_LIB(socket, main, , )
116 fi
117
118 dnl Checks for header files.
119 AC_CHECK_HEADERS(bstring.h crypt.h endian.h lastlog.h login.h maillock.h netdb.h netgroup.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stropts.h sys/time.h sys/ttcompat.h util.h utmp.h utmpx.h)
120
121 dnl Checks for library functions.
122 AC_CHECK_FUNCS(arc4random getpagesize _getpty innetgr md5_crypt mkdtemp openpty setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf)
123
124 AC_CHECK_FUNC(login, 
125         [AC_DEFINE(HAVE_LOGIN)],
126         [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
127 )
128
129 AC_CHECK_FUNC(daemon, 
130         [AC_DEFINE(HAVE_DAEMON)],
131         [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
132 )
133
134 dnl Checks for data types
135 AC_CHECK_SIZEOF(short int, 2)
136 AC_CHECK_SIZEOF(int, 4)
137 AC_CHECK_SIZEOF(long int, 4)
138 AC_CHECK_SIZEOF(long long int, 8)
139
140 dnl More checks for data types
141 AC_MSG_CHECKING([for quad_t])
142 AC_TRY_COMPILE(
143         [#include <sys/types.h>], 
144         [quad_t a; a = 1235;], 
145         [
146                 AC_DEFINE(HAVE_QUAD_T)
147                 AC_MSG_RESULT(yes)
148         ],
149         [AC_MSG_RESULT(no)]
150
151
152 AC_MSG_CHECKING([for intXX_t types])
153 AC_TRY_COMPILE(
154         [#include <sys/types.h>], 
155         [int16_t a; int32_t b; a = 1235; b = 1235;], 
156         [
157                 AC_DEFINE(HAVE_INTXX_T)
158                 AC_MSG_RESULT(yes)
159         ],
160         [AC_MSG_RESULT(no)]
161
162
163 AC_MSG_CHECKING([for u_intXX_t types])
164 AC_TRY_COMPILE(
165         [#include <sys/types.h>], 
166         [u_int16_t c; u_int32_t d; c = 1235; d = 1235;], 
167         [
168                 AC_DEFINE(HAVE_U_INTXX_T)
169                 AC_MSG_RESULT(yes)
170         ],
171         [AC_MSG_RESULT(no)]
172
173
174 AC_MSG_CHECKING([For uintXX_t types])
175 AC_TRY_COMPILE(
176         [#include <sys/types.h>], 
177         [uint16_t c; uint32_t d; c = 1235; d = 1235;], 
178         [
179                 AC_DEFINE(HAVE_UINTXX_T)
180                 AC_MSG_RESULT(yes)
181         ],
182         [AC_MSG_RESULT(no)]
183
184
185 AC_MSG_CHECKING([For socklen_t])
186 AC_TRY_COMPILE(
187         [
188                 #include <sys/types.h>
189                 #include <sys/socket.h>
190         ],
191         [socklen_t foo; foo = 1235;],
192         [
193                 AC_DEFINE(HAVE_SOCKLEN_T)
194                 AC_MSG_RESULT(yes)
195         ],
196         [AC_MSG_RESULT(no)]
197 )
198
199 AC_MSG_CHECKING([For size_t])
200 AC_TRY_COMPILE(
201         [#include <sys/types.h>],
202         [size_t foo; foo = 1235;],
203         [
204                 AC_DEFINE(HAVE_SIZE_T)
205                 AC_MSG_RESULT(yes)
206         ],
207         [AC_MSG_RESULT(no)]
208 )
209
210 AC_ARG_WITH(pam,
211         [  --without-pam           Disable PAM support ],
212         [
213                 if test "x$withval" = "xno" ; then
214                         no_pam=1
215                         AC_DEFINE(DISABLE_PAM)
216                 fi
217         ]
218 )
219
220 if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
221         AC_CHECK_LIB(dl, dlopen, , )
222         LIBS="$LIBS -lpam"
223         dnl Check PAM strerror arguments
224         AC_MSG_CHECKING([whether pam_strerror takes only one argument])
225         AC_TRY_COMPILE(
226                 [
227                         #include <stdlib.h>
228                         #include <security/pam_appl.h>
229                 ], 
230                 [(void)pam_strerror((pam_handle_t *)NULL, -1);], 
231                 [AC_MSG_RESULT(no)],
232                 [
233                         AC_DEFINE(HAVE_OLD_PAM)
234                         AC_MSG_RESULT(yes)
235                 ]
236         ) 
237 fi
238
239 AC_MSG_CHECKING([whether to build GNOME ssh-askpass])
240 dnl Check whether user wants GNOME ssh-askpass
241 AC_ARG_WITH(gnome-askpass,
242         [  --with-gnome-askpass    Build the GNOME passphrase requester (default=no)],
243         [
244                 if test x$withval = xno ; then
245                         GNOME_ASKPASS="";
246                 else
247                         GNOME_ASKPASS="gnome-ssh-askpass";
248                 fi
249         ])
250 AC_SUBST(GNOME_ASKPASS)
251
252 if test -z "$GNOME_ASKPASS" ; then
253         AC_MSG_RESULT(no)
254 else
255         AC_MSG_RESULT(yes)
256 fi
257
258 dnl Check for user-specified random device
259 AC_ARG_WITH(random,
260         [  --with-random=FILE      read randomness from FILE (default=/dev/urandom)],
261         [
262                 RANDOM_POOL="$withval";
263                 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
264         ],
265         [
266                 dnl Check for random device
267                 AC_CHECK_FILE("/dev/urandom",
268                         [
269                                 RANDOM_POOL="/dev/urandom"; 
270                                 AC_SUBST(RANDOM_POOL)
271                                 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
272                         ]
273                 )
274         ]
275 )
276
277 dnl Check for EGD pool file
278 AC_ARG_WITH(egd-pool,
279         [  --with-egd-pool=FILE    read randomness from EGD pool FILE (default none)],
280         [
281                 RANDOM_POOL="$withval";
282                 AC_DEFINE(HAVE_EGD)
283                 AC_SUBST(RANDOM_POOL)
284                 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
285         ]
286 )
287
288 dnl Make sure we have random number support
289 if test -z "$RANDOM_POOL" -a -z "$EGD_POOL"; then
290         AC_MSG_ERROR([No random device found, and no EGD random pool specified])
291 fi
292
293 AC_MSG_CHECKING([whether utmp.h has ut_host field])
294 AC_EGREP_HEADER(ut_host, utmp.h, 
295         [AC_DEFINE(HAVE_HOST_IN_UTMP) AC_MSG_RESULT(yes); ], 
296         [AC_MSG_RESULT(no)]
297 )
298 AC_MSG_CHECKING([whether utmpx.h has ut_host field])
299 AC_EGREP_HEADER(ut_host, utmpx.h, 
300         [AC_DEFINE(HAVE_HOST_IN_UTMPX) AC_MSG_RESULT(yes); ], 
301         [AC_MSG_RESULT(no)]
302 )
303 AC_MSG_CHECKING([whether utmpx.h has syslen field])
304 AC_EGREP_HEADER(syslen, utmpx.h, 
305         [AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ], 
306         [AC_MSG_RESULT(no)]
307 )
308 AC_MSG_CHECKING([whether utmp.h has ut_pid field])
309 AC_EGREP_HEADER(ut_pid, utmp.h, 
310         [AC_DEFINE(HAVE_PID_IN_UTMP) AC_MSG_RESULT(yes); ], 
311         [AC_MSG_RESULT(no)]
312 )
313 AC_MSG_CHECKING([whether utmp.h has ut_type field])
314 AC_EGREP_HEADER(ut_type, utmp.h, 
315         [AC_DEFINE(HAVE_TYPE_IN_UTMP) AC_MSG_RESULT(yes); ], 
316         [AC_MSG_RESULT(no)]
317 )
318 AC_MSG_CHECKING([whether utmp.h has ut_tv field])
319 AC_EGREP_HEADER(ut_tv, utmp.h, 
320         [AC_DEFINE(HAVE_TV_IN_UTMP) AC_MSG_RESULT(yes); ], 
321         [AC_MSG_RESULT(no)]
322 )
323 AC_MSG_CHECKING([whether utmp.h has ut_id field])
324 AC_EGREP_HEADER(ut_id, utmp.h, 
325         [AC_DEFINE(HAVE_ID_IN_UTMP) AC_MSG_RESULT(yes); ], 
326         [AC_MSG_RESULT(no)]
327 )
328
329 dnl Look for lastlog location
330 AC_ARG_WITH(lastlog,
331         [  --with-lastlog=FILE     Location of lastlog file],
332         [
333                 if test "x$withval" = "xno" ; then
334                         AC_DEFINE(DISABLE_LASTLOG)
335                 else
336                         AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$withval")
337                 fi
338         ],
339         [
340                 AC_MSG_CHECKING([location of lastlog file])
341                 for lastlog in /var/log/lastlog /var/adm/lastlog /etc/security/lastlog ; do
342                         if test -f $lastlog ; then
343                                 gotlastlog="file"
344                                 break
345                         fi
346                         if test -d $lastlog ; then
347                                 gotlastlog="dir"
348                                 break
349                         fi
350                 done
351                 if test -z "$gotlastlog" ; then
352                         AC_MSG_RESULT(not found)
353                         nolastlog=1
354                 else
355                         if test "x$gotlastlog" = "xdir" ; then
356                                 AC_MSG_RESULT(${lastlog}/)
357                                 AC_DEFINE(LASTLOG_IS_DIR)
358                                 AC_MSG_WARN([*** Directory-based lastlogs are not yet supported ***])
359                                 nolastlog=1
360                         else
361                                 AC_MSG_RESULT($lastlog)
362                                 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$lastlog")
363                         fi
364                 fi      
365         ]
366 )
367
368 if test ! -z "$nolastlog" ; then
369         AC_MSG_WARN([*** Disabling lastlog support *** ])
370         AC_DEFINE(DISABLE_LASTLOG)
371 fi
372
373 dnl Compile with dante SOCKS library
374 AC_ARG_WITH(dante,
375         [  --with-dante=DIR        Use Dante SOCKS lib (default is system library path)],
376         [
377                 AC_DEFINE(HAVE_DANTE)
378                 if test "x$withval" != "xno" ; then
379                         if test -n $withval ; then
380                                 LIBS="$LIBS -L$withval"
381                         fi
382                         LIBS="$LIBS -lsocks"
383                 fi
384         ]
385 )
386
387 AC_CHECK_FILE("/dev/ptmx", AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX))
388 AC_CHECK_FILE("/dev/ptc", AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC))
389
390 AC_MSG_CHECKING([whether libc defines __progname])
391 AC_TRY_LINK([], 
392         [extern char *__progname; printf("%s", __progname);], 
393         [
394                 AC_DEFINE(HAVE___PROGNAME)
395                 AC_MSG_RESULT(yes)
396         ], 
397         [
398                 AC_MSG_RESULT(no)
399         ]
400 )
401
402 dnl Check whether user wants Kerberos support
403 AC_ARG_WITH(kerberos4,
404         [  --with-kerberos4        Enable Kerberos 4 support],
405         [
406                 if test "x$withval" != "$xno" ; then
407                         AC_DEFINE(KRB4)
408                         LIBS="$LIBS -lkrb"
409                         CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
410                 fi
411         ]
412 )
413
414 dnl Check whether user wants AFS support
415 AC_ARG_WITH(afs,
416         [  --with-afs              Enable AFS support],
417         [
418                 if test "x$withval" != "$xno" ; then
419                         AC_DEFINE(AFS)
420                         LIBS="$LIBS -lkafs"
421                 fi
422         ]
423 )
424
425 dnl Check whether user wants S/Key support
426 AC_ARG_WITH(skey,
427         [  --with-skey             Enable S/Key support],
428         [
429                 if test "x$withval" != "$xno" ; then
430                         AC_DEFINE(SKEY)
431                         LIBS="$LIBS -lskey"
432                 fi
433         ]
434 )
435
436 dnl Check whether user wants TCP wrappers support
437 AC_ARG_WITH(tcp-wrappers,
438         [  --with-tcp-wrappers     Enable tcpwrappers support],
439         [
440                 if test "x$withval" != "$xno" ; then
441                         AC_DEFINE(LIBWRAP)
442                         LIBWRAP="-lwrap"
443                 fi
444         ]
445 )
446 AC_SUBST(LIBWRAP)
447
448 dnl Check whether to enable MD5 passwords
449 AC_ARG_WITH(md5-passwords,
450         [  --with-md5-passwords    Enable use of MD5 passwords],
451         [
452                 if test "x$withval" != "$xno" ; then
453                         AC_DEFINE(HAVE_MD5_PASSWORDS)
454                 fi
455         ]
456 )
457
458 dnl Check whether to enable utmpx support
459 AC_ARG_WITH(utmpx,
460         [  --with-utmpx            Enable utmpx support],
461         [
462                 if test "x$withval" != "xno" ; then
463                         AC_DEFINE(USE_UTMPX)
464                 fi
465         ]
466 )
467
468 dnl Whether to disable shadow password support
469 AC_ARG_WITH(shadow,
470         [  --without-shadow        Disable shadow password support],
471         [
472                 if test "x$withval" = "xno" ; then      
473                         AC_DEFINE(DISABLE_SHADOW)
474                 fi
475         ]
476 )
477
478 dnl Use ip address instead of hostname in $DISPLAY
479 AC_ARG_WITH(ipaddr-display,
480         [  --with-ipaddr-display   Use ip address instead of hostname in \$DISPLAY],
481         [
482                 if test "x$withval" = "xno" ; then      
483                         AC_DEFINE(IPADDR_IN_DISPLAY)
484                 fi
485         ]
486 )
487
488 AC_ARG_WITH(path,
489         [  --with-default-path=PATH Specify default \$PATH environment for server],
490         [
491                 if test "x$withval" != "xno" ; then     
492                         AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
493                 fi
494         ]
495 )
496
497 dnl Check for mail directory (last resort if we cannot get it from headers)
498 if test ! -z "$MAIL" ; then
499         maildir=`dirname $MAIL`
500         AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
501 fi
502
503 AC_OUTPUT(Makefile)
This page took 0.103787 seconds and 5 git commands to generate.