commons-daemon-1.0.15-src/build.properties.sample 100664 25140 25140 2036 11340636672 21534 0 ustar mturk mturk 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.
# The directory containing your binary distribution of JUnit,
# version 3.7 or later
junit.home = /usr/local/junit3.7
# The pathname of the "junit.jar" JAR file
junit.jar = ${junit.home}/junit.jar
# Proxy
# proxy
maven.proxy.host = proxy.domain
maven.proxy.port = 80
commons-daemon-1.0.15-src/README 100664 25140 25140 2546 11622261100 15704 0 ustar mturk mturk 0 0 To build the JAVA part:
ant dist
The Java portion of Commons Daemon requires Java 1.3 or later to build
To build the native parts:
1 - jsvc:
jsvc is only for Un*x systems
cd src/native/unix; configure; make
You need a gnu make.
The jsvc executable is created in the dist directory.
There is a INSTALL.txt in src/native/unix - please have a look at it.
2 - procrun:
procrun is only for windows
cd src\native\windows\apps
cd prunsrv
nmake [CPU=(X86|X64|I64)]
cd ..\prunmgr
nmake [CPU=(X86|X64|I64)]
(It is also possible to use the MS development tools).
See also the README files in src\native\windows
To build the documentation: (See http://commons.apache.org/building.html).
mvn site:generate
(Do not forget to get ../commons-build: (cd ..; svn co http://svn.apache.org/repos/asf/commons/proper/commons-build/trunk/ commons-build))
To deploy the documentation to the apache site:
mvn -Dmaven.username=${user.name} site:deploy
To deploy the Java jars to the Nexus staging repo:
mvn clean
mvn deploy -Prelease [-Ptest-deploy]
The test-deploy profile will deploy to target/deploy; omit for the live deploy
Note: do not use clean in the same invocation.
Not sure why, but with Commons-Parent v21 this results deploying the non-Maven archives (zip and tar.gz) as well.
They can be deleted before closing the repo, but it is easier not to create them. commons-daemon-1.0.15-src/pom.xml 100664 25140 25140 10375 12125035131 16362 0 ustar mturk mturk 0 0
org.apache.commonscommons-parent234.0.0commons-daemoncommons-daemon1.0.15Commons Daemon2002
Apache Commons Daemon software provides an alternative invocation mechanism for unix-daemon-like Java code.
http://commons.apache.org/daemon/jirahttp://issues.apache.org/jira/browse/DAEMONscm:svn:http://svn.apache.org/repos/asf/commons/proper/daemon/trunkscm:svn:https://svn.apache.org/repos/asf/commons/proper/daemon/trunkhttp://svn.apache.org/viewvc/commons/proper/daemon/trunkJean-Frederic Clerejfclerejfclere at apache.orgRemy Maucheratremmremm at apache.orgYoav Shapirayoavsyoavs at apache.orgBill Barkerbillbarkerbillbarker at apache.orgMladen Turkmturkmturk at apache.orgjunitjunit3.8.1test1.31.3daemon1.0.15DAEMON12310468maven-assembly-pluginsrc/main/assembly/native-src.xmlsrc/main/assembly/bin.xmlsrc/main/assembly/src.xmlsrc/main/assembly/win.xmlgnu
commons-daemon-1.0.15-src/LICENSE.txt 100664 25140 25140 26136 10210071042 16664 0 ustar mturk mturk 0 0
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.
commons-daemon-1.0.15-src/NOTICE.txt 100664 25140 25140 257 12075541424 16540 0 ustar mturk mturk 0 0 Apache Commons Daemon
Copyright 1999-2013 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
commons-daemon-1.0.15-src/PROPOSAL.html 100664 25140 25140 15536 10653172436 17214 0 ustar mturk mturk 0 0
Proposal for Daemon Package
Proposal for Daemon Package
(0) Rationale
Since 1994, the Java™ programming language evolved and became a
valid tool to develop, other than applets and client applications,
reliable and performant server applications. The major disadvantage of
the Java™ platform is that still today the only portable way to
start a Java™ applcation relies on a single point of entry: the
public static void main(String[])
method.
Having a single-point of entry is a valid solution for client
applications, where interactively a user can command to the application
to quit (which can terminate the Virtual Machine process at calling the
System.exit(int)
method), but in those cases where the application is not interactive
(server applications) there is currently no portable way to notify
the Virtual Machine of its imminent shutdown.
A server application written in Java might have to perform several tasks
before being able to shutdown the Virtual Machine process. For example
in the case of a Servlet container, before the VM process is shut down,
sessions might need to be serialized to disk, and web applications need
to be destroyed.
One common solution to this problem is to create (for example) a
ServerSocket and wait for a particular
message to be issued. When the message is received, all operations
required to shut down the server applications are performed and at the
end the System.exit method is called
to terminate the Virtual Machine process. This method, however, implies
several disadvantages and risks: for example in case of a system-wide
shutdown, it might happen that the Virtual Machine process will be shut
down directly by the operating system, without notifying the running
server application. Or, for example, if an attacker finds out what is
the required message to send to the server, and discovers a way to send
this message to the running server application, he can easily interrupt
the operation of a server, bypassing all the security restrictions
implemented in the operating system.
Most multi-user operating systems already have a way in which server
applications are started and stopped, under Unix based operating systems
non interactive server applications are called daemons and are
controlled by the operating system with a set of specified
signals. Under Windows such programs are called services
and are controlled by appropriate calls to specific functions defined in
the application binary, but although the ways of dealing with the problem
are different, in both cases the operating system can notify a server
application of its imminent shutdown, and the application has the
ability to perform certain tasks before its process of execution is
destroyed.
(1) Scope of the Package
The scope of this specification is to define an API in line with the
current Java™ Platform APIs to support an alternative invocation
mechanism which could be used instead of the above mentioned
public static void main(String[])
method. This specification cover the behavior and life cycle of what
we define as "Java ™ daemons", or, in other words,
non interactive Java™ applications.
This specification does not cover how the container of a Java™
daemon must be implemented, or how to build a native liaison between
the operating system and the Daemon
interface, but defines the relation between the an operating system
process and the Daemon implementation
life cycle. It should be trivial for implementors to build a native
liaison and container for Java™ daemons.
This specification, together with the related API documentation, can be
used by software deveopers to build portable non interactive applications
based on the Java™ platform.
(1.5) Interaction With Other Packages
Daemon relies only on standard JDK 1.2 (or later) APIs for
production deployment. It utilizes the JUnit unit testing framework for
developing and executing unit tests, but this is of interest only to
developers of the component. Daemon will be a dependency for
several existing components in the open source world.
No external configuration files are utilized.
(2) Initial Source of the Package
The original Java classes come from the Jakarta Tomcat 4.0 project.
The proposed package name for the new component is
org.apache.commons.daemon.
(3) Required Jakarta-Commons Resources
CVS Repository - New directory daemon in the
jakarta-commons CVS repository.
Mailing List - Discussions will take place on the general
dev@commons.apache.org mailing list. To help
list subscribers identify messages of interest, it is suggested that
the message subject of messages about this component be prefixed with
[Daemon].
Bugzilla - New component "Daemon" under the "Commons" product
category, with appropriate version identifiers as needed.
Jyve FAQ - New category "commons-daemon" (when available).
(4) Initial Committers
The initial committers on the Daemon component shall be:
Jean-Frederic Clere
Pier Fumagalli
Remy Maucherat
commons-daemon-1.0.15-src/RELEASE-NOTES.txt 100664 25140 25140 13155 12125035131 17553 0 ustar mturk mturk 0 0 Apache Commons Daemon
Version 1.0.15
Release Notes
INTRODUCTION:
Apache Commons Daemon is a set of utilities and Java support classes
for running Java applications as server processes.
Commonly known as 'daemon' processes in Unix terminology (hence the name),
on Windows they are called 'services'.
This document contains the release notes for this version of the
Apache Commons Daemon package, and highlights changes since
the previous version.
The current release adds new features and bug fixes, and is being done now
to follow the release early/release often mentality.
Compatibility with 1.0.3
------------------------
Binary compatible - Yes
Source compatible - Yes
Semantic compatible - Yes
Commons DAEMON 1.0.3 requires a minimum of JDK 1.3
NEW FEATURES:
* DAEMON-269: Support privilege escalation on Windows UAC for procmgr (1.0.12)
* DAEMON-264: Add -cwd to jsvc so that user can specify working
directory. It defaults to /. (1.0.11)
* DAEMON-262: Automatically refresh manager application (1.0.11)
* DAEMON-245: Support privilege escalation on Windows UAC (1.0.11)
* DAEMON-221: Add -umask to jsvc so that users don't have to
recompile the jsvc if different umask is desired (1.0.8)
* DAEMON-209: Add --LibraryPath to procrun for setting the
LoadLibrary search paths (1.0.6)
* DAEMON-208: Add -server and -client -jvm synonyms (1.0.6)
* DAEMON-205: Add support for building on ARM processors (1.0.6)
* DAEMON-204: Add DaemonSignal interface that allows catching SIGUSR2
signals and creating custom callbacks (1.0.6)
* DAEMON-202: Allow JSVC_OPTS environment variable to be used in
the example Tomcat scripts (1.0.6)
* DAEMON-180: Add DaemonWrapper to allow running standard applications
as daemons. (1.0.4)
* DAEMON-179: Allow procrun to use java/lang/System as --ShutdownClass. (1.0.4)
* DAEMON-178: Allow jsvc umask to be configured at build time
* DAEMON-177: Allow fail during init with nicer message. (1.0.4)
* DAEMON-176: Create config.nice during configure step. (1.0.4)
* DAEMON-173: Allow --JavaHome=jdk and --JavaHome=jre options that
will guess default JavaHome from the registry. (1.0.4)
* DAEMON-160: Remove obsolete code; rename native/nt as native/windows (1.0.4)
* DAEMON-144: Drop sample dependency on Commons Collections ExtendedProperties (1.0.4)
* DAEMON-95: Support log rotation using SIGUSR1 (1.0.4)
* DAEMON-80: Syslog support for jsvc (1.0.4)
* DAEMON-138: Add --PidFile option to allow storing running process id. (1.0.3)
* DAEMON-137: Add --LogJniMessages allowing to configure JNI verbose message
logging. By default those messages were always logged. (1.0.3)
* DAEMON-140: Add missing Java6 parameters -ea, da, -esa, -dsa, -showversion
and their long name synonyms. (1.0.3)
* DAEMON-142: Add option to display procrun version. (1.0.3)
* DAEMON-166: Add classpath .jar expansion. If the classpath
element ends with asterisk it will evaluate to all .jar files
found in the path. (1.0.3)
* Add -wait and -stop parameters. (1.0.1).
The -wait parameter is experimental: that a is loop testing for a
file in /tmp and waiting n/10 seconds.
* Allow to run as normal user for testing. (1.0.1).
* Initial import to Commons, including the daemon Java API, and jsvc
for Unix and Windows NT/2K/XP, which allows running a Java program
as a native operating system daemon
* Switch to JIRA bug tracking system.
* Add sample ProcrunService Java application for use with Procrun Jvm/Java modes (1.0.3)
BUG FIXES:
1.0.15: DAEMON-288, DAEMON-289, DAEMON-291, DAEMON-292
1.0.14: DAEMON-278, DAEMON-280, DAEMON-281, DAEMON-283, DAEMON-284, DAEMON-286,
DAEMON-287
1.0.13: DAEMON-275, DAEMON-276
1.0.12: DAEMON-268, DAEMON-272, DAEMON-274
1.0.11: DAEMON-244, DAEMON-246, DAEMON-247, DAEMON-252, DAEMON-253, DAEMON-254,
DAEMON-255, DAEMON-257, DAEMON-261, DAEMON-263, DAEMON-265, DAEMON-266,
DAEMON-267
1.0.10: DAEMON-241, DAEMON-242
1.0.9: DAEMON-232, DAEMON-233, DAEMON-234, DAEMON-237, DAEMON-240
1.0.8: DAEMON-195, DAEMON-215, DAEMON-216, DAEMON-218, DAEMON-219, DAEMON-220,
DAEMON-222, DAEMON-223, DAEMON-224, DAEMON-227, DAEMON-228
1.0.7: DAEMON-211, DAEMON-214
1.0.6: DAEMON-186, DAEMON-193, DAEMON-194, DAEMON-206, DAEMON-185, DAEMON-200
DAEMON-192
1.0.5: DAEMON-158, DAEMON-184, DAEMON-187, DAEMON-188, DAEMON-190
1.0.4: DAEMON-95, DAEMON-171, DAEMON-100, DAEMON-164, DAEMON-165, DAEMON-175,
DAEMON-177, DAEMON-150, DAEMON-163, DAEMON-182, DAEMON-181
1.0.3: DAEMON-108, DAEMON-128, DAEMON-139, DAEMON-143, DAEMON-148,
DAEMON-135, DAEMON-155, DAEMON-159, DAEMON-161, DAEMON-145, DAEMON-146,
DAEMON-167, DAEMON-168, DAEMON-154, DAEMON-149
1.0.2: DAEMON-16, DAEMON-31, DAEMON-40, DAEMON-45, DAEMON-49, DAEMON-60,
DAEMON-84, DAEMON-90, DAEMON-91, DAEMON-92, DAEMON-93, DAEMON-94,
DAEMON-96, DAEMON-97, DAEMON-98, DAEMON-102, DAEMON-105, DAEMON-106,
DAEMON-110, DAEMON-112, DAEMON-113, DAEMON-114, DAEMON-115, DAEMON-116,
DAEMON-117, DAEMON-118, DAEMON-119, DAEMON-120, DAEMON-121, DAEMON-123,
DAEMON-124, DAEMON-125, DAEMON-126, DAEMON-129, DAEMON-130, DAEMON-132,
DAEMON-133
1.0.1: 304310, 30177, 27523, 29465, 31614, 33580, 31613, 34851.
Feedback
--------
Open source works best when you give feedback:
http://commons.apache.org/daemon/
Please direct all bug reports to JIRA
https://issues.apache.org/jira/browse/DAEMON
Or subscribe to the commons-user mailing list (prefix emails by [daemon])
http://commons.apache.org/mail-lists.html
The Apache Commons Daemon Team
commons-daemon-1.0.15-src/build.xml 100664 25140 25140 27555 12121612333 16677 0 ustar mturk mturk 0 0
commons-daemon-1.0.15-src/src/ 40775 25140 25140 0 12125035432 15515 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/ 40775 25140 25140 0 12125035432 16441 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/java/ 40775 25140 25140 0 12125035432 17362 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/java/org/ 40775 25140 25140 0 12125035432 20151 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/java/org/apache/ 40775 25140 25140 0 12125035432 21372 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/java/org/apache/commons/ 40775 25140 25140 0 12125035432 23045 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/ 40775 25140 25140 0 12125035432 24310 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/support/ 40775 25140 25140 0 12125035432 26024 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/assembly/ 40775 25140 25140 0 12125035432 20260 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/native/ 40775 25140 25140 0 12125035432 17003 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/native/unix/ 40775 25140 25140 0 12125035432 17766 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/native/unix/support/ 40775 25140 25140 0 12125035432 21502 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/native/unix/native/ 40775 25140 25140 0 12125035432 21254 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/native/unix/man/ 40775 25140 25140 0 12125035432 20541 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/media/ 40775 25140 25140 0 12125035432 16574 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/site/ 40775 25140 25140 0 12125035432 16461 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/site/resources/ 40775 25140 25140 0 12125035432 20473 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/site/resources/images/ 40775 25140 25140 0 12125035432 21740 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/site/xdoc/ 40775 25140 25140 0 12125035432 17416 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/test/ 40775 25140 25140 0 12125035432 16474 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/test/java/ 40775 25140 25140 0 12125035432 17415 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/test/java/org/ 40775 25140 25140 0 12125035432 20204 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/test/java/org/apache/ 40775 25140 25140 0 12125035432 21425 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/test/java/org/apache/commons/ 40775 25140 25140 0 12125035432 23100 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/test/java/org/apache/commons/daemon/ 40775 25140 25140 0 12125035432 24343 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/docs/ 40775 25140 25140 0 12125035432 16445 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/samples/ 40775 25140 25140 0 12125035432 17161 5 ustar mturk mturk 0 0 commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java 100664 25140 25140 22576 12115611136 31564 0 ustar mturk mturk 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.
*/
/* @version $Id: DaemonWrapper.java 1453245 2013-03-06 09:54:38Z mturk $ */
package org.apache.commons.daemon.support;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
/**
* Implementation of the Daemon that allows running
* standard applications as daemons.
* The applications must have the mechanism to manage
* the application lifecycle.
*
* @version $Id: DaemonWrapper.java 1453245 2013-03-06 09:54:38Z mturk $
* @author Mladen Turk
*/
public class DaemonWrapper implements Daemon
{
private final static String ARGS = "args";
private final static String START_CLASS = "start";
private final static String START_METHOD = "start.method";
private final static String STOP_CLASS = "stop";
private final static String STOP_METHOD = "stop.method";
private final static String STOP_ARGS = "stop.args";
private String configFileName = null;
private final DaemonConfiguration config;
private final Invoker startup;
private final Invoker shutdown;
public DaemonWrapper()
{
super();
config = new DaemonConfiguration();
startup = new Invoker();
shutdown = new Invoker();
}
/**
* Called from DaemonLoader on init stage.
*
* Accepts the following configuration arguments:
*
*
-daemon-properties: - load DaemonConfiguration properties from the specified file to act as defaults
*
-start: set start class name
*
-start-method: set start method name
*
-stop: set stop class name
*
-stop-method: set stop method name
*
-stop-argument: set optional argument to stop method
*
Anything else is treated as a startup argument
*
*
* The following "-daemon-properties" are recognised:
*
*
args (startup argument)
*
start
*
start.method
*
stop
*
stop.method
*
stop.args
*
* These are used to set the corresponding item if it has not already been
* set by the command arguments. However, note that args and stop.args are
* appended to any existing values.
*/
public void init(DaemonContext context)
throws Exception
{
String[] args = context.getArguments();
if (args != null) {
int i;
// Parse our arguments and remove them
// from the final argument array we are
// passing to our child.
for (i = 0; i < args.length; i++) {
if (args[i].equals("--")) {
// Done with argument processing
break;
}
else if (args[i].equals("-daemon-properties")) {
if (++i == args.length)
throw new IllegalArgumentException(args[i - 1]);
configFileName = args[i];
}
else if (args[i].equals("-start")) {
if (++i == args.length)
throw new IllegalArgumentException(args[i - 1]);
startup.setClassName(args[i]);
}
else if (args[i].equals("-start-method")) {
if (++i == args.length)
throw new IllegalArgumentException(args[i - 1]);
startup.setMethodName(args[i]);
}
else if (args[i].equals("-stop")) {
if (++i == args.length)
throw new IllegalArgumentException(args[i - 1]);
shutdown.setClassName(args[i]);
}
else if (args[i].equals("-stop-method")) {
if (++i == args.length)
throw new IllegalArgumentException(args[i - 1]);
shutdown.setMethodName(args[i]);
}
else if (args[i].equals("-stop-argument")) {
if (++i == args.length)
throw new IllegalArgumentException(args[i - 1]);
String[] aa = new String[1];
aa[0] = args[i];
shutdown.addArguments(aa);
}
else {
// This is not our option.
// Everything else will be forwarded to the main
break;
}
}
if (args.length > i) {
String[] copy = new String[args.length - i];
System.arraycopy(args, i, copy, 0, copy.length);
startup.addArguments(copy);
}
}
if (config.load(configFileName)) {
// Setup params if not set via cmdline.
startup.setClassName(config.getProperty(START_CLASS));
startup.setMethodName(config.getProperty(START_METHOD));
// Merge the config with command line arguments
startup.addArguments(config.getPropertyArray(ARGS));
shutdown.setClassName(config.getProperty(STOP_CLASS));
shutdown.setMethodName(config.getProperty(STOP_METHOD));
shutdown.addArguments(config.getPropertyArray(STOP_ARGS));
}
startup.validate();
shutdown.validate();
}
/**
*/
public void start()
throws Exception
{
startup.invoke();
}
/**
*/
public void stop()
throws Exception
{
shutdown.invoke();
}
/**
*/
public void destroy()
{
// Nothing for the moment
System.err.println("DaemonWrapper: instance " + this.hashCode() + " destroy");
}
// Internal class for wrapping the start/stop methods
class Invoker
{
private String name = null;
private String call = null;
private String[] args = null;
private Method inst = null;
private Class main = null;
protected Invoker()
{
}
protected void setClassName(String name)
{
if (this.name == null)
this.name = name;
}
protected void setMethodName(String name)
{
if (this.call == null)
this.call = name;
}
protected void addArguments(String[] args)
{
if (args != null) {
ArrayList aa = new ArrayList();
if (this.args != null)
aa.addAll(Arrays.asList(this.args));
aa.addAll(Arrays.asList(args));
this.args = (String[])aa.toArray(new String[aa.size()]);
}
}
protected void invoke()
throws Exception
{
if (name.equals("System") && call.equals("exit")) {
// Just call a System.exit()
// The start method was probably installed
// a shutdown hook.
System.exit(0);
}
else {
Object obj = null;
if ((inst.getModifiers() & Modifier.STATIC) == 0) {
// We only need object instance for non-static methods.
obj = main.newInstance();
}
Object arg[] = new Object[1];
arg[0] = args;
inst.invoke(obj, arg);
}
}
// Load the class using reflection
protected void validate()
throws Exception
{
/* Check the class name */
if (name == null) {
name = "System";
call = "exit";
return;
}
if (args == null)
args = new String[0];
if (call == null)
call = "main";
// Get the ClassLoader loading this class
ClassLoader cl = DaemonWrapper.class.getClassLoader();
if (cl == null)
throw new NullPointerException("Cannot retrieve ClassLoader instance");
Class[] ca = new Class[1];
ca[0] = args.getClass();
// Find the required class
main = cl.loadClass(name);
if (main == null)
throw new ClassNotFoundException(name);
// Find the required method.
// NoSuchMethodException will be thrown if matching method
// is not found.
inst = main.getMethod(call, ca);
}
}
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java 100664 25140 25140 32167 11661752253 31362 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon.support;
import org.apache.commons.daemon.DaemonContext;
import org.apache.commons.daemon.DaemonController;
import org.apache.commons.daemon.DaemonInitException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Used by jsvc for Daemon management.
*
* @version $Id: DaemonLoader.java 1204006 2011-11-19 16:09:15Z ggregory $
*/
public final class DaemonLoader
{
// N.B. These static mutable variables need to be accessed using synch.
private static Controller controller = null; //@GuardedBy("this")
private static Object daemon = null; //@GuardedBy("this")
/* Methods to call */
private static Method init = null; //@GuardedBy("this")
private static Method start = null; //@GuardedBy("this")
private static Method stop = null; //@GuardedBy("this")
private static Method destroy = null; //@GuardedBy("this")
private static Method signal = null; //@GuardedBy("this")
public static void version()
{
System.err.println("java version \"" +
System.getProperty("java.version") + "\"");
System.err.println(System.getProperty("java.runtime.name") +
" (build " +
System.getProperty("java.runtime.version") + ")");
System.err.println(System.getProperty("java.vm.name") +
" (build " +
System.getProperty("java.vm.version") +
", " + System.getProperty("java.vm.info") + ")");
System.err.println("commons daemon version \"" +
System.getProperty("commons.daemon.version") + "\"");
System.err.println("commons daemon process (id: " +
System.getProperty("commons.daemon.process.id") +
", parent: " +
System.getProperty("commons.daemon.process.parent") + ")");
}
public static boolean check(String cn)
{
try {
/* Check the class name */
if (cn == null)
throw new NullPointerException("Null class name specified");
/* Get the ClassLoader loading this class */
ClassLoader cl = DaemonLoader.class.getClassLoader();
if (cl == null) {
System.err.println("Cannot retrieve ClassLoader instance");
return false;
}
/* Find the required class */
Class c = cl.loadClass(cn);
/* This should _never_ happen, but doublechecking doesn't harm */
if (c == null)
throw new ClassNotFoundException(cn);
/* Create a new instance of the daemon */
c.newInstance();
} catch (Throwable t) {
/* 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
*/
return true;
}
public static boolean signal()
{
try {
if (signal != null) {
signal.invoke(daemon, new Object[0]);
return true;
}
else {
System.out.println("Daemon doesn't support signaling");
}
} catch (Throwable ex) {
System.err.println("Cannot send signal: " + ex);
ex.printStackTrace(System.err);
}
return false;
}
public static boolean load(String className, String args[])
{
try {
/* Make sure any previous instance is garbage collected */
System.gc();
/* Check if the underlying libray supplied a valid list of
arguments */
if (args == null)
args = new String[0];
/* Check the class name */
if (className == null)
throw new NullPointerException("Null class name specified");
/* Get the ClassLoader loading this class */
ClassLoader cl = DaemonLoader.class.getClassLoader();
if (cl == null) {
System.err.println("Cannot retrieve ClassLoader instance");
return false;
}
Class c;
if (className.charAt(0) == '@') {
/* Wrapp the class with DaemonWrapper
* and modify arguments to include the real class name.
*/
c = DaemonWrapper.class;
String[] a = new String[args.length + 2];
a[0] = "-start";
a[1] = className.substring(1);
System.arraycopy(args, 0, a, 2, args.length);
args = a;
}
else
c = cl.loadClass(className);
/* This should _never_ happen, but doublechecking doesn't harm */
if (c == null)
throw new ClassNotFoundException(className);
/* Check interfaces */
boolean isdaemon = false;
try {
Class dclass =
cl.loadClass("org.apache.commons.daemon.Daemon");
isdaemon = dclass.isAssignableFrom(c);
}
catch (Exception cnfex) {
// Swallow if Daemon not found.
}
/* Check methods */
Class[] myclass = new Class[1];
if (isdaemon) {
myclass[0] = DaemonContext.class;
}
else {
myclass[0] = args.getClass();
}
init = c.getMethod("init", myclass);
myclass = null;
start = c.getMethod("start", myclass);
stop = c.getMethod("stop", myclass);
destroy = c.getMethod("destroy", myclass);
try {
signal = c.getMethod("signal", myclass);
} catch (NoSuchMethodException e) {
// Signaling will be disabled.
}
/* Create a new instance of the daemon */
daemon = c.newInstance();
if (isdaemon) {
/* Create a new controller instance */
controller = new Controller();
/* Set the availability flag in the controller */
controller.setAvailable(false);
/* Create context */
Context context = new Context();
context.setArguments(args);
context.setController(controller);
/* Now we want to call the init method in the class */
Object arg[] = new Object[1];
arg[0] = context;
init.invoke(daemon, arg);
}
else {
Object arg[] = new Object[1];
arg[0] = args;
init.invoke(daemon, arg);
}
}
catch (InvocationTargetException e) {
Throwable thrown = e.getTargetException();
/* DaemonInitExceptions can fail with a nicer message */
if (thrown instanceof DaemonInitException) {
failed(((DaemonInitException) thrown).getMessageWithCause());
}
else {
thrown.printStackTrace(System.err);
}
return false;
}
catch (Throwable t) {
/* 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 */
return true;
}
public static boolean start()
{
try {
/* Attempt to start the daemon */
Object arg[] = null;
start.invoke(daemon, arg);
/* Set the availability flag in the controller */
if (controller != null)
controller.setAvailable(true);
} catch (Throwable t) {
/* 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;
}
return true;
}
public static boolean stop()
{
try {
/* Set the availability flag in the controller */
if (controller != null)
controller.setAvailable(false);
/* Attempt to stop the daemon */
Object arg[] = null;
stop.invoke(daemon, arg);
/* Run garbage collector */
System.gc();
}
catch (Throwable t) {
/* 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;
}
return true;
}
public static boolean destroy()
{
try {
/* Attempt to stop the daemon */
Object arg[] = null;
destroy.invoke(daemon, arg);
/* Run garbage collector */
daemon = null;
controller = null;
System.gc();
} catch (Throwable t) {
/* 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;
}
return true;
}
private static native void shutdown(boolean reload);
private static native void failed(String message);
public static class Controller
implements DaemonController
{
private boolean available = false;
private Controller()
{
super();
this.setAvailable(false);
}
private boolean isAvailable()
{
synchronized (this) {
return this.available;
}
}
private void setAvailable(boolean available)
{
synchronized (this) {
this.available = available;
}
}
public void shutdown()
throws IllegalStateException
{
synchronized (this) {
if (!this.isAvailable()) {
throw new IllegalStateException();
}
else {
this.setAvailable(false);
DaemonLoader.shutdown(false);
}
}
}
public void reload()
throws IllegalStateException
{
synchronized (this) {
if (!this.isAvailable()) {
throw new IllegalStateException();
}
else {
this.setAvailable(false);
DaemonLoader.shutdown(true);
}
}
}
public void fail()
{
fail(null, null);
}
public void fail(String message)
{
fail(message, null);
}
public void fail(Exception exception)
{
fail(null, exception);
}
public void fail(String message, Exception exception)
{
synchronized (this) {
this.setAvailable(false);
String msg = message;
if (exception != null) {
if (msg != null)
msg = msg + ": " + exception.toString();
else
msg = exception.toString();
}
DaemonLoader.failed(msg);
}
}
}
public static class Context
implements DaemonContext
{
private DaemonController daemonController = null;
private String[] args = null;
public DaemonController getController()
{
return daemonController;
}
public void setController(DaemonController controller)
{
this.daemonController = controller;
}
public String[] getArguments()
{
return args;
}
public void setArguments(String[]args)
{
this.args = args;
}
}
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java 100664 25140 25140 15404 11727516237 32761 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon.support;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import java.text.ParseException;
/**
* Used by jsvc for Daemon configuration.
*
* Configuration is read from properties file.
* If no properties file is given the daemon.properties
* is used from the current directory.
*
*
* The properties file can have property values expanded at runtime
* by using System properties or execution environment. The part
* of the property value between ${ and }
* will be used as System property or environment key. If found then
* the entire ${foo} will be replaced by the value of
* either system property or environment variable named foo.
*
*
* If no variable is found the ${foo} will be passed as is.
* In case of $${foo} this will be unescaped and resulting
* value will be ${foo}.
*
*
* @version $Id: DaemonConfiguration.java 1299939 2012-03-13 01:02:23Z sebb $
* @author Mladen Turk
*/
public final class DaemonConfiguration
{
/**
* Default configuration file name.
*/
protected final static String DEFAULT_CONFIG = "daemon.properties";
/**
* Property prefix
*/
protected final static String PREFIX = "daemon.";
private final static String BTOKEN = "${";
private final static String ETOKEN = "}";
private final Properties configurationProperties;
private final Properties systemProperties;
/**
* Default constructor
*/
public DaemonConfiguration()
{
configurationProperties = new Properties();
systemProperties = System.getProperties();
}
/**
* Loads the configuration properties file.
*
* @param fileName The properties file to load.
* @return true if the file was loaded.
*/
public boolean load(String fileName)
{
boolean ok = false;
FileInputStream file = null;
try {
if (fileName == null)
fileName = DEFAULT_CONFIG;
file = new FileInputStream(fileName);
configurationProperties.clear();
configurationProperties.load(file);
ok = true;
}
catch (FileNotFoundException ex) {
// fileName does not exist
}
catch (IOException ex) {
// Error reading properties file
} finally {
try {
if (file != null)
file.close();
} catch (IOException ex) {
}
}
return ok;
}
private String expandProperty(String propValue)
throws ParseException
{
StringBuffer expanded;
int btoken;
int ctoken = 0;
if (propValue == null)
return null;
expanded = new StringBuffer();
btoken = propValue.indexOf(BTOKEN);
while (btoken != -1) {
if (btoken > 0 && propValue.charAt(btoken - 1) == BTOKEN.charAt(0)) {
// Skip and unquote.
expanded.append(propValue.substring(ctoken, btoken));
ctoken = btoken + 1;
btoken = propValue.indexOf(BTOKEN, btoken + BTOKEN.length());
continue;
}
int etoken = propValue.indexOf(ETOKEN, btoken);
if (etoken != -1) {
String variable = propValue.substring(btoken + BTOKEN.length(), etoken);
String sysvalue = systemProperties.getProperty(variable);
if (sysvalue == null) {
// Try with the environment if there was no
// property by that name.
sysvalue = System.getenv(variable); // N.B. Deprecated in Java 1.3/1.4, but re-instated in Java 1.5+
}
if (sysvalue != null) {
String strtoken = propValue.substring(ctoken, btoken);
expanded.append(strtoken);
expanded.append(sysvalue);
ctoken = etoken + ETOKEN.length();
}
}
else {
// We have "${" without "}"
throw new ParseException("Error while looking for teminating '" +
ETOKEN + "'", btoken);
}
btoken = propValue.indexOf(BTOKEN, etoken + ETOKEN.length());
}
// Add what's left.
expanded.append(propValue.substring(ctoken, propValue.length()));
return expanded.toString();
}
/**
* Gets the configuration property.
*
* @param name The name of the property to get.
*
* @throws ParseException if the property is wrongly formatted.
*/
public String getProperty(String name)
throws ParseException
{
if (name == null)
return null;
else
return expandProperty(configurationProperties.getProperty(PREFIX + name));
}
/**
* Gets the configuration property array.
*
* Property array is constructed form the list of properties
* which end with [index]
*
* @param name The name of the property array to get.
*
* @throws ParseException if the property is wrongly formatted.
*/
public String[] getPropertyArray(String name)
throws ParseException
{
ArrayList list = new ArrayList();
String args;
// Load daemon.arg[0] ... daemon.arg[n] into the String array.
//
while ((args = getProperty(name + "[" + list.size() + "]")) != null) {
list.add(args);
}
return (String[])list.toArray(new String[list.size()]);
}
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/DaemonInitException.java 100664 25140 25140 2745 11661752365 31205 0 ustar mturk mturk 0 0 /*
* Copyright 2010 Media Service Provider Ltd
*
* Licensed 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./*
*
*/
package org.apache.commons.daemon;
/**
* Throw this during init if you can't initialise yourself for some expected
* reason. Using this exception will cause the exception's message to come out
* on stdout, rather than a dirty great stacktrace.
* @author Nick Griffiths (nicobrevin@gmail.com)
* @version $Id: DaemonInitException.java 1204007 2011-11-19 16:10:29Z ggregory $
*/
public class DaemonInitException extends Exception {
//don't rely on Throwable#getCause (jdk1.4)
private final Throwable cause;
public DaemonInitException(String message) {
super(message);
this.cause = null;
}
public DaemonInitException(String message, Throwable cause) {
super(message);
this.cause = cause;
}
public String getMessageWithCause() {
String extra = this.cause == null ? "" : ": " + this.cause.getMessage();
return getMessage() + extra;
}
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/DaemonContext.java 100664 25140 25140 3173 11661752253 30037 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon;
/**
* Defines a set of methods that a Daemon instance can use to
* communicate with the Daemon container.
*
* @author Pier Fumagalli
* @version $Id: DaemonContext.java 1204006 2011-11-19 16:09:15Z ggregory $
*/
public interface DaemonContext
{
/**
* Returns DaemonController object that can be used
* to control the Daemon instance that this
* DaemonContext is passed to.
*/
public DaemonController getController();
/**
* Returns an array of String arguments supplied by
* the environment. corresponding to the array of arguments given
* in the public static void main() method used as an
* entry point to most other java programs.
*/
public String[] getArguments();
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/DaemonController.java 100664 25140 25140 3477 11661753033 30542 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon;
/**
* Defines methods needed by the DaemonLoader.
*
* @author Pier Fumagalli
* @version $Id: DaemonController.java 1204010 2011-11-19 16:15:23Z ggregory $
*/
public interface DaemonController
{
/**
* Shuts down the daemon.
*/
public void shutdown()
throws IllegalStateException;
/**
* Reloads daemon
*/
public void reload()
throws IllegalStateException;
/**
* Shuts down daemon and logs failed message.
*/
public void fail()
throws IllegalStateException;
/**
* Shuts down daemon and logs failed message.
*/
public void fail(String message)
throws IllegalStateException;
/**
* Shuts down daemon and logs failed message.
*/
public void fail(Exception exception)
throws IllegalStateException;
/**
* Shuts down daemon and logs failed message.
*/
public void fail(String message, Exception exception)
throws IllegalStateException;
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/DaemonListener.java 100664 25140 25140 2043 11661752253 30173 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon;
import java.util.EventListener;
/**
* EvenListener type wrapper.
* @version $Id: DaemonListener.java 1204006 2011-11-19 16:09:15Z ggregory $
*/
public interface DaemonListener extends EventListener
{
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/Daemon.java 100664 25140 25140 10337 11661753033 26507 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon;
/**
* Provides support for native daemon invocation. Using
* a platform dependant helper program, classes that implement the
* Daemon interface can be initialized, started and
* stopped according to the conventions of the underlying operating
* system.
*
* Implementors of this interface must also provide a public constructor
* with no arguments so that instances can be created in an automated
* fashion.
*
* This method gets called once the JVM process is created and the
* Daemon instance is created thru its empty public
* constructor.
*
*
* 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.
*
*
* For example, it might be wise to create ServerSocket
* instances within the scope of this method, and perform all operations
* requiring super-user privileges in the underlying operating
* system.
*
*
* Apart from set up and allocation of native resources, this method
* must not start the actual operation of the Daemon (such
* as starting threads calling the ServerSocket.accept()
* method) as this would impose some serious security hazards. The
* start of operation must be performed in the start()
* method.
*
*
* @param context A DaemonContext object used to
* communicate with the container.
* @exception DaemonInitException An exception that prevented
* initialization where you want to display a nice message to the user,
* rather than a stack trace.
* @exception Exception Any exception preventing a successful
* initialization.
*/
public void init(DaemonContext context)
throws DaemonInitException, Exception;
/**
* Starts the operation of this Daemon instance. This
* method is to be invoked by the environment after the init()
* method has been successfully invoked and possibly the security
* level of the JVM has been dropped. Implementors of this
* method are free to start any number of threads, but need to
* return control after having done that to enable invocation of
* the stop()-method.
*/
public void start()
throws Exception;
/**
* Stops the operation of this Daemon instance. Note
* that the proper place to free any allocated resources such as
* sockets or file descriptors is in the destroy method, as the
* container may restart the Daemon by calling start() after
* stop().
*/
public void stop()
throws Exception;
/**
* 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
* new call to the init() method.
*/
public void destroy();
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java 100664 25140 25140 2643 11661753033 30465 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon;
/**
* Tags a Daemon as supporting some kind of
* signaling method that allows the java application to
* perform a custom action.
*
* User must implement a signal method that will be called from
* native upon receiving {@code SIGUSR2} signal from the operating system.
*
* @author Nick Griffiths
* @author Mladen Turk
* @version $Id: DaemonUserSignal.java 1204010 2011-11-19 16:15:23Z ggregory $
*/
public interface DaemonUserSignal
{
/**
* Performs a custom action on received user signal.
*/
void signal();
}
commons-daemon-1.0.15-src/src/main/java/org/apache/commons/daemon/DaemonPermission.java 100664 25140 25140 31522 11661753033 30557 0 ustar mturk mturk 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.
*/
package org.apache.commons.daemon;
import java.security.Permission;
import java.util.StringTokenizer;
/**
* Represents the permissions to control and query the status of
* a Daemon. A DaemonPermission consists of a
* target name and a list of actions associated with it.
*
* In this specification version the only available target name for this
* permission is "control", but further releases may add more target
* names to fine-tune the access that needs to be granted to the caller.
*
*
* Actions are defined by a string of comma-separated values, as shown in the
* table below. The empty string implies no permission at all, while the
* special "*" value implies all permissions for the given
* name:
*
*
*
*
*
Target"Name
*
Action
*
Description
*
*
*
"control"
*
"start"
*
* The permission to call the start() method in an instance
* of a DaemonController interface.
*
*
*
*
"stop"
*
* The permission to call the stop() method in an instance
* of a DaemonController interface.
*
*
*
*
"shutdown"
*
* The permission to call the shutdown() method in an instance
* of a DaemonController interface.
*
*
*
*
"reload"
*
* The permission to call the reload() method in an instance
* of a DaemonController interface.
*
*
*
*
"*"
*
* The special wildcard action implies all above-mentioned action. This is
* equal to construct a permission with the "start, stop, shutdown,
* reload" list of actions.
*
*
*
*
*
* @author Pier Fumagalli
* @version $Id: DaemonPermission.java 1204010 2011-11-19 16:15:23Z ggregory $
*/
public final class DaemonPermission extends Permission
{
/* ====================================================================
* Constants.
*/
/**
* The target name when associated with control actions
* ("control").
*/
protected static final String CONTROL = "control";
/**
* The target type when associated with control actions.
*/
protected static final int TYPE_CONTROL = 1;
/**
* The action name associated with the permission to call the
* DaemonController.start() method.
*/
protected static final String CONTROL_START = "start";
/**
* The action name associated with the permission to call the
* DaemonController.stop() method.
*/
protected static final String CONTROL_STOP = "stop";
/**
* The action name associated with the permission to call the
* DaemonController.shutdown() method.
*/
protected static final String CONTROL_SHUTDOWN = "shutdown";
/**
* The action name associated with the permission to call the
* DaemonController.reload() method.
*/
protected static final String CONTROL_RELOAD = "reload";
/**
* The action mask associated with the permission to call the
* DaemonController.start() method.
*/
protected static final int MASK_CONTROL_START = 0x01;
/**
* The action mask associated with the permission to call the
* DaemonController.stop() method.
*/
protected static final int MASK_CONTROL_STOP = 0x02;
/**
* The action mask associated with the permission to call the
* DaemonController.shutdown() method.
*/
protected static final int MASK_CONTROL_SHUTDOWN = 0x04;
/**
* The action mask associated with the permission to call the
* DaemonController.reload() method.
*/
protected static final int MASK_CONTROL_RELOAD = 0x08;
/**
* The "wildcard" action implying all actions for the given
* target name.
*/
protected static final String WILDCARD = "*";
/* ====================================================================
* Instance variables
*/
/** The type of this permission object. */
private transient int type = 0;
/** The permission mask associated with this permission object. */
private transient int mask = 0;
/** The String representation of this permission object. */
private transient String desc = null;
/* ====================================================================
* Constructors
*/
/**
* Creates a new DaemonPermission instance with a specified
* permission name.
*
* This constructor will create a new DaemonPermission
* instance that will not grant any permission to the caller.
*
* @param target The target name of this permission.
* @exception IllegalArgumentException If the specified target name is not
* supported.
*/
public DaemonPermission(String target)
throws IllegalArgumentException
{
// Setup the target name of this permission object.
super(target);
// Check if the permission target name was specified
if (target == null)
throw new IllegalArgumentException("Null permission name");
// Check if this is a "control" permission and set up accordingly.
if (CONTROL.equalsIgnoreCase(target)) {
type = TYPE_CONTROL;
return;
}
// If we got here, we have an invalid permission name.
throw new IllegalArgumentException("Invalid permission name \"" +
target + "\" specified");
}
/**
* Creates a new DaemonPermission instance with a specified
* permission name and a specified list of actions.
*
*
*
* @param target The target name of this permission.
* @param actions The list of actions permitted by this permission.
* @exception IllegalArgumentException If the specified target name is not
* supported, or the specified list of actions includes an
* invalid value.
*/
public DaemonPermission(String target, String actions)
throws IllegalArgumentException
{
// Setup this instance's target name.
this(target);
// Create the appropriate mask if this is a control permission.
if (this.type == TYPE_CONTROL) {
this.mask = this.createControlMask(actions);
return;
}
}
/* ====================================================================
* Public methods
*/
/**
* Returns the list of actions permitted by this instance of
* DaemonPermission in its canonical form.
*
* @return The canonicalized list of actions.
*/
public String getActions()
{
if (this.type == TYPE_CONTROL) {
return this.createControlActions(this.mask);
}
return "";
}
/**
* Returns the hash code for this DaemonPermission instance.
*
* @return An hash code value.
*/
public int hashCode()
{
this.setupDescription();
return this.desc.hashCode();
}
/**
* Checks if a specified object equals DaemonPermission.
*
* @return true or false wether the specified object equals
* this DaemonPermission instance or not.
*/
public boolean equals(Object object)
{
if (object == this)
return true;
if (!(object instanceof DaemonPermission))
return false;
DaemonPermission that = (DaemonPermission) object;
if (this.type != that.type)
return false;
return this.mask == that.mask;
}
/**
* Checks if this DaemonPermission implies another
* Permission.
*
* @return true or false wether the specified permission
* is implied by this DaemonPermission instance or
* not.
*/
public boolean implies(Permission permission)
{
if (permission == this)
return true;
if (!(permission instanceof DaemonPermission))
return false;
DaemonPermission that = (DaemonPermission) permission;
if (this.type != that.type)
return false;
return (this.mask & that.mask) == that.mask;
}
/**
* Returns a String representation of this instance.
*
* @return A String representing this
* DaemonPermission instance.
*/
public String toString()
{
this.setupDescription();
return this.desc;
}
/* ====================================================================
* Private methods
*/
/**
* Creates a String description for this permission instance.
*/
private void setupDescription()
{
if (this.desc != null)
return;
StringBuffer buf = new StringBuffer();
buf.append(this.getClass().getName());
buf.append('[');
switch (this.type) {
case TYPE_CONTROL:
buf.append(CONTROL);
break;
default:
buf.append("UNKNOWN");
break;
}
buf.append(':');
buf.append(this.getActions());
buf.append(']');
this.desc = buf.toString();
}
/**
* Creates a permission mask for a given control actions string.
*/
private int createControlMask(String actions)
throws IllegalArgumentException
{
if (actions == null)
return 0;
int mask = 0;
StringTokenizer tok = new StringTokenizer(actions, ",", false);
while (tok.hasMoreTokens()) {
String val = tok.nextToken().trim();
if (WILDCARD.equals(val)) {
return MASK_CONTROL_START | MASK_CONTROL_STOP |
MASK_CONTROL_SHUTDOWN | MASK_CONTROL_RELOAD;
}
else if (CONTROL_START.equalsIgnoreCase(val)) {
mask = mask | MASK_CONTROL_START;
}
else if (CONTROL_STOP.equalsIgnoreCase(val)) {
mask = mask | MASK_CONTROL_STOP;
}
else if (CONTROL_SHUTDOWN.equalsIgnoreCase(val)) {
mask = mask | MASK_CONTROL_SHUTDOWN;
}
else if (CONTROL_RELOAD.equalsIgnoreCase(val)) {
mask = mask | MASK_CONTROL_RELOAD;
}
else {
throw new IllegalArgumentException("Invalid action name \"" +
val + "\" specified");
}
}
return mask;
}
/** Creates a actions list for a given control permission mask. */
private String createControlActions(int mask)
{
StringBuffer buf = new StringBuffer();
boolean sep = false;
if ((mask & MASK_CONTROL_START) == MASK_CONTROL_START) {
sep = true;
buf.append(CONTROL_START);
}
if ((mask & MASK_CONTROL_STOP) == MASK_CONTROL_STOP) {
if (sep)
buf.append(",");
else
sep = true;
buf.append(CONTROL_STOP);
}
if ((mask & MASK_CONTROL_SHUTDOWN) == MASK_CONTROL_SHUTDOWN) {
if (sep)
buf.append(",");
else
sep = true;
buf.append(CONTROL_SHUTDOWN);
}
if ((mask & MASK_CONTROL_RELOAD) == MASK_CONTROL_RELOAD) {
if (sep)
buf.append(",");
else
sep = true;
buf.append(CONTROL_RELOAD);
}
return buf.toString();
}
}
commons-daemon-1.0.15-src/src/main/assembly/bin.xml 100664 25140 25140 3062 11337251663 21662 0 ustar mturk mturk 0 0
bintar.gzzipfalseLICENSE.txtNOTICE.txtRELEASE-NOTES.txttarget*.jartarget/site/apidocsapidocs
commons-daemon-1.0.15-src/src/main/assembly/win.xml 100664 25140 25140 3010 11714176422 21676 0 ustar mturk mturk 0 0
bin-windowszipfalseLICENSE.txtNOTICE.txtRELEASE-NOTES.txttarget*.exeamd64/*.exeia64/*.exe
commons-daemon-1.0.15-src/src/main/assembly/native-src.xml 100664 25140 25140 6104 11660407126 23161 0 ustar mturk mturk 0 0
native-srctar.gzzip${project.artifactId}-${project.version}-native-srcLICENSE.txtNOTICE.txtRELEASE-NOTES.txtREADMEsrc/native/unixunixlf**/*.shconfigureautom4te.cache/****/*.formattedsrc/native/unixunixlf775**/*.shconfiguresrc/native/windowswindowscrlf**/*.ico**/*.bmp**/*.rc**/*.formatted664src/native/windowswindows**/*.ico**/*.bmp**/*.rc664
commons-daemon-1.0.15-src/src/main/assembly/src.xml 100664 25140 25140 4530 11721374220 21672 0 ustar mturk mturk 0 0
srctar.gzzip${project.artifactId}-${project.version}-srcbuild.properties.samplebuild.xmlLICENSE.txtNOTICE.txtpom.xmlPROPOSAL.htmlREADMERELEASE-NOTES.txtsrc**/*.shnative/unix/configurenative/unix/autom4te.cache/**native/windows/**srcnative/windows/**src775**/*.shnative/unix/configure
commons-daemon-1.0.15-src/src/native/unix/support/config.guess 100775 25140 25140 127060 12116104221 24156 0 ustar mturk mturk 0 0 #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2013-02-04'
# 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.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-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-2013 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
trap 'exit 1' 1 2 15
# 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.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ 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) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; 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 ; set_cc_for_build= ;'
# 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) >/dev/null 2>&1 ; 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
# 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=`(/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 ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $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
# 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/[-_].*/\./'`
;;
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}"
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 ;;
*: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 ;;
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 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
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.*:*)
eval $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)
eval $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
eval $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/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
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:BSD:*)
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
eval $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
eval $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:*:*)
eval $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 ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
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 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-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-gnu`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 '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
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="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $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-gnu
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
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-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
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.*:* | i*86:SYSTEM_V: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 configury 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 ;;
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
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
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
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
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 ;;
*: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.
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 ;;
esac
eval $set_cc_for_build
cat >$dummy.c <
# include
#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 (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#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
printf ("vax-dec-ultrix\n"); exit (0);
# 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; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 < in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 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 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
commons-daemon-1.0.15-src/src/native/unix/support/config.sub 100775 25140 25140 105250 12124512355 23630 0 ustar mturk mturk 0 0 #! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2013-02-04'
# 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 with a ChangeLog entry to config-patches@gnu.org.
#
# 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:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# 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
$0 [OPTION] ALIAS
Canonicalize a configuration name.
Operation modes:
-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-2013 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"
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
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
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* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -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*)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
-mint | -mint[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 | ia64[nw] \
| ip2k | iq2000 \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* | ia64[nw]-* \
| ip2k-* | iq2000-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
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
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
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 | j90)
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
decsystem10* | dec10*)
basic_machine=pdp10-dec
os=-tops10
;;
decsystem20* | dec20*)
basic_machine=pdp10-dec
os=-tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
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
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe)
basic_machine=m68000-convergent
;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i386-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-unknown
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
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
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
;;
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
openrisc | openrisc-*)
basic_machine=or32-unknown
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
;;
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
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
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
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
;;
tile*)
basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
toad1)
basic_machine=pdp10-xkl
os=-tops20
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
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
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
;;
# 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)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp10)
# there are many clones, so DEC is not a safe bet
basic_machine=pdp10-unknown
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/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
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First 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* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
x86-* | i*86-*)
;;
*)
os=-nto$os
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-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
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
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 $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn)
os=-riscix1.2
;;
arm*-rebel)
os=-linux
;;
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
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
;;
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-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
;;
*-next)
os=-nextstep3
;;
*-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
;;
*)
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.
vendor=unknown
case $basic_machine 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
;;
-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
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
commons-daemon-1.0.15-src/src/native/unix/support/apfunctions.m4 100664 25140 25140 5776 11451572204 24415 0 ustar mturk mturk 0 0 dnl
dnl Licensed to the Apache Software Foundation (ASF) under one or more
dnl contributor license agreements. See the NOTICE file distributed with
dnl this work for additional information regarding copyright ownership.
dnl The ASF licenses this file to You under the Apache License, Version 2.0
dnl (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl
dnl http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl
dnl -------------------------------------------------------------------------
dnl Author Pier Fumagalli
dnl Version $Id: apfunctions.m4 1003756 2010-10-02 08:59:48Z mturk $
dnl -------------------------------------------------------------------------
AC_DEFUN(AP_MSG_HEADER,[
printf "*** %s ***\n" "$1" 1>&2
AC_PROVIDE([$0])
])
AC_DEFUN(AP_CANONICAL_HOST_CHECK,[
AC_MSG_CHECKING([cached host system type])
if { test x"${ac_cv_host_system_type+set}" = x"set" &&
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])
else
AC_MSG_RESULT(ok)
ac_cv_host_system_type="$host"
fi
AC_PROVIDE([$0])
])
dnl Iteratively interpolate the contents of the second argument
dnl until interpolation offers no new result. Then assign the
dnl final result to $1.
dnl
dnl Example:
dnl
dnl foo=1
dnl bar='${foo}/2'
dnl baz='${bar}/3'
dnl AP_EXPAND_VAR(fraz, $baz)
dnl $fraz is now "1/2/3"
dnl
AC_DEFUN([AP_EXPAND_VAR], [
ap_last=
ap_cur="$2"
while test "x${ap_cur}" != "x${ap_last}";
do
ap_last="${ap_cur}"
ap_cur=`eval "echo ${ap_cur}"`
done
$1="${ap_cur}"
])
dnl
dnl AP_CONFIG_NICE(filename)
dnl
dnl Saves a snapshot of the configure command-line for later reuse
dnl
AC_DEFUN([AP_CONFIG_NICE], [
rm -f $1
cat >$1<> $1
fi
if test -n "$CFLAGS"; then
echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1
fi
if test -n "$CPPFLAGS"; then
echo "CPPFLAGS=\"$CPPFLAGS\"; export CPPFLAGS" >> $1
fi
if test -n "$LDFLAGS"; then
echo "LDFLAGS=\"$LDFLAGS\"; export LDFLAGS" >> $1
fi
if test -n "$LIBS"; then
echo "LIBS=\"$LIBS\"; export LIBS" >> $1
fi
if test -n "$STRIPFLAGS"; then
echo "STRIPFLAGS=\"$STRIPFLAGS\"; export STRIPFLAGS" >> $1
fi
if test -n "$INCLUDES"; then
echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1
fi
# Retrieve command-line arguments.
eval "set x $[0] $ac_configure_args"
shift
for arg
do
AP_EXPAND_VAR(arg, $arg)
echo "\"[$]arg\" \\" >> $1
done
echo '"[$]@"' >> $1
chmod +x $1
])dnl
commons-daemon-1.0.15-src/src/native/unix/support/apsupport.m4 100664 25140 25140 12614 12124524436 24130 0 ustar mturk mturk 0 0 dnl
dnl Licensed to the Apache Software Foundation (ASF) under one or more
dnl contributor license agreements. See the NOTICE file distributed with
dnl this work for additional information regarding copyright ownership.
dnl The ASF licenses this file to You under the Apache License, Version 2.0
dnl (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl
dnl http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl
dnl -------------------------------------------------------------------------
dnl Author Pier Fumagalli
dnl Version $Id: apsupport.m4 1461438 2013-03-27 08:09:02Z mturk $
dnl -------------------------------------------------------------------------
AC_DEFUN(AP_SUPPORTED_HOST,[
AC_MSG_CHECKING([C flags dependant on host system type])
case $host_os in
darwin*)
CFLAGS="$CFLAGS -DOS_DARWIN -DDSO_DLFCN"
supported_os="darwin"
;;
solaris*)
CFLAGS="$CFLAGS -DOS_SOLARIS -DDSO_DLFCN"
supported_os="solaris"
LIBS="$LIBS -ldl -lthread"
;;
linux*)
CFLAGS="$CFLAGS -DOS_LINUX -DDSO_DLFCN"
supported_os="linux"
LIBS="$LIBS -ldl -lpthread"
;;
cygwin)
CFLAGS="$CFLAGS -DOS_CYGWIN -DDSO_DLFCN -DNO_SETSID"
supported_os="win32"
;;
sysv)
CFLAGS="$CFLAGS -DOS_SYSV -DDSO_DLFCN"
LIBS="$LIBS -ldl"
supported_os="sysv"
;;
sysv4)
CFLAGS="$CFLAGS -DOS_SYSV -DDSO_DLFCN -Kthread"
LDFLAGS="-Kthread $LDFLAGS"
LIBS="$LIBS -ldl"
supported_os="sysv4"
;;
freebsd*)
CFLAGS="$CFLAGS -DOS_FREEBSD -DDSO_DLFCN -D_THREAD_SAFE -pthread"
LDFLAGS="-pthread $LDFLAGS"
supported_os="freebsd"
;;
osf5*)
CFLAGS="$CFLAGS -pthread -DOS_TRU64 -DDSO_DLFCN -D_XOPEN_SOURCE_EXTENDED"
LDFLAGS="$LDFLAGS -pthread"
supported_os="osf5"
;;
hpux*)
CFLAGS="$CFLAGS -DOS_HPUX -DDSO_DLFCN"
supported_os="hp-ux"
host_os="hpux"
;;
aix5*)
CFLAGS="$CFLAGS -DOS_AIX -DDSO_DLFCN"
LDFLAGS="$LDFLAGS -ldl"
supported_os="aix5"
;;
*)
AC_MSG_RESULT([failed])
AC_MSG_ERROR([Unsupported operating system "$host_os"])
;;
esac
case $host_cpu in
powerpc)
CFLAGS="$CFLAGS -DCPU=\\\"$host_cpu\\\""
HOST_CPU=$host_cpu
;;
sparc*)
CFLAGS="$CFLAGS -DCPU=\\\"$host_cpu\\\""
HOST_CPU=$host_cpu
;;
i?86|x86)
CFLAGS="$CFLAGS -DCPU=\\\"i386\\\""
HOST_CPU=i386
;;
x86_64 | amd64)
CFLAGS="$CFLAGS -DCPU=\\\"amd64\\\""
HOST_CPU=amd64
;;
bs2000)
CFLAGS="$CFLAGS -DCPU=\\\"osd\\\" -DCHARSET_EBCDIC -DOSD_POSIX"
supported_os="osd"
LDFLAGS="-Kno_link_stdlibs -B llm4"
LIBS="$LIBS -lBLSLIB"
LDCMD="/opt/C/bin/cc"
HOST_CPU=osd
;;
mips)
CFLAGS="$CFLAGS -DCPU=\\\"mips\\\""
supported_os="mips"
HOST_CPU=mips
;;
alpha*)
CFLAGS="$CFLAGS -DCPU=\\\"alpha\\\""
supported_os="alpha"
HOST_CPU=alpha
;;
hppa2.0w|hppa64)
CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\" -DSO_EXT=\\\"sl\\\""
host_cpu=hppa2.0w
HOST_CPU=PA_RISC2.0W
;;
hppa2.0n|hppa32)
CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0N\\\" -DSO_EXT=\\\"sl\\\""
HOST_CPU=PA_RISC2.0N
;;
hppa2.0)
if test "$host_os" = "hpux"
then
host_cpu=hppa2.0w
HOST_CPU=PA_RISC2.0W
else
HOST_CPU=PA_RISC2.0
fi
CFLAGS="$CFLAGS -DCPU=\\\"$HOST_CPU\\\" -DSO_EXT=\\\"sl\\\""
;;
mipsel)
CFLAGS="$CFLAGS -DCPU=\\\"mipsel\\\""
supported_os="mipsel"
HOST_CPU=mipsel
;;
ia64w)
CFLAGS="$CFLAGS -DCPU=\\\"IA64W\\\" -DSO_EXT=\\\"so\\\""
HOST_CPU=IA64W
;;
ia64n)
CFLAGS="$CFLAGS -DCPU=\\\"IA64N\\\" -DSO_EXT=\\\"so\\\""
HOST_CPU=IA64N
;;
ia64)
if test "$host_os" = "hpux"
then
CFLAGS="$CFLAGS -DCPU=\\\"IA64W\\\" -DSO_EXT=\\\"so\\\""
host_cpu=ia64w
HOST_CPU=IA64W
else
CFLAGS="$CFLAGS -DCPU=\\\"ia64\\\""
HOST_CPU=ia64
fi
;;
s390)
CFLAGS="$CFLAGS -DCPU=\\\"s390\\\""
supported_os="s390"
HOST_CPU=s390
;;
arm*)
CFLAGS="$CFLAGS -DCPU=\\\"arm\\\""
supported_os="arm"
HOST_CPU=arm
;;
*)
AC_MSG_RESULT([failed])
AC_MSG_ERROR([Unsupported CPU architecture "$host_cpu"]);;
esac
if test "x$GCC" = "xyes"
then
case $host_os-$host_cpu in
hpux-ia64n)
CFLAGS="-milp32 -pthread $CFLAGS"
LDFLAGS="-milp32 -pthread $LDFLAGS"
LIBS="$LIBS -lpthread"
;;
hpux-ia64w)
CFLAGS="-mlp64 -pthread $CFLAGS"
LDFLAGS="-mlp64 -pthread $LDFLAGS"
LIBS="$LIBS -lpthread"
;;
hpux-*)
CFLAGS="-pthread $CFLAGS"
LDFLAGS="-pthread $LDFLAGS"
LIBS="$LIBS -lpthread"
;;
*)
;;
esac
else
case $host_os-$host_cpu in
hpux-ia64n|hpux-hppa2.0n)
CFLAGS="+DD32 -mt $CFLAGS"
LDFLAGS="+DD32 -mt $LDFLAGS"
;;
hpux-ia64w|hpux-hppa2.0w)
CFLAGS="+DD64 -mt $CFLAGS"
LDFLAGS="+DD64 -mt $LDFLAGS"
;;
hpux-*)
CFLAGS="-mt $CFLAGS"
LDFLAGS="-mt $LDFLAGS"
;;
*)
;;
esac
fi
AC_MSG_RESULT([ok])
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
])
commons-daemon-1.0.15-src/src/native/unix/support/apjava.m4 100664 25140 25140 5603 11654054033 23313 0 ustar mturk mturk 0 0 dnl
dnl Licensed to the Apache Software Foundation (ASF) under one or more
dnl contributor license agreements. See the NOTICE file distributed with
dnl this work for additional information regarding copyright ownership.
dnl The ASF licenses this file to You under the Apache License, Version 2.0
dnl (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl
dnl http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl
dnl -------------------------------------------------------------------------
dnl Author Pier Fumagalli
dnl Author Mladen Turk
dnl Version $Id: apjava.m4 1196262 2011-11-01 20:35:39Z mturk $
dnl -------------------------------------------------------------------------
AC_DEFUN([AP_FIND_JAVA],[
AC_ARG_WITH(java,[ --with-java=DIR Specify the location of your JDK installation],[
AC_MSG_CHECKING([JAVA_HOME])
if test -d "$withval"
then
JAVA_HOME="$withval"
AC_MSG_RESULT([$JAVA_HOME])
else
AC_MSG_RESULT([failed])
AC_MSG_ERROR([$withval is not a directory])
fi
AC_SUBST(JAVA_HOME)
])
if test "x$JAVA_HOME" = x
then
AC_MSG_CHECKING([for JDK location])
# Oh well, nobody set JAVA_HOME, have to guess
# Check if we have java in the PATH.
java_prog="`which java 2>/dev/null || true`"
if test "x$java_prog" != x
then
java_bin="`dirname $java_prog`"
java_top="`dirname $java_bin`"
if test -f "$java_top/include/jni.h"
then
JAVA_HOME="$java_top"
AC_MSG_RESULT([${java_top}])
fi
fi
fi
if test x"$JAVA_HOME" = x
then
AC_MSG_ERROR([Java Home not defined. Rerun with --with-java=[...] parameter])
fi
])
AC_DEFUN([AP_FIND_JAVA_OS],[
tempval=""
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"
then
AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval})
fi
JAVA_OS=$tempval
],
[
AC_MSG_CHECKING(for JDK os include directory)
JAVA_OS=NONE
if test -f $JAVA_HOME/$JAVA_INC/jni_md.h
then
JAVA_OS=""
else
for f in $JAVA_HOME/$JAVA_INC/*/jni_md.h
do
if test -f $f; then
JAVA_OS=`dirname $f`
JAVA_OS=`basename $JAVA_OS`
echo " $JAVA_OS"
break
fi
done
if test "x$JAVA_OS" = "xNONE"; then
AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS})
AC_MSG_ERROR(You should retry --with-os-type=SUBDIR)
fi
fi
])
])
commons-daemon-1.0.15-src/src/native/unix/Makefile.in 100664 25140 25140 2326 11451572204 22137 0 ustar mturk mturk 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.
#
# @author Pier Fumagalli
# @version $Id: Makefile.in 1003756 2010-10-02 08:59:48Z mturk $
SUBDIRS = native
all: native/all
native/all:
(cd native; $(MAKE) all)
clean:
(cd native; $(MAKE) clean)
distclean: clean
rm -f config.cache
rm -f config.log
rm -f config.status
rm -f config.nice
rm -f native/Makefile
rm -f Makefile
rm -f Makedefs
rm -rf autom4te.cache
realclean: distclean
rm -f configure
commons-daemon-1.0.15-src/src/native/unix/configure.in 100664 25140 25140 11761 12052621565 22431 0 ustar mturk mturk 0 0 dnl
dnl Licensed to the Apache Software Foundation (ASF) under one or more
dnl contributor license agreements. See the NOTICE file distributed with
dnl this work for additional information regarding copyright ownership.
dnl The ASF licenses this file to You under the Apache License, Version 2.0
dnl (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl
dnl http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl
dnl -------------------------------------------------------------------------
dnl Author Pier Fumagalli
dnl Version $Id: configure.in 1411560 2012-11-20 06:30:13Z mturk $
dnl -------------------------------------------------------------------------
dnl -------------------------------------------------------------------------
dnl Initialize AutoConf
dnl -------------------------------------------------------------------------
AC_PREREQ(2.53)
sinclude(./support/apfunctions.m4)dnl
sinclude(./support/apjava.m4)dnl
sinclude(./support/apsupport.m4)dnl
AC_INIT(configure.in)
AC_CONFIG_AUX_DIR(./support)
dnl Generate ./config.nice for reproducing runs of configure
dnl
AP_CONFIG_NICE(config.nice)
dnl -------------------------------------------------------------------------
dnl Check current host (forget about cross compilation) and validate it
dnl against the cache (fail if the cache differs)
dnl -------------------------------------------------------------------------
AP_MSG_HEADER([Current host])
AC_CANONICAL_HOST()
AP_CANONICAL_HOST_CHECK()
dnl -------------------------------------------------------------------------
dnl Check C environment
dnl -------------------------------------------------------------------------
AP_MSG_HEADER([C-Language compilation tools])
AC_PROG_CC()
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(STRIP, strip, :)
dnl -------------------------------------------------------------------------
dnl Check if this host is supported
dnl -------------------------------------------------------------------------
AP_MSG_HEADER([Host support])
AP_SUPPORTED_HOST()
if test "$supported_os" = "darwin"
then
if test -z "$JAVA_HOME" -a -x /usr/libexec/java_home
then
JAVA_HOME="`/usr/libexec/java_home 2>dev/null`"
fi
if test -z "$JAVA_HOME" -a -d /System/Library/Frameworks/JavaVM.framework/Home; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
fi
_prevdir=`/bin/pwd`
if test -n "$JAVA_HOME" -a -d "$JAVA_HOME/include"; then
cd "$JAVA_HOME/include"
elif test -n "$JAVA_HOME" -a -d "$JAVA_HOME/../Headers"; then
cd "$JAVA_HOME/../Headers"
else
cd /System/Library/Frameworks/JavaVM.framework/Headers
fi
INCLUDES="$INCLUDES -I`/bin/pwd -P`"
cd $_prevdir
unset _prevdir
fi
dnl -------------------------------------------------------------------------
dnl Check JAVA environment
dnl -------------------------------------------------------------------------
AP_MSG_HEADER([Java compilation tools])
AP_FIND_JAVA()
dnl MAC OS X does not used include but Headers
if test -d $JAVA_HOME/Headers
then
JAVA_INC=Headers
else
JAVA_INC=include
fi
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"
else
INCLUDES="$INCLUDES -I$JAVA_HOME/include -I$JAVA_HOME/include/$supported_os"
fi
dnl -------------------------------------------------------------------------
dnl Add gcc specific CFLAGS.
dnl -------------------------------------------------------------------------
if test "$GCC" = "yes"
then
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
AC_MSG_RESULT([gcc flags added])
fi
dnl -------------------------------------------------------------------------
dnl Add gcc specific CFLAGS.
dnl -------------------------------------------------------------------------
if test -z "$LDCMD"
then
LDCMD="$CC"
fi
AC_SUBST(LDCMD)
if test "$supported_os" = "linux"
then
AC_CHECK_HEADER([sys/capability.h],
[CFLAGS="$CFLAGS -DHAVE_LIBCAP"],
AC_MSG_WARN([cannot find headers for libcap]))
fi
if test -z "$STRIPFLAGS"
then
STRIP="@: "
else
STRIP="$STRIP $STRIPFLAGS"
fi
AC_SUBST(INCLUDES)
dnl -------------------------------------------------------------------------
dnl Random programs we need to compile locally
dnl -------------------------------------------------------------------------
AP_MSG_HEADER([Writing output files])
AC_OUTPUT(Makefile Makedefs native/Makefile)
dnl -------------------------------------------------------------------------
dnl Done
dnl -------------------------------------------------------------------------
AP_MSG_HEADER([All done])
AC_MSG_RESULT([Now you can issue "make"])
commons-daemon-1.0.15-src/src/native/unix/native/home.c 100664 25140 25140 20166 12057373030 22475 0 ustar mturk mturk 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.
*/
/* @version $Id: home.c 1416921 2012-12-04 13:09:44Z mturk $ */
#include "jsvc.h"
/* Check if a path is a directory */
static bool checkdir(char *path)
{
struct stat home;
if (path == NULL)
return (false);
if (stat(path, &home) != 0)
return (false);
if (S_ISDIR(home.st_mode))
return (true);
return (false);
}
/* Check if a path is a file */
static bool checkfile(char *path)
{
struct stat home;
if (path == NULL)
return (false);
if (stat(path, &home) != 0)
return (false);
if (S_ISREG(home.st_mode))
return (true);
return (false);
}
/* Parse a VM configuration file */
static bool parse(home_data *data)
{
FILE *cfgf = fopen(data->cfgf, "r");
char *ret = NULL, *sp;
char buf[1024];
if (cfgf == NULL) {
log_debug("Can't open %s\n", data->cfgf);
return (false);
}
data->jvms = (home_jvm **)malloc(256 * sizeof(home_jvm *));
while ((ret = fgets(buf, 1024, cfgf)) != NULL) {
char *tmp = strchr(ret, '#');
int pos;
/* Clear the string at the first occurrence of '#' */
if (tmp != NULL)
tmp[0] = '\0';
/* Trim the string (including leading '-' chars */
while ((ret[0] == ' ') || (ret[0] == '\t') || (ret[0] == '-'))
ret++;
pos = strlen(ret);
while (pos >= 0) {
if ((ret[pos] == '\r') || (ret[pos] == '\n') || (ret[pos] == '\t')
|| (ret[pos] == '\0') || (ret[pos] == ' ')) {
ret[pos--] = '\0';
}
else
break;
}
/* Format changed for 1.4 JVMs */
sp = strchr(ret, ' ');
if (sp != NULL)
*sp = '\0';
/* Did we find something significant? */
if (strlen(ret) > 0) {
char *libf = NULL;
int x = 0;
log_debug("Found VM %s definition in configuration", ret);
while (location_jvm_configured[x] != NULL) {
char *orig = location_jvm_configured[x];
char temp[1024];
char repl[1024];
int k;
k = replace(temp, 1024, orig, "$JAVA_HOME", data->path);
if (k != 0) {
log_error("Can't replace home in VM library (%d)", k);
return (false);
}
k = replace(repl, 1024, temp, "$VM_NAME", ret);
if (k != 0) {
log_error("Can't replace name in VM library (%d)", k);
return (false);
}
log_debug("Checking library %s", repl);
if (checkfile(repl)) {
libf = strdup(repl);
break;
}
x++;
}
if (libf == NULL) {
log_debug("Cannot locate library for VM %s (skipping)", ret);
}
else {
data->jvms[data->jnum] = (home_jvm *)malloc(sizeof(home_jvm));
data->jvms[data->jnum]->name = strdup(ret);
data->jvms[data->jnum]->libr = libf;
data->jnum++;
data->jvms[data->jnum] = NULL;
}
}
}
return (true);
}
/* Build a Java Home structure for a path */
static home_data *build(char *path)
{
home_data *data = NULL;
char *cfgf = NULL;
char buf[1024];
int x = 0;
int k = 0;
if (path == NULL)
return (NULL);
log_debug("Attempting to locate Java Home in %s", path);
if (checkdir(path) == false) {
log_debug("Path %s is not a directory", path);
return (NULL);
}
while (location_jvm_cfg[x] != NULL) {
if ((k =
replace(buf, 1024, location_jvm_cfg[x], "$JAVA_HOME",
path)) != 0) {
log_error("Error replacing values for jvm.cfg (%d)", k);
return (NULL);
}
log_debug("Attempting to locate VM configuration file %s", buf);
if (checkfile(buf) == true) {
log_debug("Found VM configuration file at %s", buf);
cfgf = strdup(buf);
break;
}
x++;
}
data = (home_data *)malloc(sizeof(home_data));
data->path = strdup(path);
data->cfgf = cfgf;
data->jvms = NULL;
data->jnum = 0;
/* We don't have a jvm.cfg configuration file, so all we have to do is
trying to locate the "default" Java Virtual Machine library */
if (cfgf == NULL) {
log_debug("VM configuration file not found");
x = 0;
while (location_jvm_default[x] != NULL) {
char *libr = location_jvm_default[x];
if ((k = replace(buf, 1024, libr, "$JAVA_HOME", path)) != 0) {
log_error("Error replacing values for JVM library (%d)", k);
return (NULL);
}
log_debug("Attempting to locate VM library %s", buf);
if (checkfile(buf) == true) {
data->jvms = (home_jvm **)malloc(2 * sizeof(home_jvm *));
data->jvms[0] = (home_jvm *)malloc(sizeof(home_jvm));
data->jvms[0]->name = NULL;
data->jvms[0]->libr = strdup(buf);
data->jvms[1] = NULL;
data->jnum = 1;
return (data);
}
x++;
}
return (data);
}
/* If we got here, we most definitely found a jvm.cfg file */
if (parse(data) == false) {
log_error("Cannot parse VM configuration file %s", data->cfgf);
}
return (data);
}
/* Find the Java Home */
static home_data *find(char *path)
{
home_data *data = NULL;
int x = 0;
if (path == NULL || *path == '\0' || strcmp(path, "/") == 0) {
log_debug("Home not specified on command line, using environment");
path = getenv("JAVA_HOME");
if (path == NULL || *path == '\0' || strcmp(path, "/") == 0) {
/* guard against empty JAVA_HOME */
path = NULL;
}
}
if (path == NULL) {
log_debug("Home not on command line or in environment, searching");
while (location_home[x] != NULL) {
if ((data = build(location_home[x])) != NULL) {
log_debug("Java Home located in %s", data->path);
return (data);
}
x++;
}
}
else {
if ((data = build(path)) != NULL) {
log_debug("Java Home located in %s", data->path);
return (data);
}
}
return (NULL);
}
/* Main entry point: locate home and dump structure */
home_data *home(char *path)
{
home_data *data = find(path);
int x = 0;
if (data == NULL) {
log_error("Cannot locate Java Home");
return (NULL);
}
if (log_debug_flag == true) {
log_debug("+-- DUMPING JAVA HOME STRUCTURE ------------------------");
log_debug("| Java Home: \"%s\"", PRINT_NULL(data->path));
log_debug("| Java VM Config.: \"%s\"", PRINT_NULL(data->cfgf));
log_debug("| Found JVMs: %d", data->jnum);
for (x = 0; x < data->jnum; x++) {
home_jvm *jvm = data->jvms[x];
log_debug("| JVM Name: \"%s\"", PRINT_NULL(jvm->name));
log_debug("| \"%s\"", PRINT_NULL(jvm->libr));
}
log_debug("+-------------------------------------------------------");
}
return (data);
}
commons-daemon-1.0.15-src/src/native/unix/native/java.h 100664 25140 25140 2453 11571735170 22461 0 ustar mturk mturk 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.
*/
/* @version $Id: java.h 1130635 2011-06-02 16:29:44Z mturk $ */
#ifndef __JSVC_JAVA_H__
#define __JSVC_JAVA_H__
#define LOADER "org/apache/commons/daemon/support/DaemonLoader"
char *java_library(arg_data *args, home_data *data);
bool java_init(arg_data *args, home_data *data);
bool java_destroy(void);
bool java_load(arg_data *args);
bool java_signal(void);
bool java_start(void);
bool java_stop(void);
bool java_version(void);
bool java_check(arg_data *args);
bool JVM_destroy(int exit);
#endif /* __JSVC_JAVA_H__ */
commons-daemon-1.0.15-src/src/native/unix/native/.indent.pro 100664 25140 25140 157 11346135062 23421 0 ustar mturk mturk 0 0 -i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 -nut -ncs
-Tbool
-Targ_data
-Thome_data
-Thome_jvm
-Tdso_handle
commons-daemon-1.0.15-src/src/native/unix/native/Makefile.in 100664 25140 25140 2523 11457755413 23437 0 ustar mturk mturk 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.
#
# @author Pier Fumagalli
# @version $Id: Makefile.in 1025844 2010-10-21 06:17:47Z mturk $
include ../Makedefs
OBJS = arguments.o \
debug.o \
dso-dlfcn.o \
dso-dyld.o \
help.o \
home.o \
java.o \
location.o \
replace.o \
locks.o \
signals.o
all: jsvc libservice.a
libservice.a: $(OBJS)
ar cr libservice.a $(OBJS)
$(RANLIB) libservice.a
jsvc: jsvc-unix.o libservice.a
$(LDCMD) $(LDFLAGS) $(EXTRA_LDFLAGS) jsvc-unix.o libservice.a $(LIBS) -o ../jsvc
$(STRIP) ../jsvc
clean:
rm -f $(OBJS) ../jsvc jsvc-unix.o libservice.a
commons-daemon-1.0.15-src/src/native/unix/native/debug.c 100664 25140 25140 4700 11655531734 22621 0 ustar mturk mturk 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.
*/
/* @version $Id: debug.c 1198399 2011-11-06 16:20:44Z mturk $ */
#include "jsvc.h"
#include
#include
#include
/* Wether debug is enabled or not */
bool log_debug_flag = false;
/* Wether SYSLOG logging (for stderr) is enable or not. */
bool log_stderr_syslog_flag = false;
/* Wether SYSLOG logging (for stdout) is enable or not. */
bool log_stdout_syslog_flag = false;
/* The name of the jsvc binary. */
char *log_prog = "jsvc";
/* Dump a debug trace message to stderr */
void log_debug(const char *fmt, ...)
{
va_list ap;
time_t now;
struct tm *nowtm;
char buff[80];
if (log_debug_flag == false)
return;
if (fmt == NULL)
return;
now = time(NULL);
nowtm = localtime(&now);
strftime(buff, sizeof(buff), "%Y-%m-%d %T", nowtm);
va_start(ap, fmt);
if (log_stderr_syslog_flag)
fprintf(stderr, "%s %d %s debug: ", buff, getpid(), log_prog);
#if defined(DEBUG) || defined(_DEBUG)
else
fprintf(stderr, "[debug] %s %d ", buff, getpid());
#endif
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
fflush(stderr);
va_end(ap);
}
/* Dump an error message to stderr */
void log_error(const char *fmt, ...)
{
va_list ap;
time_t now;
struct tm *nowtm;
char buff[80];
if (fmt == NULL)
return;
va_start(ap, fmt);
if (log_stderr_syslog_flag) {
now = time(NULL);
nowtm = localtime(&now);
strftime(buff, sizeof(buff), "%Y-%m-%d %T", nowtm);
fprintf(stderr, "%s %d %s error: ", buff, getpid(), log_prog);
}
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
fflush(stderr);
va_end(ap);
}
commons-daemon-1.0.15-src/src/native/unix/native/signals.h 100664 25140 25140 2161 11346137764 23201 0 ustar mturk mturk 0 0 /*
Copyright 2001-2004 The Apache Software Foundation.
Licensed 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.
*/
/* @version $Id$ */
#ifndef __JSVC_SIGNALS_H__
#define __JSVC_SIGNALS_H__
/*
* as Windows does not support signal, jsvc use event to emulate them.
* The supported signal is SIGTERM.
*/
#ifdef OS_CYGWIN
/*
* set a routine handler for the signal
* note that it cannot be used to change the signal handler
* @param func The function to call on termination
* @return Zero on success, a value less than 0 if an error was encountered
*/
int SetTerm(void (*func) (void));
#endif
#endif /* ifndef __JSVC_SIGNALS_H__ */
commons-daemon-1.0.15-src/src/native/unix/native/home.h 100664 25140 25140 2677 11346137764 22505 0 ustar mturk mturk 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.
*/
/* @version $Id: home.h 921765 2010-03-11 10:03:32Z mturk $ */
#ifndef __JSVC_HOME_H__
#define __JSVC_HOME_H__
typedef struct home_jvm home_jvm;
typedef struct home_data home_data;
struct home_jvm
{
char *name;
char *libr;
};
struct home_data
{
char *path;
char *cfgf;
home_jvm **jvms;
int jnum;
};
/**
* Attempt to locate a Java Home directory and build its structure.
*
* @param path The java home path specified on the command line.
* @return A home_data structure containing all informations related to
* the Java environment, or NULL if no home was found.
*/
home_data *home(char *path);
#endif /* ifndef __JSVC_HOME_H__ */
commons-daemon-1.0.15-src/src/native/unix/native/dso-dyld.c 100664 25140 25140 10502 11346137764 23271 0 ustar mturk mturk 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.
*/
/* @version $Id: dso-dyld.c 921765 2010-03-11 10:03:32Z mturk $ */
#include "jsvc.h"
#ifdef DSO_DYLD
#include
#ifdef __bool_true_false_are_defined
/* We define these differently than stdbool.h, so ignore the defs there */
#undef bool
#undef true
#undef false
#endif
/* Print an error message and abort all if a specified symbol wasn't found */
static void nosymbol(const char *s)
{
log_error("Cannot find symbol '%s' in library", s);
abort();
}
/* We found two symbols for the same name in two different modules */
static NSModule multiple(NSSymbol s, NSModule om, NSModule nm)
{
NSModule ret = nm;
log_debug("Symbol \"%s\" found in modules \"%s\" and \"%s\" (using %s)",
NSNameOfSymbol(s), NSNameOfModule(om), NSNameOfModule(nm),
NSNameOfModule(ret));
return (ret);
}
/* We got an error while linking a module, and if it's not a warning we have
to abort the whole program */
static void linkedit(NSLinkEditErrors category, int number, const char *file,
const char *message)
{
log_error("Errors during link edit of file \"%s\" (error=%d): %s", file,
number, message);
/* Check if this error was only a warning */
if (category != NSLinkEditWarningError) {
log_error("Cannot continue");
abort();
}
}
/* Initialize all DSO stuff */
bool dso_init()
{
NSLinkEditErrorHandlers h;
h.undefined = nosymbol;
h.multiple = multiple;
h.linkEdit = linkedit;
NSInstallLinkEditErrorHandlers(&h);
return (true);
}
/* Attempt to link a library from a specified filename */
dso_handle dso_link(const char *path)
{
/* We need to load the library publically as NSModuleFileImage is not
yet implemented (at least for non MH_BUNDLE libraries */
if (NSAddLibrary(path) != TRUE)
return (NULL);
/* We need to return a non-null value, even if it has no meaning. One day
this whole crap will be fixed */
return ((void *)!NULL);
}
/* Attempt to unload a library */
bool dso_unlink(dso_handle libr)
{
/* Check the handle */
if (libr == NULL) {
log_error("Attempting to unload a module without handle");
return (false);
}
/* We don't have a module, so, we don't really have to do anything */
return (true);
}
/* Get the address for a specifed symbol */
void *dso_symbol(dso_handle hdl, const char *nam)
{
NSSymbol sym = NULL;
NSModule mod = NULL;
char *und = NULL;
void *add = NULL;
int x = 0;
/* Check parameters */
if (hdl == NULL) {
log_error("Invalid library handler specified");
return (NULL);
}
if (nam == NULL) {
log_error("Invalid symbol name specified");
return (NULL);
}
/* Process the correct name (add a _ before the name) */
while (nam[x] != '\0')
x++;
und = (char *)malloc(sizeof(char) * (x + 2));
while (x >= 0)
und[x + 1] = nam[x--];
und[0] = '_';
/* Find the symbol */
sym = NSLookupAndBindSymbol(und);
free(und);
if (sym == NULL)
return (NULL);
/* Dump some debugging output since this part is shaky */
mod = NSModuleForSymbol(sym);
add = NSAddressOfSymbol(sym);
log_debug("Symbol \"%s\" found in module \"%s\" at address \"0x%08X\"",
NSNameOfSymbol(sym), NSNameOfModule(mod), add);
/* We want to return the address of the symbol */
return (add);
}
/* Return the error message from dlopen: Well we already print it */
char *dso_error()
{
return ("no additional message");
}
#endif /* ifdef DSO_DYLD */
commons-daemon-1.0.15-src/src/native/unix/native/location.c 100664 25140 25140 15423 12115615667 23367 0 ustar mturk mturk 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.
*/
/* @version $Id: location.c 1453272 2013-03-06 10:34:31Z mturk $ */
#include "jsvc.h"
/* Locations of various JVM files. We have to deal with all this madness since
* we're not distributed togheter (yet!) with an official VM distribution. All
* this CRAP needs improvement, and based on the observation of default
* distributions of VMs and OSes. If it doesn't work for you, please report
* your VM layout (ls -laR) and system details (build/config.guess) so that we
* can improve the search algorithms.
*/
/* If JAVA_HOME is not defined we search this list of paths (OS-dependant)
* to find the default location of the JVM.
*/
char *location_home[] = {
#if defined(OS_DARWIN)
"/System/Library/Frameworks/JavaVM.framework/Home",
"/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/",
#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD)
"/usr/java/default",
"/usr/java",
"/usr/local/java",
"/usr/lib/jvm/default-java",
"/usr/lib/jvm/java",
"/etc/alternatives/java_sdk",
"/etc/alternatives/java_sdk_openjdk",
"/etc/alternatives/jre",
#if defined(__LP64__)
"/lib64/jvm/java",
"/lib64/jvm/java-openjdk",
#endif
"/lib/jvm/java",
"/lib/jvm/java-openjdk",
#elif defined(OS_CYGWIN)
"/cygdrive/c/WINNT/system32/java",
#elif defined(OS_SYSV)
"/opt/java",
"/opt/java/jdk13",
#elif defined(OS_TRU64)
"/usr/opt/java142",
"/usr/opt/java13",
#elif defined(OS_HPUX)
"/opt/java6",
"/opt/java1.5",
"/opt/java1.4",
"/opt/java1.3",
#endif
NULL,
};
/* The jvm.cfg file defines the VMs available for invocation. So far, on all
* all systems I've seen it's in $JAVA_HOME/lib. If this file is not found,
* then the "default" VMs (from location_jvm_default) is searched, otherwise,
* we're going to look thru the "configured" VMs (from lod_cfgvm) lying
* somewhere around JAVA_HOME. (Only two, I'm happy)
*/
char *location_jvm_cfg[] = {
"$JAVA_HOME/jre/lib/jvm.cfg", /* JDK */
"$JAVA_HOME/lib/jvm.cfg", /* JRE */
"$JAVA_HOME/jre/lib/" CPU "/jvm.cfg", /* JDK */
"$JAVA_HOME/lib/" CPU "/jvm.cfg", /* JRE */
NULL,
};
/* This is the list of "defaults" VM (searched when jvm.cfg is not found, as
* in the case of most JDKs 1.2.2
*/
char *location_jvm_default[] = {
#if defined(OS_DARWIN)
"$JAVA_HOME/../Libraries/libjvm.dylib",
"$JAVA_HOME/jre/lib/server/libjvm.dylib",
"$JAVA_HOME/jre/lib/client/libjvm.dylib",
#elif defined(OS_CYGWIN)
"$JAVA_HOME/jre/bin/classic/jvm.dll", /* Sun JDK 1.3 */
"$JAVA_HOME/jre/bin/client/jvm.dll", /* Sun JDK 1.4 */
#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_SYSV) || defined(OS_FREEBSD) || defined(OS_TRU64)
"$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.so", /* Sun JDK 1.2 */
"$JAVA_HOME/jre/lib/" CPU "/server/libjvm.so", /* Sun JDK 1.4 */
"$JAVA_HOME/jre/lib/" CPU "/client/libjvm.so", /* Sun JDK 1.3 */
"$JAVA_HOME/jre/lib/" CPU "/libjvm.so", /* Sun JDK */
"$JAVA_HOME/lib/" CPU "/classic/libjvm.so", /* Sun JRE 1.2 */
"$JAVA_HOME/lib/" CPU "/server/libjvm.so", /* Sun JRE 1.4 */
"$JAVA_HOME/lib/" CPU "/client/libjvm.so", /* Sun JRE 1.3 */
"$JAVA_HOME/lib/" CPU "/libjvm.so", /* Sun JRE */
"$JAVA_HOME/jre/bin/" CPU "/classic/libjvm.so", /* IBM JDK 1.3 */
"$JAVA_HOME/jre/bin/" CPU "/libjvm.so", /* IBM JDK */
"$JAVA_HOME/bin/" CPU "/classic/libjvm.so", /* IBM JRE 1.3 */
"$JAVA_HOME/bin/" CPU "/libjvm.so", /* IBM JRE */
/* Those are "weirdos: if we got here, we're probably in troubles and
* we're not going to find anything, but hope never dies...
*/
"$JAVA_HOME/jre/lib/" CPU "/classic/green_threads/libjvm.so",
#if defined(OSD_POSIX)
"$JAVA_HOME/lib/s390/client/green_threads/libjvm.so",
"$JAVA_HOME/lib/sparc/client/green_threads/libjvm.so",
#endif
"$JAVA_HOME/jre/lib/classic/libjvm.so",
"$JAVA_HOME/jre/lib/client/libjvm.so",
"$JAVA_HOME/jre/lib/libjvm.so",
"$JAVA_HOME/lib/classic/libjvm.so",
"$JAVA_HOME/lib/client/libjvm.so",
"$JAVA_HOME/lib/libjvm.so",
"$JAVA_HOME/jre/bin/classic/libjvm.so",
"$JAVA_HOME/jre/bin/client/libjvm.so",
"$JAVA_HOME/jre/bin/libjvm.so",
"$JAVA_HOME/bin/classic/libjvm.so",
"$JAVA_HOME/bin/client/libjvm.so",
"$JAVA_HOME/bin/libjvm.so",
"$JAVA_HOME/jre/lib/" CPU "/fast64/libjvm.so",
"$JAVA_HOME/jre/lib/" CPU "/fast32/libjvm.so",
"$JAVA_HOME/lib/" CPU "/fast64/libjvm.so",
"$JAVA_HOME/lib/" CPU "/fast32/libjvm.so",
#elif defined(OS_HPUX)
"$JAVA_HOME/jre/lib/" CPU "/server/libjvm." SO_EXT,
"$JAVA_HOME/jre/lib/" CPU "/client/libjvm." SO_EXT,
"$JAVA_HOME/jre/lib/" CPU "/hotspot/libjvm." SO_EXT,
"$JAVA_HOME/jre/lib/" CPU "/classic/libjvm." SO_EXT,
#endif
"/usr/lib/libgcj.so.7", /* gcc java libraries */
"/usr/lib/libgcj.so.6",
NULL,
};
/* This is the list of "configured" VM (searched when jvm.cfg is found, as
* in the case of most JDKs 1.3 (not IBM, for example), way easier than
* before, and lovely, indeed...
*/
char *location_jvm_configured[] = {
#if defined(OS_DARWIN)
"$JAVA_HOME/../Libraries/lib$VM_NAME.dylib",
#elif defined(OS_CYGWIN)
"$JAVA_HOME/jre/bin/$VM_NAME/jvm.dll", /* Sun JDK 1.3 */
#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_FREEBSD) || defined(OS_TRU64)
"$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.so", /* Sun JDK 1.3 */
"$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.so", /* Sun JRE 1.3 */
#elif defined(OS_HPUX)
"$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm." SO_EXT,
"$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm." SO_EXT,
#elif defined(OS_SYSV)
"$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/dce_threads/libjvm.so",
"$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/green_threads/libjvm.so",
"$JAVA_HOME/lib/" CPU "/$VM_NAME/dce_threads/libjvm.so",
"$JAVA_HOME/lib/" CPU "/$VM_NAME/green_threads/libjvm.so",
#endif
NULL,
};
commons-daemon-1.0.15-src/src/native/unix/native/debug.h 100664 25140 25140 3447 11426521756 22634 0 ustar mturk mturk 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.
*/
/* @version $Id: debug.h 982549 2010-08-05 11:43:42Z mturk $ */
#ifndef __JSVC_DEBUG_H__
#define __JSVC_DEBUG_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* Wether debugging is enabled or not.
*/
extern bool log_debug_flag;
/* Wether SYSLOG logging (for stderr) is enable or not. */
extern bool log_stderr_syslog_flag;
/* Wether SYSLOG logging (for stdout) is enable or not. */
extern bool log_stdout_syslog_flag;
/**
* The name of the jsvc binary.
*/
extern char *log_prog;
/**
* Helper macro to avoid NPEs in printf.
*/
#define PRINT_NULL(x) ((x) == NULL ? "null" : (x))
/**
* Dump a debug message.
*
* @param fmt The printf style message format.
* @param ... Any optional parameter for the message.
*/
void log_debug(const char *fmt, ...);
/**
* Dump an error message.
*
* @param fmt The printf style message format.
* @param ... Any optional parameter for the message.
*/
void log_error(const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif /* ifndef __JSVC_DEBUG_H__ */
commons-daemon-1.0.15-src/src/native/unix/native/java.c 100664 25140 25140 44202 11654161013 22461 0 ustar mturk mturk 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.
*/
/* @version $Id: java.c 1196468 2011-11-02 06:24:11Z mturk $ */
#include "jsvc.h"
#ifdef OS_CYGWIN
typedef long long __int64;
#endif
#include
#include
#ifdef CHARSET_EBCDIC
#ifdef OSD_POSIX
#include
#define jsvc_xlate_to_ascii(b) _e2a(b)
#define jsvc_xlate_from_ascii(b) _a2e(b)
#endif
#else
#define jsvc_xlate_to_ascii(b) /* NOOP */
#define jsvc_xlate_from_ascii(b) /* NOOP */
#endif
static JavaVM *jvm = NULL;
static JNIEnv *env = NULL;
static jclass cls = NULL;
#define FALSE 0
#define TRUE !FALSE
static void shutdown(JNIEnv *env, jobject source, jboolean reload)
{
log_debug("Shutdown requested (reload is %d)", reload);
if (reload == TRUE)
main_reload();
else
main_shutdown();
}
static void failed(JNIEnv *env, jobject source, jstring message)
{
if (message) {
const char *msg = (*env)->GetStringUTFChars(env, message, NULL);
log_error("Failed %s", msg ? msg : "(null)");
if (msg)
(*env)->ReleaseStringUTFChars(env, message, msg);
}
else
log_error("Failed requested");
main_shutdown();
}
/* Automatically restart when the JVM crashes */
static void java_abort123(void)
{
exit(123);
}
char *java_library(arg_data *args, home_data *data)
{
char *libf = NULL;
/* Did we find ANY virtual machine? */
if (data->jnum == 0) {
log_error("Cannot find any VM in Java Home %s", data->path);
return NULL;
}
/* Select the VM */
if (args->name == NULL) {
libf = data->jvms[0]->libr;
log_debug("Using default JVM in %s", libf);
}
else {
int x;
for (x = 0; x < data->jnum; x++) {
if (data->jvms[x]->name == NULL)
continue;
if (strcmp(args->name, data->jvms[x]->name) == 0) {
libf = data->jvms[x]->libr;
log_debug("Using specific JVM in %s", libf);
break;
}
}
if (libf == NULL) {
log_error("Invalid JVM name specified %s", args->name);
return NULL;
}
}
return libf;
}
typedef jint (*jvm_create_t)(JavaVM **, JNIEnv **, JavaVMInitArgs *);
bool java_signal(void)
{
jmethodID method;
jboolean ret;
char start[] = "signal";
char startparams[] = "()Z";
jsvc_xlate_to_ascii(start);
jsvc_xlate_to_ascii(startparams);
method = (*env)->GetStaticMethodID(env, cls, start, startparams);
if (method == NULL) {
(*env)->ExceptionClear(env);
log_error("Cannot find DaemonLoader \"signal\" method");
return false;
}
ret = (*env)->CallStaticBooleanMethod(env, cls, method);
/* Clear any pending exception
* so we can continue calling native methods
*/
(*env)->ExceptionClear(env);
log_debug("Daemon signal method returned %s", ret ? "true" : "false");
return ret;
}
/* Initialize the JVM and its environment, loading libraries and all */
bool java_init(arg_data *args, home_data *data)
{
#ifdef OS_DARWIN
dso_handle apph = NULL;
char appf[1024];
struct stat sb;
#endif /* ifdef OS_DARWIN */
jvm_create_t symb = NULL;
JNINativeMethod nativemethods[2];
JavaVMOption *opt = NULL;
dso_handle libh = NULL;
JavaVMInitArgs arg;
char *libf = NULL;
jint ret;
int x;
char loaderclass[] = LOADER;
char shutdownmethod[] = "shutdown";
char shutdownparams[] = "(Z)V";
char failedmethod[] = "failed";
char failedparams[] = "(Ljava/lang/String;)V";
char daemonprocid[64];
/* Decide WHAT virtual machine we need to use */
libf = java_library(args, data);
if (libf == NULL) {
log_error("Cannot locate JVM library file");
return false;
}
/* Initialize the DSO library */
if (dso_init() != true) {
log_error("Cannot initialize the dynamic library loader");
return false;
}
/* Load the JVM library */
#if !defined(OSD_POSIX)
libh = dso_link(libf);
if (libh == NULL) {
log_error("Cannot dynamically link to %s", libf);
log_error("%s", dso_error());
return false;
}
log_debug("JVM library %s loaded", libf);
#endif
#ifdef OS_DARWIN
/*
MacOS/X actually has two libraries, one with the REAL vm, and one for
the VM startup.
before JVM 1.4.1 The first one (libappshell.dyld) contains CreateVM
JVM 1.4.1 through 1.5.* The library name is libjvm_compat.dylib
starting with JVM 1.6 on OS X 10.6 the library name is libverify.dylib.
*/
if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libappshell.dylib",
"$JAVA_HOME", data->path) != 0) {
log_error("Cannot replace values in loader library");
return false;
}
if (stat(appf, &sb)) {
if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libjvm_compat.dylib",
"$JAVA_HOME", data->path) != 0) {
log_error("Cannot replace values in loader library");
return false;
}
}
if (stat(appf, &sb)) {
if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libverify.dylib",
"$JAVA_HOME", data->path) != 0) {
log_error("Cannot replace values in loader library");
return false;
}
}
apph = dso_link(appf);
if (apph == NULL) {
log_error("Cannot load required shell library %s", appf);
return false;
}
log_debug("Shell library %s loaded", appf);
#endif /* ifdef OS_DARWIN */
#if defined(OSD_POSIX)
/* BS2000 does not allow to call JNI_CreateJavaVM indirectly */
#else
symb = (jvm_create_t)dso_symbol(libh, "JNI_CreateJavaVM");
if (symb == NULL) {
#ifdef OS_DARWIN
symb = (jvm_create_t)dso_symbol(apph, "JNI_CreateJavaVM");
if (symb == NULL) {
#endif /* ifdef OS_DARWIN */
log_error("Cannot find JVM library entry point");
return false;
#ifdef OS_DARWIN
}
#endif /* ifdef OS_DARWIN */
}
log_debug("JVM library entry point found (0x%08X)", symb);
#endif
/* Prepare the VM initialization arguments */
/*
* Mac OS X Java will load JVM 1.3.1 instead of 1.4.2 if JNI_VERSION_1_2
* is specified. So use JNI_VERSION_1_4 if we can.
*/
#if defined(JNI_VERSION_1_4)
arg.version = JNI_VERSION_1_4;
#else
arg.version = JNI_VERSION_1_2;
#endif
#if defined(OSD_POSIX)
if (JNI_GetDefaultJavaVMInitArgs(&arg) < 0) {
log_error("Cannot init default JVM default args");
return false;
}
#endif
arg.ignoreUnrecognized = FALSE;
arg.nOptions = args->onum + 4; /* pid, ppid and abort */
opt = (JavaVMOption *) malloc(arg.nOptions * sizeof(JavaVMOption));
for (x = 0; x < args->onum; x++) {
opt[x].optionString = strdup(args->opts[x]);
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x].extraInfo = NULL;
}
/* Add our daemon process id */
snprintf(daemonprocid, sizeof(daemonprocid),
"-Dcommons.daemon.process.id=%d", (int)getpid());
opt[x].optionString = strdup(daemonprocid);
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x++].extraInfo = NULL;
snprintf(daemonprocid, sizeof(daemonprocid),
"-Dcommons.daemon.process.parent=%d", (int)getppid());
opt[x].optionString = strdup(daemonprocid);
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x++].extraInfo = NULL;
snprintf(daemonprocid, sizeof(daemonprocid),
"-Dcommons.daemon.version=%s", JSVC_VERSION_STRING);
opt[x].optionString = strdup(daemonprocid);
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x++].extraInfo = NULL;
opt[x].optionString = strdup("abort");
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x].extraInfo = (void *)java_abort123;
arg.options = opt;
/* Do some debugging */
if (log_debug_flag == true) {
log_debug("+-- DUMPING JAVA VM CREATION ARGUMENTS -----------------");
log_debug("| Version: %#08x", arg.version);
log_debug("| Ignore Unrecognized Arguments: %s",
arg.ignoreUnrecognized == TRUE ? "True" : "False");
log_debug("| Extra options: %d", args->onum);
for (x = 0; x < args->onum; x++) {
jsvc_xlate_from_ascii(opt[x].optionString);
log_debug("| \"%s\" (0x%08x)", opt[x].optionString,
opt[x].extraInfo);
jsvc_xlate_to_ascii(opt[x].optionString);
}
log_debug("+-------------------------------------------------------");
log_debug("| Internal options: %d", arg.nOptions - args->onum);
for (; x < arg.nOptions; x++) {
jsvc_xlate_from_ascii(opt[x].optionString);
log_debug("| \"%s\" (0x%08x)", opt[x].optionString,
opt[x].extraInfo);
jsvc_xlate_to_ascii(opt[x].optionString);
}
log_debug("+-------------------------------------------------------");
}
/* And finally create the Java VM */
#if defined(OSD_POSIX)
ret = JNI_CreateJavaVM(&jvm, &env, &arg);
#else
ret = (*symb) (&jvm, &env, &arg);
#endif
if (ret < 0) {
log_error("Cannot create Java VM");
return false;
}
log_debug("Java VM created successfully");
jsvc_xlate_to_ascii(loaderclass);
cls = (*env)->FindClass(env, loaderclass);
jsvc_xlate_from_ascii(loaderclass);
if (cls == NULL) {
log_error("Cannot find daemon loader %s", loaderclass);
return false;
}
log_debug("Class %s found", loaderclass);
jsvc_xlate_to_ascii(shutdownmethod);
nativemethods[0].name = shutdownmethod;
jsvc_xlate_to_ascii(shutdownparams);
nativemethods[0].signature = shutdownparams;
nativemethods[0].fnPtr = (void *)shutdown;
jsvc_xlate_to_ascii(failedmethod);
nativemethods[1].name = failedmethod;
jsvc_xlate_to_ascii(failedparams);
nativemethods[1].signature = failedparams;
nativemethods[1].fnPtr = (void *)failed;
if ((*env)->RegisterNatives(env, cls, nativemethods, 2) != 0) {
log_error("Cannot register native methods");
return false;
}
log_debug("Native methods registered");
return true;
}
/* Destroy the Java VM */
bool JVM_destroy(int exit)
{
jclass system = NULL;
jmethodID method;
char System[] = "java/lang/System";
char exitclass[] = "exit";
char exitparams[] = "(I)V";
jsvc_xlate_to_ascii(System);
system = (*env)->FindClass(env, System);
jsvc_xlate_from_ascii(System);
if (system == NULL) {
log_error("Cannot find class %s", System);
return false;
}
jsvc_xlate_to_ascii(exitclass);
jsvc_xlate_to_ascii(exitparams);
method = (*env)->GetStaticMethodID(env, system, exitclass, exitparams);
if (method == NULL) {
log_error("Cannot find \"System.exit(int)\" entry point");
return false;
}
log_debug("Calling System.exit(%d)", exit);
(*env)->CallStaticVoidMethod(env, system, method, (jint) exit);
/* We shouldn't get here, but just in case... */
log_debug("Destroying the Java VM");
if ((*jvm)->DestroyJavaVM(jvm) != 0)
return false;
log_debug("Java VM destroyed");
return true;
}
/* Call the load method in our DaemonLoader class */
bool java_load(arg_data *args)
{
jclass stringClass = NULL;
jstring className = NULL;
jstring currentArgument = NULL;
jobjectArray stringArray = NULL;
jmethodID method = NULL;
jboolean ret = FALSE;
int x;
char lang[] = "java/lang/String";
char load[] = "load";
char loadparams[] = "(Ljava/lang/String;[Ljava/lang/String;)Z";
jsvc_xlate_to_ascii(args->clas);
className = (*env)->NewStringUTF(env, args->clas);
jsvc_xlate_from_ascii(args->clas);
if (className == NULL) {
log_error("Cannot create string for class name");
return false;
}
jsvc_xlate_to_ascii(lang);
stringClass = (*env)->FindClass(env, lang);
if (stringClass == NULL) {
log_error("Cannot find class java/lang/String");
return false;
}
stringArray = (*env)->NewObjectArray(env, args->anum, stringClass, NULL);
if (stringArray == NULL) {
log_error("Cannot create arguments array");
return false;
}
for (x = 0; x < args->anum; x++) {
jsvc_xlate_to_ascii(args->args[x]);
currentArgument = (*env)->NewStringUTF(env, args->args[x]);
if (currentArgument == NULL) {
jsvc_xlate_from_ascii(args->args[x]);
log_error("Cannot create string for argument %s", args->args[x]);
return false;
}
(*env)->SetObjectArrayElement(env, stringArray, x, currentArgument);
}
jsvc_xlate_to_ascii(load);
jsvc_xlate_to_ascii(loadparams);
method = (*env)->GetStaticMethodID(env, cls, load, loadparams);
if (method == NULL) {
log_error("Cannot find Daemon Loader \"load\" entry point");
return false;
}
log_debug("Daemon loading...");
ret = (*env)->CallStaticBooleanMethod(env, cls, method, className,
stringArray);
if (ret == FALSE) {
log_error("Cannot load daemon");
return false;
}
log_debug("Daemon loaded successfully");
return true;
}
/* Call the start method in our daemon loader */
bool java_start(void)
{
jmethodID method;
jboolean ret;
char start[] = "start";
char startparams[] = "()Z";
jsvc_xlate_to_ascii(start);
jsvc_xlate_to_ascii(startparams);
method = (*env)->GetStaticMethodID(env, cls, start, startparams);
if (method == NULL) {
log_error("Cannot find Daemon Loader \"start\" entry point");
return false;
}
ret = (*env)->CallStaticBooleanMethod(env, cls, method);
if (ret == FALSE) {
log_error("Cannot start daemon");
return false;
}
log_debug("Daemon started successfully");
return true;
}
/*
* call the java sleep to prevent problems with threads
*/
void java_sleep(int wait)
{
jclass clsThread;
jmethodID method;
char jsleep[] = "sleep";
char jsleepparams[] = "(J)V";
char jthread[] = "java/lang/Thread";
jsvc_xlate_to_ascii(jsleep);
jsvc_xlate_to_ascii(jsleepparams);
jsvc_xlate_to_ascii(jthread);
clsThread = (*env)->FindClass(env, jthread);
if (clsThread == NULL) {
log_error("Cannot find java/lang/Thread class");
return;
}
method = (*env)->GetStaticMethodID(env, clsThread, jsleep, jsleepparams);
if (method == NULL) {
log_error("Cannot found the sleep entry point");
return;
}
(*env)->CallStaticVoidMethod(env, clsThread, method, (jlong) wait * 1000);
}
/* Call the stop method in our daemon loader */
bool java_stop(void)
{
jmethodID method;
jboolean ret;
char stop[] = "stop";
char stopparams[] = "()Z";
jsvc_xlate_to_ascii(stop);
jsvc_xlate_to_ascii(stopparams);
method = (*env)->GetStaticMethodID(env, cls, stop, stopparams);
if (method == NULL) {
log_error("Cannot found Daemon Loader \"stop\" entry point");
return false;
}
ret = (*env)->CallStaticBooleanMethod(env, cls, method);
if (ret == FALSE) {
log_error("Cannot stop daemon");
return false;
}
log_debug("Daemon stopped successfully");
return true;
}
/* Call the version method in our daemon loader */
bool java_version(void)
{
jmethodID method;
char version[] = "version";
char versionparams[] = "()V";
jsvc_xlate_to_ascii(version);
jsvc_xlate_to_ascii(versionparams);
method = (*env)->GetStaticMethodID(env, cls, version, versionparams);
if (method == NULL) {
log_error("Cannot found Daemon Loader \"version\" entry point");
return false;
}
(*env)->CallStaticVoidMethod(env, cls, method);
return true;
}
/* Call the check method in our DaemonLoader class */
bool java_check(arg_data *args)
{
jstring className = NULL;
jmethodID method = NULL;
jboolean ret = FALSE;
char check[] = "check";
char checkparams[] = "(Ljava/lang/String;)Z";
log_debug("Checking daemon");
jsvc_xlate_to_ascii(args->clas);
className = (*env)->NewStringUTF(env, args->clas);
jsvc_xlate_from_ascii(args->clas);
if (className == NULL) {
log_error("Cannot create string for class name");
return false;
}
jsvc_xlate_to_ascii(check);
jsvc_xlate_to_ascii(checkparams);
method = (*env)->GetStaticMethodID(env, cls, check, checkparams);
if (method == NULL) {
log_error("Cannot found Daemon Loader \"check\" entry point");
return false;
}
ret = (*env)->CallStaticBooleanMethod(env, cls, method, className);
if (ret == FALSE) {
log_error("An error was detected checking the %s daemon", args->clas);
return false;
}
log_debug("Daemon checked successfully");
return true;
}
/* Call the destroy method in our daemon loader */
bool java_destroy(void)
{
jmethodID method;
jboolean ret;
char destroy[] = "destroy";
char destroyparams[] = "()Z";
jsvc_xlate_to_ascii(destroy);
jsvc_xlate_to_ascii(destroyparams);
method = (*env)->GetStaticMethodID(env, cls, destroy, destroyparams);
if (method == NULL) {
log_error("Cannot found Daemon Loader \"destroy\" entry point");
return false;
}
ret = (*env)->CallStaticBooleanMethod(env, cls, method);
if (ret == FALSE) {
log_error("Cannot destroy daemon");
return false;
}
log_debug("Daemon destroyed successfully");
return true;
}
commons-daemon-1.0.15-src/src/native/unix/native/version.h 100664 25140 25140 4043 12121612333 23205 0 ustar mturk mturk 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.
*/
#ifndef __VERSION_H__
#define __VERSION_H__
/**
* Major API changes that could cause compatibility problems for older
* programs such as structure size changes. No binary compatibility is
* possible across a change in the major version.
*/
#define JSVC_MAJOR_VERSION 1
/**
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading JSVC_MAJOR_VERSION
*/
#define JSVC_MINOR_VERSION 0
/** patch level */
#define JSVC_PATCH_VERSION 15
/**
* This symbol is defined for internal, "development" copies of JSVC.
* This symbol will be #undef'd for releases.
*/
#define JSVC_IS_DEV_VERSION 1
/** Properly quote a value as a string in the C preprocessor */
#define JSVC_STRINGIFY(n) JSVC_STRINGIFY_HELPER(n)
/** Helper macro for JSVC_STRINGIFY */
#define JSVC_STRINGIFY_HELPER(n) #n
/** The formatted string of APU's version */
#define JSVC_VERSION_STRING \
JSVC_STRINGIFY(JSVC_MAJOR_VERSION) "." \
JSVC_STRINGIFY(JSVC_MINOR_VERSION) "." \
JSVC_STRINGIFY(JSVC_PATCH_VERSION) \
JSVC_IS_DEV_STRING
/** Internal: string form of the "is dev" flag */
#if JSVC_IS_DEV_VERSION
#define JSVC_IS_DEV_STRING "-dev"
#else
#define JSVC_IS_DEV_STRING ""
#endif
#endif /* __VERSION_H__ */
commons-daemon-1.0.15-src/src/native/unix/native/help.c 100664 25140 25140 12263 12073242405 22473 0 ustar mturk mturk 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.
*/
/* @version $Id: help.c 1430766 2013-01-09 10:23:01Z mturk $ */
#include "jsvc.h"
void help(home_data *data)
{
int x;
printf("Usage: %s [-options] class [args...]\n", log_prog);
printf("\n");
printf("Where options include:\n");
printf("\n");
printf(" -help | --help | -?\n");
printf(" show this help page (implies -nodetach)\n");
printf(" -jvm \n");
printf(" use a specific Java Virtual Machine. Available JVMs:\n");
printf(" ");
for (x = 0; x < data->jnum; x++) {
printf(" '%s'", PRINT_NULL(data->jvms[x]->name));
}
printf("\n");
printf(" -client\n");
printf(" use a client Java Virtual Machine.\n");
printf(" -server\n");
printf(" use a server Java Virtual Machine.\n");
printf(" -cp | -classpath \n");
printf(" set search path for service classes and resouces\n");
printf(" -java-home | -home \n");
printf(" set the path of your JDK or JRE installation (or set\n");
printf(" the JAVA_HOME environment variable)\n");
printf(" -version\n");
printf(" show the current Java environment version (to check\n");
printf(" correctness of -home and -jvm. Implies -nodetach)\n");
printf(" -showversion\n");
printf(" show the current Java environment version (to check\n");
printf(" correctness of -home and -jvm) and continue execution.\n");
printf(" -nodetach\n");
printf(" don't detach from parent process and become a daemon\n");
printf(" -debug\n");
printf(" verbosely print debugging information\n");
printf(" -check\n");
printf(" only check service (implies -nodetach)\n");
printf(" -user \n");
printf(" user used to run the daemon (defaults to current user)\n");
printf(" -verbose[:class|gc|jni]\n");
printf(" enable verbose output\n");
printf(" -cwd \n");
printf(" set working directory to given location (defaults to /)\n");
printf(" -outfile \n");
printf(" Location for output from stdout (defaults to /dev/null)\n");
printf(" Use the value '&2' to simulate '1>&2'\n");
printf(" -errfile \n");
printf(" Location for output from stderr (defaults to /dev/null)\n");
printf(" Use the value '&1' to simulate '2>&1'\n");
printf(" -pidfile \n");
printf(" Location for output from the file containing the pid of jsvc\n");
printf(" (defaults to /var/run/jsvc.pid)\n");
printf(" -D=\n");
printf(" set a Java system property\n");
printf(" -X