diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..d126a970 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,28 @@ + + +Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Your help is appreciated! + +Before you push a pull request, review this list: + +- [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project. +- [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. +- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice. +- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. +- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge. diff --git a/.github/workflows/codeql-analysis-cpp.yml b/.github/workflows/codeql-analysis-cpp.yml index 964df233..ce0fc49b 100644 --- a/.github/workflows/codeql-analysis-cpp.yml +++ b/.github/workflows/codeql-analysis-cpp.yml @@ -45,10 +45,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3.5.3 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - uses: actions/cache@v3.3.1 + - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # 3.27.9 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -86,4 +86,4 @@ jobs: make - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # 3.27.9 diff --git a/.github/workflows/codeql-analysis-java.yml b/.github/workflows/codeql-analysis-java.yml index c3074ba6..4dddfd37 100644 --- a/.github/workflows/codeql-analysis-java.yml +++ b/.github/workflows/codeql-analysis-java.yml @@ -45,10 +45,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3.5.3 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - uses: actions/cache@v3.3.1 + - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # 3.27.9 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@df409f7d9260372bd5f19e5b04e83cb3c43714ae # 3.27.9 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # 3.27.9 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 7f1f8611..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Coverage - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - java: [ 8 ] - - steps: - - uses: actions/checkout@v3.5.3 - with: - persist-credentials: false - - uses: actions/cache@v3.3.1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v3.11.0 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - - name: Build with Maven - run: mvn -V test jacoco:report --file pom.xml --no-transfer-progress - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - files: ./target/site/jacoco/jacoco.xml diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000..c6ece650 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: 'Dependency Review PR' + uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index fbeca930..a43b0796 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -27,27 +27,33 @@ jobs: continue-on-error: ${{ matrix.experimental }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-13] java: [ 8, 11, 17 ] experimental: [false] # include: -# - java: 18-ea -# experimental: true +# - os: ubuntu-latest +# java: 21 +# experimental: true +# - os: ubuntu-latest +# java: 23 +# experimental: true +# - java: 24-ea +# experimental: true steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - uses: actions/cache@v3.3.1 + - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v3.11.0 + uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 with: distribution: 'temurin' java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn -V -Ddoclint=all --file pom.xml --no-transfer-progress + run: mvn --errors --show-version --batch-mode --no-transfer-progress -Ddoclint=all diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 23c29372..35812f16 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -40,12 +40,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@v3.5.3 # 3.1.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@80e868c13c90f172d68d1f4501dee99e2479f7af # 2.1.3 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # 2.4.0 with: results_file: results.sarif results_format: sarif @@ -57,13 +57,13 @@ jobs: publish_results: true - name: "Upload artifact" - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # 3.1.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3 with: name: SARIF file path: results.sarif retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b398f525a5587552e573b247ac661067fafa920b # 2.1.22 + uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # 3.27.9 with: sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index 64be9284..4d880d82 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ /src/native/unix/native/*.o /src/native/unix/native/Makefile /src/native/unix/native/libservice.a +/src/native/unix/support/config.guess +/src/native/unix/support/config.sub /src/native/windows/apps/prunmgr/*_GUI_RELEASE /src/native/windows/apps/prunsrv/*_RELEASE /target/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfb95359..3796f160 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,13 +49,13 @@ Getting Started --------------- + Make sure you have a [JIRA account](https://issues.apache.org/jira/). -+ Make sure you have a [GitHub account](https://github.com/signup/free). ++ Make sure you have a [GitHub account](https://github.com/signup/free). This is not essential, but makes providing patches much easier. + If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons Daemon's scope. + Submit a [Jira Ticket][jira] for your issue, assuming one does not already exist. + Clearly describe the issue including steps to reproduce when it is a bug. + Make sure you fill in the earliest version that you know has the issue. + Find the corresponding [repository on GitHub](https://github.com/apache/?query=commons-), -[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository. +[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository. If you don't have a GitHub account, you can still clone the Commons repository. Making Changes -------------- @@ -109,7 +109,6 @@ Additional Resources + [General GitHub documentation](https://help.github.com/) + [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/) + [Apache Commons Twitter Account](https://twitter.com/ApacheCommons) -+ `#apache-commons` IRC channel on `irc.freenode.net` [cla]:https://www.apache.org/licenses/#clas [jira]:https://issues.apache.org/jira/browse/DAEMON diff --git a/NOTICE.txt b/NOTICE.txt index d6491d7d..d5457925 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Commons Daemon -Copyright 1999-2023 The Apache Software Foundation +Copyright 1999-2024 The Apache Software Foundation This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). +The Apache Software Foundation (https://www.apache.org/). diff --git a/README.md b/README.md index 69a311c5..06370f57 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,11 @@ Apache Commons Daemon =================== -[![GitHub Actions Status](https://github.com/apache/commons-daemon/workflows/Java%20CI/badge.svg)](https://github.com/apache/commons-daemon/actions) -[![Coverage Status](https://codecov.io/gh/apache/commons-daemon/branch/master/graph/badge.svg)](https://app.codecov.io/gh/apache/commons-daemon) -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/commons-daemon/commons-daemon/badge.svg)](https://maven-badges.herokuapp.com/maven-central/commons-daemon/commons-daemon/) -[![Javadocs](https://javadoc.io/badge/commons-daemon/commons-daemon/1.3.3.svg)](https://javadoc.io/doc/commons-daemon/commons-daemon/1.3.3) -[![CodeQL](https://github.com/apache/commons-daemon/workflows/CodeQL%20CPP/badge.svg)](https://github.com/apache/commons-daemon/actions/workflows/codeql-analysis-cpp.yml?query=workflow%3ACodeQL) -[![CodeQL](https://github.com/apache/commons-daemon/workflows/CodeQL%20Java/badge.svg)](https://github.com/apache/commons-daemon/actions/workflows/codeql-analysis-java.yml?query=workflow%3ACodeQL) +[![Java CI](https://github.com/apache/commons-daemon/actions/workflows/maven.yml/badge.svg)](https://github.com/apache/commons-daemon/actions/workflows/maven.yml) +[![Maven Central](https://img.shields.io/maven-central/v/commons-daemon/commons-daemon?label=Maven%20Central)](https://search.maven.org/artifact/commons-daemon/commons-daemon) +[![Javadocs](https://javadoc.io/badge/commons-daemon/commons-daemon/1.4.0.svg)](https://javadoc.io/doc/commons-daemon/commons-daemon/1.4.0) +[![CodeQL](https://github.com/apache/commons-daemon/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/commons-daemon/actions/workflows/codeql-analysis.yml) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/apache/commons-daemon/badge)](https://api.securityscorecards.dev/projects/github.com/apache/commons-daemon) Apache Commons Daemon software is a set of utilities and Java support classes for running Java applications as server processes. These are @@ -60,51 +59,62 @@ Documentation More information can be found on the [Apache Commons Daemon homepage](https://commons.apache.org/proper/commons-daemon). The [Javadoc](https://commons.apache.org/proper/commons-daemon/apidocs) can be browsed. -Questions related to the usage of Apache Commons Daemon should be posted to the [user mailing list][ml]. +Questions related to the usage of Apache Commons Daemon should be posted to the [user mailing list](https://commons.apache.org/mail-lists.html). -Where can I get the latest release? ------------------------------------ +Getting the latest release +-------------------------- You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-daemon/download_daemon.cgi). -Alternatively, you can pull it from the central Maven repositories: +Alternatively, you can pull it from the central Maven repositories: ```xml commons-daemon commons-daemon - 1.3.3 + 1.4.0 ``` +Building +-------- + +Building requires a Java JDK and [Apache Maven](https://maven.apache.org/). +The required Java version is found in the `pom.xml` as the `maven.compiler.source` property. + +From a command shell, run `mvn` without arguments to invoke the default Maven goal to run all tests and checks. + Contributing ------------ -We accept Pull Requests via GitHub. The [developer mailing list][ml] is the main channel of communication for contributors. +We accept Pull Requests via GitHub. The [developer mailing list](https://commons.apache.org/mail-lists.html) is the main channel of communication for contributors. There are some guidelines which will make applying PRs easier for us: + No tabs! Please use spaces for indentation. -+ Respect the code style. ++ Respect the existing code style for each file. + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change. -+ Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running ```mvn clean test```. ++ Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running ```mvn```. If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas). You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md). License ------- -This code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0). +This code is licensed under the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0). See the `NOTICE.txt` file for required notices and attributions. -Donations ---------- -You like Apache Commons Daemon? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support the development. +Donating +-------- +You like Apache Commons Daemon? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support development. Additional Resources -------------------- + [Apache Commons Homepage](https://commons.apache.org/) + [Apache Issue Tracker (JIRA)](https://issues.apache.org/jira/browse/DAEMON) ++ [Apache Commons Slack Channel](https://the-asf.slack.com/archives/C60NVB8AD) + [Apache Commons Twitter Account](https://twitter.com/ApacheCommons) -+ `#apache-commons` IRC channel on `irc.freenode.org` -[ml]:https://commons.apache.org/mail-lists.html +Apache Commons Components +------------------------- + +Please see the [list of components](https://commons.apache.org/components.html) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 5e7e7ef5..d5820ca6 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -15,18 +15,21 @@ limitations under the License. ================================================================================ - Apache Commons Daemon 1.3.5 + Apache Commons Daemon 1.4.1 Release Notes This document contains the release notes for this version of the -Apache Commons Daemon package, and highlights new features in the 1.3 -releases compared to the 1.2 releases. +Apache Commons Daemon package, and highlights new features in the 1.4 +releases compared to the 1.3 releases. New Features ------------ - - The minimum Java version has been increased to Java 7 + - The minimum Java version has been increased to Java 8 + + - The minimum supported Windows versions have been increased to Windows 10 and + Windows Server 2016. Bug Fixes diff --git a/pom.xml b/pom.xml index 7f5a9aca..14b07768 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,4 @@ - + @@ -122,22 +122,31 @@ - java17 - 1.7 + java18 + 1.8 ${commons.daemon.javaversion} ${commons.daemon.javaversion} daemon org.apache.commons.daemon - 1.3.5 + 1.4.1 RC1 - 1.3.4 + 1.4.0 DAEMON 12310468 + 2024-01-01T00:00:00Z + true + + true + 0.12 + 0.00 + 0.01 + 0.00 + 0.00 + 0.00 - diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml index 01d37de6..54ec5dae 100644 --- a/src/assembly/bin.xml +++ b/src/assembly/bin.xml @@ -14,7 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. --> - + bin tar.gz diff --git a/src/assembly/native-src.xml b/src/assembly/native-src.xml index d6279f1b..6ff43aa8 100644 --- a/src/assembly/native-src.xml +++ b/src/assembly/native-src.xml @@ -14,7 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. --> - + native-src tar.gz diff --git a/src/assembly/src.xml b/src/assembly/src.xml index 7e1640df..a4ffa88e 100644 --- a/src/assembly/src.xml +++ b/src/assembly/src.xml @@ -14,7 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. --> - + src tar.gz diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 01124790..fb3454f1 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -40,12 +40,72 @@ Apache Commons Daemon Release Notes - + + + + Fix several issues around Java OS and header files location detection. + + + Correct several log messages where an incorrect placeholder led to + truncation of the inserted values. + + + + Add protection to avoid high CPU usage for applications running in JVM + mode that do not wait for the stop method to be called before the start + method returns. + + + + Bump org.apache.commons:commons-parent from 71 to 78 #189, #196, #198, #204, #207, #210, #216. + + + Remove autogenerated files and rely on autoreconf only. + + + + + [StepSecurity] ci: Harden GitHub Actions #95. + + + Procrun. Enable Control Flow Guard for Windows binaries. + + + Procrun. Better label for command used to start service shown in + Prunmgr.exe. + + + jsvc. Fix warnings when running support/buildconf.sh + + + jsvc. Fix compilation issue with newer compilers. + + + Procrun. Refactor UAC support so that elevation is only requested for + actions that require administrator privileges. + + + Procrun. Add support for hybrid CRT builds. + + + jsvc. Add support for LoongArch64 support #92. + - Bump commons-parent from 57 to 58 (#93) #132. + Bump commons-parent from 57 to 69 #155. + + + The minimum support Java version has been upgraded from Java 7 to Java + 8. + + + Procrun. The minimum Windows versions supported are now Windows 10 and + Windows Server 2016. + + + Bump commons-parent from 69 to 70. diff --git a/src/main/java/org/apache/commons/daemon/Daemon.java b/src/main/java/org/apache/commons/daemon/Daemon.java index 7c4e75e6..83572989 100644 --- a/src/main/java/org/apache/commons/daemon/Daemon.java +++ b/src/main/java/org/apache/commons/daemon/Daemon.java @@ -42,12 +42,12 @@ public interface Daemon *

* Under certain operating systems (typically Unix based operating * systems) and if the native invocation framework is configured to do - * so, this method might be called with super-user privileges. + * so, this method might be called with super-user privileges. *

*

* For example, it might be wise to create {@code ServerSocket} * instances within the scope of this method, and perform all operations - * requiring super-user privileges in the underlying operating + * requiring super-user privileges in the underlying operating * system. *

*

@@ -100,7 +100,7 @@ void stop() * Frees any resources allocated by this daemon such as file * descriptors or sockets. This method gets called by the container * after stop() has been called, before the JVM exits. The Daemon - * can not be restarted after this method has been called without a + * cannot be restarted after this method has been called without a * new call to the init() method. */ void destroy(); diff --git a/src/main/java/org/apache/commons/daemon/DaemonContext.java b/src/main/java/org/apache/commons/daemon/DaemonContext.java index 214809d2..d4dbd4ed 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonContext.java +++ b/src/main/java/org/apache/commons/daemon/DaemonContext.java @@ -17,7 +17,6 @@ package org.apache.commons.daemon; - /** * Defines a set of methods that a Daemon instance can use to * communicate with the Daemon container. @@ -36,7 +35,7 @@ public interface DaemonContext * @return An array of {@link String} arguments supplied by the environment * corresponding to the array of arguments given in the * {@code public static void main()} method used as an entry - * point to most other java programs. + * point to most other Java programs. */ String[] getArguments(); diff --git a/src/main/java/org/apache/commons/daemon/DaemonController.java b/src/main/java/org/apache/commons/daemon/DaemonController.java index e7ad580c..cae127e4 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonController.java +++ b/src/main/java/org/apache/commons/daemon/DaemonController.java @@ -17,7 +17,6 @@ package org.apache.commons.daemon; - /** * Defines methods needed by the DaemonLoader. */ @@ -55,7 +54,6 @@ void fail() * Shuts down daemon and logs failed message. * * @param message The message to log - * * @throws IllegalStateException If the daemon is not in a valid state to be * shutdown */ @@ -66,7 +64,6 @@ void fail(String message) * Shuts down daemon and logs failed message. * * @param exception The exception to log - * * @throws IllegalStateException If the daemon is not in a valid state to be * shutdown */ @@ -78,7 +75,6 @@ void fail(Exception exception) * * @param message The message to log * @param exception The exception to log - * * @throws IllegalStateException If the daemon is not in a valid state to be * shutdown */ diff --git a/src/main/java/org/apache/commons/daemon/DaemonPermission.java b/src/main/java/org/apache/commons/daemon/DaemonPermission.java index 15303311..0774ca79 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonPermission.java +++ b/src/main/java/org/apache/commons/daemon/DaemonPermission.java @@ -175,7 +175,7 @@ public final class DaemonPermission extends Permission * permission name. *

* This constructor will create a new {@code DaemonPermission} - * instance that will not grant any permission to the caller. + * instance that will not grant any permission to the caller. * * @param target The target name of this permission. * @throws IllegalArgumentException If the specified target name is not @@ -221,7 +221,7 @@ public DaemonPermission(final String target, final String actions) // Create the appropriate mask if this is a control permission. if (this.type == TYPE_CONTROL) { - this.mask = this.createControlMask(actions); + this.mask = createControlMask(actions); } } @@ -239,7 +239,7 @@ public DaemonPermission(final String target, final String actions) public String getActions() { if (this.type == TYPE_CONTROL) { - return this.createControlActions(this.mask); + return createControlActions(this.mask); } return ""; } @@ -252,14 +252,14 @@ public String getActions() @Override public int hashCode() { - this.setupDescription(); + setupDescription(); return this.desc.hashCode(); } /** * Checks if a specified object equals {@code DaemonPermission}. * - * @return true or false whether the specified object equals + * @return true or false whether the specified object equals * this {@code DaemonPermission} instance or not. */ @Override @@ -285,7 +285,7 @@ public boolean equals(final Object object) * Checks if this {@code DaemonPermission} implies another * {@code Permission}. * - * @return true or false whether the specified permission + * @return true or false whether the specified permission * is implied by this {@code DaemonPermission} instance or * not. */ @@ -317,7 +317,7 @@ public boolean implies(final Permission permission) @Override public String toString() { - this.setupDescription(); + setupDescription(); return this.desc; } @@ -346,7 +346,7 @@ private void setupDescription() break; } buf.append(':'); - buf.append(this.getActions()); + buf.append(getActions()); buf.append(']'); this.desc = buf.toString(); @@ -373,16 +373,16 @@ private int createControlMask(final String actions) MASK_CONTROL_SHUTDOWN | MASK_CONTROL_RELOAD; } if (CONTROL_START.equalsIgnoreCase(val)) { - mask = mask | MASK_CONTROL_START; + mask |= MASK_CONTROL_START; } else if (CONTROL_STOP.equalsIgnoreCase(val)) { - mask = mask | MASK_CONTROL_STOP; + mask |= MASK_CONTROL_STOP; } else if (CONTROL_SHUTDOWN.equalsIgnoreCase(val)) { - mask = mask | MASK_CONTROL_SHUTDOWN; + mask |= MASK_CONTROL_SHUTDOWN; } else if (CONTROL_RELOAD.equalsIgnoreCase(val)) { - mask = mask | MASK_CONTROL_RELOAD; + mask |= MASK_CONTROL_RELOAD; } else { throw new IllegalArgumentException("Invalid action name \"" + diff --git a/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java b/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java index de93c3da..29c70a2d 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java +++ b/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java @@ -19,7 +19,7 @@ /** * Tags a Daemon as supporting some kind of - * signalling method that allows the java application to + * signalling method that allows the Java application to * perform a custom action. *

* User must implement a signal method that will be called from diff --git a/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java b/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java index a2691e13..3dd68254 100644 --- a/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java +++ b/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java @@ -58,7 +58,6 @@ public final class DaemonConfiguration private final static String BTOKEN = "${"; private final static String ETOKEN = "}"; - private final Properties configurationProperties; private final Properties systemProperties; @@ -87,7 +86,7 @@ public boolean load(String fileName) if (fileName == null) { fileName = DEFAULT_CONFIG; } - + try (InputStream inputStream = new FileInputStream(fileName)) { configurationProperties.clear(); configurationProperties.load(inputStream); @@ -148,9 +147,7 @@ private String expandProperty(final String propValue) * Gets the configuration property. * * @param name The name of the property to get. - * * @throws ParseException if the property is wrongly formatted. - * * @return Configuration property including any expansion/replacement */ public String getProperty(final String name) @@ -174,9 +171,7 @@ public String getProperty(final String name) * daemon.arg[2] = argument 3 * * @param name The name of the property array to get. - * * @throws ParseException if the property is wrongly formatted. - * * @return Configuration property array including any expansion/replacement */ public String[] getPropertyArray(final String name) diff --git a/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java b/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java index 267bb0ec..a3234303 100644 --- a/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java +++ b/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java @@ -60,12 +60,18 @@ public static void version() System.getProperty("commons.daemon.process.parent") + ")"); } + /** + * Checks whether the given class name can be instantiated with a zero-argument constructor. + * + * @param className The class name. + * @return true if the given class name can be instantiated, false otherwise. + */ public static boolean check(final String className) { try { /* Check the class name */ Objects.requireNonNull(className, "className"); - /* Get the ClassLoader loading this class */ + /* Gets the ClassLoader loading this class */ final ClassLoader cl = DaemonLoader.class.getClassLoader(); if (cl == null) { System.err.println("Cannot retrieve ClassLoader instance"); @@ -122,7 +128,7 @@ public static boolean load(final String className, String[] args) /* Check the class name */ Objects.requireNonNull(className, "className"); - /* Get the ClassLoader loading this class */ + /* Gets the ClassLoader loading this class */ final ClassLoader cl = DaemonLoader.class.getClassLoader(); if (cl == null) { System.err.println("Cannot retrieve ClassLoader instance"); @@ -183,10 +189,10 @@ public static boolean load(final String className, String[] args) daemon = c.getConstructor().newInstance(); if (isdaemon) { - /* Create a new controller instance */ + // Create a new controller instance controller = new Controller(); - /* Set the availability flag in the controller */ + // Set the availability flag in the controller controller.setAvailable(false); /* Create context */ @@ -194,7 +200,7 @@ public static boolean load(final String className, String[] args) context.setArguments(args); context.setController(controller); - /* Now we want to call the init method in the class */ + // Now we want to call the init method in the class final Object[] arg = new Object[1]; arg[0] = context; init.invoke(daemon, arg); @@ -208,7 +214,7 @@ public static boolean load(final String className, String[] args) } catch (final InvocationTargetException e) { final Throwable thrown = e.getTargetException(); - /* DaemonInitExceptions can fail with a nicer message */ + // DaemonInitExceptions can fail with a nicer message if (thrown instanceof DaemonInitException) { failed(((DaemonInitException) thrown).getMessageWithCause()); } @@ -218,31 +224,29 @@ public static boolean load(final String className, String[] args) return false; } catch (final Throwable t) { - /* In case we encounter ANY error, we dump the stack trace and - * return false (load, start and stop won't be called). - */ + // In case we encounter ANY error, we dump the stack trace and + // return false (load, start and stop won't be called). t.printStackTrace(System.err); return false; } - /* The class was loaded and instantiated correctly, we can return */ + // The class was loaded and instantiated correctly, we can return return true; } public static boolean start() { try { - /* Attempt to start the daemon */ + // Attempt to start the daemon start.invoke(daemon); - /* Set the availability flag in the controller */ + // Set the availability flag in the controller if (controller != null) { controller.setAvailable(true); } } catch (final Throwable t) { - /* In case we encounter ANY error, we dump the stack trace and - * return false (load, start and stop won't be called). - */ + // In case we encounter ANY error, we dump the stack trace and + // return false (load, start and stop won't be called). t.printStackTrace(System.err); return false; } @@ -252,7 +256,7 @@ public static boolean start() public static boolean stop() { try { - /* Set the availability flag in the controller */ + // Set the availability flag in the controller if (controller != null) { controller.setAvailable(false); } @@ -261,9 +265,8 @@ public static boolean stop() stop.invoke(daemon); } catch (final Throwable t) { - /* In case we encounter ANY error, we dump the stack trace and - * return false (load, start and stop won't be called). - */ + // In case we encounter ANY error, we dump the stack trace and + // return false (load, start and stop won't be called). t.printStackTrace(System.err); return false; } @@ -279,9 +282,8 @@ public static boolean destroy() daemon = null; controller = null; } catch (final Throwable t) { - /* In case we encounter ANY error, we dump the stack trace and - * return false (load, start and stop won't be called). - */ + // In case we encounter ANY error, we dump the stack trace and + // return false (load, start and stop won't be called). t.printStackTrace(System.err); return false; } @@ -299,7 +301,7 @@ public static class Controller private Controller() { - this.setAvailable(false); + setAvailable(false); } private boolean isAvailable() @@ -321,10 +323,10 @@ public void shutdown() throws IllegalStateException { synchronized (this) { - if (!this.isAvailable()) { + if (!isAvailable()) { throw new IllegalStateException(); } - this.setAvailable(false); + setAvailable(false); DaemonLoader.shutdown(false); } } @@ -334,10 +336,10 @@ public void reload() throws IllegalStateException { synchronized (this) { - if (!this.isAvailable()) { + if (!isAvailable()) { throw new IllegalStateException(); } - this.setAvailable(false); + setAvailable(false); DaemonLoader.shutdown(true); } } @@ -364,7 +366,7 @@ public void fail(final Exception exception) public void fail(final String message, final Exception exception) { synchronized (this) { - this.setAvailable(false); + setAvailable(false); String msg = message; if (exception != null) { if (msg != null) { @@ -374,7 +376,7 @@ public void fail(final String message, final Exception exception) msg = exception.toString(); } } - DaemonLoader.failed(msg); + failed(msg); } } diff --git a/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java b/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java index 475aecfa..7ecc9ce2 100644 --- a/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java +++ b/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java @@ -188,7 +188,7 @@ public void stop() public void destroy() { // Nothing for the moment - System.err.println("DaemonWrapper: instance " + this.hashCode() + " destroy"); + System.err.println("DaemonWrapper: instance " + hashCode() + " destroy"); } // Internal class for wrapping the start/stop methods diff --git a/src/native/unix/configure.in b/src/native/unix/configure.in index e3eedb9e..8f01244e 100644 --- a/src/native/unix/configure.in +++ b/src/native/unix/configure.in @@ -95,9 +95,9 @@ AP_FIND_JAVA_OS() if test -z "${JAVA_OS}" then AC_MSG_RESULT([jni_md.h found in $JAVA_HOME/$JAVA_INC]) - INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/$JAVA_INC" + INCLUDES="$INCLUDES -I$JAVA_HOME/$JAVA_INC" else - INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/include/$supported_os" + INCLUDES="$INCLUDES -I$JAVA_HOME/$JAVA_INC -I$JAVA_HOME/$JAVA_INC/$JAVA_OS" fi dnl ------------------------------------------------------------------------- @@ -135,7 +135,8 @@ dnl ------------------------------------------------------------------------- dnl Random programs we need to compile locally dnl ------------------------------------------------------------------------- AP_MSG_HEADER([Writing output files]) -AC_OUTPUT(Makefile Makedefs native/Makefile) +AC_CONFIG_FILES(Makefile Makedefs native/Makefile) +AC_OUTPUT dnl ------------------------------------------------------------------------- dnl Done diff --git a/src/native/unix/man/jsvc.1.xml b/src/native/unix/man/jsvc.1.xml index a11ac19c..25dfd274 100644 --- a/src/native/unix/man/jsvc.1.xml +++ b/src/native/unix/man/jsvc.1.xml @@ -21,8 +21,8 @@ JSVC 1 - TBD - Jsvc version 1.3.5 + 2024-05-24 + Jsvc version 1.4.1 Apache Commons Daemon project diff --git a/src/native/unix/native/help.c b/src/native/unix/native/help.c index 57339e14..d8b6b5eb 100644 --- a/src/native/unix/native/help.c +++ b/src/native/unix/native/help.c @@ -124,7 +124,7 @@ void help(home_data *data) printf(" --enable-preview\n"); printf(" Java 11 --enable-preview option. Passed as it is to JVM\n"); printf("\njsvc (Apache Commons Daemon) " JSVC_VERSION_STRING "\n"); - printf("Copyright (c) 1999-2023 Apache Software Foundation.\n"); + printf("Copyright (c) 1999-2024 Apache Software Foundation.\n"); printf("\n"); } diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c index e331a0fa..6428b9dd 100644 --- a/src/native/unix/native/jsvc-unix.c +++ b/src/native/unix/native/jsvc-unix.c @@ -850,7 +850,7 @@ static int child(arg_data *args, home_data *data, uid_t uid, gid_t gid) /* Check wether we need to dump the VM version */ if (args->vers == true) { log_error("jsvc (Apache Commons Daemon) " JSVC_VERSION_STRING); - log_error("Copyright (c) 1999-2023 Apache Software Foundation."); + log_error("Copyright (c) 1999-2024 Apache Software Foundation."); if (java_version() != true) { return -1; } @@ -1308,7 +1308,7 @@ static int run_controller(arg_data *args, home_data *data, uid_t uid, gid_t gid) * These will be replaced in the child process. */ memset(&act, '\0', sizeof(act)); - act.sa_handler = controller; + act.sa_sigaction = controller; sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART | SA_NOCLDSTOP | SA_SIGINFO; diff --git a/src/native/unix/native/version.h b/src/native/unix/native/version.h index c229837b..7af2f2e7 100644 --- a/src/native/unix/native/version.h +++ b/src/native/unix/native/version.h @@ -28,10 +28,10 @@ * Minor API changes that do not cause binary compatibility problems. * Should be reset to 0 when upgrading JSVC_MAJOR_VERSION */ -#define JSVC_MINOR_VERSION 3 +#define JSVC_MINOR_VERSION 4 /** patch level */ -#define JSVC_PATCH_VERSION 5 +#define JSVC_PATCH_VERSION 1 /** * This symbol is defined for internal, "development" copies of JSVC. diff --git a/src/native/unix/support/apfunctions.m4 b/src/native/unix/support/apfunctions.m4 index e8d7ef07..c9b71506 100644 --- a/src/native/unix/support/apfunctions.m4 +++ b/src/native/unix/support/apfunctions.m4 @@ -26,7 +26,7 @@ AC_DEFUN(AP_CANONICAL_HOST_CHECK,[ test x"$ac_cv_host_system_type" != x"$host" ; } then AC_MSG_RESULT([$ac_cv_host_system_type]) - AC_MSG_ERROR([remove the \"$cache_file\" file and re-run configure]) + AC_MSG_ERROR([remove the "$cache_file" file and re-run configure]) else AC_MSG_RESULT(ok) ac_cv_host_system_type="$host" diff --git a/src/native/unix/support/apjava.m4 b/src/native/unix/support/apjava.m4 index cd92280d..921b5fb8 100644 --- a/src/native/unix/support/apjava.m4 +++ b/src/native/unix/support/apjava.m4 @@ -57,9 +57,9 @@ AC_DEFUN([AP_FIND_JAVA_OS],[ AC_ARG_WITH(os-type,[ --with-os-type[=SUBDIR] Location of JDK os-type subdirectory.], [ tempval=$withval - if test ! -d "$JAVA_HOME/$tempval" + if test ! -d "$JAVA_HOME/$JAVA_INC/$tempval" then - AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval}) + AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/$JAVA_INC/${tempval}) fi JAVA_OS=$tempval ], @@ -80,7 +80,7 @@ AC_DEFUN([AP_FIND_JAVA_OS],[ fi done if test "x$JAVA_OS" = "xNONE"; then - AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS}) + AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${JAVA_INC}/\${OS}) AC_MSG_ERROR(You should retry --with-os-type=SUBDIR) fi fi diff --git a/src/native/unix/support/apsupport.m4 b/src/native/unix/support/apsupport.m4 index c58e2a71..dbca23fb 100644 --- a/src/native/unix/support/apsupport.m4 +++ b/src/native/unix/support/apsupport.m4 @@ -185,6 +185,10 @@ AC_DEFUN(AP_SUPPORTED_HOST,[ CFLAGS="$CFLAGS -DCPU=\\\"riscv64\\\"" HOST_CPU=riscv64 ;; + loongarch64) + CFLAGS="$CFLAGS -DCPU=\\\"loongarch64\\\"" + HOST_CPU=loongarch64 + ;; *) AC_MSG_RESULT([failed]) AC_MSG_ERROR([Unsupported CPU architecture "$host_cpu"]);; diff --git a/src/native/unix/support/buildconf.sh b/src/native/unix/support/buildconf.sh index 72c4f437..eaaa1180 100755 --- a/src/native/unix/support/buildconf.sh +++ b/src/native/unix/support/buildconf.sh @@ -19,7 +19,7 @@ rm -rf autom4te.cache if test -f configure.in ; then - autoconf + autoreconf -fi if test $? -ne 0 ; then echo "$0: cannot generate configure script" else diff --git a/src/native/unix/support/config.guess b/src/native/unix/support/config.guess deleted file mode 100755 index 6b31c7f2..00000000 --- a/src/native/unix/support/config.guess +++ /dev/null @@ -1,1658 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2019 Free Software Foundation, Inc. - -timestamp='2019-04-28' - -# 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/gitweb/?p=config.git;a=blob_plain;f=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-2019 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() { - : "${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/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - set_cc_for_build - cat <<-EOF > "$dummy.c" - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" - - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl - 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". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ - echo unknown)` - case "$UNAME_MACHINE_ARCH" in - 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 ;; - 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 ;; - *: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 [ "$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 [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] - then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$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 [ -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 [ -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 [ -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 [ "$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 [ "$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 [ -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` 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 ;; - 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:*:* | riscv64: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:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - 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 [ -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 ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then - if [ "$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 - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - 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 ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-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 </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 - -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: \ No newline at end of file diff --git a/src/native/unix/support/config.sub b/src/native/unix/support/config.sub deleted file mode 100755 index 22371e67..00000000 --- a/src/native/unix/support/config.sub +++ /dev/null @@ -1,1798 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2019 Free Software Foundation, Inc. - -timestamp='2019-01-05' - -# 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/gitweb/?p=config.git;a=blob_plain;f=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-2019 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 - 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-gnu* | linux-android* | linux-dietlibc \ - | linux-newlib* | linux-musl* | linux-uclibc* | 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 - os=$maybe_os - ;; - android-linux) - basic_machine=$field1-unknown - os=linux-android - ;; - *) - basic_machine=$field1-$field2 - os=$field3 - ;; - esac - ;; - *-*) - # A lone config we happen to match not fitting any pattern - case $field1-$field2 in - decstation-3100) - basic_machine=mips-dec - 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 - 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 - os= - ;; - *) - basic_machine=$field1 - 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 - os=bsd - ;; - a29khif) - basic_machine=a29k-amd - os=udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=scout - ;; - alliant) - basic_machine=fx80-alliant - os= - ;; - altos | altos3068) - basic_machine=m68k-altos - os= - ;; - am29k) - basic_machine=a29k-none - os=bsd - ;; - amdahl) - basic_machine=580-amdahl - os=sysv - ;; - amiga) - basic_machine=m68k-unknown - os= - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=bsd - ;; - aros) - basic_machine=i386-pc - os=aros - ;; - aux) - basic_machine=m68k-apple - os=aux - ;; - balance) - basic_machine=ns32k-sequent - os=dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=linux - ;; - cegcc) - basic_machine=arm-unknown - os=cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=bsd - ;; - convex-c2) - basic_machine=c2-convex - os=bsd - ;; - convex-c32) - basic_machine=c32-convex - os=bsd - ;; - convex-c34) - basic_machine=c34-convex - os=bsd - ;; - convex-c38) - basic_machine=c38-convex - os=bsd - ;; - cray) - basic_machine=j90-cray - os=unicos - ;; - crds | unos) - basic_machine=m68k-crds - os= - ;; - da30) - basic_machine=m68k-da30 - os= - ;; - decstation | pmax | pmin | dec3100 | decstatn) - basic_machine=mips-dec - os= - ;; - delta88) - basic_machine=m88k-motorola - os=sysv3 - ;; - dicos) - basic_machine=i686-pc - os=dicos - ;; - djgpp) - basic_machine=i586-pc - os=msdosdjgpp - ;; - ebmon29k) - basic_machine=a29k-amd - os=ebmon - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=ose - ;; - gmicro) - basic_machine=tron-gmicro - os=sysv - ;; - go32) - basic_machine=i386-pc - os=go32 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=hms - ;; - harris) - basic_machine=m88k-harris - os=sysv3 - ;; - hp300) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=hpux - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=proelf - ;; - i386mach) - basic_machine=i386-mach - os=mach - ;; - vsta) - basic_machine=i386-pc - os=vsta - ;; - isi68 | isi) - basic_machine=m68k-isi - os=sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=sysv - ;; - merlin) - basic_machine=ns32k-utek - os=sysv - ;; - mingw64) - basic_machine=x86_64-pc - os=mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=mingw32ce - ;; - monitor) - basic_machine=m68k-rom68k - os=coff - ;; - morphos) - basic_machine=powerpc-unknown - os=morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=moxiebox - ;; - msdos) - basic_machine=i386-pc - os=msdos - ;; - msys) - basic_machine=i686-pc - os=msys - ;; - mvs) - basic_machine=i370-ibm - os=mvs - ;; - nacl) - basic_machine=le32-unknown - os=nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=sysv4 - ;; - netbsd386) - basic_machine=i386-pc - os=netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=newsos - ;; - news1000) - basic_machine=m68030-sony - os=newsos - ;; - necv70) - basic_machine=v70-nec - os=sysv - ;; - nh3000) - basic_machine=m68k-harris - os=cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=cxux - ;; - nindy960) - basic_machine=i960-intel - os=nindy - ;; - mon960) - basic_machine=i960-intel - os=mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=nonstopux - ;; - os400) - basic_machine=powerpc-ibm - os=os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=ose - ;; - os68k) - basic_machine=m68k-none - os=os68k - ;; - paragon) - basic_machine=i860-intel - os=osf - ;; - parisc) - basic_machine=hppa-unknown - os=linux - ;; - pw32) - basic_machine=i586-unknown - os=pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=rdos - ;; - rdos32) - basic_machine=i386-pc - os=rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=coff - ;; - sa29200) - basic_machine=a29k-amd - os=udi - ;; - sei) - basic_machine=mips-sei - os=seiux - ;; - sequent) - basic_machine=i386-sequent - os= - ;; - sps7) - basic_machine=m68k-bull - os=sysv2 - ;; - st2000) - basic_machine=m68k-tandem - os= - ;; - stratus) - basic_machine=i860-stratus - os=sysv4 - ;; - sun2) - basic_machine=m68000-sun - os= - ;; - sun2os3) - basic_machine=m68000-sun - os=sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=sunos4 - ;; - sun3) - basic_machine=m68k-sun - os= - ;; - sun3os3) - basic_machine=m68k-sun - os=sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=sunos4 - ;; - sun4) - basic_machine=sparc-sun - os= - ;; - sun4os3) - basic_machine=sparc-sun - os=sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=solaris2 - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - os= - ;; - sv1) - basic_machine=sv1-cray - os=unicos - ;; - symmetry) - basic_machine=i386-sequent - os=dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=unicos - ;; - t90) - basic_machine=t90-cray - os=unicos - ;; - toad1) - basic_machine=pdp10-xkl - os=tops20 - ;; - tpf) - basic_machine=s390x-ibm - os=tpf - ;; - udi29k) - basic_machine=a29k-amd - os=udi - ;; - ultra3) - basic_machine=a29k-nyu - os=sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=none - ;; - vaxv) - basic_machine=vax-dec - os=sysv - ;; - vms) - basic_machine=vax-dec - os=vms - ;; - vxworks960) - basic_machine=i960-wrs - os=vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=vxworks - ;; - xbox) - basic_machine=i686-pc - os=mingw32 - ;; - ymp) - basic_machine=ymp-cray - os=unicos - ;; - *) - basic_machine=$1 - 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 - os=cnk - ;; - decsystem10* | dec10*) - cpu=pdp10 - vendor=dec - os=tops10 - ;; - decsystem20* | dec20*) - cpu=pdp10 - vendor=dec - os=tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - ;; - dpx2*) - cpu=m68k - vendor=bull - os=sysv3 - ;; - encore | umax | mmax) - cpu=ns32k - vendor=encore - ;; - elxsi) - cpu=elxsi - vendor=elxsi - os=${os:-bsd} - ;; - fx2800) - cpu=i860 - vendor=alliant - ;; - genix) - cpu=ns32k - vendor=ns - ;; - h3050r* | hiux*) - cpu=hppa1.1 - vendor=hitachi - 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 - os=sysv32 - ;; - i*86v4*) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - os=sysv4 - ;; - i*86v) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - os=sysv - ;; - i*86sol2) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - os=solaris2 - ;; - j90 | j90-cray) - cpu=j90 - vendor=cray - os=${os:-unicos} - ;; - iris | iris4d) - cpu=mips - vendor=sgi - case $os in - irix*) - ;; - *) - os=irix4 - ;; - esac - ;; - miniframe) - cpu=m68000 - vendor=convergent - ;; - *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) - cpu=m68k - vendor=atari - os=mint - ;; - news-3600 | risc-news) - cpu=mips - vendor=sony - os=newsos - ;; - next | m*-next) - cpu=m68k - vendor=next - case $os in - openstep*) - ;; - nextstep*) - ;; - ns2*) - os=nextstep2 - ;; - *) - os=nextstep3 - ;; - esac - ;; - np1) - cpu=np1 - vendor=gould - ;; - op50n-* | op60c-*) - cpu=hppa1.1 - vendor=oki - os=proelf - ;; - pa-hitachi) - cpu=hppa1.1 - vendor=hitachi - 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 - os=${os:-elf} - ;; - simso-wrs) - cpu=sparclite - vendor=wrs - 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 - 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 [ x$os != x ] -then -case $os in - # First match some system type aliases that might get confused - # with valid system types. - # solaris* is a basic system type, with this one exception. - auroraux) - os=auroraux - ;; - bluegene*) - os=cnk - ;; - solaris1 | solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - solaris) - os=solaris2 - ;; - unixware*) - os=sysv4.2uw - ;; - gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # es1800 is here to avoid being matched by es* (a different OS) - es1800*) - os=ose - ;; - # Some version numbers need modification - chorusos*) - os=chorusos - ;; - isc) - os=isc2.2 - ;; - sco6) - os=sco5v6 - ;; - sco5) - os=sco3.2v5 - ;; - sco4) - os=sco3.2v4 - ;; - sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - ;; - sco3.2v[4-9]* | sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - ;; - scout) - # Don't match below - ;; - sco*) - os=sco3.2v2 - ;; - psos*) - os=psos - ;; - # Now accept the basic system types. - # The portable systems comes first. - # Each alternative MUST end in a * to match a version number. - # sysv* is not here because it comes later, after sysvr4. - gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ - | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ - | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ - | sym* | kopensolaris* | plan9* \ - | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ - | aos* | aros* | cloudabi* | sortix* \ - | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ - | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ - | knetbsd* | mirbsd* | netbsd* \ - | bitrig* | openbsd* | solidbsd* | libertybsd* \ - | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ - | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ - | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ - | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ - | chorusrdb* | cegcc* | glidix* \ - | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ - | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ - | linux-newlib* | linux-musl* | linux-uclibc* \ - | uxpv* | beos* | mpeix* | udk* | moxiebox* \ - | interix* | uwin* | mks* | rhapsody* | darwin* \ - | openstep* | oskit* | conix* | pw32* | nonstopux* \ - | storm-chaos* | tops10* | tenex* | tops20* | its* \ - | os2* | vos* | palmos* | uclinux* | nucleus* \ - | morphos* | superux* | rtmk* | windiss* \ - | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ - | skyos* | haiku* | rdos* | toppers* | drops* | es* \ - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - qnx*) - case $cpu in - x86 | i*86) - ;; - *) - os=nto-$os - ;; - esac - ;; - hiux*) - os=hiuxwe2 - ;; - nto-qnx*) - ;; - nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - sim | xray | os68k* | v88r* \ - | windows* | osx | abug | netware* | os9* \ - | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) - ;; - linux-dietlibc) - os=linux-dietlibc - ;; - linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - lynx*178) - os=lynxos178 - ;; - lynx*5) - os=lynxos5 - ;; - lynx*) - os=lynxos - ;; - mac*) - os=`echo "$os" | sed -e 's|mac|macos|'` - ;; - opened*) - os=openedition - ;; - os400*) - os=os400 - ;; - sunos5*) - os=`echo "$os" | sed -e 's|sunos5|solaris2|'` - ;; - sunos6*) - os=`echo "$os" | sed -e 's|sunos6|solaris3|'` - ;; - wince*) - os=wince - ;; - utek*) - os=bsd - ;; - dynix*) - os=bsd - ;; - acis*) - os=aos - ;; - atheos*) - os=atheos - ;; - syllable*) - os=syllable - ;; - 386bsd) - os=bsd - ;; - ctix* | uts*) - os=sysv - ;; - nova*) - os=rtmk-nova - ;; - ns2) - os=nextstep2 - ;; - nsk*) - os=nsk - ;; - # Preserve the version number of sinix5. - sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - sinix*) - os=sysv4 - ;; - tpf*) - os=tpf - ;; - triton*) - os=sysv3 - ;; - oss*) - os=sysv3 - ;; - svr4*) - os=sysv4 - ;; - svr3) - os=sysv3 - ;; - sysvr4) - os=sysv4 - ;; - # This must come after sysvr4. - sysv*) - ;; - ose*) - os=ose - ;; - *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) - os=mint - ;; - zvmoe) - os=zvmoe - ;; - dicos*) - os=dicos - ;; - pikeos*) - # Until real need of OS specific support for - # particular features comes up, bare metal - # configurations are quite functional. - case $cpu in - arm*) - os=eabi - ;; - *) - os=elf - ;; - esac - ;; - nacl*) - ;; - ios) - ;; - none) - ;; - *-eabi) - ;; - *) - echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $cpu-$vendor in - score-*) - os=elf - ;; - spu-*) - os=elf - ;; - *-acorn) - os=riscix1.2 - ;; - arm*-rebel) - os=linux - ;; - arm*-semi) - os=aout - ;; - c4x-* | tic4x-*) - os=coff - ;; - c8051-*) - os=elf - ;; - clipper-intergraph) - os=clix - ;; - hexagon-*) - os=elf - ;; - tic54x-*) - os=coff - ;; - tic55x-*) - os=coff - ;; - tic6x-*) - os=coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=tops20 - ;; - pdp11-*) - os=none - ;; - *-dec | vax-*) - os=ultrix4.2 - ;; - m68*-apollo) - os=domain - ;; - i386-sun) - os=sunos4.0.2 - ;; - m68000-sun) - os=sunos3 - ;; - m68*-cisco) - os=aout - ;; - mep-*) - os=elf - ;; - mips*-cisco) - os=elf - ;; - mips*-*) - os=elf - ;; - or32-*) - os=coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=sysv3 - ;; - sparc-* | *-sun) - os=sunos4.1.1 - ;; - pru-*) - os=elf - ;; - *-be) - os=beos - ;; - *-ibm) - os=aix - ;; - *-knuth) - os=mmixware - ;; - *-wec) - os=proelf - ;; - *-winbond) - os=proelf - ;; - *-oki) - os=proelf - ;; - *-hp) - os=hpux - ;; - *-hitachi) - os=hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=sysv - ;; - *-cbm) - os=amigaos - ;; - *-dg) - os=dgux - ;; - *-dolphin) - os=sysv3 - ;; - m68k-ccur) - os=rtu - ;; - m88k-omron*) - os=luna - ;; - *-next) - os=nextstep - ;; - *-sequent) - os=ptx - ;; - *-crds) - os=unos - ;; - *-ns) - os=genix - ;; - i370-*) - os=mvs - ;; - *-gould) - os=sysv - ;; - *-highlevel) - os=bsd - ;; - *-encore) - os=bsd - ;; - *-sgi) - os=irix - ;; - *-siemens) - os=sysv4 - ;; - *-masscomp) - os=rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=uxpv - ;; - *-rom68k) - os=coff - ;; - *-*bug) - os=coff - ;; - *-apple) - os=macos - ;; - *-atari*) - os=mint - ;; - *-wrs) - os=vxworks - ;; - *) - os=none - ;; -esac -fi - -# 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 $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 - ;; - 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-$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: \ No newline at end of file diff --git a/src/native/unix/support/install.sh b/src/native/unix/support/install.sh deleted file mode 100755 index bd238202..00000000 --- a/src/native/unix/support/install.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -## -## install.sh -- install a program, script or datafile -## -## Based on `install-sh' from the X Consortium's X11R5 distribution -## as of 89/12/18 which is freely available. -## Cleaned up for Apache's Autoconf-style Interface (APACI) -## by Ralf S. Engelschall -## -# -# This script falls under the Apache License. -# See http://www.apache.org/docs/LICENSE - - -# -# put in absolute paths if you don't have them in your path; -# or use env. vars. -# -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" - -# -# parse argument line -# -instcmd="$mvprog" -chmodcmd="" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -ext="" -src="" -dst="" -while [ "x$1" != "x" ]; do - case $1 in - -c) instcmd="$cpprog" - shift; continue - ;; - -m) chmodcmd="$chmodprog $2" - shift; shift; continue - ;; - -o) chowncmd="$chownprog $2" - shift; shift; continue - ;; - -g) chgrpcmd="$chgrpprog $2" - shift; shift; continue - ;; - -s) stripcmd="$stripprog" - shift; continue - ;; - -S) stripcmd="$stripprog $2" - shift; shift; continue - ;; - -e) ext="$2" - shift; shift; continue - ;; - *) if [ "x$src" = "x" ]; then - src=$1 - else - dst=$1 - fi - shift; continue - ;; - esac -done -if [ "x$src" = "x" ]; then - echo "install.sh: no input file specified" - exit 1 -fi -if [ "x$dst" = "x" ]; then - echo "install.sh: no destination specified" - exit 1 -fi - -# -# If destination is a directory, append the input filename; if -# your system does not like double slashes in filenames, you may -# need to add some logic -# -if [ -d $dst ]; then - dst="$dst/`basename $src`" -fi - -# Add a possible extension (such as ".exe") to src and dst -src="$src$ext" -dst="$dst$ext" - -# Make a temp file name in the proper directory. -dstdir=`dirname $dst` -dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name -$instcmd $src $dsttmp - -# And set any options; do chmod last to preserve setuid bits -if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi -if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi -if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi -if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi - -# Now rename the file to the real destination. -$rmcmd $dst -$mvcmd $dsttmp $dst - -exit 0 - diff --git a/src/native/windows/README.txt b/src/native/windows/README.txt index 014ddf2b..12cf6fe1 100644 --- a/src/native/windows/README.txt +++ b/src/native/windows/README.txt @@ -3,7 +3,11 @@ Configuring and Building Apache Commons Daemon on Windows Using Visual Studio, you can build Apache Commons Daemon. The Makefile make file has a bunch of documentation about its -options, but a trivial build is simply; +options, but a trivial build is simply: + +All builds + +Set the JAVA_HOME environment variable to point to a Java 8 (or later) SDK. Windows X64 Build @@ -17,47 +21,33 @@ Windows X64 Build Windows X86 Build + For MVS under "C:\Program Files (x86)": + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" + + For MVS under "C:\Program Files": + "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars.bat" + nmake CPU=X86 - nmake CPU=X86 PREFIX=c:\desired\path\of\daemon install - - -Release Builds -============== -We jump through some additional hoops for release builds to avoid additional -dependencies over and above those DLLs that are known to be present on every -Windows install. If you build the binaries with a recent version of Visual -Studio then it is likely the resulting binaries will have additional -dependencies. You can check this with the Depends.exe tool provided with Visual -Studio. -Release builds are build with Mladen Turk's (mturk) Custom Microsoft Compiler -Toolkit Compilation. This can be obtained from: -https://github.com/mturk/cmsc -Version: 15.0.44 +Additional configuration +======================== -Later versions of CMSC should also work. +Specifying the installation location (defaults to .\..\..\..\..\..\target which +places the binary in the correct location for a release build): -A detailed description of the full environment used for recent release builds is -provided at: -https://cwiki.apache.org/confluence/display/TOMCAT/Common+Native+Build+Environment - -The steps to produce the Windows binaries is then: - -1. cd $GIT_CLONE_DIR\src\native\windows\apps\prunmgr - -2. $CMSC_ROOT\setenv.bat x86 - -3. nmake -f Makefile - -4. cd ..\prunsrv - -5. nmake -f Makefile + nmake CPU=X86 PREFIX=c:\desired\path\of\daemon install -6. $CMCS_ROOT\setenv.bat x64 +Use the 'Hybrid CRT' technique so the resulting binaries work on a clean Windows +installation with no additional dependencies: -7. nmake -f Makefile + nmake CPU=X86 STATIC_CRT=Hybrid + + +Release Builds +============== +Release builds must use STATIC_CRT=Hybrid. It is not necessary to build a 64-bit version of prunmgr since the 32-bit version works with both 32-bit and 64-bit services. diff --git a/src/native/windows/apps/prunmgr/prunmgr.h b/src/native/windows/apps/prunmgr/prunmgr.h index 6a8a6a4e..020a1647 100644 --- a/src/native/windows/apps/prunmgr/prunmgr.h +++ b/src/native/windows/apps/prunmgr/prunmgr.h @@ -24,7 +24,7 @@ #define _PRUNMGR_H #undef PRG_VERSION -#define PRG_VERSION "1.3.5.0" +#define PRG_VERSION "1.4.1.0" #define PRG_REGROOT L"Apache Software Foundation\\Procrun 2.0" #define IDM_TM_EXIT 2000 diff --git a/src/native/windows/apps/prunmgr/prunmgr.rc b/src/native/windows/apps/prunmgr/prunmgr.rc index 3a418e9e..6b21a8e1 100644 --- a/src/native/windows/apps/prunmgr/prunmgr.rc +++ b/src/native/windows/apps/prunmgr/prunmgr.rc @@ -38,7 +38,7 @@ BEGIN ES_READONLY | WS_BORDER | WS_VSCROLL,0,31,335,115 CONTROL "BMP_COMMONS",IDC_STATIC,"Static",SS_BITMAP|0x00000040L,0,0,337,30 LTEXT " ",IDC_ABOUTAPP,2,150,270,12 - LTEXT "Copyright (c) 2000-2023 The Apache Software Foundation.",IDC_STATIC,2,160,270,12 + LTEXT "Copyright (c) 2000-2024 The Apache Software Foundation.",IDC_STATIC,2,160,270,12 LTEXT "https://commons.apache.org",IDC_STATIC,2,170,270,12 PUSHBUTTON "&System Info",IAB_SYSINF,285,170,50,14 END @@ -89,7 +89,7 @@ BEGIN EDITTEXT IDC_PPSGDISP,70,22,180,12,ES_AUTOHSCROLL LTEXT "&Description: ",IDC_STATIC,10,41,43,8 EDITTEXT IDC_PPSGDESC,70,40,180,12,ES_AUTOHSCROLL - LTEXT "Pat&h to executable:",IDC_STATIC,10,63,66,8 + LTEXT "Command used to start service:",IDC_STATIC,10,63,110,8 EDITTEXT IDC_PPSGDEXE,10,75,240,12,ES_AUTOHSCROLL | WS_DISABLED LTEXT "Startup typ&e:",IDC_STATIC,10,94,46,8 COMBOBOX IDC_PPSGCMBST,70,93,180,80,CBS_DROPDOWNLIST | WS_VSCROLL | @@ -228,9 +228,9 @@ END STRINGTABLE BEGIN IDS_APPLICATION RSTR_PSM - IDS_APPVERSION "Version 1.3.5" + IDS_APPVERSION "Version 1.4.1" IDS_APPFULLNAME RSTR_PSM " Version " PRG_VERSION - IDS_APPCOPYRIGHT "Copyright (c) 2000-2023 The Apache Software Foundation" + IDS_APPCOPYRIGHT "Copyright (c) 2000-2024 The Apache Software Foundation" IDS_APPDESCRIPTION "Apache Commons Daemon Service Management Tool" IDS_ALREAY_RUNING "An instance of '%S' application is already running" IDS_ERRORCMD "Unknown command line option '%s'\nSee the manual for command line usage." @@ -259,8 +259,8 @@ BEGIN END 1 VERSIONINFO - FILEVERSION 1,3,5,0 - PRODUCTVERSION 1,3,5,0 + FILEVERSION 1,4,1,0 + PRODUCTVERSION 1,4,1,0 FILEFLAGSMASK 0x3fL #if defined(_DEBUG) FILEFLAGS 0x03L @@ -280,7 +280,7 @@ BEGIN VALUE "FileDescription", RSTR_PSM "\0" VALUE "FileVersion", PRG_VERSION VALUE "InternalName", RSTR_PSM "\0" - VALUE "LegalCopyright", "Copyright (c) 2000-2023 The Apache Software Foundation.\0" + VALUE "LegalCopyright", "Copyright (c) 2000-2024 The Apache Software Foundation.\0" VALUE "OriginalFilename", "prunmgr.exe\0" VALUE "ProductName", RSTR_PSM "\0" VALUE "ProductVersion", PRG_VERSION diff --git a/src/native/windows/apps/prunsrv/prunsrv.c b/src/native/windows/apps/prunsrv/prunsrv.c index c4dc9901..42c030d5 100644 --- a/src/native/windows/apps/prunsrv/prunsrv.c +++ b/src/native/windows/apps/prunsrv/prunsrv.c @@ -401,7 +401,7 @@ static void printVersion(void) { fwprintf(stderr, L"Apache Commons Daemon Service Runner version %S/Win%d (%S)\n", PRG_VERSION, PRG_BITS, __DATE__); - fwprintf(stderr, L"Copyright (c) 2000-2023 The Apache Software Foundation.\n\n" + fwprintf(stderr, L"Copyright (c) 2000-2024 The Apache Software Foundation.\n\n" L"For bug reporting instructions, please see:\n" L"."); } @@ -1839,15 +1839,23 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv) if (SO_STOPTIMEOUT) { /* we have a stop timeout */ - do { + BOOL bLoopWarningIssued = FALSE; + do { /* wait 2 seconds */ - apxHandleWait(gWorker, 2000, FALSE); + DWORD rv = apxHandleWait(gWorker, 2000, FALSE); + if (rv == WAIT_OBJECT_0 && !_exe_shutdown) { + if (!bLoopWarningIssued) { + apxLogWrite(APXLOG_MARK_WARN "Start method returned before stop method was called. This should not happen. Using loop with a fixed sleep of 2 seconds waiting for stop method to be called."); + bLoopWarningIssued = TRUE; + } + Sleep(2000); + } } while (!_exe_shutdown); apxLogWrite(APXLOG_MARK_DEBUG "waiting %d sec... shutdown: %d", SO_STOPTIMEOUT, _exe_shutdown); apxHandleWait(gWorker, SO_STOPTIMEOUT*1000, FALSE); - } else { - apxHandleWait(gWorker, INFINITE, FALSE); - } + } else { + apxHandleWait(gWorker, INFINITE, FALSE); + } apxLogWrite(APXLOG_MARK_DEBUG "Worker finished."); } else { @@ -1936,6 +1944,64 @@ BOOL docmdRunService(LPAPXCMDLINE lpCmdline) return rv; } +BOOL isRunningAsAdministrator(BOOL *bElevated) { + BOOL rv = FALSE; + HANDLE hToken; + TOKEN_ELEVATION tokenInformation; + DWORD dwSize; + + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) { + goto cleanup; + } + + if (!GetTokenInformation(hToken, TokenElevation, &tokenInformation, sizeof(tokenInformation), &dwSize)) { + goto cleanup; + } + + *bElevated = tokenInformation.TokenIsElevated; + rv = TRUE; + +cleanup: + if (hToken) { + CloseHandle(hToken); + } + return rv; +} + +BOOL restartCurrentProcessWithElevation(DWORD *dwExitCode) { + BOOL rv = FALSE; + TCHAR szPath[MAX_PATH]; + SHELLEXECUTEINFO shellExecuteInfo; + + SetLastError(0); + GetModuleFileName(NULL, szPath, MAX_PATH); + if (GetLastError()) { + goto cleanup; + } + + shellExecuteInfo.cbSize = sizeof(SHELLEXECUTEINFO); + shellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS; + shellExecuteInfo.hwnd = NULL; + shellExecuteInfo.lpVerb = L"runas"; + shellExecuteInfo.lpFile = szPath; + shellExecuteInfo.lpParameters = PathGetArgs(GetCommandLine()); + shellExecuteInfo.lpDirectory = NULL; + shellExecuteInfo.nShow = SW_SHOWNORMAL; + shellExecuteInfo.hInstApp = NULL; + + if (!ShellExecuteEx(&shellExecuteInfo)) { + goto cleanup; + } + WaitForSingleObject(shellExecuteInfo.hProcess, INFINITE); + GetExitCodeProcess(shellExecuteInfo.hProcess, dwExitCode); + + rv = TRUE; + +cleanup: + return rv; +} + + static const char *gSzProc[] = { "", "parse command line arguments", @@ -2039,6 +2105,28 @@ void __cdecl main(int argc, char **argv) t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); } + + if (lpCmdline->dwCmdIndex > 2 && lpCmdline->dwCmdIndex < 8) { + /* Command requires elevation */ + BOOL bElevated; + if (!isRunningAsAdministrator(&bElevated)) { + apxDisplayError(FALSE, NULL, 0, "Unable to determine if process has administrator privileges. Continuing as if it has.\n"); + } else { + if (!bElevated) { + DWORD dwExitCode; + if (!restartCurrentProcessWithElevation(&dwExitCode)) { + apxDisplayError(FALSE, NULL, 0, "Failed to elevate current process.\n"); + rv = lpCmdline->dwCmdIndex + 2; + } else { + if (dwExitCode) { + apxDisplayError(FALSE, NULL, 0, "Running from a command prompt with administrative privileges may show further error details.\n"); + } + rv = dwExitCode; + } + goto cleanup; + } + } + } switch (lpCmdline->dwCmdIndex) { case 1: /* Run Service as console application */ if (!docmdDebugService(lpCmdline)) @@ -2048,23 +2136,23 @@ void __cdecl main(int argc, char **argv) if (!docmdRunService(lpCmdline)) rv = 4; break; - case 3: /* Start service */ + case 3: /* Start service - requires elevation */ if (!docmdStartService(lpCmdline)) rv = 5; break; - case 4: /* Stop Service */ + case 4: /* Stop Service - requires elevation */ if (!docmdStopService(lpCmdline)) rv = 6; break; - case 5: /* Update Service parameters */ + case 5: /* Update Service parameters - requires elevation */ if (!docmdUpdateService(lpCmdline)) rv = 7; break; - case 6: /* Install Service */ + case 6: /* Install Service - requires elevation */ if (!docmdInstallService(lpCmdline)) rv = 8; break; - case 7: /* Delete Service */ + case 7: /* Delete Service - requires elevation */ if (!docmdDeleteService(lpCmdline)) rv = 9; break; @@ -2095,7 +2183,7 @@ void __cdecl main(int argc, char **argv) rv, gSzProc[ix]); if (ix > 2 && !_service_mode) { /* Print something to the user console */ - apxDisplayError(FALSE, NULL, 0, "Failed to %s.", gSzProc[ix]); + apxDisplayError(FALSE, NULL, 0, "Failed to %s.\n", gSzProc[ix]); } } else diff --git a/src/native/windows/apps/prunsrv/prunsrv.h b/src/native/windows/apps/prunsrv/prunsrv.h index 127d4e71..c3ca2357 100644 --- a/src/native/windows/apps/prunsrv/prunsrv.h +++ b/src/native/windows/apps/prunsrv/prunsrv.h @@ -25,7 +25,7 @@ #define _PRUNSRV_H #undef PRG_VERSION -#define PRG_VERSION "1.3.5.0" +#define PRG_VERSION "1.4.1.0" #define PRG_REGROOT L"Apache Software Foundation\\Procrun 2.0" #endif /* _PRUNSRV_H */ diff --git a/src/native/windows/apps/prunsrv/prunsrv.manifest b/src/native/windows/apps/prunsrv/prunsrv.manifest index 204a914f..431c5d15 100644 --- a/src/native/windows/apps/prunsrv/prunsrv.manifest +++ b/src/native/windows/apps/prunsrv/prunsrv.manifest @@ -25,10 +25,6 @@ - - - - diff --git a/src/native/windows/apps/prunsrv/prunsrv.rc b/src/native/windows/apps/prunsrv/prunsrv.rc index e583edd8..c38cdd15 100644 --- a/src/native/windows/apps/prunsrv/prunsrv.rc +++ b/src/native/windows/apps/prunsrv/prunsrv.rc @@ -23,8 +23,8 @@ IDI_MAINICON ICON "../../resources/procrunw.ico" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "prunsrv.manifest" 1 VERSIONINFO - FILEVERSION 1,3,5,0 - PRODUCTVERSION 1,3,5,0 + FILEVERSION 1,4,1,0 + PRODUCTVERSION 1,4,1,0 FILEFLAGSMASK 0x3fL #if defined(_DEBUG) FILEFLAGS 0x03L @@ -44,7 +44,7 @@ BEGIN VALUE "FileDescription", RSTR_PRUNSRV "\0" VALUE "FileVersion", PRG_VERSION VALUE "InternalName", RSTR_PRUNSRV "\0" - VALUE "LegalCopyright", "Copyright (c) 2000-2023 The Apache Software Foundation.\0" + VALUE "LegalCopyright", "Copyright (c) 2000-2024 The Apache Software Foundation.\0" VALUE "OriginalFilename", "prunsrv.exe\0" VALUE "ProductName", RSTR_PRUNSRV "\0" VALUE "ProductVersion", PRG_VERSION diff --git a/src/native/windows/include/Makefile.inc b/src/native/windows/include/Makefile.inc index 007dbce4..f26913e0 100644 --- a/src/native/windows/include/Makefile.inc +++ b/src/native/windows/include/Makefile.inc @@ -28,15 +28,6 @@ # It will default to the # PROCESSOR_ARCHITECTURE/ARCHITEW6432 environment variables # or failing that it will default to X86. -# WINVER Compile for specified Windows version -# WINXP for Windows XP and up (default) -# WIN2003 for Windows 2003 and up -# VISTA for Windows Vista and up -# WIN7 for Windows 7 and up -# Deprecated targets (may not even compile): -# WINNT for Windows 2000 and up -# NT4 for Windows NT4 and up -# WIN9X for Windows 95, 98 and Me # BUILD Build version # RETAIL or RELEASE (default) # DEBUG @@ -51,6 +42,7 @@ # EXTRA_LIBS Added to the common LIBS # EXTRA_LFLAGS Added to the common LFLAGS # EXTRA_RCFLAGS Added to the common RCFLAGS +# STATIC_CRT Enables a hybrid CRT technique # # Compiler tools environment variables: # CC C compiler (defaults to cl.exe) @@ -137,27 +129,9 @@ TARGET=EXE !ENDIF !ENDIF -!IF !DEFINED(WINVER) || "$(WINVER)" == "" -WINVER=WINXP -!ENDIF - - -!IF "$(WINVER)" == "WINXP" -NMAKE_WINVER = 0x0501 -_WIN32_IE = 0x0600 -!ELSEIF "$(WINVER)" == "WIN2003" -NMAKE_WINVER = 0x0502 -_WIN32_IE = 0x0600 -!ELSEIF "$(WINVER)" == "VISTA" -NMAKE_WINVER = 0x0600 -_WIN32_IE = 0x0700 -!ELSEIF "$(WINVER)" == "WIN7" -NMAKE_WINVER = 0x0601 -_WIN32_IE = 0x0800 -!ELSE -NMAKE_WINVER = $(WINVER) -_WIN32_IE = 0x0800 -!ENDIF +WINVER=WIN10 +NMAKE_WINVER = 0x0A00 +_WIN32_IE = 0x0A00 NMAKE_WINNT = -D_WINNT -D_WIN32_WINNT=$(NMAKE_WINVER) -DWINVER=$(NMAKE_WINVER) -D_WIN32_IE=$(_WIN32_IE) @@ -203,9 +177,9 @@ MACHINE_LC=amd64 !IF "$(BUILD)" == "RELEASE" !IF "$(CPU)" == "X86" -OPT_CFLAGS = -O2 -Ob2 -Oy- -Zi -DNDEBUG +OPT_CFLAGS = -O2 -Ob2 -Oy- -Zi -DNDEBUG -guard:cf !ELSE -OPT_CFLAGS = -O2 -Ob2 -Zi -DNDEBUG +OPT_CFLAGS = -O2 -Ob2 -Zi -DNDEBUG -guard:cf !ENDIF !ELSE OPT_CFLAGS = -Od -Zi -DDEBUG -D_DEBUG @@ -234,7 +208,7 @@ CXXFLAGS = $(EXTRA_CXXFLAGS) !ENDIF # Linker section -LIBS = kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib +LIBS = kernel32.lib advapi32.lib ole32.lib shell32.lib # Extra libs from command line or env !IF DEFINED(EXTRA_LIBS) LIBS = $(LIBS) $(EXTRA_LIBS) @@ -253,7 +227,10 @@ COMMON_LFLAGS = /NOLOGO # Always add debugging to the linker OPT_LFLAGS = /INCREMENTAL:NO /DEBUG !IF "$(BUILD)" == "RELEASE" -OPT_LFLAGS = $(OPT_LFLAGS) /OPT:REF +OPT_LFLAGS = $(OPT_LFLAGS) /OPT:REF /guard:cf +!IF DEFINED(STATIC_CRT) && "$(STATIC_CRT)" == "Hybrid" +OPT_LFLAGS = $(OPT_LFLAGS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib +!ENDIF !ENDIF !IF "$(TARGET)" == "EXE" diff --git a/src/native/windows/resources/license.rtf b/src/native/windows/resources/license.rtf index ec5b4819..620bf8f6 100644 --- a/src/native/windows/resources/license.rtf +++ b/src/native/windows/resources/license.rtf @@ -15,7 +15,7 @@ {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \qc \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0\pararsid14358633 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f1\insrsid16132583\charrsid12321742 The Apache Software License, Version 2.0 \par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\f1\fs18\insrsid16132583\charrsid16132583 -\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0\pararsid9454304 {\f1\fs18\insrsid9454304 }{\f1\fs18\insrsid16132583\charrsid16132583 Copyright 2002-2023 The Apache Software Foundation. +\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0\pararsid9454304 {\f1\fs18\insrsid9454304 }{\f1\fs18\insrsid16132583\charrsid16132583 Copyright 2002-2024 The Apache Software Foundation. \par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0\pararsid1379267 {\f1\fs18\insrsid16132583\charrsid16132583 \par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583 Licensed under the Apache License, Version 2.0 (the "License"); \par }{\f1\fs18\insrsid14358633 }{\f1\fs18\insrsid16132583\charrsid16132583 you may not use this file except in compliance with the License. diff --git a/src/native/windows/src/registry.c b/src/native/windows/src/registry.c index 89ff5549..d0955e01 100644 --- a/src/native/windows/src/registry.c +++ b/src/native/windows/src/registry.c @@ -858,7 +858,7 @@ BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription, DWORD t = REG_SZ; int iServiceNameLen = lstrlenW(szServiceName); if (iServiceNameLen > SIZ_RESMAX) { - apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%s' length %d > %d", szServiceName, iServiceNameLen, SIZ_RESMAX); + apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%S' length %d > %d", szServiceName, iServiceNameLen, SIZ_RESMAX); return FALSE; } lstrcpyW(wcName, REGSERVICE_ROOT); @@ -866,7 +866,7 @@ BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription, rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, wcName, 0, KEY_READ, &hKey); if (rc != ERROR_SUCCESS) { - apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%s' cannot be opened (rc = %d)", wcName, rc); + apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%S' cannot be opened (rc = %d)", wcName, rc); return FALSE; } rc = RegQueryValueExW(hKey, REGDESCRIPTION, NULL, &t, (BYTE *)szDescription, @@ -875,7 +875,7 @@ BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription, if (rc == ERROR_SUCCESS && t == REG_SZ) return TRUE; else { - apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%s' cannot query value at '%s' (rc = %d)", wcName, REGDESCRIPTION, rc); + apxLogWrite(APXLOG_MARK_WARN "Can't read service description because registry key '%S' cannot query value at '%S' (rc = %d)", wcName, REGDESCRIPTION, rc); return FALSE; } } diff --git a/src/native/windows/src/service.c b/src/native/windows/src/service.c index d3db7d9e..82146346 100644 --- a/src/native/windows/src/service.c +++ b/src/native/windows/src/service.c @@ -156,13 +156,13 @@ apxServiceOpen(APXHANDLE hService, LPCWSTR szServiceName, DWORD dwOptions) if (!apxGetServiceDescriptionW(szServiceName, lpService->stServiceEntry.szServiceDescription, SIZ_DESLEN)) { - apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service description for '%s'", szServiceName); + apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service description for '%S'", szServiceName); lpService->stServiceEntry.szServiceDescription[0] = L'\0'; } if (!apxGetServiceUserW(szServiceName, lpService->stServiceEntry.szObjectName, SIZ_RESLEN)) { - apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service user name for '%s'", szServiceName); + apxLogWrite(APXLOG_MARK_WARN "Failed to obtain service user name for '%S'", szServiceName); lpService->stServiceEntry.szObjectName[0] = L'\0'; } if (!QueryServiceConfigW(lpService->hService, NULL, 0, &dwNeeded)) { @@ -469,7 +469,7 @@ apxServiceControl(APXHANDLE hService, DWORD dwControl, UINT uMsg, default: break; } - /* user defined controls */ + /* user-defined controls */ if (dwControl > 127 && dwControl < 224) { /* 128 ... 159 start signals * 160 ... 191 stop signals diff --git a/src/samples/AloneService.java b/src/samples/AloneService.java index 71dc5af9..bf248a23 100644 --- a/src/samples/AloneService.java +++ b/src/samples/AloneService.java @@ -15,7 +15,6 @@ * limitations under the License. */ - import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.PrintStream; @@ -27,10 +26,10 @@ */ public class AloneService { - private Properties prop = null; - private Process proc[] = null; - private ServiceDaemonReadThread readout[] = null; - private ServiceDaemonReadThread readerr[] = null; + private Properties prop; + private Process[] proc = null; + private ServiceDaemonReadThread[] readout = null; + private ServiceDaemonReadThread[] readerr = null; @Override protected void finalize() { @@ -42,16 +41,15 @@ protected void finalize() { * init and destroy were added in jakarta-tomcat-daemon. * * @param arguments Unused - * * @throws Exception If the daemon cannot be initialized */ public void init(String[] arguments) throws Exception { - /* Set the err */ - System.setErr(new PrintStream(new FileOutputStream("/ServiceDaemon.err",true))); + // Set the err + System.setErr(new PrintStream(new FileOutputStream("/ServiceDaemon.err", true))); System.err.println("ServiceDaemon: instance "+this.hashCode()+ " init"); - /* read the properties file */ + // read the properties file prop = new Properties(); try { prop.load(new FileInputStream("startfile")); @@ -76,10 +74,10 @@ public void init(String[] arguments) throws Exception { } public void start() { - /* Dump a message */ + // Dump a message System.err.println("ServiceDaemon: starting"); - /* Start */ + // Start int i=0; for (Enumeration e = prop.keys(); e.hasMoreElements() ;) { String name = (String) e.nextElement(); @@ -89,7 +87,7 @@ public void start() { } catch (Exception ex) { System.err.println("Exception: " + ex); } - /* Start threads to read from Error and Out streams */ + // Start threads to read from Error and Out streams readerr[i] = new ServiceDaemonReadThread(proc[i].getErrorStream()); readout[i] = @@ -101,7 +99,7 @@ public void start() { } public void stop() { - /* Dump a message */ + // Dump a message System.err.println("ServiceDaemon: stopping"); for (int i=0;i * Use the main() method for running as a Java (external) service. - * Use the start() and stop() methods for running as a jvm (in-process) service + * Use the start() and stop() methods for running as a JVM (in-process) service */ public class ProcrunService implements Runnable { @@ -58,9 +57,9 @@ private ProcrunService(long wait, File file) { stopFile = file; } - private static File tmpFile(String filename) { + private static File tmpFile(String fileName) { return new File(System.getProperty("java.io.tmpdir"), - filename != null ? filename : "ProcrunService.tmp"); + fileName != null ? fileName : "ProcrunService.tmp"); } private static void usage(){ @@ -171,7 +170,7 @@ public static void main(String[] args) throws IOException { } /** - * Start the jvm version of the service, and waits for it to complete. + * Start the JVM version of the service, and waits for it to complete. * * @param args optional, arg[0] = timeout (seconds) */ @@ -191,8 +190,8 @@ private static void startThread(String waitParam, File file) { if (waitParam != null) { wait = Integer.valueOf(waitParam).intValue(); } - log("Starting the thread, wait(seconds): "+wait); - thrd = new Thread(new ProcrunService(wait*MS_PER_SEC,file)); + log("Starting the thread, wait(seconds): " + wait); + thrd = new Thread(new ProcrunService(wait * MS_PER_SEC, file)); thrd.start(); } diff --git a/src/samples/ServiceDaemon.java b/src/samples/ServiceDaemon.java index d6905212..e5bc9e30 100644 --- a/src/samples/ServiceDaemon.java +++ b/src/samples/ServiceDaemon.java @@ -28,10 +28,10 @@ public class ServiceDaemon implements Daemon { - private Properties prop = null; - private Process proc[] = null; - private ServiceDaemonReadThread readout[] = null; - private ServiceDaemonReadThread readerr[] = null; + private Properties prop; + private Process[] proc = null; + private ServiceDaemonReadThread[] readout = null; + private ServiceDaemonReadThread[] readerr = null; public ServiceDaemon() { super(); @@ -51,21 +51,21 @@ protected void finalize() { @Override public void init(DaemonContext context) throws Exception { - /* Set the err */ - System.setErr(new PrintStream(new FileOutputStream(new File("ServiceDaemon.err")),true)); + // Set the err + System.setErr(new PrintStream(new FileOutputStream(new File("ServiceDaemon.err")), true)); System.err.println("ServiceDaemon: instance "+this.hashCode()+ " init"); - /* read the properties file */ + // read the properties file prop = new Properties(); try { prop.load(new FileInputStream("startfile")); } catch (Exception e) { // Cannot find startfile.properties. - // XXX: Should we print something? + // TODO: Should we print something? } - /* create an array to store the processes */ + // create an array to store the processes int processCount = prop.size(); System.err.println("ServiceDaemon: init for " + processCount + " processes"); proc = new Process[processCount]; @@ -82,10 +82,10 @@ public void init(DaemonContext context) @Override public void start() { - /* Dump a message */ + // Dump a message System.err.println("ServiceDaemon: starting"); - /* Start */ + // Start int i=0; for (Enumeration e = prop.keys(); e.hasMoreElements() ;) { String name = (String) e.nextElement(); @@ -95,7 +95,7 @@ public void start() { } catch (Exception ex) { System.err.println("Exception: " + ex); } - /* Start threads to read from Error and Out streams */ + // Start threads to read from Error and Out streams readerr[i] = new ServiceDaemonReadThread(proc[i].getErrorStream()); readout[i] = @@ -109,7 +109,7 @@ public void start() { @Override public void stop() throws IOException, InterruptedException { - /* Dump a message */ + // Dump a message System.err.println("ServiceDaemon: stopping"); for (int i=0;i openhandlers = this.handlers.elements(); while (openhandlers.hasMoreElements()) { Handler handler = openhandlers.nextElement(); @@ -198,18 +197,16 @@ public Handler(Socket s, SimpleApplication p) { @Override public void run() { this.parent.addHandler(this); - System.err.println("SimpleApplication: connection "+this.number+ - " opened from "+this.socket.getInetAddress()); + System.err.println("SimpleApplication: connection " + this.number + " opened from " + this.socket.getInetAddress()); try { - InputStream in=this.socket.getInputStream(); - OutputStream out=this.socket.getOutputStream(); - handle(in,out); + InputStream in = this.socket.getInputStream(); + OutputStream out = this.socket.getOutputStream(); + handle(in, out); this.socket.close(); } catch (IOException e) { e.printStackTrace(System.err); } - System.err.println("SimpleApplication: connection "+this.number+ - " closed"); + System.err.println("SimpleApplication: connection " + this.number + " closed"); this.parent.removeHandler(this); } @@ -237,11 +234,10 @@ public String getDirectoryName() { return(this.directory); } - public void createFile(String name) - throws IOException { - OutputStream file=new FileOutputStream(name,true); - PrintStream out=new PrintStream(file); - SimpleDateFormat fmt=new SimpleDateFormat(); + public void createFile(String name) throws IOException { + OutputStream file = new FileOutputStream(name, true); + PrintStream out = new PrintStream(file); + SimpleDateFormat fmt = new SimpleDateFormat(); out.println(fmt.format(new Date())); out.close(); @@ -252,24 +248,24 @@ public void createDir(String name) throws IOException { File file = new File(name); boolean ok = file.mkdirs(); - if(! ok) + if (!ok) throw new IOException("mkdirs for "+name+" failed"); createFile(name); } public void handle(InputStream in, OutputStream os) { - PrintStream out=null; + PrintStream out = null; try { - out=new PrintStream(os, true, "US-ASCII"); + out = new PrintStream(os, true, StandardCharsets.US_ASCII.name()); } catch (UnsupportedEncodingException ex) { - out=new PrintStream(os, true); + out = new PrintStream(os, true); } - while(true) { + while (true) { try { - /* If we don't have data in the System InputStream, we want - to ask to the user for an option. */ - if (in.available()==0) { + // If we don't have data in the System InputStream, we want + // to ask to the user for an option. + if (in.available() == 0) { out.println(); out.println("Please select one of the following:"); out.println(" 1) Shutdown"); @@ -280,84 +276,74 @@ public void handle(InputStream in, OutputStream os) { out.print("Your choice: "); } - /* Read an option from the client */ - int x=in.read(); + // Read an option from the client + int x = in.read(); switch (x) { - /* If the socket was closed, we simply return */ - case -1: - return; - - /* Attempt to shutdown */ - case '1': - out.println("Attempting a shutdown..."); - try { - System.exit(0); - } catch (IllegalStateException e) { - out.println(); - out.println("Can't shutdown now"); - e.printStackTrace(out); - } - break; - - /* Create a file */ - case '2': - String name=this.getDirectoryName()+ - "/SimpleApplication."+ - this.getConnectionNumber()+ - ".tmp"; - try { - this.createFile(name); - out.println("File '"+name+"' created"); - } catch (IOException e) { - e.printStackTrace(out); - } - break; - - /* Disconnect */ - case '3': - out.println("Disconnecting..."); - return; - - /* Crash JVM in a native call: It need an so file ;-) */ - case '4': - System.load(System.getProperty("native.library", "./Native.so")); - toto(); - break; - - /* Create a directory (PR 30177 with 1.4.x and 1.5.0 */ - case '5': - String name1=this.getDirectoryName()+ - "/a/b/c/d/e"+ - "/SimpleApplication."+ - this.getConnectionNumber()+ - ".tmp"; - try { - this.createDir(name1); - out.println("File '"+name1+"' created"); - } catch (IOException e) { - e.printStackTrace(out); - } - break; - - - /* Discard any carriage return / newline characters */ - case '\r': - case '\n': - break; - - /* We got something that we weren't supposed to get */ - default: - out.println("Unknown option '"+(char)x+"'"); - break; + // If the socket was closed, we simply return + case -1: + return; + + // Attempt to shutdown + case '1': + out.println("Attempting a shutdown..."); + try { + System.exit(0); + } catch (IllegalStateException e) { + out.println(); + out.println("Can't shutdown now"); + e.printStackTrace(out); + } + break; + + // Create a file + case '2': + String name = this.getDirectoryName() + "/SimpleApplication." + this.getConnectionNumber() + ".tmp"; + try { + this.createFile(name); + out.println("File '" + name + "' created"); + } catch (IOException e) { + e.printStackTrace(out); + } + break; + + // Disconnect + case '3': + out.println("Disconnecting..."); + return; + + // Crash JVM in a native call: It need an so file ;-) + case '4': + System.load(System.getProperty("native.library", "./Native.so")); + toto(); + break; + + // Create a directory (PR 30177 with 1.4.x and 1.5.0 + case '5': + String name1 = this.getDirectoryName() + "/a/b/c/d/e" + "/SimpleApplication." + this.getConnectionNumber() + ".tmp"; + try { + this.createDir(name1); + out.println("File '" + name1 + "' created"); + } catch (IOException e) { + e.printStackTrace(out); + } + break; + + // Discard any carriage return / newline characters + case '\r': + case '\n': + break; + + // We got something that we weren't supposed to get + default: + out.println("Unknown option '" + (char) x + "'"); + break; } - /* If we get an IOException we return (disconnect) */ + // If we get an IOException we return (disconnect) } catch (IOException e) { - System.err.println("SimpleApplication: IOException in "+ - "connection "+ - this.getConnectionNumber()); + System.err.println("SimpleApplication: IOException in " + "connection " + this.getConnectionNumber()); return; } } diff --git a/src/samples/SimpleApplication.sh b/src/samples/SimpleApplication.sh index 385ed031..cf696cc3 100755 --- a/src/samples/SimpleApplication.sh +++ b/src/samples/SimpleApplication.sh @@ -20,7 +20,7 @@ # Adapt the following lines to your configuration JAVA_HOME=/opt/java6 PROGRAM=SimpleApplication -CLASSPATH=`pwd`/$PROGRAM.jar:`pwd`/commons-daemon-1.3.5.jar +CLASSPATH=`pwd`/$PROGRAM.jar:`pwd`/commons-daemon-1.4.1.jar case "$1" in start ) diff --git a/src/samples/SimpleDaemon.java b/src/samples/SimpleDaemon.java index 2727e4f6..cec9b2d1 100644 --- a/src/samples/SimpleDaemon.java +++ b/src/samples/SimpleDaemon.java @@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException; import java.net.ServerSocket; import java.net.Socket; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Enumeration; @@ -36,11 +37,11 @@ public class SimpleDaemon implements Daemon, Runnable { - private ServerSocket server=null; - private Thread thread=null; - private DaemonController controller=null; - private volatile boolean stopping=false; - private String directory=null; + private ServerSocket server; + private Thread thread; + private DaemonController controller; + private volatile boolean stopping; + private String directory; private final Vector handlers; public static native void toto(); @@ -63,52 +64,52 @@ protected void finalize() { */ @Override public void init(DaemonContext context) - throws Exception { - System.err.println("SimpleDaemon: instance "+this.hashCode()+ - " init"); + throws Exception { + System.err.println("SimpleDaemon: instance " + this.hashCode() + " init"); - int port=1200; + int port = 1200; String[] a = context.getArguments(); try { - if ( a.length > 0) - port=Integer.parseInt(a[0]); - } - catch (NumberFormatException ex) { + if (a.length > 0) + port = Integer.parseInt(a[0]); + } catch (NumberFormatException ex) { throw new DaemonInitException("parsing port", ex); } - if (a.length>1) this.directory=a[1]; - else this.directory="/tmp"; - - /* Dump a message */ - System.err.println("SimpleDaemon: loading on port "+port); - - /* Set up this simple daemon */ - this.controller=context.getController(); - this.server=new ServerSocket(port); - this.thread=new Thread(this); + if (a.length > 1) + this.directory = a[1]; + else + this.directory = "/tmp"; + + // Dump a message + System.err.println("SimpleDaemon: loading on port " + port); + + // Set up this simple daemon + this.controller = context.getController(); + this.server = new ServerSocket(port); + this.thread = new Thread(this); } @Override public void start() { - /* Dump a message */ + // Dump a message System.err.println("SimpleDaemon: starting"); - /* Start */ + // Start this.thread.start(); } @Override public void stop() throws IOException, InterruptedException { - /* Dump a message */ + // Dump a message System.err.println("SimpleDaemon: stopping"); - /* Close the ServerSocket. This will make our thread to terminate */ - this.stopping=true; + // Close the ServerSocket. This will make our thread to terminate + this.stopping = true; this.server.close(); - /* Wait for the main thread to exit and dump a message */ + // Wait for the main thread to exit and dump a message this.thread.join(5000); System.err.println("SimpleDaemon: stopped"); } @@ -125,20 +126,20 @@ public void run() { System.err.println("SimpleDaemon: started acceptor loop"); try { - while(!this.stopping) { - Socket socket=this.server.accept(); - Handler handler=new Handler(socket,this,this.controller); + while (!this.stopping) { + Socket socket = this.server.accept(); + Handler handler = new Handler(socket, this, this.controller); handler.setConnectionNumber(number++); handler.setDirectoryName(this.directory); new Thread(handler).start(); } } catch (IOException e) { - /* Don't dump any error message if we are stopping. A IOException - is generated when the ServerSocket is closed in stop() */ + // Don't dump any error message if we are stopping. A IOException + // is generated when the ServerSocket is closed in stop() if (!this.stopping) e.printStackTrace(System.err); } - /* Terminate all handlers that at this point are still open */ + // Terminate all handlers that at this point are still open Enumeration openhandlers = this.handlers.elements(); while (openhandlers.hasMoreElements()) { Handler handler = openhandlers.nextElement(); @@ -166,32 +167,30 @@ public static class Handler implements Runnable { private final DaemonController controller; private final SimpleDaemon parent; - private String directory=null; // Only set before thread is started + private String directory; // Only set before thread is started private final Socket socket; - private int number=0; // Only set before thread is started + private int number; // Only set before thread is started public Handler(Socket s, SimpleDaemon p, DaemonController c) { super(); - this.socket=s; - this.parent=p; - this.controller=c; + this.socket = s; + this.parent = p; + this.controller = c; } @Override public void run() { this.parent.addHandler(this); - System.err.println("SimpleDaemon: connection "+this.number+ - " opened from "+this.socket.getInetAddress()); + System.err.println("SimpleDaemon: connection " + this.number + " opened from " + this.socket.getInetAddress()); try { - InputStream in=this.socket.getInputStream(); - OutputStream out=this.socket.getOutputStream(); - handle(in,out); + InputStream in = this.socket.getInputStream(); + OutputStream out = this.socket.getOutputStream(); + handle(in, out); this.socket.close(); } catch (IOException e) { e.printStackTrace(System.err); } - System.err.println("SimpleDaemon: connection "+this.number+ - " closed"); + System.err.println("SimpleDaemon: connection " + this.number + " closed"); this.parent.removeHandler(this); } @@ -212,18 +211,17 @@ public int getConnectionNumber() { } public void setDirectoryName(String directory) { - this.directory=directory; + this.directory = directory; } public String getDirectoryName() { return(this.directory); } - public void createFile(String name) - throws IOException { - OutputStream file=new FileOutputStream(name,true); - PrintStream out=new PrintStream(file); - SimpleDateFormat fmt=new SimpleDateFormat(); + public void createFile(String name) throws IOException { + OutputStream file = new FileOutputStream(name, true); + PrintStream out = new PrintStream(file); + SimpleDateFormat fmt = new SimpleDateFormat(); out.println(fmt.format(new Date())); out.close(); @@ -234,24 +232,24 @@ public void createDir(String name) throws IOException { File file = new File(name); boolean ok = file.mkdirs(); - if(! ok) + if (!ok) throw new IOException("mkdirs for "+name+" failed"); createFile(name); } public void handle(InputStream in, OutputStream os) { - PrintStream out=null; + PrintStream out = null; try { - out=new PrintStream(os, true, "US-ASCII"); + out = new PrintStream(os, true, StandardCharsets.US_ASCII.name()); } catch (UnsupportedEncodingException ex) { - out=new PrintStream(os, true); + out = new PrintStream(os, true); } while(true) { try { - /* If we don't have data in the System InputStream, we want - to ask to the user for an option. */ - if (in.available()==0) { + // If we don't have data in the System InputStream, we want + // to ask to the user for an option. + if (in.available() == 0) { out.println(); out.println("Please select one of the following:"); out.println(" 1) Shutdown"); @@ -263,15 +261,15 @@ public void handle(InputStream in, OutputStream os) { out.print("Your choice: "); } - /* Read an option from the client */ - int x=in.read(); + // Read an option from the client + int x = in.read(); switch (x) { - /* If the socket was closed, we simply return */ + // If the socket was closed, we simply return case -1: return; - /* Attempt to shutdown */ + // Attempt to shutdown case '1': out.println("Attempting a shutdown..."); try { @@ -283,7 +281,7 @@ public void handle(InputStream in, OutputStream os) { } break; - /* Attempt to reload */ + // Attempt to reload case '2': out.println("Attempting a reload..."); try { @@ -295,7 +293,7 @@ public void handle(InputStream in, OutputStream os) { } break; - /* Create a file */ + // Create a file case '3': String name=this.getDirectoryName()+ "/SimpleDaemon."+ @@ -309,18 +307,18 @@ public void handle(InputStream in, OutputStream os) { } break; - /* Disconnect */ + // Disconnect case '4': out.println("Disconnecting..."); return; - /* Crash JVM in a native call: It need an so file ;-) */ + // Crash JVM in a native call: It need an so file ;-) case '5': System.load(System.getProperty("native.library", "./Native.so")); toto(); break; - /* Create a directory (PR 30177 with 1.4.x and 1.5.0 */ + // Create a directory (PR 30177 with 1.4.x and 1.5.0 case '6': String name1=this.getDirectoryName()+ "/a/b/c/d/e"+ @@ -335,20 +333,19 @@ public void handle(InputStream in, OutputStream os) { } break; - - /* Discard any carriage return / newline characters */ + // Discard any carriage return / newline characters case '\r': case '\n': break; - /* We got something that we weren't supposed to get */ + // We got something that we weren't supposed to get default: out.println("Unknown option '"+(char)x+"'"); break; } - /* If we get an IOException we return (disconnect) */ + // If we get an IOException we return (disconnect) } catch (IOException e) { System.err.println("SimpleDaemon: IOException in "+ "connection "+ diff --git a/src/site/xdoc/binaries.xml b/src/site/xdoc/binaries.xml index 1f2bda0e..fb38e918 100644 --- a/src/site/xdoc/binaries.xml +++ b/src/site/xdoc/binaries.xml @@ -27,7 +27,7 @@

In the directory -binaries +binaries you will find subdirectories containing archives corresponding to your operating system. Only the Windows builds are provided as a zip file.

@@ -36,7 +36,7 @@ corresponding to your operating system. Only the Windows builds are provided as

-The Windows archive (e.g. commons-daemon-1.3.5-bin-windows.zip) contains 2 different executables: +The Windows archive (e.g. commons-daemon-1.4.1-bin-windows.zip) contains 2 different executables:

  • prunsrv.exe - service application for running applications as services.
  • prunmgr.exe - the GUI manager application used to monitor and configure installed services.
  • diff --git a/src/site/xdoc/download_daemon.xml b/src/site/xdoc/download_daemon.xml index 2432fbc9..27c2e9c4 100644 --- a/src/site/xdoc/download_daemon.xml +++ b/src/site/xdoc/download_daemon.xml @@ -107,38 +107,38 @@ limitations under the License. failing that using the SHA512 hash (*.sha512 checksum files).

    - The KEYS + The KEYS file contains the public PGP keys used by Apache Commons developers to sign releases.

-
+
- - - + + + - - - + + +
commons-daemon-1.3.4-bin.tar.gzsha512pgpcommons-daemon-1.4.0-bin.tar.gzsha512pgp
commons-daemon-1.3.4-bin.zipsha512pgpcommons-daemon-1.4.0-bin.zipsha512pgp
- - - + + + - - - + + +
commons-daemon-1.3.4-src.tar.gzsha512pgpcommons-daemon-1.4.0-src.tar.gzsha512pgp
commons-daemon-1.3.4-src.zipsha512pgpcommons-daemon-1.4.0-src.zipsha512pgp
diff --git a/src/site/xdoc/issue-tracking.xml b/src/site/xdoc/issue-tracking.xml index 9debeb80..463de375 100644 --- a/src/site/xdoc/issue-tracking.xml +++ b/src/site/xdoc/issue-tracking.xml @@ -85,7 +85,7 @@ limitations under the License.

- For more information on subversion and creating patches see the + For more information on creating patches see the Apache Contributors Guide.

diff --git a/src/site/xdoc/mail-lists.xml b/src/site/xdoc/mail-lists.xml index a6b61019..9992469f 100644 --- a/src/site/xdoc/mail-lists.xml +++ b/src/site/xdoc/mail-lists.xml @@ -59,9 +59,9 @@ limitations under the License.

Questions related to the usage of Apache Commons Daemon should be posted to the - User List. + User List.
- The Developer List + The Developer List is for questions and discussion related to the development of Apache Commons Daemon.
Please do not cross-post; developers are also subscribed to the user list. @@ -70,8 +70,10 @@ limitations under the License. to subscribe.

- Note: please don't send patches or attachments to any of the mailing lists. + Note: please don't send patches or attachments to any of the mailing lists; + most of the lists are set up to drop attachments. Patches are best handled via the Issue Tracking system. + If you have a GitHub account, most components also accept PRs (pull requests). Otherwise, please upload the file to a public server and include the URL in the mail.

@@ -105,12 +107,11 @@ limitations under the License. Subscribe Unsubscribe Post - mail-archives.apache.org
+ lists.apache.org - markmail.org
- www.mail-archive.com
- news.gmane.org + + www.mail-archive.com @@ -125,12 +126,11 @@ limitations under the License. Subscribe Unsubscribe Post - mail-archives.apache.org
+ lists.apache.org - markmail.org
- www.mail-archive.com
- news.gmane.org + + www.mail-archive.com @@ -145,10 +145,10 @@ limitations under the License. Subscribe Unsubscribe read only - mail-archives.apache.org
+ lists.apache.org - markmail.org
+ www.mail-archive.com @@ -164,10 +164,10 @@ limitations under the License. Subscribe Unsubscribe read only - mail-archives.apache.org
+ lists.apache.org - markmail.org
+ www.mail-archive.com @@ -199,13 +199,11 @@ limitations under the License. Subscribe Unsubscribe read only - mail-archives.apache.org
+ lists.apache.org - markmail.org
- old.nabble.com
- www.mail-archive.com
- news.gmane.org + + www.mail-archive.com diff --git a/src/test/java/org/apache/commons/daemon/DaemonInitExceptionTest.java b/src/test/java/org/apache/commons/daemon/DaemonInitExceptionTest.java index 6e86b4fb..04c9393a 100644 --- a/src/test/java/org/apache/commons/daemon/DaemonInitExceptionTest.java +++ b/src/test/java/org/apache/commons/daemon/DaemonInitExceptionTest.java @@ -27,7 +27,7 @@ public class DaemonInitExceptionTest { @Test public void test() { - final IOException e = new IOException(); + final IOException e = new IOException(); assertEquals(e, new DaemonInitException("Test", e).getCause()); } diff --git a/src/test/java/org/apache/commons/daemon/SimpleDaemon.java b/src/test/java/org/apache/commons/daemon/SimpleDaemon.java index 0740a1de..a815e942 100644 --- a/src/test/java/org/apache/commons/daemon/SimpleDaemon.java +++ b/src/test/java/org/apache/commons/daemon/SimpleDaemon.java @@ -35,13 +35,13 @@ public class SimpleDaemon implements Daemon, Runnable, DaemonUserSignal { private boolean softReloadSignalled; public SimpleDaemon() { - System.err.println("SimpleDaemon: instance " + this.hashCode() + " created"); + System.err.println("SimpleDaemon: instance " + hashCode() + " created"); this.handlers = new Vector<>(); } @Override protected void finalize() { - System.err.println("SimpleDaemon: instance " + this.hashCode() + " garbage collected"); + System.err.println("SimpleDaemon: instance " + hashCode() + " garbage collected"); } /** @@ -49,7 +49,7 @@ protected void finalize() { */ @Override public void init(final DaemonContext context) throws Exception { - System.err.println("SimpleDaemon: instance " + this.hashCode() + " init"); + System.err.println("SimpleDaemon: instance " + hashCode() + " init"); int port = 1200; @@ -64,10 +64,10 @@ public void init(final DaemonContext context) throws Exception { this.directory = "/tmp"; } - /* Dump a message */ + // Dump a message System.err.println("SimpleDaemon: loading on port " + port); - /* Set up this simple daemon */ + // Set up this simple daemon this.controller = context.getController(); this.server = new ServerSocket(port); this.thread = new Thread(this); @@ -75,30 +75,30 @@ public void init(final DaemonContext context) throws Exception { @Override public void start() { - /* Dump a message */ + // Dump a message System.err.println("SimpleDaemon: starting"); - /* Start */ + // Start this.thread.start(); } @Override public void stop() throws IOException, InterruptedException { - /* Dump a message */ + // Dump a message System.err.println("SimpleDaemon: stopping"); - /* Close the ServerSocket. This will make our thread to terminate */ + // Close the ServerSocket. This will make our thread to terminate this.stopping = true; this.server.close(); - /* Wait for the main thread to exit and dump a message */ + // Wait for the main thread to exit and dump a message this.thread.join(5000); System.err.println("SimpleDaemon: stopped"); } @Override public void destroy() { - System.err.println("SimpleDaemon: instance " + this.hashCode() + " destroy"); + System.err.println("SimpleDaemon: instance " + hashCode() + " destroy"); } @Override @@ -118,15 +118,15 @@ public void run() { new Thread(handler).start(); } } catch (final IOException e) { - /* - * Don't dump any error message if we are stopping. A IOException is generated when the ServerSocket is closed in stop() - */ + // + // Don't dump any error message if we are stopping. A IOException is generated when the ServerSocket is closed in stop() + // if (!this.stopping) { e.printStackTrace(System.err); } } - /* Terminate all handlers that at this point are still open */ + // Terminate all handlers that at this point are still open final Enumeration openhandlers = this.handlers.elements(); while (openhandlers.hasMoreElements()) { final Handler handler = openhandlers.nextElement(); @@ -139,9 +139,9 @@ public void run() { @Override public void signal() { - /* - * In this example we are using soft reload on custom signal. - */ + // + // In this example we are using soft reload on custom signal. + // this.softReloadSignalled = true; } @@ -282,9 +282,9 @@ public void handle(final InputStream in, final OutputStream os) { /* Disconnect */ case '3': - final String name = this.getDirectoryName() + "/SimpleDaemon." + this.getConnectionNumber() + ".tmp"; + final String name = getDirectoryName() + "/SimpleDaemon." + getConnectionNumber() + ".tmp"; try { - this.log(name); + log(name); out.println("File '" + name + "' created"); } catch (final IOException e) { e.printStackTrace(out); @@ -314,7 +314,7 @@ public void handle(final InputStream in, final OutputStream os) { /* If we get an IOException we return (disconnect) */ } catch (final IOException e) { - System.err.println("SimpleDaemon: IOException in " + "connection " + this.getConnectionNumber()); + System.err.println("SimpleDaemon: IOException in " + "connection " + getConnectionNumber()); return; } }