From: David Herrmann Date: Fri, 13 Sep 2013 10:42:12 +0000 (+0200) Subject: build: check for build/link flags harder X-Git-Tag: v208~127 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=d8c8508bad097c5cc354b684866a5b7a83fce394 build: check for build/link flags harder Use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE to test for flags that might succeed during compilation but not during linking. An example is gcc compiled with libssp support but gnu-ld without it. In this case -fstack-protector works fine during compilation but fails during linking as several internal helpers are missing. --- diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 7e080da65..aa53ef238 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -42,9 +42,9 @@ AC_DEFUN([CC_CHECK_FLAG_APPEND], [ AS_TR_SH([cc_cv_$2_$3]), [eval "AS_TR_SH([cc_save_$2])='${$2}'" eval "AS_TR_SH([$2])='-Werror $3'" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])], - [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"], - [eval "AS_TR_SH([cc_cv_$2_$3])='no'"]) + AC_LINK_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])], + [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"], + [eval "AS_TR_SH([cc_cv_$2_$3])='no'"]) eval "AS_TR_SH([$2])='$cc_save_$2'"]) AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],