diff --git a/config.h b/config.h index ee1ba04..bed34d6 100644 --- a/config.h +++ b/config.h @@ -1,9 +1,6 @@ /* config.h. Generated from config.h.in by configure. */ /* 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 HAVE_ALARM 1 @@ -25,6 +22,9 @@ /* Define to 1 if you have the header file. */ #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 HAVE_LIBCRYPTO 1 diff --git a/config.h.in b/config.h.in index dfb83e9..f67b9cb 100644 --- a/config.h.in +++ b/config.h.in @@ -1,8 +1,5 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* enable libconfig */ -#undef ENABLE_LIBCONFIG - /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM @@ -24,6 +21,9 @@ /* Define to 1 if you have the header file. */ #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). */ #undef HAVE_LIBCRYPTO diff --git a/configure b/configure index 2361488..8861a5a 100755 --- a/configure +++ b/configure @@ -3562,14 +3562,16 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5 $as_echo "$ac_cv_lib_config_config_init" >&6; } 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 as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5 fi - EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; fi else @@ -3613,14 +3615,16 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5 $as_echo "$ac_cv_lib_config_config_init" >&6; } 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 as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5 fi - EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; fi diff --git a/configure.ac b/configure.ac index 357b911..8780f33 100644 --- a/configure.ac +++ b/configure.ac @@ -35,13 +35,11 @@ AC_ARG_ENABLE(libconfig,[--enable-libconfig/--disable-libconfig], AC_MSG_RESULT([disabled]) else 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])) - [EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ] + AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig])) fi ],[ 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])) - [EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ] + AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig])) ]) AC_MSG_CHECKING([for liblua]) diff --git a/main.c b/main.c index e75e821..a8d23fe 100644 --- a/main.c +++ b/main.c @@ -43,7 +43,7 @@ #include #endif #include -#ifdef ENABLE_LIBCONFIG +#ifdef HAVE_LIBCONFIG #include #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) { static char buf[1000]; int l = 0; @@ -433,7 +433,9 @@ void print_backtrace (void) { } #else 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