forked from librsync/librsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
146 lines (128 loc) · 4.66 KB
/
configure.ac
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.53)
AC_INIT([librsync],[1.0.1])
AC_COPYRIGHT([Copyright (C) 1999-2015 by Martin Pool <[email protected]>])
AC_CONFIG_SRCDIR([trace.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
# GNU library versioning: This is NOT the librsync release number.
# See libversions.txt and the libtool manual for an explanation of the
# library versioning
librsync_libversion=2:0:0
# Disable shared libs by default.
AC_DISABLE_SHARED
# Checks for programs.
AC_GNU_SOURCE
AC_PROG_CC
AC_ISC_POSIX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
# Checks for libraries.
AC_CHECK_LIB(z, deflate)
AC_CHECK_LIB(bz2, BZ2_bzCompress)
AC_CHECK_LIB(popt, poptGetContext,,[BUILD_POPT='popt/libpopt.a'; CFLAGS="$CFLAGS -I$srcdir/popt"])
# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_STDC
AC_CHECK_HEADERS([mcheck.h bzlib.h zlib.h])
AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h limits.h malloc.h stdint.h stdlib.h string.h sys/file.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
AC_SYS_LARGEFILE
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)
AC_CHECK_SIZEOF([unsigned short])
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF([unsigned long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(size_t)
#XXX: is this really the best way to do it? I think the limitation on
# rs_long_t is that we need to be able to seek to it, which relates to
# long file support. With fseeko, rs_long_t should be off_t, otherwise
# it should be long.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/types.h>
#ifndef LONG_LONG
#error not defined
#endif]],
[;])],
[ RS_LONG_T='LONG_LONG' ],
[ case "$ac_cv_sizeof_long_long" in
0) RS_LONG_T='long' ;;
*) RS_LONG_T='long long' ;;
esac ])
AC_SUBST(RS_LONG_T)
# Checks for library functions.
#AC_FUNC_MALLOC #XXX: needs malloc.c replacement
#AC_FUNC_MEMCMP #XXX: needs memcmp.c replacement
#AC_FUNC_REALLOC #XXX: needs realloc.c replacement
AC_FUNC_FSEEKO
AC_CHECK_FUNCS([memmove memset strchr strerror strtol])
AC_CHECK_FUNCS([gettext dgettext])
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])
])
# supply a snprintf and vsnprintf if the system doesn't have one.
# if missing, check MSVC _xxx varients, otherwise use snprintf.c
# replacement.
AC_CHECK_FUNCS(snprintf,,[AC_CHECK_FUNCS(_snprintf)])
AC_CHECK_FUNCS(vsnprintf,,[AC_CHECK_FUNCS(_vsnprintf,,[AC_LIBOBJ(snprintf)])])
# Test if the compiler has the GNU feature of putting argv[0] into a global
AC_MSG_CHECKING([for program_invocation_short_name])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <errno.h>]],
[[strlen(program_invocation_short_name)]])],
[ AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME,,
[GNU extension of saving argv[0] to program_invocation_short_name])
AC_MSG_RESULT(yes) ],
[ AC_MSG_RESULT(no) ])
# Test if the preprocessor understands vararg macros
AC_MSG_CHECKING([for vararg macro support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[#define func(a, b...) do {} while (0)],
[func("a", "b", "c");func("a")])],
[ AC_DEFINE(HAVE_VARARG_MACROS, , [Define if your cpp has vararg macros])
AC_MSG_RESULT(yes) ],
[ AC_MSG_RESULT(no) ])
if test "$GCC" = "yes"; then # GCC
CFLAGS="-Wall -Wshadow -Wundef -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align $CFLAGS"
elif test "$CC" = "cl"; then # MSVC
CFLAGS="-Z7 -Od -MD $CFLAGS"
fi
# TODO: Similar conditions for other known compilers. For SUNWspro, use `-v'.
AC_ARG_ENABLE(ccmalloc,
AC_HELP_STRING([--enable-ccmalloc],[use ccmalloc debugger (default no)]),
[ LIBS="$LIBS -lccmalloc -ldl" ])
AC_ARG_ENABLE(trace,
AC_HELP_STRING([--disable-trace],[turn off library tracing]),
[enable_trace=$enableval],[enable_trace=yes])
if test "$enable_trace" = "yes"; then
AC_DEFINE(DO_RS_TRACE,,[Define this to enable trace code])
fi
AC_DEFINE_UNQUOTED(RS_LIBVERSION, "$librsync_libversion",[Version of the libtool interface.])
AC_DEFINE_UNQUOTED(RS_CANONICAL_HOST, "$host",[Canonical GNU hostname])
AC_SUBST(librsync_libversion)
AC_SUBST(BUILD_POPT)
AC_CONFIG_FILES([
Makefile
doc/Makefile
doc/Doxyfile
popt/Makefile
testsuite/Makefile
librsync-config.h])
AC_OUTPUT