replace ENABLE_LIBCONFIG by HAVE_LIBCONFIG (use macro AC_CHECK_LIBdefault ACTION-IF-FOUND behavior)

fix unused write result in undefined HAVE_EXECINFO_H case
This commit is contained in:
antma 2014-02-05 15:07:58 +04:00
parent 12e8e5c7b7
commit 8b632ed4d4
5 changed files with 21 additions and 17 deletions

View File

@ -1,9 +1,6 @@
/* config.h. Generated from config.h.in by configure. */ /* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */ /* config.h.in. Generated from configure.ac by autoheader. */
/* enable libconfig */
#define ENABLE_LIBCONFIG 1
/* Define to 1 if you have the `alarm' function. */ /* Define to 1 if you have the `alarm' function. */
#define HAVE_ALARM 1 #define HAVE_ALARM 1
@ -25,6 +22,9 @@
/* Define to 1 if you have the <lauxlib.h> header file. */ /* Define to 1 if you have the <lauxlib.h> header file. */
#define HAVE_LAUXLIB_H 1 #define HAVE_LAUXLIB_H 1
/* Define to 1 if you have the `config' library (-lconfig). */
#define HAVE_LIBCONFIG 1
/* Define to 1 if you have the `crypto' library (-lcrypto). */ /* Define to 1 if you have the `crypto' library (-lcrypto). */
#define HAVE_LIBCRYPTO 1 #define HAVE_LIBCRYPTO 1

View File

@ -1,8 +1,5 @@
/* config.h.in. Generated from configure.ac by autoheader. */ /* config.h.in. Generated from configure.ac by autoheader. */
/* enable libconfig */
#undef ENABLE_LIBCONFIG
/* Define to 1 if you have the `alarm' function. */ /* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM #undef HAVE_ALARM
@ -24,6 +21,9 @@
/* Define to 1 if you have the <lauxlib.h> header file. */ /* Define to 1 if you have the <lauxlib.h> header file. */
#undef HAVE_LAUXLIB_H #undef HAVE_LAUXLIB_H
/* Define to 1 if you have the `config' library (-lconfig). */
#undef HAVE_LIBCONFIG
/* Define to 1 if you have the `crypto' library (-lcrypto). */ /* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO #undef HAVE_LIBCRYPTO

12
configure vendored
View File

@ -3562,14 +3562,16 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5
$as_echo "$ac_cv_lib_config_config_init" >&6; } $as_echo "$ac_cv_lib_config_config_init" >&6; }
if test "x$ac_cv_lib_config_config_init" = xyes; then : if test "x$ac_cv_lib_config_config_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCONFIG 1
_ACEOF
$as_echo "#define ENABLE_LIBCONFIG 1" >>confdefs.h LIBS="-lconfig $LIBS"
else else
as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5 as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5
fi fi
EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ;
fi fi
else else
@ -3613,14 +3615,16 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5
$as_echo "$ac_cv_lib_config_config_init" >&6; } $as_echo "$ac_cv_lib_config_config_init" >&6; }
if test "x$ac_cv_lib_config_config_init" = xyes; then : if test "x$ac_cv_lib_config_config_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCONFIG 1
_ACEOF
$as_echo "#define ENABLE_LIBCONFIG 1" >>confdefs.h LIBS="-lconfig $LIBS"
else else
as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5 as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5
fi fi
EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ;
fi fi

View File

@ -35,13 +35,11 @@ AC_ARG_ENABLE(libconfig,[--enable-libconfig/--disable-libconfig],
AC_MSG_RESULT([disabled]) AC_MSG_RESULT([disabled])
else else
AC_MSG_RESULT([enabled]) AC_MSG_RESULT([enabled])
AC_CHECK_LIB([config],[config_init],AC_DEFINE(ENABLE_LIBCONFIG,1,[enable libconfig]),AC_MSG_ERROR([No libconfig found. Try --disable-libconfig])) AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
[EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ]
fi fi
],[ ],[
AC_MSG_RESULT([enabled]) AC_MSG_RESULT([enabled])
AC_CHECK_LIB([config],[config_init],AC_DEFINE(ENABLE_LIBCONFIG,1,[enable libconfig]),AC_MSG_ERROR([No libconfig found. Try --disable-libconfig])) AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
[EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ]
]) ])
AC_MSG_CHECKING([for liblua]) AC_MSG_CHECKING([for liblua])

8
main.c
View File

@ -43,7 +43,7 @@
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#include <signal.h> #include <signal.h>
#ifdef ENABLE_LIBCONFIG #ifdef HAVE_LIBCONFIG
#include <libconfig.h> #include <libconfig.h>
#endif #endif
@ -247,7 +247,7 @@ void running_for_first_time (void) {
} }
} }
#ifdef ENABLE_LIBCONFIG #ifdef HAVE_LIBCONFIG
void parse_config_val (config_t *conf, char **s, char *param_name, const char *default_name, const char *path) { void parse_config_val (config_t *conf, char **s, char *param_name, const char *default_name, const char *path) {
static char buf[1000]; static char buf[1000];
int l = 0; int l = 0;
@ -433,7 +433,9 @@ void print_backtrace (void) {
} }
#else #else
void print_backtrace (void) { void print_backtrace (void) {
write (1, "No libexec. Backtrace disabled\n", 32); if (write (1, "No libexec. Backtrace disabled\n", 32) < 0) {
// Sad thing
}
} }
#endif #endif