Changeset 120
- Timestamp:
- Sep 5, 2007, 10:36:38 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/aclocal.m4
r68 r120 1065 1065 dnl Useful macros for autoconf to check for ssp-patched gcc 1066 1066 dnl 1.0 - September 2003 - Tiago Sousa <mirage@kaotik.org> 1067 dnl 1.1 - August 2006 - Ted Percival <ted@midg3t.net> 1068 dnl * Stricter language checking (C or C++) 1069 dnl * Adds GCC_STACK_PROTECT_LIB to add -lssp to LDFLAGS as necessary 1070 dnl * Caches all results 1071 dnl * Uses macros to ensure correct ouput in quiet/silent mode 1072 dnl 1.2 - April 2007 - Ted Percival <ted@midg3t.net> 1073 dnl * Added GCC_STACK_PROTECTOR macro for simpler (one-line) invocation 1074 dnl * GCC_STACK_PROTECT_LIB now adds -lssp to LIBS rather than LDFLAGS 1067 1075 dnl 1068 1076 dnl About ssp: … … 1071 1079 dnl 1072 1080 dnl Usage: 1073 dnl After calling the correct AC_LANG_*, use the corresponding macro: 1081 dnl Most people will simply call GCC_STACK_PROTECTOR. 1082 dnl If you only use one of C or C++, you can save time by only calling the 1083 dnl macro appropriate for that language. In that case you should also call 1084 dnl GCC_STACK_PROTECT_LIB first. 1085 dnl 1086 dnl GCC_STACK_PROTECTOR 1087 dnl Tries to turn on stack protection for C and C++ by calling the following 1088 dnl three macros with the right languages. 1074 1089 dnl 1075 1090 dnl GCC_STACK_PROTECT_CC … … 1077 1092 dnl CFLAGS and defines ENABLE_SSP_CC 1078 1093 dnl 1094 dnl GCC_STACK_PROTECT_CXX 1095 dnl checks -fstack-protector with the C++ compiler, if it exists then updates 1096 dnl CXXFLAGS and defines ENABLE_SSP_CXX 1097 dnl 1098 dnl GCC_STACK_PROTECT_LIB 1099 dnl adds -lssp to LIBS if it is available 1100 dnl ssp is usually provided as part of libc, but was previously a separate lib 1101 dnl It does not hurt to add -lssp even if libc provides SSP - in that case 1102 dnl libssp will simply be ignored. 1103 dnl 1104 1105 AC_DEFUN([GCC_STACK_PROTECT_LIB],[ 1106 AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib, 1107 [ssp_old_libs="$LIBS" 1108 LIBS="$LIBS -lssp" 1109 AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no) 1110 LIBS="$ssp_old_libs" 1111 ]) 1112 if test $ssp_cv_lib = yes; then 1113 LIBS="$LIBS -lssp" 1114 fi 1115 ]) 1116 1079 1117 AC_DEFUN([GCC_STACK_PROTECT_CC],[ 1080 ssp_cc=yes 1081 if test "X$GCC" = "Xyes"; then 1082 AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector]) 1083 ssp_old_cflags="$CFLAGS" 1084 CFLAGS="$CFLAGS -fstack-protector" 1085 AC_TRY_LINK(,,, ssp_cc=no) 1086 # echo $ssp_cc 1087 if test "X$ssp_cc" = "Xno"; then 1088 CFLAGS="$ssp_old_cflags" 1089 AC_MSG_RESULT(no) 1090 else 1091 AC_MSG_RESULT(yes) 1118 AC_LANG_ASSERT(C) 1119 if test "X$CC" != "X"; then 1120 AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector], 1121 ssp_cv_cc, 1122 [ssp_old_cflags="$CFLAGS" 1123 CFLAGS="$CFLAGS -fstack-protector" 1124 AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no) 1125 CFLAGS="$ssp_old_cflags" 1126 ]) 1127 if test $ssp_cv_cc = yes; then 1128 CFLAGS="$CFLAGS -fstack-protector" 1092 1129 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) 1093 1130 fi 1094 1131 fi 1095 1132 ]) 1133 1134 AC_DEFUN([GCC_STACK_PROTECT_CXX],[ 1135 AC_LANG_ASSERT(C++) 1136 if test "X$CXX" != "X"; then 1137 AC_CACHE_CHECK([whether ${CXX} accepts -fstack-protector], 1138 ssp_cv_cxx, 1139 [ssp_old_cxxflags="$CXXFLAGS" 1140 CXXFLAGS="$CXXFLAGS -fstack-protector" 1141 AC_TRY_COMPILE(,, ssp_cv_cxx=yes, ssp_cv_cxx=no) 1142 CXXFLAGS="$ssp_old_cxxflags" 1143 ]) 1144 if test $ssp_cv_cxx = yes; then 1145 CXXFLAGS="$CXXFLAGS -fstack-protector" 1146 AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.]) 1147 fi 1148 fi 1149 ]) 1150 1151 AC_DEFUN([GCC_STACK_PROTECTOR],[ 1152 GCC_STACK_PROTECT_LIB 1153 1154 AC_LANG_PUSH([C]) 1155 GCC_STACK_PROTECT_CC 1156 AC_LANG_POP([C]) 1157 1158 AC_LANG_PUSH([C++]) 1159 GCC_STACK_PROTECT_CXX 1160 AC_LANG_POP([C++]) 1161 ]) 1162 1163 1096 1164 1097 1165 AC_DEFUN([SAMHAIN_POSIX],[ -
trunk/configure.ac
r118 r120 34 34 AC_SUBST(BUILD_CC) 35 35 36 GCC_STACK_PROTECT_LIB 36 37 GCC_STACK_PROTECT_CC 37 38 38 39 39 AC_HEADER_STDC
Note:
See TracChangeset
for help on using the changeset viewer.