configure.ac 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  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.8
  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)
  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. exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
  606. }],
  607. rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
  608. if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
  609. AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function])
  610. fi
  611. if test x"$with_included_popt" != x"yes"; then
  612. AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
  613. fi
  614. if test x"$ac_cv_header_popt_popt_h" = x"yes"; then
  615. # If the system has /usr/include/popt/popt.h, we enable the
  616. # included popt because an attempt to "#include <popt/popt.h>"
  617. # would use our included header file anyway (due to -I.), and
  618. # might conflict with the system popt.
  619. with_included_popt=yes
  620. elif test x"$ac_cv_header_popt_h" != x"yes"; then
  621. with_included_popt=yes
  622. fi
  623. AC_MSG_CHECKING([whether to use included libpopt])
  624. if test x"$with_included_popt" = x"yes"; then
  625. AC_MSG_RESULT($srcdir/popt)
  626. BUILD_POPT='$(popt_OBJS)'
  627. CFLAGS="$CFLAGS -I$srcdir/popt"
  628. if test x"$ALLOCA" != x
  629. then
  630. # this can be removed when/if we add an included alloca.c;
  631. # see autoconf documentation on AC_FUNC_ALLOCA
  632. AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)])
  633. fi
  634. else
  635. AC_MSG_RESULT(no)
  636. fi
  637. AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
  638. AC_TRY_COMPILE([],[signed char *s = ""],
  639. rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)])
  640. if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
  641. AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type])
  642. fi
  643. AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
  644. AC_TRY_RUN([#include <sys/types.h>
  645. #include <dirent.h>
  646. main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
  647. if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
  648. di->d_name[0] == 0) exit(0); exit(1);} ],
  649. rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
  650. if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
  651. AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken])
  652. fi
  653. AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[
  654. AC_TRY_COMPILE([#include <sys/types.h>
  655. #include <utime.h>],
  656. [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
  657. rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)])
  658. if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
  659. AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type])
  660. fi
  661. AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
  662. AC_TRY_COMPILE([#include <sys/time.h>
  663. #include <unistd.h>],
  664. [struct timeval tv; exit(gettimeofday(&tv, NULL));],
  665. rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)])
  666. if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
  667. AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg])
  668. fi
  669. AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
  670. AC_TRY_RUN([
  671. #include <sys/types.h>
  672. #include <stdarg.h>
  673. void foo(const char *format, ...) {
  674. va_list ap;
  675. int len;
  676. char buf[5];
  677. va_start(ap, format);
  678. len = vsnprintf(0, 0, format, ap);
  679. va_end(ap);
  680. if (len != 5) exit(1);
  681. if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
  682. exit(0);
  683. }
  684. main() { foo("hello"); }
  685. ],
  686. rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
  687. if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
  688. AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value])
  689. fi
  690. AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
  691. AC_TRY_RUN([#include <stdlib.h>
  692. #include <sys/types.h>
  693. #include <sys/stat.h>
  694. #include <unistd.h>
  695. main() {
  696. struct stat st;
  697. char tpl[20]="/tmp/test.XXXXXX";
  698. int fd = mkstemp(tpl);
  699. if (fd == -1) exit(1);
  700. unlink(tpl);
  701. if (fstat(fd, &st) != 0) exit(1);
  702. if ((st.st_mode & 0777) != 0600) exit(1);
  703. exit(0);
  704. }],
  705. rsync_cv_HAVE_SECURE_MKSTEMP=yes,
  706. rsync_cv_HAVE_SECURE_MKSTEMP=no,
  707. rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
  708. if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
  709. case $host_os in
  710. hpux*)
  711. dnl HP-UX has a broken mkstemp() implementation they refuse to fix,
  712. dnl so we noisily skip using it. See HP change request JAGaf34426
  713. dnl for details. (sbonds)
  714. AC_MSG_WARN(Skipping broken HP-UX mkstemp() -- using mktemp() instead)
  715. ;;
  716. *)
  717. AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [Define to 1 if mkstemp() is available and works right])
  718. ;;
  719. esac
  720. fi
  721. AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
  722. AC_TRY_RUN([
  723. #include <stdio.h>
  724. #include <sys/stat.h>
  725. #include <errno.h>
  726. main() { int rc, ec; char *fn = "fifo-test";
  727. unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
  728. if (rc) {printf("(%d %d) ",rc,ec); return ec;}
  729. return 0;}],
  730. rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)])
  731. if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
  732. AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.])
  733. fi
  734. AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[
  735. AC_TRY_RUN([
  736. #include <stdio.h>
  737. #include <sys/stat.h>
  738. #include <errno.h>
  739. main() { int rc, ec; char *fn = "sock-test";
  740. unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
  741. if (rc) {printf("(%d %d) ",rc,ec); return ec;}
  742. return 0;}],
  743. rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)])
  744. if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
  745. AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.])
  746. fi
  747. #
  748. # The following test was mostly taken from the tcl/tk plus patches
  749. #
  750. AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
  751. rm -rf conftest*
  752. cat > conftest.$ac_ext <<EOF
  753. int main() { return 0; }
  754. EOF
  755. ${CC-cc} -c -o conftest..o conftest.$ac_ext
  756. if test -f conftest..o; then
  757. rsync_cv_DASHC_WORKS_WITH_DASHO=yes
  758. else
  759. rsync_cv_DASHC_WORKS_WITH_DASHO=no
  760. fi
  761. rm -rf conftest*
  762. ])
  763. if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
  764. OBJ_SAVE="#"
  765. OBJ_RESTORE="#"
  766. CC_SHOBJ_FLAG='-o $@'
  767. else
  768. OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
  769. 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'
  770. CC_SHOBJ_FLAG=""
  771. fi
  772. AC_SUBST(OBJ_SAVE)
  773. AC_SUBST(OBJ_RESTORE)
  774. AC_SUBST(CC_SHOBJ_FLAG)
  775. AC_SUBST(BUILD_POPT)
  776. AC_SUBST(MAKE_MAN)
  777. AC_CHECK_FUNCS(_acl __acl _facl __facl)
  778. #################################################
  779. # check for ACL support
  780. AC_MSG_CHECKING([whether to support ACLs])
  781. AC_ARG_ENABLE(acl-support,
  782. AC_HELP_STRING([--disable-acl-support],
  783. [disable ACL support]))
  784. if test x"$enable_acl_support" = x"no"; then
  785. AC_MSG_RESULT(no)
  786. else
  787. case "$host_os" in
  788. *sysv5*)
  789. AC_MSG_RESULT(Using UnixWare ACLs)
  790. AC_DEFINE(HAVE_UNIXWARE_ACLS, 1, [true if you have UnixWare ACLs])
  791. AC_DEFINE(SUPPORT_ACLS, 1, [Define to 1 to add support for ACLs])
  792. ;;
  793. *solaris*|*cygwin*)
  794. AC_MSG_RESULT(Using solaris ACLs)
  795. AC_DEFINE(HAVE_SOLARIS_ACLS, 1, [true if you have solaris ACLs])
  796. AC_DEFINE(SUPPORT_ACLS, 1)
  797. ;;
  798. *hpux*)
  799. AC_MSG_RESULT(Using HPUX ACLs)
  800. AC_DEFINE(HAVE_HPUX_ACLS, 1, [true if you have HPUX ACLs])
  801. AC_DEFINE(SUPPORT_ACLS, 1)
  802. ;;
  803. *irix*)
  804. AC_MSG_RESULT(Using IRIX ACLs)
  805. AC_DEFINE(HAVE_IRIX_ACLS, 1, [true if you have IRIX ACLs])
  806. AC_DEFINE(SUPPORT_ACLS, 1)
  807. ;;
  808. *aix*)
  809. AC_MSG_RESULT(Using AIX ACLs)
  810. AC_DEFINE(HAVE_AIX_ACLS, 1, [true if you have AIX ACLs])
  811. AC_DEFINE(SUPPORT_ACLS, 1)
  812. ;;
  813. *osf*)
  814. AC_MSG_RESULT(Using Tru64 ACLs)
  815. AC_DEFINE(HAVE_TRU64_ACLS, 1, [true if you have Tru64 ACLs])
  816. AC_DEFINE(SUPPORT_ACLS, 1)
  817. LIBS="$LIBS -lpacl"
  818. ;;
  819. darwin*)
  820. AC_MSG_RESULT(Using OS X ACLs)
  821. AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
  822. AC_DEFINE(SUPPORT_ACLS, 1)
  823. ;;
  824. *)
  825. AC_MSG_RESULT(running tests:)
  826. AC_CHECK_LIB(acl,acl_get_file)
  827. AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
  828. AC_TRY_LINK([#include <sys/types.h>
  829. #include <sys/acl.h>],
  830. [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
  831. samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
  832. AC_MSG_CHECKING(ACL test results)
  833. if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
  834. AC_MSG_RESULT(Using posix ACLs)
  835. AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs])
  836. AC_DEFINE(SUPPORT_ACLS, 1)
  837. AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
  838. AC_TRY_LINK([#include <sys/types.h>
  839. #include <sys/acl.h>],
  840. [ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
  841. samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
  842. if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
  843. AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np])
  844. fi
  845. else
  846. if test x"$enable_acl_support" = x"yes"; then
  847. AC_MSG_ERROR(Failed to find ACL support)
  848. else
  849. AC_MSG_RESULT(No ACL support found)
  850. fi
  851. fi
  852. ;;
  853. esac
  854. fi
  855. #################################################
  856. # check for extended attribute support
  857. AC_MSG_CHECKING(whether to support extended attributes)
  858. AC_ARG_ENABLE(xattr-support,
  859. AC_HELP_STRING([--disable-xattr-support],
  860. [disable extended attributes]),
  861. [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link" in
  862. *yes*) enable_xattr_support=maybe ;;
  863. *) enable_xattr_support=no ;;
  864. esac])
  865. AH_TEMPLATE([SUPPORT_XATTRS],
  866. [Define to 1 to add support for extended attributes])
  867. if test x"$enable_xattr_support" = x"no"; then
  868. AC_MSG_RESULT(no)
  869. else
  870. case "$host_os" in
  871. *linux*)
  872. AC_MSG_RESULT(Using Linux xattrs)
  873. AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
  874. AC_DEFINE(SUPPORT_XATTRS, 1)
  875. AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks do not support xattrs])
  876. ;;
  877. darwin*)
  878. AC_MSG_RESULT(Using OS X xattrs)
  879. AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
  880. AC_DEFINE(SUPPORT_XATTRS, 1)
  881. AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs])
  882. AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support xattrs])
  883. ;;
  884. freebsd*)
  885. AC_MSG_RESULT(Using FreeBSD extattrs)
  886. AC_DEFINE(HAVE_FREEBSD_XATTRS, 1, [True if you have FreeBSD xattrs])
  887. AC_DEFINE(SUPPORT_XATTRS, 1)
  888. ;;
  889. *)
  890. if test x"$enable_xattr_support" = x"yes"; then
  891. AC_MSG_ERROR(Failed to find extended attribute support)
  892. else
  893. AC_MSG_RESULT(No extended attribute support found)
  894. fi
  895. ;;
  896. esac
  897. fi
  898. if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
  899. AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
  900. OLD_CFLAGS="$CFLAGS"
  901. CFLAGS="$CFLAGS -Wno-unused-parameter"
  902. AC_TRY_LINK([#include <stdio.h>], [printf("hello\n");], [rsync_warn_flag=yes], [rsync_warn_flag=no])
  903. AC_MSG_RESULT([$rsync_warn_flag])
  904. if test x"$rsync_warn_flag" = x"no"; then
  905. CFLAGS="$OLD_CFLAGS"
  906. fi
  907. fi
  908. case "$CC" in
  909. ' checker'*|checker*)
  910. AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.])
  911. ;;
  912. esac
  913. AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
  914. AC_OUTPUT
  915. AC_MSG_RESULT()
  916. AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
  917. AC_MSG_RESULT()