From: Michał Kępień Date: Mon, 29 Jun 2020 08:23:23 +0000 (+0200) Subject: Fix restoring CFLAGS and LIBS in AX_LIB_LMDB() X-Git-Tag: v9.17.3~32^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf0229caad23a4c33e84ce0c8092953dcbbbe7d8;p=thirdparty%2Fbind9.git Fix restoring CFLAGS and LIBS in AX_LIB_LMDB() The AX_LIB_LMDB() macro attempts to test the potential LMDB installation path provided to it by temporarily updating CFLAGS and LIBS, calling AC_SEARCH_LIBS(), and then restoring CFLAGS and LIBS to their original values. However, including certain statements (e.g. "break") in the arguments provided to the AX_LIB_LMDB() macro may cause an early exit from it, in which case CFLAGS and LIBS will be left polluted. Fix by resetting CFLAGS and LIBS to their original values before executing the commands provided as AX_LIB_LMDB() arguments. --- diff --git a/m4/ax_lib_lmdb.m4 b/m4/ax_lib_lmdb.m4 index 0895a9d2690..2d011dc7cdc 100644 --- a/m4/ax_lib_lmdb.m4 +++ b/m4/ax_lib_lmdb.m4 @@ -37,22 +37,21 @@ AC_DEFUN([AX_LIB_LMDB], [AC_MSG_RESULT([yes]) LMDB_CFLAGS="-I$1/include" LMDB_LIBS="-L$1/lib" - saved_CFLAGS="$CFLAGS" - saved_LIBS="$LIBS" + AX_SAVE_FLAGS([lmdb]) CFLAGS="$CFLAGS $LMDB_CFLAGS" LIBS="$LIBS $LMDB_LIBS" AC_SEARCH_LIBS([mdb_env_create], [lmdb], [LMDB_LIBS="$LMDB_LIBS $ac_cv_search_mdb_env_create" AC_SUBST([LMDB_CFLAGS]) AC_SUBST([LMDB_LDFLAGS]) + AX_RESTORE_FLAGS([lmdb]) $2 ], [AC_MSG_RESULT([no]) LMDB_CFLAGS="" LMDB_LIBS="" + AX_RESTORE_FLAGS([lmdb]) $3 ]) - CFLAGS="$saved_CFLAGS" - LIBS="$saved_LIBS" ], [AC_MSG_RESULT([no])])])