1 dnl configure.in for RPM
3 dnl Don't add checks for things we can't work around, unless those checks
4 dnl failing causes the script to bomb out with a message. If we can't fix
8 AC_CONFIG_HEADER(config.h)
10 dnl default to not using NLS
14 GETTEXTSTUB="gettextstub.o"
18 dnl Checks for programs.
21 AC_PROG_GCC_TRADITIONAL
24 AC_MSG_CHECKING(checking for POSIX chmod...)
26 chmod 744 foo.chmodtest
27 chmod +X foo.chmodtest 2>/dev/null
28 a=`ls -l foo.chmodtest | awk '{print $1}'`
30 if test "$a" = "-rwxr-xr-x"; then
34 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
47 AC_CHECK_TOOL(AR, ar, :)
49 if test "$cross_compiling" != "yes"; then
50 AC_MSG_CHECKING(checking for GNU cpio...)
51 if test -z "$CPIOBIN"; then
54 for n in $PATH:/opt/gnu/bin; do
55 if test -f $n/cpio; then
56 $n/cpio --quiet -o < /dev/null >/dev/null 2>/dev/null
57 if test "$?" = "0"; then
65 if test -z "$CPIOBIN"; then
67 AC_MSG_WARN(RPM will not work without GNU cpio 2.4.2 or later.)
73 AC_MSG_CHECKING(checking for GNU gzip...)
74 if test -z "$GZIPBIN"; then
77 for n in $PATH:/opt/gnu/bin; do
78 if test -f $n/gzip; then
85 if test -z "$GZIPBIN"; then
88 AC_MSG_WARN(RPM will not work without GNU gzip.)
96 if test $prefix != "/usr" -a $prefix != "/usr/local"; then
97 echo $ac_n "checking for $prefix/lib... $ac_c"
98 if test -d $prefix/lib ; then
99 LIBS="$LIBS -L$prefix/lib"
106 echo $ac_n "checking for $prefix/include... $ac_c"
107 if test -d $prefix/include ; then
108 INCPATH="$INCPATH -I$prefix/include"
116 AC_MSG_CHECKING(checking for /usr/local/lib...)
117 if test -d /usr/local/lib ; then
118 LIBS="$LIBS -L/usr/local/lib"
125 AC_MSG_CHECKING(checking for /usr/local/include...)
126 if test -d /usr/local/include ; then
127 INCPATH="$INCPATH -I/usr/local/include"
133 AC_MSG_CHECKING(checking for /usr/ucblib...)
134 if test -d /usr/ucblib ; then
135 LIBS="$LIBS -L/usr/ucblib"
142 dnl Checks for libraries.
144 AC_CHECK_FUNC(strcasecmp, [], [
145 AC_CHECK_LIB(ucb, strcasecmp, [LIBS="-lucb $LIBS"])
149 dnl handle --disable-nls
152 [ --disable-nls do not use National Language Support],
153 USE_NLS=$enableval, USE_NLS=yes)
155 if test "$USE_NLS" != "no"; then
156 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"],
157 AC_CHECK_LIB(intl, gettext, [LIBINTL="-lintl" HAVEGETTEXT="y"],
158 AC_MSG_WARN([sorry this package needs libintl.a (from the
163 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
165 if test "$XGETTEXT" != ""; then
166 if xgettext --help 2>&1 | grep illegal >/dev/null ; then
167 echo "xgettext isn't GNU version"
172 if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
173 echo "xgettext and gettext() exist; will build i18n support"
177 echo "xgettext and libintl.a don't both exist; will not build i18n support"
180 echo "user specificed no gettext; will not build i18n support"
183 AC_CHECK_FUNC(getdomainname, [], [
184 AC_CHECK_LIB(nsl, getdomainname, [LIBS="-lnsl $LIBS"])
186 AC_CHECK_FUNC(socket, [], [
187 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"])
190 AC_CHECK_FUNC(dbopen, [],
191 AC_CHECK_LIB(db, dbopen, [], AC_MSG_WARN([sorry this package needs libdb.a
192 (from the db package)]))
195 AC_CHECK_FUNC(fork, [], [echo "using vfork() instead of fork()";
196 MISCOBJS=fakefork.o])
198 dnl AmigaOS and IXEmul have a fork() dummy
201 echo "Building for AmigaOS: using vfork() instead of fork()";
202 CFLAGS="$CFLAGS -Dfork=vfork"
208 for zlib in z gz ; do
209 AC_CHECK_LIB(${zlib}, gzread,
210 [LIBS="-l${zlib} $LIBS"; break],
211 [if test ${zlib} = gz; then
212 AC_MSG_WARN([sorry this package needs libz.a or libgz.a (from the zlib package)])
217 dnl Checks for header files we can live without.
220 AC_CHECK_HEADERS(netinet/in_systm.h limits.h)
221 AC_CHECK_HEADERS(alloca.h dirent.h sys/socket.h sys/select.h)
222 AC_CHECK_HEADERS(machine/types.h string.h)
223 AC_CHECK_HEADERS(mntent.h sys/mnttab.h)
224 AC_CHECK_HEADERS(glob.h,,MISCOBJS="$MISCOBJS glob.o")
225 AC_CHECK_HEADERS(fnmatch.h,,MISCOBJS="$MISCOBJS fnmatch.o")
227 if test "$PO" = po; then
228 AC_CHECK_HEADERS(libintl.h)
233 dnl look for libc features
235 AC_MSG_CHECKING(if <netdb.h> defines h_errno...)
236 AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
237 AC_MSG_RESULT($PROVIDES_ERRNO)
238 if test $PROVIDES_ERRNO = yes; then
239 AC_DEFINE(HAVE_HERRNO)
242 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
243 dnl make S_ISSOCK always return false (nice, eh?)
244 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK...)
245 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
246 HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
247 AC_MSG_RESULT($HAS_S_IFSOCK)
248 if test $HAS_S_IFSOCK = yes; then
249 AC_DEFINE(HAVE_S_IFSOCK)
252 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
253 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK...)
254 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
255 HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
256 AC_MSG_RESULT($HAS_S_ISLNK)
257 if test $HAS_S_ISLNK = yes; then
258 AC_DEFINE(HAVE_S_ISLNK)
261 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK...)
262 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
263 HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
264 AC_MSG_RESULT($HAS_S_ISSOCK)
265 if test $HAS_S_ISSOCK = yes; then
266 AC_DEFINE(HAVE_S_ISSOCK)
269 AC_MSG_CHECKING(if timezone is defined...)
270 AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
271 HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
272 AC_MSG_RESULT($HAS_TIMEZONE)
273 if test $HAS_TIMEZONE = no; then
274 AC_DEFINE(NEED_TIMEZONE)
277 dnl Checks for library functions.
278 AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), MISCOBJS="$MISCOBJS inet_aton.o")
279 AC_CHECK_FUNC(realpath, AC_DEFINE(HAVE_REALPATH), MISCOBJS="$MISCOBJS realpath.o")
280 AC_CHECK_FUNC(strerror, [], MISCOBJS="$MISCOBJS strerror.o")
281 AC_CHECK_FUNC(strtol, [], MISCOBJS="$MISCOBJS strtol.o")
282 AC_CHECK_FUNC(strtoul, [], MISCOBJS="$MISCOBJS strtoul.o")
284 AC_CHECK_FUNC(lchown, [LCHOWN=yes; AC_DEFINE(HAVE_LCHOWN)])
286 if test "$LCHOWN" = no; then
287 dnl Does chown() follow symlinks? This should be a good enough test.
288 AC_MSG_CHECKING(whether chown() follows symlinks...)
289 AC_ARG_ENABLE([broken-chown],
290 [ --enable-broken-chown this system's chown follows symbolic links],
291 result=yes, result=unknown)
292 if echo "$build" | grep "aix" > /dev/null ; then
295 if test $result = unknown; then
296 if test `id | cut -f 2 -d \= | cut -f 1 -d \(` = 0; then
301 if test `ls -l foo | awk '{print $3}'` != "root"; then
308 AC_MSG_CHECKING((cannot check by non-root user))
313 AC_MSG_RESULT($result)
314 if test $result = yes; then
315 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK)
319 if test -n "$MISCOBJS"; then
323 if test "x$varprefix" = "x"; then
324 varprefix=`echo $prefix | sed 's/usr/var/'`
325 test "x$prefix" = xNONE && varprefix=`echo $ac_default_prefix | sed 's/usr/var/'`
328 if test "x$tmpdir" = "x"; then
329 if test -d $varprefix/tmp; then
330 tmpdir=$varprefix/tmp
332 if test -d /var/tmp; then
340 # Solaris 2.5.1 seems to confuse things
341 if echo "$build" | grep "solaris2.5" > /dev/null ; then
342 echo "Hacking things up for Solaris 2.5.x"
347 # Solaris needs -ldl to use -lnsl, and it can't build static
348 # binaries if you use -ldl
349 if echo "$build_os" | grep solaris >/dev/null; then
350 echo "hacking things up for solaris"
353 elif echo "$build_os" | grep sco > /dev/null; then
354 echo "hacking things up for sco"
356 AC_DEFINE(NEED_STRINGS_H)
357 elif echo "$build_os" | grep sunos > /dev/null; then
358 echo "hacking things up for sunos"
359 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
360 AC_DEFINE(NEED_STRINGS_H)
361 AC_DEFINE(NEED_MYREALLOC)
362 MISCOBJS="$MISCOBJS myrealloc.o"
363 elif echo "$build_os" | grep hpux > /dev/null; then
365 echo "hacking things up for hpux"
368 rm -f ./find-provides.sh
369 if test -f autodeps/${build_os}.prov ; then
370 echo "using autodeps/$build_os.prov for automatic provides generation"
371 ln -s autodeps/${build_os}.prov ./find-provides.sh
373 echo "*** no default provides information is available for $build_os"
374 ln -s autodeps/none ./find-provides.sh
377 rm -f ./find-requires.sh
378 if test -f autodeps/${build_os}.req ; then
379 echo "using autodeps/$build_os.req for automatic requires generation"
380 ln -s autodeps/$build_os.req ./find-requires.sh
382 echo "*** no default requires information is available for $build_os"
383 ln -s autodeps/none ./find-requires.sh
399 AC_SUBST(GETTEXTSTUB)
405 AC_OUTPUT(Makefile Makefile.inc lib-rpmrc lib/Makefile build/Makefile tools/Makefile po/Makefile misc/Makefile)