diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000000000000000000000000000000000..7d1f9c9d0b64a0ec85db9c3b0c36ea788b11c9b8 --- /dev/null +++ b/.clang-format @@ -0,0 +1,187 @@ +# This file represents the coding style enforced by PRRTE. This file +# is based on the long-held, but not enforced, guidelines from the +# beginning of the project. We will be requiring that all code going +# forward uses this style. To check your code before attempting to open +# a PR install clang-format and run your commits through clang-format. +# +# To install clang-format: +# +# macOS: +# Homebrew: brew install clang-format +# Mac Ports: port install clang +# +# Linux: +# debian/ubuntu/rasbian: apt-get install clang-format +# redhat/fedora: yum install clang-format +# +# To run against your code changes: +# +# unstaged changes: git clang-format --style file -f +# staged changes: git clang-format --style file +# +# For interactive add the -p option. +# +# To run against all of PRRTE: +# +# ./contrib/clang-format-prte.sh +# +# This command is intended to be run only once. +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: true +AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: true +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH + - BOOST_FOREACH + - PMIX_LIST_FOREACH + - PMIX_LIST_FOREACH_DECL + - PMIX_LIST_FOREACH_SAFE + - PMIX_LIST_FOREACH_REV + - PMIX_LIST_FOREACH_SAFE_REV + - PMIX_HASH_TABLE_FOREACH + - PMIX_HASH_TABLE_FOREACH_PTR +IncludeBlocks: Preserve +IncludeCategories: + # Ensure config includes always come first (prte_config.h, etc) + - Regex: '^".*_config\.h"' + Priority: -1 + # In-tree includes come next (after main include) + - Regex: '^".*"' + Priority: 2 + # System includes come last + - Regex: '^<.*>' + Priority: 3 +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: false +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: AfterHash +IndentExternBlock: AfterExternBlock +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 4 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 250 +PenaltyBreakBeforeFirstCallParameter: 301 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Latest +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION + - BEGIN_C_DECLS + - END_C_DECLS +TabWidth: 8 +UseCRLF: false +UseTab: Never +WhitespaceSensitiveMacros: + - _STRINGIZE + - STRINGIZE + - PP_STRINGIZE + - BOOST_PP_STRINGIZE +... + diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..7fab3454800716cb8d2591848ddc3d674f200b90 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,34 @@ +## How to contribute to the PMIx Reference Server + +General information about contributing to the PMIx project can be found at the [Contributing to PMIx webpage](https://pmix.org/code/contribute/). +The instructions below are specifically for opening issues and pull requests against the PMIx Reference Server. + +#### **Did you find a bug?** + +* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/pmix/pmix-reference-server/issues). + +* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/pmix/pmix-reference-server/issues/new). + +* For more detailed information on submitting a bug report and creating an issue, visit our [FAQ](https://pmix.org/support/faq). + +#### **Did you write a patch that fixes a bug?** + +* Open a new GitHub pull request with the patch. + +* Ensure the PR description clearly describes the problem and solution. If there is an existing GitHub issue open describing this bug, please include it in the description so we can close it. + +* Before submitting, please read the [Contributing to the PMIx Project FAQ](https://pmix.org/support/faq/contributing) and the [SubmittingPullRequests](https://pmix.org/support/faq/submitting-pull-requests) web pages. In particular, note that all git commits contributed to PMIx (including the reference server) require a Signed-off by line. + +#### **Do you intend to add a new feature or change an existing one?** + +* Suggest your change on the [devel mail list](https://groups.google.com/forum/#!forum/pmix) and start writing code. + +* Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes. + +#### **Do you have questions about the source code?** + +* We are working to provide more online info about the PMIx code. A paper describing the [multi-component architecture](https://www.open-mpi.org/papers/ics-2004/ics-2004.pdf) of Open MPI (also used in PMIx and the reference server) may also be helpful. The [devel mail list](https://groups.google.com/forum/#!forum/pmix) is a good place to post questions about the source code as well. + +Thanks + +The PMIx Team diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000000000000000000000000000000000000..0e278b20acce042aa076ffcffa128cdcd8b206dd --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,24 @@ +Thank you for taking the time to submit an issue! + +## Background information + +### What version of the PMIx Reference Server are you using? (e.g., v1.0, v2.1, git master @ hash, etc.) + +##### What version of PMIx are you using? (e.g., v1.2.5, v2.0.3, v2.1.0, git branch name and hash, etc.) + +### Please describe the system on which you are running + +* Operating system/version: +* Computer hardware: +* Network type: + +----------------------------- + +## Details of the problem + +Please describe, in detail, the problem that you are having, including the behavior you expect to see, the actual behavior that you are seeing, steps to reproduce the problem, etc. It is most helpful if you can attach a small program that a developer can use to reproduce your problem. + +**Note**: If you include verbatim output (or a code block), please use a [GitHub Markdown](https://help.github.com/articles/creating-and-highlighting-code-blocks/) code block like below: +```shell +shell$ prun -np 2 ./hello_world +``` diff --git a/.github/workflows/builds.yaml b/.github/workflows/builds.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cc219811cdd88d05b9fe281aa3cbc02efe405131 --- /dev/null +++ b/.github/workflows/builds.yaml @@ -0,0 +1,200 @@ +name: Build tests + +on: [pull_request] + +jobs: + macos: + runs-on: macos-latest + strategy: + matrix: + path: ['non-vpath', 'vpath'] + sphinx: ['no-sphinx', 'sphinx'] + steps: + - name: Install dependencies + run: brew install libevent hwloc autoconf automake libtool + - name: Git clone OpenPMIx + uses: actions/checkout@v3 + with: + submodules: recursive + repository: openpmix/openpmix + path: openpmix/master + ref: master + - name: Build OpenPMIx + run: | + cd openpmix/master + # Homebrew doesn't install Libevent's (or libev's) header or + # library files into a default search location. Shrug. So + # use pkg-config to get the location and explicitly pass it to + # configure. + libevent_cppflags=$(pkg-config libevent --cflags) + libevent_ldflags=$(pkg-config libevent --libs | perl -pe 's/^.*(-L[^ ]+).*$/\1/') + ./autogen.pl + ./configure --prefix=$RUNNER_TEMP/pmixinstall \ + CPPFLAGS=$libevent_cppflags \ + LDFLAGS=$libevent_ldflags + make -j + make install + - name: Git clone PRRTE + uses: actions/checkout@v3 + with: + submodules: recursive + clean: false + - name: Build PRRTE + run: | + ./autogen.pl + + sphinx= + if test "${{ matrix.sphinx }}" = sphinx; then + # The macos Github Action environment gets angry at us if + # we try to pip install into the global environment. So + # make a virtual environment and install sphinx into that. + python -m venv venv + . ./venv/bin/activate + pip3 install -r docs/requirements.txt + sphinx=--enable-sphinx + fi + + c=./configure + if test "${{ matrix.path }}" = vpath; then + mkdir build + cd build + c=../configure + fi + + # Homebrew doesn't install Libevent's (or libev's) header or + # library files into a default search location. Shrug. So + # use pkg-config to get the location and explicitly pass it to + # configure. + libevent_cppflags=$(pkg-config libevent --cflags) + libevent_ldflags=$(pkg-config libevent --libs | perl -pe 's/^.*(-L[^ ]+).*$/\1/') + + $c --prefix=$RUNNER_TEMP/prteinstall --with-pmix=$RUNNER_TEMP/pmixinstall $sphinx \ + CPPFLAGS=$libevent_cppflags \ + LDFLAGS=$libevent_ldflags + make -j + make install + make uninstall + + ubuntu: + runs-on: ubuntu-latest + strategy: + matrix: + path: ['non-vpath', 'vpath'] + sphinx: ['no-sphinx', 'sphinx'] + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends software-properties-common libhwloc-dev libevent-dev + - name: Git clone OpenPMIx + uses: actions/checkout@v3 + with: + submodules: recursive + repository: openpmix/openpmix + path: openpmix/master + ref: master + - name: Build OpenPMIx + run: | + cd openpmix/master + ./autogen.pl + ./configure --prefix=$RUNNER_TEMP/pmixinstall + make -j + make install + - name: Git clone PRRTE + uses: actions/checkout@v3 + with: + submodules: recursive + clean: false + - name: Build PRRTE + run: | + ./autogen.pl + + sphinx= + if test "${{ matrix.sphinx }}" = sphinx; then + pip3 install -r docs/requirements.txt + sphinx=--enable-sphinx + fi + + c=./configure + if test "${{ matrix.path }}" = vpath; then + mkdir build + cd build + c=../configure + fi + + $c --prefix=$RUNNER_TEMP/prteinstall --with-pmix=$RUNNER_TEMP/pmixinstall $sphinx + make -j + make install + make uninstall + + ubuntuClang: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends software-properties-common libhwloc-dev libevent-dev clang + - name: Git clone OpenPMIx + uses: actions/checkout@v3 + with: + submodules: recursive + repository: openpmix/openpmix + path: openpmix/master + ref: master + - name: Build OpenPMIx + run: | + cd openpmix/master + ./autogen.pl + CC=clang ./configure --prefix=$RUNNER_TEMP/pmixinstall + make -j + make install + - name: Git clone PRRTE + uses: actions/checkout@v3 + with: + submodules: recursive + clean: false + - name: Build PRRTE + run: | + ./autogen.pl + + pip3 install -r docs/requirements.txt + sphinx=--enable-sphinx + + c=./configure + CC=clang $c --prefix=$RUNNER_TEMP/prteinstall --with-pmix=$RUNNER_TEMP/pmixinstall $sphinx + make -j + make install + make uninstall + + distcheck: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends software-properties-common libhwloc-dev libevent-dev python3 python3-pip + - name: Git clone OpenPMIx + uses: actions/checkout@v3 + with: + submodules: recursive + repository: openpmix/openpmix + path: openpmix/master + ref: master + - name: Build OpenPMIx + run: | + cd openpmix/master + ./autogen.pl + ./configure --prefix=$RUNNER_TEMP/pmixinstall + make -j + make install + - name: Git clone PRRTE + uses: actions/checkout@v3 + with: + submodules: recursive + clean: false + - name: Distcheck + run: | + pip install -r docs/requirements.txt + ./autogen.pl + ./configure --prefix=$RUNNER_TEMP/prteinstall --with-pmix=$RUNNER_TEMP/pmixinstall --enable-sphinx + make distcheck AM_DISTCHECK_MAKEFLAGS=-j AM_DISTCHECK_CONFIGURE_FLAGS="--with-pmix=$RUNNER_TEMP/pmixinstall" diff --git a/.github/workflows/close-stale-issues.yaml b/.github/workflows/close-stale-issues.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5f57cac2398a5bbb48d9d031e793f61407e4d321 --- /dev/null +++ b/.github/workflows/close-stale-issues.yaml @@ -0,0 +1,65 @@ +# The idea behind this Action is to prevent the situation where a user +# files a Github Issue, someone asks for clarification / more +# information, but the original poster never provides the information. +# The issue then becomes forgotten and abondoned. +# +# Instead of that scenario, PMIx community members can assign a +# label to Github Issues indicating that we're waiting for the user to +# reply. If too much time elapses with no reply, mark the Issue as +# stale and emit a warning that we'll close the issue if we continue +# to receive no reply. If we timeout again with no reply after the +# warning, close the Issue and emit a comment explaining why. +# +# If the user *does* reply, the label is removed, and this bot won't +# touch the Issue. Specifically: this bot will never mark stale / +# close an Issue that doesn't have the specified label. +# +# Additionally, we are *only* marking stale / auto-closing Github +# Issues -- not Pull Requests. +# +# This is a cron-based Action that runs a few times a day, just so +# that we don't mark stale / close a bunch of issues all at once. +# +# While the actions/stale bot Action used here is capable of removing +# the label when a user replies to the Issue, we actually use a 2nd +# Action (removing-awaiting-user-info-label.yaml) to remove the label. +# We do this because that 2nd Action runs whenever a comment is +# created -- not via cron. Hence, the 2nd Action will remove the +# label effectively immediately when the user replies (vs. up to +# several hours later). + +name: Close stale issues +on: + schedule: + # Run it a few times a day so as not to necessarily mark stale / + # close a bunch of issues at once. + - cron: '0 1,5,9,13,17,21 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + # https://github.com/marketplace/actions/close-stale-issues + - uses: actions/stale@v9 + with: + # If there are no replies for 14 days, mark the issue as + # "stale" (and emit a warning). + days-before-stale: 14 + # If there are no replies for 14 days after becoming stale, + # then close the issue (and emit a message explaining why). + days-before-close: 14 + + # Never close PRs + days-before-pr-close: -1 + + # We only close issues with this label + only-labels: "Awaiting response" + close-issue-label: Closed due to no reply + + # Messages that we put in comments on issues + stale-issue-message: | + It looks like this issue is expecting a response, but hasn't gotten one yet. If there are no responses in the next 2 weeks, we'll assume that the issue has been abandoned and will close it. + close-issue-message: | + Per the above comment, it has been a month with no reply on this issue. It looks like this issue has been abandoned. + + I'm going to close this issue. If I'm wrong and this issue is *not* abandoned, please feel free to re-open it. Thank you! diff --git a/.github/workflows/pr-target.yaml b/.github/workflows/pr-target.yaml new file mode 100644 index 0000000000000000000000000000000000000000..77958e1628496192a7ec81348de1a42d8f2d74e3 --- /dev/null +++ b/.github/workflows/pr-target.yaml @@ -0,0 +1,29 @@ +name: PR Checks CI + +# We're using pull_request_target here instead of just pull_request so that the +# action runs in the context of the base of the pull request, rather than in the +# context of the merge commit. For more detail about the differences, see: +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target +on: + pull_request_target: + # We don't need this to be run on all types of PR behavior + # See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request + types: + - opened + - synchronize + - edited + +permissions: {} # none + +jobs: + check: + permissions: + pull-requests: write + name: Check Commits + runs-on: ubuntu-latest + steps: + - name: Pull Request Commit Checker + uses: open-mpi/pr-git-commit-checker@v1.0.1 + with: + token: "${{ secrets.GITHUB_TOKEN}}" + cherry-pick-required: true diff --git a/.github/workflows/remove-awaiting-user-info-label.yaml b/.github/workflows/remove-awaiting-user-info-label.yaml new file mode 100644 index 0000000000000000000000000000000000000000..592264e34b2b10babdb6045a98152f6356b8529e --- /dev/null +++ b/.github/workflows/remove-awaiting-user-info-label.yaml @@ -0,0 +1,30 @@ +# This Action is run in conjunction with close-stale-issues.yaml. See +# that file for a more complete description of how they work together. + +name: 'Remove "Awaiting response" label when there has been a reply' +on: + issue_comment: + types: + - created + +jobs: + build: + runs-on: ubuntu-latest + # From + # https://github.com/marketplace/actions/close-issues-after-no-reply: + # only remove the label if someone replies to an issue who is not + # an owner or collaborator on the repo. + if: | + github.event.comment.author_association != 'OWNER' && + github.event.comment.author_association != 'COLLABORATOR' + steps: + - name: 'Remove "Awaiting response" label' + uses: octokit/request-action@v2.x + continue-on-error: true + with: + route: DELETE /repos/:repository/issues/:issue/labels/:label + repository: ${{ github.repository }} + issue: ${{ github.event.issue.number }} + label: "Awaiting response" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/run-special.yml b/.github/workflows/run-special.yml new file mode 100644 index 0000000000000000000000000000000000000000..01e77c8c395bbeed59f7509ad12e690dfe204176 --- /dev/null +++ b/.github/workflows/run-special.yml @@ -0,0 +1,33 @@ +name: PRRTE Special Builds Testing + +on: + pull_request: + # We don't need this to be run on all types of PR behavior + # See + # - https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request + # - https://frontside.com/blog/2020-05-26-github-actions-pull_request + types: + - opened + - synchronize + - edited + - reopened + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: docker.io + # github.repository as / + IMAGE_NAME: jjhursey/pmix-xver-tester + +jobs: + special-builds: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check out the code + uses: actions/checkout@v3 + with: + submodules: recursive + # Run the container tester + - name: Special Builds + run: docker run --rm -v ${GITHUB_WORKSPACE}:/home/pmixer/prrte --env PR_TARGET_BRANCH=${GITHUB_BASE_REF} -w /home/pmixer/pmix-tests/ci-builds ${{ env.IMAGE_NAME }}:latest /bin/bash -c 'git pull && ./run-all-prrte.sh && echo SUCCESS' + shell: bash diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3c16e466b5652eee0b7f2773d5d14dbbe1817a61 --- /dev/null +++ b/.gitignore @@ -0,0 +1,201 @@ +.libs +.deps +.libs +.dirstamp +.DS_Store +.cdt* +.project +.gdb* +cov-int + +.hgrc +.hgignore +.hg +.hgignore_local + +*.la +*.lo +*.o +*.so +*.a +*.dwarf +*.dSYM +*.S +*.loT +*.orig +*.rej +*.bak +*.class +*.xcscheme +*.out +*.plist +*.orig +*.obj +*.mod +*.i90 +*.ii +*.ti +*.exe +*.log +*.trs +*.sapp +*~ +*\\# + +Makefile +Makefile.in +static-components.h +*\\# +config.cache +aclocal.m4 +autom4te.cache +config.log +config.status +configure +configure.log.* +make.log.* +make.install.log.* +libtool +bin +lib +cscope.* +etags +GRTAGS +GSYMS +GTAGS +GPATH +vc70.pdb +.hgrc +.hgignore +.hg +.hgignore_local +stamp-h? +AUTHORS + +ar-lib +ylwrap +config.lt +config.guess +config.sub +depcomp +compile +install-sh +ltmain.sh +missing +mkinstalldirs +libtool.m4 +lt~obsolete.m4 +ltdl.m4 +argz.m4 +ltargz.m4 +ltsugar.m4 +ltversion.m4 +ltoptions.m4 + +config/project_list.m4 +config/autogen_found_items.m4 +config/test-driver +config/mca_no_configure_components.m4 +config/mca_m4_config_include.m4 +config/ext_no_configure_components.m4 +config/ext_m4_config_include.m4 +config/mca_library_paths.txt + +include/prte_version.h +contrib/docker/tmp + +examples/alloc +examples/bad_exit +examples/client +examples/client2 +examples/dmodex +examples/dynamic +examples/fault +examples/hello +examples/jctrl +examples/launcher +examples/log +examples/pmi1client +examples/probe +examples/pub +examples/showkeys +examples/target +examples/tool +examples/debugger/direct +examples/debugger/indirect +examples/debugger/attach +examples/debugger/daemon +examples/debugger/hello +examples/debugger/direct-multi +examples/debugger/indirect-multi +examples/debugger/stdincheck +examples/debugger/mpihello +examples/legacy +examples/colocate +examples/pset +examples/nodeid + +src/sys/powerpc/atomic-32.s +src/sys/powerpc/atomic-64.s +src/sys/powerpc/atomic-32-64.s + +src/mca/base/mca_base_parse_paramfile_lex.c + +src/mca/prteinstalldirs/config/install_dirs.h + +src/include/prte_config.h +src/include/prte_config.h.in +src/include/version.h +src/include/prte_frameworks.c +src/include/prte_frameworks.h +src/include/frameworks.h +src/include/prte_config.h + +src/mca/rmaps/rank_file/rmaps_rank_file_lex.c +src/mca/rmaps/rank_file/rankfile_lex.c + +src/tools/prun/prun +src/tools/prte_info/prte_info +src/tools/prted/prted +src/tools/prte/prte +src/tools/pcc/pcc +src/tools/pcc/pcc-wrapper-data.txt +src/tools/pterm/pterm +src/tools/psched/psched + +src/util/hostfile/hostfile_lex.c +src/util/keyval/keyval_lex.c +src/util/show_help_lex.c + +test/double-get +test/get-nofence +test/attachtest/app +test/attachtest/tool +test/get-immediate +test/abort +test/simple_spawn +test/hello +test/connect +test/loop_child +test/loop_spawn +test/reinit +test/cmspawn +test/qspawn +test/filegen +test/iostress +test/spawn_multiple +test/clichk + +docs/_build +docs/_static +docs/_static/css/custom.css +docs/_templates +src/docs/_build +src/docs/mca/mca.rst +src/docs/mca/help*rst +__pycache__ + +# Common Python virtual environment directory names +venv +py?? +docs-venv diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..8a21d3bf83cf1e989828c4dd87cefd3a2c8bddd2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "oac"] + path = config/oac + url = https://gitee.com/openeuler/oac.git + branch = main diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000000000000000000000000000000000..e8e71435ca9c1b1b841acf0b15dd9dbb0c8bd806 --- /dev/null +++ b/.mailmap @@ -0,0 +1,113 @@ +# This file exists to help consolidate names and email addresses +# (e.g., when people accidentally commit with an incorrect or local +# email address). Two common use cases: +# +# 1. Consolidate multiple email addresses from a single person. +# Example: one commit from John Smith is from +# and another is from +# , and a third is from +# . But they're all from +# the same John Smith person. +# +# 2. Consolidate misspellings / altername names from a single person. +# Example: one commit is from "John Smith" and another is from +# "John Smith, CONTRACTOR", and third is from "RocketMan 9982". But +# these are all really the same person, who can be listed once in +# AUTHORS as "John Smith". +# +# The format of this file is documented in git-shortlog(1). Specifically, +# a line like this: +# +# Proper Name +# +# means that when git sees "commit@email.xx" it will display +# "Proper Name " instead in certain circumstances. Those +# circumstances include: +# +# - git shortlog +# - git blame +# - git log --format=tformat:"%aN <%aE>" (and similar) +# + +Jeff Squyres +Jeff Squyres --quiet <--quiet> +Jeff Squyres + +George Bosilca + +Howard Pritchard +Howard Pritchard + +Andrew Friedley + +Devendar Bureddy + +Edgar Gabriel +Edgar Gabriel + +Gilles Gouaillardet + +Matias A Cabral +Matias A Cabral + +Pavel Shamis +Pavel Shamis +Pavel Shamis + +Todd Kordenbrock + +Yohann Burette +Yohann Burette + +MPI Team (bot) +MPI Team (bot) +MPI Team (bot) + +Yossi Itigin + +Josh Hursey +Josh Hursey + +Adrian Reber + +Elena Elkina +Elena Elkina + +Igor Ivanov +Igor Ivanov + +Mangala Jyothi Bhaskar +Mangala Jyothi Bhaskar + +Ralph Castain +Ralph Castain + +Rolf vandeVaart + +Karol Mroz + +Nadezhda Kogteva + +Thananon Patinyasakdikul + +Nysal Jan K A +Nysal Jan K A + +Zhi Ming Wang + +Annapurna Dasari + +L. R. Rajeshnarayanan + +Aurelien Bouteiller +Aurelien Bouteiller + +Alex Mikheev + +Thomas Naughton + +Geoffrey Paulsen + +Anandhi S Jayakumar + +Mohan Gandhi diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000000000000000000000000000000000000..44e0bbac5a7037aec11f4b430be334591dc706ab --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,23 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Currently, RTD needs to select an OS with OpenSSL>=1.1.1 because of +# urllib3's dependence on that system library. (alternately, pin urllib3<2 +# See https://github.com/urllib3/urllib3/issues/2168 +build: + os: ubuntu-22.04 + tools: + python: "3.10" + +python: + install: + - requirements: docs/requirements.txt + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + fail_on_warning: true diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..51678cd8e6f3ec5c7da4a752d9e1110a1d55ed86 --- /dev/null +++ b/LICENSE @@ -0,0 +1,101 @@ +Most files in this release are marked with the copyrights of the +organizations who have edited them. The copyrights below are in no +particular order and generally reflect members of the PMIx and +Open MPI core teams who have contributed code to this release. +The copyrights for code used under license from other parties are +included in the corresponding files. + +Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + University Research and Technology + Corporation. All rights reserved. +Copyright (c) 2004-2017 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. +Copyright (c) 2004-2010 High Performance Computing Center Stuttgart, + University of Stuttgart. All rights reserved. +Copyright (c) 2004-2008 The Regents of the University of California. + All rights reserved. +Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights + reserved. +Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved. +Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved. +Copyright (c) 2006-2017 Sandia National Laboratories. All rights reserved. +Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved. + Use is subject to license terms. +Copyright (c) 2006-2017 The University of Houston. All rights reserved. +Copyright (c) 2006-2009 Myricom, Inc. All rights reserved. +Copyright (c) 2007-2017 UT-Battelle, LLC. All rights reserved. +Copyright (c) 2007-2017 IBM Corporation. All rights reserved. +Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing + Centre, Federal Republic of Germany +Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany +Copyright (c) 2007 Evergrid, Inc. All rights reserved. +Copyright (c) 2008 Chelsio, Inc. All rights reserved. +Copyright (c) 2008-2009 Institut National de Recherche en + Informatique. All rights reserved. +Copyright (c) 2007 Lawrence Livermore National Security, LLC. + All rights reserved. +Copyright (c) 2007-2017 Mellanox Technologies. All rights reserved. +Copyright (c) 2006-2010 QLogic Corporation. All rights reserved. +Copyright (c) 2008-2017 Oak Ridge National Labs. All rights reserved. +Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2009-2015 Bull SAS. All rights reserved. +Copyright (c) 2010 ARM ltd. All rights reserved. +Copyright (c) 2016 ARM, Inc. All rights reserved. +Copyright (c) 2010-2011 Alex Brick . All rights reserved. +Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights + reserved. +Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +Copyright (c) 2011-2017 NVIDIA Corporation. All rights reserved. +Copyright (c) 2016 Broadcom Limited. All rights reserved. +Copyright (c) 2011-2017 Fujitsu Limited. All rights reserved. +Copyright (c) 2014-2015 Hewlett-Packard Development Company, LP. All + rights reserved. +Copyright (c) 2013-2017 Research Organization for Information Science (RIST). + All rights reserved. +Copyright (c) 2017-2018 Amazon.com, Inc. or its affiliates. All Rights + reserved. +Copyright (c) 2018 DataDirect Networks. All rights reserved. +Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. + +Copyright (c) 2023 Nanook Consulting. All rights reserved. +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +The copyright holders provide no reassurances that the source code +provided does not infringe any patent, copyright, or any other +intellectual property rights of third parties. The copyright holders +disclaim any liability to any recipient for claims brought against +recipient by any third party for infringement of that parties +intellectual property rights. + +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. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..1145e4272d9b404f6547ef64d37a1dc9bfaf42c7 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,43 @@ +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2009 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2006-2022 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2012-2015 Los Alamos National Security, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2018 Amazon.com, Inc. or its affiliates. +# All Rights reserved. +# Copyright (c) 2021-2023 Nanook Consulting. All rights reserved. +# Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +SUBDIRS = config contrib src include docs +EXTRA_DIST = README.md VERSION LICENSE autogen.pl + +include examples/Makefile.include + +# Check for common symbols. Use a "-hook" to increase the odds that a +# developer will see it at the end of their installation process. +install-exec-hook: + -@if test -d "$(top_srcdir)/.git"; then \ + $(top_srcdir)/config/find_common_syms \ + --brief \ + --top_builddir=$(top_builddir) \ + --top_srcdir=$(top_srcdir) \ + --objext=$(OBJEXT); \ + fi + +ACLOCAL_AMFLAGS = -I config diff --git a/Makefile.prte-rules b/Makefile.prte-rules new file mode 100644 index 0000000000000000000000000000000000000000..df136d92b4422b482a79d759b8a3552ff4474766 --- /dev/null +++ b/Makefile.prte-rules @@ -0,0 +1,33 @@ +# -*- makefile -*- +# Copyright (c) 2008-2022 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright (c) 2020 Intel, Inc. All rights reserved. +# Copyright (c) 2023 Nanook Consulting. All rights reserved. +# Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# A little verbosity magic; "make" will show the terse output. "make +# V=1" will show the actual commands used (just like the other +# Automake-generated cprtelation/linker rules). +V=0 + +PRTE_V_SPHINX_HTML = $(prte__v_SPHINX_HTML_$V) +prte__v_SPHINX_HTML_ = $(prte__v_SPHINX_HTML_$AM_DEFAULT_VERBOSITY) +prte__v_SPHINX_HTML_0 = @echo " GENERATE HTML docs"; + +PRTE_V_SPHINX_MAN = $(prte__v_SPHINX_MAN_$V) +prte__v_SPHINX_MAN_ = $(prte__v_SPHINX_MAN_$AM_DEFAULT_VERBOSITY) +prte__v_SPHINX_MAN_0 = @echo " GENERATE man pages"; + +PRTE_V_TXT = $(prte__v_TXT_$V) +prte__v_TXT_ = $(prte__v_TXT_$AM_DEFAULT_VERBOSITY) +prte__v_TXT_0 = @echo " GENERATE text files"; + +PRTE_V_LN_S = $(prte__v_LN_S_$V) +prte__v_LN_S_ = $(prte__v_LN_S_$AM_DEFAULT_VERBOSITY) +prte__v_LN_S_0 = @echo " LN_S " `basename $@`; diff --git a/README.md b/README.md index bc419ad2164b2854da222087f4d4219c46f64e88..72e173d7f865f3677f52c066a2b08e3a3f574125 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,24 @@ -# hpc-prrte +# PMIx Reference RunTime Environment (PRRTE) -#### 介绍 -hpc-prrte is the process manager of openmpi. It starts, stops, and manages parrallel computing tasks. +PRRTE is [the PMIx Reference RunTime +Environment](https://github.com/openpmix/prrte) -#### 软件架构 -软件架构说明 +## Official documentation +The PRRTE documentation can be viewed in the following ways: -#### 安装教程 +1. Online at https://docs.prrte.org/ +1. In self-contained (i.e., suitable for local viewing, without an + internet connection) in official distribution tarballs under + `docs/_build/html/index.html`. -1. xxxx -2. xxxx -3. xxxx +## Building the documentation locally -#### 使用说明 +The source code for PRRTE's docs can be found in the PRRTE Git +repository under the `docs` folder. -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +Developers who clone the PRRTE Git repository will not have the +HTML documentation and man pages by default; it must be built. +Instructions for how to build the PRRTE documentation can be found +here: +https://docs.prrte.org/en/latest/developers/sphinx.html diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..c9d501d6dffb481b513e389e1943b2a490f74bfe --- /dev/null +++ b/VERSION @@ -0,0 +1,100 @@ +# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011 NVIDIA Corporation. All rights reserved. +# Copyright (c) 2013 Mellanox Technologies, Inc. +# All rights reserved. +# Copyright (c) 2016 IBM Corporation. All rights reserved. +# Copyright (c) 2017 Los Alamos National Security, LLC. All rights +# reserved. + +# This is the VERSION file for PRRTE, describing the precise +# version of PRRTE in this distribution. The various components of +# the version number below are combined to form a single version +# number string. + +# major, minor, and release are generally combined in the form +# ... + +major=3 +minor=0 +release=6 + +# PRRTE required dependency versions. +# List in x.y.z format. + +pmix_min_version=4.2.4 +hwloc_min_version=1.11.0 +event_min_version=2.0.21 +automake_min_version=1.13.4 +autoconf_min_version=2.69.0 +libtool_min_version=2.4.2 +flex_min_version=2.5.4 + +# greek is generally used for alpha or beta release tags. If it is +# non-empty, it will be appended to the version number. It does not +# have to be numeric. Common examples include: a1 (alpha release 1), +# b1 (beta release 1), rc2 (release candidate 2). The only +# requirement is that it must be entirely printable ASCII characters +# and have no white space. + +greek=rc1 + +# If repo_rev is empty, then the repository version number will be +# obtained during "make dist" via the "git describe --tags --always" +# command, or with the date (if "git describe" fails) in the form of +# "date". + +repo_rev= + +# If tarball_version is not empty, it is used as the version string in +# the tarball filename, regardless of all other versions listed in +# this file. For example, if tarball_version is empty, the tarball +# filename will be of the form +# openmpi-...tar.*. However, if +# tarball_version is not empty, the tarball filename will be of the +# form openmpi-.tar.*. + +tarball_version=gitclone + +# The date when this release was created + +date="Nov 24, 2018" + +# The shared library version of each of PRRTE's public libraries. +# These versions are maintained in accordance with the "Library +# Interface Versions" chapter from the GNU Libtool documentation: +# +# - If the library source code has changed at all since the last +# update, then increment revision (`c:r:a' becomes `c:r+1:a'). +# +# - If any interfaces have been added, removed, or changed since +# the last update, increment current, and set revision to 0. +# +# - If any interfaces have been added since the last public release, +# then increment age. +# +# - If any interfaces have been removed since the last public release, +# then set age to 0. +# +# All changes in these version numbers are dictated by the PMIx +# release managers (not individual developers). Notes: + +# 1. Since these version numbers are associated with *releases*, the +# version numbers maintained on the PMIx Github trunk (and developer +# branches) is always 0:0:0 for all libraries. + +# 2. The version number of libpmix refers to the public pmix interfaces. +# It does not refer to any internal interfaces. + +# Version numbers are described in the Libtool current:revision:age +# format. + +libprrte_so_version=3:6:0 + +# "Common" components install standalone libraries that are run-time +# linked by one or more components. So they need to be versioned as +# well. Yuck; this somewhat breaks the +# components-don't-affect-the-build-system abstraction. + +libprrte_common_alps_so_version=3:0:0 + diff --git a/autogen.pl b/autogen.pl new file mode 100755 index 0000000000000000000000000000000000000000..6934caf124a84267d3f737b47936ac21852877e8 --- /dev/null +++ b/autogen.pl @@ -0,0 +1,1121 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2009-2022 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013 Mellanox Technologies, Inc. +# All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2015 IBM Corporation. All rights reserved. +# Copyright (c) 2021-2023 Nanook Consulting. All rights reserved. +# Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; + +use Cwd; +use File::Basename; +use File::Find; +use Data::Dumper; +use Getopt::Long; + +# +# Global variables +# + +# Sentinel file to remove if we fail +my $sentinel; + +# The m4 file we'll write at the end +my $m4_output_file = "config/autogen_found_items.m4"; +my $m4; +# Sanity check file +my $topdir_file = "docs/index.rst"; +my $dnl_line = "dnl ---------------------------------------------------------------------------"; +# The text file we'll write at the end that will contain +# all the mca component directory paths +my $mca_library_paths_file = "config/mca_library_paths.txt"; + +# Data structures to fill up with all the stuff we find +my $mca_found; +my @subdirs; + +# Command line parameters +my $quiet_arg = 0; +my $debug_arg = 0; +my $help_arg = 0; +my $include_arg = 0; +my $exclude_arg = 0; +my $force_arg = 0; + +# Include/exclude lists +my $include_list; +my $exclude_list; + +# Minimum versions +my $prte_automake_version = "1.13.4"; +my $prte_autoconf_version = "2.69"; +my $prte_libtool_version = "2.4.2"; + +# Search paths +my $prte_autoconf_search = "autoconf"; +my $prte_automake_search = "automake"; +my $prte_libtoolize_search = "libtoolize;glibtoolize"; + +# One-time setup +my $username; +my $hostname; +my $full_hostname; + +# Patch program +my $patch_prog = "patch"; +# Solaris "patch" doesn't understand unified diffs, and will cause +# autogen.pl to hang with a "File to patch:" prompt. Default to Linux +# "patch", but use "gpatch" on Solaris. +if ($^O eq "solaris") { + $patch_prog = "gpatch"; +} + +$username = getpwuid($>); +$full_hostname = `hostname`; +chomp($full_hostname); +$hostname = $full_hostname; +$hostname =~ s/^([\w\-]+)\..+/\1/; + +############################################################################## + +sub my_die { + unlink($sentinel) + if ($sentinel); + die @_; +} + +sub my_exit { + my ($ret) = @_; + unlink($sentinel) + if ($sentinel && $ret != 0); + exit($ret); +} + +############################################################################## + +sub verbose { + print @_ + if (!$quiet_arg); +} + +sub debug { + print @_ + if ($debug_arg); +} + +sub debug_dump { + my $d = new Data::Dumper([@_]); + $d->Purity(1)->Indent(1); + debug $d->Dump; +} + +############################################################################## + +sub mca_process_component { + my ($framework, $component) = @_; + + my $cdir = "src/mca/$framework/$component"; + + return + if (! -d $cdir); + + # Process this directory + my $found_component; + + $found_component = { + name => $component, + framework_name => $framework, + abs_dir => $cdir, + }; + + # Does this directory have a configure.m4 file? + if (-f "$cdir/configure.m4") { + $found_component->{"configure.m4"} = 1; + verbose " Found configure.m4 file\n"; + } + + # Does this directory have a + # help-{framework}-{component}.rst file? + if (-f "$cdir/help-$framework-$component.rst") { + $found_component->{"rst"} = 1; + verbose " Found help-$framework-$component.rst file\n"; + } + + # Push the results onto the $mca_found hash array + push(@{$mca_found->{$framework}->{"components"}}, + $found_component); + + # save the directory for later to create the paths + # to all the component libraries + push(@subdirs, $cdir); +} + +############################################################################## + +sub ignored { + my ($dir) = @_; + + # If this directory does not have .prte_ignore, or if it has a + # .prte_unignore that has my username in it, then add it to the + # list of components. + my $ignored = 0; + + if (-f "$dir/.prte_ignore") { + $ignored = 1; + } + if (-f "$dir/.prte_unignore") { + open(UNIGNORE, "$dir/.prte_unignore") || + my_die "Can't open $dir/.prte_unignore file"; + my $unignore; + $unignore .= $_ + while (); + close(UNIGNORE); + + $ignored = 0 + if ($unignore =~ /^$username$/m || + $unignore =~ /^$username\@$hostname$/m || + $unignore =~ /^$username\@$full_hostname$/m); + } + + return $ignored; +} + +############################################################################## + +sub mca_process_framework { + my ($framework) = @_; + + # Does this framework have a configure.m4 file? + my $dir = "src/mca/$framework"; + if (-f "$dir/configure.m4") { + $mca_found->{$framework}->{"configure.m4"} = 1; + verbose " Found framework configure.m4 file\n"; + } + + # Did we exclude all components for this framework? + if (exists($exclude_list->{$framework}) && + $exclude_list->{$framework}[0] eq "AGEN_EXCLUDE_ALL") { + verbose " => Excluded\n"; + } else { + # Look for component directories in this framework + if (-d $dir) { + $mca_found->{$framework}->{found} = 1; + opendir(DIR, $dir) || + my_die "Can't open $dir directory"; + foreach my $d (sort(readdir(DIR))) { + # Skip any non-directory, "base", or any dir that + # begins with "." + next + if (! -d "$dir/$d" || $d eq "base" || + substr($d, 0, 1) eq "."); + + # Skip any component that doesn't have a configure.m4 + # or Makefile.am as we couldn't build it anyway + if (! -f "$dir/$d/configure.m4" && + ! -f "$dir/$d/Makefile.am" && + ! -f "$dir/$d/configure.ac" && + ! -f "$dir/$d/configure.in") { + verbose " => No sentinel file found in $dir/$d -> Excluded\n"; + next; + } + + verbose "--- Found PRRTE / $framework / $d component: src/mca/$framework/$d\n"; + + # Skip if specifically excluded + if (exists($exclude_list->{$framework})) { + my $tst = 0; + foreach my $ck (@{$exclude_list->{$framework}}) { + if ($ck eq $d) { + verbose " => Excluded\n"; + $tst = 1; + last; + } + } + if ($tst) { + next; + } + } + + # Skip if the framework is on the include list, but + # doesn't contain this component + if (exists($include_list->{$framework})) { + my $tst = 0; + foreach my $ck (@{$include_list->{$framework}}) { + if ($ck ne $d) { + verbose " => Not included\n"; + $tst = 1; + last; + } + } + if ($tst) { + next; + } + } + + # Check ignore status + if (ignored("$dir/$d")) { + verbose " => Ignored (found .prte_ignore file)\n"; + } else { + mca_process_component($framework, $d); + } + } + } + closedir(DIR); + } +} + +############################################################################## + +sub mca_generate_framework_header(\$\@) { + my (@frameworks) = @_; + my $framework_array_output=""; + my $framework_decl_output=""; + my $framework_name_output=""; + + foreach my $framework (@frameworks) { + # There is no common framework object + if ($framework ne "common" and $framework ne "src") { + my $framework_name = "prte_${framework}_base_framework"; + $framework_array_output .= " &$framework_name,\n"; + $framework_decl_output .= "extern pmix_mca_base_framework_t $framework_name;\n"; + $framework_name_output .= " \"${framework}\",\n"; + } + } + $framework_name_output .= " \"hwloc\",\n"; + $framework_name_output .= " \"if\",\n"; + $framework_name_output .= " \"reachable\",\n"; + + my $ifdef_string = uc "prte_FRAMEWORKS_H"; + open(FRAMEWORKS_OUT, ">src/include/prte_frameworks.h"); + printf FRAMEWORKS_OUT "%s", "/* + * This file is autogenerated by autogen.pl. Do not edit this file by hand. + */ +#ifndef $ifdef_string +#define $ifdef_string + +#include \"src/mca/base/pmix_mca_base_framework.h\" + +$framework_decl_output +PRTE_EXPORT extern pmix_mca_base_framework_t *prte_frameworks[]; +PRTE_EXPORT extern char *prte_framework_names[]; + +#endif /* $ifdef_string */\n\n"; + close(FRAMEWORKS_OUT); + + open(FRAMEWORKS_OUT, ">src/include/prte_frameworks.c"); + printf FRAMEWORKS_OUT "%s", "/* + * This file is autogenerated by autogen.pl. Do not edit this file by hand. + */ + +#include \"src/include/prte_config.h\" +#include \"src/include/prte_frameworks.h\" + +pmix_mca_base_framework_t *prte_frameworks[] = { +$framework_array_output NULL +}; + +char *prte_framework_names[] = { +$framework_name_output NULL +}; + +"; + close(FRAMEWORKS_OUT); +} + +############################################################################## + +sub mca_process_project { + + # Look for framework directories + my $dir = "src/mca"; + opendir(DIR, $dir) || + my_die "Can't open $dir directory"; + my @my_dirs = readdir(DIR); + @my_dirs = sort(@my_dirs); + + foreach my $d (@my_dirs) { + # Skip any non-directory, "base", or any dir that begins with "." + next + if (! -d "$dir/$d" || $d eq "base" || substr($d, 0, 1) eq "."); + + # If this directory has a $dir.h file and a base/ + # subdirectory, or its name is "common", then it's a + # framework. + if ("common" eq $d || + (-f "$dir/$d/$d.h" && -d "$dir/$d/base")) { + verbose "\n=== Found prte framework: src/mca/$d\n"; + mca_process_framework($d); + } + } + closedir(DIR); +} + +############################################################################## + +sub mca_run_global { + + # Go find a list of frameworks, and for each of + # those, go find a list of components. + mca_process_project(); + + # Debugging output + debug_dump($mca_found); + + $m4 .= "\n$dnl_line +$dnl_line +$dnl_line + +dnl MCA information\n"; + + # Array for all the m4_includes that we'll need to pick up the + # configure.m4's. + my @includes; + + # Write the list of frameworks + my $frameworks_comma; + + # Print out project-level info + my @mykeys = keys(%{$mca_found}); + @mykeys = sort(@mykeys); + + # Ensure that the "common" framework is listed first + # (if it exists) + my @tmp; + push(@tmp, "common") + if (grep(/common/, @mykeys)); + foreach my $f (@mykeys) { + push(@tmp, $f) + if ($f ne "common"); + } + @mykeys = @tmp; + + foreach my $f (@mykeys) { + $frameworks_comma .= ", $f"; + + # Does this framework have a configure.m4 file? + push(@includes, "src/mca/$f/configure.m4") + if (exists($mca_found->{$f}->{"configure.m4"})); + + # This framework does have a Makefile.am (or at least, + # it should!) + my_die "Missing src/mca/$f/Makefile.am" + if (! -f "src/mca/$f/Makefile.am"); + } + $frameworks_comma =~ s/^, //; + + &mca_generate_framework_header("src", @mykeys); + + $m4 .= "$dnl_line + +dnl Frameworks in the prte project and their corresponding directories +m4_define([mca_prte_framework_list], [$frameworks_comma]) + +"; + + # Print out framework-level info + foreach my $f (@mykeys) { + my $components; + my $m4_config_component_list; + my $no_config_component_list; + + # Troll through each of the found components + foreach my $comp (@{$mca_found->{$f}->{components}}) { + my $c = $comp->{name}; + $components .= "$c "; + + # Does this component have a configure.m4 file? + if (exists($comp->{"configure.m4"})) { + push(@includes, "src/mca/$f/$c/configure.m4"); + $m4_config_component_list .= ", $c"; + } else { + $no_config_component_list .= ", $c"; + } + } + $m4_config_component_list =~ s/^, //; + $no_config_component_list =~ s/^, //; + + $m4 .= "dnl Components in the prte / $f framework +m4_define([mca_prte_${f}_m4_config_component_list], [$m4_config_component_list]) +m4_define([mca_prte_${f}_no_config_component_list], [$no_config_component_list]) + +"; + } + + # List out all the m4_include + $m4 .= "$dnl_line + +dnl List of configure.m4 files to include\n"; + foreach my $i (@includes) { + $m4 .= "m4_include([$i])\n"; + } +} + + +############################################################################## +# Find and remove stale files + +sub find_and_delete { + foreach my $file (@_) { + my $removed = 0; + if (-f $file) { + unlink($file); + $removed = 1; + } + if (-f "config/$file") { + unlink("config/$file"); + $removed = 1; + } + debug " Removed stale copy of $file\n" + if ($removed); + } +} + +############################################################################## +# Find a specific executable and ensure that it is a recent enough +# version. + +sub find_and_check { + my ($app, $app_name, $req_version) = @_; + + my @search_path = split(/;/, $app_name); + my @min_version = split(/\./, $req_version); + my @versions_found = (); + + foreach (@search_path) { + verbose " Searching for $_\n"; + my $version = `$_ --version`; + if (!defined($version)) { + verbose " $_ not found\n"; + next; + } + + # Matches a version string with 1 or more parts possibly prefixed with a letter (ex: + # v2.2) or followed by a letter (ex: 2.2.6b). This regex assumes there is a space + # before the version string and that the version is ok if there is no version. + if (!($version =~ m/\s[vV]?(\d[\d\.]*\w?)/m)) { + verbose " WARNING: $_ does not appear to support --version. Assuming it is ok\n"; + + return; + } + + $version = $1; + + verbose " Found $_ version $version; checking version...\n"; + push(@versions_found, $version); + + my @parts = split(/\./, $version); + my $i = 0; + # Check every component of the version number + while ($i <= $#min_version) { + verbose " Found version component $parts[$i] -- need $min_version[$i]\n"; + + # Check to see if there are any characters (!) in the + # version number (e.g., Libtool's "2.2.6b" -- #%@#$%!!!). + # Do separate comparisons between the number and any + # trailing digits. You can't just "lt" compare the whole + # string because "10 lt 2b" will return true. #@$@#$#@$ + # Libtool!! + $parts[$i] =~ m/(\d+)([a-z]*)/i; + my $pn = $1; + my $pa = $2; + $min_version[$i] =~ m/(\d+)([a-z]*)/i; + my $mn = $1; + my $ma = $2; + + # If the version is higher, we're done. + if ($pn > $mn) { + verbose " ==> ACCEPTED\n"; + return; + } + # If the version is lower, we're done. + elsif ($pn < $mn || + ($pn == $mn && $pa lt $ma)) { + verbose " ==> Too low! Skipping this version\n"; + last; + } + + # If the version was equal, keep checking. + ++$i; + } + + # If we found a good version, return. + if ($i > $#min_version) { + verbose " ==> ACCEPTED\n"; + return; + } + } + + # if no acceptable version found, reject it + print " +================================================================= +I could not find a recent enough copy of $app. +I need at least $req_version, but only found the following versions:\n\n"; + + my $i = 0; + foreach (@search_path) { + print " $_: $versions_found[$i]\n"; + $i++; + } + + print "\nI am gonna abort. :-( + +Please make sure you are using at least the following versions of the +tools: + + GNU Autoconf: $prte_autoconf_version + GNU Automake: $prte_automake_version + GNU Libtool: $prte_libtool_version +=================================================================\n"; + my_exit(1); +} + +############################################################################## + +sub safe_system { + print "Running: " . join(/ /, @_) . "\n"; + my $ret = system(@_); + $ret >>= 8; + if (0 != $ret) { + print "Command failed: @_\n"; + my_exit($ret); + } + $ret; +} + +############################################################################## + +sub patch_autotools_output { + my ($topdir) = @_; + + # Set indentation string for verbose output depending on current directory. + my $indent_str = " "; + if ($topdir eq ".") { + $indent_str = "=== "; + } + + # Patch ltmain.sh error for PGI version numbers. Redirect stderr to + # /dev/null because this patch is only necessary for some versions of + # Libtool (e.g., 2.2.6b); it'll [rightfully] fail if you have a new + # enough Libtool that doesn't need this patch. But don't alarm the + # user and make them think that autogen failed if this patch fails -- + # make the errors be silent. + # Also patch ltmain.sh for NAG compiler + if (-f "config/ltmain.sh") { + verbose "$indent_str"."Patching PGI compiler version numbers in ltmain.sh\n"; + system("$patch_prog -N -p0 < $topdir/config/ltmain_pgi_tp.diff >/dev/null 2>&1"); + unlink("config/ltmain.sh.rej"); + + verbose "$indent_str"."Patching \"-pthread\" option for NAG compiler in ltmain.sh\n"; + system("$patch_prog -N -p0 < $topdir/config/ltmain_nag_pthread.diff >/dev/null 2>&1"); + unlink("config/ltmain.sh.rej"); + } + + # If there's no configure script, there's nothing else to do. + return + if (! -f "configure"); + my @verbose_out; + + # Total ugh. We have to patch the configure script itself. See below + # for explanations why. + open(IN, "configure") || my_die "Can't open configure"; + my $c; + $c .= $_ + while(); + close(IN); + my $c_orig = $c; + + # The PGI 10 version number broke <=LT + # 2.2.6b's version number checking regexps. We can't fix the + # Libtool install; all we can do is patch the resulting configure + # script. :-( The following comes from the upstream patch: + # http://lists.gnu.org/archive/html/libtool-patches/2009-11/msg00016.html + push(@verbose_out, $indent_str . "Patching configure for Libtool PGI version number regexps\n"); + $c =~ s/\*pgCC\\ \[1-5\]\* \| \*pgcpp\\ \[1-5\]\*/*pgCC\\ [1-5]\.* | *pgcpp\\ [1-5]\.*/g; + + # See http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=v2.2.6-201-g519bf91 for details + # Note that this issue was fixed in LT 2.2.8, however most distros are still using 2.2.6b + + push(@verbose_out, $indent_str . "Patching configure for IBM xlf libtool bug\n"); + $c =~ s/(\$LD -shared \$libobjs \$deplibs \$)compiler_flags( -soname \$soname)/$1linker_flags$2/g; + + #Check if we are using a recent enough libtool that supports PowerPC little endian + if(index($c, 'powerpc64le-*linux*)') == -1) { + push(@verbose_out, $indent_str . "Patching configure for PowerPC little endian support\n"); + my $replace_string = "x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*|"; + $c =~ s/x86_64-\*kfreebsd\*-gnu\|x86_64-\*linux\*\|ppc\*-\*linux\*\|powerpc\*-\*linux\*\|/$replace_string/g; + $replace_string = + "powerpc64le-*linux*)\n\t LD=\"\${LD-ld} -m elf32lppclinux\"\n\t ;;\n\t powerpc64-*linux*)"; + $c =~ s/ppc64-\*linux\*\|powerpc64-\*linux\*\)/$replace_string/g; + $replace_string = + "powerpcle-*linux*)\n\t LD=\"\${LD-ld} -m elf64lppc\"\n\t ;;\n\t powerpc-*linux*)"; + $c =~ s/ppc\*-\*linux\*\|powerpc\*-\*linux\*\)/$replace_string/g; + } + + # Fix consequence of broken libtool.m4 + # see http://lists.gnu.org/archive/html/bug-libtool/2015-07/msg00002.html and + # https://github.com/open-mpi/ompi/issues/751 + push(@verbose_out, $indent_str . "Patching configure for -L/-R libtool.m4 bug\n"); + # patch for libtool < 2.4.3 + $c =~ s/# Some compilers place space between "-\{L,R\}" and the path.\n # Remove the space.\n if test \$p = \"-L\" \|\|/# Some compilers place space between "-\{L,-l,R\}" and the path.\n # Remove the spaces.\n if test \$p = \"-L\" \|\|\n test \$p = \"-l\" \|\|/g; + # patch for libtool >= 2.4.3 + $c =~ s/# Some compilers place space between "-\{L,R\}" and the path.\n # Remove the space.\n if test x-L = \"\$p\" \|\|\n test x-R = \"\$p\"\; then/# Some compilers place space between "-\{L,-l,R\}" and the path.\n # Remove the spaces.\n if test x-L = \"x\$p\" \|\|\n test x-l = \"x\$p\" \|\|\n test x-R = \"x\$p\"\; then/g; + + # Fix OS X Big Sur (11.0.x) support + # From https://lists.gnu.org/archive/html/libtool-patches/2020-06/msg00001.html + push(@verbose_out, $indent_str . "Patching configure for MacOS Big Sur libtool.m4 bug\n"); + # Some versions of Libtool use ${wl} consistently, but others did + # not (e.g., they used $wl). Make the regexp be able to handle + # both. Additionally, the case string searching for 10.[012]* + # changed over time. So make sure it can handle both of the case + # strings that we're aware of. + my $WL = '(\$\{wl\}|\$wl)'; + my $SOMETIMES = '(\[,.\])*'; + my $search_string = 'darwin\*\) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don\'t you love it\? + case \$\{MACOSX_DEPLOYMENT_TARGET-10.0\},\$host in + 10.0,\*86\*-darwin8\*\|10.0,\*-darwin\[91\]\*\) + _lt_dar_allow_undefined=\'' . $WL . '-undefined ' . $WL . 'dynamic_lookup\' ;; + 10.\[012\]' . $SOMETIMES . '\*\) + _lt_dar_allow_undefined=\'' . $WL . '-flat_namespace ' . $WL . '-undefined ' . $WL . 'suppress\' ;; + 10.\*\)'; + my $replace_string = 'darwin*) + # PRRTE patched for Darwin / MacOS Big Sur. See + # http://lists.gnu.org/archive/html/bug-libtool/2015-07/msg00001.html + case ${MACOSX_DEPLOYMENT_TARGET},$host in + 10.[012],*|,*powerpc*) + _lt_dar_allow_undefined=\'${wl}-flat_namespace ${wl}-undefined ${wl}suppress\' ;; + *)'; + $c =~ s/$search_string/$replace_string/g; + + # Only write out verbose statements and a new configure if the + # configure content actually changed + return + if ($c eq $c_orig); + foreach my $str (@verbose_out) { + verbose($str); + } + + open(OUT, ">configure.patched") || my_die "Can't open configure.patched"; + print OUT $c; + close(OUT); + # Use cp so that we preserve permissions on configure + safe_system("cp configure.patched configure"); + unlink("configure.patched"); +} + +sub export_version { + my ($name,$version) = @_; + $version =~ s/[^a-zA-Z0-9,.]//g; + my @version_splits = split(/\./,$version); + my $hex = sprintf("0x%04x%02x%02x", $version_splits[0], $version_splits[1], $version_splits[2]); + $m4 .= "m4_define([PRTE_${name}_MIN_VERSION], [$version])\n"; + $m4 .= "m4_define([PRTE_${name}_NUMERIC_MIN_VERSION], [$hex])\n"; +} + +sub get_and_define_min_versions() { + + open(IN, "VERSION") || my_die "Can't open VERSION"; + while () { + my $line = $_; + my @fields = split(/=/,$line); + if ($fields[0] eq "automake_min_version") { + if ($fields[1] ne "\n") { + $prte_automake_version = $fields[1]; + } + } + elsif($fields[0] eq "autoconf_min_version") { + if ($fields[1] ne "\n") { + $prte_autoconf_version = $fields[1]; + } + } + elsif($fields[0] eq "libtool_min_version") { + if ($fields[1] ne "\n") { + $prte_libtool_version = $fields[1]; + } + } + elsif($fields[0] eq "pmix_min_version") { + if ($fields[1] ne "\n") { + export_version("PMIX", $fields[1]); + } + } + elsif($fields[0] eq "hwloc_min_version") { + if ($fields[1] ne "\n") { + export_version("HWLOC", $fields[1]); + } + } + elsif($fields[0] eq "event_min_version") { + if ($fields[1] ne "\n") { + export_version("EVENT", $fields[1]); + } + } + elsif($fields[0] eq "flex_min_version") { + if ($fields[1] ne "\n") { + export_version("FLEX", $fields[1]); + } + } + } + close(IN); +} + + +############################################################################## + +sub in_tarball { + my $tarball = 0; + open(IN, "VERSION") || my_die "Can't open VERSION"; + # If repo_rev is not an empty string, we are in a tarball + while () { + my $line = $_; + my @fields = split(/=/,$line); + if ($fields[0] eq "repo_rev") { + if ($fields[1] ne "\n") { + $tarball = 1; + last; + } + } + } + close(IN); + return $tarball; +} + +############################################################################## + +sub replace_config_sub_guess { + # This could be simpler if we could use some Perl modules for this + # functionality (e.g., DateTime). But I don't want to introduce + # any CPAN dependencies here, so just do sometime simple, even if + # it's a bit laborious. Use a few private helper functions for + # this kind of functionality. + + sub _get_timestamp { + my $filename = shift; + + my $ret; + if (-x $filename) { + my $out = `$filename --version`; + $out =~ m/GNU config\.[a-z]+ \((.+)\)/; + $ret = $1; + } + + return $ret; + } + + sub _split_timestamp { + my $ts = shift; + + $ts =~ m/(\d+)-(\d+)-(\d+)/; + return $1, $2, $3; + } + + # Returns true if timestamp $a > timestamp $b. + sub _timestamp_gt { + my ($a, $b) = @_; + + my ($year_a, $month_a, $day_a) = _split_timestamp($a); + my ($year_b, $month_b, $day_b) = _split_timestamp($b); + + # Don't try to be clever -- just do a simple set of explicit + # comparisons. + if ($year_a > $year_b) { + return 1; + } elsif ($year_a < $year_b) { + return 0; + } else { + if ($month_a > $month_b) { + return 1; + } elsif ($month_a < $month_b) { + return 0; + } else { + if ($day_a > $day_b) { + return 1; + } else { + return 0; + } + } + } + } + + my ($topdir) = @_; + + # Find the stashed known-good files, and get their version + # timestamps. + my $cached_dir = "$topdir/config/from-savannah"; + my @files = qw/config.guess config.sub/; + my %known_good_timestamps; + foreach my $file (@files) { + my $filename = "$cached_dir/upstream-$file"; + my_die("Cannot find $filename") + if (! -f $filename); + + my $ts = _get_timestamp($filename); + $known_good_timestamps{$file} = $ts; + } + + # Find all config.guess/config.sub files in the tree. If their + # versions are older than the stashed known-good files, update + # them from the stash. + my @files; + File::Find::find(sub { + push(@files, $File::Find::name) + if ($_ eq "config.guess" || + $_ eq "config.sub") }, $topdir); + + foreach my $file (@files) { + my $base = basename($file); + my $ts = _get_timestamp($file); + if (_timestamp_gt($known_good_timestamps{$base}, $ts)) { + print("=== Replacing $file with newer version\n"); + safe_system("cp -f $cached_dir/upstream-$base $file"); + } + } +} + +############################################################################## +############################################################################## +## main - do the real work... +############################################################################## +############################################################################## + +# Command line parameters + +my $ok = Getopt::Long::GetOptions("quiet|q" => \$quiet_arg, + "debug|d" => \$debug_arg, + "help|h" => \$help_arg, + "include=s" => \$include_arg, + "exclude=s" => \$exclude_arg, + "force|f" => \$force_arg, + ); + +if (!$ok || $help_arg) { + print "Invalid command line argument.\n\n" + if (!$ok); + print "Options: + --quiet | -q Do not display normal verbose output + --debug | -d Output lots of debug information + --help | -h This help list + --include | -i Comma-separated list of framework-component pairs + to be exclusively built - i.e., all other components + will be ignored and only those specified will be marked + to build + --exclude | -e Comma-separated list of framework or framework-component + to be excluded from the build + --force | -f Run even if invoked from the source tree of an expanded + distribution tarball\n"; + my_exit($ok ? 0 : 1); +} + +#--------------------------------------------------------------------------- + +# Check for project existence +my $project_name_long = "prte"; +my $project_name_short = "prte"; + +#--------------------------------------------------------------------------- + +$full_hostname = `hostname`; +chomp($full_hostname); + +$m4 = "dnl +dnl \$HEADER\$ +dnl +$dnl_line +dnl This file is automatically created by autogen.pl; it should not +dnl be edited by hand!! +dnl +dnl Generated by $username at " . localtime($ENV{SOURCE_DATE_EPOCH} || time) . " +dnl on $full_hostname. +$dnl_line\n\n"; + +#--------------------------------------------------------------------------- + +# Verify that we're in the PRTE root directory by checking for a token file. + +my_die "Not at the root directory of a PRRTE source tree" + if (! -f "config/prte_mca.m4"); + +$force_arg = 1; + +my_die "autogen.pl has been invoked in the source tree of a PRRTE distribution tarball; aborting... +You likely do not need to invoke \"autogen.pl\" -- you can probably run \"configure\" directly. +If you really know what you are doing, and really need to run autogen.pl, use the \"--force\" flag." + if (!$force_arg && in_tarball()); + +# Now that we've verified that we're in the top-level PRRTE directory, +# set the sentinel file to remove if we abort. +$sentinel = Cwd::cwd() . "/configure"; + +#--------------------------------------------------------------------------- + +my $step = 1; +verbose "PRRTE autogen (buckle up!) + +$step. Checking tool versions\n\n"; + +get_and_define_min_versions(); + +# Check the autotools revision levels +&find_and_check("autoconf", $prte_autoconf_search, $prte_autoconf_version); +&find_and_check("libtool", $prte_libtoolize_search, $prte_libtool_version); +&find_and_check("automake", $prte_automake_search, $prte_automake_version); + +#--------------------------------------------------------------------------- + +++$step; +verbose "\n$step. Checking for git submodules\n\n"; + +# Make sure we got a submodule-full clone. If not, abort and let a +# human figure it out. +if (-f ".gitmodules") { + open(IN, "git submodule status|") + || die "Can't run \"git submodule status\""; + while () { + $_ =~ m/^(.)[0-9a-f]{40}\s+(\S+)/; + my $status = $1; + my $path = $2; + + print("=== Submodule: $path\n"); + # Make sure the submodule is there + if ($status eq "-") { + print(" ==> ERROR: Missing + +The submodule \"$path\" is missing. + +Perhaps you forgot to \"git clone --recursive ...\", or you need to +\"git submodule update --init --recursive\"...?\n\n"); + exit(1); + } + + # See if the commit in the submodule is not the same as the + # commit that the git submodule thinks it should be. + elsif ($status eq "+") { + print(" ==> WARNING: Submodule hash is different than upstream. +If this is not intentional, you may want to run: +\"git submodule update --init --recursive\"\n"); + } else { + print(" Local hash is what is expected by the submodule (good!)\n"); + } + } +} + +#--------------------------------------------------------------------------- + +# No platform file -- write an empty list +$m4 .= "m4_define([autogen_platform_file], [])\n\n"; + +if ($exclude_arg) { + debug "Using exclude list: $exclude_arg"; + my @list = split(/,/, $exclude_arg); + foreach (@list) { + my @pairs = split(/-/, $_); + if (exists($pairs[1])) { + # Remove any trailing newlines + chomp($pairs[1]); + debug " Adding ".$pairs[0]."->".$pairs[1]." to exclude list\n"; + push(@{$exclude_list->{$pairs[0]}}, $pairs[1]); + } else { + debug " Adding $pairs[0] to exclude list\n"; + push(@{$exclude_list->{$pairs[0]}}, "AGEN_EXCLUDE_ALL"); + } + } +} +if ($include_arg) { + debug "Using include list: $include_arg"; + my @list = split(/,/, $include_arg); + foreach (@list) { + my @pairs = split(/-/, $_); + if (exists($pairs[1])) { + # Remove any trailing newlines + chomp($pairs[1]); + debug " Adding ".$pairs[0]."->".$pairs[1]." to include list\n"; + push(@{$include_list->{$pairs[0]}}, $pairs[1]); + } + # NOTE: it makes no sense to include all as that is the default + # so ignore that scenario here, if given + } +} + +#--------------------------------------------------------------------------- + +# Find frameworks, components +++$step; +verbose "\n$step. Searching for MCA frameworks and components\n"; + +my $ret; + +# Figure out if we're at the top level of the PRRTE tree or not. +if (! (-f "VERSION" && -f "configure.ac" && -f $topdir_file)) { + print("\n\nYou must run this script from the top-level directory of the PRRTE tree.\n\n"); + my_exit(1); +} + +$m4 .= "\ndnl Project names +m4_define([project_name_long], [$project_name_long]) +m4_define([project_name_short], [$project_name_short])\n"; + +# Setup MCA +mca_run_global(); + +#--------------------------------------------------------------------------- + +# If we got here, all was good. Run the auto tools. +++$step; +verbose "\n$step. Running autotools on top-level tree\n\n"; + +# Remove old versions of the files (this is probably overkill, but...) +verbose "==> Remove stale files\n"; +find_and_delete(qw/config.guess config.sub depcomp compile install-sh ltconfig + ltmain.sh missing mkinstalldirs libtool/); + +# Remove the old m4 file and write the new one +verbose "==> Writing m4 file with autogen.pl results\n"; +unlink($m4_output_file); +open(M4, ">$m4_output_file") || + my_die "Can't open $m4_output_file"; +print M4 $m4; +close(M4); + +# Remove the old library path file and write the new one +verbose "==> Writing txt file with all the mca component paths\n"; +unlink($mca_library_paths_file); +open(M4, ">$mca_library_paths_file") || + my_die "Cannot open $mca_library_paths_file"; +my $paths = join(":", @subdirs); +print M4 $paths; +close(M4); + +# Run autoreconf +verbose "==> Running autoreconf\n"; +my $cmd = "autoreconf -ivf --warnings=all,no-obsolete,no-override -I config -I config/oac"; +safe_system($cmd); + +patch_autotools_output("."); + +# Per https://github.com/open-mpi/ompi/issues/8410, replace config.sub +# and config.guess with known-good versions if the Autoconf-installed +# versions are older. +replace_config_sub_guess("."); + +#--------------------------------------------------------------------------- + +verbose " +================================================ +PRRTE autogen: completed successfully. w00t! +================================================\n\n"; + +# Done! +exit(0); diff --git a/config/Makefile.am b/config/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..b1d2532053dd3dc64f94d834008111272c59ae64 --- /dev/null +++ b/config/Makefile.am @@ -0,0 +1,49 @@ +# +# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2006-2022 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010 Oracle and/or its affiliates. All rights +# reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2016 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2021-2022 Nanook Consulting All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This is a weird place for this, but config/ is the first directory that +# is entered, and the dist-hook runs at the end of the current directory, +# so this is the earliest we can run this test. +dist-hook: + @if test -n "$(PRTE_MAKEDIST_DISABLE)" ; then \ + echo "#########################################################################"; \ + echo "#"; \ + echo "# make dist is disabled due to the following packages: $(PRTE_MAKEDIST_DISABLE)"; \ + echo "#"; \ + echo "#########################################################################"; \ + exit 1; \ + fi + +EXTRA_DIST = \ + distscript.sh \ + prte_get_version.m4sh \ + prte_get_version.sh \ + ltmain_nag_pthread.diff \ + ltmain_pgi_tp.diff \ + prte_mca_priority_sort.pl \ + find_common_syms \ + getdate.sh \ + from-savannah/upstream-config.guess \ + from-savannah/upstream-config.sub diff --git a/config/Makefile.options b/config/Makefile.options new file mode 100644 index 0000000000000000000000000000000000000000..7f42e96740292cd3fe92a833c52a0ae1a72e44c3 --- /dev/null +++ b/config/Makefile.options @@ -0,0 +1,20 @@ +# -*- makefile -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AUTOMAKE_OPTIONS = foreign dist-bzip2 diff --git a/config/distscript.sh b/config/distscript.sh new file mode 100755 index 0000000000000000000000000000000000000000..227cad1e765307a9490381f9a41a78b18b4dc773 --- /dev/null +++ b/config/distscript.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2015 Los Alamos National Security, LLC. All rights +# reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +srcdir=$1 +builddir=$PWD +distdir=$builddir/$2 +OMPI_REPO_REV=$3 + +if test x"$2" = x ; then + echo "*** ERROR: Must supply relative distdir as argv[2] -- aborting" + exit 1 +elif test ! -d "$distdir" ; then + echo "*** ERROR: dist dir does not exist" + echo "*** ERROR: $distdir" + exit 1 +fi + +# We can catch some hard (but possible) to do mistakes by looking at +# our repo's revision, but only if we are in the source tree. +# Otherwise, use what configure told us, at the cost of allowing one +# or two corner cases in (but otherwise VPATH builds won't work). +repo_rev=$OMPI_REPO_REV +if test -d .git ; then + repo_rev=$(config/prte_get_version.sh VERSION --repo-rev) +fi + +# +# Update VERSION:repo_rev with the best value we have. +# +perl -pi -e 's/^repo_rev=.*/repo_rev='$repo_rev'/' -- "${distdir}/VERSION" +# need to reset the timestamp to not annoy AM dependencies +touch -r "${srcdir}/VERSION" "${distdir}/VERSION" + +echo "*** Updated VERSION file with repo rev: $repo_rev" +echo "*** (via dist-hook / config/distscript.sh)" diff --git a/config/find_common_syms b/config/find_common_syms new file mode 100755 index 0000000000000000000000000000000000000000..0a67ffc4bd206c0d5d17b87b61b4677cbd2574ed --- /dev/null +++ b/config/find_common_syms @@ -0,0 +1,144 @@ +#!/usr/bin/env perl +# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Common symbols cause linking issues on some platforms, including OS X. See +# this issue for more background: +# https://github.com/open-mpi/ompi/issues/375 + +use strict; +use warnings; + +use Getopt::Long; +use File::Basename qw(basename); + +sub is_whitelisted; + +my $MAX_BRIEF = 10; + +my @orig_argv = @ARGV; +my @sym_whitelist = (); + +sub usage { + print STDERR < \$all, + "brief!" => \$brief, + "full-path!" => \$print_full_obj_path, + "objext=s" => \$objext, + "top_builddir=s" => \$top_builddir, + "top_srcdir=s" => \$top_srcdir, +) || usage(); + +if (!$top_builddir or !$top_srcdir) { + usage(); +} + +if (0 != system("command -v nm >/dev/null 2>&1")) { + print STDERR "NOTE: nm not found, skipping common symbol check\n"; + # Makefile usage should prefix this command with "-" to ignore this exit status + exit 1; +} + +# load the common symbol whitelist from files scattered around the codebase +# +# It would be better to load these into some sort of tree and then have those +# whitelists only apply to objects that are found in the same directory or +# subdirectories. That way a whitelisted symbol in one component doesn't +# "shadow" a symbol that should not be whitelisted in another component. If we +# find this is actually a problem in practice then we can write a v2 update. +my @wl_files = `find '${top_srcdir}' -name 'common_sym_whitelist.txt'`; +foreach my $wl_file (@wl_files) { + chomp $wl_file; + my @lines = `cat $wl_file`; + foreach my $line (@lines) { + chomp $line; + next if ($line =~ /^\s*#/); # skip comments + next if ($line =~ /^\s*$/); # skip blank lines + push @sym_whitelist, $line; + } +} + +my $n = 0; +open(FIND, '-|', "find ${top_builddir} -name '*.${objext}'"); +OBJECT: while (my $obj_line = ) { + my $obj = $obj_line; + chomp $obj; + + # This pattern may not be 100% robust for all implementations of nm. If + # that turns out to be the case, we can try switching to "nm -P", which is + # supposed to activate the "portable" (yet ugly) format. It's also unclear + # at this point how common support for "nm -P" is. + open(NM, '-|', "nm '${obj}' 2>/dev/null | egrep '\\s[cC]\\s'"); + SYMBOL: while (my $sym_line = ) { + if (!$all and is_whitelisted($sym_line)) { + next SYMBOL; + } + + if ($n == 0) { + print STDERR "WARNING! Common symbols found:\n"; + } + if ($brief and $n == $MAX_BRIEF) { + print STDERR "[...]\n"; + print STDERR "skipping remaining symbols. To see all symbols, run:\n"; + print STDERR " " . join(" ", ($0, grep {!/--brief/} @orig_argv)) . "\n"; + last OBJECT; + } + if ($print_full_obj_path) { + print STDERR "$obj: $sym_line"; + } else { + my $obj_basename = basename($obj); + printf STDERR "%25s: %s", $obj_basename, $sym_line; + } + ++$n; + } + close(NM); +} +close(FIND); + +if ($n > 0) { + exit 1; +} else { + exit 0; +} + +sub is_whitelisted { + my $line = shift; + + foreach my $wl_sym (@sym_whitelist) { + if ($line =~ m/\b_?\Q$wl_sym\E\b/) { + return 1; + } + } + + # Look for symbol names ending in one or more underscores and assume they + # are "Fortran-shaped". This won't match the hex output from most nm's and + # shouldn't match the single characters that indicate symbol type. + if ($line =~ m/\b_?[A-Za-z_]+[A-Za-z0-9_]*_+\b/) { + return 1; + } + + return 0; +} diff --git a/config/from-savannah/README.md b/config/from-savannah/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9d0bf1cdc90326d333b996e0b24718c58abe333a --- /dev/null +++ b/config/from-savannah/README.md @@ -0,0 +1,11 @@ +These files downloaded from +https://git.savannah.gnu.org/gitweb/?p=config.git at git hash +6faca61810d335c7837f320733fe8e15a1431fc2 on 26 Jan 2021. + +They were stashed here in the PRRTE repository in response to +https://github.com/open-mpi/ompi/issues/8410, where it was determined +that the responses from `config.*` installed by Autoconf were not +sufficient for some modern platforms (e.g., Apple M1 Macs). + +`autogen.pl` will copy in these files if they are, in fact, newer than +the corresponding files installed by Autoconf. diff --git a/config/from-savannah/upstream-config.guess b/config/from-savannah/upstream-config.guess new file mode 100755 index 0000000000000000000000000000000000000000..1972fda8eb05d040c1390495644252fc92fa2d10 --- /dev/null +++ b/config/from-savannah/upstream-config.guess @@ -0,0 +1,1700 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2021 Free Software Foundation, Inc. + +timestamp='2021-01-25' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +me=$(echo "$0" | sed -e 's,.*/,,') + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2021 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039 + { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$driver" + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown +UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown +UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown +UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown + +case "$UNAME_SYSTEM" in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + EOF + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)) + case "$UNAME_MACHINE_ARCH" in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') + endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') + machine="${arch}${endian}"-unknown + ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case "$UNAME_MACHINE_ARCH" in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case "$UNAME_MACHINE_ARCH" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "$UNAME_VERSION" in + Debian*) + release='-gnu' + ;; + *) + release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "$machine-${os}${release}${abi-}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; + *:ekkoBSD:*:*) + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + exit ;; + *:SolidBSD:*:*) + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + exit ;; + *:OS108:*:*) + echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:MirBSD:*:*) + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:Sortix:*:*) + echo "$UNAME_MACHINE"-unknown-sortix + exit ;; + *:Twizzler:*:*) + echo "$UNAME_MACHINE"-unknown-twizzler + exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') + ;; + *5.*) + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix"$UNAME_RELEASE" + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "$( (/bin/universe) 2>/dev/null)" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case $(/usr/bin/uname -p) in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux"$UNAME_RELEASE" + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + sun4*:SunOS:*:*) + case "$(/usr/bin/arch -k)" in + Series*|S4*) + UNAME_RELEASE=$(uname -v) + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos"$UNAME_RELEASE" + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case "$(/bin/arch)" in + sun3) + echo m68k-sun-sunos"$UNAME_RELEASE" + ;; + sun4) + echo sparc-sun-sunos"$UNAME_RELEASE" + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos"$UNAME_RELEASE" + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint"$UNAME_RELEASE" + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint"$UNAME_RELEASE" + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint"$UNAME_RELEASE" + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten"$UNAME_RELEASE" + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten"$UNAME_RELEASE" + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix"$UNAME_RELEASE" + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix"$UNAME_RELEASE" + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix"$UNAME_RELEASE" + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && + SYSTEM_NAME=$("$dummy" "$dummyarg") && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos"$UNAME_RELEASE" + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=$(/usr/bin/uname -p) + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + echo m88k-dg-dgux"$UNAME_RELEASE" + else + echo m88k-dg-dguxbcs"$UNAME_RELEASE" + fi + else + echo i586-dg-dgux"$UNAME_RELEASE" + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=$(/usr/bin/oslevel) + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') + case "$UNAME_MACHINE" in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) + sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) + case "$sc_cpu_version" in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "$sc_kernel_bits" in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') + echo ia64-hp-hpux"$HPUX_REV" + exit ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + echo "$UNAME_MACHINE"-unknown-osf1mk + else + echo "$UNAME_MACHINE"-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) + FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') + FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') + FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:BSD/OS:*:*) + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + exit ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=$(uname -p) + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi + else + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf + fi + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=$(/usr/bin/uname -p) + case "$UNAME_PROCESSOR" in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + exit ;; + i*:CYGWIN*:*) + echo "$UNAME_MACHINE"-pc-cygwin + exit ;; + *:MINGW64*:*) + echo "$UNAME_MACHINE"-pc-mingw64 + exit ;; + *:MINGW*:*) + echo "$UNAME_MACHINE"-pc-mingw32 + exit ;; + *:MSYS*:*) + echo "$UNAME_MACHINE"-pc-msys + exit ;; + i*:PW*:*) + echo "$UNAME_MACHINE"-pc-pw32 + exit ;; + *:Interix*:*) + case "$UNAME_MACHINE" in + x86) + echo i586-pc-interix"$UNAME_RELEASE" + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix"$UNAME_RELEASE" + exit ;; + IA64) + echo ia64-unknown-interix"$UNAME_RELEASE" + exit ;; + esac ;; + i*:UWIN*:*) + echo "$UNAME_MACHINE"-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-pc-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + *:GNU:*:*) + # the GNU system + echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" + exit ;; + *:Minix:*:*) + echo "$UNAME_MACHINE"-unknown-minix + exit ;; + aarch64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + alpha:Linux:*:*) + case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + else + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + cris:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + crisv32:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + e2k:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + frv:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + hexagon:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:Linux:*:*) + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + ia64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m32r*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m68*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-"$LIBC" + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-"$LIBC" + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-"$LIBC" + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-"$LIBC" + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-"$LIBC" + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-"$LIBC" + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-"$LIBC" + exit ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + exit ;; + sh64*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sh*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + tile*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + vax:Linux:*:*) + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + exit ;; + x86_64:Linux:*:*) + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI="$LIBC"x32 + fi + fi + echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" + exit ;; + xtensa*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo "$UNAME_MACHINE"-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo "$UNAME_MACHINE"-unknown-stop + exit ;; + i*86:atheos:*:*) + echo "$UNAME_MACHINE"-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo "$UNAME_MACHINE"-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos"$UNAME_RELEASE" + exit ;; + i*86:*DOS:*:*) + echo "$UNAME_MACHINE"-pc-msdosdjgpp + exit ;; + i*86:*:4.*:*) + UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case $(/bin/uname -X | grep "^Machine") in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=$(sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos"$UNAME_RELEASE" + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos"$UNAME_RELEASE" + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv"$UNAME_RELEASE" + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=$( (uname -p) 2>/dev/null) + echo "$UNAME_MACHINE"-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo "$UNAME_MACHINE"-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux"$UNAME_RELEASE" + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + echo mips-nec-sysv"$UNAME_RELEASE" + else + echo mips-unknown-sysv"$UNAME_RELEASE" + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux"$UNAME_RELEASE" + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux"$UNAME_RELEASE" + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux"$UNAME_RELEASE" + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux"$UNAME_RELEASE" + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Rhapsody:*:*) + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + exit ;; + arm64:Darwin:*:*) + echo aarch64-apple-darwin"$UNAME_RELEASE" + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=$(uname -p) + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=$(uname -p) + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + # shellcheck disable=SC2154 + if test "$cputype" = 386; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo "$UNAME_MACHINE"-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux"$UNAME_RELEASE" + exit ;; + *:DragonFly:*:*) + echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=$( (uname -p) 2>/dev/null) + case "$UNAME_MACHINE" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" + exit ;; + i*86:rdos:*:*) + echo "$UNAME_MACHINE"-pc-rdos + exit ;; + *:AROS:*:*) + echo "$UNAME_MACHINE"-unknown-aros + exit ;; + x86_64:VMkernel:*:*) + echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; + *:Unleashed:*:*) + echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" + exit ;; +esac + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null); + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case "$UNAME_MACHINE:$UNAME_SYSTEM" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&2 </dev/null || echo unknown) +uname -r = $( (uname -r) 2>/dev/null || echo unknown) +uname -s = $( (uname -s) 2>/dev/null || echo unknown) +uname -v = $( (uname -v) 2>/dev/null || echo unknown) + +/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) +/bin/uname -X = $( (/bin/uname -X) 2>/dev/null) + +hostinfo = $( (hostinfo) 2>/dev/null) +/bin/universe = $( (/bin/universe) 2>/dev/null) +/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) +/bin/arch = $( (/bin/arch) 2>/dev/null) +/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) +/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/from-savannah/upstream-config.sub b/config/from-savannah/upstream-config.sub new file mode 100755 index 0000000000000000000000000000000000000000..63c1f1c8b5e2d881e106d8951a11c6c94ae6352b --- /dev/null +++ b/config/from-savannah/upstream-config.sub @@ -0,0 +1,1860 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2021 Free Software Foundation, Inc. + +timestamp='2021-01-08' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=$(echo "$0" | sed -e 's,.*/,,') + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2021 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=$(echo "$basic_machine" | sed 's/-.*//') + ;; + + *-*) + # shellcheck disable=SC2162 + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') + ;; + os2-emx) + kernel=os2 + os=$(echo $basic_os | sed -e 's|os2-emx|emx|') + ;; + nto-qnx*) + kernel=nto + os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') + ;; + *-*) + # shellcheck disable=SC2162 + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/getdate.sh b/config/getdate.sh new file mode 100755 index 0000000000000000000000000000000000000000..81c8f45fc783b118ff1d596b5f2b127a05c81120 --- /dev/null +++ b/config/getdate.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# Copyright (c) 2017 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. + +# Provide a way to override build date for reproducible build results +# See https://reproducible-builds.org/ for why this is good. + +SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" +date -u -d "@$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u "$@" diff --git a/config/ltmain_nag_pthread.diff b/config/ltmain_nag_pthread.diff new file mode 100644 index 0000000000000000000000000000000000000000..927b671f9ae9fff02a0187c4f9801cf6e4d81201 --- /dev/null +++ b/config/ltmain_nag_pthread.diff @@ -0,0 +1,18 @@ +--- config/ltmain.sh ++++ config/ltmain.sh +@@ -6417,8 +6417,14 @@ + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" ++ # and "-pthread" to "-Wl,-pthread" if NAG compiler + if test -n "$inherited_linker_flags"; then +- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` ++ case "$CC" in ++ *nagfor*) ++ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g' | $SED 's/-pthread/-Wl,-pthread/g'`;; ++ *) ++ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`;; ++ esac + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; diff --git a/config/ltmain_pgi_tp.diff b/config/ltmain_pgi_tp.diff new file mode 100644 index 0000000000000000000000000000000000000000..ff0fc36d79f495106920ed912fb897365ce707b5 --- /dev/null +++ b/config/ltmain_pgi_tp.diff @@ -0,0 +1,11 @@ +--- config/ltmain.sh ++++ config/ltmain.sh +@@ -4765,7 +4765,7 @@ + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ +- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) ++ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp|-tp=*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" diff --git a/config/oac b/config/oac new file mode 160000 index 0000000000000000000000000000000000000000..dfff67569fb72dbf8d73a1dcf74d091dad93f71b --- /dev/null +++ b/config/oac @@ -0,0 +1 @@ +Subproject commit dfff67569fb72dbf8d73a1dcf74d091dad93f71b diff --git a/config/pkg.m4 b/config/pkg.m4 new file mode 100644 index 0000000000000000000000000000000000000000..58798298b86473d76a4c5ad7d5f2deb5c88bb34e --- /dev/null +++ b/config/pkg.m4 @@ -0,0 +1,303 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurrence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPPRTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPPRTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPPRTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPPRTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR + +########################################################################### +########################################################################### +########################################################################### +# Open MPI project extensions to pkg.m4 +########################################################################### +########################################################################### +########################################################################### + +# _PKG_CONFIG2([VARIABLE], [COMMAND1], [COMMAND2], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG2], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$4], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 --[]$3 "$4" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG2 + +# PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Variation of PGK_CHECK_MODULES which also defines $1_LIBS_STATIC +# by using the pkg-config --libs --static pkg-config option. +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_STATIC_LIBS], [static linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) +_PKG_CONFIG2([$1][_STATIC_LIBS], [libs], [static], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPPRTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + $1[]_STATIC_LIBS=$pkg_cv_[]$1[]_STATIC_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES_STATIC diff --git a/config/prte_check_alps.m4 b/config/prte_check_alps.m4 new file mode 100644 index 0000000000000000000000000000000000000000..d66ecdc61ade402c6265622d060161ad14a85c45 --- /dev/null +++ b/config/prte_check_alps.m4 @@ -0,0 +1,193 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2015 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2020 Triad National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2021 Nanook Consulting. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# PRTE_CHECK_ALPS_CLE4([action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_ALPS_CLE4],[ + +# +# if we've gotten here, its because we are building on a CLE 4 system +# + prte_check_alps_cle4_libdir_happy="no" + prte_check_alps_cle4_dir_happy="no" + + AC_MSG_CHECKING([Checking for ALPS components on a CLE 4 system with alps $with_alps]) + + AC_ARG_WITH([alps-libdir], + [AS_HELP_STRING([--with-alps-libdir=DIR], + [Location of alps libraries (alpslli, alpsutil) (default: /usr/lib/alps (/opt/cray/xe-sysroot/default/user on eslogin nodes))])]) + +# +# check to see if Open MPI is being built on a CLE 4 eslogin node +# + AS_IF([test -f /etc/opt/cray/release/ESLrelease], + [default_alps_dir="/opt/cray/xe-sysroot/default/usr"], + [default_alps_dir="/usr"]) + + AS_IF([test -z "$with_alps_libdir"], + [AS_IF([test "$with_alps" != "yes" && test "$with_alps" != "auto"], + [AS_IF([test -d "$with_alps_libdir/lib64"], + [prte_check_alps_libdir="$with_alps_libdir/lib64"], + [prte_check_alps_libdir="$with_alps_libdir/lib"])], + [ prte_check_alps_libdir="$default_alps_dir/lib/alps"]) + ],[]) + + AS_IF([test "$with_alps" = "yes" || test "$with_alps" = "auto"], + [prte_check_alps_dir=$default_alps_dir], + [prte_check_alps_dir=$with_alps]) + + AC_MSG_CHECKING([if $prte_check_alps_libdir/libalps.a is present]) + AS_IF([test -f "$prte_check_alps_libdir/libalps.a"], + [prte_check_alps_libdir_cle4_happy="yes"], + [prte_check_alps_libdir_cle4_happy="no", + AC_MSG_RESULT([no])]) + + AC_MSG_CHECKING([if $prte_check_alps_dir/include/alps/apInfo.h is present]) + AS_IF([test -f "$prte_check_alps_dir/include/alps/apInfo.h"], + [prte_check_alps_dir_cle4_happy="yes"], + [prte_check_alps_dir_cle4_happy="no" + AC_MSG_RESULT([no])]) + + AS_IF([test "$prte_check_alps_libdir_cle4_happy" = "yes" && test "$prte_check_alps_dir_cle4_happy" = "yes"], + [CRAY_ALPSLLI_CFLAGS="-I$prte_check_alps_dir/include" + CRAY_ALPSLLI_LIBS="-L$prte_check_alps_libdir -lalpslli -lalpsutil" + CRAY_ALPSLLI_STATIC_LIBS="-L$prte_check_alps_libdir -lalpslli -lalpsutil" + $1], + [$2]) +]) + + + + +# PRTE_CHECK_ALPS(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_ALPS],[ + if test -z "$prte_check_cray_alps_happy"; then + + AC_ARG_WITH([alps], + [AS_HELP_STRING([--with-alps(=DIR|yes|no)], + [Build with ALPS scheduler component, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries (default: auto)])],[],with_alps=auto) + + if test -f /etc/opt/cray/release/clerelease; then + cle_level=`awk -F. '{print [$]1}' /etc/opt/cray/release/clerelease` + else + cle_level="unknown" + fi + + AC_MSG_CHECKING([for ALPS support cle level $cle_level]) + AS_IF([test "$cle_level" = "4" && test "$with_alps" != "no"], + [PRTE_CHECK_ALPS_CLE4([prte_check_cray_alps_happy="yes"], + [prte_check_cray_alps_happy="no"])], + [AS_IF([test "$with_alps" = "no"], + [AC_MSG_RESULT([no]) + $3], + [AS_IF([test "$with_alps" = "auto" || test "$with_alps" = "yes"], + [PKG_CHECK_MODULES_STATIC([CRAY_ALPSLLI], [cray-alpslli], + [prte_check_cray_alps_happy="yes"], + [prte_check_cray_alps_happy="no"] + [AS_IF([test "$with_alps" = "yes"], + [AC_MSG_WARN([ALPS support requested but pkg-config failed.]) + AC_MSG_WARN([Need to explicitly indicate ALPS directory]) + AC_MSG_WARN([on the configure line using --with-alps option.]) + AC_MSG_ERROR([Aborting])],[])] + ) + PKG_CHECK_MODULES_STATIC([CRAY_ALPSUTIL], [cray-alpsutil], + [prte_check_cray_alps_happy="yes"], + [prte_check_cray_alps_happy="no"] + [AS_IF([test "$with_alps" = "yes"], + [AC_MSG_WARN([ALPS support requested but pkg-config failed.]) + AC_MSG_WARN([Need to explicitly indicate ALPS directory]) + AC_MSG_WARN([on the configure line using --with-alps option.]) + AC_MSG_ERROR([Aborting])],[])] + ) + + PKG_CHECK_MODULES_STATIC([CRAY_ALPS], [cray-alps], + [prte_check_cray_alps_happy="yes"], + [prte_check_cray_alps_happy="no"] + [AS_IF([test "$with_alps" = "yes"], + [AC_MSG_WARN([ALPS support requested but pkg-config failed.]) + AC_MSG_WARN([Need to explicitly indicate ALPS directory]) + AC_MSG_WARN([on the configure line using --with-alps option.]) + AC_MSG_ERROR([Aborting])],[])] + ) + PKG_CHECK_MODULES_STATIC([CRAY_WLM_DETECT], [cray-wlm_detect], + [prte_check_cray_alps_happy="yes" + AC_DEFINE_UNQUOTED([CRAY_WLM_DETECT],[1], + [defined to 1 if cray wlm available, 0 otherwise]) + ], + [prte_check_cray_alps_happy="no"] + [AS_IF([test "$with_alps" = "yes"], + [AC_MSG_WARN([ALPS support requested but pkg-config failed.]) + AC_MSG_WARN([Need to explicitly indicate ALPS directory]) + AC_MSG_WARN([on the configure line using --with-alps option.]) + AC_MSG_ERROR([Aborting])],[])] + ) + PKG_CHECK_MODULES_STATIC([CRAY_UGNI], [cray-ugni], + [prte_check_cray_alps_happy="yes" + AC_DEFINE_UNQUOTED([CRAY_UGNI],[1], + [defined to 1 if cray uGNI available, 0 otherwise]) + ], + [prte_check_cray_alps_happy="no"] + [AS_IF([test "$with_alps" = "yes"], + [AC_MSG_WARN([ALPS support requested but pkg-config failed.]) + AC_MSG_WARN([Need to explicitly indicate ALPS directory]) + AC_MSG_WARN([on the configure line using --with-alps option.]) + AC_MSG_ERROR([Aborting])],[])] + ) + ], + [AC_MSG_WARN([See ./configure --help for how to control Open MPI]) + AC_MSG_WARN([configuration for ALPS on CLE 5 and higher systems]) + AC_MSG_ERROR([Aborting])]) + ]) + ]) + + AC_MSG_RESULT([prte_check_cray_alps_happy = $prte_check_cray_alps_happy]) + + AS_IF([test "$prte_check_cray_alps_happy" = "yes"], + [prte_have_cray_alps=1], + [prte_have_cray_alps=0]) + + AC_DEFINE_UNQUOTED([PRTE_HAVE_CRAY_ALPS], + [$prte_have_cray_alps], + [defined to 1 if cray alps env, 0 otherwise]) + + AS_IF([test "$prte_check_cray_alps_happy" = "yes" && test "$enable_static" = "yes"], + [CRAY_ALPSLLI_LIBS = $CRAY_ALPSLLI_STATIC_LIBS + CRAY_ALPSUTIL_LIBS = $CRAY_ALPSUTIL_STATIC_LIBS], + []) + + PRTE_SUMMARY_ADD([Resource Managers], [Cray Alps], [], [$prte_check_cray_alps_happy]) + fi + + AS_IF([test "$prte_check_cray_alps_happy" = "yes"], + [$1_LDFLAGS="[$]$1_LDFLAGS $CRAY_ALPSLLI_LIBS $CRAY_ALPSUTIL_LIBS" + $1_CPPFLAGS="[$]$1_CPPFLAGS $CRAY_ALPSLLI_CFLAGS $CRAY_ALPSUTIL_CFLAGS $CRAY_ALPS_CFLAGS $CRAY_WLM_DETECT_CFLAGS" + $1_LIBS="[$]$1_LIBS $CRAY_ALPSLLI_LIBS $CRAY_ALPSUTIL_LIBS $CRAY_WLM_DETECT_LIBS $CRAY_UGNI_LIBS" + $2], + [$3]) +]) diff --git a/config/prte_check_attributes.m4 b/config/prte_check_attributes.m4 new file mode 100644 index 0000000000000000000000000000000000000000..26d0c4759c97281bd70af5a337e6adfe908e2a8b --- /dev/null +++ b/config/prte_check_attributes.m4 @@ -0,0 +1,567 @@ +# -*- shell-script -*- +# PMIx copyrights: +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# +######################### +# +# Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2010 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. +# Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013 Mellanox Technologies, Inc. +# All rights reserved. +# Copyright (c) 2015 Intel, Inc. All rights reserved. +######################### +# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# +# Search the generated warnings for +# keywords regarding skipping or ignoring certain attributes +# Intel: ignore +# Sun C++: skip +# +AC_DEFUN([_PRTE_ATTRIBUTE_FAIL_SEARCH],[ + AC_REQUIRE([AC_PROG_GREP]) + if test -s conftest.err ; then + # icc uses 'invalid attribute' and 'attribute "__XXX__" ignored' + # Sun 12.1 emits 'warning: attribute parameter "__printf__" is undefined' + for i in invalid ignore skip undefined ; do + $GREP -iq $i conftest.err + if test "$?" = "0" ; then + prte_cv___attribute__[$1]=0 + break; + fi + done + fi +]) + +# +# Check for one specific attribute by compiling with C +# +# The last argument is for specific CFLAGS, that need to be set +# for the compiler to generate a warning on the cross-check. +# This may need adaption for future compilers / CFLAG-settings. +# +AC_DEFUN([_PRTE_CHECK_SPECIFIC_ATTRIBUTE], [ + AC_MSG_CHECKING([for __attribute__([$1])]) + AC_CACHE_VAL(prte_cv___attribute__[$1], [ + # + # Try to compile using the C compiler + # + AC_COMPILE_IFELSE([AC_LANG_SOURCE([$2])], + [ + # + # In case we did succeed: Fine, but was this due to the + # attribute being ignored/skipped? Grep for IgNoRe/skip in conftest.err + # and if found, reset the prte_cv__attribute__var=0 + # + prte_cv___attribute__[$1]=1 + _PRTE_ATTRIBUTE_FAIL_SEARCH([$1]) + ], + [prte_cv___attribute__[$1]=0]) + ]) + + if test "$prte_cv___attribute__[$1]" = "1" ; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi +]) + + +# +# Test the availability of __attribute__ and with the help +# of _PRTE_CHECK_SPECIFIC_ATTRIBUTE for the support of +# particular attributes. Compilers, that do not support an +# attribute most often fail with a warning (when the warning +# level is set). +# The compilers output is parsed in _PRTE_ATTRIBUTE_FAIL_SEARCH +# +# To add a new attributes __NAME__ add the +# prte_cv___attribute__NAME +# add a new check with _PRTE_CHECK_SPECIFIC_ATTRIBUTE (possibly with a cross-check) +# _PRTE_CHECK_SPECIFIC_ATTRIBUTE([name], [int foo (int arg) __attribute__ ((__name__));], [], []) +# and define the corresponding +# AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_NAME, [$prte_cv___attribute__NAME], +# [Whether your compiler has __attribute__ NAME or not]) +# and decide on a correct macro (in prte/include/prte_config_bottom.h): +# # define __prte_attribute_NAME(x) __attribute__(__NAME__) +# +# Please use the "__"-notation of the attribute in order not to +# clash with predefined names or macros (e.g. const, which some compilers +# do not like..) +# + + +AC_DEFUN([PRTE_CHECK_ATTRIBUTES], [ + AC_LANG(C) + AC_MSG_CHECKING(for __attribute__) + + AC_CACHE_VAL(prte_cv___attribute__, [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], + [/* Check for the longest available __attribute__ (since gcc-2.3) */ + struct foo { + char a; + int x[2] __attribute__ ((__packed__)); + }; + ])], + [prte_cv___attribute__=1], + [prte_cv___attribute__=0])]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE, [$prte_cv___attribute__], + [Whether your compiler has __attribute__ or not]) + +# +# Now that we know the compiler support __attribute__ let's check which kind of +# attributed are supported. +# + if test "$prte_cv___attribute__" = "0" ; then + AC_MSG_RESULT([no]) + prte_cv___attribute__aligned=0 + prte_cv___attribute__always_inline=0 + prte_cv___attribute__cold=0 + prte_cv___attribute__const=0 + prte_cv___attribute__deprecated=0 + prte_cv___attribute__deprecated_argument=0 + prte_cv___attribute__format=0 + prte_cv___attribute__format_funcptr=0 + prte_cv___attribute__hot=0 + prte_cv___attribute__malloc=0 + prte_cv___attribute__may_alias=0 + prte_cv___attribute__no_instrument_function=0 + prte_cv___attribute__noinline=0 + prte_cv___attribute__nonnull=0 + prte_cv___attribute__noreturn=0 + prte_cv___attribute__noreturn_funcptr=0 + prte_cv___attribute__packed=0 + prte_cv___attribute__pure=0 + prte_cv___attribute__sentinel=0 + prte_cv___attribute__unused=0 + prte_cv___attribute__visibility=0 + prte_cv___attribute__warn_unused_result=0 + prte_cv___attribute__weak_alias=0 + prte_cv___attribute__destructor=0 + prte_cv___attribute__optnone=0 + prte_cv___attribute__extension=0 + else + AC_MSG_RESULT([yes]) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([aligned], + [struct foo { char text[4]; } __attribute__ ((__aligned__(8)));], + [], + []) + + # + # Ignored by PGI-6.2.5; -- recognized by output-parser + # + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([always_inline], + [int foo (int arg) __attribute__ ((__always_inline__));], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([cold], + [ + int foo(int arg1, int arg2) __attribute__ ((__cold__)); + int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; } + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([const], + [ + int foo(int arg1, int arg2) __attribute__ ((__const__)); + int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; } + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([deprecated], + [ + int foo(int arg1, int arg2) __attribute__ ((__deprecated__)); + int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; } + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([deprecated_argument], + [ + int foo(int arg1, int arg2) __attribute__ ((__deprecated__("compiler allows argument"))); + int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; } + ], + [], + []) + + ATTRIBUTE_CFLAGS= + case "$prte_c_vendor" in + gnu) + ATTRIBUTE_CFLAGS="-Wall" + ;; + intel) + # we want specifically the warning on format string conversion + ATTRIBUTE_CFLAGS="-we181" + ;; + esac + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([format], + [ + int this_printf (void *my_object, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); + ], + [ + static int usage (int * argument); + extern int this_printf (int arg1, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); + + static int usage (int * argument) { + return this_printf (*argument, "%d", argument); /* This should produce a format warning */ + } + /* The autoconf-generated main-function is int main(), which produces a warning by itself */ + int main(void); + ], + [$ATTRIBUTE_CFLAGS]) + + ATTRIBUTE_CFLAGS= + case "$prte_c_vendor" in + gnu) + ATTRIBUTE_CFLAGS="-Wall" + ;; + intel) + # we want specifically the warning on format string conversion + ATTRIBUTE_CFLAGS="-we181" + ;; + esac + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([format_funcptr], + [ + int (*this_printf)(void *my_object, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); + ], + [ + static int usage (int * argument); + extern int (*this_printf) (int arg1, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); + + static int usage (int * argument) { + return (*this_printf) (*argument, "%d", argument); /* This should produce a format warning */ + } + /* The autoconf-generated main-function is int main(), which produces a warning by itself */ + int main(void); + ], + [$ATTRIBUTE_CFLAGS]) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([hot], + [ + int foo(int arg1, int arg2) __attribute__ ((__hot__)); + int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; } + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([malloc], + [ +#ifdef HAVE_STDLIB_H +# include +#endif + int * foo(int arg1) __attribute__ ((__malloc__)); + int * foo(int arg1) { return (int*) malloc(arg1); } + ], + [], + []) + + + # + # Attribute may_alias: No suitable cross-check available, that works for non-supporting compilers + # Ignored by intel-9.1.045 -- turn off with -wd1292 + # Ignored by PGI-6.2.5; ignore not detected due to missing cross-check + # + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([may_alias], + [int * p_value __attribute__ ((__may_alias__));], + [], + []) + + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([no_instrument_function], + [int * foo(int arg1) __attribute__ ((__no_instrument_function__));], + [], + []) + + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([noinline], + [ + int foo(int arg1, int arg2) __attribute__ ((__noinline__)); + int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; } + static int bar(int arg1, int arg2) __attribute__ ((__noinline__)); + static int bar(int arg1, int arg2) { return arg1 * arg2 + arg1; } + ], + [], + []) + + # + # Attribute nonnull: + # Ignored by intel-compiler 9.1.045 -- recognized by cross-check + # Ignored by PGI-6.2.5 (pgCC) -- recognized by cross-check + # + ATTRIBUTE_CFLAGS= + case "$prte_c_vendor" in + gnu) + ATTRIBUTE_CFLAGS="-Wall" + ;; + intel) + # we do not want to get ignored attributes warnings, but rather real warnings + ATTRIBUTE_CFLAGS="-wd1292" + ;; + esac + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([nonnull], + [ + int square(int *arg) __attribute__ ((__nonnull__)); + int square(int *arg) { return *arg; } + ], + [ + static int usage(int * argument); + int square(int * argument) __attribute__ ((__nonnull__)); + int square(int * argument) { return (*argument) * (*argument); } + + static int usage(int * argument) { + return square( ((void*)0) ); /* This should produce an argument must be nonnull warning */ + } + /* The autoconf-generated main-function is int main(), which produces a warning by itself */ + int main(void); + ], + [$ATTRIBUTE_CFLAGS]) + + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([noreturn], + [ +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif + void fatal(int arg1) __attribute__ ((__noreturn__)); + void fatal(int arg1) { exit(arg1); } + ], + [], + []) + + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([noreturn_funcptr], + [ +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif + extern void (*fatal_exit)(int arg1) __attribute__ ((__noreturn__)); + void fatal(int arg1) { fatal_exit (arg1); } + ], + [], + [$ATTRIBUTE_CFLAGS]) + + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([packed], + [ + struct foo { + char a; + int x[2] __attribute__ ((__packed__)); + }; + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([pure], + [ + int square(int arg) __attribute__ ((__pure__)); + int square(int arg) { return arg * arg; } + ], + [], + []) + + # + # Attribute sentinel: + # Ignored by the intel-9.1.045 -- recognized by cross-check + # intel-10.0beta works fine + # Ignored by PGI-6.2.5 (pgCC) -- recognized by output-parser and cross-check + # Ignored by pathcc-2.2.1 -- recognized by cross-check (through grep ignore) + # + ATTRIBUTE_CFLAGS= + case "$prte_c_vendor" in + gnu) + ATTRIBUTE_CFLAGS="-Wall" + ;; + intel) + # we do not want to get ignored attributes warnings + ATTRIBUTE_CFLAGS="-wd1292" + ;; + esac + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([sentinel], + [ + int my_execlp(const char * file, const char *arg, ...) __attribute__ ((__sentinel__)); + ], + [ + static int usage(int * argument); + int my_execlp(const char * file, const char *arg, ...) __attribute__ ((__sentinel__)); + + static int usage(int * argument) { + void * last_arg_should_be_null = argument; + return my_execlp ("lala", "/home/there", last_arg_should_be_null); /* This should produce a warning */ + } + /* The autoconf-generated main-function is int main(), which produces a warning by itself */ + int main(void); + ], + [$ATTRIBUTE_CFLAGS]) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([unused], + [ + int square(int arg1 __attribute__ ((__unused__)), int arg2); + int square(int arg1, int arg2) { return arg2; } + ], + [], + []) + + + # + # Ignored by PGI-6.2.5 (pgCC) -- recognized by the output-parser + # + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([visibility], + [ + int square(int arg1) __attribute__ ((__visibility__("hidden"))); + ], + [], + []) + + + # + # Attribute warn_unused_result: + # Ignored by the intel-compiler 9.1.045 -- recognized by cross-check + # Ignored by pathcc-2.2.1 -- recognized by cross-check (through grep ignore) + # + ATTRIBUTE_CFLAGS= + case "$prte_c_vendor" in + gnu) + ATTRIBUTE_CFLAGS="-Wall" + ;; + intel) + # we do not want to get ignored attributes warnings + ATTRIBUTE_CFLAGS="-wd1292" + ;; + esac + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([warn_unused_result], + [ + int foo(int arg) __attribute__ ((__warn_unused_result__)); + int foo(int arg) { return arg + 3; } + ], + [ + static int usage(int * argument); + int foo(int arg) __attribute__ ((__warn_unused_result__)); + + int foo(int arg) { return arg + 3; } + static int usage(int * argument) { + foo (*argument); /* Should produce an unused result warning */ + return 0; + } + + /* The autoconf-generated main-function is int main(), which produces a warning by itself */ + int main(void); + ], + [$ATTRIBUTE_CFLAGS]) + + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([weak_alias], + [ + int foo(int arg); + int foo(int arg) { return arg + 3; } + int foo2(int arg) __attribute__ ((__weak__, __alias__("foo"))); + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([destructor], + [ + void foo(void) __attribute__ ((__destructor__)); + void foo(void) { return ; } + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([optnone], + [ + void __attribute__ ((__optnone__)) foo(void); + void foo(void) { return ; } + ], + [], + []) + + _PRTE_CHECK_SPECIFIC_ATTRIBUTE([extension], + [ + int i = __extension__ 3; + ], + [], + []) + fi + + # Now that all the values are set, define them + + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_ALIGNED, [$prte_cv___attribute__aligned], + [Whether your compiler has __attribute__ aligned or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_ALWAYS_INLINE, [$prte_cv___attribute__always_inline], + [Whether your compiler has __attribute__ always_inline or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_COLD, [$prte_cv___attribute__cold], + [Whether your compiler has __attribute__ cold or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_CONST, [$prte_cv___attribute__const], + [Whether your compiler has __attribute__ const or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_DEPRECATED, [$prte_cv___attribute__deprecated], + [Whether your compiler has __attribute__ deprecated or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_DEPRECATED_ARGUMENT, [$prte_cv___attribute__deprecated_argument], + [Whether your compiler has __attribute__ deprecated with optional argument]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_FORMAT, [$prte_cv___attribute__format], + [Whether your compiler has __attribute__ format or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_FORMAT_FUNCPTR, [$prte_cv___attribute__format_funcptr], + [Whether your compiler has __attribute__ format and it works on function pointers]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_HOT, [$prte_cv___attribute__hot], + [Whether your compiler has __attribute__ hot or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_MALLOC, [$prte_cv___attribute__malloc], + [Whether your compiler has __attribute__ malloc or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_MAY_ALIAS, [$prte_cv___attribute__may_alias], + [Whether your compiler has __attribute__ may_alias or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION, [$prte_cv___attribute__no_instrument_function], + [Whether your compiler has __attribute__ no_instrument_function or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_NOINLINE, [$prte_cv___attribute__noinline], + [Whether your compiler has __attribute__ noinline or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_NONNULL, [$prte_cv___attribute__nonnull], + [Whether your compiler has __attribute__ nonnull or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_NORETURN, [$prte_cv___attribute__noreturn], + [Whether your compiler has __attribute__ noreturn or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_NORETURN_FUNCPTR, [$prte_cv___attribute__noreturn_funcptr], + [Whether your compiler has __attribute__ noreturn and it works on function pointers]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_PACKED, [$prte_cv___attribute__packed], + [Whether your compiler has __attribute__ packed or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_PURE, [$prte_cv___attribute__pure], + [Whether your compiler has __attribute__ pure or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_SENTINEL, [$prte_cv___attribute__sentinel], + [Whether your compiler has __attribute__ sentinel or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_UNUSED, [$prte_cv___attribute__unused], + [Whether your compiler has __attribute__ unused or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_VISIBILITY, [$prte_cv___attribute__visibility], + [Whether your compiler has __attribute__ visibility or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT, [$prte_cv___attribute__warn_unused_result], + [Whether your compiler has __attribute__ warn unused result or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_WEAK_ALIAS, [$prte_cv___attribute__weak_alias], + [Whether your compiler has __attribute__ weak alias or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_DESTRUCTOR, [$prte_cv___attribute__destructor], + [Whether your compiler has __attribute__ destructor or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_OPTNONE, [$prte_cv___attribute__optnone], + [Whether your compiler has __attribute__ optnone or not]) + AC_DEFINE_UNQUOTED(PRTE_HAVE_ATTRIBUTE_EXTENSION, [$prte_cv___attribute__extension], + [Whether your compiler has __attribute__ extension or not]) +]) diff --git a/config/prte_check_cflags.m4 b/config/prte_check_cflags.m4 new file mode 100644 index 0000000000000000000000000000000000000000..bb032dad2feb7be2ef55ab2b112c6aad9beca747 --- /dev/null +++ b/config/prte_check_cflags.m4 @@ -0,0 +1,42 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2021 IBM Corporation. All rights reserved. +dnl +dnl Copyright (c) 2021 Nanook Consulting. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([_PRTE_CFLAGS_FAIL_SEARCH],[ + AC_REQUIRE([AC_PROG_GREP]) + if test -s conftest.err ; then + $GREP -iq $1 conftest.err + if test "$?" = "0" ; then + prte_cv_cc_[$2]=0 + fi + fi +]) + +AC_DEFUN([_PRTE_CHECK_SPECIFIC_CFLAGS], [ +AC_MSG_CHECKING(if $CC supports ([$1])) + CFLAGS_orig=$CFLAGS + PRTE_APPEND_UNIQ([CFLAGS], ["$1"]) + AC_CACHE_VAL(prte_cv_cc_[$2], [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [$3])], + [ + prte_cv_cc_[$2]=1 + _PRTE_CFLAGS_FAIL_SEARCH("ignored\|not recognized\|not supported\|not compatible\|unrecognized\|unknown", [$2]) + ], + prte_cv_cc_[$2]=1 + _PRTE_CFLAGS_FAIL_SEARCH("ignored\|not recognized\|not supported\|not compatible\|unrecognized\|unknown\|error", [$2]) + )]) + if test "$prte_cv_cc_[$2]" = "0" ; then + CFLAGS="$CFLAGS_orig" + AC_MSG_RESULT([no]) + else + AC_MSG_RESULT([yes]) + fi +]) diff --git a/config/prte_check_compiler_version.m4 b/config/prte_check_compiler_version.m4 new file mode 100644 index 0000000000000000000000000000000000000000..70f8bd6aad899a6a42b989064b4767a663002a2b --- /dev/null +++ b/config/prte_check_compiler_version.m4 @@ -0,0 +1,58 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. +dnl Copyright (c) 2021 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights +dnl reserved. +dnl +dnl Copyright (c) 2021 Nanook Consulting. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + + +# PRTE_CHECK_COMPILER_VERSION_ID() +# ---------------------------------------------------- +# Try to figure out the compiler's name and version to detect cases, +# where users compile Open MPI with one version and compile the application +# with a different compiler. +# +AC_DEFUN([PRTE_CHECK_COMPILER_VERSION_ID], +[ + PRTE_CHECK_COMPILER(FAMILYID) + PRTE_CHECK_COMPILER(VERSION) +])dnl + + +AC_DEFUN([PRTE_CHECK_COMPILER], [ + AS_LITERAL_IF([$1], [], + [m4_fatal([PRTE_CHECK_COMPILER argument must be a literal])]) + lower=m4_tolower([$1]) + AC_CACHE_CHECK([for compiler $lower], [prte_cv_compiler_$1], + [ + CPPFLAGS_orig=$CPPFLAGS + CPPFLAGS="-I${PRTE_TOP_SRCDIR}/prte/include $CPPFLAGS" + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +#include "src/include/prte_portable_platform.h" +]],[[ + FILE * f; + f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf (f, "%d", PLATFORM_COMPILER_$1); + ]])], [ + prte_cv_compiler_$1=`cat conftestval` + ], [ + prte_cv_compiler_$1=0 + ], [ + prte_cv_compiler_$1=0 + ]) + CPPFLAGS=$CPPFLAGS_orig + ]) + AC_DEFINE_UNQUOTED([PRTE_BUILD_PLATFORM_COMPILER_$1], [$prte_cv_compiler_$1], + [The compiler $lower which OMPI was built with]) +])dnl diff --git a/config/prte_check_compiler_works.m4 b/config/prte_check_compiler_works.m4 new file mode 100644 index 0000000000000000000000000000000000000000..1d10de2671fed6f14704096e4998b6e56e4f65fa --- /dev/null +++ b/config/prte_check_compiler_works.m4 @@ -0,0 +1,57 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# PRTE_CHECK_COMPILER_WORKS(language, headers, body, +# [action-if-found], [action-if-not-found]) +# ---------------------------------------------------- +# Try to compile and run a simple application in 'language'. A +# warning is always printed if the application fails to run. +# Action-if-found is evaluated if the application runs successfully +# (or compiles if cross-compiling), and action-if-not-found is +# evaluated if the application fails to run. +# +# headers are any headers needed to compile the body (e.g., #include +# statements), and body is the program to compile. It should include +# a clean exit from the application (e.g., "return 0" in C/C++, empty in +# fortran). +AC_DEFUN([PRTE_CHECK_COMPILER_WORKS], +[ AS_VAR_PUSHDEF([lang_var], [prte_cv_$1_works]) + + AC_CACHE_CHECK([if $1 compiler works], lang_var, + [AC_LANG_PUSH($1) + AC_RUN_IFELSE([AC_LANG_PROGRAM([$2], [$3])], + [AS_VAR_SET(lang_var, ["yes"])], + [AS_VAR_SET(lang_var, ["no"])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])], + [AS_VAR_SET(lang_var, ["links (cross compiling)"])], + [AS_VAR_SET(lang_var, ["no"])])]) + AC_LANG_POP($1)]) + AS_VAR_IF(lang_var, [no], + [cat <&2 +********************************************************************** +* It appears that your $1 compiler is unable to produce working +* executables. A simple test application failed to properly +* execute. Note that this is likely not a problem with Open MPI, +* but a problem with the local compiler installation. More +* information (including exactly what command was given to the +* compiler and what error resulted when the command was executed) is +* available in the config.log file in the Open MPI build directory. +********************************************************************** +EOF + $5], [$4]) + + AS_VAR_POPDEF([lang_var])dnl +]) diff --git a/config/prte_check_ident.m4 b/config/prte_check_ident.m4 new file mode 100644 index 0000000000000000000000000000000000000000..62c783a051ccffdd4bc36cc723042cac6a370928 --- /dev/null +++ b/config/prte_check_ident.m4 @@ -0,0 +1,104 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. +dnl Copyright (c) 2015-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl +dnl defines: +dnl PRTE_$1_USE_PRAGMA_IDENT +dnl PRTE_$1_USE_IDENT +dnl PRTE_$1_USE_CONST_CHAR_IDENT +dnl + +# PRTE_CHECK_IDENT(compiler-env, compiler-flags, +# file-suffix, lang) Try to compile a source file containing +# a #pragma ident, and determine whether the ident was +# inserted into the resulting object file +# ----------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_IDENT], [ + AC_MSG_CHECKING([for $4 ident string support]) + + prte_pragma_ident_happy=0 + prte_ident_happy=0 + prte_static_const_char_happy=0 + _PRTE_CHECK_IDENT( + [$1], [$2], [$3], + [[#]pragma ident], [], + [prte_pragma_ident_happy=1 + prte_message="[#]pragma ident"], + _PRTE_CHECK_IDENT( + [$1], [$2], [$3], + [[#]ident], [], + [prte_ident_happy=1 + prte_message="[#]ident"], + _PRTE_CHECK_IDENT( + [$1], [$2], [$3], + [[#]pragma comment(exestr, ], [)], + [prte_pragma_comment_happy=1 + prte_message="[#]pragma comment"], + [prte_static_const_char_happy=1 + prte_message="static const char[[]]"]))) + + AC_DEFINE_UNQUOTED([PRTE_$1_USE_PRAGMA_IDENT], + [$prte_pragma_ident_happy], [Use #pragma ident strings for $4 files]) + AC_DEFINE_UNQUOTED([PRTE_$1_USE_IDENT], + [$prte_ident_happy], [Use #ident strings for $4 files]) + AC_DEFINE_UNQUOTED([PRTE_$1_USE_PRAGMA_COMMENT], + [$prte_pragma_comment_happy], [Use #pragma comment for $4 files]) + AC_DEFINE_UNQUOTED([PRTE_$1_USE_CONST_CHAR_IDENT], + [$prte_static_const_char_happy], [Use static const char[] strings for $4 files]) + + AC_MSG_RESULT([$prte_message]) + + unset prte_pragma_ident_happy prte_ident_happy prte_static_const_char_happy prte_message +]) + +# _PRTE_CHECK_IDENT(compiler-env, compiler-flags, +# file-suffix, header_prefix, header_suffix, action-if-success, action-if-fail) +# Try to compile a source file containing a #-style ident, +# and determine whether the ident was inserted into the +# resulting object file +# ----------------------------------------------------------- +AC_DEFUN([_PRTE_CHECK_IDENT], [ + eval prte_compiler="\$$1" + eval prte_flags="\$$2" + + prte_ident="string_not_coincidentally_inserted_by_the_compiler" + cat > conftest.$3 <&5 + prte_output=`$prte_compiler $prte_flags -c conftest.$3 -o conftest.${OBJEXT} 2>&1 1>/dev/null` + prte_status=$? + AS_IF([test $prte_status = 0], + [test -z "$prte_output" + prte_status=$?]) + PRTE_LOG_MSG([\$? = $prte_status], 1) + AS_IF([test $prte_status = 0 && test -f conftest.${OBJEXT}], + [prte_output="`strings -a conftest.${OBJEXT} | grep $prte_ident`" + grep $prte_ident conftest.${OBJEXT} 2>&1 1>/dev/null + prte_status=$? + AS_IF([test "$prte_output" != "" || test "$prte_status" = "0"], + [$6], + [$7])], + [PRTE_LOG_MSG([the failed program was:]) + PRTE_LOG_FILE([conftest.$3]) + $7]) + + unset prte_compiler prte_flags prte_output prte_status + rm -rf conftest.* conftest${EXEEXT} +])dnl diff --git a/config/prte_check_lock.m4 b/config/prte_check_lock.m4 new file mode 100644 index 0000000000000000000000000000000000000000..3e21aa4a0e26437846548049c38f157faa8cd52c --- /dev/null +++ b/config/prte_check_lock.m4 @@ -0,0 +1,63 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2017 Mellanox Technologies, Inc. +dnl All rights reserved. +dnl Copyright (c) 2017 IBM Corporation. All rights reserved. +dnl Copyright (c) 2017 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2017-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([PRTE_CHECK_DSTOR_LOCK],[ + orig_libs=$LIBS + LIBS="-lpthread $LIBS" + + _x_ac_pthread_lock_found="0" + _x_ac_fcntl_lock_found="0" + + AC_CHECK_MEMBERS([struct flock.l_type], + [ + AC_DEFINE([HAVE_FCNTL_FLOCK], [1], + [Define to 1 if you have the locking by fcntl.]) + _x_ac_fcntl_lock_found="1" + ], [], [#include ]) + + if test "$DSTORE_PTHREAD_LOCK" = "1"; then + AC_CHECK_FUNC([pthread_rwlockattr_setkind_np], + [AC_EGREP_HEADER([PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP], + [pthread.h],[ + AC_DEFINE([HAVE_PTHREAD_SETKIND], [1], + [Define to 1 if you have the `pthread_rwlockattr_setkind_np` function.])])]) + + AC_CHECK_FUNC([pthread_rwlockattr_setpshared], + [AC_EGREP_HEADER([PTHREAD_PROCESS_SHARED], + [pthread.h],[ + AC_DEFINE([HAVE_PTHREAD_SHARED], [1], + [Define to 1 if you have the `PTHREAD_PROCESS_SHARED` definition. + ]) + _x_ac_pthread_lock_found="1" + ]) + ]) + + if test "$_x_ac_pthread_lock_found" = "0"; then + if test "$_x_ac_fcntl_lock_found" = "1"; then + AC_MSG_WARN([dstore: pthread-based locking not found, will use fcntl-based locking.]) + else + AC_MSG_ERROR([dstore: no available locking mechanisms was found. Can not continue. Try disabling dstore]) + fi + fi + else + if test "$_x_ac_fcntl_lock_found" = "0"; then + AC_MSG_ERROR([dstore: no available locking mechanisms was found. Can not continue. Try disabling dstore]) + fi + fi + LIBS="$orig_libs" + AM_CONDITIONAL([HAVE_DSTORE_PTHREAD_LOCK], [test "$_x_ac_pthread_lock_found" = "1"]) + AM_CONDITIONAL([HAVE_DSTORE_FCNTL_LOCK], [test "$_x_ac_fcntl_lock_found" = "1"]) +]) diff --git a/config/prte_check_lsf.m4 b/config/prte_check_lsf.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f86d3acb37ff065368d8b8456cb1651bfb8f4fbb --- /dev/null +++ b/config/prte_check_lsf.m4 @@ -0,0 +1,176 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2015 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2017-2021 IBM Corporation. All rights reserved. +dnl Copyright (c) 2017-2020 Intel, Inc. All rights reserved. +dnl Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# check for lsf +# PRTE_CHECK_LSF(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_LSF],[ + AC_ARG_WITH([lsf], + [AS_HELP_STRING([--with-lsf(=DIR)], + [Build LSF support])]) + AC_ARG_WITH([lsf-libdir], + [AS_HELP_STRING([--with-lsf-libdir=DIR], + [Search for LSF libraries in DIR])]) + + AS_IF([test "$with_lsf" != "no"],[ + # If no directories were specified, look for LSF_LIBDIR, + # LSF_INCLUDEDIR, and/or LSF_ENVDIR. + AS_IF([test "${with_lsf}" = "yes" -o -z "${with_lsf}"], + [AS_IF([test ! -z "$LSF_ENVDIR" && test -z "$LSF_INCLUDEDIR" && test -f "$LSF_ENVDIR/lsf.conf"], + [LSF_INCLUDEDIR=`egrep ^LSF_INCLUDEDIR= $LSF_ENVDIR/lsf.conf | cut -d= -f2-`]) + AS_IF([test ! -z "$LSF_INCLUDEDIR"], + [with_lsf_incdir=`dirname $LSF_INCLUDEDIR` + AC_MSG_NOTICE([Setting LSF includedir to ${with_lsf_incdir}])]) + + AS_IF([test -z "${with_lsf_libdir}"], + [AS_IF([test ! -z "$LSF_ENVDIR" && test -z "$LSF_LIBDIR" && test -f "$LSF_ENVDIR/lsf.conf"], + [LSF_LIBDIR=`egrep ^LSF_LIBDIR= $LSF_ENVDIR/lsf.conf | cut -d= -f2-`]) + AS_IF([test ! -z "$LSF_LIBDIR"], + [with_lsf_libdir=$LSF_LIBDIR + AC_MSG_NOTICE([Setting LSF libdir to ${with_lsf_libdir}])])])]) + + prte_check_lsf_$1_save_CPPFLAGS="$CPPFLAGS" + prte_check_lsf_$1_save_LDFLAGS="$LDFLAGS" + prte_check_lsf_$1_save_LIBS="$LIBS" + + prte_check_lsf_happy="yes" + + # liblsf requires yp_all, yp_get_default_domain, and ypprot_err + # on Linux, Solaris, NEC, and Sony NEWSs these are found in libnsl + # on AIX it should be in libbsd + # on HP-UX it should be in libBSD + # on IRIX < 6 it should be in libsun (IRIX 6 and later it is in libc) + # on RHEL: libnsl, libnsl2 AND libnsl2-devel are required to link libnsl to get yp_all. + AS_IF([test "$prte_check_lsf_happy" = "yes"], + [PRTE_SEARCH_LIBS_COMPONENT([yp_all_nsl], [yp_all], [nsl bsd BSD sun], + [prte_check_lsf_happy="yes"], + [AS_IF([test "${with_lsf}" = "yes"], + [AC_MSG_WARN([[Could not find yp_all. Please see https://github.com/openpmix/prrte/wiki/Building-LSF-support for more details.]]) + AC_MSG_ERROR([Cannot build requested LSF support])]) + prte_check_lsf_happy="no"])]) + + # liblsf requires shm_open, shm_unlink, which are in librt + AS_IF([test "$prte_check_lsf_happy" = "yes"], + [PRTE_SEARCH_LIBS_COMPONENT([shm_open_rt], [shm_open], [rt], + [prte_check_lsf_happy="yes"], + [prte_check_lsf_happy="no"])]) + + AS_IF([test "$prte_check_lsf_happy" = "yes"], + [OAC_CHECK_PACKAGE([lsf], + [ls_info_lsf], + [lsf/lsf.h], + [lsf $yp_all_nsl_LIBS $shm_open_rt_LIBS], + [ls_info], + [prte_check_lsf_happy="yes"], + [prte_check_lsf_happy="no"])]) + + # test function of liblsb LSF package + AS_IF([test "$prte_check_lsf_happy" = "yes"], + [with_lsfbatch=${with_lsf} + with_lsfbatch_incdir=${with_lsf_incdir} + with_lsfbatch_libdir=${with_lsf_libdir} + OAC_CHECK_PACKAGE([lsfbatch], + [prte_check_lsf], + [lsf/lsbatch.h], + [bat $ls_info_lsf_LIBS], + [lsb_launch], + [prte_check_lsf_happy="yes"], + [prte_check_lsf_happy="no"])]) + + # Some versions of LSF ship with a libevent.so in their library path. + # This is _not_ a copy of Libevent, but something specific to their project. + # The PRRTE components should not need to link against LSF's libevent.so + # However, the presence of it in the linker search path can cause a problem + # + # Add a check here to see if we are in a scenario where the two are conflicting. + # In which case the earlier checks for successful compile of an LSF program will + # have failed with messages like: + # lib64/libevent_pthreads.so: undefined reference to `evthread_set_condition_callbacks' + # lib64/libevent_pthreads.so: undefined reference to `event_mm_malloc_' + # lib64/libevent_pthreads.so: undefined reference to `event_mm_free_' + # lib64/libevent_pthreads.so: undefined reference to `evthread_set_id_callback' + # lib64/libevent_pthreads.so: undefined reference to `evthread_set_lock_callbacks' + # Because it picked up -levent from LSF, but -levent_pthreads from Libevent. + # + # So look for a function that libevent_pthreads is looking for from libevent.so. + # If it does appears then we have the correct libevent.so, otherwise then we picked + # up the LSF version and a conflict has been detected. + # If the external libevent component used 'event_core' instead of 'event' + prte_check_lsf_event_conflict=na + # Split libs into an array, see if -levent is in that list + prte_check_lsf_libevent_present=`echo "$LIBS" | awk '{split([$]0, a, " "); {for (k in a) {if (a[[k]] == "-levent") {print a[[k]]}}}}' | wc -l | tr -d '[[:space:]]'` + # (1) LSF check must have failed above. We need to know why... + AS_IF([test "${with_lsf}" = "yes" && test "$prte_check_lsf_happy" = "no"], + [# (2) If there is a -levent in the $LIBS then that might be the problem + AS_IF([test "$prte_check_lsf_libevent_present" != "0"], + [AS_IF([test "$prte_check_lsf_libdir" = "" ], + [], + [LDFLAGS="$LDFLAGS -L$prte_check_lsf_libdir"]) + # Note that we do not want to set LIBS here to include -llsf since + # the check is not for an LSF library, but for the conflict with + # LDFLAGS. + # (3) Check to see if the -levent is from Libevent (check for a symbol it has) + AC_CHECK_LIB([event], [evthread_set_condition_callbacks], + [AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([No conflict found. The correct libevent.so was linked.]) + prte_check_lsf_event_conflict=no], + [# (4) The libevent.so is not from Libevent. Warn the user. + AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([Conflict found. Detected a libevent.so that is not from Libevent.]) + prte_check_lsf_event_conflict=yes]) + ], + [AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([No conflict found. -levent is not being explicitly used.]) + prte_check_lsf_event_conflict=na])], + [AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([No conflict found. LSF checks passed.]) + prte_check_lsf_event_conflict=na]) + + AS_IF([test "$prte_check_lsf_event_conflict" = "yes"], + [AC_MSG_WARN([===================================================================]) + AC_MSG_WARN([===================================================================]) + ]) + + CPPFLAGS="$prte_check_lsf_$1_save_CPPFLAGS" + LDFLAGS="$prte_check_lsf_$1_save_LDFLAGS" + LIBS="$prte_check_lsf_$1_save_LIBS" + + ], [prte_check_lsf_happy="no (disabled by user)"]) + + PRTE_SUMMARY_ADD([Resource Managers], [LSF], [], [$prte_check_lsf_happy]) + + AS_IF([test "$prte_check_lsf_happy" = "yes"], + [$1_LIBS="[$]$1_LIBS $prte_check_lsf_LIBS" + $1_LDFLAGS="[$]$1_LDFLAGS $prte_check_lsf_LDFLAGS" + $1_CPPFLAGS="[$]$1_CPPFLAGS $prte_check_lsf_CPPFLAGS" + # add the LSF libraries to static builds as they are required + $2], + [AS_IF([test ! -z "$with_lsf" && test "$with_lsf" != "no"], + [AC_MSG_WARN([LSF support requested (via --with-lsf) but not found.]) + AC_MSG_ERROR([Aborting.])]) + $3]) +]) diff --git a/config/prte_check_moab.m4 b/config/prte_check_moab.m4 new file mode 100644 index 0000000000000000000000000000000000000000..4b18e5c24663b1bf0c2ead43f0c4a21887537d64 --- /dev/null +++ b/config/prte_check_moab.m4 @@ -0,0 +1,76 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2016 Los Alamos National Security, LLC. All rights +# reserved. +# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. +# All Rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# PRTE_CHECK_MOAB(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_MOAB],[ + PRTE_VAR_SCOPE_PUSH([prte_check_moab_$1_save_CPPFLAGS prte_check_moab_$1_save_LDFLAGS prte_check_moab_$1_save_LIBS]) + + AC_ARG_WITH([moab], + [AS_HELP_STRING([--with-moab], + [Build MOAB scheduler component (default: yes)])]) + AC_ARG_WITH([moab-libdir], + [AS_HELP_STRING([--with-moab-libdir=DIR], + [Search for Moab libraries in DIR])]) + + prte_check_moab_happy="yes" + AS_IF([test "$with_moab" = "no"], + [prte_check_moab_happy=no]) + + prte_check_moab_$1_save_CPPFLAGS=$CPPFLAGS + prte_check_moab_$1_save_LDFLAGS=$LDFLAGS + prte_check_moab_$1_save_LIBS=$LIBS + + AS_IF([test $prte_check_moab_happy = yes], + [OAC_CHECK_PACKAGE([moab], + [prte_check_moab], + [mapi.h], + [cmoab], + [MCCJobGetRemainingTime], + [], + [prte_check_moab_happy=no])]) + + CPPFLAGS=$prte_check_moab_$1_save_CPPFLAGS + LDFLAGS=$prte_check_moab_$1_save_LDFLAGS + LIBS=$prte_check_moab_$1_save_LIBS + + PRTE_SUMMARY_ADD([Resource Managers], [Moab], [], [$prte_check_moab_SUMMARY]) + PRTE_VAR_SCOPE_POP + + if test $prte_check_moab_happy = yes ; then + $1_CPPFLAGS="[$]$1_CPPFLAGS $prte_check_moab_CPPFLAGS" + $1_LIBS="[$]$1_LIBS $prte_check_moab_LIBS" + $1_LDFLAGS="[$]$1_LDFLAGS $prte_check_moab_LDFLAGS" + + AC_SUBST($1_CPPFLAGS) + AC_SUBST($1_LDFLAGS) + AC_SUBST($1_LIBS) + fi + + AS_IF([test "$prte_check_moab_happy" = "yes"], + [$2], + [$3]) +]) diff --git a/config/prte_check_offsetof.m4 b/config/prte_check_offsetof.m4 new file mode 100644 index 0000000000000000000000000000000000000000..912daa454dda6651d2446966e8976c15ceccc76a --- /dev/null +++ b/config/prte_check_offsetof.m4 @@ -0,0 +1,43 @@ +# -*- shell-script -*- +# +# Copyright (c) 2009 IBM Corporation. All rights reserved. +# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This macro checks to ensure that the compiler properly supports +# offsetof(). The PGI compilers had a problem with this macro in some +# versions of their compiler on some platforms (e.g., 9.0-1 on +# x86_64). The workaround is to use -DNO_PGI_OFFSET in these cases. +# A bug report was submitted to PGI support in late June 2009; the +# problem was apparently a trivial typo in one of their header files +# and should be fixed in subsequent releases (e.g., 9.0-2?). + +AC_DEFUN([PRTE_CHECK_OFFSETOF],[ + PRTE_VAR_SCOPE_PUSH([have_offsetof_msg]) + + AC_MSG_CHECKING(for functional offsetof macro) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include]], + [[struct foo {int a, b;}; size_t offset = offsetof(struct foo, b); ]])], + [have_offsetof_msg="yes"], [have_offsetof_msg="no"]) + if test "$have_offsetof_msg" = "no"; then + CPPFLAGS="$CPPFLAGS -DNO_PGI_OFFSET" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include]], + [[struct foo {int a, b;}; size_t offset = offsetof(struct foo, b); ]])], + [have_offsetof_msg="yes"], [have_offsetof_msg="no"]) + + if test "$have_offsetof_msg" = "no"; then + AC_MSG_RESULT([$have_offsetof_msg]) + AC_MSG_WARN([Your compiler does not support offsetof macro]) + AC_MSG_ERROR([Configure: Cannot continue]) + fi + fi + + AC_MSG_RESULT([$have_offsetof_msg]) + PRTE_VAR_SCOPE_POP +])dnl diff --git a/config/prte_check_os_flavors.m4 b/config/prte_check_os_flavors.m4 new file mode 100644 index 0000000000000000000000000000000000000000..dbc63f282654fe5356feac6895a79157c43e57a1 --- /dev/null +++ b/config/prte_check_os_flavors.m4 @@ -0,0 +1,77 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl +dnl Copyright (c) 2022 Nanook Consulting. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# PRTE_CHECK_OS_FLAVOR_SPECIFIC() +# ---------------------------------------------------- +# Helper macro from PRTE-CHECK-OS-FLAVORS(), below. +# $1 = macro to look for +# $2 = suffix of env variable to set with results +AC_DEFUN([PRTE_CHECK_OS_FLAVOR_SPECIFIC], +[ + AC_MSG_CHECKING([$1]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#ifndef $1 + #this is not $1, error + #endif + ]])], + [prte_found_$2=yes], + [prte_found_$2=no]) + AC_MSG_RESULT([$prte_found_$2]) +])dnl + +# PRTE_CHECK_OS_FLAVORS() +# ---------------------------------------------------- +# Try to figure out the various OS flavors out there. +# +AC_DEFUN([PRTE_CHECK_OS_FLAVORS], +[ + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__NetBSD__], [netbsd]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__FreeBSD__], [freebsd]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__OpenBSD__], [openbsd]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__DragonFly__], [dragonfly]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__386BSD__], [386bsd]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__bsdi__], [bsdi]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__APPLE__], [apple]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__linux__], [linux]) + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__sun__], [sun]) + AS_IF([test "$prte_found_sun" = "no"], + PRTE_CHECK_OS_FLAVOR_SPECIFIC([__sun], [sun])) + + AS_IF([test "$prte_found_sun" = "yes"], + [prte_have_solaris=1 + CFLAGS="$CFLAGS -D_REENTRANT" + CPPFLAGS="$CPPFLAGS -D_REENTRANT"], + [prte_have_solaris=0]) + AC_DEFINE_UNQUOTED([PRTE_HAVE_SOLARIS], + [$prte_have_solaris], + [Whether or not we have solaris]) + + AS_IF([test "$prte_found_apple" = "yes"], + [prte_have_apple=1], + [prte_have_apple=0]) + AC_DEFINE_UNQUOTED([PRTE_HAVE_APPLE], + [$prte_have_apple], + [Whether or not we have apple]) + + # check for sockaddr_in (a good sign we have TCP) + AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h]) + AC_CHECK_TYPES([struct sockaddr_in], + [prte_found_sockaddr=yes], + [prte_found_sockaddr=no], + [AC_INCLUDES_DEFAULT +#ifdef HAVE_NETINET_IN_H +#include +#endif]) +])dnl diff --git a/config/prte_check_pthread_pids.m4 b/config/prte_check_pthread_pids.m4 new file mode 100644 index 0000000000000000000000000000000000000000..95a229253665c801ce68c2a16e409d8ebc8ef085 --- /dev/null +++ b/config/prte_check_pthread_pids.m4 @@ -0,0 +1,109 @@ +dnl +dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2017-2019 Intel, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([PRTE_CHECK_PTHREAD_PIDS],[ +# +# Arguments: none +# +# Dependencies: None +# +# Sets: +# PRTE_THREADS_HAVE_DIFFERENT_PIDS (variable) +# +# Test for Linux-like threads in the system. PRTE does not support +# systems with different PIDs for threads in the same process, so error +# out if we detect that case. +# + +AC_MSG_CHECKING([if threads have different pids (pthreads on linux)]) + +PRTE_VAR_SCOPE_PUSH([tpids_CFLAGS_save tpids_CPPFLAGS_save tpids_LDFLAGS_save tpids_LIBS_save tpids_MSG]) +tpids_CFLAGS_save="$CFLAGS" +CFLAGS="$CFLAGS $THREAD_CFLAGS" +tpids_CPPFLAGS_save="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS" +tpids_LDFLAGS_save="$LDFLAGS" +LDFLAGS="$LDFLAGS $THREAD_LDFLAGS" +tpids_LIBS_save="$LIBS" +LIBS="$LIBS $THREAD_LIBS" +AC_RUN_IFELSE([AC_LANG_SOURCE([#include +#include +#include +#include + +void *checkpid(void *arg); +int main() { + pthread_t thr; + int pid, *retval; + pid = getpid(); + pthread_create(&thr, NULL, checkpid, &pid); + pthread_join(thr, (void **) &retval); + exit(*retval); +} + +static int ret; +void *checkpid(void *arg) { + int ppid = *((int *) arg); + if (ppid == getpid()) + ret = 0; + else + ret = 1; + pthread_exit((void *) &ret); +}])], +[tpids_MSG=no PRTE_THREADS_HAVE_DIFFERENT_PIDS=0], +[tpids_MSG=yes PRTE_THREADS_HAVE_DIFFERENT_PIDS=1], +[ + # If we're cross compiling, we can't do another AC_* function here beause + # it we haven't displayed the result from the last one yet. So defer + # another test until below. + PRTE_THREADS_HAVE_DIFFERENT_PIDS= + MSG="cross compiling (need another test)"]) + +CFLAGS="$tpids_CFLAGS_save" +CPPFLAGS="$tpids_CPPFLAGS_save" +LDFLAGS="$tpids_LDFLAGS_save" +LIBS="$tpids_LIBS_save" + +AC_MSG_RESULT([$tpids_MSG]) + +AS_IF([test "x$PRTE_THREADS_HAVE_DIFFERENT_PIDS" = "x"], + [ # If we are cross-compiling, look for the symbol + # __linuxthreads_create_event, which seems to only exist in the + # Linux Threads-based pthreads implementation (i.e., the one + # that has different PIDs for each thread). We *could* switch + # on $host here and only test *linux* hosts, but this test is + # pretty unique, so why bother? Note that AC_CHECK_FUNC works + # properly in cross-compiling environments in recent-enough + # versions of Autoconf (which is one of the reasons we mandate + # recent versions in autogen!). + AC_CHECK_FUNC([__linuxthreads_create_event], + [PRTE_THREADS_HAVE_DIFFERENT_PIDS=1])]) + +AS_IF([test "$PRTE_THREADS_HAVE_DIFFERENT_PIDS" = "1"], + [AC_MSG_WARN([This version of PMIx only supports environments where]) + AC_MSG_WARN([threads have the same PID]) + AC_MSG_ERROR([Cannot continue]) + ]) + +# +# if pthreads is not available, then the system does not have an insane threads +# model +# +PRTE_VAR_SCOPE_POP])dnl diff --git a/config/prte_check_ptrace.m4 b/config/prte_check_ptrace.m4 new file mode 100644 index 0000000000000000000000000000000000000000..a0369af5dd68067a2731297392f1c545fcca0532 --- /dev/null +++ b/config/prte_check_ptrace.m4 @@ -0,0 +1,121 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2020 Intel, Inc. All rights reserved. +dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2022 Nanook Consulting. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# See if there is support for ptrace options required for +# "stop-on-exec" behavior. + +AC_DEFUN([PRTE_CHECK_PTRACE],[ + + PRTE_VAR_SCOPE_PUSH(prte_have_ptrace_traceme prte_have_ptrace_detach prte_have_ptrace_header prte_have_ptrace prte_want_stop_on_exec prte_traceme_cmd prte_detach_cmd prte_ptrace_linux_sig prte_ptrace_CFLAGS_save) + + prte_have_ptrace_traceme=no + prte_have_ptrace_detach=no + prte_traceme_cmd= + prte_detach_cmd= + + AC_CHECK_HEADER([sys/ptrace.h], + [prte_have_ptrace_header=1 + # must manually define the header protection since check_header doesn't do it + AC_DEFINE_UNQUOTED([HAVE_SYS_PTRACE_H], [1], [Whether or not we have the ptrace header])], + [prte_have_ptrace_header=0]) + + AC_CHECK_FUNC([ptrace], + [prte_have_ptrace=yes], + [prte_have_ptrace=no]) + + if test "$prte_have_ptrace_header" = "1" && test "$prte_have_ptrace" = "yes"; then + AC_MSG_CHECKING([PTRACE_TRACEME]) + AC_EGREP_CPP([yes], + [#include + #ifdef PTRACE_TRACEME + yes + #endif + ], + [AC_MSG_RESULT(yes) + prte_have_ptrace_traceme=yes + prte_traceme_cmd=PTRACE_TRACEME], + [AC_MSG_RESULT(no) + AC_MSG_CHECKING([PT_TRACE_ME]) + AC_EGREP_CPP([yes], + [#include + #ifdef PT_TRACE_ME + yes + #endif + ], + [AC_MSG_RESULT(yes) + prte_have_ptrace_traceme=yes + prte_traceme_cmd=PT_TRACE_ME], + [AC_MSG_RESULT(no) + prte_have_ptrace_traceme=no]) + ]) + + AC_MSG_CHECKING([PTRACE_DETACH]) + AC_EGREP_CPP([yes], + [#include + #ifdef PTRACE_DETACH + yes + #endif + ], + [AC_MSG_RESULT(yes) + prte_have_ptrace_detach=yes + prte_detach_cmd=PTRACE_DETACH], + [AC_MSG_RESULT(no) + AC_MSG_CHECKING(PT_DETACH) + AC_EGREP_CPP([yes], + [#include + #ifdef PT_DETACH + yes + #endif + ], + [AC_MSG_RESULT(yes) + prte_have_ptrace_detach=yes + prte_detach_cmd=PT_DETACH], + [AC_MSG_RESULT(no) + prte_have_ptrace_detach=no]) + ]) + + AC_MSG_CHECKING([Linux ptrace function signature]) + AC_LANG_PUSH(C) + # must have -Werror set here + prte_ptrace_CFLAGS_save=$CFLAGS + CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include "sys/ptrace.h"]], + [[long (*ptr)(enum __ptrace_request request, pid_t pid, void *addr, void *data);] + [ptr = ptrace;]]) + ],[ + AC_MSG_RESULT([yes]) + prte_ptrace_linux_sig=1 + ],[ + AC_MSG_RESULT([no]) + prte_ptrace_linux_sig=0 + ]) + AC_LANG_POP(C) + CFLAGS=$prte_ptrace_CFLAGS_save + + fi + + AC_MSG_CHECKING(ptrace stop-on-exec will be supported) + AS_IF([test "$prte_have_ptrace_traceme" = "yes" && test "$prte_have_ptrace_detach" = "yes"], + [AC_MSG_RESULT(yes) + prte_want_stop_on_exec=1], + [AC_MSG_RESULT(no) + prte_want_stop_on_exec=0]) + + AC_DEFINE_UNQUOTED([PRTE_HAVE_LINUX_PTRACE], [$prte_ptrace_linux_sig], [Does ptrace have the Linux signature]) + AC_DEFINE_UNQUOTED([PRTE_HAVE_STOP_ON_EXEC], [$prte_want_stop_on_exec], [Whether or not we have stop-on-exec support]) + AC_DEFINE_UNQUOTED([PRTE_TRACEME], [$prte_traceme_cmd], [Command for declaring that process expects to be traced by parent]) + AC_DEFINE_UNQUOTED([PRTE_DETACH], [$prte_detach_cmd], [Command to detach from process being traced]) + + PRTE_VAR_SCOPE_POP +]) diff --git a/config/prte_check_sge.m4 b/config/prte_check_sge.m4 new file mode 100644 index 0000000000000000000000000000000000000000..0ed320a3721ce63ac2df20958b00cb34a8f1b5ce --- /dev/null +++ b/config/prte_check_sge.m4 @@ -0,0 +1,61 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2016 Los Alamos National Security, LLC. All rights +# reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# 1. if --with-sge is given, always build +# 2. if --without-sge is given, never build +# 3. if neither is given, build if-and-only-if you find either qrsh in path or +# sge_root in environment + +# PRTE_CHECK_GRIDENGINE(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_GRIDENGINE],[ + if test -z "$prte_gridengine_build" ; then + AC_ARG_WITH([sge], + [AS_HELP_STRING([--with-sge], + [Build SGE or Grid Engine support (default: no)])]) + + AC_MSG_CHECKING([if user requested SGE build]) + prte_gridengine_build="no" + AS_IF([test "$with_sge" = "yes"], + [AC_MSG_RESULT([yes]) + prte_gridengine_build=yes], + [AS_IF([test "$with_sge" = "no"], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([not specified; checking environment]) + AC_CHECK_PROG([QRSH], [qrsh], [qrsh]) + AS_IF([test "$QRSH" != ""], + [prte_gridengine_build=yes], + [AC_MSG_CHECKING([for SGE_ROOT environment variable]) + AS_IF([test "$SGE_ROOT" != ""], + [AC_MSG_RESULT([found]) + prte_gridengine_build=yes], + [AC_MSG_RESULT([not found])])])])]) + + PRTE_SUMMARY_ADD([Resource Managers], [Grid Engine], [], [$prte_gridengine_build]) + fi + + AS_IF([test "$prte_gridengine_build" = "yes"], + [$2], + [$3]) +]) diff --git a/config/prte_check_singularity.m4 b/config/prte_check_singularity.m4 new file mode 100644 index 0000000000000000000000000000000000000000..9d61f97f28ab7fc3a0ba733138a6b3a3062995d0 --- /dev/null +++ b/config/prte_check_singularity.m4 @@ -0,0 +1,57 @@ +# -*- shell-script ; indent-tabs-mode:nil -*- +# +# Copyright (c) 2016-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# PRTE_CHECK_SINGULARITY() +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_SINGULARITY],[ + PRTE_VAR_SCOPE_PUSH([spath have_singularity]) + + AC_ARG_WITH([singularity], + [AS_HELP_STRING([--with-singularity(=DIR)], + [Build support for the Singularity container, optionally adding DIR to the search path])]) + spath= + AC_MSG_CHECKING([if Singularity is present]) + AS_IF([test "$with_singularity" = "no"], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes]) + AS_IF([test -z "$with_singularity" || test "$with_singularity" = "yes"], + [ # look for the singularity command in the default path + AC_CHECK_PROG([SINGULARITY], [singularity], [singularity]) + AS_IF([test "$SINGULARITY" != ""], + [spath=DEFAULT], + [AS_IF([test "$with_singularity" = "yes"], + [AC_MSG_WARN([Singularity support requested, but required executable]) + AC_MSG_WARN(["singularity" not found in default locations]) + AC_MSG_ERROR([Cannot continue])])])], + [ AC_MSG_CHECKING([for existence of $with_singularity/bin]) + # look for the singularity command in the bin subdirectory + AS_IF([test ! -d "$with_singularity/bin"], + [AC_MSG_RESULT([not found]) + AC_MSG_WARN([Directory $with_singularity/bin not found]) + AC_MSG_ERROR([Cannot continue])], + [AC_MSG_RESULT([found])]) + save_path=$PATH + PATH=$with_singularity/bin:$PATH + AC_CHECK_PROG([SINGULARITY], [singularity], [singularity]) + AS_IF([test "$SINGULARITY" != ""], + [spath=$with_singularity/bin], + [AC_MSG_WARN([Singularity support requested, but required executable]) + AC_MSG_WARN(["singularity" not found in either default or specified path]) + AC_MSG_ERROR([Cannot continue])]) + PATH=$save_path + ] + )]) + + AC_DEFINE_UNQUOTED(PRTE_SINGULARITY_PATH, "$spath", [Path to Singularity binaries]) + + PRTE_VAR_SCOPE_POP +]) diff --git a/config/prte_check_slurm.m4 b/config/prte_check_slurm.m4 new file mode 100644 index 0000000000000000000000000000000000000000..0aa818ad09be23beade9b87c6aa11af5ea66a241 --- /dev/null +++ b/config/prte_check_slurm.m4 @@ -0,0 +1,90 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2016 Los Alamos National Security, LLC. All rights +# reserved. +# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. +# All Rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# PRTE_CHECK_SLURM(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_SLURM],[ + if test -z "$prte_check_slurm_happy" ; then + AC_ARG_WITH([slurm], + [AS_HELP_STRING([--with-slurm], + [Build SLURM scheduler component (default: yes)])]) + + if test "$with_slurm" = "no" ; then + prte_check_slurm_happy="no" + elif test "$with_slurm" = "" ; then + # unless user asked, only build slurm component on linux, AIX, + # and OS X systems (these are the platforms that SLURM + # supports) + case $host in + *-linux*|*-aix*|*-apple-darwin*) + prte_check_slurm_happy="yes" + ;; + *) + AC_MSG_CHECKING([for SLURM srun in PATH]) + PRTE_WHICH([srun], [PRTE_CHECK_SLURM_SRUN]) + if test "$PRTE_CHECK_SLURM_SRUN" = ""; then + prte_check_slurm_happy="no" + else + prte_check_slurm_happy="yes" + fi + AC_MSG_RESULT([$prte_check_slurm_happy]) + ;; + esac + else + prte_check_slurm_happy="yes" + fi + + AS_IF([test "$prte_check_slurm_happy" = "yes"], + [AC_CHECK_FUNC([fork], + [prte_check_slurm_happy="yes"], + [prte_check_slurm_happy="no"])]) + + AS_IF([test "$prte_check_slurm_happy" = "yes"], + [AC_CHECK_FUNC([execve], + [prte_check_slurm_happy="yes"], + [prte_check_slurm_happy="no"])]) + + AS_IF([test "$prte_check_slurm_happy" = "yes"], + [AC_CHECK_FUNC([setpgid], + [prte_check_slurm_happy="yes"], + [prte_check_slurm_happy="no"])]) + + # check to see if this is a Cray nativized slurm env. + + slurm_cray_env=0 + PRTE_CHECK_ALPS([prte_slurm_cray], + [slurm_cray_env=1]) + + AC_DEFINE_UNQUOTED([SLURM_CRAY_ENV],[$slurm_cray_env], + [defined to 1 if slurm cray env, 0 otherwise]) + + PRTE_SUMMARY_ADD([Resource Managers], [Slurm], [], [$prte_check_slurm_happy]) + fi + + AS_IF([test "$prte_check_slurm_happy" = "yes"], + [$2], + [$3]) +]) diff --git a/config/prte_check_tm.m4 b/config/prte_check_tm.m4 new file mode 100644 index 0000000000000000000000000000000000000000..08ed95d800924c06aab5a3f345691f4a7de20b3b --- /dev/null +++ b/config/prte_check_tm.m4 @@ -0,0 +1,198 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2015-2017 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2017-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. +dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. +dnl All Rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# PRTE_CHECK_TM_PBS_CONFIG_RUN([pbs-config args], [assigmnent variable], +# [action-if-successful], [action-if-not-successful]) +# -------------------------------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_TM_PBS_CONFIG_RUN], [ + # bozo check + AS_IF([test -z "${prte_check_tm_cv_pbs_config_path}"], + [AC_MSG_ERROR([Internal error. pbs-config not properly configured.])]) + + PRTE_LOG_COMMAND([prte_check_tm_pbs_config_run_results=`${prte_check_tm_cv_pbs_config_path} $1 2>&1`], + [AS_VAR_COPY([$2], [prte_check_tm_pbs_config_run_results]) + $3], [$4]) + AS_UNSET([prte_check_tm_pbs_config_run_results]) +]) + + +# PRTE_CHECK_TM_LIBS_FLAGS([flags-name-prefix], [input-flags]) +# ------------------------------------------------------------ +AC_DEFUN([PRTE_CHECK_TM_SPLIT_LIBS_OUTPUT], [ + for prte_check_tm_val in $2; do + AS_IF([test "`echo $prte_check_tm_val | cut -c1-2`" = "-l"], + [PRTE_APPEND([$1_LIBS], [${prte_check_tm_val}])], + [PRTE_APPEND([$1_LDFLAGS], [${prte_check_tm_val}])]) + done + AS_UNSET([prte_check_tm_val]) +]) + + +# PRTE_CHECK_TM_PBS_CONFIG(prefix, [action-if-found], [action-if-not-found], +# [action-if-found-but-does-not-work]) +# -------------------------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_TM_PBS_CONFIG], [ + PRTE_VAR_SCOPE_PUSH([pbs_config_happy]) + + pbs_config_happy="yes" + + AC_CACHE_CHECK([for pbs-config path], + [prte_check_tm_cv_pbs_config_path], + [AS_IF([test -z "${with_tm}" -o "${with_tm}" = "yes"], + [prte_check_tm_cv_pbs_config_path="pbs-config"], + [prte_check_tm_cv_pbs_config_path="${with_tm}/bin/pbs-config"])]) + + AC_CACHE_CHECK([if pbs-config works], + [prte_check_tm_cv_pbs_config_works], + [PRTE_CHECK_TM_PBS_CONFIG_RUN([--prefix], [prte_check_tm_dummy], + [prte_check_tm_cv_pbs_config_works="yes"], + [prte_check_tm_cv_pbs_config_works="no"])]) + AS_IF([test "${prte_check_tm_cv_pbs_config_works}" = "no"], [pbs_config_happy="no"]) + + AS_IF([test "${pbs_config_happy}" = "yes"], + [AC_CACHE_CHECK([for pbs-config cflags], + [prte_check_tm_cv_pbs_config_cflags_output], + [PRTE_CHECK_TM_PBS_CONFIG_RUN([--cflags], [prte_check_tm_cv_pbs_config_cflags_output], [], + [AC_MSG_ERROR([An error occurred retrieving cflags from pbs-config])])]) + + AC_CACHE_CHECK([for pbs-config libs], + [prte_check_tm_cv_pbs_config_libs_output], + [PRTE_CHECK_TM_PBS_CONFIG_RUN([--libs], [prte_check_tm_cv_pbs_config_libs_output], [], + [AC_MSG_ERROR([An error occurred retrieving libs from pbs-config])])]) + + $1_CPPFLAGS="${prte_check_tm_cv_pbs_config_cflags_output}" + PRTE_CHECK_TM_SPLIT_LIBS_OUTPUT([$1], [${prte_check_tm_cv_pbs_config_libs_output}]) + + PRTE_LOG_MSG([pbs-config CPPFLAGS: ${$1_CPPFLAGS}], 1) + PRTE_LOG_MSG([pbs-config LDFLAGS: ${$1_LDFLAGS}], 1) + PRTE_LOG_MSG([pbs-config LIBS: ${$1_LIBS}], 1) + + # Now that we supposedly have the right flags, try them out. + prte_check_tm_CPPFLAGS_save="${CPPFLAGS}" + prte_check_tm_LDFLAGS_save="${LDFLAGS}" + prte_check_tm_LIBS_save="${LIBS}" + + CPPFLAGS="${CPPFLAGS} ${$1_CPPFLAGS}" + LIBS="${LIBS} ${$1_LIBS}" + LDFLAGS="${LDFLAGS} ${$1_LDFLAGS}" + + pbs_config_happy=no + AC_CHECK_HEADER([tm.h], + [AC_CHECK_FUNC([tm_finalize], + [pbs_config_happy="yes"])]) + + CPPFLAGS="${prte_check_tm_CPPFLAGS_save}" + LDFLAGS="${prte_check_tm_LDFLAGS_save}" + LIBS="${prte_check_tm_LIBS_save}"]) + + AS_IF([test "${pbs_config_happy}" = "yes"], + [$1_SUMMARY="yes (${prte_check_tm_cv_pbs_config_path})" + $2], + [test "${prte_check_tm_cv_pbs_config_works}" = "yes"], + [$4], + [$1_SUMMARY="no" + $3]) + + PRTE_VAR_SCOPE_POP +]) + + +# PRTE_CHECK_TM(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_TM],[ + PRTE_VAR_SCOPE_PUSH([prte_check_tm_happy prte_check_tm_found]) + + AC_ARG_WITH([tm], + [AS_HELP_STRING([--with-tm(=DIR)], + [Build TM (Torque, PBSPro, and compatible) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])]) + AC_ARG_WITH([tm-libdir], + [AS_HELP_STRING([--with-tm-libdir=DIR], + [Search for Torque libraries in DIR])]) + + AS_IF([test "${with_tm}" = "no"], + [prte_check_tm_happy="no"], + [prte_check_tm_happy="yes"]) + + prte_check_tm_found=0 + + # Note: If we found pbs-config, got flags from it, but those flags don't work, consider that a hard fail + # for a working TM. Don't try to search with check package in that case. + AS_IF([test "${prte_check_tm_happy}" = "yes"], + [PRTE_CHECK_TM_PBS_CONFIG([$1], [prte_check_tm_found=1], [], [prte_check_tm_happy="no"])]) + + # Note that Torque 2.1.0 changed the name of their back-end + # library to "libtorque". So we have to check for both libpbs and + # libtorque. First, check for libpbs. + AS_IF([test "${prte_check_tm_happy}" = "yes" -a ${prte_check_tm_found} -eq 0], + [AS_VAR_SET_IF([prte_cv_check_tm_libs], + [OAC_CHECK_PACKAGE([tm], + [$1], + [tm.h], + [${prte_cv_check_tm_libs}], + [tm_init], + [prte_check_tm_found=1])], + [OAC_CHECK_PACKAGE([tm], + [$1], + [tm.h], + [pbs crypto z], + [tm_init], + [prte_cv_check_tm_libs="pbs crypto z" + prte_check_tm_found=1])]) + AS_IF([test ${prte_check_tm_found} -eq 0], + [OAC_CHECK_PACKAGE_INVALIDATE_GENERIC_CACHE([tm], [$1], [tm_init]) + OAC_CHECK_PACKAGE([tm], + [$1], + [tm.h], + [pbs crypto z], + [tm_init], + [prte_cv_check_tm_libs="pbs crypto z" + prte_check_tm_found=1])]) + AS_IF([test ${prte_check_tm_found} -eq 0], + [OAC_CHECK_PACKAGE_INVALIDATE_GENERIC_CACHE([tm], [$1], [tm_init]) + OAC_CHECK_PACKAGE([tm], + [$1], + [tm.h], + [torque], + [tm_init], + [prte_cv_check_tm_libs="torque" + prte_check_tm_found=1])])]) + + AS_IF([test ${prte_check_tm_found} -eq 0], [prte_check_tm_happy="no"]) + + + # Did we find the right stuff? + AS_IF([test "${prte_check_tm_happy}" = "yes"], + [$2], + [AS_IF([test ! -z "${with_tm}" && test "${with_tm}" != "no"], + [AC_MSG_ERROR([TM support requested but not found. Aborting])]) + $3]) + + PRTE_SUMMARY_ADD([Resource Managers], [Torque], [], [${$1_SUMMARY}]) + + PRTE_VAR_SCOPE_POP +]) diff --git a/config/prte_check_vendor.m4 b/config/prte_check_vendor.m4 new file mode 100644 index 0000000000000000000000000000000000000000..0ef3dad606b0b9924ef5744d35e671d6a94ab56e --- /dev/null +++ b/config/prte_check_vendor.m4 @@ -0,0 +1,252 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. +dnl Copyright (c) 2013-2020 Intel, Inc. All rights reserved. +dnl Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2015 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + + +# PRTE_C_COMPILER_VENDOR(VENDOR_VARIABLE) +# --------------------------------------- +# Set shell variable VENDOR_VARIABLE to the name of the compiler +# vendor for the current C compiler. +# +# See comment for _PRTE_CHECK_COMPILER_VENDOR for a complete +# list of currently detected compilers. +AC_DEFUN([PRTE_C_COMPILER_VENDOR], [ + AC_REQUIRE([AC_PROG_CC]) + + AC_CACHE_CHECK([for the C compiler vendor], + [prte_cv_c_compiler_vendor], + [AC_LANG_PUSH(C) + _PRTE_CHECK_COMPILER_VENDOR([prte_cv_c_compiler_vendor]) + AC_LANG_POP(C)]) + + $1="$prte_cv_c_compiler_vendor" +]) + + +# workaround to avoid syntax error with Autoconf < 2.68: +m4_ifndef([AC_LANG_DEFINES_PROVIDED], + [m4_define([AC_LANG_DEFINES_PROVIDED])]) + +# PRTE_IFDEF_IFELSE(symbol, [action-if-defined], +# [action-if-not-defined]) +# ---------------------------------------------- +# Run compiler to determine if preprocessor symbol "symbol" is +# defined by the compiler. +AC_DEFUN([PRTE_IFDEF_IFELSE], [ + AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED +#ifndef $1 +#error "symbol $1 not defined" +choke me +#endif], [$2], [$3])]) + + +# PRTE_IF_IFELSE(symbol, [action-if-defined], +# [action-if-not-defined]) +# ---------------------------------------------- +# Run compiler to determine if preprocessor symbol "symbol" is +# defined by the compiler. +AC_DEFUN([PRTE_IF_IFELSE], [ + AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED +#if !( $1 ) +#error "condition $1 not met" +choke me +#endif], [$2], [$3])]) + + +# _PRTE_CHECK_COMPILER_VENDOR(VENDOR_VARIABLE) +# -------------------------------------------- +# Set shell variable VENDOR_VARIABLE to the name of the compiler +# vendor for the compiler for the current language. Language must be +# one of C, OBJC, or C++. +# +# thanks to http://predef.sourceforge.net/precomp.html for the list +# of defines to check. +AC_DEFUN([_PRTE_CHECK_COMPILER_VENDOR], [ + prte_check_compiler_vendor_result="unknown" + + # GNU is probably the most common, so check that one as soon as + # possible. Intel and PGI18 pretend to be GNU, so need to check Intel + # and PGI before checking for GNU. + + + # Intel + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__INTEL_COMPILER) || defined(__ICC)], + [prte_check_compiler_vendor_result="intel"])]) + + # Portland Group + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__PGI], + [prte_check_compiler_vendor_result="portland group"])]) + + # Fujitsu + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__FUJITSU)], + [prte_check_compiler_vendor_result="fujitsu"])]) + # Borland Turbo C + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__TURBOC__], + [prte_check_compiler_vendor_result="borland"])]) + + # Borland C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__BORLANDC__], + [prte_check_compiler_vendor_result="borland"])]) + + # Comeau C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__COMO__], + [prte_check_compiler_vendor_result="comeau"])]) + + # Compaq C/C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__DECC) || defined(VAXC) || defined(__VAXC)], + [prte_check_compiler_vendor_result="compaq"], + [PRTE_IF_IFELSE([defined(__osf__) && defined(__LANGUAGE_C__)], + [prte_check_compiler_vendor_result="compaq"], + [PRTE_IFDEF_IFELSE([__DECCXX], + [prte_check_compiler_vendor_result="compaq"])])])]) + + # Cray C/C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([_CRAYC], + [prte_check_compiler_vendor_result="cray"])]) + + # Diab C/C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__DCC__], + [prte_check_compiler_vendor_result="diab"])]) + + # Digital Mars + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__DMC__) || defined(__SC__) || defined(__ZTC__)], + [prte_check_compiler_vendor_result="digital mars"])]) + + # HP ANSI C / aC++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__HP_cc) || defined(__HP_aCC)], + [prte_check_compiler_vendor_result="hp"])]) + + # IBM XL C/C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__ibmxl__)], + [prte_check_compiler_vendor_result="ibm"], + [PRTE_IF_IFELSE([defined(_AIX) && !defined(__GNUC__)], + [prte_check_compiler_vendor_result="ibm"])])]) + + # KAI C++ (rest in peace) + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__KCC], + [prte_check_compiler_vendor_result="kai"])]) + + # LCC + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__LCC__], + [prte_check_compiler_vendor_result="lcc"])]) + + # MetaWare High C/C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__HIGHC__], + [prte_check_compiler_vendor_result="metaware high"])]) + + # Metrowerks Codewarrior + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__MWERKS__], + [prte_check_compiler_vendor_result="metrowerks"])]) + + # MIPSpro (SGI) + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(sgi) || defined(__sgi)], + [prte_check_compiler_vendor_result="sgi"])]) + + # MPW C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__MRC__) || defined(MPW_C) || defined(MPW_CPLUS)], + [prte_check_compiler_vendor_result="mpw"])]) + + # Norcroft C + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__CC_NORCROFT], + [prte_check_compiler_vendor_result="norcroft"])]) + + # Pelles C + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__POCC__], + [prte_check_compiler_vendor_result="pelles"])]) + + # SAS/C + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(SASC) || defined(__SASC) || defined(__SASC__)], + [prte_check_compiler_vendor_result="sas"])]) + + # Sun Workshop C/C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IF_IFELSE([defined(__SUNPRO_C) || defined(__SUNPRO_CC)], + [prte_check_compiler_vendor_result="sun"])]) + + # TenDRA C/C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__TenDRA__], + [prte_check_compiler_vendor_result="tendra"])]) + + # Tiny C + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__TINYC__], + [prte_check_compiler_vendor_result="tiny"])]) + + # USL C + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__USLC__], + [prte_check_compiler_vendor_result="usl"])]) + + # Watcom C++ + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__WATCOMC__], + [prte_check_compiler_vendor_result="watcom"])]) + + # GNU + AS_IF([test "$prte_check_compiler_vendor_result" = "unknown"], + [PRTE_IFDEF_IFELSE([__GNUC__], + [prte_check_compiler_vendor_result="gnu" + + # We do not support gccfss as a compiler so die if + # someone tries to use said compiler. gccfss (gcc + # for SPARC Systems) is a compiler that is no longer + # supported by Oracle and it has some major flaws + # that prevents it from actually compiling PRTE code. + # So if we detect it we automatically bail. + + if ($CC --version | grep gccfss) >/dev/null 2>&1; then + AC_MSG_RESULT([gccfss]) + AC_MSG_WARN([Detected gccfss being used to compile PMIx.]) + AC_MSG_WARN([Because of several issues PMIx does not support]) + AC_MSG_WARN([the gccfss compiler. Please use a different compiler.]) + AC_MSG_WARN([If you didn't think you used gccfss you may want to]) + AC_MSG_WARN([check to see if the compiler you think you used is]) + AC_MSG_WARN([actually a link to gccfss.]) + AC_MSG_ERROR([Cannot continue]) + fi])]) + + $1="$prte_check_compiler_vendor_result" + unset prte_check_compiler_vendor_result +]) diff --git a/config/prte_check_version.m4 b/config/prte_check_version.m4 new file mode 100644 index 0000000000000000000000000000000000000000..0bb08a3cce0e51f38110db8d045251b2fdae281d --- /dev/null +++ b/config/prte_check_version.m4 @@ -0,0 +1,81 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2016 IBM Corporation. All rights reserved. +dnl Copyright (c) 2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# Parameters: (use a version "1.1.4rc2" as the example) +# * prefix +# Will export a variable $prefix_version_cmp +# - action_if_less => "less" +# - action_if_equal => "equal" +# - action_if_equal_series => "series" +# - action_if_greater => "greater" +# * version_actual +# Actual version string +# * version_desired +# Desired version string to check against +# * action_if_less +# Action to take if the version is strictly less than +# "1.1.3" < "1.1.4rc2" +# * action_if_equal +# Action to take if the version matches exactly +# "1.1.4rc2" = "1.1.4rc2" +# * action_if_equal_series +# Action to take if the version matches to this series +# "1.1.4rc1" ~=~ "1.1.4rc2" +# "1.1.4" ~=~ "1.1.4rc2" +# * action_if_greater +# Action to take if the version is strictly greater than +# "1.1.5" > "1.1.4rc2" +# "2.0" > "1.1.4rc2" +# +# See documentation on m4_version_compare and AS_VERSION_COMPARE for more +# precise definitions +# PRTE_CHECK_VERSION(prefix, version_actual, version_desired, +# action_if_less, action_if_equal, action_if_equal_series, +# action_if_greater) +# ---------------------------------------------------- +AC_DEFUN([PRTE_CHECK_VERSION],[ + version_actual=$2 + version_desired=$3 + + AC_MSG_CHECKING([Checking library version is $version_desired]) + # + # Example: If version_desired=1.1.4 and + # version_actual=1.1.3 -> -1 + # version_actual=1.1.4 -> 0 + # version_actual=1.1.4rc1 -> 1 + # version_actual=1.1.5 -> 1 (need further check) + # + AS_VERSION_COMPARE(["$version_actual"], [$version_desired], + [AC_MSG_RESULT([Earlier than expected ($version_actual < $$version_desired)]) + $1_version_cmp="less" + $4], + [AC_MSG_RESULT([Equal]) + $1_version_cmp="equal" + $5], + [ + # Need further check to make sure we are < 1.1.5 + # version_actual=1.1.4rc1 -> -1 + # version_actual=1.1.4 -> 0 (caught above) + # version_actual=1.1.5 -> 1 + AS_VERSION_COMPARE(["$version_actual"], [$version_desired"zzzz"], + [AC_MSG_RESULT([Within release series ($version_actual)]) + $1_version_cmp="series" + $6], + [AC_MSG_RESULT([Within release series ($version_actual)]) + $1_version_cmp="series" + $6], + [AC_MSG_RESULT([Later than expected ($version_actual > $$version_desired)]) + $1_version_cmp="greater" + $7] + )] + ) +])dnl diff --git a/config/prte_check_visibility.m4 b/config/prte_check_visibility.m4 new file mode 100644 index 0000000000000000000000000000000000000000..0da9fc2c2014433fecaa5d8c375cad82efc25145 --- /dev/null +++ b/config/prte_check_visibility.m4 @@ -0,0 +1,92 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# Copyright (c) 2021 Nanook Consulting. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# PRTE_CHECK_VISIBILITY +# -------------------------------------------------------- +AC_DEFUN([PRTE_CHECK_VISIBILITY],[ + AC_REQUIRE([AC_PROG_GREP]) + + # Check if the compiler has support for visibility, like some + # versions of gcc, icc Sun Studio cc. + AC_ARG_ENABLE(visibility, + AS_HELP_STRING([--enable-visibility], + [enable visibility feature of certain compilers/linkers (default: enabled)])) + + prte_visibility_define=0 + prte_msg="whether to enable symbol visibility" + + if test "$enable_visibility" = "no"; then + AC_MSG_CHECKING([$prte_msg]) + AC_MSG_RESULT([no (disabled)]) + else + CFLAGS_orig=$CFLAGS + + prte_add= + case "$prte_c_vendor" in + sun) + # Check using Sun Studio -xldscope=hidden flag + prte_add=-xldscope=hidden + CFLAGS="$PRTE_CFLAGS_BEFORE_PICKY $prte_add -errwarn=%all" + ;; + + *) + # Check using -fvisibility=hidden + prte_add=-fvisibility=hidden + CFLAGS="$PRTE_CFLAGS_BEFORE_PICKY $prte_add -Werror" + ;; + esac + + AC_MSG_CHECKING([if $CC supports $prte_add]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + __attribute__((visibility("default"))) int foo; + ]],[[fprintf(stderr, "Hello, world\n");]])], + [AS_IF([test -s conftest.err], + [$GREP -iq visibility conftest.err + # If we find "visibility" in the stderr, then + # assume it doesn't work + AS_IF([test "$?" = "0"], [prte_add=])]) + ], [prte_add=]) + AS_IF([test "$prte_add" = ""], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes])]) + + CFLAGS=$CFLAGS_orig + PRTE_VISIBILITY_CFLAGS=$prte_add + + if test "$prte_add" != "" ; then + prte_visibility_define=1 + AC_MSG_CHECKING([$prte_msg]) + AC_MSG_RESULT([yes (via $prte_add)]) + elif test "$enable_visibility" = "yes"; then + AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting]) + else + AC_MSG_CHECKING([$prte_msg]) + AC_MSG_RESULT([no (unsupported)]) + fi + unset prte_add + fi + + AC_DEFINE_UNQUOTED([PRTE_C_HAVE_VISIBILITY], [$prte_visibility_define], + [Whether C compiler supports symbol visibility or not]) +]) diff --git a/config/prte_config_asm.m4 b/config/prte_config_asm.m4 new file mode 100644 index 0000000000000000000000000000000000000000..6456b6f91711c86c9a689358e6398d12e68d67a0 --- /dev/null +++ b/config/prte_config_asm.m4 @@ -0,0 +1,135 @@ +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2018 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. +dnl Copyright (c) 2015-2018 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2017-2021 Amazon.com, Inc. or its affiliates. All Rights +dnl reserved. +dnl Copyright (c) 2020 Google, LLC. All rights reserved. +dnl Copyright (c) 2020 Intel, Inc. All rights reserved. +dnl Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + + +AC_DEFUN([PRTE_CHECK_GCC_ATOMIC_BUILTINS], [ + if test -z "$prte_cv_have___atomic" ; then + AC_MSG_CHECKING([for 32-bit GCC built-in atomics]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +]],[[ +uint32_t tmp, old = 0; +uint64_t tmp64, old64 = 0; +__atomic_thread_fence(__ATOMIC_SEQ_CST); +__atomic_compare_exchange_n(&tmp, &old, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); +__atomic_add_fetch(&tmp, 1, __ATOMIC_RELAXED); +__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); +__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);]])], + [prte_cv_have___atomic=yes], + [prte_cv_have___atomic=no]) + AC_MSG_RESULT([$prte_cv_have___atomic]) + + if test "$prte_cv_have___atomic" = "yes" ; then + AC_MSG_CHECKING([for 64-bit GCC built-in atomics]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +]],[[ +uint64_t tmp64, old64 = 0; +__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); +__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);]])], + [prte_cv_have___atomic_64=yes], + [prte_cv_have___atomic_64=no]) + AC_MSG_RESULT([$prte_cv_have___atomic_64]) + if test "$prte_cv_have___atomic_64" = "yes" ; then + AC_MSG_CHECKING([if 64-bit GCC built-in atomics are lock-free]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_is_lock_free (8, 0)) { return 1; }])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + prte_cv_have___atomic_64=no], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + fi + else + prte_cv_have___atomic_64=no + fi + fi +]) + +dnl ################################################################# +dnl +dnl PRTE_CONFIG_ASM() +dnl +dnl DEFINE PRTE_ATOMIC_C11 if C11 atomics should be used +dnl DEFINE PRTE_ATOMIC_GCC_BUILTIN if gcc builtin atomics should be used +dnl DEFINE PRTE_ATOMIC_X86_64 if we're on an x86_64 platform +dnl +dnl ################################################################# +AC_DEFUN([PRTE_CONFIG_ASM],[ + AC_REQUIRE([PRTE_SETUP_CC]) + + AC_ARG_ENABLE([c11-atomics],[AS_HELP_STRING([--enable-c11-atomics], + [Enable use of C11 atomics if available (default: enabled)])]) + AC_ARG_ENABLE([builtin-atomics], + [AS_HELP_STRING([--enable-builtin-atomics], + [Enable use of GCC built-in atomics (default: autodetect)])]) + + prte_atomic_c11=0 + prte_atomic_gcc_builtin=0 + + PRTE_CHECK_GCC_ATOMIC_BUILTINS + if test "x$enable_c11_atomics" != "xno" && test "$prte_cv_c11_supported" = "yes" ; then + prte_atomic_style="c11" + prte_atomic_c11=1 + elif test "x$enable_c11_atomics" = "xyes"; then + AC_MSG_WARN([C11 atomics were requested but are not supported]) + AC_MSG_ERROR([Cannot continue]) + elif test "$enable_builtin_atomics" != "no" && test "$prte_cv_have___atomic" = "yes" ; then + prte_atomic_style="gcc" + prte_atomic_gcc_builtin=1 + elif test "$enable_builtin_atomics" = "yes" ; then + AC_MSG_WARN([GCC built-in atomics requested but not found.]) + AC_MSG_ERROR([Cannot continue]) + else + AC_MSG_WARN([Neither C11 nor the built-in atomics are available,]) + AC_MSG_WARN([either because they were disabled on the configure]) + AC_MSG_WARN([command line or they were not found. PRRTE requires]) + AC_MSG_WARN([atomic support, so either a compiler with C11 atomics]) + AC_MSG_WARN([must be used OR the built-in atomics must not be disabled.]) + AC_MSG_ERROR([Cannot continue]) + fi + + AC_MSG_CHECKING([for x86_64 architecture]) + case "${host}" in + x86_64-*x32|i?86-*|x86_64*|amd64*) + AC_MSG_RESULT([yes]) + AC_DEFINE([PRTE_ATOMIC_X86_64], [1], [whether building on x86_64 platform]) + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac + + AC_MSG_CHECKING([for atomics style]) + AC_MSG_RESULT([$prte_atomic_style]) + + AC_DEFINE_UNQUOTED([PRTE_ATOMIC_C11], [$prte_atomic_c11], + [Use C11 style atomics]) + + AC_DEFINE_UNQUOTED([PRTE_ATOMIC_GCC_BUILTIN], [$prte_atomic_gcc_builtin], + [Use GCC builtin style atomics]) +])dnl diff --git a/config/prte_config_files.m4 b/config/prte_config_files.m4 new file mode 100644 index 0000000000000000000000000000000000000000..750484975e45278ad4b18b52683310055a8a29b1 --- /dev/null +++ b/config/prte_config_files.m4 @@ -0,0 +1,30 @@ +# -*- shell-script -*- +# +# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2016-2020 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2022-2023 Nanook Consulting. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This file is m4_included in the top-level configure.ac + +AC_DEFUN([PRTE_CONFIG_FILES],[ + AC_CONFIG_FILES([ + src/Makefile + src/etc/Makefile + src/util/Makefile + src/util/hostfile/Makefile + src/tools/pcc/Makefile + src/tools/prted/Makefile + src/tools/prun/Makefile + src/tools/prte_info/Makefile + src/tools/prte/Makefile + src/tools/pterm/Makefile + ]) +]) diff --git a/config/prte_config_pthreads.m4 b/config/prte_config_pthreads.m4 new file mode 100644 index 0000000000000000000000000000000000000000..e8cdf27a41c6612d6827bfb1497712417f5ae0fd --- /dev/null +++ b/config/prte_config_pthreads.m4 @@ -0,0 +1,322 @@ +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2016 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl +dnl PRTE_CONFIG_POSIX_THREADS() +dnl +dnl Configure posix threads, setting the following variables (but +dnl not calling AC_SUBST on them). + +# ******************************************************************** +# +# Internal macros - do not call from outside PRTE_CONFIG_POSIX_THREADS +# +# ******************************************************************** + + +AC_DEFUN([PRTE_INTL_PTHREAD_TRY_LINK], [ +# BEGIN: PRTE_INTL_PTHREAD_TRY_LINK +# +# Make sure that we can run a small application in C or C++, which +# ever is the current language. Do make sure that C or C++ is the +# current language. +# +# As long as this is not being run.... +# pthread_t may be anything from an int to a struct -- init with self-tid. +# + AC_LINK_IFELSE([AC_LANG_SOURCE([[ +#include + +int i = 3; +pthread_t me, newthread; + +void cleanup_routine(void *foo); +void *thread_main(void *foo); + +void cleanup_routine(void *foo) { i = 4; } +void *thread_main(void *foo) { i = 2; return (void*) &i; } + +int main(int argc, char* argv[]) +{ + pthread_attr_t attr; + + me = pthread_self(); + pthread_atfork(NULL, NULL, NULL); + pthread_attr_init(&attr); + pthread_cleanup_push(cleanup_routine, 0); + pthread_create(&newthread, &attr, thread_main, 0); + pthread_join(newthread, 0); + pthread_cleanup_pop(0); + + return 0; +}]])], + [$1], [$2]) +# END: PRTE_INTL_PTHREAD_TRY_LINK +])dnl + +# ******************************************************************** +# +# Try to compile thread support without any special flags +# +# ******************************************************************** +AC_DEFUN([PRTE_INTL_POSIX_THREADS_PLAIN_C], [ +# +# C compiler +# +if test "$prte_pthread_c_success" = "0"; then + AC_MSG_CHECKING([if C compiler and POSIX threads work as is]) + + AC_LANG_PUSH(C) + PRTE_INTL_PTHREAD_TRY_LINK(prte_pthread_c_success=1, + prte_pthread_c_success=0) + AC_LANG_POP(C) + if test "$prte_pthread_c_success" = "1"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi +fi +])dnl + + +AC_DEFUN([PRTE_INTL_POSIX_THREADS_PLAIN], [ +# BEGIN: PRTE_INTL_POSIX_THREADS_PLAIN +# +# Check if can compile without any special flags +# we throw -D_REENTRANT or -D_THREAD_SAFE in here, just in +# case. Some systems (OS X, for example) generally don't need +# the defines, but then will on one system header here or there +# why take chances? +# + +AC_PROVIDE_IFELSE([AC_PROG_CC], + [PRTE_INTL_POSIX_THREADS_PLAIN_C], + [prte_pthread_c_success=1]) + +# End: PRTE_INTL_POSIX_THREADS_PLAIN +])dnl + + +# ******************************************************************** +# +# Try to compile thread support with special compiler flags +# +# ******************************************************************** +AC_DEFUN([PRTE_INTL_POSIX_THREADS_SPECIAL_FLAGS_C], [ +# +# C compiler +# +if test "$prte_pthread_c_success" = "0"; then + for pf in $pflags; do + AC_MSG_CHECKING([if C compiler and POSIX threads work with $pf]) + CFLAGS="$orig_CFLAGS $pf" + AC_LANG_PUSH(C) + PRTE_INTL_PTHREAD_TRY_LINK(prte_pthread_c_success=1, + prte_pthread_c_success=0) + AC_LANG_POP(C) + if test "$prte_pthread_c_success" = "1"; then + PTHREAD_CFLAGS="$pf" + AC_MSG_RESULT([yes]) + break + else + PTHREAD_CFLAGS= + CFLAGS="$orig_CFLAGS" + AC_MSG_RESULT([no]) + fi + done +fi +]) + + +AC_DEFUN([PRTE_INTL_POSIX_THREADS_SPECIAL_FLAGS],[ +# Begin: PRTE_INTL_POSIX_THREADS_SPECIAL_FLAGS +# +# If above didn't work, try some super-special compiler flags +# that get evaluated to the "right" things. +# +# -Kthread: +# -kthread: FreeBSD kernel threads +# -pthread: Modern GCC (most all platforms) +# -pthreads: GCC on solaris +# -mthreads: +# -mt: Solaris native compilers / HP-UX aCC +# +# Put -mt before -mthreads because HP-UX aCC will properly compile +# with -mthreads (reading as -mt), but emit a warning about unknown +# flags hreads. Stupid compilers. + +case "${host_cpu}-${host_os}" in + *solaris*) + pflags="-pthread -pthreads -mt" + ;; + *) + pflags="-Kthread -kthread -pthread -pthreads -mt -mthreads" + ;; +esac + +AC_PROVIDE_IFELSE([AC_PROG_CC], + [PRTE_INTL_POSIX_THREADS_SPECIAL_FLAGS_C], + [prte_pthread_c_success=1]) + +# End: PRTE_INTL_POSIX_THREADS_SPECIAL_FLAGS +])dnl + + +# ******************************************************************** +# +# Try to compile thread support with extra libs +# +# ******************************************************************** +AC_DEFUN([PRTE_INTL_POSIX_THREADS_LIBS_C],[ +# +# C compiler +# +if test "$prte_pthread_c_success" = "0"; then + for pl in $plibs; do + AC_MSG_CHECKING([if C compiler and POSIX threads work with $pl]) + case "${host_cpu}-${host-_os}" in + *-aix* | *-freebsd*) + if test "`echo $CPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then + PTHREAD_CPPFLAGS="-D_THREAD_SAFE" + CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS" + fi + ;; + *) + if test "`echo $CPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then + PTHREAD_CPPFLAGS="-D_REENTRANT" + CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS" + fi + ;; + esac + LIBS="$orig_LIBS $pl" + AC_LANG_PUSH(C) + PRTE_INTL_PTHREAD_TRY_LINK(prte_pthread_c_success=1, + prte_pthread_c_success=0) + AC_LANG_POP(C) + if test "$prte_pthread_c_success" = "1"; then + PTHREAD_LIBS="$pl" + AC_MSG_RESULT([yes]) + else + PTHREAD_CPPFLAGS= + CPPFLAGS="$orig_CPPFLAGS" + LIBS="$orig_LIBS" + AC_MSG_RESULT([no]) + fi + done +fi +])dnl + +AC_DEFUN([PRTE_INTL_POSIX_THREADS_LIBS],[ +# Begin: PRTE_INTL_POSIX_THREADS_LIBS +# +# if we can't find a super-special compiler flags, try some libraries. +# we throw -D_REENTRANT or -D_THREAD_SAFE in here, just in case. Some +# systems (OS X, for example) generally don't need the defines, but +# then will on one system header here or there why take chances? +# +# libpthreads: AIX - must check before libpthread +# liblthread: LinuxThreads on FreeBSD +# libpthread: The usual place (like we can define usual!) +plibs="-lpthreads -llthread -lpthread" + +AC_PROVIDE_IFELSE([AC_PROG_CC], + [PRTE_INTL_POSIX_THREADS_LIBS_C], + [prte_pthread_c_success=1]) + +# End: PRTE_INTL_POSIX_THREADS_LIBS] +)dnl + + +#******************************************************************** +# +# External macro (aka, the real thing) +# +#******************************************************************** +AC_DEFUN([PRTE_CONFIG_POSIX_THREADS],[ + AC_REQUIRE([AC_PROG_GREP]) + +prte_pthread_c_success=0 + +orig_CFLAGS="$CFLAGS" +orig_CPPFLAGS="$CPPFLAGS" +orig_LDFLAGS="$LDFLAGS" +orig_LIBS="$LIBS" + +PTHREAD_CFLAGS= +PTHREAD_CPPFLAGS= +PTHREAD_LDFLAGS= +PTHREAD_LIBS= + +# Try with the basics, mam. +PRTE_INTL_POSIX_THREADS_PLAIN + +# Try the super-special compiler flags. +PRTE_INTL_POSIX_THREADS_SPECIAL_FLAGS + +# Try the normal linking methods (that's no fun) +PRTE_INTL_POSIX_THREADS_LIBS + +# +# check to see if we can create shared memory mutexes and conditions +# +AC_CHECK_FUNCS([pthread_mutexattr_setpshared pthread_condattr_setpshared]) + +# +# check to see if we can set error checking mutexes +# + +# LinuxThreads +AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP]) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[pthread_mutexattr_settype(NULL, PTHREAD_MUTEX_ERRORCHECK_NP);]])], + [result="yes" defval=1], [result="no" defval=0]) +AC_MSG_RESULT([$result]) +AC_DEFINE_UNQUOTED([PRTE_HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], [$defval], + [If PTHREADS implementation supports PTHREAD_MUTEX_ERRORCHECK_NP]) + +# Mac OS X +AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK]) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[pthread_mutexattr_settype(NULL, PTHREAD_MUTEX_ERRORCHECK);]])], + [result="yes" defval=1], [result="no" defval=0]) +AC_MSG_RESULT([$result]) +AC_DEFINE_UNQUOTED([PRTE_HAVE_PTHREAD_MUTEX_ERRORCHECK], [$defval], + [If PTHREADS implementation supports PTHREAD_MUTEX_ERRORCHECK]) + +CFLAGS="$orig_CFLAGS" +CPPFLAGS="$orig_CPPFLAGS" +LDFLAGS="$orig_LDFLAGS" +LIBS="$orig_LIBS" + +if test "$prte_pthread_c_success" = "1"; then + internal_useless=1 + $1 +else + internal_useless=1 + $2 +fi + +unset prte_pthread_c_success +unset internal_useless +])dnl diff --git a/config/prte_config_subdir.m4 b/config/prte_config_subdir.m4 new file mode 100644 index 0000000000000000000000000000000000000000..7890d4ee52562304b53e83b842564ae00d3e81a8 --- /dev/null +++ b/config/prte_config_subdir.m4 @@ -0,0 +1,147 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2015 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([PRTE_CONFIG_SUBDIR],[ +PRTE_VAR_SCOPE_PUSH([subdir_parent sub_configure subdir_dir subdir_srcdir subdir_cache_file subdir_args subdir_dots total_dir dir_part temp]) + +# +# Invoke configure in a specific subdirectory. +# +# $1 is the directory to invoke in +# $2 is the list of arguments to pass +# $3 is actions to execute upon success +# $4 is actions to execute upon failure +# +subdir_dir="$1" +subdir_args="$2" +subdir_success="$3" +subdir_failure="$4" + +# +# Sanity checks +# + +if test "$subdir_dir" != ":" && test -d $srcdir/$subdir_dir; then + AC_MSG_NOTICE([PRTE configuring in $subdir_dir]) + + # + # Gotta check where srcdir is for VPATH builds. If srcdir is not + # ., then we need to mkdir the subdir. Otherwise, we can just cd + # into it. + # + + case $srcdir in + .) + ;; + *) + { case $subdir_dir in + [[\\/]]* | ?:[[\\/]]* ) total_dir=;; + *) total_dir=.;; + esac + temp=$subdir_dir + for dir_part in `IFS='/\\'; set X $temp; shift; echo "$[@]"`; do + case $dir_part in + # Skip DOS drivespec + ?:) total_dir=$dir_part ;; + *) total_dir=$total_dir/$dir_part + test -d "$total_dir" || + mkdir "$total_dir" || + AC_MSG_ERROR([cannot create $subdir_dir]) + ;; + esac + done; } + + if test -d ./$subdir_dir; then :; + else + AC_MSG_ERROR([cannot create `pwd`/$subdir_dir]) + fi + ;; + esac + + # + # Move into the target directory + # + + subdir_parent=`pwd` + cd $subdir_dir + + # + # Make a "../" for each directory in $subdir_dir. + # + + subdir_dots=`[echo $subdir_dir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g]'` + # + # Construct the --srcdir argument + # + + case $srcdir in + .) + # In place + subdir_srcdir="$srcdir" + ;; + [[\\/]* | ?:[\\/]*] ) + # Absolute path + subdir_srcdir="$srcdir/$subdir_dir" + ;; + *) + # Relative path + subdir_srcdir="$subdir_dots$srcdir/$subdir_dir" + ;; + esac + + # + # Construct the --cache-file argument + # + + # BWB - subdir caching is a pain since we change CFLAGS and all that. + # Just disable it for now + subdir_cache_file="/dev/null" + + # + # Invoke the configure script in the subdirectory + # + + sub_configure="$SHELL '$subdir_srcdir/configure'" + AC_MSG_NOTICE([running $sub_configure $subdir_args --cache-file=$subdir_cache_file --srcdir=$subdir_srcdir --disable-option-checking]) + eval "$sub_configure $subdir_args \ + --cache-file=\"\$subdir_cache_file\" --srcdir=\"$subdir_srcdir\" --disable-option-checking" + if test "$?" = "0"; then + eval $subdir_success + AC_MSG_NOTICE([$sub_configure succeeded for $subdir_dir]) + else + eval $subdir_failure + AC_MSG_NOTICE([$sub_configure *failed* for $subdir_dir]) + fi + + # + # Go back to the topdir + # + + cd $subdir_parent +fi + +# +# Clean up +# + +PRTE_VAR_SCOPE_POP])dnl diff --git a/config/prte_config_subdir_args.m4 b/config/prte_config_subdir_args.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f475a9d8b6b253ed57b4f733c658b252aa59ce6c --- /dev/null +++ b/config/prte_config_subdir_args.m4 @@ -0,0 +1,84 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([PRTE_CONFIG_SUBDIR_ARGS],[ +PRTE_VAR_SCOPE_PUSH([subdirs_str subdirs_skip subdirs_args subdirs_arg]) +# +# Invoke configure in subdirectories. +# +# $1 is the name of the variable to assign the output to +# + +# +# Make a list of command line args --eliminate the --srcdir and +# --cache-file args, because we need to replace them with our own +# values when invoking the sub-configure script. Also eliminate +# the --with-platform as this will confuse any subdir with +# similar options +# + +subdirs_args= +subdirs_skip=no + +eval "set x $ac_configure_args" +shift +for subdirs_arg +do + if test "$subdirs_skip" = "yes"; then + subdirs_skip=no + else + case $subdirs_arg in + -cache-file | --cache-file | -cache | --cache) + subdirs_skip=yes + ;; + --config-cache | -C) + ;; + -cache-file=* | --cache-file=*) + ;; + -srcdir | --srcdir) + subdirs_skip=yes + ;; + -srcdir=* | --srcdir=*) + ;; + -with-platform=* | --with-platform=*) + ;; + *) + case $subdir_arg in + *\'*) subdir_arg=`echo "$subdir_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + subdirs_args="$subdirs_args '$subdirs_arg'" + ;; + esac + fi +done + +# +# Assign the output +# + +subdirs_str=$1=\"$subdirs_args\" +eval "$subdirs_str" + +# +# Clean up +# + +PRTE_VAR_SCOPE_POP])dnl diff --git a/config/prte_config_threads.m4 b/config/prte_config_threads.m4 new file mode 100644 index 0000000000000000000000000000000000000000..d344d56580c206333023c6e60cc1d85682179bed --- /dev/null +++ b/config/prte_config_threads.m4 @@ -0,0 +1,68 @@ +dnl +dnl Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2015 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([PRTE_CONFIG_THREADS],[ +# +# Arguments: none +# +# Dependencies: None +# +# Modifies: +# none - see called tests +# +# configure threads +# + +# +# Check we have POSIX threads +# +PRTE_CONFIG_POSIX_THREADS(HAVE_POSIX_THREADS=1, HAVE_POSIX_THREADS=0) +AC_MSG_CHECKING([for working POSIX threads package]) +if test "$HAVE_POSIX_THREADS" = "1" ; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi +export HAVE_POSIX_THREADS + +# +# Ask what threading we want (allow posix right now) +# + +if test "$HAVE_POSIX_THREADS" = "0"; then + AC_MSG_WARN(["*** POSIX threads are not"]) + AC_MSG_WARN(["*** available on your system "]) + AC_MSG_ERROR(["*** Can not continue"]) +fi + +THREAD_CFLAGS="$PTHREAD_CFLAGS" +THREAD_CPPFLAGS="$PTHREAD_CPPFLAGS" +THREAD_LDFLAGS="$PTHREAD_LDFLAGS" +THREAD_LIBS="$PTHREAD_LIBS" + +PRTE_CHECK_PTHREAD_PIDS + +AC_DEFINE_UNQUOTED([PRTE_ENABLE_MULTI_THREADS], [1], + [Whether we should enable thread support within the PRTE code base]) + +])dnl diff --git a/config/prte_configure_options.m4 b/config/prte_configure_options.m4 new file mode 100644 index 0000000000000000000000000000000000000000..9f768e58a81935dec9927a0f10d325b8052931d9 --- /dev/null +++ b/config/prte_configure_options.m4 @@ -0,0 +1,387 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. +dnl Copyright (c) 2009 IBM Corporation. All rights reserved. +dnl Copyright (c) 2009-2013 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. +dnl +dnl Copyright (c) 2016-2020 Intel, Inc. All rights reserved. +dnl Copyright (c) 2021-2024 Nanook Consulting All rights reserved. +dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. +dnl All Rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + + +AC_DEFUN([PRTE_CONFIGURE_OPTIONS],[ +prte_show_subtitle "PRTE Configuration options" + +# A hint to tell us if we are working with a build from Git or a tarball. +# Helpful when preparing diagnostic output. +if test -e $PRTE_TOP_SRCDIR/.git; then + AC_DEFINE_UNQUOTED([PRTE_GIT_REPO_BUILD], ["1"], + [If built from a git repo]) + prte_git_repo_build=yes +else + prte_git_repo_build=no +fi + + +# +# Do we want prte's --prefix behavior to be enabled by default? +# +AC_MSG_CHECKING([if want prte "--prefix" behavior to be enabled by default]) +AC_ARG_ENABLE([prte-prefix-by-default], + [AS_HELP_STRING([--enable-prte-prefix-by-default], + [Make "prte ..." behave exactly the same as "prte --prefix \$prefix" (where \$prefix is the value given to --prefix in configure)])]) +if test "$enable_prte_prefix_by_default" = "yes"; then + AC_MSG_RESULT([yes]) + prte_want_prte_prefix_by_default=1 +else + AC_MSG_RESULT([no]) + prte_want_prte_prefix_by_default=0 +fi +AC_DEFINE_UNQUOTED([PRTE_WANT_PRTE_PREFIX_BY_DEFAULT], + [$prte_want_prte_prefix_by_default], + [Whether we want prte to effect "--prefix $prefix" by default]) + +# +# Developer debugging +# +AC_MSG_CHECKING([if want developer-level debugging code]) +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug], + [enable developer-level debugging code (not for general MPI users!) (default: disabled)])) +if test "$enable_debug" = "yes"; then + AC_MSG_RESULT([yes]) + WANT_DEBUG=1 +else + AC_MSG_RESULT([no]) + WANT_DEBUG=0 +fi + + +if test "$WANT_DEBUG" = "0"; then + CFLAGS="-DNDEBUG $CFLAGS" + CXXFLAGS="-DNDEBUG $CXXFLAGS" +fi +AC_DEFINE_UNQUOTED(PRTE_ENABLE_DEBUG, $WANT_DEBUG, + [Whether we want developer-level debugging code or not]) + +AC_ARG_ENABLE(debug-symbols, + AS_HELP_STRING([--disable-debug-symbols], + [Disable adding compiler flags to enable debugging symbols if --enable-debug is specified. For non-debugging builds, this flag has no effect.])) + +# +# Developer picky compiler options +# + +AC_MSG_CHECKING([if want developer-level compiler pickyness]) +AC_ARG_ENABLE(devel-check, + AS_HELP_STRING([--enable-devel-check], + [enable developer-level compiler pickyness when building PRRTE (default: disabled)])) +if test "$enable_devel_check" = "yes"; then + AC_MSG_RESULT([yes]) + WANT_PICKY_COMPILER=1 +elif test "$enable_devel_check" = "no"; then + AC_MSG_RESULT([no]) + WANT_PICKY_COMPILER=0 +elif test "$prte_git_repo_build" = "yes" && test "$WANT_DEBUG" = "1"; then + AC_MSG_RESULT([yes]) + WANT_PICKY_COMPILER=1 +else + AC_MSG_RESULT([no]) + WANT_PICKY_COMPILER=0 +fi + +AC_DEFINE_UNQUOTED(PRTE_PICKY_COMPILERS, $WANT_PICKY_COMPILER, + [Whether or not we are using picky compiler settings]) + +AC_MSG_CHECKING([if want memory sanitizers]) +AC_ARG_ENABLE(memory-sanitizers, + AS_HELP_STRING([--memory-sanitizers], + [enable developer-level memory sanitizers when building PMIx (default: disabled)])) +if test "$enable_memory_sanitizers" = "yes"; then + AC_MSG_RESULT([yes]) + WANT_MEMORY_SANITIZERS=1 + AC_MSG_WARN([******************************************************]) + AC_MSG_WARN([**** Memory sanitizers may require that you LD_PRELOAD]) + AC_MSG_WARN([**** libasan in order to run an executable.]) + AC_MSG_WARN([******************************************************]) +else + AC_MSG_RESULT([no]) + WANT_MEMORY_SANITIZERS=0 +fi + +AC_DEFINE_UNQUOTED(PRTE_MEMORY_SANITIZERS, $WANT_MEMORY_SANITIZERS, + [Whether or not we are using memory sanitizers]) + +# +# Do we want to install the internal devel headers? +# +AC_MSG_CHECKING([if want to install project-internal header files]) +AC_ARG_WITH(devel-headers, + AS_HELP_STRING([--with-devel-headers], + [Normal PRTE users/applications do not need this. Developer headers are only necessary for authors doing deeper integration (default: disabled).])) +if test "$with_devel_headers" = "yes"; then + AC_MSG_RESULT([yes]) + WANT_INSTALL_HEADERS=1 +else + AC_MSG_RESULT([no]) + WANT_INSTALL_HEADERS=0 +fi +AM_CONDITIONAL(WANT_INSTALL_HEADERS, test "$WANT_INSTALL_HEADERS" = 1) + +# +# Do we want the pretty-print stack trace feature? +# + +AC_MSG_CHECKING([if want pretty-print stacktrace]) +AC_ARG_ENABLE([pretty-print-stacktrace], + [AS_HELP_STRING([--enable-pretty-print-stacktrace], + [Pretty print stacktrace on process signal (default: enabled)])]) +if test "$enable_pretty_print_stacktrace" = "no" ; then + AC_MSG_RESULT([no]) + WANT_PRETTY_PRINT_STACKTRACE=0 +else + AC_MSG_RESULT([yes]) + WANT_PRETTY_PRINT_STACKTRACE=1 +fi +AC_DEFINE_UNQUOTED([PRTE_WANT_PRETTY_PRINT_STACKTRACE], + [$WANT_PRETTY_PRINT_STACKTRACE], + [if want pretty-print stack trace feature]) + + +# +# Do we want PTY support? +# + +AC_MSG_CHECKING([if want pty support]) +AC_ARG_ENABLE(pty-support, + AS_HELP_STRING([--enable-pty-support], + [Enable/disable PTY support for STDIO forwarding. (default: enabled)])) +if test "$enable_pty_support" = "no" ; then + AC_MSG_RESULT([no]) + PRTE_ENABLE_PTY_SUPPORT=0 +else + AC_MSG_RESULT([yes]) + PRTE_ENABLE_PTY_SUPPORT=1 +fi +AC_DEFINE_UNQUOTED([PRTE_ENABLE_PTY_SUPPORT], [$PRTE_ENABLE_PTY_SUPPORT], + [Whether user wants PTY support or not]) + + +# +# Do we want to allow DLOPEN? +# + +AC_MSG_CHECKING([if want dlopen support]) +AC_ARG_ENABLE([dlopen], + [AS_HELP_STRING([--enable-dlopen], + [Whether build should attempt to use dlopen (or + similar) to dynamically load components. + Disabling dlopen implies --disable-mca-dso. + (default: enabled)])]) +if test "$enable_dlopen" = "no" ; then + PRTE_ENABLE_DLOPEN_SUPPORT=0 + AC_MSG_RESULT([no]) +else + PRTE_ENABLE_DLOPEN_SUPPORT=1 + AC_MSG_RESULT([yes]) +fi +AC_DEFINE_UNQUOTED(PRTE_ENABLE_DLOPEN_SUPPORT, $PRTE_ENABLE_DLOPEN_SUPPORT, + [Whether we want to enable dlopen support]) + + +# +# Do we want to show component load error messages by default? +# + +AC_MSG_CHECKING([for default value of mca_base_component_show_load_errors]) +AC_ARG_ENABLE([show-load-errors-by-default], + [AS_HELP_STRING([--enable-show-load-errors-by-default], + [Set the default value for the MCA parameter + mca_base_component_show_load_errors (but can be + overridden at run time by the usual + MCA-variable-setting mechansism). This MCA variable + controls whether warnings are displayed when an MCA + component fails to load at run time due to an error. + (default: enabled in --enable-debug builds, meaning that + mca_base_component_show_load_errors is enabled + by default when configured with --enable-debug])]) +if test "$enable_show_load_errors_by_default" = "no" ; then + PRTE_SHOW_LOAD_ERRORS_DEFAULT=0 + AC_MSG_RESULT([disabled by default]) +else + PRTE_SHOW_LOAD_ERRORS_DEFAULT=$WANT_DEBUG + if test "$WANT_DEBUG" = "1"; then + AC_MSG_RESULT([enabled by default]) + else + AC_MSG_RESULT([disabled by default]) + fi +fi +AC_DEFINE_UNQUOTED(PRTE_SHOW_LOAD_ERRORS_DEFAULT, $PRTE_SHOW_LOAD_ERRORS_DEFAULT, + [Default value for mca_base_component_show_load_errors MCA variable]) + + +# +# Handle embedded version strings +# +AC_MSG_CHECKING([if a proxy version string for prte is required]) +AC_ARG_WITH(proxy-version-string, + AS_HELP_STRING([--with-proxy-version-string], + [Return the provided string when prte is used in proxy mode and the version is requested])) +if test -n "$with_proxy_version_string"; then + AC_MSG_RESULT([yes]) + PRTE_PROXY_VERSION_STRING=$with_proxy_version_string +else + AC_MSG_RESULT([no]) + PRTE_PROXY_VERSION_STRING=$PRTE_VERSION +fi +AC_DEFINE_UNQUOTED(PRTE_PROXY_VERSION_STRING, "$PRTE_PROXY_VERSION_STRING", + [Version string to be returned by prte when in proxy mode]) + +# +# Save the actual version in an external header file so that +# packages that use us can know what version we are +# +prtemajor=${PRTE_MAJOR_VERSION}L +prteminor=${PRTE_MINOR_VERSION}L +prterelease=${PRTE_RELEASE_VERSION}L +prtenumeric=$(printf 0x%4.4x%2.2x%2.2x $PRTE_MAJOR_VERSION $PRTE_MINOR_VERSION $PRTE_RELEASE_VERSION) +AC_SUBST(prtemajor) +AC_SUBST(prteminor) +AC_SUBST(prterelease) +AC_SUBST(prtenumeric) + +AC_MSG_CHECKING([if a proxy package name for prte is required]) +AC_ARG_WITH(proxy-package-name, + AS_HELP_STRING([--with-proxy-package-name], + [Return the provided string when prte is used in proxy mode and the package name is requested])) +if test -n "$with_proxy_package_name"; then + AC_MSG_RESULT([yes]) + PRTE_PROXY_PACKAGE_NAME=$with_proxy_package_name +else + AC_MSG_RESULT([no]) + PRTE_PROXY_PACKAGE_NAME="PMIx Reference RunTime Environment" +fi +AC_DEFINE_UNQUOTED(PRTE_PROXY_PACKAGE_NAME, "$PRTE_PROXY_PACKAGE_NAME", + [Package name to be returned by prte when in proxy mode]) + +AC_MSG_CHECKING([if a proxy bugreport path for prte is required]) +AC_ARG_WITH(proxy-bugreport, + AS_HELP_STRING([--with-proxy-bugreport], + [Return the provided string when prte is used in proxy mode and the PACKAGE_BUGREPORT is requested])) +if test -n "$with_proxy_bugreport"; then + AC_MSG_RESULT([yes]) + PRTE_PROXY_BUGREPORT=$with_proxy_bugreport +else + AC_MSG_RESULT([no]) + PRTE_PROXY_BUGREPORT=https://github.com/openpmix/prrte/ +fi +AC_DEFINE_UNQUOTED(PRTE_PROXY_BUGREPORT, "$PRTE_PROXY_BUGREPORT", + [Bugreport string to be returned by prte when in proxy mode]) + + +# +# Support per-user config files? +# +AC_ARG_ENABLE([per-user-config-files], + [AS_HELP_STRING([--enable-per-user-config-files], + [Disable per-user configuration files, to save disk accesses during job start-up. This is likely desirable for large jobs. Note that this can also be achieved by environment variables at run-time. (default: enabled)])]) +if test "$enable_per_user_config_files" = "no" ; then + result=0 +else + result=1 +fi +AC_DEFINE_UNQUOTED([PRTE_WANT_HOME_CONFIG_FILES], [$result], + [Enable per-user config files]) + +# +# Do we want to enable IPv6 support? +# +AC_MSG_CHECKING([if want IPv6 support]) +AC_ARG_ENABLE([ipv6], + [AS_HELP_STRING([--enable-ipv6], + [Enable IPv6 support, but only if the underlying system supports it (default: disabled)])]) +if test "$enable_ipv6" = "yes"; then + AC_MSG_RESULT([yes]) + prte_want_ipv6=1 +else + AC_MSG_RESULT([no]) + prte_want_ipv6=0 +fi +AC_DEFINE_UNQUOTED([PRTE_ENABLE_IPV6], [$prte_want_ipv6], + [Enable IPv6 support, but only if the underlying system supports it]) + + +# Package/brand string +# +AC_MSG_CHECKING([if want package/brand string]) +AC_ARG_WITH([package-string], + [AS_HELP_STRING([--with-package-string=STRING], + [Use a branding string throughout PRRTE])]) +if test "$with_package_string" = "" || test "$with_package_string" = "no"; then + with_package_string="Open MPI $PRTE_CONFIGURE_USER@$PRTE_CONFIGURE_HOST Distribution" +fi +AC_DEFINE_UNQUOTED([PRTE_PACKAGE_STRING], ["$with_package_string"], + [package/branding string for Open MPI]) +AC_MSG_RESULT([$with_package_string]) + +# +# Ident string +# +AC_MSG_CHECKING([if want ident string]) +AC_ARG_WITH([ident-string], + [AS_HELP_STRING([--with-ident-string=STRING], + [Embed an ident string into Open MPI object files])]) +if test "$with_ident_string" = "" || test "$with_ident_string" = "no"; then + with_ident_string="%VERSION%" +fi +# This is complicated, because $PRTE_VERSION may have spaces in it. +# So put the whole sed expr in single quotes -- i.e., directly +# substitute %VERSION% for (not expanded) $PRTE_VERSION. +with_ident_string="`echo $with_ident_string | sed -e 's/%VERSION%/$PRTE_VERSION/'`" + +# Now eval an echo of that so that the "$PRTE_VERSION" token is +# replaced with its value. Enclose the whole thing in "" so that it +# ends up as 1 token. +with_ident_string="`eval echo $with_ident_string`" + +AC_DEFINE_UNQUOTED([PRTE_IDENT_STRING], ["$with_ident_string"], + [ident string for Open MPI]) +AC_MSG_RESULT([$with_ident_string]) + + +# some systems don't want/like getpwuid +AC_MSG_CHECKING([if want getpwuid support]) +AC_ARG_ENABLE([getpwuid], + [AS_HELP_STRING([--disable-getpwuid], + [Disable getpwuid support (default: enabled)])]) +if test "$enable_getpwuid" = "no"; then + AC_MSG_RESULT([no]) + prte_want_getpwuid=0 +else + AC_MSG_RESULT([yes]) + prte_want_getpwuid=1 +fi +AC_DEFINE_UNQUOTED([PRTE_ENABLE_GETPWUID], [$prte_want_getpwuid], + [Disable getpwuid support (default: enabled)]) + +])dnl diff --git a/config/prte_ensure_contains_optflags.m4 b/config/prte_ensure_contains_optflags.m4 new file mode 100644 index 0000000000000000000000000000000000000000..d92f931e3f2e4b30da8a431aa12785ed09909fca --- /dev/null +++ b/config/prte_ensure_contains_optflags.m4 @@ -0,0 +1,67 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. +dnl Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([PRTE_ENSURE_CONTAINS_OPTFLAGS],[ + +# Modularize this setup so that sub-configure.in scripts can use this +# same setup code. + +################################## +# Optimization flags +################################## + +# If the user did not specify optimization flags, add some (the value +# from $OPTFLAGS) + +co_arg="$1" +co_found=0 +for co_word in $co_arg; do + # See http://www.gnu.org/software/autoconf/manual/html_node/Quadrigraphs.html#Quadrigraphs + # for an explanation of @<:@ and @:>@ -- they m4 expand to [ and ] + case $co_word in + -g) co_found=1 ;; + -g@<:@1-3@:>@) co_found=1 ;; + +K@<:@0-5@:>@) co_found=1 ;; + -O) co_found=1 ;; + -O@<:@0-9@:>@) co_found=1 ;; + -xO) co_found=1 ;; + -xO@<:@0-9@:>@) co_found=1 ;; + -fast) co_found=1 ;; + + # The below Sun Studio flags require or + # trigger -xO optimization + -xvector*) co_found=1 ;; + -xdepend=yes) co_found=1 ;; + + esac +done + +if test "$co_found" = "0"; then + co_result="$OPTFLAGS $co_arg" +else + co_result="$co_arg" +fi + +# Clean up + +unset co_found co_word co_arg +]) diff --git a/config/prte_find_type.m4 b/config/prte_find_type.m4 new file mode 100644 index 0000000000000000000000000000000000000000..553cbe86a311b3d0d71b8e134b598c3a92f93f77 --- /dev/null +++ b/config/prte_find_type.m4 @@ -0,0 +1,56 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# PRTE_FIND_TYPE(type, [list of c types], abort if not found, +# target size, variable to set) +# ----------------------------------------------------------- +AC_DEFUN([PRTE_FIND_TYPE],[ + AS_VAR_PUSHDEF([type_var], [prte_cv_find_type_$1]) + + oft_abort_on_fail="$3" + oft_target_size="$4" + + AC_CACHE_CHECK([for C type corresponding to $1], type_var, + [ # Loop over all the types handed to us + oft_real_type= + AS_IF([test "$oft_target_size" != ""], + [m4_foreach(oft_type, [$2], + [if test -z "$oft_real_type"; then + if test "[$ac_cv_sizeof_]m4_bpatsubst(oft_type, [[^a-zA-Z0-9_]], [_])" = "$oft_target_size" ; then + oft_real_type="oft_type" + fi + fi +])]) + AS_IF([test -z "$oft_real_type"], + [AS_VAR_SET(type_var, "not found")], + [AS_VAR_SET(type_var, "$oft_real_type")])]) + + AS_VAR_IF(type_var, ["not found"], + [AC_MSG_WARN([*** Did not find corresponding C type]) + AS_IF([test "$oft_abort_on_fail" != "no"], + [AC_MSG_ERROR([Cannot continue])])]) + + AS_VAR_IF(type_var, ["not found"], [$5=], [AS_VAR_COPY([$5], [type_var])]) + + unset oft_real_type oft_target_size + + AS_VAR_POPDEF([type_var])dnl +])dnl diff --git a/config/prte_functions.m4 b/config/prte_functions.m4 new file mode 100644 index 0000000000000000000000000000000000000000..7c9a68e83e933992173795aa4c02be797f23e587 --- /dev/null +++ b/config/prte_functions.m4 @@ -0,0 +1,389 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. +dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. +dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2013-2020 Intel, Inc. All rights reserved. +dnl Copyright (c) 2017 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl +dnl Copyright (c) 2021 Nanook Consulting. All rights reserved. +dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. +dnl All Rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl +dnl Portions of this file derived from GASNet v1.12 (see "GASNet" +dnl comments, below) +dnl Copyright 2004, Dan Bonachea +dnl +dnl IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +dnl DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +dnl OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +dnl CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +dnl AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +dnl ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +dnl PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +dnl + +AC_DEFUN([PRTE_CONFIGURE_SETUP],[ + +# Some helper script functions. Unfortunately, we cannot use $1 kinds +# of arugments here because of the m4 substitution. So we have to set +# special variable names before invoking the function. :-\ + +prte_show_title() { + cat <@:*) + echo installing to directory \"$prefix\" + ;; + *) + AC_MSG_ERROR(prefix "$prefix" must be an absolute directory path) + ;; +esac + +# BEGIN: Derived from GASNet + +# Suggestion from Paul Hargrove to disable --program-prefix and +# friends. Heavily influenced by GASNet 1.12 acinclude.m4 +# functionality to do the same thing (copyright listed at top of this +# file). + +# echo program_prefix=$program_prefix program_suffix=$program_suffix program_transform_name=$program_transform_name +# undo prefix autoconf automatically adds during cross-compilation +if test "$cross_compiling" = yes && test "$program_prefix" = "${target_alias}-" ; then + program_prefix=NONE +fi +# normalize empty prefix/suffix +if test -z "$program_prefix" ; then + program_prefix=NONE +fi +if test -z "$program_suffix" ; then + program_suffix=NONE +fi +# undo transforms caused by empty prefix/suffix +if expr "$program_transform_name" : 's.^..$' >/dev/null || \ + expr "$program_transform_name" : 's.$$..$' >/dev/null || \ + expr "$program_transform_name" : 's.$$..;s.^..$' >/dev/null ; then + program_transform_name="s,x,x," +fi +if test "$program_prefix$program_suffix$program_transform_name" != "NONENONEs,x,x," ; then + AC_MSG_WARN([*** The PMIx configure script does not support --program-prefix, --program-suffix or --program-transform-name. Users are recommended to instead use --prefix with a unique directory and make symbolic links as desired for renaming.]) + AC_MSG_ERROR([*** Cannot continue]) +fi + +# END: Derived from GASNet +])dnl + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +AC_DEFUN([PRTE_LOG_MSG], +[AS_IF([test -n "$2"], [OAC_LOG_MSG([$1])], [OAC_LOG_MSG_NOPREFIX([$1])])]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_LOG_FILE], [PRTE_LOG_FILE]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_LOG_COMMAND], [PRTE_LOG_COMMAND]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_UNIQ], [PRTE_UNIQ]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_APPEND], [PRTE_APPEND]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_APPEND_UNIQ], [PRTE_APPEND_UNIQ]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_FLAGS_APPEND_UNIQ], [PRTE_FLAGS_APPEND_UNIQ]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_FLAGS_PREPEND_UNIQ], [PRTE_FLAGS_PREPEND_UNIQ]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +# Macro that serves as an alternative to using `which `. It is +# preferable to simply using `which ` because backticks (`) (aka +# backquotes) invoke a sub-shell which may source a "noisy" +# ~/.whatever file (and we do not want the error messages to be part +# of the assignment in foo=`which `). This macro ensures that we +# get a sane executable value. +AC_DEFUN([PRTE_WHICH],[ +# 1 is the variable name to do "which" on +# 2 is the variable name to assign the return value to + +PRTE_VAR_SCOPE_PUSH([prte_prog prte_file prte_dir prte_sentinel]) + +prte_prog=$1 + +IFS_SAVE=$IFS +IFS="$PATH_SEPARATOR" +for prte_dir in $PATH; do + if test -x "$prte_dir/$prte_prog"; then + $2="$prte_dir/$prte_prog" + break + fi +done +IFS=$IFS_SAVE + +PRTE_VAR_SCOPE_POP +])dnl + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +m4_copy([OAC_VAR_SCOPE_PUSH], [PRTE_VAR_SCOPE_PUSH]) +m4_copy([OAC_VAR_SCOPE_POP], [PRTE_VAR_SCOPE_POP]) + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +# +# PRTE_WITH_OPTION_MIN_MAX_VALUE(NAME,DEFAULT_VALUE,LOWER_BOUND,UPPER_BOUND) +# Defines a variable PRTE_MAX_xxx, with "xxx" being specified as parameter $1 as "variable_name". +# If not set at configure-time using --with-max-xxx, the default-value ($2) is assumed. +# If set, value is checked against lower (value >= $3) and upper bound (value <= $4) +# +AC_DEFUN([PRTE_WITH_OPTION_MIN_MAX_VALUE], [ + max_value=[$2] + AC_MSG_CHECKING([maximum length of ]m4_translit($1, [_], [ ])) + AC_ARG_WITH([max-]m4_translit($1, [_], [-]), + AS_HELP_STRING([--with-max-]m4_translit($1, [_], [-])[=VALUE], + [maximum length of ]m4_translit($1, [_], [ ])[s. VALUE argument has to be specified (default: [$2]).])) + if test ! -z "$with_max_[$1]" && test "$with_max_[$1]" != "no" ; then + # Ensure it's a number (hopefully an integer!), and >0 + expr $with_max_[$1] + 1 > /dev/null 2> /dev/null + AS_IF([test "$?" != "0"], [happy=0], + [AS_IF([test $with_max_[$1] -ge $3 && test $with_max_[$1] -le $4], + [happy=1], [happy=0])]) + + # If badness in the above tests, bail + AS_IF([test "$happy" = "0"], + [AC_MSG_RESULT([bad value ($with_max_[$1])]) + AC_MSG_WARN([--with-max-]m4_translit($1, [_], [-])[s value must be >= $3 and <= $4]) + AC_MSG_ERROR([Cannot continue])]) + max_value=$with_max_[$1] + fi + AC_MSG_RESULT([$max_value]) + AC_DEFINE_UNQUOTED([PRTE_MAX_]m4_toupper($1), $max_value, + [Maximum length of ]m4_translit($1, [_], [ ])[s (default is $2)]) + [PRTE_MAX_]m4_toupper($1)=$max_value + AC_SUBST([PRTE_MAX_]m4_toupper($1)) +])dnl + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +# Usage: PRTE_COMPUTE_MAX_VALUE(number_bytes, variable_to_set, action if overflow) +# Compute maximum value of datatype of +# number_bytes, setting the result in the second argument. Assumes a +# signed datatype. +AC_DEFUN([PRTE_COMPUTE_MAX_VALUE], [ + # This is more complicated than it really should be. But some + # expr implementations (OpenBSD) have an expr with a max value of + # 2^31 - 1, and we sometimes want to compute the max value of a + # type as big or bigger than that... + prte_num_bits=`expr $1 \* 8 - 1` + newval=1 + value=1 + overflow=0 + + while test $prte_num_bits -ne 0 ; do + newval=`expr $value \* 2` + if test 0 -eq `expr $newval \< 0` ; then + # if the new value is not negative, next iteration... + value=$newval + prte_num_bits=`expr $prte_num_bits - 1` + # if this was the last iteration, subtract 1 (as signed + # max positive is 2^num_bits - 1). Do this here instead + # of outside of the while loop because we might have + # already subtracted 1 by then if we're trying to find the + # max value of the same datatype expr uses as it's + # internal representation (ie, if we hit the else + # below...) + if test 0 -eq $prte_num_bits ; then + value=`expr $value - 1` + fi + else + # if the new value is negative, we've over flowed. First, + # try adding value - 1 instead of value (see if we can get + # to positive max of expr) + newval=`expr $value - 1 + $value` + if test 0 -eq `expr $newval \< 0` ; then + value=$newval + # Still positive, this is as high as we can go. If + # prte_num_bits is 1, we didn't actually overflow. + # Otherwise, we overflowed. + if test 1 -ne $prte_num_bits ; then + overflow=1 + fi + else + # stil negative. Time to give up. + overflow=1 + fi + prte_num_bits=0 + fi + done + + AS_VAR_SET([$2], [$value]) + AS_IF([test $overflow -ne 0], [$3]) +])dnl diff --git a/config/prte_get_version.m4 b/config/prte_get_version.m4 new file mode 100644 index 0000000000000000000000000000000000000000..b78a64009cfe0ac5e27e9c3c6095e7b10e55443a --- /dev/null +++ b/config/prte_get_version.m4 @@ -0,0 +1,101 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2005 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2014-2020 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +dnl +dnl This file is also used as input to prte_get_version.sh. +dnl + +# PRTE_GET_VERSION(version_file, variable_prefix) +# ----------------------------------------------- +# parse version_file for version information, setting +# the following shell variables: +# +# prefix_VERSION +# prefix_BASE_VERSION +# prefix_MAJOR_VERSION +# prefix_MINOR_VERSION +# prefix_RELEASE_VERSION +# prefix_GREEK_VERSION +# prefix_REPO_REV +# prefix_TARBALL_VERSION +# prefix_RELEASE_DATE +m4_define([PRTE_GET_VERSION],[ + dnl quote eval to suppress macro expansion with non-GNU m4 + if test -f "$1"; then + srcdir=`dirname $1` + prte_vers=`sed -n " + t clear + : clear + s/^major/$2_MAJOR_VERSION/ + s/^minor/$2_MINOR_VERSION/ + s/^release/$2_RELEASE_VERSION/ + s/^greek/$2_GREEK_VERSION/ + s/^repo_rev/$2_REPO_REV/ + s/^tarball_version/$2_TARBALL_VERSION/ + s/^date/$2_RELEASE_DATE/ + t print + b + : print + p" < "$1"` + [eval] "$prte_vers" + + $2_VERSION="$$2_MAJOR_VERSION.$$2_MINOR_VERSION.$$2_RELEASE_VERSION" + $2_VERSION="${$2_VERSION}${$2_GREEK_VERSION}" + + if test "$$2_TARBALL_VERSION" = ""; then + $2_TARBALL_VERSION=$$2_VERSION + fi + + m4_ifdef([AC_MSG_CHECKING], + [AC_MSG_CHECKING([for repo version])]) + + # If repo_rev was not set in the VERSION file, then get it now + if test "$$2_REPO_REV" = ""; then + # See if we can find the "git" command. + git_happy=0 + git --version > /dev/null 2>&1 + if test $? -eq 0; then + git_happy=1 + fi + + # If we're in a git repo and we found the git command, use + # git describe to get the repo rev + if test -r "$srcdir/.git" && test $git_happy -eq 1; then + if test "$srcdir" != "`pwd`"; then + git_save_dir=`pwd` + cd "$srcdir" + $2_REPO_REV=`git describe --tags --always` + cd "$git_save_dir" + unset git_save_dir + else + $2_REPO_REV=`git describe --tags --always` + fi + else + $2_REPO_REV=`$srcdir/config/getdate.sh '+%Y-%m-%d'` + fi + fi + + m4_ifdef([AC_MSG_RESULT], + [AC_MSG_RESULT([$$2_REPO_REV])]) + fi +]) diff --git a/config/prte_get_version.m4sh b/config/prte_get_version.m4sh new file mode 100644 index 0000000000000000000000000000000000000000..9f31e02235d3893a936d1d5c817438db17ed09fd --- /dev/null +++ b/config/prte_get_version.m4sh @@ -0,0 +1,94 @@ +m4_define([_m4_divert(SCRIPT)], 100) +m4_divert_push([SCRIPT])dnl +#!/bin/sh +# +# prte_get_version is created from prte_get_version.m4 and prte_get_version.m4sh. +# +# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +m4_include([prte_get_version.m4]) + +srcfile="$1" +option="$2" + +if test -z "$srcfile"; then + option="--help" +else + PRTE_GET_VERSION([$srcfile],[PRTE]) + + if test "$option" = ""; then + option="--full" + fi +fi + +case "$option" in + --full|-v|--version) + echo $PRTE_VERSION + ;; + --major) + echo $PRTE_MAJOR_VERSION + ;; + --minor) + echo $PRTE_MINOR_VERSION + ;; + --release) + echo $PRTE_RELEASE_VERSION + ;; + --greek) + echo $PRTE_GREEK_VERSION + ;; + --repo-rev) + echo $PRTE_REPO_REV + ;; + --tarball) + echo $PRTE_TARBALL_VERSION + ;; + --release-date) + echo $PRTE_RELEASE_DATE + ;; + --all) + echo ${PRTE_VERSION} : ${PRTE_MAJOR_VERSION} : ${PRTE_MINOR_VERSION} : ${PRTE_RELEASE_VERSION} : ${PRTE_GREEK_VERSION} : ${PRTE_REPO_REV} : ${PRTE_TARBALL_VERSION} + ;; + -h|--help) + cat < [