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)
222 AC_CHECK_HEADERS(machine/types.h string.h)
223 AC_CHECK_HEADERS(glob.h,,MISCOBJS="$MISCOBJS glob.o")
224 AC_CHECK_HEADERS(fnmatch.h,,MISCOBJS="$MISCOBJS fnmatch.o")
226 if test "$PO" = po; then
227 AC_CHECK_HEADERS(libintl.h)
232 dnl look for libc features
234 AC_MSG_CHECKING(if <netdb.h> defines h_errno...)
235 AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
236 AC_MSG_RESULT($PROVIDES_ERRNO)
237 if test $PROVIDES_ERRNO = yes; then
238 AC_DEFINE(HAVE_HERRNO)
241 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
242 dnl make S_ISSOCK always return false (nice, eh?)
243 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK...)
244 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
245 HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
246 AC_MSG_RESULT($HAS_S_IFSOCK)
247 if test $HAS_S_IFSOCK = yes; then
248 AC_DEFINE(HAVE_S_IFSOCK)
251 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
252 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK...)
253 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
254 HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
255 AC_MSG_RESULT($HAS_S_ISLNK)
256 if test $HAS_S_ISLNK = yes; then
257 AC_DEFINE(HAVE_S_ISLNK)
260 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK...)
261 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
262 HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
263 AC_MSG_RESULT($HAS_S_ISSOCK)
264 if test $HAS_S_ISSOCK = yes; then
265 AC_DEFINE(HAVE_S_ISSOCK)
268 dnl Checks for library functions.
269 AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), MISCOBJS="$MISCOBJS inet_aton.o")
270 AC_CHECK_FUNC(realpath, AC_DEFINE(HAVE_REALPATH), MISCOBJS="$MISCOBJS realpath.o")
271 AC_CHECK_FUNC(strerror, [], MISCOBJS="$MISCOBJS strerror.o")
272 AC_CHECK_FUNC(strtol, [], MISCOBJS="$MISCOBJS strtol.o")
273 AC_CHECK_FUNC(strtoul, [], MISCOBJS="$MISCOBJS strtoul.o")
275 if test -n "$MISCOBJS"; then
279 if test "x$varprefix" = "x"; then
280 varprefix=`echo $prefix | sed 's/usr/var/'`
281 test "x$prefix" = xNONE && varprefix=`echo $ac_default_prefix | sed 's/usr/var/'`
284 if test "x$tmpdir" = "x"; then
285 if test -d $varprefix/tmp; then
286 tmpdir=$varprefix/tmp
288 if test -d /var/tmp; then
296 if echo "$build" | egrep 'solaris|hpux10|sco' >/dev/null ; then
297 # Solaris needs -ldl to use -lnsl, and it can't build static
298 # binaries if you use -ldl
300 if echo "$build" | grep solaris >/dev/null; then
301 echo "hacking things up for solaris"
303 elif echo "$build" | grep sco > /dev/null; then
304 echo "hacking things up for sco"
305 AC_DEFINE(NEED_STRINGS_H)
307 echo "hacking things up for hpux"
313 rm -f ./find-provides.sh
314 if test -f autodeps/${build_os}.prov ; then
315 echo "using autodeps/$build_os.prov for automatic provides generation"
316 ln -s autodeps/${build_os}.prov ./find-provides.sh
318 echo "*** no default provides information is available for $build_os"
319 ln -s autodeps/none ./find-provides.sh
322 rm -f ./find-requires.sh
323 if test -f autodeps/${build_os}.req ; then
324 echo "using autodeps/$build_os.req for automatic requires generation"
325 ln -s autodeps/$build_os.req ./find-requires.sh
327 echo "*** no default requires information is available for $build_os"
328 ln -s autodeps/none ./find-requires.sh
344 AC_SUBST(GETTEXTSTUB)
350 AC_OUTPUT(Makefile Makefile.inc lib-rpmrc lib/Makefile build/Makefile tools/Makefile po/Makefile misc/Makefile)