| 1083 | | yes) |
| 1084 | | enable_strict_done="yes" |
| 1085 | | if test "$ac_cv_prog_gcc" = "yes" ; then |
| 1086 | | pac_cc_strict_flags="-Wall $GCC_OPTFLAG -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL" |
| 1087 | | CFLAGS="$CFLAGS $pac_cc_strict_flags" |
| 1088 | | AC_MSG_RESULT([Adding strict check arguments to CFLAGS]) |
| 1089 | | AC_MSG_CHECKING([whether we can add -std=c89]) |
| 1090 | | # See if we can add -std=c89 |
| 1091 | | savCFLAGS=$CFLAGS |
| 1092 | | CFLAGS="$CFLAGS -std=c89" |
| 1093 | | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[int a;])], |
| 1094 | | stdc_ok=yes, |
| 1095 | | stdc_ok=no) |
| 1096 | | AC_MSG_RESULT($stdc_ok) |
| 1097 | | if test "$stdc_ok" != yes ; then |
| 1098 | | CFLAGS="$savCFLAGS" |
| 1099 | | else |
| 1100 | | pac_cc_strict_flags="$pac_cc_strict_flags -std=c89" |
| 1101 | | fi |
| 1102 | | else |
| 1103 | | AC_MSG_WARN([enable strict supported only for gcc]) |
| 1104 | | fi |
| | 1075 | yes|all) |
| | 1076 | enable_strict_done="yes" |
| | 1077 | pac_cc_strict_flags="-O2 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -DGCC_WALL -Wunused -Wshadow -Wmissing-declarations -Werror-implicit-function-declaration -Wno-long-long -Wunused-parameter -Wunused-value -Wfloat-equal -Wdeclaration-after-statement -Wundef -Wno-endif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wold-style-definition -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wno-pointer-sign -Wvariadic-macros -std=c89" |
| 1107 | | all) |
| 1108 | | enable_strict_done="yes" |
| 1109 | | if test "$ac_cv_prog_gcc" = "yes" ; then |
| 1110 | | # -Wsystem-headers removed because of too many warning messages |
| 1111 | | # that are unfixable by the user of this option (the warnings |
| 1112 | | # often show benign but real problems) |
| 1113 | | # -Wunreachable-code has a serious bug and falsely reports |
| 1114 | | # labels as unreachable code. This makes that option useless |
| 1115 | | # for the MPICH2 code, for example |
| 1116 | | # The next line was the original set of options; this |
| 1117 | | # worked with gcc version 2.x |
| 1118 | | # pac_cc_strict_flags="-Wall -Wextra $GCC_OPTFLAG -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL -Wunused -Wshadow -Wmissing-declarations -Wunused-parameter -Wunused-value -Wno-long-long -Werror-implicit-function-declaration" |
| 1119 | | pac_cc_strict_flags="-Wall -Wextra $GCC_OPTFLAG -Wstrict-prototypes -Wmissing-prototypes -DGCC_WALL -Wunused -Wshadow -Wmissing-declarations -Werror-implicit-function-declaration -Wno-long-long -Wunused-parameter -Wunused-value -Wfloat-equal -Wdeclaration-after-statement -Wundef -Wno-endif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wold-style-definition -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wno-pointer-sign -Wvariadic-macros" |
| 1120 | | CFLAGS="$CFLAGS $pac_cc_strict_flags" |
| 1121 | | AC_MSG_CHECKING([whether we can add -std=c89]) |
| 1122 | | # See if we can add -std=c89 |
| 1123 | | savCFLAGS=$CFLAGS |
| 1124 | | CFLAGS="$CFLAGS -std=c89" |
| 1125 | | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[int a;])], |
| 1126 | | stdc_ok=yes, |
| 1127 | | stdc_ok=no) |
| 1128 | | AC_MSG_RESULT($stdc_ok) |
| 1129 | | if test "$stdc_ok" != yes ; then |
| 1130 | | CFLAGS="$savCFLAGS" |
| 1131 | | else |
| 1132 | | pac_cc_strict_flags="$pac_cc_strict_flags -std=c89" |
| 1133 | | fi |
| 1134 | | else |
| 1135 | | AC_MSG_WARN([enable strict supported only for gcc]) |
| 1136 | | fi |
| 1137 | | ;; |
| 1138 | | |
| 1139 | | # The MPICH2 code has several modules that have duplicate |
| 1140 | | # function declarations. The resulting list of warnings is |
| 1141 | | # swamped by those duplicates, rendering the output nearly |
| 1142 | | # useless. This temporary option choice is the same as |
| 1143 | | # --enable-strict=all, but without that one option |
| 1144 | | allbutdupdefs) |
| 1145 | | enable_strict_done="yes" |
| 1146 | | if test "$ac_cv_prog_gcc" = "yes" ; then |
| 1147 | | # -Wsystem-headers removed because of too many warning messages |
| 1148 | | # that are unfixable by the user of this option (the warnings |
| 1149 | | # often show benign but real problems) |
| 1150 | | # -Wunreachable-code has a serious bug and falsely reports |
| 1151 | | # labels as unreachable code. This makes that option useless |
| 1152 | | # for the MPICH2 code, for example |
| 1153 | | # This next line contains the options used with gcc version 2.x |
| 1154 | | # pac_cc_strict_flags="-Wall -Wextra $GCC_OPTFLAG -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL -Wunused -Wshadow -Wmissing-declarations -Wunused-parameter -Wunused-value -Wno-long-long -Werror-implicit-function-declaration" |
| 1155 | | pac_cc_strict_flags="-Wall -Wextra $GCC_OPTFLAG -Wstrict-prototypes -Wmissing-prototypes -DGCC_WALL -Wunused -Wshadow -Wmissing-declarations -Werror-implicit-function-declaration -Wno-long-long -Wunused-parameter -Wunused-value -Wfloat-equal -Wdeclaration-after-statement -Wundef -Wno-endif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wold-style-definition -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wpadded -Wnested-externs -Winline -Winvalid-pch -Wno-pointer-sign -Wvariadic-macros -std=c89" |
| 1156 | | CFLAGS="$CFLAGS $pac_cc_strict_flags" |
| 1157 | | AC_MSG_CHECKING([whether we can add -std=c89]) |
| 1158 | | # See if we can add -std=c89 |
| 1159 | | savCFLAGS=$CFLAGS |
| 1160 | | CFLAGS="$CFLAGS -std=c89" |
| 1161 | | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[int a;])], |
| 1162 | | stdc_ok=yes, |
| 1163 | | stdc_ok=no) |
| 1164 | | AC_MSG_RESULT($stdc_ok) |
| 1165 | | if test "$stdc_ok" != yes ; then |
| 1166 | | CFLAGS="$savCFLAGS" |
| 1167 | | else |
| 1168 | | pac_cc_strict_flags="$pac_cc_strict_flags -std=c89" |
| 1169 | | fi |
| 1170 | | else |
| 1171 | | AC_MSG_WARN([enable strict supported only for gcc]) |
| 1172 | | fi |
| 1173 | | ;; |
| 1174 | | |
| 1176 | | # fsync is a part of POSIX only in the real-time extensions, |
| 1177 | | # apparently, so code that used include <unistd.h> and POSIX |
| 1178 | | # and expects fsync to be defined is in trouble. Because of that |
| 1179 | | # we're not including the -W option to error if a function is |
| 1180 | | # not prototyped. |
| 1181 | | enable_strict_done="yes" |
| 1182 | | if test "$ac_cv_prog_gcc" = "yes" ; then |
| 1183 | | pac_cc_strict_flags="-Wall $GCC_OPTFLAG -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL -D_POSIX_C_SOURCE=199506L" |
| 1184 | | CFLAGS="$CFLAGS $pac_cc_strict_flags" |
| 1185 | | AC_MSG_RESULT([Adding strict check arguments (POSIX flavor) to CFLAGS]) |
| 1186 | | AC_MSG_CHECKING([whether we can add -std=c89]) |
| 1187 | | # See if we can add -std=c89 |
| 1188 | | savCFLAGS=$CFLAGS |
| 1189 | | CFLAGS="$CFLAGS -std=c89" |
| 1190 | | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[int a;])], |
| 1191 | | stdc_ok=yes, |
| 1192 | | stdc_ok=no) |
| 1193 | | AC_MSG_RESULT($stdc_ok) |
| 1194 | | if test "$stdc_ok" != yes ; then |
| 1195 | | CFLAGS="$savCFLAGS" |
| 1196 | | else |
| 1197 | | pac_cc_strict_flags="$pac_cc_strict_flags -std=c89" |
| 1198 | | fi |
| 1199 | | else |
| 1200 | | AC_MSG_WARN([enable strict supported only for gcc]) |
| 1201 | | fi |
| | 1081 | # fsync is a part of POSIX only in the real-time |
| | 1082 | # extensions, apparently, so code that used include |
| | 1083 | # <unistd.h> and POSIX and expects fsync to be defined |
| | 1084 | # is in trouble. Because of that we're not including |
| | 1085 | # the -W option to error if a function is not |
| | 1086 | # prototyped. |
| | 1087 | enable_strict_done="yes" |
| | 1088 | pac_cc_strict_flags="-O2 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -DGCC_WALL -Wunused -Wshadow -Wmissing-declarations -Werror-implicit-function-declaration -Wno-long-long -Wunused-parameter -Wunused-value -Wfloat-equal -Wdeclaration-after-statement -Wundef -Wno-endif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wold-style-definition -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wno-pointer-sign -Wvariadic-macros -std=c89 -D_POSIX_C_SOURCE=199506L" |
| 1204 | | noopt) |
| 1205 | | enable_strict_done="yes" |
| 1206 | | if test "$ac_cv_prog_gcc" = "yes" ; then |
| 1207 | | pac_cc_strict_flags="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL" |
| 1208 | | CFLAGS="$CFLAGS $pac_cc_strict_flags" |
| 1209 | | AC_MSG_RESULT([Adding strict check arguments to CFLAGS]) |
| 1210 | | AC_MSG_CHECKING([whether we can add -std=c89]) |
| 1211 | | # See if we can add -std=c89 |
| 1212 | | savCFLAGS=$CFLAGS |
| 1213 | | CFLAGS="$CFLAGS -std=c89" |
| 1214 | | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[int a;])], |
| 1215 | | stdc_ok=yes, |
| 1216 | | stdc_ok=no) |
| 1217 | | AC_MSG_RESULT($stdc_ok) |
| 1218 | | if test "$stdc_ok" != yes ; then |
| 1219 | | CFLAGS="$savCFLAGS" |
| 1220 | | else |
| 1221 | | pac_cc_strict_flags="$pac_cc_strict_flags -std=c89" |
| 1222 | | fi |
| 1223 | | else |
| 1224 | | AC_MSG_WARN([enable strict supported only for gcc]) |
| 1225 | | fi |
| | 1091 | no) |
| | 1092 | # Accept and ignore this value |
| | 1093 | : |
| 1247 | | dnl Adds '--enable-strict' to the command line. If this is enabled, then |
| 1248 | | dnl if no compiler has been set, set 'CC' to 'gcc'. |
| 1249 | | dnl If the compiler is 'gcc', 'COPTIONS' is set to include |
| 1250 | | dnl.vb |
| 1251 | | dnl -O -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror=pointer-arith -DGCC_WALL -std=c89 |
| 1252 | | dnl.ve |
| 1253 | | dnl This makes using a void * with pointer arithmetic an error, not a warning. |
| 1254 | | dnl We do this because pointer arithmetic with void * is not valid C but |
| 1255 | | dnl gcc accepts this unless these particular optiones are used. |
| 1256 | | dnl Grr. -Werror=name is a recent addition to gcc, so we can't require it yet. |
| 1257 | | dnl |
| 1258 | | dnl -std=c89 is used to select the C89 version of the ANSI/ISO C standard. |
| 1259 | | dnl As of this writing, many C compilers still accepted only this version, |
| 1260 | | dnl not the later C99 version. When all compilers accept C99, this |
| 1261 | | dnl should be changed to the appropriate standard level. Note that we've |
| 1262 | | dnl had trouble with gcc 2.95.3 accepting -std=c89 but then trying to |
| 1263 | | dnl compile program with a invalid set of options |
| 1264 | | dnl (-D __STRICT_ANSI__-trigraphs) |
| 1265 | | dnl |
| 1266 | | dnl If the value 'all' is given to '--enable-strict', additional warning |
| 1267 | | dnl options are included. These are |
| 1268 | | dnl.vb |
| 1269 | | dnl -Wunused -Wshadow -Wmissing-declarations -Wno-long-long |
| 1270 | | dnl.ve |
| 1271 | | dnl |
| 1272 | | dnl If the value 'noopt' is given to '--enable-strict', no optimization |
| 1273 | | dnl options are set. For some compilers (including gcc), this may |
| 1274 | | dnl cause some strict complication tests to be skipped (typically, these are |
| 1275 | | dnl tests for unused variables or variables used before they are defined). |
| 1276 | | dnl |
| 1277 | | dnl If the value 'posix' is given to '--enable-strict', POSIX is selected |
| 1278 | | dnl as the C dialect (including the definition for the POSIX level) |
| 1279 | | dnl |
| 1280 | | dnl If the value 'all' is given to '--enable-strict', use the "GNU" Unix |
| 1281 | | dnl dialect. This permits the use of stricter checking for declarations of |
| 1282 | | dnl system functions (note that fsync is not defined in strict, non-real-time |
| 1283 | | dnl POSIX). This level includes |
| 1284 | | dnl .vb |
| 1285 | | dnl -Werror-implicit-function-declaration |
| 1286 | | dnl .ve |
| 1287 | | dnl |
| 1288 | | dnl This only works where 'gcc' is available. |
| 1289 | | dnl In addition, it exports the variable 'enable_strict_done'. This |
| 1290 | | dnl ensures that subsidiary 'configure's do not add the above flags to |
| 1291 | | dnl 'COPTIONS' once the top level 'configure' sees '--enable-strict'. To ensure |
| 1292 | | dnl this, 'COPTIONS' is also exported. |
| 1293 | | dnl |
| 1294 | | dnl Not yet available: options when using other compilers. However, |
| 1295 | | dnl here are some possible choices |
| 1296 | | dnl Solaris cc |
| 1297 | | dnl -fd -v -Xc |
| 1298 | | dnl -Xc is strict ANSI (some version) and does not allow "long long", for |
| 1299 | | dnl example |
| 1300 | | dnl IRIX |
| 1301 | | dnl -ansi -DEBUG:trap_uninitialized=ON:varargs_interface_check=ON:verbose_runtime=ON |
| | 1123 | dnl Adds '--enable-strict' to the command line. |