[PATCH] fix hesiod check error, use correct $(LIBS)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Lan Yixun (dlan)" <dennis.yxun@xxxxxxxxx>

the problem here is that hesiod checking always fail due to wrong $(LDFLAGS),
no matter hesiod library is installed or not. moving "-lhesiod" into
$(LIBS) solve this problem.

1) convert "char *" -> "void *" to fix the compile warning
2) put "-lhesiod -lresolv" into $(LIBS), not into $(LDFLAGS), otherwise we got link error

---
tst_hesiod.c: In function ‘main’:
tst_hesiod.c:38:3: warning: passing argument 1 of ‘hesiod_init’ from incompatible pointer type
[enabled by default]
   char *c; hesiod_init(&c);
   ^
In file included from tst_hesiod.c:34:0:
/usr/include/hesiod.h:36:5: note: expected ‘void **’ but argument is of type ‘char **’
 int hesiod_init(void **context);



$ x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe -march=core2  -I/usr/include
 -Wl,-O1 -Wl,--as-needed -g -lhesiod -lresolv tst_hesiod.c -L/usr/lib64
 -lkrb5 -lhx509 -lcom_err -lhcrypto -lasn1 -lwind -lheimbase -lroken
-lcrypt -ldl -lresolv

/tmp/ccN6GW0r.o: In function `main':
/root/tst_hesiod.c:38: undefined reference to `hesiod_init'
collect2: error: ld returned 1 exit status

Signed-off-by: Lan Yixun (dlan) <dennis.yxun@xxxxxxxxx>
---
 aclocal.m4 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 7a8b03c..637a775 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -316,20 +316,20 @@ dnl --------------------------------------------------------------------------
 AC_DEFUN([AF_CHECK_LIBHESIOD],
 [AC_MSG_CHECKING(for libhesiod)
 
-# save current ldflags
-af_check_hesiod_save_ldflags="$LDFLAGS"
-LDFLAGS="$LDFLAGS -lhesiod -lresolv"
+# save current libs
+af_check_hesiod_save_libs="$LIBS"
+LIBS="$LIBS -lhesiod -lresolv"
 
 AC_TRY_LINK(
   [ #include <hesiod.h> ],
-  [ char *c; hesiod_init(&c); ],
+  [ void *c; hesiod_init(&c); ],
   [ HAVE_HESIOD=1
     LIBHESIOD="$LIBHESIOD -lhesiod -lresolv"
     AC_MSG_RESULT(yes) ],
   [ AC_MSG_RESULT(no) ])
 
-# restore ldflags
-LDFLAGS="$af_check_hesiod_save_ldflags"
+# restore libs
+LIBS="$af_check_hesiod_save_libs"
 ])
 
 dnl --------------------------------------------------------------------------
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux