configure.ac 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT()
  3. AC_CONFIG_SRCDIR([byteorder.h])
  4. AC_CONFIG_HEADER(config.h)
  5. AC_PREREQ(2.59)
  6. RSYNC_VERSION=3.0.9
  7. AC_SUBST(RSYNC_VERSION)
  8. AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])
  9. AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$RSYNC_VERSION"], [rsync release version])
  10. LDFLAGS=${LDFLAGS-""}
  11. AC_CANONICAL_HOST
  12. # We must decide this before testing the compiler.
  13. # Please allow this to default to yes, so that your users have more
  14. # chance of getting a useful stack trace if problems occur.
  15. AC_MSG_CHECKING([whether to include debugging symbols])
  16. AC_ARG_ENABLE(debug,
  17. AC_HELP_STRING([--disable-debug],
  18. [disable debugging symbols and features]))
  19. if test x"$enable_debug" = x"no"; then
  20. AC_MSG_RESULT(no)
  21. ac_cv_prog_cc_g=no
  22. else
  23. AC_MSG_RESULT([yes])
  24. dnl AC_DEFINE(DEBUG, 1, [Define to turn on debugging code that may slow normal operation])
  25. # leave ac_cv_prog_cc_g alone; AC_PROG_CC will try to include -g if it can
  26. fi
  27. dnl Checks for programs.
  28. AC_PROG_CC
  29. AC_PROG_CPP
  30. AC_PROG_EGREP
  31. AC_PROG_INSTALL
  32. AC_PROG_CC_STDC
  33. AC_SUBST(SHELL)
  34. AC_DEFINE([_GNU_SOURCE], 1,
  35. [Define _GNU_SOURCE so that we get all necessary prototypes])
  36. if test x"$ac_cv_prog_cc_stdc" = x"no"; then
  37. AC_MSG_WARN([rsync requires an ANSI C compiler and you do not seem to have one])
  38. fi
  39. AC_ARG_ENABLE(profile,
  40. AC_HELP_STRING([--enable-profile],
  41. [turn on CPU profiling]))
  42. if test x"$enable_profile" = x"yes"; then
  43. CFLAGS="$CFLAGS -pg"
  44. fi
  45. # Specifically, this turns on panic_action handling.
  46. AC_ARG_ENABLE(maintainer-mode,
  47. AC_HELP_STRING([--enable-maintainer-mode],
  48. [turn on extra debug features]))
  49. if test x"$enable_maintainer_mode" = x"yes"; then
  50. CFLAGS="$CFLAGS -DMAINTAINER_MODE"
  51. fi
  52. # This is needed for our included version of popt. Kind of silly, but
  53. # I don't want our version too far out of sync.
  54. CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
  55. # If GCC, turn on warnings.
  56. if test x"$GCC" = x"yes"; then
  57. CFLAGS="$CFLAGS -Wall -W"
  58. fi
  59. AC_ARG_WITH(included-popt,
  60. AC_HELP_STRING([--with-included-popt], [use bundled popt library, not from system]))
  61. AC_ARG_WITH(rsync-path,
  62. AC_HELP_STRING([--with-rsync-path=PATH], [set default --rsync-path to PATH (default: rsync)]),
  63. [ RSYNC_PATH="$with_rsync_path" ],
  64. [ RSYNC_PATH="rsync" ])
  65. AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine])
  66. AC_ARG_WITH(rsyncd-conf,
  67. AC_HELP_STRING([--with-rsyncd-conf=PATH], [set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
  68. [ if test ! -z "$with_rsyncd_conf" ; then
  69. case $with_rsyncd_conf in
  70. yes|no)
  71. RSYNCD_SYSCONF="/etc/rsyncd.conf"
  72. ;;
  73. /*)
  74. RSYNCD_SYSCONF="$with_rsyncd_conf"
  75. ;;
  76. *)
  77. AC_MSG_ERROR(You must specify an absolute path to --with-rsyncd-conf=PATH)
  78. ;;
  79. esac
  80. else
  81. RSYNCD_SYSCONF="/etc/rsyncd.conf"
  82. fi ],
  83. [ RSYNCD_SYSCONF="/etc/rsyncd.conf" ])
  84. AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server])
  85. AC_ARG_WITH(rsh,
  86. AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)]))
  87. AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
  88. if test x$HAVE_REMSH = x1; then
  89. AC_DEFINE(HAVE_REMSH, 1, [Define to 1 if remote shell is remsh, not rsh])
  90. fi
  91. if test x"$with_rsh" != x; then
  92. RSYNC_RSH="$with_rsh"
  93. else
  94. RSYNC_RSH="ssh"
  95. fi
  96. AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command])
  97. AC_CHECK_PROG(HAVE_YODL2MAN, yodl2man, 1, 0)
  98. if test x$HAVE_YODL2MAN = x1; then
  99. MAKE_MAN=man
  100. fi
  101. AC_ARG_WITH(nobody-group,
  102. AC_HELP_STRING([--with-nobody-group=GROUP],
  103. [set the default unprivileged group (default nobody or nogroup)]),
  104. [ NOBODY_GROUP="$with_nobody_group" ])
  105. if test x"$with_nobody_group" = x; then
  106. AC_MSG_CHECKING([the group for user "nobody"])
  107. if grep '^nobody:' /etc/group >/dev/null 2>&1; then
  108. NOBODY_GROUP=nobody
  109. elif grep '^nogroup:' /etc/group >/dev/null 2>&1; then
  110. NOBODY_GROUP=nogroup
  111. else
  112. NOBODY_GROUP=nobody # test for others?
  113. fi
  114. AC_MSG_RESULT($NOBODY_GROUP)
  115. fi
  116. AC_DEFINE_UNQUOTED(NOBODY_USER, "nobody", [unprivileged user--e.g. nobody])
  117. AC_DEFINE_UNQUOTED(NOBODY_GROUP, "$NOBODY_GROUP", [unprivileged group for unprivileged user])
  118. # arrgh. libc in some old debian version screwed up the largefile
  119. # stuff, getting byte range locking wrong
  120. AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
  121. AC_TRY_RUN([
  122. #define _FILE_OFFSET_BITS 64
  123. #include <stdio.h>
  124. #include <fcntl.h>
  125. #include <sys/types.h>
  126. #include <sys/wait.h>
  127. int main(void)
  128. {
  129. struct flock lock;
  130. int status;
  131. char tpl[32] = "/tmp/locktest.XXXXXX";
  132. int fd = mkstemp(tpl);
  133. if (fd < 0) {
  134. strcpy(tpl, "conftest.dat");
  135. fd = open(tpl, O_CREAT|O_RDWR, 0600);
  136. }
  137. lock.l_type = F_WRLCK;
  138. lock.l_whence = SEEK_SET;
  139. lock.l_start = 0;
  140. lock.l_len = 1;
  141. lock.l_pid = 0;
  142. fcntl(fd,F_SETLK,&lock);
  143. if (fork() == 0) {
  144. lock.l_start = 1;
  145. _exit(fcntl(fd,F_SETLK,&lock) == 0);
  146. }
  147. wait(&status);
  148. unlink(tpl);
  149. exit(WEXITSTATUS(status));
  150. }
  151. ],
  152. rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)])
  153. if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then
  154. AC_SYS_LARGEFILE
  155. fi
  156. ipv6type=unknown
  157. ipv6lib=none
  158. ipv6trylibc=yes
  159. AC_ARG_ENABLE(ipv6,
  160. AC_HELP_STRING([--disable-ipv6],
  161. [do not even try to use IPv6]))
  162. if test x"$enable_ipv6" != x"no"; then
  163. AC_MSG_CHECKING([ipv6 stack type])
  164. for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta cygwin; do
  165. case $i in
  166. inria)
  167. # http://www.kame.net/
  168. AC_EGREP_CPP(yes, [
  169. #include <netinet/in.h>
  170. #ifdef IPV6_INRIA_VERSION
  171. yes
  172. #endif],
  173. [ipv6type=$i;
  174. AC_DEFINE(INET6, 1, [true if you have IPv6])
  175. ])
  176. ;;
  177. kame)
  178. # http://www.kame.net/
  179. AC_EGREP_CPP(yes, [
  180. #include <netinet/in.h>
  181. #ifdef __KAME__
  182. yes
  183. #endif],
  184. [ipv6type=$i;
  185. AC_DEFINE(INET6, 1, [true if you have IPv6])])
  186. ;;
  187. linux-glibc)
  188. # http://www.v6.linux.or.jp/
  189. AC_EGREP_CPP(yes, [
  190. #include <features.h>
  191. #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
  192. yes
  193. #endif],
  194. [ipv6type=$i;
  195. AC_DEFINE(INET6, 1, [true if you have IPv6])])
  196. ;;
  197. linux-inet6)
  198. # http://www.v6.linux.or.jp/
  199. if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then
  200. ipv6type=$i
  201. ipv6lib=inet6
  202. ipv6libdir=/usr/inet6/lib
  203. ipv6trylibc=yes;
  204. AC_DEFINE(INET6, 1, [true if you have IPv6])
  205. CFLAGS="-I/usr/inet6/include $CFLAGS"
  206. fi
  207. ;;
  208. solaris)
  209. # http://www.sun.com
  210. AC_EGREP_CPP(yes, [
  211. #include <netinet/ip6.h>
  212. #ifdef __sun
  213. yes
  214. #endif],
  215. [ipv6type=$i;
  216. AC_DEFINE(INET6, 1, [true if you have IPv6])])
  217. ;;
  218. toshiba)
  219. AC_EGREP_CPP(yes, [
  220. #include <sys/param.h>
  221. #ifdef _TOSHIBA_INET6
  222. yes
  223. #endif],
  224. [ipv6type=$i;
  225. ipv6lib=inet6;
  226. ipv6libdir=/usr/local/v6/lib;
  227. AC_DEFINE(INET6, 1, [true if you have IPv6])])
  228. ;;
  229. v6d)
  230. AC_EGREP_CPP(yes, [
  231. #include </usr/local/v6/include/sys/v6config.h>
  232. #ifdef __V6D__
  233. yes
  234. #endif],
  235. [ipv6type=$i;
  236. ipv6lib=v6;
  237. ipv6libdir=/usr/local/v6/lib;
  238. AC_DEFINE(INET6, 1, [true if you have IPv6])])
  239. ;;
  240. zeta)
  241. AC_EGREP_CPP(yes, [
  242. #include <sys/param.h>
  243. #ifdef _ZETA_MINAMI_INET6
  244. yes
  245. #endif],
  246. [ipv6type=$i;
  247. ipv6lib=inet6;
  248. ipv6libdir=/usr/local/v6/lib;
  249. AC_DEFINE(INET6, 1, [true if you have IPv6])])
  250. ;;
  251. cygwin)
  252. AC_EGREP_CPP(yes, [
  253. #include <netinet/in.h>
  254. #ifdef _CYGWIN_IN6_H
  255. yes
  256. #endif],
  257. [ipv6type=$i;
  258. AC_DEFINE(INET6, 1, [true if you have IPv6])])
  259. ;;
  260. esac
  261. if test "$ipv6type" != "unknown"; then
  262. break
  263. fi
  264. done
  265. AC_MSG_RESULT($ipv6type)
  266. AC_SEARCH_LIBS(getaddrinfo, inet6)
  267. fi
  268. dnl Do you want to disable use of locale functions
  269. AC_ARG_ENABLE([locale],
  270. AC_HELP_STRING([--disable-locale],
  271. [disable locale features]))
  272. AH_TEMPLATE([CONFIG_LOCALE],
  273. [Undefine if you do not want locale features. By default this is defined.])
  274. if test x"$enable_locale" != x"no"; then
  275. AC_DEFINE(CONFIG_LOCALE)
  276. fi
  277. AC_MSG_CHECKING([whether to call shutdown on all sockets])
  278. case $host_os in
  279. *cygwin* ) AC_MSG_RESULT(yes)
  280. AC_DEFINE(SHUTDOWN_ALL_SOCKETS, 1,
  281. [Define to 1 if sockets need to be shutdown])
  282. ;;
  283. * ) AC_MSG_RESULT(no);;
  284. esac
  285. AC_C_BIGENDIAN
  286. AC_HEADER_DIRENT
  287. AC_HEADER_TIME
  288. AC_HEADER_SYS_WAIT
  289. AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
  290. unistd.h utime.h grp.h compat.h sys/param.h ctype.h sys/wait.h \
  291. sys/ioctl.h sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h \
  292. sys/un.h sys/attr.h mcheck.h arpa/inet.h arpa/nameser.h locale.h \
  293. netdb.h malloc.h float.h limits.h iconv.h libcharset.h langinfo.h \
  294. sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
  295. popt.h popt/popt.h netinet/in_systm.h netinet/ip.h)
  296. AC_HEADER_MAJOR
  297. AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[
  298. AC_TRY_RUN([
  299. #include <sys/types.h>
  300. #ifdef MAJOR_IN_MKDEV
  301. #include <sys/mkdev.h>
  302. # if !defined makedev && (defined mkdev || defined _WIN32 || defined __WIN32__)
  303. # define makedev mkdev
  304. # endif
  305. #elif defined MAJOR_IN_SYSMACROS
  306. #include <sys/sysmacros.h>
  307. #endif
  308. int main(void)
  309. {
  310. dev_t dev = makedev(0, 5, 7);
  311. if (major(dev) != 5 || minor(dev) != 7)
  312. exit(1);
  313. return 0;
  314. }
  315. ],
  316. rsync_cv_MAKEDEV_TAKES_3_ARGS=yes,rsync_cv_MAKEDEV_TAKES_3_ARGS=no,rsync_cv_MAKEDEV_TAKES_3_ARGS=no)])
  317. if test x"$rsync_cv_MAKEDEV_TAKES_3_ARGS" = x"yes"; then
  318. AC_DEFINE(MAKEDEV_TAKES_3_ARGS, 1, [Define to 1 if makedev() takes 3 args])
  319. fi
  320. AC_CHECK_SIZEOF(int)
  321. AC_CHECK_SIZEOF(long)
  322. AC_CHECK_SIZEOF(long long)
  323. AC_CHECK_SIZEOF(short)
  324. AC_CHECK_SIZEOF(int16_t)
  325. AC_CHECK_SIZEOF(uint16_t)
  326. AC_CHECK_SIZEOF(int32_t)
  327. AC_CHECK_SIZEOF(uint32_t)
  328. AC_CHECK_SIZEOF(int64_t)
  329. AC_CHECK_SIZEOF(off_t)
  330. AC_CHECK_SIZEOF(off64_t)
  331. AC_CHECK_SIZEOF(time_t)
  332. AC_C_INLINE
  333. AC_C_LONG_DOUBLE
  334. AC_TYPE_SIGNAL
  335. AC_TYPE_UID_T
  336. AC_CHECK_TYPES([mode_t,off_t,size_t,pid_t,id_t])
  337. AC_TYPE_GETGROUPS
  338. AC_CHECK_MEMBERS([struct stat.st_rdev])
  339. TYPE_SOCKLEN_T
  340. AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [
  341. AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
  342. rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)])
  343. if test x"$rsync_cv_errno" = x"yes"; then
  344. AC_DEFINE(HAVE_ERRNO_DECL, 1, [Define to 1 if errno is declared in errno.h])
  345. fi
  346. # The following test taken from the cvs sources
  347. # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
  348. # These need checks to be before checks for any other functions that
  349. # might be in the same libraries.
  350. # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
  351. # libsocket.so which has a bad implementation of gethostbyname (it
  352. # only looks in /etc/hosts), so we only look for -lsocket if we need
  353. # it.
  354. AC_CHECK_FUNCS(connect)
  355. if test x"$ac_cv_func_connect" = x"no"; then
  356. case "$LIBS" in
  357. *-lnsl*) ;;
  358. *) AC_CHECK_LIB(nsl_s, printf) ;;
  359. esac
  360. case "$LIBS" in
  361. *-lnsl*) ;;
  362. *) AC_CHECK_LIB(nsl, printf) ;;
  363. esac
  364. case "$LIBS" in
  365. *-lsocket*) ;;
  366. *) AC_CHECK_LIB(socket, connect) ;;
  367. esac
  368. case "$LIBS" in
  369. *-linet*) ;;
  370. *) AC_CHECK_LIB(inet, connect) ;;
  371. esac
  372. dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
  373. dnl has been cached.
  374. if test x"$ac_cv_lib_socket_connect" = x"yes" ||
  375. test x"$ac_cv_lib_inet_connect" = x"yes"; then
  376. # ac_cv_func_connect=yes
  377. # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
  378. AC_DEFINE(HAVE_CONNECT, 1, [Define to 1 if you have the "connect" function])
  379. fi
  380. fi
  381. AC_SEARCH_LIBS(inet_ntop, resolv)
  382. # For OS X, Solaris, HP-UX, etc.: figure out if -liconv is needed. We'll
  383. # accept either iconv_open or libiconv_open, since some include files map
  384. # the former to the latter.
  385. AC_SEARCH_LIBS(iconv_open, iconv)
  386. AC_SEARCH_LIBS(libiconv_open, iconv)
  387. AC_MSG_CHECKING([for iconv declaration])
  388. AC_CACHE_VAL(am_cv_proto_iconv, [
  389. AC_TRY_COMPILE([
  390. #include <stdlib.h>
  391. #include <iconv.h>
  392. extern
  393. #ifdef __cplusplus
  394. "C"
  395. #endif
  396. #if defined(__STDC__) || defined(__cplusplus)
  397. size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  398. #else
  399. size_t iconv();
  400. #endif
  401. ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
  402. am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
  403. am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
  404. AC_MSG_RESULT([$]{ac_t:-
  405. }[$]am_cv_proto_iconv)
  406. AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
  407. [Define as const if the declaration of iconv() needs const.])
  408. dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
  409. AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)])
  410. AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)])
  411. AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
  412. AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/types.h>
  413. #include <sys/socket.h>])
  414. # Irix 6.5 has getaddrinfo but not the corresponding defines, so use
  415. # builtin getaddrinfo if one of the defines don't exist
  416. AC_CACHE_CHECK([whether defines needed by getaddrinfo exist],
  417. rsync_cv_HAVE_GETADDR_DEFINES,[
  418. AC_EGREP_CPP(yes, [
  419. #include <sys/types.h>
  420. #include <sys/socket.h>
  421. #include <netdb.h>
  422. #ifdef AI_PASSIVE
  423. yes
  424. #endif],
  425. rsync_cv_HAVE_GETADDR_DEFINES=yes,
  426. rsync_cv_HAVE_GETADDR_DEFINES=no)])
  427. if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then
  428. # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
  429. # something else so we must include <netdb.h> to get the
  430. # redefinition.
  431. AC_CHECK_FUNCS(getaddrinfo, ,
  432. [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
  433. AC_TRY_LINK([#include <sys/types.h>
  434. #include <sys/socket.h>
  435. #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
  436. [AC_MSG_RESULT([yes])
  437. AC_DEFINE(HAVE_GETADDRINFO, 1,
  438. [Define to 1 if you have the "getaddrinfo" function and required types.])],
  439. [AC_MSG_RESULT([no])
  440. AC_LIBOBJ(lib/getaddrinfo)])])
  441. else
  442. AC_LIBOBJ(lib/getaddrinfo)
  443. fi
  444. AC_CHECK_MEMBER([struct sockaddr.sa_len],
  445. [ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ],
  446. [],
  447. [
  448. #include <sys/types.h>
  449. #include <sys/socket.h>
  450. ])
  451. AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
  452. [ AC_DEFINE(HAVE_SOCKADDR_IN_LEN, 1, [Do we have sockaddr_in.sin_len?]) ],
  453. [],
  454. [
  455. #include <sys/types.h>
  456. #include <sys/socket.h>
  457. #include <netinet/in.h>
  458. ])
  459. AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
  460. [ AC_DEFINE(HAVE_SOCKADDR_UN_LEN, 1, [Do we have sockaddr_un.sun_len?]) ],
  461. [],
  462. [
  463. #include <sys/types.h>
  464. #include <sys/socket.h>
  465. #include <netinet/in.h>
  466. ])
  467. AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],
  468. [ AC_DEFINE(HAVE_SOCKADDR_IN6_SCOPE_ID, 1, [Do we have sockaddr_in6.sin6_scope_id?]) ],
  469. [],
  470. [
  471. #include <sys/types.h>
  472. #include <sys/socket.h>
  473. #include <netinet/in.h>
  474. ])
  475. AC_HAVE_TYPE([struct stat64], [#include <stdio.h>
  476. #if HAVE_SYS_TYPES_H
  477. # include <sys/types.h>
  478. #endif
  479. #if HAVE_SYS_STAT_H
  480. # include <sys/stat.h>
  481. #endif
  482. #if STDC_HEADERS
  483. # include <stdlib.h>
  484. # include <stddef.h>
  485. #else
  486. # if HAVE_STDLIB_H
  487. # include <stdlib.h>
  488. # endif
  489. #endif
  490. ])
  491. # if we can't find strcasecmp, look in -lresolv (for Unixware at least)
  492. #
  493. AC_CHECK_FUNCS(strcasecmp)
  494. if test x"$ac_cv_func_strcasecmp" = x"no"; then
  495. AC_CHECK_LIB(resolv, strcasecmp)
  496. fi
  497. AC_CHECK_FUNCS(aclsort)
  498. if test x"$ac_cv_func_aclsort" = x"no"; then
  499. AC_CHECK_LIB(sec, aclsort)
  500. fi
  501. dnl At the moment we don't test for a broken memcmp(), because all we
  502. dnl need to do is test for equality, not comparison, and it seems that
  503. dnl every platform has a memcmp that can do at least that.
  504. dnl AC_FUNC_MEMCMP
  505. AC_FUNC_UTIME_NULL
  506. AC_FUNC_ALLOCA
  507. AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
  508. fchmod fstat ftruncate strchr readlink link utime utimes lutimes strftime \
  509. memmove lchown vsnprintf snprintf vasprintf asprintf setsid strpbrk \
  510. strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
  511. setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
  512. seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
  513. extattr_get_link sigaction sigprocmask setattrlist \
  514. utimensat)
  515. dnl cygwin iconv.h defines iconv_open as libiconv_open
  516. if test x"$ac_cv_func_iconv_open" != x"yes"; then
  517. AC_CHECK_FUNC(libiconv_open, [ac_cv_func_iconv_open=yes; AC_DEFINE(HAVE_ICONV_OPEN, 1)])
  518. fi
  519. AC_CHECK_FUNCS(getpgrp tcgetpgrp)
  520. if test $ac_cv_func_getpgrp = yes; then
  521. AC_FUNC_GETPGRP
  522. fi
  523. AC_ARG_ENABLE(iconv-open,
  524. AC_HELP_STRING([--disable-iconv-open],
  525. [disable all use of iconv_open() function]),
  526. [], [enable_iconv_open=$ac_cv_func_iconv_open])
  527. if test x"$enable_iconv_open" != x"no"; then
  528. AC_DEFINE(USE_ICONV_OPEN, 1, [Define to 1 if you want rsync to make use of iconv_open()])
  529. fi
  530. AC_ARG_ENABLE(iconv,
  531. AC_HELP_STRING([--disable-iconv],
  532. [disable rsync's --iconv option]),
  533. [], [enable_iconv=$enable_iconv_open])
  534. AH_TEMPLATE([ICONV_OPTION],
  535. [Define if you want the --iconv option. Specifing a value will set the
  536. default iconv setting (a NULL means no --iconv processing by default).])
  537. if test x"$enable_iconv" != x"no"; then
  538. if test x"$enable_iconv" = x"yes"; then
  539. AC_DEFINE(ICONV_OPTION, NULL)
  540. else
  541. AC_DEFINE_UNQUOTED(ICONV_OPTION, "$enable_iconv")
  542. fi
  543. AC_DEFINE(UTF8_CHARSET, "UTF-8", [String to pass to iconv() for the UTF-8 charset.])
  544. fi
  545. AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[
  546. AC_TRY_RUN([
  547. #if HAVE_UNISTD_H
  548. # include <unistd.h>
  549. #endif
  550. #include <stdlib.h>
  551. #include <errno.h>
  552. main() {
  553. char const *dangling_symlink = "conftest.dangle";
  554. unlink(dangling_symlink);
  555. if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
  556. if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1);
  557. exit(0);
  558. }],
  559. rsync_cv_chown_modifies_symlink=yes,rsync_cv_chown_modifies_symlink=no,rsync_cv_chown_modifies_symlink=no)])
  560. if test $rsync_cv_chown_modifies_symlink = yes; then
  561. AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.])
  562. fi
  563. AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[
  564. AC_TRY_RUN([
  565. #if HAVE_UNISTD_H
  566. # include <unistd.h>
  567. #endif
  568. #include <stdlib.h>
  569. #include <errno.h>
  570. #define FILENAME "conftest.dangle"
  571. main() {
  572. unlink(FILENAME);
  573. if (symlink("conftest.no-such", FILENAME) < 0) abort();
  574. if (link(FILENAME, FILENAME "2") < 0) exit(1);
  575. exit(0);
  576. }],
  577. rsync_cv_can_hardlink_symlink=yes,rsync_cv_can_hardlink_symlink=no,rsync_cv_can_hardlink_symlink=no)])
  578. if test $rsync_cv_can_hardlink_symlink = yes; then
  579. AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.])
  580. fi
  581. AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[
  582. AC_TRY_RUN([
  583. #if HAVE_UNISTD_H
  584. # include <unistd.h>
  585. #endif
  586. #include <stdlib.h>
  587. #include <errno.h>
  588. #define FILENAME "conftest.fifi"
  589. main() {
  590. unlink(FILENAME);
  591. if (mkfifo(FILENAME, 0777) < 0) abort();
  592. if (link(FILENAME, FILENAME "2") < 0) exit(1);
  593. exit(0);
  594. }],
  595. rsync_cv_can_hardlink_special=yes,rsync_cv_can_hardlink_special=no,rsync_cv_can_hardlink_special=no)])
  596. if test $rsync_cv_can_hardlink_special = yes; then
  597. AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
  598. fi
  599. AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
  600. AC_TRY_RUN([
  601. #include <sys/types.h>
  602. #include <sys/socket.h>
  603. main() {
  604. int fd[2];
  605. #ifdef __CYGWIN__
  606. exit(1);
  607. #else
  608. exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
  609. #endif
  610. }],
  611. rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
  612. if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
  613. AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function])
  614. fi
  615. if test x"$with_included_popt" != x"yes"; then
  616. AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
  617. fi
  618. if test x"$ac_cv_header_popt_popt_h" = x"yes"; then
  619. # If the system has /usr/include/popt/popt.h, we enable the
  620. # included popt because an attempt to "#include <popt/popt.h>"
  621. # would use our included header file anyway (due to -I.), and
  622. # might conflict with the system popt.
  623. with_included_popt=yes
  624. elif test x"$ac_cv_header_popt_h" != x"yes"; then
  625. with_included_popt=yes
  626. fi
  627. AC_MSG_CHECKING([whether to use included libpopt])
  628. if test x"$with_included_popt" = x"yes"; then
  629. AC_MSG_RESULT($srcdir/popt)
  630. BUILD_POPT='$(popt_OBJS)'
  631. CFLAGS="$CFLAGS -I$srcdir/popt"
  632. if test x"$ALLOCA" != x
  633. then
  634. # this can be removed when/if we add an included alloca.c;
  635. # see autoconf documentation on AC_FUNC_ALLOCA
  636. AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)])
  637. fi
  638. else
  639. AC_MSG_RESULT(no)
  640. fi
  641. AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
  642. AC_TRY_COMPILE([],[signed char *s = ""],
  643. rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)])
  644. if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
  645. AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type])
  646. fi
  647. AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
  648. AC_TRY_RUN([#include <sys/types.h>
  649. #include <dirent.h>
  650. main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
  651. if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
  652. di->d_name[0] == 0) exit(0); exit(1);} ],
  653. rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
  654. if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
  655. AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken])
  656. fi
  657. AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[
  658. AC_TRY_COMPILE([#include <sys/types.h>
  659. #include <utime.h>],
  660. [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
  661. rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)])
  662. if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
  663. AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type])
  664. fi
  665. AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
  666. AC_TRY_COMPILE([#include <sys/time.h>
  667. #include <unistd.h>],
  668. [struct timeval tv; exit(gettimeofday(&tv, NULL));],
  669. rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)])
  670. if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
  671. AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg])
  672. fi
  673. AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
  674. AC_TRY_RUN([
  675. #include <sys/types.h>
  676. #include <stdarg.h>
  677. void foo(const char *format, ...) {
  678. va_list ap;
  679. int len;
  680. char buf[5];
  681. va_start(ap, format);
  682. len = vsnprintf(0, 0, format, ap);
  683. va_end(ap);
  684. if (len != 5) exit(1);
  685. if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
  686. exit(0);
  687. }
  688. main() { foo("hello"); }
  689. ],
  690. rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
  691. if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
  692. AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value])
  693. fi
  694. AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
  695. AC_TRY_RUN([#include <stdlib.h>
  696. #include <sys/types.h>
  697. #include <sys/stat.h>
  698. #include <unistd.h>
  699. main() {
  700. struct stat st;
  701. char tpl[20]="/tmp/test.XXXXXX";
  702. int fd = mkstemp(tpl);
  703. if (fd == -1) exit(1);
  704. unlink(tpl);
  705. if (fstat(fd, &st) != 0) exit(1);
  706. if ((st.st_mode & 0777) != 0600) exit(1);
  707. exit(0);
  708. }],
  709. rsync_cv_HAVE_SECURE_MKSTEMP=yes,
  710. rsync_cv_HAVE_SECURE_MKSTEMP=no,
  711. rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
  712. if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
  713. case $host_os in
  714. hpux*)
  715. dnl HP-UX has a broken mkstemp() implementation they refuse to fix,
  716. dnl so we noisily skip using it. See HP change request JAGaf34426
  717. dnl for details. (sbonds)
  718. AC_MSG_WARN(Skipping broken HP-UX mkstemp() -- using mktemp() instead)
  719. ;;
  720. *)
  721. AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [Define to 1 if mkstemp() is available and works right])
  722. ;;
  723. esac
  724. fi
  725. AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
  726. AC_TRY_RUN([
  727. #include <stdio.h>
  728. #include <sys/stat.h>
  729. #include <errno.h>
  730. main() { int rc, ec; char *fn = "fifo-test";
  731. unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
  732. if (rc) {printf("(%d %d) ",rc,ec); return ec;}
  733. return 0;}],
  734. rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)])
  735. if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
  736. AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.])
  737. fi
  738. AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[
  739. AC_TRY_RUN([
  740. #include <stdio.h>
  741. #include <sys/stat.h>
  742. #include <errno.h>
  743. main() { int rc, ec; char *fn = "sock-test";
  744. unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
  745. if (rc) {printf("(%d %d) ",rc,ec); return ec;}
  746. return 0;}],
  747. rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)])
  748. if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
  749. AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.])
  750. fi
  751. #
  752. # The following test was mostly taken from the tcl/tk plus patches
  753. #
  754. AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
  755. rm -rf conftest*
  756. cat > conftest.$ac_ext <<EOF
  757. int main() { return 0; }
  758. EOF
  759. ${CC-cc} -c -o conftest..o conftest.$ac_ext
  760. if test -f conftest..o; then
  761. rsync_cv_DASHC_WORKS_WITH_DASHO=yes
  762. else
  763. rsync_cv_DASHC_WORKS_WITH_DASHO=no
  764. fi
  765. rm -rf conftest*
  766. ])
  767. if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
  768. OBJ_SAVE="#"
  769. OBJ_RESTORE="#"
  770. CC_SHOBJ_FLAG='-o $@'
  771. else
  772. OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
  773. OBJ_RESTORE=' @b=`basename $@ .o`;if test "$$b.o" != "$@"; then mv $$b.o $@; if test -f $$b.o.sav; then mv $$b.o.sav $$b.o; fi; fi'
  774. CC_SHOBJ_FLAG=""
  775. fi
  776. AC_SUBST(OBJ_SAVE)
  777. AC_SUBST(OBJ_RESTORE)
  778. AC_SUBST(CC_SHOBJ_FLAG)
  779. AC_SUBST(BUILD_POPT)
  780. AC_SUBST(MAKE_MAN)
  781. AC_CHECK_FUNCS(_acl __acl _facl __facl)
  782. #################################################
  783. # check for ACL support
  784. AC_MSG_CHECKING([whether to support ACLs])
  785. AC_ARG_ENABLE(acl-support,
  786. AC_HELP_STRING([--disable-acl-support],
  787. [disable ACL support]))
  788. if test x"$enable_acl_support" = x"no"; then
  789. AC_MSG_RESULT(no)
  790. else
  791. case "$host_os" in
  792. *sysv5*)
  793. AC_MSG_RESULT(Using UnixWare ACLs)
  794. AC_DEFINE(HAVE_UNIXWARE_ACLS, 1, [true if you have UnixWare ACLs])
  795. AC_DEFINE(SUPPORT_ACLS, 1, [Define to 1 to add support for ACLs])
  796. ;;
  797. *solaris*|*cygwin*)
  798. AC_MSG_RESULT(Using solaris ACLs)
  799. AC_DEFINE(HAVE_SOLARIS_ACLS, 1, [true if you have solaris ACLs])
  800. AC_DEFINE(SUPPORT_ACLS, 1)
  801. ;;
  802. *hpux*)
  803. AC_MSG_RESULT(Using HPUX ACLs)
  804. AC_DEFINE(HAVE_HPUX_ACLS, 1, [true if you have HPUX ACLs])
  805. AC_DEFINE(SUPPORT_ACLS, 1)
  806. ;;
  807. *irix*)
  808. AC_MSG_RESULT(Using IRIX ACLs)
  809. AC_DEFINE(HAVE_IRIX_ACLS, 1, [true if you have IRIX ACLs])
  810. AC_DEFINE(SUPPORT_ACLS, 1)
  811. ;;
  812. *aix*)
  813. AC_MSG_RESULT(Using AIX ACLs)
  814. AC_DEFINE(HAVE_AIX_ACLS, 1, [true if you have AIX ACLs])
  815. AC_DEFINE(SUPPORT_ACLS, 1)
  816. ;;
  817. *osf*)
  818. AC_MSG_RESULT(Using Tru64 ACLs)
  819. AC_DEFINE(HAVE_TRU64_ACLS, 1, [true if you have Tru64 ACLs])
  820. AC_DEFINE(SUPPORT_ACLS, 1)
  821. LIBS="$LIBS -lpacl"
  822. ;;
  823. darwin*)
  824. AC_MSG_RESULT(Using OS X ACLs)
  825. AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
  826. AC_DEFINE(SUPPORT_ACLS, 1)
  827. ;;
  828. *)
  829. AC_MSG_RESULT(running tests:)
  830. AC_CHECK_LIB(acl,acl_get_file)
  831. AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
  832. AC_TRY_LINK([#include <sys/types.h>
  833. #include <sys/acl.h>],
  834. [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
  835. samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
  836. AC_MSG_CHECKING(ACL test results)
  837. if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
  838. AC_MSG_RESULT(Using posix ACLs)
  839. AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs])
  840. AC_DEFINE(SUPPORT_ACLS, 1)
  841. AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
  842. AC_TRY_LINK([#include <sys/types.h>
  843. #include <sys/acl.h>],
  844. [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
  845. samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
  846. if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
  847. AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np])
  848. fi
  849. else
  850. if test x"$enable_acl_support" = x"yes"; then
  851. AC_MSG_ERROR(Failed to find ACL support)
  852. else
  853. AC_MSG_RESULT(No ACL support found)
  854. fi
  855. fi
  856. ;;
  857. esac
  858. fi
  859. #################################################
  860. # check for extended attribute support
  861. AC_MSG_CHECKING(whether to support extended attributes)
  862. AC_ARG_ENABLE(xattr-support,
  863. AC_HELP_STRING([--disable-xattr-support],
  864. [disable extended attributes]),
  865. [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link" in
  866. *yes*) enable_xattr_support=maybe ;;
  867. *) enable_xattr_support=no ;;
  868. esac])
  869. AH_TEMPLATE([SUPPORT_XATTRS],
  870. [Define to 1 to add support for extended attributes])
  871. if test x"$enable_xattr_support" = x"no"; then
  872. AC_MSG_RESULT(no)
  873. else
  874. case "$host_os" in
  875. *linux*)
  876. AC_MSG_RESULT(Using Linux xattrs)
  877. AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
  878. AC_DEFINE(SUPPORT_XATTRS, 1)
  879. ;;
  880. darwin*)
  881. AC_MSG_RESULT(Using OS X xattrs)
  882. AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
  883. AC_DEFINE(SUPPORT_XATTRS, 1)
  884. AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs])
  885. AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support xattrs])
  886. ;;
  887. freebsd*)
  888. AC_MSG_RESULT(Using FreeBSD extattrs)
  889. AC_DEFINE(HAVE_FREEBSD_XATTRS, 1, [True if you have FreeBSD xattrs])
  890. AC_DEFINE(SUPPORT_XATTRS, 1)
  891. ;;
  892. solaris*)
  893. # Better Solaris support coming in 3.1.0...
  894. AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks do not support xattrs])
  895. ;;
  896. *)
  897. if test x"$enable_xattr_support" = x"yes"; then
  898. AC_MSG_ERROR(Failed to find extended attribute support)
  899. else
  900. AC_MSG_RESULT(No extended attribute support found)
  901. fi
  902. ;;
  903. esac
  904. fi
  905. if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
  906. AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
  907. OLD_CFLAGS="$CFLAGS"
  908. CFLAGS="$CFLAGS -Wno-unused-parameter"
  909. AC_TRY_LINK([#include <stdio.h>], [printf("hello\n");], [rsync_warn_flag=yes], [rsync_warn_flag=no])
  910. AC_MSG_RESULT([$rsync_warn_flag])
  911. if test x"$rsync_warn_flag" = x"no"; then
  912. CFLAGS="$OLD_CFLAGS"
  913. fi
  914. fi
  915. case "$CC" in
  916. ' checker'*|checker*)
  917. AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.])
  918. ;;
  919. esac
  920. AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
  921. AC_OUTPUT
  922. AC_MSG_RESULT()
  923. AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
  924. AC_MSG_RESULT()