"Fossies" - the Fresh Open Source Software Archive

Member "scalasca-2.6/build-config/common/m4/ac_common_package.m4" (19 Apr 2021, 7720 Bytes) of package /linux/misc/scalasca-2.6.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ## -*- mode: autoconf -*-
    2 
    3 ##
    4 ## This file is part of the Score-P software (http://www.score-p.org)
    5 ##
    6 ## Copyright (c) 2009-2012,
    7 ## RWTH Aachen University, Germany
    8 ##
    9 ## Copyright (c) 2009-2012,
   10 ## Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
   11 ##
   12 ## Copyright (c) 2009-2014,
   13 ## Technische Universitaet Dresden, Germany
   14 ##
   15 ## Copyright (c) 2009-2012,
   16 ## University of Oregon, Eugene, USA
   17 ##
   18 ## Copyright (c) 2009-2012,
   19 ## Forschungszentrum Juelich GmbH, Germany
   20 ##
   21 ## Copyright (c) 2009-2012,
   22 ## German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
   23 ##
   24 ## Copyright (c) 2009-2012,
   25 ## Technische Universitaet Muenchen, Germany
   26 ##
   27 ## This software may be modified and distributed under the terms of
   28 ## a BSD-style license.  See the COPYING file in the package base
   29 ## directory for details.
   30 ##
   31 
   32 ## file       ac_common_package.m4
   33 
   34 # AFS_PACKAGE_INIT
   35 # ----------------
   36 # Common AC_DEFINE's and AC_SUBST's for the package based on its name.
   37 # Call this only in the top-level configure.ac, sub-builds should call
   38 # `AFS_PACKAGE_BUILD_INIT`.
   39 #
   40 # List of defined autoconf macros:
   41 #  `AFS_PACKAGE_name`::       The tarname of the package in lower case and
   42 #                             runs of non-alphanumeric characters are converted
   43 #                             to a single underscore
   44 #  `AFS_PACKAGE_NAME`::       The value of AFS_PACKAGE_name in upper case
   45 #  `AFS_PACKAGE_TO_TOP`::     Empty
   46 # List of provided automake substitutions:
   47 #  `AFS_PACKAGE_name`::       The value of AFS_PACKAGE_name
   48 #  `AFS_PACKAGE_NAME`::       The value of AFS_PACKAGE_NAME
   49 #  'afs_srcdir'::             Same as $srcdir
   50 #
   51 AC_DEFUN_ONCE([AFS_PACKAGE_INIT], [
   52 
   53 m4_case([$#],
   54     [0], [],
   55     [1], [m4_ifnblank($1, [m4_fatal([$0: too many arguments: $@])])],
   56     [m4_fatal([$0: too many arguments: $@])])dnl
   57 
   58 m4_pushdef([_afs_package_tmp],
   59     m4_bpatsubst(m4_tolower(AC_PACKAGE_TARNAME), [[^a-z0-9]+], [_]))dnl
   60 AC_SUBST([AFS_PACKAGE_name], _afs_package_tmp)
   61 m4_define([AFS_PACKAGE_name], _afs_package_tmp)dnl
   62 m4_popdef([_afs_package_tmp])dnl
   63 
   64 m4_pushdef([_afs_package_tmp], m4_toupper(AC_PACKAGE_TARNAME))dnl
   65 AC_SUBST([AFS_PACKAGE_NAME], _afs_package_tmp)
   66 m4_define([AFS_PACKAGE_NAME], _afs_package_tmp)dnl
   67 m4_popdef([_afs_package_tmp])dnl
   68 
   69 dnl May be redefined by AFS_PACKAGE_BUILD_INIT
   70 m4_define([AFS_PACKAGE_TO_TOP], [])dnl
   71 
   72 afs_srcdir=$srcdir
   73 AC_SUBST([afs_srcdir])
   74 ])
   75 
   76 # AFS_PACKAGE_BUILD_INIT(BUILD-NAME, [TO-TOP])
   77 # --------------------------------------------
   78 # Initializes an sub-build configure. It is sufficient to call
   79 # `AFS_PACKAGE_BUILD_INIT`, `AFS_PACKAGE_INIT` will be called automatically.
   80 #
   81 # The relative path to the top-level configure from this configure
   82 # can be specified with TO-TOP, it must contain a trailing slash,
   83 # defaulting to `../`.
   84 #
   85 # List of defined autoconf macros:
   86 #  `AFS_PACKAGE_BUILD`::      The normalized name of the build (e.g., 'backend',
   87 #                             'MPI backend')
   88 #  `AFS_PACKAGE_BUILD_name`:: The build name usable as a symbol in lower case
   89 #                             (i.e., only alphanumeric characters and underscore,
   90 #                             e.g., backend, mpi_backend)
   91 #  `AFS_PACKAGE_BUILD_NAME`:: The value of AFS_PACKAGE_BUILD_name in upper case
   92 #                             (e.g., BACKEND, MPI_BACKEND)
   93 # List of provided automake substitutions:
   94 #  'AFS_PACKAGE_BUILD_name'   The value of AFS_PACKAGE_BUILD_name
   95 #  'AFS_PACKAGE_BUILD_NAME'   The value of AFS_PACKAGE_BUILD_NAME
   96 #  `AFS_PACKAGE_TO_TOP`::     The value of TO-TOP
   97 #  'afs_srcdir'::             $srcdir joined with AFS_PACKAGE_TO_TOP without
   98 #                             trailing slash (i.e., full path to the top-level
   99 #                             source)
  100 # List of provided config header defines:
  101 #  `AFS_PACKAGE_BUILD`::      The value of AFS_PACKAGE_BUILD as a string
  102 #                             constant
  103 #  `AFS_PACKAGE_BUILD_name`:: The value of AFS_PACKAGE_BUILD_name
  104 #  `AFS_PACKAGE_BUILD_NAME`:: The value of AFS_PACKAGE_BUILD_NAME
  105 #  `AFS_PACKAGE_SRCDIR`::     The relative path to the source directory as
  106 #                             string constant including a trailing slash
  107 #  `AFS_PACKAGE_name`::       The value of AFS_PACKAGE_name
  108 #  `AFS_PACKAGE_NAME`::       The value of AFS_PACKAGE_NAME
  109 #
  110 AC_DEFUN_ONCE([AFS_PACKAGE_BUILD_INIT], [
  111 AC_REQUIRE([AFS_PACKAGE_INIT])dnl
  112 
  113 m4_case([$#],
  114     [0], [m4_fatal([$0: missing arguments])],
  115     [1], [m4_ifblank(m4_normalize($1), [m4_fatal([$0: empty BUILD-NAME argument])])],
  116     [2], [m4_ifblank(m4_normalize($1), [m4_fatal([$0: empty BUILD-NAME argument])])],
  117     [m4_fatal([$0: too many arguments: $@])])dnl
  118 
  119 m4_pushdef([_afs_package_tmp], m4_normalize($1))dnl
  120 AC_DEFINE_UNQUOTED([AFS_PACKAGE_BUILD], "_afs_package_tmp",
  121     [Name of the sub-build.])
  122 m4_define([AFS_PACKAGE_BUILD], _afs_package_tmp)dnl
  123 m4_popdef([_afs_package_tmp])dnl
  124 
  125 dnl Overwrites AFS_PACKAGE_TO_TOP defined in AFS_PACKAGE_INIT.
  126 m4_pushdef([_afs_package_tmp],
  127     m4_bpatsubst(m4_default([$2], [../]), [/+], [/]))dnl
  128 m4_if(m4_substr(_afs_package_tmp, decr(len(_afs_package_tmp))), [/],
  129     [], [m4_fatal([$0: no trailing slash in TO-TOP argument: ]$2)])
  130 dnl undefine previously defined by AFS_PACKAGE_INIT
  131 m4_undefine([AFS_PACKAGE_TO_TOP])
  132 AC_SUBST([AFS_PACKAGE_TO_TOP], _afs_package_tmp)
  133 m4_define([AFS_PACKAGE_TO_TOP], _afs_package_tmp)dnl
  134 m4_popdef([_afs_package_tmp])dnl
  135 
  136 dnl when building inplace, $srcdir equals ., ignore $srcdir than
  137 dnl AC_SUBST already in AFS_PACKAGE_INIT
  138 AS_CASE([$srcdir],
  139     [.], [afs_srcdir="]AFS_PACKAGE_TO_TOP["],
  140     [afs_srcdir="${srcdir}/]AFS_PACKAGE_TO_TOP["])
  141 dnl AFS_PACKAGE_SRCDIR still has the trailing slash
  142 AC_DEFINE_UNQUOTED([[AFS_PACKAGE_SRCDIR]],
  143     ["${afs_srcdir}"], [Relative path to the top-level source directory.])
  144 dnl Now remove the trailing slash
  145 afs_srcdir=${afs_srcdir%/}
  146 
  147 m4_pushdef([_afs_package_tmp],
  148     m4_bpatsubst(m4_tolower(m4_normalize($1)), [[^a-z0-9]+], [_]))dnl
  149 AC_DEFINE_UNQUOTED([AFS_PACKAGE_BUILD_name], _afs_package_tmp,
  150     [Symbol name of the sub-build in lower case.])
  151 AC_SUBST([AFS_PACKAGE_BUILD_name], _afs_package_tmp)
  152 m4_define([AFS_PACKAGE_BUILD_name], _afs_package_tmp)dnl
  153 m4_popdef([_afs_package_tmp])dnl
  154 
  155 m4_pushdef([_afs_package_tmp],
  156     m4_toupper(AFS_PACKAGE_BUILD_name))dnl
  157 AC_DEFINE_UNQUOTED([AFS_PACKAGE_BUILD_NAME], _afs_package_tmp,
  158     [Symbol name of the sub-build in upper case.])
  159 AC_SUBST([AFS_PACKAGE_BUILD_NAME], _afs_package_tmp)
  160 m4_define([AFS_PACKAGE_BUILD_NAME], _afs_package_tmp)dnl
  161 m4_popdef([_afs_package_tmp])dnl
  162 
  163 AC_DEFINE_UNQUOTED([[AFS_PACKAGE_name]], AFS_PACKAGE_name,
  164     [The package name usable as a symbol in lower case.])
  165 
  166 AC_DEFINE_UNQUOTED([[AFS_PACKAGE_NAME]], AFS_PACKAGE_NAME,
  167     [The package name usable as a symbol in upper case.])
  168 ])
  169 
  170 # AC_SCOREP_DEFINE_HAVE(VARIABLE, VALUE[, DESCRIPTION])
  171 # ------------------------------------------------------
  172 # Like AC_DEFINE, but prepends the HAVE_ prefix and also defines the
  173 # HAVE_'PACKAGE_BUILD'_ variant, if in a sub configure by utilizing the
  174 # AFS_PACKAGE_BUILD_NAME macro.
  175 #
  176 AC_DEFUN([AC_SCOREP_DEFINE_HAVE], [
  177 AC_DEFINE([HAVE_]$1, [$2], [$3])
  178 m4_ifdef([AFS_PACKAGE_BUILD], [
  179     AC_DEFINE([HAVE_]AFS_PACKAGE_BUILD_NAME[_]$1, [$2], [$3])
  180 ])
  181 ])
  182 
  183 # AC_SCOREP_COND_HAVE(VARIABLE, CONDITION[, DESCRIPTION[, COND_TRUE[, COND_FALSE]]])
  184 # --------------------------------------------------
  185 # Convenience macro to define a AM_CONDITIONAL and always a
  186 # AC_SCOREP_DEFINE_HAVE at once. VARIABLE will be prefixed with HAVE_
  187 #
  188 AC_DEFUN([AC_SCOREP_COND_HAVE], [
  189 AM_CONDITIONAL(HAVE_[]$1, [$2])
  190 AM_COND_IF(HAVE_[]$1,
  191            [AC_SCOREP_DEFINE_HAVE([$1], [1], [$3])
  192             $4],
  193            [AC_SCOREP_DEFINE_HAVE([$1], [0], [$3])
  194             $5])
  195 ])