]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
from systemd: build: check for build/link flags harder
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 13 Sep 2013 10:42:12 +0000 (12:42 +0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 25 Feb 2015 01:41:30 +0000 (22:41 -0300)
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.

m4/attributes.m4

index 104f04cec218e0b40fe8d80dfd6a5e57912eeb5e..fad1c8f05f8154b029692b6e367d266c9838dfea 100644 (file)
@@ -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],