You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/12/20 05:28:20 UTC
svn commit: r1424291 - in /subversion/branches/tweak-build-take-two:
aclocal.m4 build/ac-macros/compiler.m4
Author: brane
Date: Thu Dec 20 04:28:20 2012
New Revision: 1424291
URL: http://svn.apache.org/viewvc?rev=1424291&view=rev
Log:
[On the tweak-build-take-two branch]
* build/ac-macros/compiler.m4: New file.
(SVN_CFLAGS_ADD_IFELSE): Conditionally add C compiler flags.
(SVN_CXXFLAGS_ADD_IFELSE): Conditionally add C++ compiler flags.
(_SVN_XXFLAGS_ADD_IFELSE): Common code for the above two functions.
(SVN_PROG_CC): Replaces AC_PROG_CC and assigns flags that put
the compiler into C90 mode in CMODEFLAGS.
(SVN_PROG_CXX): Replaces AC_PROG_CXX and assigns flags that put
the compiler into C90 mode in CXXMODEFLAGS.
* aclocal.m4: Include build/ac-macros/compiler.m4.
Added:
subversion/branches/tweak-build-take-two/build/ac-macros/compiler.m4
Modified:
subversion/branches/tweak-build-take-two/aclocal.m4
Modified: subversion/branches/tweak-build-take-two/aclocal.m4
URL: http://svn.apache.org/viewvc/subversion/branches/tweak-build-take-two/aclocal.m4?rev=1424291&r1=1424290&r2=1424291&view=diff
==============================================================================
--- subversion/branches/tweak-build-take-two/aclocal.m4 (original)
+++ subversion/branches/tweak-build-take-two/aclocal.m4 Thu Dec 20 04:28:20 2012
@@ -36,6 +36,7 @@ sinclude(build/ac-macros/apr.m4)
sinclude(build/ac-macros/aprutil.m4)
sinclude(build/ac-macros/apr_memcache.m4)
sinclude(build/ac-macros/berkeley-db.m4)
+sinclude(build/ac-macros/compiler.m4)
sinclude(build/ac-macros/ctypesgen.m4)
sinclude(build/ac-macros/gssapi.m4)
sinclude(build/ac-macros/java.m4)
Added: subversion/branches/tweak-build-take-two/build/ac-macros/compiler.m4
URL: http://svn.apache.org/viewvc/subversion/branches/tweak-build-take-two/build/ac-macros/compiler.m4?rev=1424291&view=auto
==============================================================================
--- subversion/branches/tweak-build-take-two/build/ac-macros/compiler.m4 (added)
+++ subversion/branches/tweak-build-take-two/build/ac-macros/compiler.m4 Thu Dec 20 04:28:20 2012
@@ -0,0 +1,91 @@
+dnl ===================================================================
+dnl Licensed to the Apache Software Foundation (ASF) under one
+dnl or more contributor license agreements. See the NOTICE file
+dnl distributed with this work for additional information
+dnl regarding copyright ownership. The ASF licenses this file
+dnl to you under the Apache License, Version 2.0 (the
+dnl "License"); you may not use this file except in compliance
+dnl with the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing,
+dnl software distributed under the License is distributed on an
+dnl "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl KIND, either express or implied. See the License for the
+dnl specific language governing permissions and limitations
+dnl under the License.
+dnl ===================================================================
+dnl
+dnl SVN_CFLAGS_ADD_IFELSE(option, success, failure)
+dnl
+dnl Check if the C compiler accepts $option. If it does, prepend it
+dnl to CFLAGS and execute $success; otherwise execute $failure.
+dnl
+dnl SVN_CXXFLAGS_ADD_IFELSE(option, success, failure)
+dnl
+dnl Like SVN_CFLAGS_ADD_IFELSE, but for C++ and CXXFLAGS.
+dnl
+dnl SVN_PROG_CC: Customized replacement for AC_PROG_CC
+dnl SVN_PROG_CXX: Customized replacement for AC_PROG_CXX
+
+AC_DEFUN([_SVN_XXFLAGS_ADD_IFELSE],
+[
+ _svn_xxflags__save="[$][$3]"
+ AC_LANG_PUSH([$1])
+ AC_MSG_CHECKING([if [$][$2] accepts $4])
+ [$3]="$4 [$][$3]"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],[
+ AC_MSG_RESULT([yes])
+ $5
+ ],[
+ AC_MSG_RESULT([no])
+ [$3]="$_svn_xxflags__save"
+ $6
+ ])
+ AC_LANG_POP([$1])
+])
+
+AC_DEFUN([SVN_CFLAGS_ADD_IFELSE],
+ [_SVN_XXFLAGS_ADD_IFELSE([C],[CC],[CFLAGS],[$1],[$2],[$3])])
+
+AC_DEFUN([SVN_CXXFLAGS_ADD_IFELSE],
+ [_SVN_XXFLAGS_ADD_IFELSE([C++],[CXX],[CXXFLAGS],[$1],[$2],[$3])])
+
+
+AC_DEFUN([SVN_PROG_CC],
+[
+ AC_PROG_CC
+
+ CFLAGS_KEEP="$CFLAGS"
+ CFLAGS=""
+
+ dnl Find flags to force C90 mode
+ dnl gcc and clang
+ SVN_CFLAGS_ADD_IFELSE([-std=c90],[],[
+ SVN_CFLAGS_ADD_IFELSE([-std=c89],[],[
+ SVN_CFLAGS_ADD_IFELSE([-ansi])
+ ])
+ ])
+
+ AC_SUBST(CMODEFLAGS)
+ CMODEFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS_KEEP"
+])
+
+
+AC_DEFUN([SVN_PROG_CXX],
+[
+ AC_PROG_CXX
+
+ CXXFLAGS_KEEP="$CXXFLAGS"
+ CXXFLAGS=""
+
+ dnl Find flags to force C++98 mode
+ dnl g++ and clang++
+ SVN_CXXFLAGS_ADD_IFELSE([-std=c++98])
+
+ AC_SUBST(CXXMODEFLAGS)
+ CXXMODEFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS_KEEP"
+])