Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sct
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dkrz-sw
sct
Commits
40224a82
Commit
40224a82
authored
1 year ago
by
Hendryk Bockelmann
Browse files
Options
Downloads
Plain Diff
Merge branch 'm4-license' into 'master'
Update m4 macros to get license headers See merge request dkrz-sw/sct!11
parents
48bc3b71
9915fea5
Branches
master
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
m4/acx_fc_line_length.m4
+62
-66
62 additions, 66 deletions
m4/acx_fc_line_length.m4
m4/acx_fc_pp.m4
+53
-61
53 additions, 61 deletions
m4/acx_fc_pp.m4
with
115 additions
and
127 deletions
m4/acx_fc_line_length.m4
+
62
−
66
View file @
40224a82
# Copyright (c) 2018-2024, MPI-M
#
# Author: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ACX_FC_LINE_LENGTH([LENGTH = 132],
# [ACTION-IF-SUCCESS = APPEND-FCFLAGS],
# [ACTION-IF-FAILURE = FAILURE])
# -----------------------------------------------------------------------------
# Originally taken from the master branch of Autoconf where it is known as
# AC_FC_LINE_LENGTH.
# -----------------------------------------------------------------------------
# Finds the Fortran compiler flag needed to accept lines of length LENGTH,
# where LENGTH may be 80, 132 (default), or 'unlimited' for longer lines. The
# result is either "unknown", or the actual compiler flag required to to accept
...
...
@@ -16,74 +43,43 @@
#
# The flag is cached in the acx_cv_fc_line_length_[]LENGTH.
#
# Known flags:
# -f{free,fixed}-line-length-N with N 72, 80, 132, or 0 or none for none.
# gfortran: -ffree-line-length-none
# g95: -ffree-line-length-huge (also -ffixed-line-length-N as above)
# IBM: -qfixed=132 80 72
# Cray: -Mextend
# Intel: -132 -80 -72 (needs to come before -extend_source because ifort
# accepts that as well with an optional parameter and
# does not fail but only warns about unknown arguments)
# SGI: -extend_source
# Absoft: -W, -WNN (132, 80, 72)
# HP: +es, +extend_source (254 in either form, default is 72 fixed, 132 free)
# Lahey/Fujitsu: -w, (-)-wide (255 cols in fixed form)
# SUN: -e (132 characters)
# NAGWare: -132
# f2c: -72, -f, -Wf,-f: f2c (a weak form of "free-form" and long lines)
# Open Watcom: /XLine
# The implementation patches the standard Autoconf macro AC_FC_LINE_LENGTH to
# reduce the number of LANG switches and to avoid false negative results with
# the GFortran '-fimplicit-none' flag.
#
AC_DEFUN([ACX_FC_LINE_LENGTH],
[AC_LANG_ASSERT([Fortran])dnl
dnl Fail instead of warning:
m4_bmatch(m4_default([$1], [132]),
[unlimited\|132\|80], [],
[m4_fatal([Invalid LENGTH argument for $0: '$1'])])dnl
dnl Monkey-patch AC_FC_LINE_LENGTH:
m4_pushdef([acx_cache_var], [acx_cv_fc_line_length_$1])dnl
AC_MSG_CHECKING([for fortran flag needed to accept dnl
m4_default([$1], [132]) column source lines])
m4_pushdef([ac_cv_fc_line_length], [acx_cache_var])dnl
m4_pushdef([acx_orig_macro],
m4_bpatsubsts(m4_dquote(m4_defn([AC_FC_LINE_LENGTH])),
[\$ac_fc_line_length_test$], [\&
implicit integer (a)],
[AC_LANG_P\(OP\|USH\)(\[?Fortran\]?)], [dn][l ]))dnl
dnl This macro does not have a special meaning for the value 'none'
dnl but AC_FC_LINE_LENGTH does. To account for the difference, we need to know
dnl whether 'none' came from the cache variable and set the cache variable to
dnl 'none' if it is set to an empty string:
acx_fc_line_length_none_in_cache=no
AS_VAR_SET_IF([acx_cache_var],
[AS_ECHO_N(["(cached) "]) >&AS_MESSAGE_FD],
[acx_cache_var=unknown
m4_case(m4_default([$1], [132]),
[unlimited],
[acx_flag_suffix=0
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
subroutine longer_than_132(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19)
implicit none
integer :: arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19
end subroutine]])])],
[132],
[acx_flag_suffix=132
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
subroutine longer_than_80(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
implicit none
integer :: arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10
end subroutine]])])],
[80],
[acx_flag_suffix=80
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
subroutine longer_than_72(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
implicit none
integer :: arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9
end subroutine]])])],
[m4_fatal([Invalid LENGTH argument for ACX_FC_LINE_LENGTH: '$1'])])
acx_save_FCFLAGS=$FCFLAGS
for acx_flag in '' \
-ffree-line-length-none -ffixed-line-length-none \
-ffree-line-length-huge \
-ffree-line-length-$acx_flag_suffix \
-ffixed-line-length-$acx_flag_suffix \
-qfixed=$acx_flag_suffix -Mextend \
-$acx_flag_suffix -extend_source \
-W$acx_flag_suffix -W +extend_source +es -wide --wide -w -e \
-f -Wf,-f -xline; do
FCFLAGS="$acx_save_FCFLAGS $acx_flag"
AC_COMPILE_IFELSE([],[acx_cache_var=$acx_flag])
test "x$acx_cache_var" != xunknown && break
done
rm -f conftest.$ac_ext
FCFLAGS=$acx_save_FCFLAGS])
AS_IF([test -n "$acx_cache_var"],
[AC_MSG_RESULT([$acx_cache_var])],
[AC_MSG_RESULT([none needed])])
[AS_CASE([$acx_cache_var],
[none], [acx_fc_line_length_none_in_cache=yes],
[''], [acx_cache_var=none])])
dnl AC_FC_LINE_LENGTH changes the FCFLAGS, which we do not want:
acx_save_FCFLAGS=$FCFLAGS
m4_quote(acx_orig_macro([$1], [], [:]))
FCFLAGS=$acx_save_FCFLAGS
m4_popdef([acx_orig_macro])dnl
m4_popdef([ac_cv_fc_line_length])dnl
dnl Set the cache variable to an empty string if the value 'none' was set by
dnl AC_FC_LINE_LENGTH but not if the variable had it before the expansion:
AS_IF([test "x$acx_cache_var$acx_fc_line_length_none_in_cache" = xnoneno],
[acx_cache_var=])
AS_VAR_IF([acx_cache_var], [unknown],
[m4_default([$3],
[AC_MSG_FAILURE([unable to detect Fortran compiler flag needed to dnl
...
...
This diff is collapsed.
Click to expand it.
m4/acx_fc_pp.m4
+
53
−
61
View file @
40224a82
# Copyright (c) 2018-2024, MPI-M
#
# Author: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ACX_FC_PP_SRCEXT(EXTENSION,
# [ACTION-IF-SUCCESS],
# [ACTION-IF-FAILURE = FAILURE])
# -----------------------------------------------------------------------------
# Originally taken from the master branch of Autoconf where it is known as
# AC_FC_PP_SRCEXT.
# -----------------------------------------------------------------------------
# Finds the Fortran compiler flag needed to enable Fortran preprocessing for
# source files with extension EXTENSION. The result is either "unknown",
# or the actual compiler flag required to enable Fortran preprocessing, which
...
...
@@ -21,70 +48,35 @@
# The flag is cached in the acx_cv_fc_pp_srcext_[]EXTENSION, which may contain
# whitespaces.
#
# Known flags:
# gfortran: -cpp
# SGI: -ftpp
# SUN: -xpp={fpp,cpp}
# IBM: -qsuffix=cpp=EXTENSION
# HP: +cpp
# PGI: -Mpreprocess
# Absoft: -cpp
# Cray: -e T, -e Z
# Intel: -fpp (-Tf may also be needed right before the source file name)
# PathScale: -ftpp, -cpp
# Lahey: -Cpp
# NAGWare: -fpp
# Compaq/Tru64: -cpp
# f2c: -cpp
# g95: -cpp
# The implementation patches the standard Autoconf macro AC_FC_PP_SRCEXT to
# reduce the number of LANG switches and to support additional known compiler
# flags:
# Cray: -e T (must precede -e Z, which triggers generation of unwanted *.i
# flags and crashes old versions of the compiler at the linking
# stage)
#
AC_DEFUN([ACX_FC_PP_SRCEXT],
[
m4_provide([AC_FC_PP_SRCEXT
])dnl
AC_LANG_ASSERT([Fortran])dnl
[
AC_LANG_ASSERT([Fortran
])dnl
acx_ext_save=$ac_ext
m4_pushdef([acx_cache_var], [acx_cv_fc_pp_srcext_$1])dnl
AC_MSG_CHECKING([for Fortran compiler flag needed to compile dnl
preprocessed .$1 files])
AS_VAR_SET_IF([acx_cache_var],
[AS_ECHO_N(["(cached) "]) >&AS_MESSAGE_FD],
[acx_cache_var=unknown
acx_ext_save=$ac_ext
acx_fcflags_srcext_save=$ac_fcflags_srcext
ac_ext=$1
AS_CASE([$acx_fc_pp_srcext_ext],
[[[fF]]77], [acx_fc_pp_srcext_try=f77-cpp-input],
[acx_fc_pp_srcext_try=f95-cpp-input])
for ac_fcflags_srcext in '' -ftpp -fpp -Tf '-fpp -Tf' -xpp=fpp dnl
-Mpreprocess '-e T' '-e Z' -cpp -xpp=cpp -qsuffix=cpp=$1 dnl
"-x $acx_fc_pp_srcext_try" +cpp -Cpp; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#if 0
#include <ac_nonexistent.h>
choke me
#endif]])],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#if 1
#include <ac_nonexistent.h>
choke me
#endif]])],
[],
[acx_cache_var=$ac_fcflags_srcext])])
test "x$acx_cache_var" != xunknown && break
done
ac_fcflags_srcext=$acx_fcflags_srcext_save
ac_ext=$acx_ext_save])
AS_IF([test -n "$acx_cache_var"],
[AC_MSG_RESULT([$acx_cache_var])],
[AC_MSG_RESULT([none needed])])
AC_SUBST([FCFLAGS_][$1])
m4_pushdef([ac_cv_fc_pp_srcext_$1], [acx_cache_var])dnl
m4_pushdef([AC_CACHE_CHECK],
m4_bpatsubst(m4_dquote(m4_defn([AC_CACHE_CHECK])),
[\$][1],
[for Fortran compiler flag needed to compile preprocessed .$1 files]))dnl
m4_pushdef([AC_FC_PP_SRCEXT],
m4_bpatsubsts(m4_dquote(m4_defn([AC_FC_PP_SRCEXT])),
["-e Z"], ["-e T" \&],
[AC_LANG_P\(OP\|USH\)(\[?Fortran\]?)], [dn][l ]))dnl
AC_FC_PP_SRCEXT([$1], [], [:])
m4_popdef([AC_FC_PP_SRCEXT])dnl
m4_popdef([AC_CACHE_CHECK])dnl
m4_popdef([ac_cv_fc_pp_srcext_$1])dnl
AS_VAR_IF([acx_cache_var], [unknown],
[ac_fcflags_srcext=
AS_VAR_COPY([FCFLAGS_][$1], [ac_fcflags_srcext])
[ac_ext=$acx_ext_save
m4_default([$3],
[AC_MSG_FAILURE([unable to detect Fortran compiler flag needed to dnl
compile preprocessed .$1 files])])],
[ac_fcflags_srcext=$acx_cache_var
AS_VAR_COPY([FCFLAGS_][$1], [ac_fcflags_srcext])
ac_fc_srcext=$1
AS_VAR_COPY([ac_ext], [ac_fc_srcext])
[ac_ext=$ac_fc_srcext
$2])
m4_popdef([acx_cache_var])])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment