-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
278 lines (238 loc) · 8.44 KB
/
configure.in
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
274
275
276
277
278
ad
dnl Process this file with autoconf to produce a configure script.
dnl The ONLY thing this is used for is to configure for different
dnl linux architectures and configurations, it is not used to make the
dnl code more portable
dnl You MUST have an environment that has all the POSIX functions and
dnl some of the more populare bsd/sysv ones (like select). You'll also
dnl need a C++ compiler that is semi-standard conformant, exceptions are
dnl not used but STL is.
dnl 'make -f Makefile startup' will generate the configure file from
dnl configure.in correctly and can be run at any time
AC_PREREQ(2.50)
AC_INIT(configure.in)
AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
dnl -- SET THIS TO THE RELEASE VERSION --
AC_DEFINE_UNQUOTED(VERSION,"0.7.20.2")
PACKAGE="apt"
AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
AC_SUBST(PACKAGE)
dnl Check the archs, we want the target type.
AC_CANONICAL_SYSTEM
dnl Check our C compiler
AC_CHECK_TOOL_PREFIX
AC_PROG_CC
AC_ISC_POSIX
dnl Check for other programs
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_RANLIB
AC_CHECK_TOOL(AR,ar,"ar")
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 Check for BDB
saveLIBS="$LIBS"
LIBS="$LIBS -ldb"
AC_CHECK_HEADER(db.h,
[AC_MSG_CHECKING(if we can link against BerkeleyDB)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <db.h>],
[int r, s, t; db_version(&r, &s, &t);]
)],
[AC_DEFINE(HAVE_BDB)
BDBLIB="-ldb"
AC_MSG_RESULT(yes)],
[BDBLIB=""
AC_MSG_RESULT(no)]
)]
)
LIBS="$saveLIBS"
AC_CHECK_LIB(curl, curl_easy_init,
[AC_CHECK_HEADER(curl/curl.h,
curl_ok=yes,
curl_ok=no)],
AC_MSG_ERROR([failed: I need CURL due https support]),
)
AC_SUBST(BDBLIB)
dnl Converts the ARCH to be something singular for this general CPU family
dnl This is often the dpkg architecture string.
dnl First check against the full canonical canoncial-system-type in $target
dnl and if that fails, just look for the cpu
AC_MSG_CHECKING(debian architecture)
archset="`dpkg-architecture -qDEB_HOST_ARCH -t$host`"
if test "x$archset" = "x"; then
AC_MSG_ERROR([failed: use --host= or output from dpkg-architecture])
fi
AC_MSG_RESULT($archset)
AC_DEFINE_UNQUOTED(COMMON_ARCH,"$archset")
dnl We use C99 types if at all possible
AC_CACHE_CHECK([for C99 integer types],c9x_ints,[
AC_TRY_COMPILE([#include <inttypes.h>],
[uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
c9x_ints=yes,c9x_ints=no)])
dnl Single Unix Spec statvfs
AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
AC_SUBST(HAVE_STATVFS)
dnl Arg, linux and bsd put their statfs function in different places
if test x"$HAVE_STATVFS" != x"yes"; then
AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
])
fi
dnl We should use the real timegm function if we have it.
AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
AC_SUBST(HAVE_TIMEGM)
dnl Check the sizes etc. of the architecture
dnl This is stupid, it should just use the AC macros like it does below
dnl Cross compilers can either get a real C library or preload the cache
dnl with their size values.
changequote(,)
archline="`awk \" ! /^#|^\\\$/ {if (match(\\\"$archset\\\",\\\$1)) {print; exit}}\" $srcdir/buildlib/sizetable | cut -f 2- -d ' '`"
if test "x$archline" != "x"; then
changequote([,])
set $archline
if test "$1" = "little"; then
ac_cv_c_bigendian=no
else
ac_cv_c_bigendian=yes
fi
size_char=$2
size_int=$3
size_short=$4
size_long=$5
fi
dnl I wonder what AC_C_BIGENDIAN does if you cross compile...
dnl This is probably bogus, as above we only care if we have to build our own
dnl C9x types.
if test "$cross_compiling" = "yes" -a "x$archline" = "x"; then
AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
fi
AC_C_BIGENDIAN
dnl We do not need this if we have inttypes!
HAVE_C9X=yes
if test x"$c9x_ints" = x"no"; then
AC_CHECK_SIZEOF(char,$size_char)
AC_CHECK_SIZEOF(int,$size_int)
AC_CHECK_SIZEOF(short,$size_short)
AC_CHECK_SIZEOF(long,$size_long)
HAVE_C9X=
AC_SUBST(HAVE_C9X)
fi
dnl HP-UX sux..
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.")])
])
AC_MSG_CHECKING(for openpty)
AC_EGREP_HEADER(openpty, pty.h, [
AC_MSG_RESULT(found in pty.h)
AC_DEFINE_UNQUOTED([HAVE_OPENPTY_PTY_H],[1],[Define if we have openpty() in pty.h])
],[
AC_EGREP_HEADER(openpty, util.h, [
AC_MSG_RESULT(found in util.h)
AC_DEFINE_UNQUOTED([HAVE_OPENPTY_UTIL_H],[1],[Define if we have openpty() in util.h])
],[
AC_MSG_ERROR([no header containing openpty() could be found])
])
])
AC_CHECK_FUNC([memrchr])
AC_MSG_CHECKING([for sighandler_t])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <signal.h>
],[
sighandler_t handler_test;
],[AC_MSG_RESULT([found])
AC_DEFINE_UNQUOTED([HAVE_SIGHANDLER_T],[1],[Define if we have sighandler_t])],
[AC_MSG_RESULT([not found])])
AC_CHECK_HEADERS([sys/statfs.h sys/statvfs.h sys/param.h sys/mount.h])
dnl Check for debiandoc
AC_PATH_PROG(DEBIANDOC_HTML,debiandoc2html)
AC_PATH_PROG(DEBIANDOC_TEXT,debiandoc2text)
dnl Check for doxygen
AC_PATH_PROG(DOXYGEN, doxygen)
dnl Check for the SGML tools needed to build man pages
AC_PATH_PROG(DOCBOOK2MAN,docbook2man)
dnl Check for the XML tools needed to build man pages
AC_PATH_PROG(XMLTO,xmlto)
dnl Check for graphviz
AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO])
AC_PATH_PROG([DOT], [dot], [])
DOTDIR=$(dirname $DOT)
AC_SUBST(DOTDIR)
dnl Check for YODL
dnl AC_CHECK_PROG(YODL_MAN,yodl2man,"yes","")
ah_NUM_PROCS
rc_GLIBC_VER
rc_LIBSTDCPP_VER
ah_GCC3DEP
dnl It used to be that the user could select translations and that could get
dnl passed to the makefiles, but now that can only work if you use special
dnl gettext approved makefiles, so this feature is unsupported by this.
ALL_LINGUAS="bg bs ca cs cy da de dz el en_GB es eu fi fr gl hu it ja ko ku nb nl nn pl pt_BR pt ro ru sk sl sv th tl uk vi zn_CN zh_TW"
AM_GNU_GETTEXT(external)
if test x"$USE_NLS" = "xyes"; then
AC_DEFINE(USE_NLS)
fi
AC_SUBST(USE_NLS)
AC_PATH_PROG(BASH, bash)
dnl apt-get requires -liconv whether or not --enable-nls is given; if NLS
dnl is disabled, gettext doesn't bother looking for libiconv, and linking
dnl fails. Try to get it one way or another.
AC_CHECK_FUNC([iconv_open],,[
AC_CHECK_LIB([iconv],[iconv_open],[INTLLIBS="-liconv $INTLLIBS"])
])
AC_SUBST([INTLLIBS])
if test x"$prefix" = x"NONE" ; then
prefix="$ac_default_prefix"
fi
if test x"$exec_prefix" = x"NONE" ; then
exec_prefix="$prefix"
fi
BINDIR=`eval echo $bindir | sed 's!^/!!'`
LIBDIR=`eval echo $libdir | sed 's!^/!!'`
LOCALSTATEDIR=`eval echo $localstatedir | sed 's!^/!!'`
SYSCONFDIR=`eval echo $sysconfdir | sed 's!^/!!'`
AC_DEFINE_UNQUOTED([BINDIR],["$BINDIR"],[Path to the configured 'bin' directory, without leading slash])
AC_SUBST([BINDIR])
AC_DEFINE_UNQUOTED([LIBDIR],["$LIBDIR"],[Path to the configured 'lib' directory, without leading slash])
AC_SUBST([LIBDIR])
AC_DEFINE_UNQUOTED([LOCALSTATEDIR],["$LOCALSTATEDIR"],[Path to the configured 'var' directory, without leading slash])
AC_SUBST([LOCALSTATEDIR])
AC_DEFINE_UNQUOTED([SYSCONFDIR],["$SYSCONFDIR"],[Path to the configured 'etc' directory, without leading slash])
AC_SUBST([SYSCONFDIR])
AC_OUTPUT([
environment.mak:buildlib/environment.mak.in
GNUmakefile:buildlib/makefile.in
doc/Doxyfile
scripts/dselect/install:dselect/install.in
scripts/dselect/setup:dselect/setup.in
scripts/dselect/update:dselect/update.in],
[chmod +x scripts/dselect/install
chmod +x scripts/dselect/setup
chmod +x scripts/dselect/update
make -s dirs])