Skip to content

Commit

Permalink
Merge pull request ceph#823 from ceph/port/detect-libresolv
Browse files Browse the repository at this point in the history
autoconf: check for res_nquery explicitly
Sage Weil committed Nov 9, 2013
2 parents b2acac0 + 1cc8558 commit 3596b4c
Showing 2 changed files with 35 additions and 2 deletions.
35 changes: 34 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -120,8 +120,41 @@ AX_C_PRETTY_FUNC
# Checks for libraries.
ACX_PTHREAD
AC_CHECK_LIB([uuid], [uuid_parse], [true], AC_MSG_FAILURE([libuuid not found]))

#
# Check for res_nquery in libresolv. There are several variations. On OSX
# res_nquery is a macro defined in resolv.h, so the typical AC_CHECK_LIB
# doesn't work. On FreeBSD res_nquery can be found in libc. The required
# library for linking (if any) is defined RESOLV_LIBS.
#
AC_CHECK_HEADER([resolv.h], [], [], [#include <netinet/in.h>])

AC_DEFUN([CHECK_RESOLV_LIBS], [{
AC_MSG_CHECKING([if res_nquery will link (LIBS=$1)])
saved_LIBS="${LIBS}"
LIBS="$1"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netinet/in.h>
#include <resolv.h>
]], [[res_nquery(0, 0, 0, 0, 0, 0);]])],
[AC_MSG_RESULT([yes])
[$2]],
AC_MSG_RESULT([no]))
LIBS="${saved_LIBS}"
}])

RESOLV_LIBS=""
CHECK_RESOLV_LIBS([$RESOLV_LIBS], [resolv_libs="ok"])
if test x"$resolv_libs" != "xok"; then
RESOLV_LIBS="-lresolv"
CHECK_RESOLV_LIBS([$RESOLV_LIBS], [resolv_libs="ok"])
if test x"$resolv_libs" != "xok"; then
AC_MSG_FAILURE([no resolv library found])
fi
fi
AC_SUBST([RESOLV_LIBS])

AC_CHECK_LIB([m], [pow], [true], AC_MSG_FAILURE([libm not found]))
AC_CHECK_LIB([resolv], [__res_nquery], [true], AC_MSG_FAILURE([libresolv not found]))
if test x"$linux" = x"yes"; then
AC_CHECK_LIB([keyutils], [add_key], [true], AC_MSG_FAILURE([libkeyutils not found]))
fi
2 changes: 1 addition & 1 deletion src/rgw/Makefile.am
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ radosgw_SOURCES = \
rgw/rgw_swift.cc \
rgw/rgw_swift_auth.cc \
rgw/rgw_main.cc
radosgw_LDADD = $(LIBRGW) $(LIBRGW_DEPS) -lresolv $(CEPH_GLOBAL)
radosgw_LDADD = $(LIBRGW) $(LIBRGW_DEPS) $(RESOLV_LIBS) $(CEPH_GLOBAL)
bin_PROGRAMS += radosgw

radosgw_admin_SOURCES = rgw/rgw_admin.cc

0 comments on commit 3596b4c

Please sign in to comment.