[cig-commits] [commit] Hiro_latest: Test of check configuration for gmake (7576be7)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Mon Nov 18 16:21:34 PST 2013
Repository : ssh://geoshell/calypso
On branch : Hiro_latest
Link : https://github.com/geodynamics/calypso/compare/93e9f8f974c7a247c8f02e54ec18de063f86c8fb...3c548304673360ddedd7d68c8095b3fb74a2b9ce
>---------------------------------------------------------------
commit 7576be7247e5a933bb56c440fa4ef54d485c7c55
Author: Hiroaki Matsui <h_kemono at mac.com>
Date: Sat Nov 2 09:12:01 2013 -0700
Test of check configuration for gmake
>---------------------------------------------------------------
7576be7247e5a933bb56c440fa4ef54d485c7c55
Makefile.in | 3 +-
configure | 35 ++++++++++++++++++++++++
configure.in | 7 +++++
src/confdb/check_gnu_make.m4 | 65 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 109 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 525410f..a568f56 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -27,6 +27,7 @@ MPILIBS = @MPILIBS@
F90_LOCAL = @FC@
MPIF90 = @MPIFC@
+GMAKE = @GMAKE@
AR = @ar_bin@
RANLIB = @RANLIB@
@@ -67,7 +68,7 @@ $(MAKE_MOD_DEP): $(MHDDIR)/module_dependency/make_module_dependency.f90
makemake: $(MAKE_MOD_DEP)
echo "# Construct Makefile"; \
cd $(MHDDIR) ; \
- make \
+ $(GMAKE) \
MAKEDIR="$(MAKEDIR)" \
BUILDDIR="$(BUILDDIR)" \
INSTDIR="$(INSTDIR)" \
diff --git a/configure b/configure
index 475fb9b..710a164 100755
--- a/configure
+++ b/configure
@@ -655,6 +655,8 @@ MPILIBS
MPICC
OPENMP_CFLAGS
PKG_CONFIG
+GMAKE
+ifGNUmake
RANLIB
SET_MAKE
ar_bin
@@ -2305,6 +2307,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
@@ -3810,6 +3816,35 @@ else
fi
+# GNU make check
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU make" >&5
+$as_echo_n "checking for GNU make... " >&6; }
+if ${_cv_gnu_make_command+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ _cv_gnu_make_command='' ;
+ for a in "$MAKE" make gmake gnumake ; do
+ if test -z "$a" ; then continue ; fi ;
+ if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
+ _cv_gnu_make_command=$a ;
+ break;
+ fi
+ done ;
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_cv_gnu_make_command" >&5
+$as_echo "$_cv_gnu_make_command" >&6; } ;
+ if test "x$_cv_gnu_make_command" != "x" ; then
+ ifGNUmake='' ;
+ else
+ ifGNUmake='#' ;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"Not found\"" >&5
+$as_echo "\"Not found\"" >&6; };
+ fi
+
+
+GMAKE=$_cv_gnu_make_command
+
# libtool check
diff --git a/configure.in b/configure.in
index 053e89d..800ff70 100644
--- a/configure.in
+++ b/configure.in
@@ -5,6 +5,9 @@
# AC_PREREQ(2.61)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
+dnl Include GNU make check
+builtin(include,src/confdb/check_gnu_make.m4)
+
dnl Include Fortran related definitions
builtin(include,src/confdb/aclocal_fc.m4)
@@ -46,6 +49,10 @@ AC_SUBST(ar_bin)
AC_PROG_MAKE_SET
AC_PROG_RANLIB
+# GNU make check
+CHECK_GNU_MAKE()
+GMAKE=$_cv_gnu_make_command
+AC_SUBST(GMAKE)
# libtool check
PKG_PROG_PKG_CONFIG
diff --git a/src/confdb/check_gnu_make.m4 b/src/confdb/check_gnu_make.m4
new file mode 100644
index 0000000..6cb2585
--- /dev/null
+++ b/src/confdb/check_gnu_make.m4
@@ -0,0 +1,65 @@
+dnl @synopsis CHECK_GNU_MAKE()
+dnl
+dnl This macro searches for a GNU version of make. If a match is found,
+dnl the makefile variable `ifGNUmake' is set to the empty string,
+dnl otherwise it is set to "#". This is useful for including a special
+dnl features in a Makefile, which cannot be handled by other versions
+dnl of make. The variable _cv_gnu_make_command is set to the command to
+dnl invoke GNU make if it exists, the empty string otherwise.
+dnl
+dnl Here is an example of its use:
+dnl
+dnl Makefile.in might contain:
+dnl
+dnl # A failsafe way of putting a dependency rule into a makefile
+dnl $(DEPEND):
+dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
+dnl
+dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
+dnl @ifGNUmake@ include $(DEPEND)
+dnl @ifGNUmake@ endif
+dnl
+dnl Then configure.in would normally contain:
+dnl
+dnl CHECK_GNU_MAKE()
+dnl AC_OUTPUT(Makefile)
+dnl
+dnl Then perhaps to cause gnu make to override any other make, we could
+dnl do something like this (note that GNU make always looks for
+dnl GNUmakefile first):
+dnl
+dnl if ! test x$_cv_gnu_make_command = x ; then
+dnl mv Makefile GNUmakefile
+dnl echo .DEFAULT: > Makefile ;
+dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
+dnl fi
+dnl
+dnl Then, if any (well almost any) other make is called, and GNU make
+dnl also exists, then the other make wraps the GNU make.
+dnl
+dnl @category InstalledPackages
+dnl @author John Darrington <j.darrington at elvis.murdoch.edu.au>
+dnl @version 2002-01-04
+dnl @license AllPermissive
+
+AC_DEFUN(
+ [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
+ _cv_gnu_make_command='' ;
+dnl Search all the common names for GNU make
+ for a in "$MAKE" make gmake gnumake ; do
+ if test -z "$a" ; then continue ; fi ;
+ if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
+ _cv_gnu_make_command=$a ;
+ break;
+ fi
+ done ;
+ ) ;
+dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
+ if test "x$_cv_gnu_make_command" != "x" ; then
+ ifGNUmake='' ;
+ else
+ ifGNUmake='#' ;
+ AC_MSG_RESULT("Not found");
+ fi
+ AC_SUBST(ifGNUmake)
+] )
More information about the CIG-COMMITS
mailing list