Annotation of embedaddon/rsync/configure.ac, revision 1.1.1.2

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>