source:
m4/acx_compilerflags.m4@
a97897
| Last change on this file since a97897 was a97897, checked in by , 17 years ago | |
|---|---|
|
|
| File size: 1.5 KB | |
| Line | |
|---|---|
| 1 | # AC_SET_COMPILER_FLAGS(optimization, debugging, warnings) |
| 2 | #---------------------------------------------------------------- |
| 3 | AC_DEFUN([AC_SET_COMPILER_FLAGS],[ |
| 4 | AC_MSG_NOTICE([Using AC@&t@_SET_COMPILER_FLAGS macro]) |
| 5 | |
| 6 | dnl optimization |
| 7 | if test ! x"$1" = xno; then |
| 8 | if test x"$2" = xno; then |
| 9 | if test x"$1" = xyes; then |
| 10 | optimization="-O2" |
| 11 | else |
| 12 | optimization="-O$1" |
| 13 | fi |
| 14 | fi |
| 15 | fi |
| 16 | dnl debugging info |
| 17 | if ! test x"$2" = xno; then |
| 18 | if test x"$2" = xyes; then |
| 19 | debugging="-g3" |
| 20 | else |
| 21 | debugging="-g$2" |
| 22 | fi |
| 23 | AC_DEFINE(HAVE_DEBUG,1, ["Output debugging info"]) |
| 24 | AC_SUBST(HAVE_DEBUG) |
| 25 | fi |
| 26 | |
| 27 | dnl enable all warnings |
| 28 | if test x"$3" = xsome; then |
| 29 | dnl even without debugging we want some minimal info of something's utterly wrong |
| 30 | Cwarnings="-Wall" |
| 31 | CXXwarnings="-Wall" |
| 32 | fi |
| 33 | if test x"$3" = xfull; then |
| 34 | Cwarnings="-Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wredundant-decls -Wnested-externs -Wmissing-noreturn -Wformat-security -Wmissing-format-attribute -Winit-self" |
| 35 | CXXwarnings="-Wall -W -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wredundant-decls -Wmissing-noreturn -Wformat-security -Wmissing-format-attribute -Winit-self" |
| 36 | fi |
| 37 | if test x"$3" = xnone; then |
| 38 | unset Cwarnings |
| 39 | unset CXXwarnings |
| 40 | else |
| 41 | AC_DEFINE(HAVE_WARNINGS,$enable_warnings, ["Output compiler warnings"]) |
| 42 | fi |
| 43 | |
| 44 | # finally, apply whatever was set |
| 45 | CFLAGS="$CFLAGS $debugging $optimization $Cwarnings" |
| 46 | CXXFLAGS="$CXXFLAGS $debugging $optimization $CXXwarnings" |
| 47 | |
| 48 | ]) |
Note:
See TracBrowser
for help on using the repository browser.
