]> git.saurik.com Git - apt.git/blob - configure.in
Minimal CD swaps
[apt.git] / configure.in
1 ad
2 dnl Process this file with autoconf to produce a configure script.
3 dnl The ONLY thing this is used for is to configure for different
4 dnl linux architectures and configurations, it is not used to make the
5 dnl code more portable
6
7 dnl You MUST have an environment that has all the POSIX functions and
8 dnl some of the more populare bsd/sysv ones (like select). You'll also
9 dnl need a C++ compiler that is semi-standard conformant, exceptions are
10 dnl not used but STL is.
11
12 dnl 'make -f Makefile startup' will generate the configure file from
13 dnl configure.in correctly and can be run at any time
14
15 AC_INIT(configure.in)
16 AC_CONFIG_AUX_DIR(buildlib)
17 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in)
18
19 dnl -- SET THIS TO THE RELEASE VERSION --
20 AC_DEFINE_UNQUOTED(VERSION,"0.3.16")
21 AC_DEFINE_UNQUOTED(PACKAGE,"apt")
22
23 dnl Check our C compiler
24 AC_CHECK_TOOL_PREFIX
25 AC_PROG_CC
26 AC_ISC_POSIX
27
28 dnl Check the host arch (build+target not needed... yet)
29 AC_CANONICAL_HOST
30 AC_CHECK_TOOL_PREFIX dnl recheck, in case the initial guess was wrong
31
32 dnl Check for other programs
33 AC_PROG_CXX
34 AC_PROG_CPP
35 AC_PROG_RANLIB
36 AC_CHECK_TOOL(AR,ar,"ar")
37
38 dnl Checks for sockets
39 SAVE_LIBS="$LIBS"
40 LIBS=""
41 AC_SEARCH_LIBS(gethostbyname,nsl)
42 AC_SEARCH_LIBS(connect,socket)
43 SOCKETLIBS="$LIBS"
44 AC_SUBST(SOCKETLIBS)
45 LIBS="$SAVE_LIBS"
46
47 dnl Section Disabled pending removal of deity widget library -- jgg
48 if test "yes" != "yes"; then
49 dnl Checks for X11
50 AC_PATH_X
51 AC_PATH_XTRA
52 AC_SUBST(X11LIB)
53 X11LIB=
54 if test "$no_x" != "yes"; then
55 X11LIB="-lX11"
56 AC_DEFINE(HAVE_X11)
57 dnl Checks for ZPM
58 AC_CHECK_LIB(Xpm, XpmLibraryVersion,[AC_DEFINE(HAVE_LIBXPM) XPMLIB="-lXpm"],,$X_LIBS $X_PRE_LIBS $X11LIB $X_EXTRA_LIBS)
59 AC_SUBST(XPMLIB)
60 if test "$XPMLIB" != "-lXpm"; then
61 AC_MSG_ERROR(failed: I need xpm if you are building for X)
62 fi
63 fi
64
65 dnl Checks for Slang
66 AC_CHECK_LIB(slang, SLang_Version,[AC_DEFINE(HAVE_LIBSLANG) SLANGLIB="-lslang"])
67 AC_SUBST(SLANGLIB)
68
69 dnl Checks for GPM
70 AC_ARG_WITH(gpm,[ --without-gpm do not use GPM mouse support])
71 if test "$with_gpm" != "no"; then
72 AC_CHECK_LIB(gpm, Gpm_Open,[AC_DEFINE(HAVE_LIBGPM) GPMLIB="-lgpm"])
73 AC_SUBST(GPMLIB)
74 fi
75 fi
76
77 dnl Checks for pthread
78 #AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"])
79 AC_SUBST(PTHREADLIB)
80 #if test "$PTHREADLIB" != "-lpthread"; then
81 # AC_MSG_ERROR(failed: I need posix threads, pthread)
82 #fi
83
84 dnl Converts the ARCH to be the same as dpkg
85 AC_MSG_CHECKING(system architecture)
86 archset="`awk \"{ if(\\\$1 == \\\"$host_cpu\\\") print \\\$2 }\" $srcdir/buildlib/archtable`"
87 if test "x$archset" = "x"; then
88 AC_MSG_ERROR(failed: use --host=)
89 fi
90 AC_MSG_RESULT($archset)
91 AC_DEFINE_UNQUOTED(ARCHITECTURE,"$archset")
92
93 dnl We use C9x types if at all possible
94 AC_CACHE_CHECK([for C9x integer types],c9x_ints,[
95 AC_TRY_COMPILE([#include <inttypes.h>],
96 [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
97 c9x_ints=yes,c9x_ints=no)])
98
99 dnl Single Unix Spec statvfs
100 AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
101 AC_SUBST(HAVE_STATVFS)
102
103 dnl Arg, linux and bsd put their statfs function in different places
104 if test x"$HAVE_STATVFS" != x"yes"; then
105 AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
106 AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
107 ])
108 fi
109
110 dnl Check the sizes etc. of the architecture
111 dnl This is stupid, it should just use the AC macros like it does below
112 dnl Cross compilers can either get a real C library or preload the cache
113 dnl with their size values.
114 changequote(,)
115 archline="`grep \"^$archset\" $srcdir/buildlib/sizetable | cut -f 2- -d ' '`"
116 if test "x$archline" != "x"; then
117 changequote([,])
118 set $archline
119 if test "$1" = "little"; then
120 ac_cv_c_bigendian=no
121 else
122 ac_cv_c_bigendian=yes
123 fi
124 size_char=$2
125 size_int=$3
126 size_short=$4
127 size_long=$5
128 fi
129
130 dnl I wonder what AC_C_BIGENDIAN does if you cross compile...
131 if test "$cross_compiling" = "yes" -a "x$archline" = "x"; then
132 AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
133 fi
134 AC_C_BIGENDIAN
135
136 dnl We do not need this if we have inttypes!
137 HAVE_C9X=yes
138 if test x"$c9x_ints" = x"no"; then
139 AC_CHECK_SIZEOF(char,$size_char)
140 AC_CHECK_SIZEOF(int,$size_int)
141 AC_CHECK_SIZEOF(short,$size_short)
142 AC_CHECK_SIZEOF(long,$size_long)
143
144 HAVE_C9X=
145 AC_SUBST(HAVE_C9X)
146 fi
147
148 dnl HP-UX sux..
149 AC_MSG_CHECKING(for missing socklen_t)
150 AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[
151 AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
152 NEED_SOCKLEN_T_DEFINE=yes
153 AC_MSG_RESULT(missing.)])
154 AC_SUBST(NEED_SOCKLEN_T_DEFINE)
155
156 dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
157 AC_MSG_CHECKING(for h_errno)
158 AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
159 [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
160 AC_EGREP_HEADER(h_errno, netdb.h,
161 [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
162 [AC_MSG_ERROR("not found.")])
163 ])
164
165 dnl Check for debiandoc
166 AC_CHECK_PROG(DEBIANDOC_HTML,debiandoc2html,"yes","")
167 AC_CHECK_PROG(DEBIANDOC_TEXT,debiandoc2text,"yes","")
168
169 dnl Check for YODL
170 AC_CHECK_PROG(YODL_MAN,yodl2man,"yes","")
171
172 ah_NUM_PROCS
173
174 AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in,make dirs)