From b3e2aa19f3ef3d6cef6521f3dc15b303285afb1c Mon Sep 17 00:00:00 2001 From: Neel Goyal Date: Fri, 9 Aug 2013 17:04:25 -0400 Subject: [PATCH] Add Werror to cflags. Remove getdns lib check. Fail configure on dependencies not found. --- configure | 55 ++++++++----------------------------- configure.ac | 12 ++++++-- src/common/Makefile.am | 2 +- src/common/Makefile.in | 2 +- src/common/getdns_context.c | 2 +- src/common/getdns_convert.c | 1 + src/common/getdns_dict.c | 1 + src/example/Makefile.am | 2 +- src/example/Makefile.in | 2 +- 9 files changed, 27 insertions(+), 52 deletions(-) diff --git a/configure b/configure index c34a8270..cdccf4dc 100755 --- a/configure +++ b/configure @@ -12058,6 +12058,9 @@ fi # Checks for libraries. +found_all_libs=1 +{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking for dependencies ldns and libevent" >&5 +$as_echo "$as_me: Checking for dependencies ldns and libevent" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for event_base_new in -levent_core" >&5 $as_echo_n "checking for event_base_new in -levent_core... " >&6; } if ${ac_cv_lib_event_core_event_base_new+:} false; then : @@ -12101,51 +12104,8 @@ _ACEOF LIBS="-levent_core $LIBS" -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getdns_context_create in -lgetdns" >&5 -$as_echo_n "checking for getdns_context_create in -lgetdns... " >&6; } -if ${ac_cv_lib_getdns_getdns_context_create+:} false; then : - $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgetdns $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char getdns_context_create (); -int -main () -{ -return getdns_context_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_getdns_getdns_context_create=yes -else - ac_cv_lib_getdns_getdns_context_create=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_getdns_getdns_context_create" >&5 -$as_echo "$ac_cv_lib_getdns_getdns_context_create" >&6; } -if test "x$ac_cv_lib_getdns_getdns_context_create" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBGETDNS 1 -_ACEOF - - LIBS="-lgetdns $LIBS" - + found_all_libs=0 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_dname_new_frm_str in -lldns" >&5 @@ -12191,9 +12151,16 @@ _ACEOF LIBS="-lldns $LIBS" +else + found_all_libs=0 fi +if test $found_all_libs == 0 +then + as_fn_error $? "One more dependencies is missing" "$LINENO" 5 +fi + # Checks for header files. for ac_header in inttypes.h netinet/in.h stdint.h stdlib.h string.h do : diff --git a/configure.ac b/configure.ac index 080c7a1c..71d63e30 100644 --- a/configure.ac +++ b/configure.ac @@ -16,9 +16,15 @@ AC_CONFIG_MACRO_DIR([m4]) AC_PROG_CC # Checks for libraries. -AC_CHECK_LIB([event_core], [event_base_new]) -AC_CHECK_LIB([getdns], [getdns_context_create]) -AC_CHECK_LIB([ldns], [ldns_dname_new_frm_str]) +found_all_libs=1 +AC_MSG_NOTICE([Checking for dependencies ldns and libevent]) +AC_CHECK_LIB([event_core], [event_base_new], [], [found_all_libs=0]) +AC_CHECK_LIB([ldns], [ldns_dname_new_frm_str], [], [found_all_libs=0]) + +if test $found_all_libs == 0 +then + AC_MSG_ERROR([One more dependencies is missing]) +fi # Checks for header files. AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h]) diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 3add2200..b53d574a 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -Wall -g -fPIC -I$(srcdir)/ -I /usr/local/include -std=c99 +AM_CPPFLAGS = -Wall -Werror -g -fPIC -I$(srcdir)/ -I /usr/local/include -std=c99 lib_LTLIBRARIES = libgetdns.la libgetdns_la_SOURCES = getdns_address.c getdns_context.c getdns_convert.c \ getdns_dict.c getdns_general.c getdns_hostname.c getdns_list.c \ diff --git a/src/common/Makefile.in b/src/common/Makefile.in index 730a7708..765d648f 100644 --- a/src/common/Makefile.in +++ b/src/common/Makefile.in @@ -235,7 +235,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = -Wall -g -fPIC -I$(srcdir)/ -I /usr/local/include -std=c99 +AM_CPPFLAGS = -Wall -Werror -g -fPIC -I$(srcdir)/ -I /usr/local/include -std=c99 lib_LTLIBRARIES = libgetdns.la libgetdns_la_SOURCES = getdns_address.c getdns_context.c getdns_convert.c \ getdns_dict.c getdns_general.c getdns_hostname.c getdns_list.c \ diff --git a/src/common/getdns_context.c b/src/common/getdns_context.c index d2294b99..8c6f9889 100644 --- a/src/common/getdns_context.c +++ b/src/common/getdns_context.c @@ -28,7 +28,7 @@ * THE SOFTWARE. */ -#include +#include /* stuff to make it compile pedantically */ #define UNUSED_PARAM(x) ((void)(x)) diff --git a/src/common/getdns_convert.c b/src/common/getdns_convert.c index 487fb515..0025ed1c 100644 --- a/src/common/getdns_convert.c +++ b/src/common/getdns_convert.c @@ -29,6 +29,7 @@ */ #include +#include /* stuff to make it compile pedantically */ #define UNUSED_PARAM(x) ((void)(x)) diff --git a/src/common/getdns_dict.c b/src/common/getdns_dict.c index 33feb803..ce0701f9 100644 --- a/src/common/getdns_dict.c +++ b/src/common/getdns_dict.c @@ -29,6 +29,7 @@ * THE SOFTWARE. */ +#include #include #include #include diff --git a/src/example/Makefile.am b/src/example/Makefile.am index 112dab65..41b9270d 100644 --- a/src/example/Makefile.am +++ b/src/example/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -Wall -g -fPIC -I$(srcdir)/ -I/usr/local/include -I../common -std=c99 +AM_CPPFLAGS = -Wall -Werror -g -fPIC -I$(srcdir)/ -I/usr/local/include -I../common -std=c99 AM_LDFLAGS = -L../common -L/usr/local/lib -lgetdns -lldns -levent bin_PROGRAMS = example_all_functions example_synchronous \ example_simple_answers example_tree diff --git a/src/example/Makefile.in b/src/example/Makefile.in index 5250c416..a11d33cb 100644 --- a/src/example/Makefile.in +++ b/src/example/Makefile.in @@ -218,7 +218,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = -Wall -g -fPIC -I$(srcdir)/ -I/usr/local/include -I../common -std=c99 +AM_CPPFLAGS = -Wall -Werror -g -fPIC -I$(srcdir)/ -I/usr/local/include -I../common -std=c99 AM_LDFLAGS = -L../common -L/usr/local/lib -lgetdns -lldns -levent example_all_functions_SOURCES = example_all_functions.c example_synchronous_SOURCES = example_synchronous.c