configure.ac 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf and autoheader to produce a configure script.
  3. # This Autoconf file was cobbled from various locations. In particular, a bunch
  4. # of the platform checks have been taken straight from OpenSSH's configure.ac
  5. # Huge thanks to them for dealing with the horrible platform-specifics :)
  6. AC_PREREQ(2.59)
  7. AC_INIT
  8. AC_CONFIG_SRCDIR(buffer.c)
  9. OLDCFLAGS=$CFLAGS
  10. # Checks for programs.
  11. AC_PROG_CC
  12. AC_PROG_MAKE_SET
  13. if test -z "$LD" ; then
  14. LD=$CC
  15. fi
  16. AC_SUBST(LD)
  17. if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then
  18. AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC)
  19. CFLAGS="-Os -W -Wall -Wno-pointer-sign"
  20. fi
  21. # large file support is useful for scp
  22. AC_SYS_LARGEFILE
  23. # Host specific options
  24. # this isn't a definitive list of hosts, they are just added as required
  25. AC_CANONICAL_HOST
  26. case "$host" in
  27. *-*-linux*)
  28. no_ptmx_check=1
  29. ;;
  30. *-*-solaris*)
  31. CFLAGS="$CFLAGS -I/usr/local/include"
  32. LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
  33. conf_lastlog_location="/var/adm/lastlog"
  34. AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
  35. sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
  36. if test "$sol2ver" -ge 8; then
  37. AC_MSG_RESULT(yes)
  38. AC_DEFINE(DISABLE_UTMP,,Disable utmp)
  39. AC_DEFINE(DISABLE_WTMP,,Disable wtmp)
  40. else
  41. AC_MSG_RESULT(no)
  42. fi
  43. AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
  44. AC_CHECK_LIB(nsl, yp_match, LIBS="$LIBS -lnsl")
  45. ;;
  46. *-*-aix*)
  47. AC_DEFINE(AIX,,Using AIX)
  48. # OpenSSH thinks it's broken. If it isn't, let me know.
  49. AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
  50. ;;
  51. *-*-hpux*)
  52. LIBS="$LIBS -lsec"
  53. # It's probably broken.
  54. AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
  55. ;;
  56. *-dec-osf*)
  57. AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
  58. ;;
  59. esac
  60. AC_CHECK_TOOL(AR, ar, :)
  61. AC_CHECK_TOOL(RANLIB, ranlib, :)
  62. AC_CHECK_TOOL(STRIP, strip, :)
  63. AC_CHECK_TOOL(INSTALL, install, :)
  64. dnl Can't use login() or logout() with uclibc
  65. AC_CHECK_DECL(__UCLIBC__,
  66. [
  67. no_loginfunc_check=1
  68. AC_MSG_NOTICE([Using uClibc - login() and logout() probably don't work, so we won't use them.])
  69. ],,,)
  70. dnl We test for crypt() specially. On Linux (and others?) it resides in libcrypt
  71. dnl but we don't want link all binaries to -lcrypt, just dropbear server.
  72. dnl OS X doesn't need -lcrypt
  73. AC_CHECK_FUNC(crypt, found_crypt_func=here)
  74. AC_CHECK_LIB(crypt, crypt,
  75. [
  76. CRYPTLIB="-lcrypt"
  77. found_crypt_func=here
  78. ])
  79. AC_SUBST(CRYPTLIB)
  80. if test "t$found_crypt_func" = there; then
  81. AC_DEFINE(HAVE_CRYPT, 1, [crypt() function])
  82. fi
  83. # Check if zlib is needed
  84. AC_ARG_WITH(zlib,
  85. [ --with-zlib=PATH Use zlib in PATH],
  86. [
  87. # option is given
  88. if test -d "$withval/lib"; then
  89. LDFLAGS="-L${withval}/lib ${LDFLAGS}"
  90. else
  91. LDFLAGS="-L${withval} ${LDFLAGS}"
  92. fi
  93. if test -d "$withval/include"; then
  94. CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
  95. else
  96. CPPFLAGS="-I${withval} ${CPPFLAGS}"
  97. fi
  98. ]
  99. )
  100. AC_ARG_ENABLE(zlib,
  101. [ --disable-zlib Don't include zlib support],
  102. [
  103. if test "x$enableval" = "xno"; then
  104. AC_DEFINE(DISABLE_ZLIB,, Use zlib)
  105. AC_MSG_NOTICE(Disabling zlib)
  106. else
  107. AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** zlib missing - install first or check config.log ***]))
  108. AC_MSG_NOTICE(Enabling zlib)
  109. fi
  110. ],
  111. [
  112. # if not disabled, check for zlib
  113. AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** zlib missing - install first or check config.log ***]))
  114. AC_MSG_NOTICE(Enabling zlib)
  115. ]
  116. )
  117. # Check if pam is needed
  118. AC_ARG_WITH(pam,
  119. [ --with-pam=PATH Use pam in PATH],
  120. [
  121. # option is given
  122. if test -d "$withval/lib"; then
  123. LDFLAGS="-L${withval}/lib ${LDFLAGS}"
  124. else
  125. LDFLAGS="-L${withval} ${LDFLAGS}"
  126. fi
  127. if test -d "$withval/include"; then
  128. CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
  129. else
  130. CPPFLAGS="-I${withval} ${CPPFLAGS}"
  131. fi
  132. ]
  133. )
  134. AC_ARG_ENABLE(pam,
  135. [ --enable-pam Try to include PAM support],
  136. [
  137. if test "x$enableval" = "xyes"; then
  138. AC_CHECK_LIB(pam, pam_authenticate, , AC_MSG_ERROR([*** PAM missing - install first or check config.log ***]))
  139. AC_MSG_NOTICE(Enabling PAM)
  140. AC_CHECK_FUNCS(pam_fail_delay)
  141. else
  142. AC_DEFINE(DISABLE_PAM,, Use PAM)
  143. AC_MSG_NOTICE(Disabling PAM)
  144. fi
  145. ],
  146. [
  147. # disable it by default
  148. AC_DEFINE(DISABLE_PAM,, Use PAM)
  149. AC_MSG_NOTICE(Disabling PAM)
  150. ]
  151. )
  152. AC_ARG_ENABLE(openpty,
  153. [ --disable-openpty Don't use openpty, use alternative method],
  154. [
  155. if test "x$enableval" = "xno"; then
  156. AC_MSG_NOTICE(Not using openpty)
  157. else
  158. AC_MSG_NOTICE(Using openpty if available)
  159. AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)])
  160. fi
  161. ],
  162. [
  163. AC_MSG_NOTICE(Using openpty if available)
  164. AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)])
  165. ]
  166. )
  167. AC_ARG_ENABLE(syslog,
  168. [ --disable-syslog Don't include syslog support],
  169. [
  170. if test "x$enableval" = "xno"; then
  171. AC_DEFINE(DISABLE_SYSLOG,, Using syslog)
  172. AC_MSG_NOTICE(Disabling syslog)
  173. else
  174. AC_MSG_NOTICE(Enabling syslog)
  175. fi
  176. ],
  177. [
  178. AC_MSG_NOTICE(Enabling syslog)
  179. ]
  180. )
  181. AC_ARG_ENABLE(shadow,
  182. [ --disable-shadow Don't use shadow passwords (if available)],
  183. [
  184. if test "x$enableval" = "xno"; then
  185. AC_MSG_NOTICE(Not using shadow passwords)
  186. else
  187. AC_CHECK_HEADERS([shadow.h])
  188. AC_MSG_NOTICE(Using shadow passwords if available)
  189. fi
  190. ],
  191. [
  192. AC_CHECK_HEADERS([shadow.h])
  193. AC_MSG_NOTICE(Using shadow passwords if available)
  194. ]
  195. )
  196. # Checks for header files.
  197. AC_HEADER_STDC
  198. AC_HEADER_SYS_WAIT
  199. AC_CHECK_HEADERS([fcntl.h limits.h netinet/in.h netinet/tcp.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h crypt.h pty.h ioctl.h libutil.h libgen.h inttypes.h stropts.h utmp.h utmpx.h lastlog.h paths.h util.h netdb.h security/pam_appl.h pam/pam_appl.h netinet/in_systm.h sys/uio.h])
  200. # Checks for typedefs, structures, and compiler characteristics.
  201. AC_C_CONST
  202. AC_TYPE_UID_T
  203. AC_TYPE_MODE_T
  204. AC_TYPE_PID_T
  205. AC_TYPE_SIZE_T
  206. AC_HEADER_TIME
  207. AC_CHECK_TYPES([uint8_t, u_int8_t, uint16_t, u_int16_t, uint32_t, u_int32_t])
  208. AC_CHECK_TYPES([struct sockaddr_storage])
  209. AC_CHECK_TYPE([socklen_t], ,[
  210. AC_MSG_CHECKING([for socklen_t equivalent])
  211. AC_CACHE_VAL([curl_cv_socklen_t_equiv],
  212. [
  213. # Systems have either "struct sockaddr *" or
  214. # "void *" as the second argument to getpeername
  215. curl_cv_socklen_t_equiv=
  216. for arg2 in "struct sockaddr" void; do
  217. for t in int size_t unsigned long "unsigned long"; do
  218. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  219. #include <sys/types.h>
  220. #include <sys/socket.h>
  221. int getpeername (int, $arg2 *, $t *);
  222. ]],[[
  223. $t len;
  224. getpeername(0,0,&len);
  225. ]])],[
  226. curl_cv_socklen_t_equiv="$t"
  227. break
  228. ])
  229. done
  230. done
  231. if test "x$curl_cv_socklen_t_equiv" = x; then
  232. AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
  233. fi
  234. ])
  235. AC_MSG_RESULT($curl_cv_socklen_t_equiv)
  236. AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
  237. [type to use in place of socklen_t if not defined])],
  238. [#include <sys/types.h>
  239. #include <sys/socket.h>])
  240. # for the fake-rfc2553 stuff - straight from OpenSSH
  241. AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
  242. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  243. #include <sys/types.h>
  244. #include <sys/socket.h>
  245. ]],
  246. [[ if (sizeof(struct sockaddr_storage)) return 0 ]])],
  247. [ ac_cv_have_struct_sockaddr_storage="yes" ],
  248. [ ac_cv_have_struct_sockaddr_storage="no" ]
  249. )
  250. ])
  251. if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
  252. AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
  253. fi
  254. AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
  255. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  256. #include <sys/types.h>
  257. #include <netinet/in.h>
  258. ]],
  259. [[ if (sizeof(struct sockaddr_in6)) return 0 ]])],
  260. [ ac_cv_have_struct_sockaddr_in6="yes" ],
  261. [ ac_cv_have_struct_sockaddr_in6="no" ]
  262. )
  263. ])
  264. if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
  265. AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6,,Have struct sockaddr_in6)
  266. fi
  267. AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
  268. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  269. #include <sys/types.h>
  270. #include <netinet/in.h>
  271. ]],
  272. [[ if (sizeof(struct in6_addr)) return 0 ]])],
  273. [ ac_cv_have_struct_in6_addr="yes" ],
  274. [ ac_cv_have_struct_in6_addr="no" ]
  275. )
  276. ])
  277. if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
  278. AC_DEFINE(HAVE_STRUCT_IN6_ADDR,,Have struct in6_addr)
  279. fi
  280. AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
  281. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  282. #include <sys/types.h>
  283. #include <sys/socket.h>
  284. #include <netdb.h>
  285. ]],
  286. [[ if (sizeof(struct addrinfo)) return 0 ]])],
  287. [ ac_cv_have_struct_addrinfo="yes" ],
  288. [ ac_cv_have_struct_addrinfo="no" ]
  289. )
  290. ])
  291. if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
  292. AC_DEFINE(HAVE_STRUCT_ADDRINFO,,Have struct addrinfo)
  293. fi
  294. # IRIX has a const char return value for gai_strerror()
  295. AC_CHECK_FUNCS(gai_strerror,[
  296. AC_DEFINE(HAVE_GAI_STRERROR)
  297. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  298. #include <sys/types.h>
  299. #include <sys/socket.h>
  300. #include <netdb.h>
  301. const char *gai_strerror(int);]],[[
  302. char *str;
  303. str = gai_strerror(0);]])],[
  304. AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
  305. [Define if gai_strerror() returns const char *])])])
  306. # for loginrec.c
  307. AC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_pid, struct utmp.ut_type, struct utmp.ut_tv, struct utmp.ut_id, struct utmp.ut_addr, struct utmp.ut_addr_v6, struct utmp.ut_exit, struct utmp.ut_time],,,[
  308. #include <sys/types.h>
  309. #if HAVE_UTMP_H
  310. #include <utmp.h>
  311. #endif
  312. ])
  313. AC_CHECK_MEMBERS([struct utmpx.ut_host, struct utmpx.ut_syslen, struct utmpx.ut_type, struct utmpx.ut_id, struct utmpx.ut_addr, struct utmpx.ut_addr_v6, struct utmpx.ut_time, struct utmpx.ut_tv],,,[
  314. #include <sys/types.h>
  315. #include <sys/socket.h>
  316. #if HAVE_UTMPX_H
  317. #include <utmpx.h>
  318. #endif
  319. ])
  320. AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],,,[
  321. #include <sys/types.h>
  322. #include <sys/socket.h>
  323. ])
  324. AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
  325. AC_CHECK_FUNCS(utmpname)
  326. AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
  327. AC_CHECK_FUNCS(setutxent utmpxname)
  328. AC_CHECK_FUNCS(logout updwtmp logwtmp)
  329. # OS X monotonic time
  330. AC_CHECK_HEADERS([mach/mach_time.h])
  331. AC_CHECK_FUNCS(mach_absolute_time)
  332. AC_CHECK_FUNCS(explicit_bzero memset_s)
  333. AC_ARG_ENABLE(bundled-libtom,
  334. [ --enable-bundled-libtom Force using bundled libtomcrypt/libtommath even if a system version exists.
  335. --disable-bundled-libtom Force using system libtomcrypt/libtommath, fail if it does not exist.
  336. Default is to use system if available, otherwise bundled.],
  337. [
  338. if test "x$enableval" = "xyes"; then
  339. BUNDLED_LIBTOM=1
  340. AC_MSG_NOTICE(Forcing bundled libtom*)
  341. else
  342. BUNDLED_LIBTOM=0
  343. AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath",
  344. [AC_MSG_ERROR([Missing system libtommath and --disable-bundled-libtom was specified])] )
  345. AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt",
  346. [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] )
  347. fi
  348. ],
  349. [
  350. BUNDLED_LIBTOM=0
  351. AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", BUNDLED_LIBTOM=1)
  352. AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", BUNDLED_LIBTOM=1)
  353. ]
  354. )
  355. if test $BUNDLED_LIBTOM = 1 ; then
  356. AC_DEFINE(BUNDLED_LIBTOM,,Use bundled libtom)
  357. fi
  358. AC_SUBST(LIBTOM_LIBS)
  359. AC_SUBST(BUNDLED_LIBTOM)
  360. dnl Added from OpenSSH 3.6.1p2's configure.ac
  361. dnl allow user to disable some login recording features
  362. AC_ARG_ENABLE(lastlog,
  363. [ --disable-lastlog Disable use of lastlog even if detected [no]],
  364. [ AC_DEFINE(DISABLE_LASTLOG,,Disable use of lastlog()) ]
  365. )
  366. AC_ARG_ENABLE(utmp,
  367. [ --disable-utmp Disable use of utmp even if detected [no]],
  368. [ AC_DEFINE(DISABLE_UTMP,,Disable use of utmp) ]
  369. )
  370. AC_ARG_ENABLE(utmpx,
  371. [ --disable-utmpx Disable use of utmpx even if detected [no]],
  372. [ AC_DEFINE(DISABLE_UTMPX,,Disable use of utmpx) ]
  373. )
  374. AC_ARG_ENABLE(wtmp,
  375. [ --disable-wtmp Disable use of wtmp even if detected [no]],
  376. [ AC_DEFINE(DISABLE_WTMP,,Disable use of wtmp) ]
  377. )
  378. AC_ARG_ENABLE(wtmpx,
  379. [ --disable-wtmpx Disable use of wtmpx even if detected [no]],
  380. [ AC_DEFINE(DISABLE_WTMPX,,Disable use of wtmpx) ]
  381. )
  382. AC_ARG_ENABLE(loginfunc,
  383. [ --disable-loginfunc Disable use of login() etc. [no]],
  384. [ no_loginfunc_check=1
  385. AC_MSG_NOTICE(Not using login() etc) ]
  386. )
  387. AC_ARG_ENABLE(pututline,
  388. [ --disable-pututline Disable use of pututline() etc. ([uw]tmp) [no]],
  389. [ AC_DEFINE(DISABLE_PUTUTLINE,,Disable use of pututline()) ]
  390. )
  391. AC_ARG_ENABLE(pututxline,
  392. [ --disable-pututxline Disable use of pututxline() etc. ([uw]tmpx) [no]],
  393. [ AC_DEFINE(DISABLE_PUTUTXLINE,,Disable use of pututxline()) ]
  394. )
  395. AC_ARG_WITH(lastlog,
  396. [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
  397. [
  398. if test "x$withval" = "xno" ; then
  399. AC_DEFINE(DISABLE_LASTLOG)
  400. else
  401. conf_lastlog_location=$withval
  402. fi
  403. ]
  404. )
  405. if test -z "$no_loginfunc_check"; then
  406. dnl Checks for libutil functions (login(), logout() etc, not openpty() )
  407. AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN,,Have login() function)])
  408. AC_CHECK_FUNCS(logout updwtmp logwtmp)
  409. fi
  410. dnl lastlog, [uw]tmpx? detection
  411. dnl NOTE: set the paths in the platform section to avoid the
  412. dnl need for command-line parameters
  413. dnl lastlog and [uw]tmp are subject to a file search if all else fails
  414. dnl lastlog detection
  415. dnl NOTE: the code itself will detect if lastlog is a directory
  416. AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
  417. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  418. #include <sys/types.h>
  419. #include <utmp.h>
  420. #ifdef HAVE_LASTLOG_H
  421. # include <lastlog.h>
  422. #endif
  423. #ifdef HAVE_PATHS_H
  424. # include <paths.h>
  425. #endif
  426. #ifdef HAVE_LOGIN_H
  427. # include <login.h>
  428. #endif
  429. ]],
  430. [[ char *lastlog = LASTLOG_FILE; ]])],
  431. [ AC_MSG_RESULT(yes) ],
  432. [
  433. AC_MSG_RESULT(no)
  434. AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
  435. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  436. #include <sys/types.h>
  437. #include <utmp.h>
  438. #ifdef HAVE_LASTLOG_H
  439. # include <lastlog.h>
  440. #endif
  441. #ifdef HAVE_PATHS_H
  442. # include <paths.h>
  443. #endif
  444. ]],
  445. [[ char *lastlog = _PATH_LASTLOG; ]])],
  446. [ AC_MSG_RESULT(yes) ],
  447. [
  448. AC_MSG_RESULT(no)
  449. system_lastlog_path=no
  450. ])
  451. ]
  452. )
  453. if test -z "$conf_lastlog_location"; then
  454. if test x"$system_lastlog_path" = x"no" ; then
  455. for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
  456. if (test -d "$f" || test -f "$f") ; then
  457. conf_lastlog_location=$f
  458. fi
  459. done
  460. if test -z "$conf_lastlog_location"; then
  461. AC_MSG_WARN([** Cannot find lastlog **])
  462. dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
  463. fi
  464. fi
  465. fi
  466. if test -n "$conf_lastlog_location"; then
  467. AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location", lastlog file location)
  468. fi
  469. dnl utmp detection
  470. AC_MSG_CHECKING([if your system defines UTMP_FILE])
  471. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  472. #include <sys/types.h>
  473. #include <utmp.h>
  474. #ifdef HAVE_PATHS_H
  475. # include <paths.h>
  476. #endif
  477. ]],
  478. [[ char *utmp = UTMP_FILE; ]])],
  479. [ AC_MSG_RESULT(yes) ],
  480. [ AC_MSG_RESULT(no)
  481. system_utmp_path=no ]
  482. )
  483. if test -z "$conf_utmp_location"; then
  484. if test x"$system_utmp_path" = x"no" ; then
  485. for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
  486. if test -f $f ; then
  487. conf_utmp_location=$f
  488. fi
  489. done
  490. if test -z "$conf_utmp_location"; then
  491. AC_DEFINE(DISABLE_UTMP)
  492. fi
  493. fi
  494. fi
  495. if test -n "$conf_utmp_location"; then
  496. AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location", utmp file location)
  497. fi
  498. dnl wtmp detection
  499. AC_MSG_CHECKING([if your system defines WTMP_FILE])
  500. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  501. #include <sys/types.h>
  502. #ifdef HAVE_UTMP_H
  503. # include <utmp.h>
  504. #endif
  505. #ifdef HAVE_PATHS_H
  506. # include <paths.h>
  507. #endif
  508. ]],
  509. [[ char *wtmp = WTMP_FILE; ]])],
  510. [ AC_MSG_RESULT(yes) ],
  511. [ AC_MSG_RESULT(no)
  512. system_wtmp_path=no ]
  513. )
  514. if test -z "$conf_wtmp_location"; then
  515. if test x"$system_wtmp_path" = x"no" ; then
  516. for f in /usr/adm/wtmp /var/log/wtmp; do
  517. if test -f $f ; then
  518. conf_wtmp_location=$f
  519. fi
  520. done
  521. if test -z "$conf_wtmp_location"; then
  522. AC_DEFINE(DISABLE_WTMP)
  523. fi
  524. fi
  525. fi
  526. if test -n "$conf_wtmp_location"; then
  527. AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location", wtmp file location)
  528. fi
  529. dnl utmpx detection - I don't know any system so perverse as to require
  530. dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
  531. dnl there, though.
  532. AC_MSG_CHECKING([if your system defines UTMPX_FILE])
  533. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  534. #include <sys/types.h>
  535. #include <utmp.h>
  536. #ifdef HAVE_UTMPX_H
  537. #include <utmpx.h>
  538. #endif
  539. #ifdef HAVE_PATHS_H
  540. # include <paths.h>
  541. #endif
  542. ]],
  543. [[ char *utmpx = UTMPX_FILE; ]])],
  544. [ AC_MSG_RESULT(yes) ],
  545. [ AC_MSG_RESULT(no)
  546. system_utmpx_path=no ]
  547. )
  548. if test -z "$conf_utmpx_location"; then
  549. if test x"$system_utmpx_path" = x"no" ; then
  550. AC_DEFINE(DISABLE_UTMPX)
  551. fi
  552. else
  553. AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location", utmpx file location)
  554. fi
  555. dnl wtmpx detection
  556. AC_MSG_CHECKING([if your system defines WTMPX_FILE])
  557. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  558. #include <sys/types.h>
  559. #ifdef HAVE_UTMP_H
  560. # include <utmp.h>
  561. #endif
  562. #ifdef HAVE_UTMPX_H
  563. # include <utmpx.h>
  564. #endif
  565. #ifdef HAVE_PATHS_H
  566. # include <paths.h>
  567. #endif
  568. ]],
  569. [[ char *wtmpx = WTMPX_FILE; ]])],
  570. [ AC_MSG_RESULT(yes) ],
  571. [ AC_MSG_RESULT(no)
  572. system_wtmpx_path=no ]
  573. )
  574. if test -z "$conf_wtmpx_location"; then
  575. if test x"$system_wtmpx_path" = x"no" ; then
  576. AC_DEFINE(DISABLE_WTMPX)
  577. fi
  578. else
  579. AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location", wtmpx file location)
  580. fi
  581. # Checks for library functions.
  582. AC_PROG_GCC_TRADITIONAL
  583. AC_FUNC_MEMCMP
  584. AC_FUNC_SELECT_ARGTYPES
  585. AC_CHECK_FUNCS([dup2 getpass getspnam getusershell memset putenv select socket strdup clearenv strlcpy strlcat daemon basename _getpty getaddrinfo freeaddrinfo getnameinfo fork writev])
  586. AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
  587. # Solaris needs ptmx
  588. if test -z "$no_ptmx_check" ; then
  589. if test x"$cross_compiling" = x"no" ; then
  590. if test -e /dev/ptmx ; then
  591. AC_DEFINE(USE_DEV_PTMX,,Use /dev/ptmx)
  592. fi
  593. else
  594. AC_MSG_NOTICE([Not checking for /dev/ptmx, we're cross-compiling])
  595. fi
  596. fi
  597. if test -z "$no_ptc_check" ; then
  598. if test x"$cross_compiling" = x"no" ; then
  599. if test -e /dev/ptc ; then
  600. AC_DEFINE(HAVE_DEV_PTS_AND_PTC,,Use /dev/ptc & /dev/pts)
  601. fi
  602. else
  603. AC_MSG_NOTICE([Not checking for /dev/ptc & /dev/pts since we're cross-compiling])
  604. fi
  605. fi
  606. AC_EXEEXT
  607. # XXX there must be a nicer way to do this
  608. if test $BUNDLED_LIBTOM = 1 ; then
  609. AS_MKDIR_P(libtomcrypt/src/ciphers/aes)
  610. AS_MKDIR_P(libtomcrypt/src/ciphers/safer)
  611. AS_MKDIR_P(libtomcrypt/src/ciphers/twofish)
  612. AS_MKDIR_P(libtomcrypt/src/encauth/ccm)
  613. AS_MKDIR_P(libtomcrypt/src/encauth/eax)
  614. AS_MKDIR_P(libtomcrypt/src/encauth/gcm)
  615. AS_MKDIR_P(libtomcrypt/src/encauth/ocb)
  616. AS_MKDIR_P(libtomcrypt/src/hashes)
  617. AS_MKDIR_P(libtomcrypt/src/hashes/chc)
  618. AS_MKDIR_P(libtomcrypt/src/hashes/helper)
  619. AS_MKDIR_P(libtomcrypt/src/hashes/sha2)
  620. AS_MKDIR_P(libtomcrypt/src/hashes/whirl)
  621. AS_MKDIR_P(libtomcrypt/src/mac/hmac)
  622. AS_MKDIR_P(libtomcrypt/src/mac/omac)
  623. AS_MKDIR_P(libtomcrypt/src/mac/pelican)
  624. AS_MKDIR_P(libtomcrypt/src/mac/pmac)
  625. AS_MKDIR_P(libtomcrypt/src/mac/f9)
  626. AS_MKDIR_P(libtomcrypt/src/mac/xcbc)
  627. AS_MKDIR_P(libtomcrypt/src/math/fp)
  628. AS_MKDIR_P(libtomcrypt/src/misc/base64)
  629. AS_MKDIR_P(libtomcrypt/src/misc/crypt)
  630. AS_MKDIR_P(libtomcrypt/src/misc/mpi)
  631. AS_MKDIR_P(libtomcrypt/src/misc/pkcs5)
  632. AS_MKDIR_P(libtomcrypt/src/modes/cbc)
  633. AS_MKDIR_P(libtomcrypt/src/modes/cfb)
  634. AS_MKDIR_P(libtomcrypt/src/modes/ctr)
  635. AS_MKDIR_P(libtomcrypt/src/modes/ecb)
  636. AS_MKDIR_P(libtomcrypt/src/modes/ofb)
  637. AS_MKDIR_P(libtomcrypt/src/modes/f8)
  638. AS_MKDIR_P(libtomcrypt/src/modes/lrw)
  639. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/bit)
  640. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/boolean)
  641. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/choice)
  642. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/ia5)
  643. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/integer)
  644. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/object_identifier)
  645. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/octet)
  646. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/printable_string)
  647. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/sequence)
  648. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/set)
  649. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/short_integer)
  650. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utctime)
  651. AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utf8)
  652. AS_MKDIR_P(libtomcrypt/src/pk/dh)
  653. AS_MKDIR_P(libtomcrypt/src/pk/dsa)
  654. AS_MKDIR_P(libtomcrypt/src/pk/ecc)
  655. AS_MKDIR_P(libtomcrypt/src/pk/katja)
  656. AS_MKDIR_P(libtomcrypt/src/pk/pkcs1)
  657. AS_MKDIR_P(libtomcrypt/src/pk/rsa)
  658. AS_MKDIR_P(libtomcrypt/src/prngs)
  659. LIBTOM_FILES="libtomcrypt/Makefile libtommath/Makefile"
  660. fi
  661. AC_CONFIG_HEADER(config.h)
  662. AC_CONFIG_FILES(Makefile $LIBTOM_FILES)
  663. AC_OUTPUT
  664. AC_MSG_NOTICE()
  665. if test $BUNDLED_LIBTOM = 1 ; then
  666. AC_MSG_NOTICE([Using bundled libtomcrypt and libtommath])
  667. else
  668. AC_MSG_NOTICE([Using system libtomcrypt and libtommath])
  669. fi
  670. if test "x$ac_cv_func_getpass" != xyes; then
  671. AC_MSG_NOTICE()
  672. AC_MSG_NOTICE([getpass() not available, dbclient will only have public-key authentication])
  673. fi
  674. if test "t$found_crypt_func" != there; then
  675. AC_MSG_NOTICE()
  676. AC_MSG_NOTICE([crypt() not available, dropbear server will not have password authentication])
  677. fi
  678. AC_MSG_NOTICE()
  679. AC_MSG_NOTICE([Now edit options.h to choose features.])