-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
273 lines (235 loc) · 8.87 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([apt],[0.5.15lorg3.95],[apt-rpm@lists.laiskiainen.org])
dnl Check the archs, we want the target type.
AC_CONFIG_AUX_DIR([buildlib])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_CONFIG_SRCDIR([AUTHORS.RPM])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-bzip2 1.9.5])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_HEADER([include/config.h:buildlib/config.h.in])
AC_CONFIG_HEADER([include/apt-pkg/aptconf.h:apt-pkg/aptconf.h.in])
dnl Check our C compiler
AC_PROG_CC
AM_PROG_CC_C_O
AC_ISC_POSIX
dnl Check for other programs
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_LIBTOOL
dnl Checks for sockets
SAVE_LIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS(gethostbyname,nsl)
AC_SEARCH_LIBS(connect,socket)
SOCKETLIBS="$LIBS"
AC_SUBST(SOCKETLIBS)
LIBS="$SAVE_LIBS"
dnl Checks for pthread -- disabled due to glibc bugs jgg
dnl AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"])
AC_SUBST(PTHREADLIB)
dnl if test "$PTHREADLIB" != "-lpthread"; then
dnl AC_MSG_ERROR(failed: I need posix threads, pthread)
dnl fi
dnl Apt acquirer methods need bz2 and libz
AC_CHECK_LIB(bz2,BZ2_bzopen, [],
[AC_MSG_ERROR([Can't find libbz2 library])])
AC_CHECK_LIB(z,gzopen, [],
[AC_MSG_ERROR([Can't find libz library])])
dnl See if we have pkgconfig for rpm
PKG_CHECK_MODULES([RPM], [rpm], [
RPM_VERSION_RAW=`pkg-config --modversion rpm`
AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
CPPFLAGS="$RPM_CFLAGS $CPPFLAGS"
LDFLAGS="$RPM_LIBS $LDFLAGS"
]
)
AC_MSG_CHECKING(for RPM version)
RPM_VERSION_MAJOR=`echo $RPM_VERSION_RAW | cut -d. -f1`
RPM_VERSION_MINOR=`echo $RPM_VERSION_RAW | cut -d. -f2`
RPM_VERSION_MICRO=`echo $RPM_VERSION_RAW | cut -d. -f3`
if test -z "$RPM_VERSION_MAJOR" -o -z "$RPM_VERSION_MINOR"; then
AC_MSG_ERROR([can't parse RPM version])
fi
if test -z "$RPM_VERSION_MICRO"; then
RPM_VERSION_MICRO=0
fi
AC_DEFINE_UNQUOTED([RPM_VERSION_MAJOR],$RPM_VERSION_MAJOR,[RPM major version])
AC_DEFINE_UNQUOTED([RPM_VERSION_MINOR],$RPM_VERSION_MINOR,[RPM minor version])
AC_DEFINE_UNQUOTED([RPM_VERSION_MICRO],$RPM_VERSION_MICRO,[RPM micro version])
AC_DEFINE_UNQUOTED([RPM_VERSION],
[((RPM_VERSION_MAJOR<<16)|(RPM_VERSION_MINOR<<8)|RPM_VERSION_MICRO)],
[Define to the RPM version])
AC_DEFINE_UNQUOTED([RPM_VERSION_RAW],"$RPM_VERSION_RAW",[RPM raw version])
AC_MSG_RESULT($RPM_VERSION_RAW)
dnl Various rpm header checks..
AC_CHECK_HEADERS([rpm/rpmcallback.h rpm/rpmtypes.h rpm/rpmtd.h], [],
[AC_MSG_ERROR([Required rpm headers missing (rpm too old?)])])
AC_MSG_CHECKING(for rpmTagVal)
AC_EGREP_HEADER(rpmTagVal, rpm/rpmtag.h,
[AC_MSG_RESULT(yes) AC_DEFINE(RPM_HAVE_RPMTAGVAL, 1, [rpmTagVal]) ],
[AC_MSG_RESULT(no) ])
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([tr1/unordered_map tr1/unordered_set])
AC_LANG_POP([C++])
dnl sqlite3
SAVE_LIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS([sqlite3_open], [sqlite3], [], [have_sqlite3="no"])
if test "x$have_sqlite3" != "xno"; then
AC_DEFINE([WITH_SQLITE3], [1], [yes])
SQLITE3LIBS="$LIBS"
fi
LIBS="$SAVE_LIBS"
AM_CONDITIONAL([WITH_SQLITE3], [test ! "x$have_sqlite3" = "no"])
AC_SUBST(SQLITE3LIBS)
dnl CNC:2003-03-20
AC_MSG_CHECKING(for --disable-scripts)
AC_ARG_ENABLE([scripts],
AS_HELP_STRING([--disable-scripts],[disable the lua script extension system]),
[enable_scripts="$enableval"],[enable_scripts="yes"])
if test "$enable_scripts" != "no"; then
AC_MSG_RESULT(no)
AC_DEFINE(APT_WITH_LUA, 1,
[Define if you want to enable the extension system])
else
AC_MSG_RESULT(yes)
fi
# XXX We should optimally support both internal and system lua, with our
# local extensions always built if lua enabled.
AM_CONDITIONAL(WITH_LUA, test "$enable_scripts" != "no")
AM_CONDITIONAL(WITH_LUAEXT, test "$enable_scripts" != "no")
dnl Repomd support
AC_MSG_CHECKING(for --disable-repomd)
AC_ARG_ENABLE([repomd],
AS_HELP_STRING([--disable-repomd],
[disable repomd support]),
[enable_repomd="$enableval"],[enable_repomd="yes"])
if test "$enable_repomd" != "no"; then
AC_MSG_RESULT(no)
AC_DEFINE(APT_WITH_REPOMD, 1, [Define if you want to enable repomd support])
## xmlReadFile is not available before 2.6.0
PKG_CHECK_MODULES([LIBXML2],[libxml-2.0 >= 2.6])
RPM_LIBS="$LIBXML2_LIBS $RPM_LIBS"
CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
## FIXME: Conditionalize this properly. We can support xml repomd without
## sqlite and repodb with libxml2 older than 2.6. In addition, rollback
## will be using sqlite as well, we only want to check for it once.
RPM_LIBS="$RPM_LIBS $SQLITE3LIBS"
else
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(WITH_REPOMD, test "$enable_repomd" != "no")
dnl Before configuring libtool check for --enable-static-progs option
AC_MSG_CHECKING(for --enable-static-progs)
AC_ARG_ENABLE(static-progs,
AS_HELP_STRING([--enable-static-progs],
[build completely static (standalone) binaries]),
[enable_static_progs="$enableval"],[enable_static_progs="no"])
AM_CONDITIONAL(COMPILE_STATIC, test "$enable_static_progs" = "yes")
if test "$enable_static_progs" = "yes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Check for apt-shell dependencies
AC_CHECK_LIB(ncurses,tputs,
[AC_CHECK_HEADER(readline/readline.h,
[AC_CHECK_LIB(readline,rl_completion_matches,
[compile_aptshell=yes],,[-lncurses])])])
AM_CONDITIONAL(COMPILE_APTSHELL, test "$compile_aptshell" = "yes")
dnl Converts the ARCH to be something singular for this general CPU family
dnl This is often the dpkg architecture string.
AH_TEMPLATE(COMMON_CPU, [Define the common CPU])
AH_TEMPLATE(COMMON_OS, [Define the common OS])
AC_MSG_CHECKING(system architecture)
archset="`awk \" ! /^#|^\\\$/ { if(match(\\\"$host_cpu\\\",\\\"^\\\"\\\$1\\\"\\\$\\\")) {print \\\$2; exit}}\" $srcdir/buildlib/archtable`"
if test "x$archset" = "x"; then
AC_MSG_ERROR(failed: use --host=)
fi
AC_MSG_RESULT($archset)
AC_DEFINE_UNQUOTED(COMMON_CPU,"$archset")
dnl Get a common name for the host OS - this is primarily only for HURD and is
dnl non fatal if it fails
AC_MSG_CHECKING(system OS)
osset="`awk \" ! /^#|^\\\$/ {if (match(\\\"$host_vendor-$host_os\\\",\\\$1)) {print \\\$2; exit}}\" $srcdir/buildlib/ostable`"
AC_MSG_RESULT($osset)
AC_DEFINE_UNQUOTED(COMMON_OS,"$osset")
dnl We use C99 types if at all possible
AC_CACHE_CHECK([for C99 integer types],apt_cv_c9x_ints,[
AC_TRY_COMPILE([#include <inttypes.h>],
[uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
apt_cv_c9x_ints=yes,apt_cv_c9x_ints=no)])
AC_C_BIGENDIAN
dnl Check the sizes etc. of the architecture
dnl Cross compilers can either get a real C library or preload the cache
dnl with their size values.
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
dnl Single Unix Spec statvfs
AC_CHECK_FUNC(statvfs,[have_statvfs=yes])
dnl Arg, linux and bsd put their statfs function in different places
AH_TEMPLATE(HAVE_SYS_VFS_H, [Define to 1 if sys/vfs.h is available])
AH_TEMPLATE(HAVE_SYS_MOUNT_H, [Define to 1 if sys/mount.h is available])
if test "$have_statvfs" != "yes"; then
AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_SYS_VFS_H)],[
AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_SYS_MOUNT_H)],
[AC_MSG_ERROR(failed: Need statvfs)])
])
fi
dnl We should use the real timegm function if we have it.
AH_TEMPLATE(HAVE_TIMEGM, [Define to 1 if timegm is available])
AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
AC_SUBST(HAVE_TIMEGM)
dnl HP-UX sux..
AH_TEMPLATE(NEED_SOCKLEN_T_DEFINE, [Define to 1 if socket_t is missing])
AC_MSG_CHECKING(for missing socklen_t)
AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[
AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
NEED_SOCKLEN_T_DEFINE=yes
AC_MSG_RESULT(missing.)])
AC_SUBST(NEED_SOCKLEN_T_DEFINE)
dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
AC_MSG_CHECKING(for h_errno)
AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
[CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
AC_EGREP_HEADER(h_errno, netdb.h,
[AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
[AC_MSG_ERROR("not found.")])
])
dnl Check for debiandoc
dnl AC_PATH_PROG(DEBIANDOC_HTML,debiandoc2html)
dnl AC_PATH_PROG(DEBIANDOC_TEXT,debiandoc2text)
AC_PATH_PROG([GPG],[gpg],[/usr/bin/gpg])
AM_GNU_GETTEXT_VERSION([0.14.5])
AM_GNU_GETTEXT([external])
dnl ah_NUM_PROCS
dnl rc_GLIBC_VER
dnl rc_LIBSTDCPP_VER
dnl ah_GCC3DEP
AC_CONFIG_FILES([
Makefile
luaext/Makefile
apt-pkg/Makefile
apt-pkg/libapt-pkg.pc
methods/Makefile
cmdline/Makefile
tools/Makefile
doc/Makefile
test/Makefile
po/Makefile.in
])
AC_CONFIG_LINKS([include/apti18n.h:buildlib/gettext.h])
AS_IF([test "$apt_cv_c9x_ints" = "no"],[
AC_CONFIG_LINKS([include/inttypes.h:buildlib/inttypes.h])
])
AS_IF([test "$have_statvfs" != "yes"],[
AC_CONFIG_LINKS([include/statvfs.h:buildlib/statvfs.h])
])
AS_IF([test "$NEED_SOCKLEN_T_DEFINE" = "yes"],[
AC_CONFIG_LINKS([include/netdb.h:buildlib/netdb.h])
])
AC_OUTPUT