summaryrefslogtreecommitdiff
path: root/librsync/configure.in
blob: 04943af7ac3739dd41e294d97d9c4355e872d028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# -*- shell-script -*-
dnl Process this file with autoconf to produce a configure script. 
AC_REVISION(Id: configure.in,v 1.77 2001/09/14 01:41:33 mbp Exp )

# Copyright (C) 1999, 2000, 2001 by Martin Pool <mbp@samba.org>

                    # Linux is the gateway drug for freedom.
                    #                -- Don Marti

AC_INIT(trace.c)

my_version=0.9.5
my_package=librsync
my_url=http://rproxy.samba.org/
echo "Configuring $my_package $my_version   ($my_url)"
AM_INIT_AUTOMAKE($my_package, $my_version)

# ac2.50 complains about this next line being redundant.  I'm not
# sure: perhaps it's still required for earlier versions?
AC_CANONICAL_HOST

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_ISC_POSIX
AC_PROG_INSTALL

AM_CONFIG_HEADER(config.h)

AM_DISABLE_SHARED
AM_PROG_LIBTOOL

# Set up to get as many features as we can manage
AC_DEFINE(_GNU_SOURCE)

AC_TYPE_SIZE_T
AC_TYPE_OFF_T

AC_C_CONST

AC_SYS_LARGEFILE

# See if the compiler has the nice GNU feature of 
# putting argv[0] into a global
AC_MSG_CHECKING([for program_invocation_short_name])
AC_TRY_COMPILE([#include <errno.h>], 
    [strlen(program_invocation_short_name)],
    [ AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME)
      AC_MSG_RESULT(yes) ],
    [ AC_MSG_RESULT(no) ])

# supply a snprintf if the system doesn't have one
AC_REPLACE_FUNCS(snprintf)
AC_CHECK_FUNCS(vsnprintf)
AC_CHECK_FUNCS(strerror mtrace)
AC_CHECK_FUNC(setreuid, [], [
    AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
])

AC_ARG_WITH(included-popt,
        [  --with-included-popt    use bundled popt library, not from system])

dnl Checks for declarations
AC_MSG_CHECKING(for sockaddr.sin_len)
AC_EGREP_HEADER(sin_len, sys/socket.h, 
	[ AC_DEFINE(HAVE_SOCK_SIN_LEN)
          AC_MSG_RESULT(yes) ],
        [ AC_MSG_RESULT(no) ])

AC_MSG_CHECKING(for intmax_t in stdint.h)
AC_EGREP_HEADER(intmax_t, stdint.h,
        [ AC_MSG_RESULT(yes) ],
        [ AC_DEFINE(intmax_t, long)
          AC_MSG_RESULT(no) ])

dnl Checks for libraries

AC_CHECK_LIB(z, deflate)
AC_CHECK_LIB(bz2, BZ2_bzCompress)

if test x"$with_included_popt" != x"yes"
then
    AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
fi

AC_MSG_CHECKING([whether to use included libpopt])
if test x"$with_included_popt" = x"yes"
then
    AC_MSG_RESULT("$srcdir/popt")
    BUILD_POPT='popt/libpopt.a'
    CFLAGS="$CFLAGS -I$srcdir/popt"
else
    AC_MSG_RESULT(no)
fi

dnl Check configuration options
if test "$GCC" = "yes" 
then 
    # I'm fussy.
    CFLAGS="-Wall -Wshadow -Wundef -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align $CFLAGS"
fi
# TODO: Similar conditions for other known compilers.  For SUNWspro, use `-v'.

AC_ARG_ENABLE(ccmalloc,
	[  --enable-ccmalloc       use ccmalloc debugger (default no)],
	[ LIBS="$LIBS -lccmalloc -ldl" ])

AC_ARG_ENABLE(trace,
        [  --disable-trace         turn off library tracing])
AC_MSG_CHECKING([whether to include trace code])
if test "$enable_trace" = "yes" -o -z "$enable_trace"
then
    AC_MSG_RESULT(yes)
    AC_DEFINE(DO_RS_TRACE)
elif test "$enable_trace" = "no"
then
    AC_MSG_RESULT(no)
else
    AC_MSG_RESULT(failed)
    AC_MSG_ERROR([--enable-trace must be set to yes or no])
fi

AC_CHECK_SIZEOF([unsigned char], 1)
if test "$ac_cv_sizeof_unsigned_char" -ne 1
then
    AC_MSG_WARN(unsigned char seems to be $ac_cv_sizeof_unsigned_char bytes.  Expect trouble.)
fi

AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF([unsigned short], 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF([unsigned int], 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF([unsigned long], 4)
AC_CHECK_SIZEOF([long long], 0)
AC_CHECK_SIZEOF(off_t, 4)
AC_CHECK_SIZEOF(size_t, 4)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(config.h unistd.h alloca.h libintl.h mcheck.h)
AC_CHECK_HEADERS(zlib.h bzlib.h stdint.h)

# GNU library versioning: This is NOT the librsync release number.
# Rather, it is a CURRENT:REVISION:AGE tuple describing binary
# compatibility to libtool.  It is only updated on major public
# releases where there is the possibility of binaries hanging around.

librsync_libversion=2:0:0
AC_DEFINE_UNQUOTED(RS_LIBVERSION, "$librsync_libversion")

AC_DEFINE_UNQUOTED(RS_CANONICAL_HOST, "$host")

AC_SUBST(librsync_libversion)
AC_SUBST(OBJ_SAVE)
AC_SUBST(OBJ_RESTORE)
AC_SUBST(CC_SHOBJ_FLAG)
AC_SUBST(CCMALLOC_LIB)
AC_SUBST(net_libs)
AC_SUBST(LIBOBJS)
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(BUILD_POPT)

AC_OUTPUT([Makefile popt/Makefile])