Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com>
---
 configure.ac            |    1 +
 include/mk/config.mk.in |    2 +-
 m4/ltp-gcc_option.m4    |   37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletions(-)
 create mode 100644 m4/ltp-gcc_option.m4

diff --git a/configure.ac b/configure.ac
index 44016e7..23bd02a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,5 +175,6 @@ LTP_CHECK_FCHOWNAT
 LTP_CHECK_MKNODAT
 LTP_CHECK_FALLOCATE
 LTP_CHECK_SYSCALL_FCNTL
+LTP_CHECK_GCC_OPTION
 
 AC_OUTPUT
diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in
index c83d08c..478b899 100644
--- a/include/mk/config.mk.in
+++ b/include/mk/config.mk.in
@@ -66,7 +66,7 @@ DEBUG_CXXFLAGS                ?= $(DEBUG_CFLAGS)
 OPT_CFLAGS             ?= -O2 -fno-strict-aliasing -pipe
 OPT_CXXFLAGS           ?= $(OPT_CFLAGS)
 
-WCFLAGS                        ?= -Wall -W -Wold-style-definition
+WCFLAGS                        ?= -Wall -W @GCC_WARN_OLDSTYLE@
 WCXXFLAGS              ?= $(WCFLAGS)
 
 LDFLAGS                        += $(WLDFLAGS)
diff --git a/m4/ltp-gcc_option.m4 b/m4/ltp-gcc_option.m4
new file mode 100644
index 0000000..93e67cd
--- /dev/null
+++ b/m4/ltp-gcc_option.m4
@@ -0,0 +1,37 @@
+dnl Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+dnl
+dnl This program is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 2 of
+dnl the License, or (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it would be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write the Free Software Foundation,
+dnl Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+dnl
+dnl Author: Alexey Kodanev <alexey.koda...@oracle.com>
+dnl
+
+AC_DEFUN([LTP_CHECK_GCC_OPTION],[dnl
+
+AC_MSG_CHECKING([for gcc -Wold-style-definition])
+
+backup_cflags="$CFLAGS"
+CFLAGS="-Wold-style-definition"
+
+AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM([])],
+       [GCC_WARN_OLDSTYLE="$CFLAGS"]
+       [AC_MSG_RESULT([yes])],
+       [AC_MSG_RESULT([no])]
+)
+
+AC_SUBST(GCC_WARN_OLDSTYLE)
+CFLAGS="$backup_cflags"
+
+])
-- 
1.7.1


------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to