add apr to in tree libs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3733 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2006-12-19 19:58:23 +00:00
parent 9da5d7e90f
commit 0488a5109a
459 changed files with 155202 additions and 0 deletions

2082
libs/apr/CHANGES Normal file

File diff suppressed because it is too large Load Diff

297
libs/apr/LICENSE Normal file
View File

@@ -0,0 +1,297 @@
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.
APACHE PORTABLE RUNTIME SUBCOMPONENTS:
The Apache Portable Runtime includes a number of subcomponents with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and
conditions of the following licenses.
From strings/apr_fnmatch.c, include/apr_fnmatch.h, misc/unix/getopt.c,
file_io/unix/mktemp.c, strings/apr_strings.c:
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
From network_io/unix/inet_ntop.c, network_io/unix/inet_pton.c:
/* Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
From dso/aix/dso.c:
* Based on libdl (dlfcn.c/dlfcn.h) which is
* Copyright (c) 1992,1993,1995,1996,1997,1988
* Jens-Uwe Mager, Helios Software GmbH, Hannover, Germany.
*
* Not derived from licensed software.
*
* Permission is granted to freely use, copy, modify, and redistribute
* this software, provided that the author is not construed to be liable
* for any results of using the software, alterations are clearly marked
* as such, and this notice is not modified.
From strings/apr_strnatcmp.c, include/apr_strings.h:
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

124
libs/apr/Makefile.in Normal file
View File

@@ -0,0 +1,124 @@
srcdir=@srcdir@
VPATH=@srcdir@
top_srcdir=@apr_srcdir@
top_blddir=@apr_builddir@
#
# APR (Apache Portable Runtime) library Makefile.
#
CPP = @CPP@
# get substituted into some targets
APR_MAJOR_VERSION=@APR_MAJOR_VERSION@
#
# Macros for supporting directories
#
INCDIR=./include
OSDIR=$(top_srcdir)/include/arch/@OSDIR@
DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@
INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include
#
# Macros for target determination
#
CLEAN_SUBDIRS= test
INSTALL_SUBDIRS=@INSTALL_SUBDIRS@
TARGET_LIB = lib@APR_LIBNAME@.la
APR_PCFILE = apr-$(APR_MAJOR_VERSION).pc
APR_CONFIG = apr-$(APR_MAJOR_VERSION)-config
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
#
# Rules for building specific targets, starting with 'all' for
# building the entire package.
#
TARGETS = $(TARGET_LIB) export_vars.c apr.exp
# bring in rules.mk for standard functionality
@INCLUDE_RULES@
@INCLUDE_OUTPUTS@
CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \
build/apr_rules.out
DISTCLEAN_TARGETS = config.cache config.log config.status \
include/apr.h include/arch/unix/apr_private.h \
libtool $(APR_CONFIG) build/apr_rules.mk apr.pc \
build/pkg/pkginfo
EXTRACLEAN_TARGETS = configure aclocal.m4 include/arch/unix/apr_private.h.in \
build-outputs.mk build/ltcf-c.sh build/ltmain.sh build/libtool.m4
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
includedir=@includedir@
installbuilddir=@installbuilddir@
# Create apr-config script suitable for the install tree
apr-config.out: $(APR_CONFIG)
sed 's,^\(location=\).*$$,\1installed,' < $(APR_CONFIG) > $@
# Create apr_rules.mk suitable for the install tree
build/apr_rules.out: build/apr_rules.mk
sed 's,^\(apr_build.*=\).*$$,\1$(installbuilddir),' < build/apr_rules.mk > $@
install: $(TARGET_LIB) apr-config.out build/apr_rules.out
$(APR_MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(installbuilddir) \
$(DESTDIR)$(libdir)/pkgconfig $(DESTDIR)$(includedir)
$(INSTALL_DATA) $(top_blddir)/include/apr.h $(DESTDIR)$(includedir)
for f in $(top_srcdir)/include/apr_*.h; do \
$(INSTALL_DATA) $${f} $(DESTDIR)$(includedir); \
done
$(LIBTOOL) --mode=install $(INSTALL) -m 755 $(TARGET_LIB) $(DESTDIR)$(libdir)
$(INSTALL_DATA) apr.exp $(DESTDIR)$(libdir)/apr.exp
$(INSTALL_DATA) apr.pc $(DESTDIR)$(libdir)/pkgconfig/$(APR_PCFILE)
for f in libtool shlibtool; do \
if test -f $${f}; then $(INSTALL) -m 755 $${f} $(DESTDIR)$(installbuilddir); fi; \
done
$(INSTALL) -m 755 $(top_srcdir)/build/mkdir.sh $(DESTDIR)$(installbuilddir)
for f in make_exports.awk make_var_export.awk; do \
$(INSTALL_DATA) $(top_srcdir)/build/$${f} $(DESTDIR)$(installbuilddir); \
done
$(INSTALL_DATA) build/apr_rules.out $(DESTDIR)$(installbuilddir)/apr_rules.mk
$(INSTALL) -m 755 apr-config.out $(DESTDIR)$(bindir)/$(APR_CONFIG)
@if [ $(INSTALL_SUBDIRS) != "none" ]; then \
for i in $(INSTALL_SUBDIRS); do \
( cd $$i ; $(MAKE) DESTDIR=$(DESTDIR) install ); \
done \
fi
$(TARGET_LIB): $(OBJECTS)
$(LINK) @lib_target@ $(ALL_LIBS)
exports.c: $(HEADERS)
$(APR_MKEXPORT) $(HEADERS) > $@
export_vars.c: $(HEADERS)
$(APR_MKVAREXPORT) $(HEADERS) > $@
apr.exp: exports.c export_vars.c
@echo "#! lib@APR_LIBNAME@.so" > $@
@echo "* This file was AUTOGENERATED at build time." >> $@
@echo "* Please do not edit by hand." >> $@
$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@
$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$$/d' >> $@
dox:
doxygen $(top_srcdir)/docs/doxygen.conf
gcov:
@build/run-gcov.sh
test: check
check: $(TARGET_LIB)
(cd test && $(MAKE) check)
etags:
etags `find . -name '*.[ch]'`
# DO NOT REMOVE
docs: $(INCDIR)/*.h

9
libs/apr/NOTICE Normal file
View File

@@ -0,0 +1,9 @@
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
Portions of this software were developed at the National Center
for Supercomputing Applications (NCSA) at the University of
Illinois at Urbana-Champaign.
This software contains code derived from the RSA Data Security
Inc. MD5 Message-Digest Algorithm.

404
libs/apr/NWGNUmakefile Normal file
View File

@@ -0,0 +1,404 @@
#
# Declare the sub-directories to be built here
#
SUBDIRS = \
build \
$(APU_WORK) \
$(EOLIST)
#
# Get the 'head' of the build environment. This includes default targets and
# paths to tools
#
include $(APR_WORK)\build\NWGNUhead.inc
#
# build this level's files
#
# Make sure all needed macro's are defined
#
#
# These directories will be at the beginning of the include list, followed by
# INCDIRS
#
XINCDIRS += \
$(APR)/include \
$(APR)/include/arch/NetWare \
$(APR)/include/arch/unix \
$(APR)/memory/unix \
$(APR)/random/unix \
$(APRUTIL)/xml \
$(EOLIST)
#
# These flags will come after CFLAGS
#
XCFLAGS += \
$(EOLIST)
#
# These defines will come after DEFINES
#
XDEFINES += \
$(EOLIST)
#
# These flags will be added to the link.opt file
#
XLFLAGS += \
$(EOLIST)
#
# These values will be appended to the correct variables based on the value of
# RELEASE
#
ifeq "$(RELEASE)" "debug"
XINCDIRS += \
$(EOLIST)
XCFLAGS += \
$(EOLIST)
XDEFINES += \
$(EOLIST)
XLFLAGS += \
$(EOLIST)
endif
ifeq "$(RELEASE)" "noopt"
XINCDIRS += \
$(EOLIST)
XCFLAGS += \
$(EOLIST)
XDEFINES += \
$(EOLIST)
XLFLAGS += \
$(EOLIST)
endif
ifeq "$(RELEASE)" "release"
XINCDIRS += \
$(EOLIST)
XCFLAGS += \
$(EOLIST)
XDEFINES += \
$(EOLIST)
XLFLAGS += \
$(EOLIST)
endif
#
# These are used by the link target if an NLM is being generated
# This is used by the link 'name' directive to name the nlm. If left blank
# TARGET_nlm (see below) will be used.
#
NLM_NAME = aprlib
#
# This is used by the link '-desc ' directive.
# If left blank, NLM_NAME will be used.
#
NLM_DESCRIPTION = Apache Portability Runtime Library $(VERSION_STR)
#
# This is used by the '-threadname' directive. If left blank,
# NLM_NAME Thread will be used.
#
NLM_THREAD_NAME =
#
# If this is specified, it will override VERSION value in
# $(APR_WORK)\build\NWGNUenvironment.inc
#
NLM_VERSION =
#
# If this is specified, it will override the default of 64K
#
NLM_STACK_SIZE =
#
# If this is specified it will be used by the link '-entry' directive
#
NLM_ENTRY_SYM = _LibCPrelude
#
# If this is specified it will be used by the link '-exit' directive
#
NLM_EXIT_SYM = _LibCPostlude
#
# If this is specified it will be used by the link '-check' directive
#
NLM_CHECK_SYM =
#
# If this is specified it will be used by the link '-flags' directive
#
NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
#
# If this is specified it will be linked in with the XDCData option in the def
# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can
# be disabled by setting APACHE_UNIPROC in the environment
#
XDCDATA =
#
# Declare all target files (you must add your files here)
#
#
# If there is an NLM target, put it here
#
TARGET_nlm = \
$(OBJDIR)/aprlib.nlm \
$(EOLIST)
#
# If there is an LIB target, put it here
#
TARGET_lib = \
$(OBJDIR)/aprlib.lib \
$(EOLIST)
#
# These are the OBJ files needed to create the NLM target above.
# Paths must all use the '/' character
#
FILES_nlm_objs = \
$(OBJDIR)/libprews.o \
$(EOLIST)
#
# These are the LIB files needed to create the NLM target above.
# These will be added as a library command in the link.opt file.
#
FILES_nlm_libs = \
libcpre.o \
$(APRLIB) \
$(APRUTLIB) \
$(APULDAPLIB) \
$(XMLLIB) \
$(EOLIST)
#
# These are the modules that the above NLM target depends on to load.
# These will be added as a module command in the link.opt file.
#
FILES_nlm_modules = \
Libc \
$(EOLIST)
# Include the Winsock libraries if Winsock is being used
ifndef USE_STDSOCKETS
FILES_nlm_modules += ws2_32 \
$(EOLIST)
endif
#If the LDAP support is defined then add the auto-load modules
ifneq "$(LDAPSDK)" ""
FILES_nlm_modules += \
lldapsdk \
lldapssl \
$(EOLIST)
endif
#
# If the nlm has a msg file, put it's path here
#
FILE_nlm_msg =
#
# If the nlm has a hlp file put it's path here
#
FILE_nlm_hlp =
#
# If this is specified, it will override $(NWOS)\copyright.txt.
#
FILE_nlm_copyright =
#
# Any additional imports go here
#
FILES_nlm_Ximports = \
@libc.imp \
@netware.imp \
$(EOLIST)
# Include the Winsock imports if Winsock is being used
ifndef USE_STDSOCKETS
FILES_nlm_Ximports += \
@ws2nlm.imp \
WSAStartupRTags \
WSACleanupRTag \
$(EOLIST)
endif
#If the LDAP support is defined then add the imports
ifneq "$(LDAPSDK)" ""
FILES_nlm_Ximports += \
@$(LDAPSDK)/imports/lldapsdk.imp \
@$(LDAPSDK)/imports/lldapssl.imp \
$(EOLIST)
endif
#
# Any symbols exported to here
#
FILES_nlm_exports = \
@aprlib.imp \
$(EOLIST)
#
# These are the OBJ files needed to create the LIB target above.
# Paths must all use the '/' character
#
FILES_lib_objs = \
$(OBJDIR)/apr_atomic.o \
$(OBJDIR)/apr_cpystrn.o \
$(OBJDIR)/apr_fnmatch.o \
$(OBJDIR)/apr_getpass.o \
$(OBJDIR)/apr_hash.o \
$(OBJDIR)/apr_pools.o \
$(OBJDIR)/apr_random.o \
$(OBJDIR)/apr_snprintf.o \
$(OBJDIR)/apr_strings.o \
$(OBJDIR)/apr_strnatcmp.o \
$(OBJDIR)/apr_strtok.o \
$(OBJDIR)/apr_tables.o \
$(OBJDIR)/charset.o \
$(OBJDIR)/copy.o \
$(OBJDIR)/common.o \
$(OBJDIR)/dir.o \
$(OBJDIR)/dso.o \
$(OBJDIR)/errorcodes.o \
$(OBJDIR)/env.o \
$(OBJDIR)/fileacc.o \
$(OBJDIR)/filedup.o \
$(OBJDIR)/filepath.o \
$(OBJDIR)/filepath_util.o \
$(OBJDIR)/filestat.o \
$(OBJDIR)/filesys.o \
$(OBJDIR)/flock.o \
$(OBJDIR)/fullrw.o \
$(OBJDIR)/getopt.o \
$(OBJDIR)/groupinfo.o \
$(OBJDIR)/inet_pton.o \
$(OBJDIR)/inet_ntop.o \
$(OBJDIR)/libprews.o \
$(OBJDIR)/mktemp.o \
$(OBJDIR)/mmap.o \
$(OBJDIR)/multicast.o \
$(OBJDIR)/open.o \
$(OBJDIR)/pipe.o \
$(OBJDIR)/otherchild.o \
$(OBJDIR)/proc.o \
$(OBJDIR)/procsup.o \
$(OBJDIR)/proc_mutex.o \
$(OBJDIR)/rand.o \
$(OBJDIR)/readwrite.o \
$(OBJDIR)/seek.o \
$(OBJDIR)/select.o \
$(OBJDIR)/sendrecv.o \
$(OBJDIR)/sha2.o \
$(OBJDIR)/sha2_glue.o \
$(OBJDIR)/shm.o \
$(OBJDIR)/signals.o \
$(OBJDIR)/sockaddr.o \
$(OBJDIR)/sockets.o \
$(OBJDIR)/sockopt.o \
$(OBJDIR)/start.o \
$(OBJDIR)/tempdir.o \
$(OBJDIR)/thread.o \
$(OBJDIR)/thread_cond.o \
$(OBJDIR)/thread_mutex.o \
$(OBJDIR)/thread_rwlock.o \
$(OBJDIR)/threadpriv.o \
$(OBJDIR)/time.o \
$(OBJDIR)/timestr.o \
$(OBJDIR)/userinfo.o \
$(OBJDIR)/version.o \
$(OBJDIR)/waitio.o \
$(EOLIST)
#
# implement targets and dependancies (leave this section alone)
#
libs :: $(OBJDIR) $(TARGET_lib)
nlms :: libs $(TARGET_nlm)
#
# Updated this target to create necessary directories and copy files to the
# correct place. (See $(APR_WORK)\build\NWGNUhead.inc for examples)
#
install :: nlms $(INSTDIRS) FORCE
copy $(OBJDIR)\aprlib.nlm $(INSTALLBASE)\*.*
ifndef DEST
-copy $(subst /,\,$(APR))\STATUS $(INSTALLBASE)\*.apr
-copy $(subst /,\,$(APR))\LICENSE $(INSTALLBASE)\*
-copy $(subst /,\,$(APR))\CHANGES $(INSTALLBASE)\*.apr
-copy $(subst /,\,$(APRUTIL))\STATUS $(INSTALLBASE)\*.apu
-copy $(subst /,\,$(APRUTIL))\CHANGES $(INSTALLBASE)\*.apu
@echo rem copying the docs directories > xc.bat
@echo xcopy docs $(INSTALLBASE)\docs\*.* $(XCOPYSW) >> xc.bat
$(CMD) xc.bat
$(DEL) xc.bat
endif
$(INSTDIRS) ::
$(CHKNOT) $@\NUL mkdir $@
ifndef DEST
installdev :: $(INSTDEVDIRS) FORCE
-copy $(subst /,\,$(APR))\include\*.h $(INSTALLBASE)\include\*.*
-copy $(subst /,\,$(APRUTIL))\include\*.h $(INSTALLBASE)\include\*.*
-copy $(subst /,\,$(APR))\*.imp $(INSTALLBASE)\lib\*.*
-copy $(subst /,\,$(APR))\misc\netware\*.xdc $(INSTALLBASE)\lib\*.*
$(INSTDEVDIRS) ::
$(CHKNOT) $@\NUL mkdir $@
endif
#
# Any specialized rules here
#
vpath %.c atomic/netware:strings:tables:passwd:lib:time/unix
vpath %.c file_io/unix:locks/netware:misc/netware:misc/unix:threadproc/netware
vpath %.c poll/unix:shmem\unix:support/unix:random/unix
vpath %.c dso/netware:memory/unix:mmap/unix:user/netware
# Use the win32 network_io if Winsock is being used
ifdef USE_STDSOCKETS
vpath %.c network_io/unix
else
vpath %.c network_io/win32:network_io/unix
endif
$(OBJDIR)/%.o: file_io/netware/%.c $(OBJDIR)\$(NLM_NAME)_cc.opt
@echo Compiling $<
$(CC) file_io\netware\$(<F) -cwd source -o=$(OBJDIR)\$(@F) @$(OBJDIR)\$(NLM_NAME)_cc.opt
#
# Include the 'tail' makefile that has targets that depend on variables defined
# in this makefile
#
include $(APR_WORK)\build\NWGNUtail.inc

30
libs/apr/README.dev Normal file
View File

@@ -0,0 +1,30 @@
Apache Portable Runtime
=======================
If you are building APR from SVN, you need to use a slightly non-standard
build process. You must have autoconf and libtool installed for this to
work. There are three steps:
1) ./buildconf
2) ./configure
3) make
If you are building APR from a distribution tarball, buildconf will have
already been run for you, and you therefore do not need to have either
autoconf or libtool installed, and you do not need to run buildconf. Skip
step one above and just run configure then make.
Generating Test Coverage information
====================================
If you want to generate test coverage data, use the following steps:
1) ./buildconf
2) CFLAGS="-fprofile-arcs -ftest-coverage" ./configure
3) make
4) cd test
5) make
6) ./testall
7) cd ..
8) make gcov

250
libs/apr/apr-config.in Normal file
View File

@@ -0,0 +1,250 @@
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# APR script designed to allow easy command line access to APR configuration
# parameters.
APR_MAJOR_VERSION="@APR_MAJOR_VERSION@"
APR_DOTTED_VERSION="@APR_DOTTED_VERSION@"
prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
libdir="@libdir@"
datadir="@datadir@"
installbuilddir="@installbuilddir@"
includedir="@includedir@"
CC="@CC@"
CPP="@CPP@"
SHELL="@SHELL@"
CPPFLAGS="@EXTRA_CPPFLAGS@"
CFLAGS="@EXTRA_CFLAGS@"
LDFLAGS="@EXTRA_LDFLAGS@"
LIBS="@EXTRA_LIBS@"
EXTRA_INCLUDES="@EXTRA_INCLUDES@"
SHLIBPATH_VAR="@shlibpath_var@"
APR_SOURCE_DIR="@apr_srcdir@"
APR_BUILD_DIR="@apr_builddir@"
APR_SO_EXT="@so_ext@"
APR_LIB_TARGET="@export_lib_target@"
APR_LIBNAME="@APR_LIBNAME@"
# NOTE: the following line is modified during 'make install': alter with care!
location=@APR_CONFIG_LOCATION@
show_usage()
{
cat << EOF
Usage: apr-$APR_MAJOR_VERSION-config [OPTION]
Known values for OPTION are:
--prefix[=DIR] change prefix to DIR
--bindir print location where binaries are installed
--includedir print location where headers are installed
--cc print C compiler name
--cpp print C preprocessor name and any required options
--cflags print C compiler flags
--cppflags print C preprocessor flags
--includes print include information
--ldflags print linker flags
--libs print additional libraries to link against
--srcdir print APR source directory
--installbuilddir print APR build helper directory
--link-ld print link switch(es) for linking to APR
--link-libtool print the libtool inputs for linking to APR
--shlib-path-var print the name of the shared library path env var
--apr-la-file print the path to the .la file, if available
--apr-so-ext print the extensions of shared objects on this platform
--apr-lib-target print the libtool target information
--apr-libtool print the path to APR's libtool
--version print the APR's version as a dotted triple
--help print this help
When linking with libtool, an application should do something like:
APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-libtool --libs\`"
or when linking directly:
APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-ld --libs\`"
An application should use the results of --cflags, --cppflags, --includes,
and --ldflags in their build process.
EOF
}
if test $# -eq 0; then
show_usage
exit 1
fi
if test "$location" = "installed"; then
LA_FILE="$libdir/lib${APR_LIBNAME}.la"
else
LA_FILE="$APR_BUILD_DIR/lib${APR_LIBNAME}.la"
fi
flags=""
while test $# -gt 0; do
# Normalize the prefix.
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
# It is possible for the user to override our prefix.
--prefix=*)
prefix=$optarg
;;
--prefix)
echo $prefix
exit 0
;;
--bindir)
echo $bindir
exit 0
;;
--includedir)
if test "$location" = "installed"; then
flags="$includedir"
elif test "$location" = "source"; then
flags="$APR_SOURCE_DIR/include"
else
# this is for VPATH builds
flags="$APR_BUILD_DIR/include $APR_SOURCE_DIR/include"
fi
echo $flags
exit 0
;;
--cc)
echo $CC
exit 0
;;
--cpp)
echo $CPP
exit 0
;;
--cflags)
flags="$flags $CFLAGS"
;;
--cppflags)
flags="$flags $CPPFLAGS"
;;
--libs)
flags="$flags $LIBS"
;;
--ldflags)
flags="$flags $LDFLAGS"
;;
--includes)
if test "$location" = "installed"; then
flags="$flags -I$includedir $EXTRA_INCLUDES"
elif test "$location" = "source"; then
flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
else
# this is for VPATH builds
flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
fi
;;
--srcdir)
echo $APR_SOURCE_DIR
exit 0
;;
--installbuilddir)
if test "$location" = "installed"; then
echo "${installbuilddir}"
elif test "$location" = "source"; then
echo "$APR_SOURCE_DIR/build"
else
# this is for VPATH builds
echo "$APR_BUILD_DIR/build"
fi
exit 0
;;
--version)
echo $APR_DOTTED_VERSION
exit 0
;;
--link-ld)
if test "$location" = "installed"; then
### avoid using -L if libdir is a "standard" location like /usr/lib
flags="$flags -L$libdir -l${APR_LIBNAME}"
else
### this surely can't work since the library is in .libs?
flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}"
fi
;;
--link-libtool)
# If the LA_FILE exists where we think it should be, use it. If we're
# installed and the LA_FILE does not exist, assume to use -L/-l
# (the LA_FILE may not have been installed). If we're building ourselves,
# we'll assume that at some point the .la file be created.
if test -f "$LA_FILE"; then
flags="$flags $LA_FILE"
elif test "$location" = "installed"; then
### avoid using -L if libdir is a "standard" location like /usr/lib
# Since the user is specifying they are linking with libtool, we
# *know* that -R will be recognized by libtool.
flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}"
else
flags="$flags $LA_FILE"
fi
;;
--shlib-path-var)
echo "$SHLIBPATH_VAR"
exit 0
;;
--apr-la-file)
if test -f "$LA_FILE"; then
flags="$flags $LA_FILE"
fi
;;
--apr-so-ext)
echo "$APR_SO_EXT"
exit 0
;;
--apr-lib-target)
echo "$APR_LIB_TARGET"
exit 0
;;
--apr-libtool)
if test "$location" = "installed"; then
echo "${installbuilddir}/libtool"
else
echo "$APR_BUILD_DIR/libtool"
fi
exit 0
;;
--help)
show_usage
exit 0
;;
*)
show_usage
exit 1
;;
esac
# Next please.
shift
done
if test -n "$flags"; then
echo "$flags"
fi
exit 0

651
libs/apr/apr.dsp Normal file
View File

@@ -0,0 +1,651 @@
# Microsoft Developer Studio Project File - Name="apr" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=apr - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "apr.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "apr.mak" CFG="apr - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "apr - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "apr - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "apr - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "LibR"
# PROP BASE Intermediate_Dir "LibR"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "LibR"
# PROP Intermediate_Dir "LibR"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibR\apr_src" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"LibR\apr-1.lib"
!ELSEIF "$(CFG)" == "apr - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "LibD"
# PROP BASE Intermediate_Dir "LibD"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "LibD"
# PROP Intermediate_Dir "LibD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibD\apr_src" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"LibD\apr-1.lib"
!ENDIF
# Begin Target
# Name "apr - Win32 Release"
# Name "apr - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ".c"
# Begin Group "atomic"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\atomic\win32\apr_atomic.c
# End Source File
# End Group
# Begin Group "dso"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\dso\win32\dso.c
# End Source File
# End Group
# Begin Group "file_io"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\file_io\unix\copy.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\dir.c
# End Source File
# Begin Source File
SOURCE=.\file_io\unix\fileacc.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\filedup.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\filepath.c
# End Source File
# Begin Source File
SOURCE=.\file_io\unix\filepath_util.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\filestat.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\filesys.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\flock.c
# End Source File
# Begin Source File
SOURCE=.\file_io\unix\fullrw.c
# End Source File
# Begin Source File
SOURCE=.\file_io\unix\mktemp.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\open.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\pipe.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\readwrite.c
# End Source File
# Begin Source File
SOURCE=.\file_io\win32\seek.c
# End Source File
# Begin Source File
SOURCE=.\file_io\unix\tempdir.c
# End Source File
# End Group
# Begin Group "locks"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\locks\win32\proc_mutex.c
# End Source File
# Begin Source File
SOURCE=.\locks\win32\thread_cond.c
# End Source File
# Begin Source File
SOURCE=.\locks\win32\thread_mutex.c
# End Source File
# Begin Source File
SOURCE=.\locks\win32\thread_rwlock.c
# End Source File
# End Group
# Begin Group "memory"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\memory\unix\apr_pools.c
# End Source File
# End Group
# Begin Group "misc"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\misc\win32\apr_app.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\misc\win32\charset.c
# End Source File
# Begin Source File
SOURCE=.\misc\win32\env.c
# End Source File
# Begin Source File
SOURCE=.\misc\unix\errorcodes.c
# End Source File
# Begin Source File
SOURCE=.\misc\unix\getopt.c
# End Source File
# Begin Source File
SOURCE=.\misc\win32\internal.c
# End Source File
# Begin Source File
SOURCE=.\misc\win32\misc.c
# End Source File
# Begin Source File
SOURCE=.\misc\unix\otherchild.c
# End Source File
# Begin Source File
SOURCE=.\misc\win32\rand.c
# End Source File
# Begin Source File
SOURCE=.\misc\win32\start.c
# End Source File
# Begin Source File
SOURCE=.\misc\win32\utf8.c
# End Source File
# Begin Source File
SOURCE=.\misc\unix\version.c
# End Source File
# End Group
# Begin Group "mmap"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\mmap\unix\common.c
# End Source File
# Begin Source File
SOURCE=.\mmap\win32\mmap.c
# End Source File
# End Group
# Begin Group "network_io"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\network_io\unix\inet_ntop.c
# End Source File
# Begin Source File
SOURCE=.\network_io\unix\inet_pton.c
# End Source File
# Begin Source File
SOURCE=.\poll\unix\select.c
# End Source File
# Begin Source File
SOURCE=.\network_io\unix\multicast.c
# End Source File
# Begin Source File
SOURCE=.\network_io\win32\sendrecv.c
# End Source File
# Begin Source File
SOURCE=.\network_io\unix\sockaddr.c
# End Source File
# Begin Source File
SOURCE=.\network_io\win32\sockets.c
# End Source File
# Begin Source File
SOURCE=.\network_io\win32\sockopt.c
# End Source File
# End Group
# Begin Group "passwd"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\passwd\apr_getpass.c
# End Source File
# End Group
# Begin Group "random"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\random\unix\apr_random.c
# End Source File
# Begin Source File
SOURCE=.\random\unix\sha2.c
# End Source File
# Begin Source File
SOURCE=.\random\unix\sha2_glue.c
# End Source File
# End Group
# Begin Group "shmem"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\shmem\win32\shm.c
# End Source File
# End Group
# Begin Group "strings"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\strings\apr_cpystrn.c
# End Source File
# Begin Source File
SOURCE=.\strings\apr_fnmatch.c
# End Source File
# Begin Source File
SOURCE=.\strings\apr_snprintf.c
# End Source File
# Begin Source File
SOURCE=.\strings\apr_strings.c
# End Source File
# Begin Source File
SOURCE=.\strings\apr_strnatcmp.c
# End Source File
# Begin Source File
SOURCE=.\strings\apr_strtok.c
# End Source File
# End Group
# Begin Group "tables"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\tables\apr_hash.c
# End Source File
# Begin Source File
SOURCE=.\tables\apr_tables.c
# End Source File
# End Group
# Begin Group "threadproc"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\threadproc\win32\proc.c
# End Source File
# Begin Source File
SOURCE=.\threadproc\win32\signals.c
# End Source File
# Begin Source File
SOURCE=.\threadproc\win32\thread.c
# End Source File
# Begin Source File
SOURCE=.\threadproc\win32\threadpriv.c
# End Source File
# End Group
# Begin Group "time"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\time\win32\access.c
# End Source File
# Begin Source File
SOURCE=.\time\win32\time.c
# End Source File
# Begin Source File
SOURCE=.\time\win32\timestr.c
# End Source File
# End Group
# Begin Group "user"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\user\win32\groupinfo.c
# End Source File
# Begin Source File
SOURCE=.\user\win32\userinfo.c
# End Source File
# End Group
# End Group
# Begin Group "Private Header Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_atime.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_dso.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_file_io.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_inherit.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_misc.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_networkio.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_thread_mutex.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_thread_rwlock.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_threadproc.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_arch_utf8.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\win32\apr_private.h
# End Source File
# Begin Source File
SOURCE=.\include\arch\apr_private_common.h
# End Source File
# End Group
# Begin Group "Public Header Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\include\apr.h.in
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\include\apr.hnw
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\include\apr.hw
!IF "$(CFG)" == "apr - Win32 Release"
# Begin Custom Build - Creating apr.h from apr.hw
InputPath=.\include\apr.hw
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apr.hw > .\include\apr.h
# End Custom Build
!ELSEIF "$(CFG)" == "apr - Win32 Debug"
# Begin Custom Build - Creating apr.h from apr.hw
InputPath=.\include\apr.hw
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apr.hw > .\include\apr.h
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\include\apr_allocator.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_atomic.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_dso.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_env.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_errno.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_file_info.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_file_io.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_fnmatch.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_general.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_getopt.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_global_mutex.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_hash.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_inherit.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_lib.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_mmap.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_network_io.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_poll.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_pools.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_portable.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_proc_mutex.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_ring.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_shm.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_signal.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_strings.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_support.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_tables.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_thread_cond.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_thread_mutex.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_thread_proc.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_thread_rwlock.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_time.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_user.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_version.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_want.h
# End Source File
# End Group
# End Target
# End Project

71
libs/apr/apr.dsw Normal file
View File

@@ -0,0 +1,71 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "apr"=".\apr.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "apr_app"=".\build\apr_app.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name apr
End Project Dependency
}}}
###############################################################################
Project: "libapr"=".\libapr.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "libapr_app"=".\build\libapr_app.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libapr
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

11
libs/apr/apr.pc.in Normal file
View File

@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
APR_MAJOR_VERSION=@APR_MAJOR_VERSION@
includedir=@includedir@
Name: APR
Description: The Apache Portable Runtime library
Version: @APR_DOTTED_VERSION@
Libs: -L${libdir} -l@APR_LIBNAME@ @EXTRA_LIBS@
Cflags: @EXTRA_CPPFLAGS@ @EXTRA_CFLAGS@ -I${includedir}

96
libs/apr/apr.spec Normal file
View File

@@ -0,0 +1,96 @@
%define aprver 1
Summary: Apache Portable Runtime library
Name: apr
Version: 1.2.8
Release: 1
License: Apache Software License
Group: System Environment/Libraries
URL: http://apr.apache.org/
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildPrereq: autoconf, libtool, doxygen
%description
The mission of the Apache Portable Runtime (APR) is to provide a
free library of C data structures and routines, forming a system
portability layer to as many operating systems as possible,
including Unices, MS Win32, BeOS and OS/2.
%package devel
Group: Development/Libraries
Summary: APR library development kit
Requires: apr = %{version}
%description devel
This package provides the support files which can be used to
build applications using the APR library. The mission of the
Apache Portable Runtime (APR) is to provide a free library of
C data structures and routines.
%prep
%setup -q
%build
# regenerate configure script etc.
./buildconf
%configure \
--prefix=/usr \
--includedir=%{_includedir}/apr-%{aprver} \
--with-installbuilddir=%{_libdir}/apr/build-%{aprver} \
--with-devrandom=/dev/urandom \
CC=gcc CXX=g++
make %{?_smp_mflags} && make dox
%check
# Run non-interactive tests
pushd test
make %{?_smp_mflags} testall CFLAGS=-fno-strict-aliasing
./testall -v || exit 1
popd
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
# Move docs to more convenient location
mv docs/dox/html html
# Unpackaged files:
rm -f $RPM_BUILD_ROOT%{_libdir}/apr.exp
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc CHANGES LICENSE NOTICE
%{_libdir}/libapr-%{aprver}.so.*
%files devel
%defattr(-,root,root,-)
%doc docs/APRDesign.html docs/canonical_filenames.html
%doc docs/incomplete_types docs/non_apr_programs
%doc --parents html
%{_bindir}/apr*config
%{_libdir}/libapr-%{aprver}.*a
%{_libdir}/libapr-%{aprver}.so
%dir %{_libdir}/apr
%dir %{_libdir}/apr/build-%{aprver}
%{_libdir}/apr/build-%{aprver}/*
%{_libdir}/pkgconfig/apr-%{aprver}.pc
%dir %{_includedir}/apr-%{aprver}
%{_includedir}/apr-%{aprver}/*.h
%changelog
* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
- update to support v1.0.0 of APR
* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
- derived from Fedora Core apr.spec

View File

@@ -0,0 +1,70 @@
/* 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.
*/
#include "apr.h"
#include "apr_atomic.h"
#include <stdlib.h>
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *pool)
{
return APR_SUCCESS;
}
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
return atomic_xchgadd((unsigned long *)mem,(unsigned long)val);
}
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
atomic_sub((unsigned long *)mem,(unsigned long)val);
}
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
{
return atomic_xchgadd((unsigned long *)mem, 1);
}
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
*mem = val;
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
{
return *mem;
}
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,apr_uint32_t cmp)
{
return atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with);
}
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
return atomic_xchg((unsigned long *)mem,(unsigned long)val);
}
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
{
return (atomic_xchgadd((unsigned long *)mem, 0xFFFFFFFF) - 1);
}
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
{
return (void*)atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with);
}

View File

@@ -0,0 +1,96 @@
/* 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.
*/
#include "apr.h"
#include "apr_atomic.h"
#include <stdlib.h>
apr_status_t apr_atomic_init(apr_pool_t *p)
{
return APR_SUCCESS;
}
apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t old, new_val;
old = *mem; /* old is automatically updated on cs failure */
do {
new_val = old + val;
} while (__cs(&old, (cs_t *)mem, new_val));
return old;
}
void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t old, new_val;
old = *mem; /* old is automatically updated on cs failure */
do {
new_val = old - val;
} while (__cs(&old, (cs_t *)mem, new_val));
}
apr_uint32_t apr_atomic_inc32(volatile apr_uint32_t *mem)
{
return apr_atomic_add32(mem, 1);
}
int apr_atomic_dec32(volatile apr_uint32_t *mem)
{
apr_uint32_t old, new_val;
old = *mem; /* old is automatically updated on cs failure */
do {
new_val = old - 1;
} while (__cs(&old, (cs_t *)mem, new_val));
return new_val != 0;
}
apr_uint32_t apr_atomic_read32(volatile apr_uint32_t *mem)
{
return *mem;
}
void apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
*mem = val;
}
apr_uint32_t apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t swap,
apr_uint32_t cmp)
{
apr_uint32_t old = cmp;
__cs(&old, (cs_t *)mem, swap);
return old; /* old is automatically updated from mem on cs failure */
}
apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t old, new_val;
old = *mem; /* old is automatically updated on cs failure */
do {
new_val = val;
} while (__cs(&old, (cs_t *)mem, new_val));
return old;
}

View File

@@ -0,0 +1,393 @@
/* 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.
*/
#include "apr.h"
#include "apr_atomic.h"
#include "apr_thread_mutex.h"
#include "apr_private.h"
#include <stdlib.h>
#if defined(__GNUC__) && defined(__STRICT_ANSI__) && !defined(USE_GENERIC_ATOMICS)
/* force use of generic atomics if building e.g. with -std=c89, which
* doesn't allow inline asm */
#define USE_GENERIC_ATOMICS
#endif
#if (defined(__i386__) || defined(__x86_64__)) \
&& defined(__GNUC__) && !defined(USE_GENERIC_ATOMICS)
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem,
apr_uint32_t with,
apr_uint32_t cmp)
{
apr_uint32_t prev;
asm volatile ("lock; cmpxchgl %1, %2"
: "=a" (prev)
: "r" (with), "m" (*(mem)), "0"(cmp)
: "memory", "cc");
return prev;
}
#define APR_OVERRIDE_ATOMIC_CAS32
static apr_uint32_t inline intel_atomic_add32(volatile apr_uint32_t *mem,
apr_uint32_t val)
{
asm volatile ("lock; xaddl %0,%1"
: "=r"(val), "=m"(*mem) /* outputs */
: "0"(val), "m"(*mem) /* inputs */
: "memory", "cc");
return val;
}
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem,
apr_uint32_t val)
{
return intel_atomic_add32(mem, val);
}
#define APR_OVERRIDE_ATOMIC_ADD32
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
asm volatile ("lock; subl %1, %0"
:
: "m" (*(mem)), "r" (val)
: "memory", "cc");
}
#define APR_OVERRIDE_ATOMIC_SUB32
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
{
unsigned char prev;
asm volatile ("lock; decl %1;\n\t"
"setnz %%al"
: "=a" (prev)
: "m" (*(mem))
: "memory", "cc");
return prev;
}
#define APR_OVERRIDE_ATOMIC_DEC32
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
{
return intel_atomic_add32(mem, 1);
}
#define APR_OVERRIDE_ATOMIC_INC32
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
*mem = val;
}
#define APR_OVERRIDE_ATOMIC_SET32
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t prev = val;
asm volatile ("lock; xchgl %0, %1"
: "=r" (prev)
: "m" (*(mem)), "0"(prev)
: "memory");
return prev;
}
#define APR_OVERRIDE_ATOMIC_XCHG32
/*#define apr_atomic_init(pool) APR_SUCCESS*/
#endif /* (__linux__ || __EMX__ || __FreeBSD__) && __i386__ */
#if (defined(__PPC__) || defined(__ppc__)) && defined(__GNUC__) \
&& !defined(USE_GENERIC_ATOMICS)
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem,
apr_uint32_t swap,
apr_uint32_t cmp)
{
apr_uint32_t prev;
asm volatile ("0:\n\t" /* retry local label */
"lwarx %0,0,%1\n\t" /* load prev and reserve */
"cmpw %0,%3\n\t" /* does it match cmp? */
"bne- 1f\n\t" /* ...no, bail out */
"stwcx. %2,0,%1\n\t" /* ...yes, conditionally
store swap */
"bne- 0b\n\t" /* start over if we lost
the reservation */
"1:" /* exit local label */
: "=&r"(prev) /* output */
: "b" (mem), "r" (swap), "r"(cmp) /* inputs */
: "memory", "cc"); /* clobbered */
return prev;
}
#define APR_OVERRIDE_ATOMIC_CAS32
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem,
apr_uint32_t delta)
{
apr_uint32_t prev, temp;
asm volatile ("0:\n\t" /* retry local label */
"lwarx %0,0,%2\n\t" /* load prev and reserve */
"add %1,%0,%3\n\t" /* temp = prev + delta */
"stwcx. %1,0,%2\n\t" /* conditionally store */
"bne- 0b" /* start over if we lost
the reservation */
/*XXX find a cleaner way to define the temp
* it's not an output
*/
: "=&r" (prev), "=&r" (temp) /* output, temp */
: "b" (mem), "r" (delta) /* inputs */
: "memory", "cc"); /* clobbered */
return prev;
}
#define APR_OVERRIDE_ATOMIC_ADD32
#endif /* __PPC__ && __GNUC__ */
#if !defined(APR_OVERRIDE_ATOMIC_INIT)
#if APR_HAS_THREADS
#define NUM_ATOMIC_HASH 7
/* shift by 2 to get rid of alignment issues */
#define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH)
static apr_thread_mutex_t **hash_mutex;
#endif /* APR_HAS_THREADS */
apr_status_t apr_atomic_init(apr_pool_t *p)
{
#if APR_HAS_THREADS
int i;
apr_status_t rv;
hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH);
for (i = 0; i < NUM_ATOMIC_HASH; i++) {
rv = apr_thread_mutex_create(&(hash_mutex[i]),
APR_THREAD_MUTEX_DEFAULT, p);
if (rv != APR_SUCCESS) {
return rv;
}
}
#endif /* APR_HAS_THREADS */
return APR_SUCCESS;
}
#endif /* !defined(APR_OVERRIDE_ATOMIC_INIT) */
/* abort() if 'x' does not evaluate to APR_SUCCESS. */
#define CHECK(x) do { if ((x) != APR_SUCCESS) abort(); } while (0)
#if !defined(APR_OVERRIDE_ATOMIC_ADD32)
#if defined(APR_OVERRIDE_ATOMIC_CAS32)
apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t old_value, new_value;
do {
old_value = *mem;
new_value = old_value + val;
} while (apr_atomic_cas32(mem, new_value, old_value) != old_value);
return old_value;
}
#else
apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t old_value;
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
CHECK(apr_thread_mutex_lock(lock));
old_value = *mem;
*mem += val;
CHECK(apr_thread_mutex_unlock(lock));
#else
old_value = *mem;
*mem += val;
#endif /* APR_HAS_THREADS */
return old_value;
}
#endif /* defined(APR_OVERRIDE_ATOMIC_CAS32) */
#endif /* !defined(APR_OVERRIDE_ATOMIC_ADD32) */
#if !defined(APR_OVERRIDE_ATOMIC_SUB32)
#if defined(APR_OVERRIDE_ATOMIC_CAS32)
void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t old_value, new_value;
do {
old_value = *mem;
new_value = old_value - val;
} while (apr_atomic_cas32(mem, new_value, old_value) != old_value);
}
#else
void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
CHECK(apr_thread_mutex_lock(lock));
*mem -= val;
CHECK(apr_thread_mutex_unlock(lock));
#else
*mem -= val;
#endif /* APR_HAS_THREADS */
}
#endif /* defined(APR_OVERRIDE_ATOMIC_CAS32) */
#endif /* !defined(APR_OVERRIDE_ATOMIC_SUB32) */
#if !defined(APR_OVERRIDE_ATOMIC_SET32)
void apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
CHECK(apr_thread_mutex_lock(lock));
*mem = val;
CHECK(apr_thread_mutex_unlock(lock));
#else
*mem = val;
#endif /* APR_HAS_THREADS */
}
#endif /* !defined(APR_OVERRIDE_ATOMIC_SET32) */
#if !defined(APR_OVERRIDE_ATOMIC_INC32)
apr_uint32_t apr_atomic_inc32(volatile apr_uint32_t *mem)
{
return apr_atomic_add32(mem, 1);
}
#endif /* !defined(APR_OVERRIDE_ATOMIC_INC32) */
#if !defined(APR_OVERRIDE_ATOMIC_DEC32)
#if defined(APR_OVERRIDE_ATOMIC_CAS32)
int apr_atomic_dec32(volatile apr_uint32_t *mem)
{
apr_uint32_t old_value, new_value;
do {
old_value = *mem;
new_value = old_value - 1;
} while (apr_atomic_cas32(mem, new_value, old_value) != old_value);
return old_value != 1;
}
#else
int apr_atomic_dec32(volatile apr_uint32_t *mem)
{
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
apr_uint32_t new;
CHECK(apr_thread_mutex_lock(lock));
(*mem)--;
new = *mem;
CHECK(apr_thread_mutex_unlock(lock));
return new;
#else
(*mem)--;
return *mem;
#endif /* APR_HAS_THREADS */
}
#endif /* defined(APR_OVERRIDE_ATOMIC_CAS32) */
#endif /* !defined(APR_OVERRIDE_ATOMIC_DEC32) */
#if !defined(APR_OVERRIDE_ATOMIC_CAS32)
apr_uint32_t apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
apr_uint32_t cmp)
{
apr_uint32_t prev;
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
CHECK(apr_thread_mutex_lock(lock));
prev = *mem;
if (prev == cmp) {
*mem = with;
}
CHECK(apr_thread_mutex_unlock(lock));
#else
prev = *mem;
if (prev == cmp) {
*mem = with;
}
#endif /* APR_HAS_THREADS */
return prev;
}
#endif /* !defined(APR_OVERRIDE_ATOMIC_CAS32) */
#if !defined(APR_OVERRIDE_ATOMIC_XCHG32)
#if defined(APR_OVERRIDE_ATOMIC_CAS32)
apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t prev;
do {
prev = *mem;
} while (apr_atomic_cas32(mem, val, prev) != prev);
return prev;
}
#else
apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
apr_uint32_t prev;
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
CHECK(apr_thread_mutex_lock(lock));
prev = *mem;
*mem = val;
CHECK(apr_thread_mutex_unlock(lock));
#else
prev = *mem;
*mem = val;
#endif /* APR_HAS_THREADS */
return prev;
}
#endif /* defined(APR_OVERRIDE_ATOMIC_CAS32) */
#endif /* !defined(APR_OVERRIDE_ATOMIC_XCHG32) */
#if !defined(APR_OVERRIDE_ATOMIC_CASPTR)
void *apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
{
void *prev;
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
CHECK(apr_thread_mutex_lock(lock));
prev = *(void **)mem;
if (prev == cmp) {
*mem = with;
}
CHECK(apr_thread_mutex_unlock(lock));
#else
prev = *(void **)mem;
if (prev == cmp) {
*mem = with;
}
#endif /* APR_HAS_THREADS */
return prev;
}
#endif /* !defined(APR_OVERRIDE_ATOMIC_CASPTR) */
#if !defined(APR_OVERRIDE_ATOMIC_READ32)
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
{
return *mem;
}
#endif

View File

@@ -0,0 +1,123 @@
/* 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.
*/
#include "apr.h"
#include "apr_atomic.h"
#include "apr_thread_mutex.h"
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
return APR_SUCCESS;
}
/*
* Remapping function pointer type to accept apr_uint32_t's type-safely
* as the arguments for as our apr_atomic_foo32 Functions
*/
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_fn)
(apr_uint32_t volatile *);
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_fn)
(apr_uint32_t volatile *,
apr_uint32_t);
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn)
(apr_uint32_t volatile *,
apr_uint32_t, apr_uint32_t);
typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn)
(volatile void **,
void *, const void *);
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
#if (defined(_M_IA64) || defined(_M_AMD64))
return InterlockedExchangeAdd(mem, val);
#else
return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val);
#endif
}
/* Of course we want the 2's compliment of the unsigned value, val */
#pragma warning(disable: 4146)
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
#if (defined(_M_IA64) || defined(_M_AMD64))
InterlockedExchangeAdd(mem, -val);
#else
((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val);
#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
{
/* we return old value, win32 returns new value :( */
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
return InterlockedIncrement(mem) - 1;
#else
return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1;
#endif
}
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
{
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
return InterlockedDecrement(mem);
#else
return ((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem);
#endif
}
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
InterlockedExchange(mem, val);
#else
((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
{
return *mem;
}
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
apr_uint32_t cmp)
{
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
return InterlockedCompareExchange(mem, with, cmp);
#else
return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp);
#endif
}
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
{
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
return InterlockedCompareExchangePointer(mem, with, cmp);
#else
/* Too many VC6 users have stale win32 API files, stub this */
return ((apr_atomic_win32_ptr_ptr_ptr_fn)InterlockedCompareExchange)(mem, with, cmp);
#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
return InterlockedExchange(mem, val);
#else
return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
#endif
}

236
libs/apr/build-outputs.mk Normal file
View File

@@ -0,0 +1,236 @@
# DO NOT EDIT. AUTOMATICALLY GENERATED.
passwd/apr_getpass.lo: passwd/apr_getpass.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h
strings/apr_cpystrn.lo: strings/apr_cpystrn.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h
strings/apr_strnatcmp.lo: strings/apr_strnatcmp.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h
strings/apr_strings.lo: strings/apr_strings.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h
strings/apr_strtok.lo: strings/apr_strtok.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_pools.h
strings/apr_fnmatch.lo: strings/apr_fnmatch.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_fnmatch.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
strings/apr_snprintf.lo: strings/apr_snprintf.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
tables/apr_tables.lo: tables/apr_tables.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h include/apr_tables.h
tables/apr_hash.lo: tables/apr_hash.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_hash.h include/apr_pools.h
OBJECTS_all = passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_strnatcmp.lo strings/apr_strings.lo strings/apr_strtok.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo tables/apr_tables.lo tables/apr_hash.lo
atomic/unix/apr_atomic.lo: atomic/unix/apr_atomic.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_atomic.h include/apr_pools.h
OBJECTS_atomic_unix = atomic/unix/apr_atomic.lo
dso/unix/dso.lo: dso/unix/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_dso_unix = dso/unix/dso.lo
file_io/unix/flock.lo: file_io/unix/flock.c .make.dirs
file_io/unix/readwrite.lo: file_io/unix/readwrite.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_general.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_time.h include/apr_pools.h
file_io/unix/filepath_util.lo: file_io/unix/filepath_util.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_pools.h include/apr_tables.h
file_io/unix/seek.lo: file_io/unix/seek.c .make.dirs
file_io/unix/dir.lo: file_io/unix/dir.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/unix/mktemp.lo: file_io/unix/mktemp.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/unix/filedup.lo: file_io/unix/filedup.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/unix/tempdir.lo: file_io/unix/tempdir.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_env.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_inherit.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/unix/filepath.lo: file_io/unix/filepath.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/unix/pipe.lo: file_io/unix/pipe.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/unix/open.lo: file_io/unix/open.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_hash.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/unix/filestat.lo: file_io/unix/filestat.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/unix/copy.lo: file_io/unix/copy.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/unix/fileacc.lo: file_io/unix/fileacc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h
file_io/unix/fullrw.lo: file_io/unix/fullrw.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h
OBJECTS_file_io_unix = file_io/unix/flock.lo file_io/unix/readwrite.lo file_io/unix/filepath_util.lo file_io/unix/seek.lo file_io/unix/dir.lo file_io/unix/mktemp.lo file_io/unix/filedup.lo file_io/unix/tempdir.lo file_io/unix/filepath.lo file_io/unix/pipe.lo file_io/unix/open.lo file_io/unix/filestat.lo file_io/unix/copy.lo file_io/unix/fileacc.lo file_io/unix/fullrw.lo
locks/unix/thread_rwlock.lo: locks/unix/thread_rwlock.c .make.dirs
locks/unix/thread_mutex.lo: locks/unix/thread_mutex.c .make.dirs include/apr_want.h
locks/unix/thread_cond.lo: locks/unix/thread_cond.c .make.dirs
locks/unix/proc_mutex.lo: locks/unix/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h
locks/unix/global_mutex.lo: locks/unix/global_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_locks_unix = locks/unix/thread_rwlock.lo locks/unix/thread_mutex.lo locks/unix/thread_cond.lo locks/unix/proc_mutex.lo locks/unix/global_mutex.lo
memory/unix/apr_pools.lo: memory/unix/apr_pools.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_env.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_atomic.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_hash.h include/apr_lib.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_memory_unix = memory/unix/apr_pools.lo
misc/unix/charset.lo: misc/unix/charset.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
misc/unix/env.lo: misc/unix/env.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_env.h include/apr_thread_mutex.h include/apr_pools.h
misc/unix/version.lo: misc/unix/version.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_version.h include/apr_thread_mutex.h include/apr_pools.h
misc/unix/rand.lo: misc/unix/rand.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_pools.h
misc/unix/start.lo: misc/unix/start.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_signal.h include/apr_want.h include/apr_thread_mutex.h include/apr_atomic.h include/apr_pools.h
misc/unix/errorcodes.lo: misc/unix/errorcodes.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_dso.h include/apr_pools.h
misc/unix/getopt.lo: misc/unix/getopt.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h
misc/unix/otherchild.lo: misc/unix/otherchild.c .make.dirs
OBJECTS_misc_unix = misc/unix/charset.lo misc/unix/env.lo misc/unix/version.lo misc/unix/rand.lo misc/unix/start.lo misc/unix/errorcodes.lo misc/unix/getopt.lo misc/unix/otherchild.lo
mmap/unix/mmap.lo: mmap/unix/mmap.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_ring.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h include/apr_mmap.h
mmap/unix/common.lo: mmap/unix/common.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_ring.h include/apr_tables.h include/apr_time.h include/apr_pools.h include/apr_mmap.h
OBJECTS_mmap_unix = mmap/unix/mmap.lo mmap/unix/common.lo
network_io/unix/sockaddr.lo: network_io/unix/sockaddr.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h
network_io/unix/sockopt.lo: network_io/unix/sockopt.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h
network_io/unix/sendrecv.lo: network_io/unix/sendrecv.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_user.h include/apr_network_io.h include/apr_general.h include/apr_inherit.h include/apr_file_info.h include/apr_errno.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h
network_io/unix/multicast.lo: network_io/unix/multicast.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_general.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
network_io/unix/sockets.lo: network_io/unix/sockets.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_general.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
network_io/unix/inet_ntop.lo: network_io/unix/inet_ntop.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h
network_io/unix/inet_pton.lo: network_io/unix/inet_pton.c .make.dirs
OBJECTS_network_io_unix = network_io/unix/sockaddr.lo network_io/unix/sockopt.lo network_io/unix/sendrecv.lo network_io/unix/multicast.lo network_io/unix/sockets.lo network_io/unix/inet_ntop.lo network_io/unix/inet_pton.lo
poll/unix/epoll.lo: poll/unix/epoll.c .make.dirs
poll/unix/select.lo: poll/unix/select.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_poll.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
poll/unix/poll.lo: poll/unix/poll.c .make.dirs
poll/unix/port.lo: poll/unix/port.c .make.dirs
poll/unix/kqueue.lo: poll/unix/kqueue.c .make.dirs
OBJECTS_poll_unix = poll/unix/epoll.lo poll/unix/select.lo poll/unix/poll.lo poll/unix/port.lo poll/unix/kqueue.lo
random/unix/sha2.lo: random/unix/sha2.c .make.dirs
random/unix/apr_random.lo: random/unix/apr_random.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_random.h include/apr_thread_proc.h include/apr_time.h include/apr_pools.h include/apr_tables.h
random/unix/sha2_glue.lo: random/unix/sha2_glue.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_random.h include/apr_pools.h
OBJECTS_random_unix = random/unix/sha2.lo random/unix/apr_random.lo random/unix/sha2_glue.lo
shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_strings.h include/apr_thread_mutex.h include/apr_pools.h
OBJECTS_shmem_unix = shmem/unix/shm.lo
support/unix/waitio.lo: support/unix/waitio.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_general.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_poll.h include/apr_time.h include/apr_pools.h
OBJECTS_support_unix = support/unix/waitio.lo
threadproc/unix/procsup.lo: threadproc/unix/procsup.c .make.dirs
threadproc/unix/thread.lo: threadproc/unix/thread.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
threadproc/unix/signals.lo: threadproc/unix/signals.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_signal.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_pools.h
threadproc/unix/proc.lo: threadproc/unix/proc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_signal.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_proc_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_random.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
threadproc/unix/threadpriv.lo: threadproc/unix/threadpriv.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_threadproc_unix = threadproc/unix/procsup.lo threadproc/unix/thread.lo threadproc/unix/signals.lo threadproc/unix/proc.lo threadproc/unix/threadpriv.lo
time/unix/time.lo: time/unix/time.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
time/unix/timestr.lo: time/unix/timestr.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_time_unix = time/unix/time.lo time/unix/timestr.lo
user/unix/userinfo.lo: user/unix/userinfo.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
user/unix/groupinfo.lo: user/unix/groupinfo.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_user_unix = user/unix/userinfo.lo user/unix/groupinfo.lo
OBJECTS_unix = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_unix) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
dso/aix/dso.lo: dso/aix/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_dso_aix = dso/aix/dso.lo
OBJECTS_aix = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_aix) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
dso/beos/dso.lo: dso/beos/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_dso_beos = dso/beos/dso.lo
locks/beos/thread_rwlock.lo: locks/beos/thread_rwlock.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
locks/beos/thread_mutex.lo: locks/beos/thread_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
locks/beos/thread_cond.lo: locks/beos/thread_cond.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
locks/beos/proc_mutex.lo: locks/beos/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_locks_beos = locks/beos/thread_rwlock.lo locks/beos/thread_mutex.lo locks/beos/thread_cond.lo locks/beos/proc_mutex.lo
network_io/beos/socketcommon.lo: network_io/beos/socketcommon.c .make.dirs
network_io/beos/sendrecv.lo: network_io/beos/sendrecv.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_time.h include/apr_pools.h
OBJECTS_network_io_beos = network_io/beos/socketcommon.lo network_io/beos/sendrecv.lo
shmem/beos/shm.lo: shmem/beos/shm.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_shmem_beos = shmem/beos/shm.lo
threadproc/beos/apr_proc_stub.lo: threadproc/beos/apr_proc_stub.c .make.dirs
threadproc/beos/thread.lo: threadproc/beos/thread.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
threadproc/beos/proc.lo: threadproc/beos/proc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h
threadproc/beos/threadpriv.lo: threadproc/beos/threadpriv.c .make.dirs
threadproc/beos/threadproc_common.lo: threadproc/beos/threadproc_common.c .make.dirs
OBJECTS_threadproc_beos = threadproc/beos/apr_proc_stub.lo threadproc/beos/thread.lo threadproc/beos/proc.lo threadproc/beos/threadpriv.lo threadproc/beos/threadproc_common.lo
OBJECTS_beos = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_beos) $(OBJECTS_file_io_unix) $(OBJECTS_locks_beos) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_beos) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_beos) $(OBJECTS_support_unix) $(OBJECTS_threadproc_beos) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
dso/os2/dso.lo: dso/os2/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_dso_os2 = dso/os2/dso.lo
file_io/os2/dir_make_recurse.lo: file_io/os2/dir_make_recurse.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/os2/filesys.lo: file_io/os2/filesys.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h
file_io/os2/flock.lo: file_io/os2/flock.c .make.dirs
file_io/os2/readwrite.lo: file_io/os2/readwrite.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/os2/filepath_util.lo: file_io/os2/filepath_util.c .make.dirs
file_io/os2/seek.lo: file_io/os2/seek.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/os2/dir.lo: file_io/os2/dir.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/os2/mktemp.lo: file_io/os2/mktemp.c .make.dirs
file_io/os2/filedup.lo: file_io/os2/filedup.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/os2/tempdir.lo: file_io/os2/tempdir.c .make.dirs
file_io/os2/maperrorcode.lo: file_io/os2/maperrorcode.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/os2/filepath.lo: file_io/os2/filepath.c .make.dirs
file_io/os2/pipe.lo: file_io/os2/pipe.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/os2/open.lo: file_io/os2/open.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
file_io/os2/filestat.lo: file_io/os2/filestat.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
file_io/os2/copy.lo: file_io/os2/copy.c .make.dirs
file_io/os2/fileacc.lo: file_io/os2/fileacc.c .make.dirs
file_io/os2/fullrw.lo: file_io/os2/fullrw.c .make.dirs
OBJECTS_file_io_os2 = file_io/os2/dir_make_recurse.lo file_io/os2/filesys.lo file_io/os2/flock.lo file_io/os2/readwrite.lo file_io/os2/filepath_util.lo file_io/os2/seek.lo file_io/os2/dir.lo file_io/os2/mktemp.lo file_io/os2/filedup.lo file_io/os2/tempdir.lo file_io/os2/maperrorcode.lo file_io/os2/filepath.lo file_io/os2/pipe.lo file_io/os2/open.lo file_io/os2/filestat.lo file_io/os2/copy.lo file_io/os2/fileacc.lo file_io/os2/fullrw.lo
locks/os2/thread_rwlock.lo: locks/os2/thread_rwlock.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
locks/os2/thread_mutex.lo: locks/os2/thread_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
locks/os2/thread_cond.lo: locks/os2/thread_cond.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
locks/os2/proc_mutex.lo: locks/os2/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_locks_os2 = locks/os2/thread_rwlock.lo locks/os2/thread_mutex.lo locks/os2/thread_cond.lo locks/os2/proc_mutex.lo
network_io/os2/sockaddr.lo: network_io/os2/sockaddr.c .make.dirs
network_io/os2/sockopt.lo: network_io/os2/sockopt.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
network_io/os2/sendrecv_udp.lo: network_io/os2/sendrecv_udp.c .make.dirs include/apr_support.h include/apr_general.h include/apr_network_io.h include/apr_inherit.h include/apr_file_info.h include/apr_allocator.h include/apr_thread_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_lib.h include/apr_time.h include/apr_pools.h
network_io/os2/sendrecv.lo: network_io/os2/sendrecv.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h
network_io/os2/os2calls.lo: network_io/os2/os2calls.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
network_io/os2/sockets.lo: network_io/os2/sockets.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
network_io/os2/inet_ntop.lo: network_io/os2/inet_ntop.c .make.dirs
network_io/os2/inet_pton.lo: network_io/os2/inet_pton.c .make.dirs
OBJECTS_network_io_os2 = network_io/os2/sockaddr.lo network_io/os2/sockopt.lo network_io/os2/sendrecv_udp.lo network_io/os2/sendrecv.lo network_io/os2/os2calls.lo network_io/os2/sockets.lo network_io/os2/inet_ntop.lo network_io/os2/inet_pton.lo
poll/os2/pollset.lo: poll/os2/pollset.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_poll.h include/apr_time.h include/apr_pools.h include/apr_tables.h
poll/os2/poll.lo: poll/os2/poll.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_poll.h include/apr_time.h include/apr_pools.h include/apr_tables.h
OBJECTS_poll_os2 = poll/os2/pollset.lo poll/os2/poll.lo
shmem/os2/shm.lo: shmem/os2/shm.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_shmem_os2 = shmem/os2/shm.lo
threadproc/os2/thread.lo: threadproc/os2/thread.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
threadproc/os2/signals.lo: threadproc/os2/signals.c .make.dirs
threadproc/os2/proc.lo: threadproc/os2/proc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_signal.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_proc_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
threadproc/os2/threadpriv.lo: threadproc/os2/threadpriv.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_threadproc_os2 = threadproc/os2/thread.lo threadproc/os2/signals.lo threadproc/os2/proc.lo threadproc/os2/threadpriv.lo
OBJECTS_os2 = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_os2) $(OBJECTS_file_io_os2) $(OBJECTS_locks_os2) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_os2) $(OBJECTS_poll_os2) $(OBJECTS_random_unix) $(OBJECTS_shmem_os2) $(OBJECTS_support_unix) $(OBJECTS_threadproc_os2) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
atomic/os390/atomic.lo: atomic/os390/atomic.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_atomic.h include/apr_pools.h
OBJECTS_atomic_os390 = atomic/os390/atomic.lo
dso/os390/dso.lo: dso/os390/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h
OBJECTS_dso_os390 = dso/os390/dso.lo
OBJECTS_os390 = $(OBJECTS_all) $(OBJECTS_atomic_os390) $(OBJECTS_dso_os390) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
HEADERS = $(top_srcdir)/include/apr_thread_mutex.h $(top_srcdir)/include/apr_env.h $(top_srcdir)/include/apr_poll.h $(top_srcdir)/include/apr_fnmatch.h $(top_srcdir)/include/apr_global_mutex.h $(top_srcdir)/include/apr_pools.h $(top_srcdir)/include/apr_want.h $(top_srcdir)/include/apr_file_io.h $(top_srcdir)/include/apr_version.h $(top_srcdir)/include/apr_mmap.h $(top_srcdir)/include/apr_dso.h $(top_srcdir)/include/apr_thread_proc.h $(top_srcdir)/include/apr_errno.h $(top_srcdir)/include/apr_shm.h $(top_srcdir)/include/apr_network_io.h $(top_srcdir)/include/apr_signal.h $(top_srcdir)/include/apr_user.h $(top_srcdir)/include/apr_support.h $(top_srcdir)/include/apr_atomic.h $(top_srcdir)/include/apr_random.h $(top_srcdir)/include/apr_thread_cond.h $(top_srcdir)/include/apr_thread_rwlock.h $(top_srcdir)/include/apr_getopt.h $(top_srcdir)/include/apr_inherit.h $(top_srcdir)/include/apr_strings.h $(top_srcdir)/include/apr_general.h $(top_srcdir)/include/apr_proc_mutex.h $(top_srcdir)/include/apr_tables.h $(top_srcdir)/include/apr_ring.h $(top_srcdir)/include/apr_file_info.h $(top_srcdir)/include/apr_allocator.h $(top_srcdir)/include/apr_portable.h $(top_srcdir)/include/apr_hash.h $(top_srcdir)/include/apr_time.h $(top_srcdir)/include/apr_lib.h
SOURCE_DIRS = random/unix dso/os2 time/unix locks/unix user/unix locks/beos tables support/unix file_io/unix mmap/unix atomic/unix poll/os2 dso/os390 atomic/os390 dso/beos poll/unix passwd network_io/beos threadproc/os2 network_io/os2 threadproc/beos shmem/unix network_io/unix file_io/os2 dso/aix threadproc/unix misc/unix shmem/beos dso/unix locks/os2 shmem/os2 memory/unix strings $(EXTRA_SOURCE_DIRS)
BUILD_DIRS = atomic atomic/os390 atomic/unix dso dso/aix dso/beos dso/os2 dso/os390 dso/unix file_io file_io/os2 file_io/unix locks locks/beos locks/os2 locks/unix memory memory/unix misc misc/unix mmap mmap/unix network_io network_io/beos network_io/os2 network_io/unix passwd poll poll/os2 poll/unix random random/unix shmem shmem/beos shmem/os2 shmem/unix strings support support/unix tables threadproc threadproc/beos threadproc/os2 threadproc/unix time time/unix user user/unix
.make.dirs: $(srcdir)/build-outputs.mk
@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done
@echo timestamp > $@

26
libs/apr/build.conf Normal file
View File

@@ -0,0 +1,26 @@
#
# Configuration file for APR. Used by APR/build/gen-build.py
#
[options]
# paths to platform-independent .c files to build
paths =
passwd/*.c
strings/*.c
tables/*.c
# directories that have platform-specific code in them. the resulting
# pattern will be: SUBDIR/PLATFORM/*.c
platform_dirs =
atomic dso file_io locks memory misc mmap network_io poll random
shmem support threadproc time user
# all the public headers
headers = include/*.h
# aplibtool is manually built by the configure process
# build/aplibtool.c
# we have a recursive makefile for the test files (for now)
# test/*.c

39
libs/apr/build/MakeEtags Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
# This file illustrates how to generate a useful TAGS file via etags
# for emacs. This should be invoked from the top source directory i.e.:
# > build/MakeEtags
# and will create a TAGS file in the top source directory.
# This script falls under the Apache License.
# See http://www.apache.org/docs/LICENSE
# Once you have created ./TAGS in emacs you'll need to setup
# tag-table-alist with an entry to assure it finds the single ./TAGS
# file from the many source directories. Something along these lines:
# (setq tag-table-alist
# '(("/home/me/work/httpd-2.0/"
# . "/home/me/work/httpd-2.0/")
# ))
# This requires a special version of etags, i.e. the
# one called "Exuberant ctags" available at:
# http://fly.hiwaay.net/~darren/ctags/
# Once that is setup you'll need to point to the
# executable here:
etags=~/local/bin/etags
# Exuberant etags is necessary since it can ignore some defined symbols
# that obscure the function signatures.
ignore=AP_DECLARE,AP_DECLARE_NONSTD,__declspec
# Create an etags file at the root of the source
# tree, then create symbol links to it from each
# directory in the source tree. By passing etags
# absolute pathnames we get a tag file that is
# NOT portable when we move the directory tree.
find . -name '*.[ch]' -print | $etags -I "$ignore" -L -

View File

@@ -0,0 +1,304 @@
#
# Setup needed Tools and Libraries
#
ifeq "$(wildcard $(APR_WORK)\build\NWGNUcustom.inc)" "$(APR_WORK)\build\NWGNUcustom.inc"
include $(APR_WORK)\build\NWGNUcustom.inc
CUSTOM_INI = $(AP_WORK)\NWGNUcustom.ini
endif
ifndef VERBOSE
.SILENT:
endif
#
# Treat like an include
#
ifndef EnvironmentDefined
#
# simple macros for parsing makefiles
#
EOLIST:=
EMPTY :=
COMMA := ,
SPACE := $(EMPTY) $(EMPTY)
#
# Base environment
#
# Try and handle case issues
ifndef NOVELLLIBC
ifdef NovellLibC
NOVELLLIBC = $(NovellLibC)
endif
endif
ifndef NOVELLLIBC
NOVELLLIBC = C:/novell/ndk/libc
endif
# This is a placeholder
# ifndef LDAPSDK
# LDAPSDK = C:/novell/ndk/cldapsdk
# endif
ifndef METROWERKS
METROWERKS = C:\Program Files\Metrowerks\CodeWarrior
endif
# If LM_LICENSE_FILE isn't defined, define a variable that can be used to
# restart make with it defined
ifndef LM_LICENSE_FILE
NO_LICENSE_FILE = NO_LICENSE_FILE
endif
#
# Set the Release type that you want to build, possible values are:
#
# debug - full debug switches are set
# noopt - normal switches are set (default)
# optimized - optimization switches are set
ifdef reltype
RELEASE=$(reltype)
endif
ifdef RELTYPE
RELEASE=$(RELTYPE)
endif
ifdef debug
RELEASE=debug
endif
ifdef DEBUG
RELEASE=debug
endif
ifdef optimized
RELEASE=optimized
endif
ifdef OPTIMIZED
RELEASE=optimized
endif
ifndef RELEASE
RELEASE = optimized
endif
ifeq "$(RELEASE)" "debug"
OBJDIR = Debug
endif
ifeq "$(RELEASE)" "noopt"
OBJDIR = Noopt
endif
ifeq "$(RELEASE)" "optimized"
OBJDIR = Release
endif
#
# Setup compiler information
#
# MetroWerks NLM tools
CC = mwccnlm
CPP = mwccnlm
LINK = mwldnlm
LIB = mwldnlm -type library -w nocmdline
ifdef IPV6
ifndef USE_STDSOCKETS
USE_STDSOCKETS=1
endif
endif
NOVI = $(NOVELLLIBC)\imports
INCDIRS = $(NOVELLLIBC)\include;$(NOVELLLIBC)\include\nks;$(NOVELLLIBC)\include\winsock;
DEFINES = -DNETWARE
ifndef USE_STDSOCKETS
DEFINES += -DUSE_WINSOCK
endif
ifndef DEBUG
DEFINES += -DNDEBUG
endif
#
# MetroWerks static Libraries
CLIB3S = $(METROWERKS)\Novell Support\Metrowerks Support\Libraries\Runtime\mwcrtl.lib
MATH3S =
PLIB3S = $(METROWERKS)\Novell Support\Metrowerks Support\Libraries\MSL C++\MWCPP.lib
# Base compile flags
# and prefix or precompiled header added here.
# The default flags are as follows:
#
# -c compile only, no link
# -nosyspath treat #include <...> like #include "..."
# -Cpp_exceptions off disable C++ exceptions
# -RTTI off disable C++ run-time typing information
# -align 4 align on 4 byte bounderies
# -w nocmdline disable command-line driver/parser warnings
# -proc PII generate code base on Pentium II instruction set
# -inst mmx use MMX extensions (not used)
CFLAGS = -c -nosyspath -Cpp_exceptions off -RTTI off -align 4 -w nocmdline -proc PII
# -g generate debugging information
# -O0 level 0 optimizations
ifeq "$(RELEASE)" "debug"
CFLAGS += -g -O0
endif
# -O4,p level 4 optimizations, optimize for speed
ifeq "$(RELEASE)" "optimized"
CFLAGS += -O4,p
endif
# -prefix apr_arch_pre_nw.h #include pre_nw.h for all files
CFLAGS += -prefix apr_arch_pre_nw.h
PATH:=$(PATH);$(METROWERKS)\bin;$(METROWERKS)\Other Metrowerks Tools\Command Line Tools
#
# Declare major project deliverables output directories here
#
ifdef DEST
INSTALL = $(DEST)
ifeq (\, $(findstring \,$(INSTALL)))
INSTDIRS = $(DEST)
endif
endif
ifdef dest
INSTALL = $(dest)
ifeq (\, $(findstring \,$(INSTALL)))
INSTDIRS = $(dest)
endif
endif
ifndef INSTALL
INSTALL = $(APR_WORK)\Dist
INSTDIRS = $(APR_WORK)\Dist
endif
# Add support for building IPV6 alongside
ifneq "$(IPV6)" ""
DEFINES += -DNW_BUILD_IPV6
INCDIRS := $(NOVELLLIBC)\include\winsock\IPV6;$(INCDIRS)
ifneq "$(findstring IPV6,$(OBJDIR))" "IPV6"
OBJDIR := $(OBJDIR)_IPV6
endif
ifneq "$(findstring IPV6,$(INSTALL))" "IPV6"
INSTALL := $(INSTALL)_IPV6
endif
ifneq "$(findstring IPV6,$(INSTDIRS))" "IPV6"
INSTDIRS := $(INSTDIRS)_IPV6
endif
endif
ifdef DEST
INSTALLBASE := $(INSTALL)\Apache2
INSTDEVDIRS := \
$(INSTDIRS) \
$(INSTALLBASE) \
$(INSTALLBASE)\include \
$(INSTALLBASE)\lib \
INSTDIRS += \
$(INSTALLBASE) \
else
INSTALLBASE := $(INSTALL)\apr
INSTDEVDIRS := \
$(INSTDIRS) \
$(INSTALLBASE) \
$(INSTALLBASE)\include \
$(INSTALLBASE)\lib \
INSTDIRS += \
$(INSTALLBASE) \
endif
#
# Declare Command and tool macros here
#
# Os2LibPath is an extra check to see if we are on NT
ifdef Os2LibPath
OS = Windows_NT
endif
ifeq "$(OS)" "Windows_NT"
CMD=cmd /C
CHK=cmd /C if exist
CHKNOT=cmd /C if not exist
DEL = del /F
DELTREE = cmd /C rd /s/q
WINNT=1
XCOPYSW = /E
else
CMD=command /C
CHK=command /C if exist
CHKNOT=command /C if not exist
DEL = del
DELTREE = deltree /y
XCOPYSW = /E /Y
endif
#
# Setup base C compiler flags
#
#
# Common directories
#
APR = $(APR_WORK)
APRTEST = $(APR_WORK)/test
APRUTIL = $(APU_WORK)
APULDAP = $(APU_WORK)/ldap
XML = $(APRUTIL)/xml
#
# Internal Libraries
#
APRLIB = $(APR)/$(OBJDIR)/aprlib.lib
APRUTLIB = $(APRUTIL)/$(OBJDIR)/aprutil.lib
APULDAPLIB = $(APULDAP)/$(OBJDIR)/apuldap.lib
XMLLIB = $(XML)/$(OBJDIR)/xmllib.lib
#
# Additional general defines
#
EnvironmentDefined = 1
endif # ifndef EnvironmentDefined
# This is always set so that it will show up in lower directories
ifdef Path
Path = $(PATH)
endif

View File

@@ -0,0 +1,96 @@
#
# Obtain the global build environment
#
include $(APR_WORK)\build\NWGNUenvironment.inc
#
# Define base targets and rules
#
TARGETS = libs nlms install clobber_libs clobber_nlms clean installdev
.PHONY : $(TARGETS) default all help $(NO_LICENSE_FILE)
# Here is where we will use the NO_LICENSE_FILE variable to see if we need to
# restart the make with it defined
ifdef NO_LICENSE_FILE
default: NO_LICENSE_FILE
all: NO_LICENSE_FILE
install :: NO_LICENSE_FILE
installdev :: NO_LICENSE_FILE
NO_LICENSE_FILE :
$(MAKE) $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(METROWERKS)\license.dat"
else # LM_LICENSE_FILE must be defined so use the real targets
default: $(SUBDIRS) libs nlms
all: $(SUBDIRS) libs nlms install
$(TARGETS) :: $(SUBDIRS)
endif #NO_LICENSE_FILE check
help :
@echo targets for RELEASE=$(RELEASE):
@echo (default) . . . . libs nlms
@echo all . . . . . . . does everything (libs nlms install)
@echo libs. . . . . . . builds all libs
@echo nlms. . . . . . . builds all nlms
@echo install . . . . . builds libs and nlms and copies install files to
@echo "$(INSTALL)"
@echo installdev. . . . copies headers and files needed for development to
@echo "$(INSTALL)"
@echo clean . . . . . . deletes $(OBJDIR) dirs, *.err, and *.map
@echo clobber_all . . . deletes all possible output from the make
@echo clobber_install . deletes all files in $(INSTALL)
@$(CMD) echo.
@echo Multiple targets can be used on a single nmake command line -
@echo (i.e. $(MAKE) clean all)
@$(CMD) echo.
@echo You can also specify RELEASE=debug, RELEASE=noopt, or RELEASE=optimized
@echo The default is RELEASE=optimized
clobber_all :: clean clobber_install
clobber_install ::
-$(DELTREE) $(INSTALL) 2>NUL
#
# build recursive targets
#
$(SUBDIRS) : FORCE
ifneq "$(MAKECMDGOALS)" "clean"
$(CMD) echo.
@echo Building $(CURDIR)/$@
endif
$(MAKE) -C $@ $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(LM_LICENSE_FILE)"
$(CMD) echo.
FORCE:
#
# Standard targets
#
clean :: $(SUBDIRS)
@echo Cleaning up $(CURDIR)
-$(DELTREE) $(OBJDIR) 2> NUL
$(CHK) *.err $(DEL) *.err
$(CHK) *.map $(DEL) *.map
$(CHK) *.d $(DEL) *.d
$(CHK) *.tmp $(DEL) *.tmp
$(CHK) xc.bat $(DEL) xc.bat
-$(DELTREE) $(OBJDIR) 2> NUL
$(OBJDIR) ::
$(CHKNOT) $(OBJDIR)\nul mkdir $(OBJDIR)

View File

@@ -0,0 +1,94 @@
#
# Declare the sub-directories to be built here
#
SUBDIRS = \
$(EOLIST)
#
# Get the 'head' of the build environment. This includes default targets and
# paths to tools
#
include $(APR_WORK)\build\NWGNUhead.inc
#
# build this level's files
FILES_prebuild_headers = \
$(APR)/include/apr.h \
$(APRUTIL)/include/apu.h \
$(APRUTIL)/include/apu_want.h \
$(APRUTIL)/include/apr_ldap.h \
$(APRUTIL)/include/private/apu_config.h \
$(APRUTIL)/include/private/apu_select_dbm.h \
$(APRUTIL)/xml/expat/lib/expat.h \
$(APRUTIL)/xml/expat/lib/config.h \
$(EOLIST)
nlms :: $(APR)/aprlib.imp
$(APR)/aprlib.imp : make_nw_export.awk nw_export.i
@echo Generating $(subst /,\,$@)
awk -f make_nw_export.awk nw_export.i | sort >$(APR)/aprlib.imp
nw_export.i : nw_export.inc $(FILES_prebuild_headers) $(NLM_NAME)_cc.opt
@echo Generating $(subst /,\,$@)
$(CC) $< @$(NLM_NAME)_cc.opt
$(NLM_NAME)_cc.opt : NWGNUmakefile $(APR_WORK)\build\NWGNUenvironment.inc $(APR_WORK)\build\NWGNUhead.inc $(APR_WORK)\build\NWGNUtail.inc $(CUSTOM_INI)
$(CHK) $@ $(DEL) $@
@echo -P >> $@
@echo -EP >> $@
@echo -nosyspath >> $@
@echo -w nocmdline >> $@
@echo $(DEFINES) -DGENEXPORTS >> $@
@echo -I$(APR)\include >> $@
@echo -I$(APR)\include\arch\netware >> $@
@echo -I$(APR)\include\arch\unix >> $@
@echo -I$(APRUTIL)\include >> $@
@echo -ir $(NOVELLLIBC) >> $@
ifneq "$(LDAPSDK)" ""
@echo -ir $(LDAPSDK) >> $@
endif
$(APR)/include/%.h: $(subst /,\,$(APR))\include\%.hnw
@echo Creating $(subst /,\,$@)
copy $< $(subst /,\,$(APR))\include\$(@F)
$(APRUTIL)/include/%.h: $(subst /,\,$(APRUTIL))\include\%.hnw
@echo Creating $(subst /,\,$@)
copy $< $(subst /,\,$(APRUTIL))\include\$(@F)
$(APRUTIL)/include/private/%.h: $(subst /,\,$(APRUTIL))\include\private\%.hw
@echo Creating $(subst /,\,$@)
copy $< $(subst /,\,$(APRUTIL))\include\private\$(@F)
$(APRUTIL)/xml/expat/lib/%.h: $(subst /,\,$(APRUTIL))\xml\expat\lib\%.hnw
@echo Creating $(subst /,\,$@)
copy $< $(subst /,\,$(APRUTIL))\xml\expat\lib\$(@F)
$(APRUTIL)/xml/expat/lib/%.h: $(subst /,\,$(APRUTIL))\xml\expat\lib\%.h.in
@echo Creating $(subst /,\,$@)
copy $< $(subst /,\,$(APRUTIL))\xml\expat\lib\$(@F)
#
# You can use this target if all that is needed is to copy files to the
# installation area
#
install :: nlms FORCE
clean ::
$(CHK) nw_export.i $(DEL) nw_export.i
$(CHK) $(NLM_NAME)_cc.opt $(DEL) $(NLM_NAME)_cc.opt
$(CHK) NWGNUversion.inc $(DEL) NWGNUversion.inc
$(CHK) $(subst /,\,$(APR))\include\apr.h $(DEL) $(subst /,\,$(APR))\include\apr.h
$(CHK) $(subst /,\,$(APRUTIL))\include\apu.h $(DEL) $(subst /,\,$(APRUTIL))\include\apu.h
$(CHK) $(subst /,\,$(APRUTIL))\include\apr_ldap.h $(DEL) $(subst /,\,$(APRUTIL))\include\apr_ldap.h
$(CHK) $(subst /,\,$(APRUTIL))\include\private\apu_config.h $(DEL) $(subst /,\,$(APRUTIL))\include\private\apu_config.h
$(CHK) $(subst /,\,$(APRUTIL))\include\private\apu_select_dbm.h $(DEL) $(subst /,\,$(APRUTIL))\include\private\apu_select_dbm.h
$(CHK) $(subst /,\,$(APRUTIL))\xml\expat\lib\expat.h $(DEL) $(subst /,\,$(APRUTIL))\xml\expat\lib\expat.h
$(CHK) $(subst /,\,$(APRUTIL))\xml\expat\lib\config.h $(DEL) $(subst /,\,$(APRUTIL))\xml\expat\lib\config.h
$(CHK) $(subst /,\,$(APR))\aprlib.imp $(DEL) $(subst /,\,$(APR))\aprlib.imp

View File

@@ -0,0 +1,327 @@
#
# This contains final targets and should be included at the end of any
# NWGNUmakefile file
#
#
# If we are going to create an nlm, make sure we have assigned variables to
# use during the link.
#
echo NLM_NAME=$(NLM_NAME)
ifndef NLM_NAME
NLM_NAME = $(TARGET_nlm)
endif
ifndef NLM_DESCRIPTION
NLM_DESCRIPTION = $(NLM_NAME)
endif
ifndef NLM_THREAD_NAME
NLM_THREAD_NAME = $(NLM_NAME) Thread
endif
ifndef NLM_SCREEN_NAME
NLM_SCREEN_NAME = DEFAULT
endif
ifndef NLM_COPYRIGHT
NLM_COPYRIGHT = Licensed to the Apache Software Foundation (ASF) under one or more
NLM_COPYRIGHT = contributor license agreements. See the NOTICE file distributed with
NLM_COPYRIGHT = this work for additional information regarding copyright ownership.
NLM_COPYRIGHT = The ASF licenses this file to You under the Apache License, Version 2.0
NLM_COPYRIGHT = (the "License"); you may not use this file except in compliance with
NLM_COPYRIGHT = the License. You may obtain a copy of the License at
endif
#
# Create dependency lists based on the files available
#
CCOPT_DEPENDS = \
$(APR_WORK)\build\NWGNUhead.inc \
$(APR_WORK)\build\NWGNUenvironment.inc \
$(APR_WORK)\build\NWGNUtail.inc \
NWGNUmakefile \
$(CUSTOM_INI) \
$(EOLIST)
CPPOPT_DEPENDS = \
$(APR_WORK)\build\NWGNUhead.inc \
$(APR_WORK)\build\NWGNUenvironment.inc \
$(APR_WORK)\build\NWGNUtail.inc \
NWGNUmakefile \
$(CUSTOM_INI) \
$(EOLIST)
$(NLM_NAME)_LINKOPT_DEPENDS = \
$(TARGET_lib) \
$(APR_WORK)\build\NWGNUenvironment.inc \
NWGNUmakefile \
$(APR_WORK)\build\NWGNUtail.inc \
$(CUSTOM_INI) \
$(VERSION_INC) \
$(EOLIST)
ifeq "$(words $(strip $(TARGET_lib)))" "1"
LIB_NAME = $(basename $(notdir $(TARGET_lib)))
$(LIB_NAME)_LIBLST_DEPENDS = \
$(FILES_lib_objs) \
$(APR_WORK)\build\NWGNUenvironment.inc \
NWGNUmakefile \
$(APR_WORK)\build\NWGNUtail.inc \
$(CUSTOM_INI) \
$(EOLIST)
endif
ifeq "$(wildcard NWGNU$(LIB_NAME))" "NWGNU$(LIB_NAME)"
$(LIB_NAME)_LIBLST_DEPENDS += NWGNU$(LIB_NAME)
endif
ifeq "$(wildcard NWGNU$(NLM_NAME))" "NWGNU$(NLM_NAME)"
$(NLM_NAME)_LINKOPT_DEPENDS += NWGNU$(NLM_NAME)
CCOPT_DEPENDS += NWGNU$(NLM_NAME)
CPPOPT_DEPENDS += NWGNU$(NLM_NAME)
endif
#
# Generic compiler rules
#
$(APR_WORK)\build\NWGNUversion.inc : $(APR_WORK)\include\apr_version.h $(APR_WORK)\build\nw_ver.awk
@echo Generating $(subst /,\,$@)
awk -f $(APR_WORK)\build\nw_ver.awk $(APR_WORK)\include\apr_version.h > $(APR_WORK)\build\NWGNUversion.inc
-include $(APR_WORK)\build\NWGNUversion.inc
ifneq "$(strip $(VERSION_STR))" ""
VERSION_INC = $(APR_WORK)\build\NWGNUversion.inc
else
VERSION = 1,0,0
VERSION_STR = 1.0.0
endif
ifeq "$(words $(strip $(TARGET_nlm)))" "1"
INCLUDE_BLDCMDS=1
endif
ifeq "$(words $(strip $(TARGET_lib)))" "1"
INCLUDE_BLDCMDS=1
endif
ifeq "$(INCLUDE_BLDCMDS)" "1"
$(OBJDIR)/%.o: %.c $(OBJDIR)\$(NLM_NAME)_cc.opt
@echo Compiling $<
$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\$(NLM_NAME)_cc.opt
$(OBJDIR)\$(NLM_NAME)_cc.opt: $(CCOPT_DEPENDS)
@echo CCOPT_DEPENDS=$(CCOPT_DEPENDS)
$(CHK) $@ $(DEL) $@
@echo Generating $@
ifneq "$(strip $(CFLAGS))" ""
@echo $(CFLAGS) >> $@
endif
ifneq "$(strip $(XCFLAGS))" ""
@echo $(XCFLAGS) >> $@
endif
ifneq "$(strip $(XINCDIRS))" ""
@echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
endif
ifneq "$(strip $(INCDIRS))" ""
@echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
endif
ifneq "$(strip $(DEFINES))" ""
@echo $(DEFINES) >> $@
endif
ifneq "$(strip $(XDEFINES))" ""
@echo $(XDEFINES) >> $@
endif
$(OBJDIR)/%.o: %.cpp $(OBJDIR)\cpp.opt
@echo Compiling $<
$(CPP) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cpp.opt
$(OBJDIR)\cpp.opt: $(CPPOPT_DEPENDS)
$(CHK) $@ $(DEL) $@
@echo Generating $@
ifneq "$(strip $(CFLAGS))" ""
@echo $(CFLAGS) >> $@
endif
ifneq "$(strip $(XCFLAGS))" ""
@echo $(XCFLAGS) >> $@
endif
ifneq "$(strip $(XINCDIRS))" ""
@echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
endif
ifneq "$(strip $(INCDIRS))" ""
@echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
endif
ifneq "$(strip $(DEFINES))" ""
@echo $(DEFINES) >> $@
endif
ifneq "$(strip $(XDEFINES))" ""
@echo $(XDEFINES) >> $@
endif
endif # one target nlm
#
# Rules to build libraries
#
# If we only have one target library then build it
ifeq "$(words $(strip $(TARGET_lib)))" "1"
$(TARGET_lib) : $(OBJDIR)\$(LIB_NAME)_lib.lst
@echo Generating $@
$(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
$(LIB) -o $(OBJDIR)\$(@F) @$?
$(OBJDIR)\$(LIB_NAME)_lib.lst: $($(LIB_NAME)_LIBLST_DEPENDS)
$(CHK) $@ $(DEL) $@
@echo Generating $@
ifneq "$(strip $(FILES_lib_objs))" ""
@echo $(foreach objfile,$(FILES_lib_objs),$(subst /,\,$(objfile)) ) >> $@
endif
else # We must have more than one target library so load the individual makefiles
$(OBJDIR)/%.lib: NWGNU% $(APR_WORK)\build\NWGNUhead.inc $(APR_WORK)\build\NWGNUtail.inc $(APR_WORK)\build\NWGNUenvironment.inc FORCE
@echo Calling $<
$(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
endif
#
# Rules to build nlms.
#
vpath libcpre.o $(NOVELLLIBC)\imports
# If we only have one target NLM then build it
ifeq "$(words $(strip $(TARGET_nlm)))" "1"
$(TARGET_nlm) : $(FILES_nlm_objs) $(FILES_nlm_libs) $(OBJDIR)\$(NLM_NAME)_link.opt
@echo Linking $@
$(LINK) @$(OBJDIR)\$(NLM_NAME)_link.opt
# This will force the link option file to be rebuilt if we change the
# corresponding makefile
$(OBJDIR)\$(NLM_NAME)_link.opt : $($(NLM_NAME)_LINKOPT_DEPENDS)
$(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
$(CHK) $(OBJDIR)\$(NLM_NAME)_link.def $(DEL) $(OBJDIR)\$(NLM_NAME)_link.def
@echo Generating $@
@echo -warnings off >> $@
@echo -zerobss >> $@
@echo -desc "$(NLM_DESCRIPTION)" >> $@
@echo -o $(TARGET_nlm) >> $@
ifneq "$(FILE_nlm_copyright)" ""
@-type $(FILE_nlm_copyright) >> $@
else
@echo -copy "$(NLM_COPYRIGHT)" >> $@
endif
ifeq "$(RELEASE)" "debug"
@echo -g >> $@
@echo -sym internal >> $@
@echo -sym codeview4 >> $@
@echo -osym $(OBJDIR)\$(NLM_NAME).sym >> $@
else
@echo -sym internal >> $@
endif
@echo -screenname "$(NLM_SCREEN_NAME)" >> $@
ifneq "$(NLM_VERSION)" ""
@echo -nlmversion=$(NLM_VERSION) >> $@
else
@echo -nlmversion=$(VERSION) >> $@
endif
@echo -l $(APR)/$(OBJDIR) >> $@
@echo -l $(APRUTIL)/$(OBJDIR) >> $@
@echo -l $(APULDAP)/$(OBJDIR) >> $@
@echo -l $(XML)/$(OBJDIR) >> $@
@echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime" >> $@
@echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++" >> $@
ifneq "$(IPV6)" ""
@echo -l $(NOVELLLIBC)\include\winsock\IPV6 >> $@
endif
@echo -l $(NOVELLLIBC)/imports >> $@
ifneq "$(LDAPSDK)" ""
@echo -l $(LDAPSDK)/lib/nlm >> $@
endif
@echo -nodefaults >> $@
@echo -map $(OBJDIR)\$(NLM_NAME).map>> $@
@echo -threadname "$(NLM_THREAD_NAME)" >> $@
ifneq "$(NLM_STACK_SIZE)" ""
@echo -stacksize $(subst K,000,$(subst k,K,$(strip $(NLM_STACK_SIZE)))) >> $@
else
@echo -stacksize 64000 >> $@
endif
ifneq "$(NLM_ENTRY_SYM)" ""
@echo -entry $(NLM_ENTRY_SYM) >> $@
endif
ifneq "$(NLM_EXIT_SYM)" ""
@echo -exit $(NLM_EXIT_SYM) >> $@
endif
ifneq "$(NLM_CHECK_SYM)" ""
@echo -check $(NLM_CHECK_SYM) >> $@
endif
ifneq "$(NLM_FLAGS)" ""
@echo -flags $(NLM_FLAGS) >> $@
endif
ifneq "$(strip $(XLFLAGS))" ""
@echo $(XLFLAGS) >> $@
endif
ifneq "$(strip $(FILES_nlm_objs))" ""
@echo $(foreach objfile,$(strip $(FILES_nlm_objs)),$(subst /,\,$(objfile))) >> $@
endif
ifneq "$(FILES_nlm_libs)" ""
@echo $(foreach libfile, $(notdir $(strip $(FILES_nlm_libs))),-l$(subst /,\,$(libfile))) >> $@
endif
@echo -commandfile $(OBJDIR)\$(NLM_NAME)_link.def >> $@
ifneq "$(FILE_nlm_msg)" ""
@echo Messages $(FILE_nlm_msg) >> $(OBJDIR)\$(NLM_NAME)_link.def
endif
ifneq "$(FILE_nlm_hlp)" ""
@echo Help $(FILE_nlm_hlp) >> $(OBJDIR)\$(NLM_NAME)_link.def
endif
ifneq "$(FILES_nlm_modules)" ""
@echo module $(foreach module,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_modules))),$(subst /,\,$(module))) >> $(OBJDIR)\$(NLM_NAME)_link.def
endif
ifneq "$(FILES_nlm_Ximports)" ""
@echo Import $(foreach import,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_Ximports))),$(subst /,\,$(import))) >> $(OBJDIR)\$(NLM_NAME)_link.def
endif
ifneq "$(FILES_nlm_exports)" ""
@echo Export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_exports))),$(subst /,\,$(export))) >> $(OBJDIR)\$(NLM_NAME)_link.def
endif
# if APACHE_UNIPROC is defined, don't include XDCData
ifndef APACHE_UNIPROC
ifneq "$(string $(XDCDATA))" ""
@echo XDCData $(XDCDATA) >> $(OBJDIR)\$(NLM_NAME)_link.def
else
@echo XDCData $(APR)\misc\netware\apr.xdc >> $(OBJDIR)\$(NLM_NAME)_link.def
endif
endif
else # more than one target so look for individual makefiles.
# Only include these if NO_LICENSE_FILE isn't set to prevent excessive
# recursion
ifndef NO_LICENSE_FILE
$(OBJDIR)/%.nlm: NWGNU% $(APR_WORK)\build\NWGNUhead.inc $(APR_WORK)\build\NWGNUtail.inc $(APR_WORK)\build\NWGNUenvironment.inc $(CUSTOM_INI) $(VERSION_INC) FORCE
@echo Calling $<
$(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
$(CMD) echo.
else
$(TARGET_nlm):
endif # NO_LICENSE_FILE
endif # multiple targets

130
libs/apr/build/PrintPath Executable file
View File

@@ -0,0 +1,130 @@
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Look for program[s] somewhere in $PATH.
#
# Options:
# -s
# Do not print out full pathname. (silent)
# -pPATHNAME
# Look in PATHNAME instead of $PATH
#
# Usage:
# PrintPath [-s] [-pPATHNAME] program [program ...]
#
# Initially written by Jim Jagielski for the Apache configuration mechanism
# (with kudos to Kernighan/Pike)
##
# Some "constants"
##
pathname=$PATH
echo="yes"
##
# Find out what OS we are running for later on
##
os=`(uname) 2>/dev/null`
##
# Parse command line
##
for args in $*
do
case $args in
-s ) echo="no" ;;
-p* ) pathname="`echo $args | sed 's/^..//'`" ;;
* ) programs="$programs $args" ;;
esac
done
##
# Now we make the adjustments required for OS/2 and everyone
# else :)
#
# First of all, all OS/2 programs have the '.exe' extension.
# Next, we adjust PATH (or what was given to us as PATH) to
# be whitespace separated directories.
# Finally, we try to determine the best flag to use for
# test/[] to look for an executable file. OS/2 just has '-r'
# but with other OSs, we do some funny stuff to check to see
# if test/[] knows about -x, which is the prefered flag.
##
if [ "x$os" = "xOS/2" ]
then
ext=".exe"
pathname=`echo -E $pathname |
sed 's/^;/.;/
s/;;/;.;/g
s/;$/;./
s/;/ /g
s/\\\\/\\//g' `
test_exec_flag="-r"
else
ext="" # No default extensions
pathname=`echo $pathname |
sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g' `
# Here is how we test to see if test/[] can handle -x
testfile="pp.t.$$"
cat > $testfile <<ENDTEST
#!/bin/sh
if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then
exit 0
fi
exit 1
ENDTEST
if `/bin/sh $testfile 2>/dev/null`; then
test_exec_flag="-x"
else
test_exec_flag="-r"
fi
rm -f $testfile
fi
for program in $programs
do
for path in $pathname
do
if [ $test_exec_flag $path/${program}${ext} ] && \
[ ! -d $path/${program}${ext} ]; then
if [ "x$echo" = "xyes" ]; then
echo $path/${program}${ext}
fi
exit 0
fi
# Next try without extension (if one was used above)
if [ "x$ext" != "x" ]; then
if [ $test_exec_flag $path/${program} ] && \
[ ! -d $path/${program} ]; then
if [ "x$echo" = "xyes" ]; then
echo $path/${program}
fi
exit 0
fi
fi
done
done
exit 1

755
libs/apr/build/aplibtool.c Normal file
View File

@@ -0,0 +1,755 @@
/* 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.
*/
#include <stdio.h>
#include <process.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
typedef char bool;
#define false 0
#define true (!false)
bool silent = false;
bool shared = false;
bool export_all = false;
enum mode_t { mCompile, mLink, mInstall };
enum output_type_t { otGeneral, otObject, otProgram, otStaticLibrary, otDynamicLibrary };
#ifdef __EMX__
# define SHELL_CMD "sh"
# define CC "gcc"
# define GEN_EXPORTS "emxexp"
# define DEF2IMPLIB_CMD "emximp"
# define SHARE_SW "-Zdll -Zmtd"
# define USE_OMF true
# define TRUNCATE_DLL_NAME
# define DYNAMIC_LIB_EXT "dll"
# define EXE_EXT ".exe"
# if USE_OMF
/* OMF is the native format under OS/2 */
# define STATIC_LIB_EXT "lib"
# define OBJECT_EXT "obj"
# define LIBRARIAN "emxomfar"
# else
/* but the alternative, a.out, can fork() which is sometimes necessary */
# define STATIC_LIB_EXT "a"
# define OBJECT_EXT "o"
# define LIBRARIAN "ar"
# endif
#endif
typedef struct {
char *arglist[1024];
int num_args;
enum mode_t mode;
enum output_type_t output_type;
char *output_name;
char *stub_name;
char *tmp_dirs[1024];
int num_tmp_dirs;
char *obj_files[1024];
int num_obj_files;
} cmd_data_t;
void parse_args(int argc, char *argv[], cmd_data_t *cmd_data);
bool parse_long_opt(char *arg, cmd_data_t *cmd_data);
int parse_short_opt(char *arg, cmd_data_t *cmd_data);
bool parse_input_file_name(char *arg, cmd_data_t *cmd_data);
bool parse_output_file_name(char *arg, cmd_data_t *cmd_data);
void post_parse_fixup(cmd_data_t *cmd_data);
bool explode_static_lib(char *lib, cmd_data_t *cmd_data);
int execute_command(cmd_data_t *cmd_data);
char *shell_esc(const char *str);
void cleanup_tmp_dirs(cmd_data_t *cmd_data);
void generate_def_file(cmd_data_t *cmd_data);
char *nameof(char *fullpath);
char *truncate_dll_name(char *path);
int main(int argc, char *argv[])
{
int rc;
cmd_data_t cmd_data;
memset(&cmd_data, 0, sizeof(cmd_data));
cmd_data.mode = mCompile;
cmd_data.output_type = otGeneral;
parse_args(argc, argv, &cmd_data);
rc = execute_command(&cmd_data);
if (rc == 0 && cmd_data.stub_name) {
fopen(cmd_data.stub_name, "w");
}
cleanup_tmp_dirs(&cmd_data);
return rc;
}
void parse_args(int argc, char *argv[], cmd_data_t *cmd_data)
{
int a;
char *arg;
bool argused;
for (a=1; a < argc; a++) {
arg = argv[a];
argused = false;
if (arg[0] == '-') {
if (arg[1] == '-') {
argused = parse_long_opt(arg + 2, cmd_data);
} else if (arg[1] == 'o' && a+1 < argc) {
cmd_data->arglist[cmd_data->num_args++] = arg;
arg = argv[++a];
argused = parse_output_file_name(arg, cmd_data);
} else {
int num_used = parse_short_opt(arg + 1, cmd_data);
argused = num_used > 0;
if (num_used > 1) {
a += num_used - 1;
}
}
} else {
argused = parse_input_file_name(arg, cmd_data);
}
if (!argused) {
cmd_data->arglist[cmd_data->num_args++] = arg;
}
}
post_parse_fixup(cmd_data);
}
bool parse_long_opt(char *arg, cmd_data_t *cmd_data)
{
char *equal_pos = strchr(arg, '=');
char var[50];
char value[500];
if (equal_pos) {
strncpy(var, arg, equal_pos - arg);
var[equal_pos - arg] = 0;
strcpy(value, equal_pos + 1);
} else {
strcpy(var, arg);
}
if (strcmp(var, "silent") == 0) {
silent = true;
} else if (strcmp(var, "mode") == 0) {
if (strcmp(value, "compile") == 0) {
cmd_data->mode = mCompile;
cmd_data->output_type = otObject;
}
if (strcmp(value, "link") == 0) {
cmd_data->mode = mLink;
}
if (strcmp(value, "install") == 0) {
cmd_data->mode = mInstall;
}
} else if (strcmp(var, "shared") == 0) {
shared = true;
} else if (strcmp(var, "export-all") == 0) {
export_all = true;
} else {
return false;
}
return true;
}
int parse_short_opt(char *arg, cmd_data_t *cmd_data)
{
if (strcmp(arg, "export-dynamic") == 0) {
return 1;
}
if (strcmp(arg, "module") == 0) {
return 1;
}
if (strcmp(arg, "Zexe") == 0) {
return 1;
}
if (strcmp(arg, "avoid-version") == 0) {
return 1;
}
if (strcmp(arg, "prefer-pic") == 0) {
return 1;
}
if (strcmp(arg, "prefer-non-pic") == 0) {
return 1;
}
if (strcmp(arg, "version-info") == 0 ) {
return 2;
}
if (strcmp(arg, "no-install") == 0) {
return 1;
}
return 0;
}
bool parse_input_file_name(char *arg, cmd_data_t *cmd_data)
{
char *ext = strrchr(arg, '.');
char *name = strrchr(arg, '/');
int pathlen;
char *newarg;
if (!ext) {
return false;
}
ext++;
if (name == NULL) {
name = strrchr(arg, '\\');
if (name == NULL) {
name = arg;
} else {
name++;
}
} else {
name++;
}
pathlen = name - arg;
if (strcmp(ext, "lo") == 0) {
newarg = (char *)malloc(strlen(arg) + 10);
strcpy(newarg, arg);
strcpy(newarg + (ext - arg), OBJECT_EXT);
cmd_data->arglist[cmd_data->num_args++] = newarg;
cmd_data->obj_files[cmd_data->num_obj_files++] = newarg;
return true;
}
if (strcmp(ext, "la") == 0) {
newarg = (char *)malloc(strlen(arg) + 10);
strcpy(newarg, arg);
newarg[pathlen] = 0;
strcat(newarg, ".libs/");
if (strncmp(name, "lib", 3) == 0) {
name += 3;
}
strcat(newarg, name);
ext = strrchr(newarg, '.') + 1;
if (shared && cmd_data->mode == mInstall) {
strcpy(ext, DYNAMIC_LIB_EXT);
newarg = truncate_dll_name(newarg);
} else {
strcpy(ext, STATIC_LIB_EXT);
}
cmd_data->arglist[cmd_data->num_args++] = newarg;
return true;
}
if (strcmp(ext, "c") == 0) {
if (cmd_data->stub_name == NULL) {
cmd_data->stub_name = (char *)malloc(strlen(arg) + 4);
strcpy(cmd_data->stub_name, arg);
strcpy(strrchr(cmd_data->stub_name, '.') + 1, "lo");
}
}
if (strcmp(name, CC) == 0 || strcmp(name, CC EXE_EXT) == 0) {
if (cmd_data->output_type == otGeneral) {
cmd_data->output_type = otObject;
}
}
return false;
}
bool parse_output_file_name(char *arg, cmd_data_t *cmd_data)
{
char *name = strrchr(arg, '/');
char *ext = strrchr(arg, '.');
char *newarg = NULL, *newext;
int pathlen;
if (name == NULL) {
name = strrchr(arg, '\\');
if (name == NULL) {
name = arg;
} else {
name++;
}
} else {
name++;
}
if (!ext) {
cmd_data->stub_name = arg;
cmd_data->output_type = otProgram;
newarg = (char *)malloc(strlen(arg) + 5);
strcpy(newarg, arg);
strcat(newarg, EXE_EXT);
cmd_data->arglist[cmd_data->num_args++] = newarg;
cmd_data->output_name = newarg;
return true;
}
ext++;
pathlen = name - arg;
if (strcmp(ext, "la") == 0) {
cmd_data->stub_name = arg;
cmd_data->output_type = shared ? otDynamicLibrary : otStaticLibrary;
newarg = (char *)malloc(strlen(arg) + 10);
mkdir(".libs", 0);
strcpy(newarg, ".libs/");
if (strncmp(arg, "lib", 3) == 0) {
arg += 3;
}
strcat(newarg, arg);
newext = strrchr(newarg, '.') + 1;
strcpy(newext, shared ? DYNAMIC_LIB_EXT : STATIC_LIB_EXT);
#ifdef TRUNCATE_DLL_NAME
if (shared) {
newarg = truncate_dll_name(newarg);
}
#endif
cmd_data->arglist[cmd_data->num_args++] = newarg;
cmd_data->output_name = newarg;
return true;
}
if (strcmp(ext, "lo") == 0) {
cmd_data->stub_name = arg;
cmd_data->output_type = otObject;
newarg = (char *)malloc(strlen(arg) + 2);
strcpy(newarg, arg);
ext = strrchr(newarg, '.') + 1;
strcpy(ext, OBJECT_EXT);
cmd_data->arglist[cmd_data->num_args++] = newarg;
cmd_data->output_name = newarg;
return true;
}
return false;
}
void post_parse_fixup(cmd_data_t *cmd_data)
{
int a;
char *arg;
char *ext;
if (cmd_data->output_type == otStaticLibrary && cmd_data->mode == mLink) {
/* We do a real hatchet job on the args when making a static library
* removing all compiler switches & any other cruft that ar won't like
* We also need to explode any libraries listed
*/
for (a=0; a < cmd_data->num_args; a++) {
arg = cmd_data->arglist[a];
if (arg) {
ext = strrchr(arg, '.');
if (ext) {
ext++;
}
if (arg[0] == '-') {
cmd_data->arglist[a] = NULL;
if (strcmp(arg, "-rpath") == 0 && a+1 < cmd_data->num_args) {
cmd_data->arglist[a+1] = NULL;
}
if (strcmp(arg, "-R") == 0 && a+1 < cmd_data->num_args) {
cmd_data->arglist[a+1] = NULL;
}
if (strcmp(arg, "-version-info") == 0 && a+1 < cmd_data->num_args) {
cmd_data->arglist[a+1] = NULL;
}
if (strcmp(arg, "-Zstack") == 0 && a+1 < cmd_data->num_args) {
cmd_data->arglist[a+1] = NULL;
}
if (strcmp(arg, "-o") == 0) {
a++;
}
}
if (strcmp(arg, CC) == 0 || strcmp(arg, CC EXE_EXT) == 0) {
cmd_data->arglist[a] = LIBRARIAN " cr";
}
if (ext) {
if (strcmp(ext, "h") == 0 || strcmp(ext, "c") == 0) {
/* ignore source files, they don't belong in a library */
cmd_data->arglist[a] = NULL;
}
if (strcmp(ext, STATIC_LIB_EXT) == 0) {
cmd_data->arglist[a] = NULL;
explode_static_lib(arg, cmd_data);
}
}
}
}
}
if (cmd_data->output_type == otDynamicLibrary) {
for (a=0; a < cmd_data->num_args; a++) {
arg = cmd_data->arglist[a];
if (arg) {
if (strcmp(arg, "-rpath") == 0 && a+1 < cmd_data->num_args) {
cmd_data->arglist[a] = NULL;
cmd_data->arglist[a+1] = NULL;
}
}
}
if (export_all) {
generate_def_file(cmd_data);
}
}
#if USE_OMF
if (cmd_data->output_type == otObject ||
cmd_data->output_type == otProgram ||
cmd_data->output_type == otDynamicLibrary) {
cmd_data->arglist[cmd_data->num_args++] = "-Zomf";
}
#endif
if (shared && (cmd_data->output_type == otObject || cmd_data->output_type == otDynamicLibrary)) {
cmd_data->arglist[cmd_data->num_args++] = SHARE_SW;
}
}
int execute_command(cmd_data_t *cmd_data)
{
int target = 0;
char *command;
int a, total_len = 0;
char *args[4];
for (a=0; a < cmd_data->num_args; a++) {
if (cmd_data->arglist[a]) {
total_len += strlen(cmd_data->arglist[a]) + 1;
}
}
command = (char *)malloc( total_len );
command[0] = 0;
for (a=0; a < cmd_data->num_args; a++) {
if (cmd_data->arglist[a]) {
strcat(command, cmd_data->arglist[a]);
strcat(command, " ");
}
}
command[strlen(command)-1] = 0;
if (!silent) {
puts(command);
}
cmd_data->num_args = target;
cmd_data->arglist[cmd_data->num_args] = NULL;
command = shell_esc(command);
args[0] = SHELL_CMD;
args[1] = "-c";
args[2] = command;
args[3] = NULL;
return spawnvp(P_WAIT, args[0], args);
}
char *shell_esc(const char *str)
{
char *cmd;
unsigned char *d;
const unsigned char *s;
cmd = (char *)malloc(2 * strlen(str) + 1);
d = (unsigned char *)cmd;
s = (const unsigned char *)str;
for (; *s; ++s) {
if (*s == '"' || *s == '\\') {
*d++ = '\\';
}
*d++ = *s;
}
*d = '\0';
return cmd;
}
bool explode_static_lib(char *lib, cmd_data_t *cmd_data)
{
char tmpdir[1024];
char savewd[1024];
char cmd[1024];
char *name;
DIR *dir;
struct dirent *entry;
strcpy(tmpdir, lib);
strcat(tmpdir, ".exploded");
mkdir(tmpdir, 0);
cmd_data->tmp_dirs[cmd_data->num_tmp_dirs++] = strdup(tmpdir);
getcwd(savewd, sizeof(savewd));
if (chdir(tmpdir) != 0)
return false;
strcpy(cmd, LIBRARIAN " x ");
name = strrchr(lib, '/');
if (name) {
name++;
} else {
name = lib;
}
strcat(cmd, "../");
strcat(cmd, name);
system(cmd);
chdir(savewd);
dir = opendir(tmpdir);
while ((entry = readdir(dir)) != NULL) {
if (entry->d_name[0] != '.') {
strcpy(cmd, tmpdir);
strcat(cmd, "/");
strcat(cmd, entry->d_name);
cmd_data->arglist[cmd_data->num_args++] = strdup(cmd);
}
}
closedir(dir);
return true;
}
void cleanup_tmp_dir(char *dirname)
{
DIR *dir;
struct dirent *entry;
char fullname[1024];
dir = opendir(dirname);
if (dir == NULL)
return;
while ((entry = readdir(dir)) != NULL) {
if (entry->d_name[0] != '.') {
strcpy(fullname, dirname);
strcat(fullname, "/");
strcat(fullname, entry->d_name);
remove(fullname);
}
}
rmdir(dirname);
}
void cleanup_tmp_dirs(cmd_data_t *cmd_data)
{
int d;
for (d=0; d < cmd_data->num_tmp_dirs; d++) {
cleanup_tmp_dir(cmd_data->tmp_dirs[d]);
}
}
void generate_def_file(cmd_data_t *cmd_data)
{
char def_file[1024];
char implib_file[1024];
char *ext;
FILE *hDef;
char *export_args[1024];
int num_export_args = 0;
char *cmd;
int cmd_size = 0;
int a;
if (cmd_data->output_name) {
strcpy(def_file, cmd_data->output_name);
strcat(def_file, ".def");
hDef = fopen(def_file, "w");
if (hDef != NULL) {
fprintf(hDef, "LIBRARY '%s' INITINSTANCE\n", nameof(cmd_data->output_name));
fprintf(hDef, "DATA NONSHARED\n");
fprintf(hDef, "EXPORTS\n");
fclose(hDef);
for (a=0; a < cmd_data->num_obj_files; a++) {
cmd_size += strlen(cmd_data->obj_files[a]) + 1;
}
cmd_size += strlen(GEN_EXPORTS) + strlen(def_file) + 3;
cmd = (char *)malloc(cmd_size);
strcpy(cmd, GEN_EXPORTS);
for (a=0; a < cmd_data->num_obj_files; a++) {
strcat(cmd, " ");
strcat(cmd, cmd_data->obj_files[a] );
}
strcat(cmd, ">>");
strcat(cmd, def_file);
puts(cmd);
export_args[num_export_args++] = SHELL_CMD;
export_args[num_export_args++] = "-c";
export_args[num_export_args++] = cmd;
export_args[num_export_args++] = NULL;
spawnvp(P_WAIT, export_args[0], export_args);
cmd_data->arglist[cmd_data->num_args++] = strdup(def_file);
/* Now make an import library for the dll */
num_export_args = 0;
export_args[num_export_args++] = DEF2IMPLIB_CMD;
export_args[num_export_args++] = "-o";
strcpy(implib_file, ".libs/");
strcat(implib_file, cmd_data->stub_name);
ext = strrchr(implib_file, '.');
if (ext)
*ext = 0;
strcat(implib_file, ".");
strcat(implib_file, STATIC_LIB_EXT);
export_args[num_export_args++] = implib_file;
export_args[num_export_args++] = def_file;
export_args[num_export_args++] = NULL;
spawnvp(P_WAIT, export_args[0], export_args);
}
}
}
/* returns just a file's name without path or extension */
char *nameof(char *fullpath)
{
char buffer[1024];
char *ext;
char *name = strrchr(fullpath, '/');
if (name == NULL) {
name = strrchr(fullpath, '\\');
}
if (name == NULL) {
name = fullpath;
} else {
name++;
}
strcpy(buffer, name);
ext = strrchr(buffer, '.');
if (ext) {
*ext = 0;
return strdup(buffer);
}
return name;
}
char *truncate_dll_name(char *path)
{
/* Cut DLL name down to 8 characters after removing any mod_ prefix */
char *tmppath = strdup(path);
char *newname = strrchr(tmppath, '/') + 1;
char *ext = strrchr(tmppath, '.');
int len;
if (ext == NULL)
return tmppath;
len = ext - newname;
if (strncmp(newname, "mod_", 4) == 0) {
strcpy(newname, newname + 4);
len -= 4;
}
if (len > 8) {
strcpy(newname + 8, strchr(newname, '.'));
}
return tmppath;
}

View File

@@ -0,0 +1,89 @@
# Microsoft Developer Studio Project File - Name="apr_app" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=apr_app - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "apr_app.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "apr_app.mak" CFG="apr_app - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "apr_app - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "apr_app - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "apr_app - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "LibR"
# PROP BASE Intermediate_Dir "LibR"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "LibR"
# PROP Intermediate_Dir "LibR"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "../include" /I "../include/arch" /I "../include/arch/win32" /I "../include/arch/unix" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_APP" /D "APR_DECLARE_STATIC" /Fd"LibR\apr_app_src" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"LibR\apr_app-1.lib"
!ELSEIF "$(CFG)" == "apr_app - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "LibD"
# PROP BASE Intermediate_Dir "LibD"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "LibD"
# PROP Intermediate_Dir "LibD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../include" /I "../include/arch" /I "../include/arch/win32" /I "../include/arch/unix" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_APP" /D "APR_DECLARE_STATIC" /Fd"LibD\apr_app_src" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"LibD\apr_app-1.lib"
!ENDIF
# Begin Target
# Name "apr_app - Win32 Release"
# Name "apr_app - Win32 Debug"
# Begin Source File
SOURCE=..\misc\win32\apr_app.c
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,961 @@
dnl -------------------------------------------------------- -*- autoconf -*-
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 apr_common.m4: APR's general-purpose autoconf macros
dnl
dnl
dnl APR_CONFIG_NICE(filename)
dnl
dnl Saves a snapshot of the configure command-line for later reuse
dnl
AC_DEFUN(APR_CONFIG_NICE,[
rm -f $1
cat >$1<<EOF
#! /bin/sh
#
# Created by configure
EOF
if test -n "$CC"; then
echo "CC=\"$CC\"; export CC" >> $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 "$LTFLAGS"; then
echo "LTFLAGS=\"$LTFLAGS\"; export LTFLAGS" >> $1
fi
if test -n "$LIBS"; then
echo "LIBS=\"$LIBS\"; export LIBS" >> $1
fi
if test -n "$INCLUDES"; then
echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1
fi
if test -n "$NOTEST_CFLAGS"; then
echo "NOTEST_CFLAGS=\"$NOTEST_CFLAGS\"; export NOTEST_CFLAGS" >> $1
fi
if test -n "$NOTEST_CPPFLAGS"; then
echo "NOTEST_CPPFLAGS=\"$NOTEST_CPPFLAGS\"; export NOTEST_CPPFLAGS" >> $1
fi
if test -n "$NOTEST_LDFLAGS"; then
echo "NOTEST_LDFLAGS=\"$NOTEST_LDFLAGS\"; export NOTEST_LDFLAGS" >> $1
fi
if test -n "$NOTEST_LIBS"; then
echo "NOTEST_LIBS=\"$NOTEST_LIBS\"; export NOTEST_LIBS" >> $1
fi
# Retrieve command-line arguments.
eval "set x $[0] $ac_configure_args"
shift
for arg
do
APR_EXPAND_VAR(arg, $arg)
echo "\"[$]arg\" \\" >> $1
done
echo '"[$]@"' >> $1
chmod +x $1
])dnl
dnl APR_MKDIR_P_CHECK(fallback-mkdir-p)
dnl checks whether mkdir -p works
AC_DEFUN(APR_MKDIR_P_CHECK,[
AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
test -d conftestdir && rm -rf conftestdir
mkdir -p conftestdir/somedir >/dev/null 2>&1
if test -d conftestdir/somedir; then
ac_cv_mkdir_p=yes
else
ac_cv_mkdir_p=no
fi
rm -rf conftestdir
])
if test "$ac_cv_mkdir_p" = "yes"; then
mkdir_p="mkdir -p"
else
mkdir_p="$1"
fi
])
dnl
dnl APR_SUBDIR_CONFIG(dir [, sub-package-cmdline-args, args-to-drop])
dnl
dnl dir: directory to find configure in
dnl sub-package-cmdline-args: arguments to add to the invocation (optional)
dnl args-to-drop: arguments to drop from the invocation (optional)
dnl
dnl Note: This macro relies on ac_configure_args being set properly.
dnl
dnl The args-to-drop argument is shoved into a case statement, so
dnl multiple arguments can be separated with a |.
dnl
dnl Note: Older versions of autoconf do not single-quote args, while 2.54+
dnl places quotes around every argument. So, if you want to drop the
dnl argument called --enable-layout, you must pass the third argument as:
dnl [--enable-layout=*|\'--enable-layout=*]
dnl
dnl Trying to optimize this is left as an exercise to the reader who wants
dnl to put up with more autoconf craziness. I give up.
dnl
AC_DEFUN(APR_SUBDIR_CONFIG, [
# save our work to this point; this allows the sub-package to use it
AC_CACHE_SAVE
echo "configuring package in $1 now"
ac_popdir=`pwd`
apr_config_subdirs="$1"
test -d $1 || $mkdir_p $1
ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
cd $1
changequote(, )dnl
# A "../" for each directory in /$config_subdirs.
ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
changequote([, ])dnl
# Make the cache file pathname absolute for the subdirs
# required to correctly handle subdirs that might actually
# be symlinks
case "$cache_file" in
/*) # already absolute
ac_sub_cache_file=$cache_file ;;
*) # Was relative path.
ac_sub_cache_file="$ac_popdir/$cache_file" ;;
esac
ifelse($3, [], [apr_configure_args=$ac_configure_args],[
apr_configure_args=
apr_sep=
for apr_configure_arg in $ac_configure_args
do
case "$apr_configure_arg" in
$3)
continue ;;
esac
apr_configure_args="$apr_configure_args$apr_sep'$apr_configure_arg'"
apr_sep=" "
done
])
# autoconf doesn't add --silent to ac_configure_args; explicitly pass it
test "x$silent" = "xyes" && apr_configure_args="$apr_configure_args --silent"
dnl The eval makes quoting arguments work - specifically $2 where the
dnl quoting mechanisms used is "" rather than [].
dnl
dnl We need to execute another shell because some autoconf/shell combinations
dnl will choke after doing repeated APR_SUBDIR_CONFIG()s. (Namely Solaris
dnl and autoconf-2.54+)
if eval $SHELL $ac_abs_srcdir/configure $apr_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2
then :
echo "$1 configured properly"
else
echo "configure failed for $1"
exit 1
fi
cd $ac_popdir
# grab any updates from the sub-package
AC_CACHE_LOAD
])dnl
dnl
dnl APR_SAVE_THE_ENVIRONMENT(variable_name)
dnl
dnl Stores the variable (usually a Makefile macro) for later restoration
dnl
AC_DEFUN(APR_SAVE_THE_ENVIRONMENT,[
apr_ste_save_$1="$$1"
])dnl
dnl
dnl APR_RESTORE_THE_ENVIRONMENT(variable_name, prefix_)
dnl
dnl Uses the previously saved variable content to figure out what configure
dnl has added to the variable, moving the new bits to prefix_variable_name
dnl and restoring the original variable contents. This makes it possible
dnl for a user to override configure when it does something stupid.
dnl
AC_DEFUN(APR_RESTORE_THE_ENVIRONMENT,[
if test "x$apr_ste_save_$1" = "x"; then
$2$1="$$1"
$1=
else
if test "x$apr_ste_save_$1" = "x$$1"; then
$2$1=
else
$2$1=`echo $$1 | sed -e "s%${apr_ste_save_$1}%%"`
$1="$apr_ste_save_$1"
fi
fi
if test "x$silent" != "xyes"; then
echo " restoring $1 to \"$$1\""
echo " setting $2$1 to \"$$2$1\""
fi
AC_SUBST($2$1)
])dnl
dnl
dnl APR_SETIFNULL(variable, value)
dnl
dnl Set variable iff it's currently null
dnl
AC_DEFUN(APR_SETIFNULL,[
if test -z "$$1"; then
test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
$1="$2"
fi
])dnl
dnl
dnl APR_SETVAR(variable, value)
dnl
dnl Set variable no matter what
dnl
AC_DEFUN(APR_SETVAR,[
test "x$silent" != "xyes" && echo " forcing $1 to \"$2\""
$1="$2"
])dnl
dnl
dnl APR_ADDTO(variable, value)
dnl
dnl Add value to variable
dnl
AC_DEFUN(APR_ADDTO,[
if test "x$$1" = "x"; then
test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
$1="$2"
else
apr_addto_bugger="$2"
for i in $apr_addto_bugger; do
apr_addto_duplicate="0"
for j in $$1; do
if test "x$i" = "x$j"; then
apr_addto_duplicate="1"
break
fi
done
if test $apr_addto_duplicate = "0"; then
test "x$silent" != "xyes" && echo " adding \"$i\" to $1"
$1="$$1 $i"
fi
done
fi
])dnl
dnl
dnl APR_REMOVEFROM(variable, value)
dnl
dnl Remove a value from a variable
dnl
AC_DEFUN(APR_REMOVEFROM,[
if test "x$$1" = "x$2"; then
test "x$silent" != "xyes" && echo " nulling $1"
$1=""
else
apr_new_bugger=""
apr_removed=0
for i in $$1; do
if test "x$i" != "x$2"; then
apr_new_bugger="$apr_new_bugger $i"
else
apr_removed=1
fi
done
if test $apr_removed = "1"; then
test "x$silent" != "xyes" && echo " removed \"$2\" from $1"
$1=$apr_new_bugger
fi
fi
]) dnl
dnl
dnl APR_CHECK_DEFINE_FILES( symbol, header_file [header_file ...] )
dnl
AC_DEFUN(APR_CHECK_DEFINE_FILES,[
AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
ac_cv_define_$1=no
for curhdr in $2
do
AC_EGREP_CPP(YES_IS_DEFINED, [
#include <$curhdr>
#ifdef $1
YES_IS_DEFINED
#endif
], ac_cv_define_$1=yes)
done
])
if test "$ac_cv_define_$1" = "yes"; then
AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined])
fi
])
dnl
dnl APR_CHECK_DEFINE(symbol, header_file)
dnl
AC_DEFUN(APR_CHECK_DEFINE,[
AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
AC_EGREP_CPP(YES_IS_DEFINED, [
#include <$2>
#ifdef $1
YES_IS_DEFINED
#endif
], ac_cv_define_$1=yes, ac_cv_define_$1=no)
])
if test "$ac_cv_define_$1" = "yes"; then
AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2])
fi
])
dnl
dnl APR_CHECK_APR_DEFINE( symbol )
dnl
AC_DEFUN(APR_CHECK_APR_DEFINE,[
apr_old_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $INCLUDES"
AC_EGREP_CPP(YES_IS_DEFINED, [
#include <apr.h>
#if $1
YES_IS_DEFINED
#endif
], ac_cv_define_$1=yes, ac_cv_define_$1=no)
CPPFLAGS=$apr_old_cppflags
])
dnl APR_CHECK_FILE(filename); set ac_cv_file_filename to
dnl "yes" if 'filename' is readable, else "no".
dnl @deprecated! - use AC_CHECK_FILE instead
AC_DEFUN([APR_CHECK_FILE], [
dnl Pick a safe variable name
define([apr_cvname], ac_cv_file_[]translit([$1], [./+-], [__p_]))
AC_CACHE_CHECK([for $1], [apr_cvname],
[if test -r $1; then
apr_cvname=yes
else
apr_cvname=no
fi])
])
define(APR_IFALLYES,[dnl
ac_rc=yes
for ac_spec in $1; do
ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
case $ac_type in
header )
ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
ac_var="ac_cv_header_$ac_item"
;;
file )
ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
ac_var="ac_cv_file_$ac_item"
;;
func ) ac_var="ac_cv_func_$ac_item" ;;
struct ) ac_var="ac_cv_struct_$ac_item" ;;
define ) ac_var="ac_cv_define_$ac_item" ;;
custom ) ac_var="$ac_item" ;;
esac
eval "ac_val=\$$ac_var"
if test ".$ac_val" != .yes; then
ac_rc=no
break
fi
done
if test ".$ac_rc" = .yes; then
:
$2
else
:
$3
fi
])
define(APR_BEGIN_DECISION,[dnl
ac_decision_item='$1'
ac_decision_msg='FAILED'
ac_decision=''
])
AC_DEFUN([APR_DECIDE],[dnl
dnl Define the flag (or not) in apr_private.h via autoheader
AH_TEMPLATE($1, [Define if $2 will be used])
ac_decision='$1'
ac_decision_msg='$2'
ac_decision_$1=yes
ac_decision_$1_msg='$2'
])
define(APR_DECISION_OVERRIDE,[dnl
ac_decision=''
for ac_item in $1; do
eval "ac_decision_this=\$ac_decision_${ac_item}"
if test ".$ac_decision_this" = .yes; then
ac_decision=$ac_item
eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
fi
done
])
define(APR_DECISION_FORCE,[dnl
ac_decision="$1"
eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\""
])
define(APR_END_DECISION,[dnl
if test ".$ac_decision" = .; then
echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2
exit 1
else
if test ".$ac_decision_msg" = .; then
ac_decision_msg="$ac_decision"
fi
AC_DEFINE_UNQUOTED(${ac_decision_item})
AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg])
fi
])
dnl
dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE])
dnl
dnl A variant of AC_CHECK_SIZEOF which allows the checking of
dnl sizes of non-builtin types
dnl
AC_DEFUN(APR_CHECK_SIZEOF_EXTENDED,
[changequote(<<,>>)dnl
dnl The name to #define
define(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
dnl The cache variable
define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$2, [ *],[<p>]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(size of $2)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
$1
main()
{
FILE *f=fopen("conftestval","w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof($2));
exit(0);
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,,
AC_CV_NAME=$3))])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])
dnl
dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
dnl
dnl Tries a compile test with warnings activated so that the result
dnl is false if the code doesn't compile cleanly. For compilers
dnl where it is not known how to activate a "fail-on-error" mode,
dnl it is undefined which of the sets of actions will be run.
dnl
AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
[apr_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $CFLAGS_WARN"
if test "$ac_cv_prog_gcc" = "yes"; then
CFLAGS="$CFLAGS -Werror"
fi
AC_COMPILE_IFELSE(
[#include "confdefs.h"
]
[[$1]]
[int main(int argc, const char *const *argv) {]
[[$2]]
[ return 0; }],
[$3], [$4])
CFLAGS=$apr_save_CFLAGS
])
dnl
dnl APR_CHECK_STRERROR_R_RC
dnl
dnl Decide which style of retcode is used by this system's
dnl strerror_r(). It either returns int (0 for success, -1
dnl for failure), or it returns a pointer to the error
dnl string.
dnl
dnl
AC_DEFUN(APR_CHECK_STRERROR_R_RC,[
AC_MSG_CHECKING(for type of return code from strerror_r)
AC_TRY_RUN([
#include <errno.h>
#include <string.h>
#include <stdio.h>
main()
{
char buf[1024];
if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
exit(0);
}
else {
exit(1);
}
}], [
ac_cv_strerror_r_rc_int=yes ], [
ac_cv_strerror_r_rc_int=no ], [
ac_cv_strerror_r_rc_int=no ] )
if test "x$ac_cv_strerror_r_rc_int" = xyes; then
AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
msg="int"
else
msg="pointer"
fi
AC_MSG_RESULT([$msg])
] )
dnl
dnl APR_CHECK_DIRENT_INODE
dnl
dnl Decide if d_fileno or d_ino are available in the dirent
dnl structure on this platform. Single UNIX Spec says d_ino,
dnl BSD uses d_fileno. Undef to find the real beast.
dnl
AC_DEFUN(APR_CHECK_DIRENT_INODE, [
AC_CACHE_CHECK([for inode member of struct dirent], apr_cv_dirent_inode, [
apr_cv_dirent_inode=no
AC_TRY_COMPILE([
#include <sys/types.h>
#include <dirent.h>
],[
#ifdef d_ino
#undef d_ino
#endif
struct dirent de; de.d_fileno;
], apr_cv_dirent_inode=d_fileno)
if test "$apr_cv_dirent_inode" = "no"; then
AC_TRY_COMPILE([
#include <sys/types.h>
#include <dirent.h>
],[
#ifdef d_fileno
#undef d_fileno
#endif
struct dirent de; de.d_ino;
], apr_cv_dirent_inode=d_ino)
fi
])
if test "$apr_cv_dirent_inode" != "no"; then
AC_DEFINE_UNQUOTED(DIRENT_INODE, $apr_cv_dirent_inode,
[Define if struct dirent has an inode member])
fi
])
dnl
dnl APR_CHECK_DIRENT_TYPE
dnl
dnl Decide if d_type is available in the dirent structure
dnl on this platform. Not part of the Single UNIX Spec.
dnl Note that this is worthless without DT_xxx macros, so
dnl look for one while we are at it.
dnl
AC_DEFUN(APR_CHECK_DIRENT_TYPE,[
AC_CACHE_CHECK([for file type member of struct dirent], apr_cv_dirent_type,[
apr_cv_dirent_type=no
AC_TRY_COMPILE([
#include <sys/types.h>
#include <dirent.h>
],[
struct dirent de; de.d_type = DT_REG;
], apr_cv_dirent_type=d_type)
])
if test "$apr_cv_dirent_type" != "no"; then
AC_DEFINE_UNQUOTED(DIRENT_TYPE, $apr_cv_dirent_type,
[Define if struct dirent has a d_type member])
fi
])
dnl the following is a newline, a space, a tab, and a backslash (the
dnl backslash is used by the shell to skip newlines, but m4 sees it;
dnl treat it like whitespace).
dnl WARNING: don't reindent these lines, or the space/tab will be lost!
define([apr_whitespace],[
\])
dnl
dnl APR_COMMA_ARGS(ARG1 ...)
dnl convert the whitespace-separated arguments into comman-separated
dnl arguments.
dnl
dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...)
dnl subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i]
dnl within each iteration.
dnl
changequote({,})
define({APR_COMMA_ARGS},{patsubst([$}{1],[[}apr_whitespace{]+],[,])})
define({APR_FOREACH},
{ifelse($}{2,,,
[define([eachval],
$}{2)$}{1[]APR_FOREACH([$}{1],
builtin([shift],
builtin([shift], $}{@)))])})
changequote([,])
dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ])
dnl we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0
dnl if FLAG-TO-SET is null, we automagically determine it's name
dnl by changing all "/" to "_" in the HEADER-FILE and dropping
dnl all "." and "-" chars. If the 3rd parameter is "yes" then instead of
dnl setting to 1 or 0, we set FLAG-TO-SET to yes or no.
dnl
AC_DEFUN(APR_FLAG_HEADERS,[
AC_CHECK_HEADERS($1)
for aprt_i in $1
do
ac_safe=`echo "$aprt_i" | sed 'y%./+-%__p_%'`
aprt_2=`echo "$aprt_i" | sed -e 's%/%_%g' -e 's/\.//g' -e 's/-//g'`
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,yes,1)"
else
eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,no,0)"
fi
done
])
dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ])
dnl if FLAG-TO-SET is null, we automagically determine it's name
dnl prepending "have_" to the function name in FUNC, otherwise
dnl we use what's provided as FLAG-TO-SET. If the 3rd parameter
dnl is "yes" then instead of setting to 1 or 0, we set FLAG-TO-SET
dnl to yes or no.
dnl
AC_DEFUN(APR_FLAG_FUNCS,[
AC_CHECK_FUNCS($1)
for aprt_j in $1
do
aprt_3="have_$aprt_j"
if eval "test \"`echo '$ac_cv_func_'$aprt_j`\" = yes"; then
eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,yes,1)"
else
eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,no,0)"
fi
done
])
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 APR_EXPAND_VAR(fraz, $baz)
dnl $fraz is now "1/2/3"
dnl
AC_DEFUN(APR_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 Removes the value of $3 from the string in $2, strips of any leading
dnl slashes, and returns the value in $1.
dnl
dnl Example:
dnl orig_path="${prefix}/bar"
dnl APR_PATH_RELATIVE(final_path, $orig_path, $prefix)
dnl $final_path now contains "bar"
AC_DEFUN(APR_PATH_RELATIVE,[
ap_stripped=`echo $2 | sed -e "s#^$3##"`
# check if the stripping was successful
if test "x$2" != "x${ap_stripped}"; then
# it was, so strip of any leading slashes
$1="`echo ${ap_stripped} | sed -e 's#^/*##'`"
else
# it wasn't so return the original
$1="$2"
fi
])
dnl APR_HELP_STRING(LHS, RHS)
dnl Autoconf 2.50 can not handle substr correctly. It does have
dnl AC_HELP_STRING, so let's try to call it if we can.
dnl Note: this define must be on one line so that it can be properly returned
dnl as the help string. When using this macro with a multi-line RHS, ensure
dnl that you surround the macro invocation with []s
AC_DEFUN(APR_HELP_STRING,[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING([$1],[$2]),[ ][$1] substr([ ],len($1))[$2])])
dnl
dnl APR_LAYOUT(configlayout, layoutname [, extravars])
dnl
AC_DEFUN(APR_LAYOUT,[
if test ! -f $srcdir/config.layout; then
echo "** Error: Layout file $srcdir/config.layout not found"
echo "** Error: Cannot use undefined layout '$LAYOUT'"
exit 1
fi
# Catch layout names including a slash which will otherwise
# confuse the heck out of the sed script.
case $2 in
*/*)
echo "** Error: $2 is not a valid layout name"
exit 1 ;;
esac
pldconf=./config.pld
changequote({,})
sed -e "1s/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*//;1t" \
-e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
-e '/[ ]*<\/Layout>[ ]*/,$d' \
-e "s/^[ ]*//g" \
-e "s/:[ ]*/=\'/g" \
-e "s/[ ]*$/'/g" \
$1 > $pldconf
layout_name=$2
if test ! -s $pldconf; then
echo "** Error: unable to find layout $layout_name"
exit 1
fi
. $pldconf
rm $pldconf
for var in prefix exec_prefix bindir sbindir libexecdir mandir \
sysconfdir datadir includedir localstatedir runtimedir \
logfiledir libdir installbuilddir libsuffix $3; do
eval "val=\"\$$var\""
case $val in
*+)
val=`echo $val | sed -e 's;\+$;;'`
eval "$var=\"\$val\""
autosuffix=yes
;;
*)
autosuffix=no
;;
esac
val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
if test "$autosuffix" = "yes"; then
if echo $val | grep apache >/dev/null; then
addtarget=no
else
addtarget=yes
fi
if test "$addtarget" = "yes"; then
val="$val/apache2"
fi
fi
eval "$var='$val'"
done
changequote([,])
])dnl
dnl
dnl APR_ENABLE_LAYOUT(default layout name [, extra vars])
dnl
AC_DEFUN(APR_ENABLE_LAYOUT,[
AC_ARG_ENABLE(layout,
[ --enable-layout=LAYOUT],[
LAYOUT=$enableval
])
if test -z "$LAYOUT"; then
LAYOUT="$1"
fi
APR_LAYOUT($srcdir/config.layout, $LAYOUT, $2)
AC_MSG_CHECKING(for chosen layout)
AC_MSG_RESULT($layout_name)
])
dnl
dnl APR_PARSE_ARGUMENTS
dnl a reimplementation of autoconf's argument parser,
dnl used here to allow us to co-exist layouts and argument based
dnl set ups.
AC_DEFUN(APR_PARSE_ARGUMENTS,[
ac_prev=
# Retrieve the command-line arguments. The eval is needed because
# the arguments are quoted to preserve accuracy.
eval "set x $ac_configure_args"
shift
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'`
case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir="$ac_optarg" ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir="$ac_optarg" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix="$ac_optarg" ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir="$ac_optarg" ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir="$ac_optarg" ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir="$ac_optarg" ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir="$ac_optarg" ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir="$ac_optarg" ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir="$ac_optarg" ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix="$ac_optarg" ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir="$ac_optarg" ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir="$ac_optarg" ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir="$ac_optarg" ;;
esac
done
# Be sure to have absolute paths.
for ac_var in exec_prefix prefix
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;;
*) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);;
esac
done
])dnl
dnl
dnl APR_CHECK_DEPEND
dnl
dnl Determine what program we can use to generate .deps-style dependencies
dnl
AC_DEFUN(APR_CHECK_DEPEND,[
dnl Try to determine what depend program we can use
dnl All GCC-variants should have -MM.
dnl If not, then we can check on those, too.
if test "$GCC" = "yes"; then
MKDEP='$(CC) -MM'
else
rm -f conftest.c
dnl <sys/types.h> should be available everywhere!
cat > conftest.c <<EOF
#include <sys/types.h>
int main() { return 0; }
EOF
MKDEP="true"
for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do
AC_MSG_CHECKING([if $i can create proper make dependencies])
if $i conftest.c 2>/dev/null | grep 'conftest.o: conftest.c' >/dev/null; then
MKDEP=$i
AC_MSG_RESULT(yes)
break;
fi
AC_MSG_RESULT(no)
done
rm -f conftest.c
fi
AC_SUBST(MKDEP)
])

470
libs/apr/build/apr_hints.m4 Normal file
View File

@@ -0,0 +1,470 @@
dnl -------------------------------------------------------- -*- autoconf -*-
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 apr_hints.m4: APR's autoconf macros for platform-specific hints
dnl
dnl We preload various configure settings depending
dnl on previously obtained platform knowledge.
dnl We allow all settings to be overridden from
dnl the command-line.
dnl
dnl We maintain the "format" that we've used
dnl under 1.3.x, so we don't exactly follow
dnl what is "recommended" by autoconf.
dnl
dnl APR_PRELOAD
dnl
dnl Preload various ENV/makefile params such as CC, CFLAGS, etc
dnl based on outside knowledge
dnl
dnl Generally, we force the setting of CC, and add flags
dnl to CFLAGS, CPPFLAGS, LIBS and LDFLAGS.
dnl
AC_DEFUN(APR_PRELOAD, [
if test "x$apr_preload_done" != "xyes" ; then
apr_preload_done="yes"
echo "Applying APR hints file rules for $host"
case "$host" in
*mint)
APR_ADDTO(CPPFLAGS, [-DMINT])
APR_ADDTO(LIBS, [-lportlib])
;;
*MPE/iX*)
APR_ADDTO(CPPFLAGS, [-DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE])
APR_ADDTO(LIBS, [-lsvipc -lcurses])
APR_ADDTO(LDFLAGS, [-Xlinker \"-WL,cap=ia,ba,ph;nmstack=1024000\"])
;;
*-apple-aux3*)
APR_ADDTO(CPPFLAGS, [-DAUX3 -D_POSIX_SOURCE])
APR_ADDTO(LIBS, [-lposix -lbsd])
APR_ADDTO(LDFLAGS, [-s])
APR_SETVAR(SHELL, [/bin/ksh])
;;
*-ibm-aix*)
APR_ADDTO(CPPFLAGS, [-U__STR__ -D_THREAD_SAFE])
dnl _USR_IRS gets us the hstrerror() proto in netdb.h
case $host in
*-ibm-aix4.3)
APR_ADDTO(CPPFLAGS, [-D_USE_IRS])
;;
*-ibm-aix5*)
APR_ADDTO(CPPFLAGS, [-D_USE_IRS])
;;
*-ibm-aix4.3.*)
APR_ADDTO(CPPFLAGS, [-D_USE_IRS])
;;
esac
dnl If using xlc, remember it, and give it the right options.
if $CC 2>&1 | grep 'xlc' > /dev/null; then
APR_SETIFNULL(AIX_XLC, [yes])
APR_ADDTO(CFLAGS, [-qHALT=E])
fi
APR_SETIFNULL(apr_sysvsem_is_global, [yes])
APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
case $host in
*-ibm-aix3* | *-ibm-aix4.1.*)
;;
*)
APR_ADDTO(LDFLAGS, [-Wl,-brtl])
;;
esac
;;
*-apollo-*)
APR_ADDTO(CPPFLAGS, [-DAPOLLO])
;;
*-dg-dgux*)
APR_ADDTO(CPPFLAGS, [-DDGUX])
;;
*-os2*)
APR_SETVAR(SHELL, [sh])
APR_SETIFNULL(apr_gethostbyname_is_thread_safe, [yes])
APR_SETIFNULL(apr_gethostbyaddr_is_thread_safe, [yes])
;;
*-hi-hiux)
APR_ADDTO(CPPFLAGS, [-DHIUX])
;;
*-hp-hpux11.*)
APR_ADDTO(CPPFLAGS, [-DHPUX11 -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED])
;;
*-hp-hpux10.*)
case $host in
*-hp-hpux10.01)
dnl # We know this is a problem in 10.01.
dnl # Not a problem in 10.20. Otherwise, who knows?
APR_ADDTO(CPPFLAGS, [-DSELECT_NEEDS_CAST])
;;
esac
APR_ADDTO(CPPFLAGS, [-D_REENTRANT])
;;
*-hp-hpux*)
APR_ADDTO(CPPFLAGS, [-DHPUX -D_REENTRANT])
;;
*-linux-*)
case `uname -r` in
2.* ) APR_ADDTO(CPPFLAGS, [-DLINUX=2])
;;
1.* ) APR_ADDTO(CPPFLAGS, [-DLINUX=1])
;;
* )
;;
esac
APR_ADDTO(CPPFLAGS, [-D_REENTRANT -D_GNU_SOURCE])
;;
*-GNU*)
APR_ADDTO(CPPFLAGS, [-DHURD -D_GNU_SOURCE])
;;
*-lynx-lynxos)
APR_ADDTO(CPPFLAGS, [-D__NO_INCLUDE_WARN__ -DLYNXOS])
APR_ADDTO(LIBS, [-lbsd])
;;
*486-*-bsdi*)
APR_ADDTO(CFLAGS, [-m486])
;;
*-*-bsdi*)
case $host in
*bsdi4.1)
APR_ADDTO(CFLAGS, [-D_REENTRANT])
;;
esac
;;
*-openbsd*)
APR_ADDTO(CPPFLAGS, [-D_POSIX_THREADS])
# binding to an ephemeral port fails on OpenBSD so override
# the test for O_NONBLOCK inheritance across accept().
APR_SETIFNULL(ac_cv_o_nonblock_inherited, [yes])
;;
*-netbsd*)
APR_ADDTO(CPPFLAGS, [-DNETBSD])
# fcntl() lies about O_NONBLOCK on an accept()ed socket (PR kern/26950)
APR_SETIFNULL(ac_cv_o_nonblock_inherited, [yes])
;;
*-freebsd*)
APR_SETIFNULL(apr_lock_method, [USE_FLOCK_SERIALIZE])
if test -x /sbin/sysctl; then
os_version=`/sbin/sysctl -n kern.osreldate`
else
os_version=000000
fi
# 502102 is when libc_r switched to libpthread (aka libkse).
if test $os_version -ge "502102"; then
apr_cv_pthreads_cflags="none"
apr_cv_pthreads_lib="-lpthread"
else
APR_ADDTO(CPPFLAGS, [-D_THREAD_SAFE -D_REENTRANT])
APR_SETIFNULL(enable_threads, [no])
fi
# prevent use of KQueue before FreeBSD 4.8
if test $os_version -lt "480000"; then
APR_SETIFNULL(ac_cv_func_kqueue, no)
fi
;;
*-next-nextstep*)
APR_SETIFNULL(CFLAGS, [-O])
APR_ADDTO(CPPFLAGS, [-DNEXT])
;;
*-next-openstep*)
APR_SETIFNULL(CFLAGS, [-O])
APR_ADDTO(CPPFLAGS, [-DNEXT])
;;
*-apple-rhapsody*)
APR_ADDTO(CPPFLAGS, [-DRHAPSODY])
;;
*-apple-darwin*)
APR_ADDTO(CPPFLAGS, [-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp])
APR_SETIFNULL(apr_posixsem_is_global, [yes])
APR_SETIFNULL(ac_cv_func_poll, [no]) # See issue 34332
# kqueue is broken on OS X, the poll tests work, but the socket tests
# hang when it's turned on. if you decide to reenable this please be
# sure to test that ALL the tests continue to work with it turned on.
APR_SETIFNULL(ac_cv_func_kqueue, [no])
;;
*-dec-osf*)
APR_ADDTO(CPPFLAGS, [-DOSF1])
# process-shared mutexes don't seem to work in Tru64 5.0
APR_SETIFNULL(apr_cv_process_shared_works, [no])
;;
*-nto-qnx*)
;;
*-qnx)
APR_ADDTO(CPPFLAGS, [-DQNX])
APR_ADDTO(LIBS, [-N128k -lunix])
;;
*-qnx32)
APR_ADDTO(CPPFLAGS, [-DQNX])
APR_ADDTO(CFLAGS, [-mf -3])
APR_ADDTO(LIBS, [-N128k -lunix])
;;
*-isc4*)
APR_ADDTO(CPPFLAGS, [-posix -DISC])
APR_ADDTO(LDFLAGS, [-posix])
APR_ADDTO(LIBS, [-linet])
;;
*-sco3.2v[[234]]*)
APR_ADDTO(CPPFLAGS, [-DSCO -D_REENTRANT])
if test "$GCC" = "no"; then
APR_ADDTO(CFLAGS, [-Oacgiltz])
fi
APR_ADDTO(LIBS, [-lPW -lmalloc])
;;
*-sco3.2v5*)
APR_ADDTO(CPPFLAGS, [-DSCO5 -D_REENTRANT])
;;
*-sco_sv*|*-SCO_SV*)
APR_ADDTO(CPPFLAGS, [-DSCO -D_REENTRANT])
APR_ADDTO(LIBS, [-lPW -lmalloc])
;;
*-solaris2*)
PLATOSVERS=`echo $host | sed 's/^.*solaris2.//'`
APR_ADDTO(CPPFLAGS, [-DSOLARIS2=$PLATOSVERS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT])
APR_SETIFNULL(apr_lock_method, [USE_FCNTL_SERIALIZE])
;;
*-sunos4*)
APR_ADDTO(CPPFLAGS, [-DSUNOS4])
;;
*-unixware1)
APR_ADDTO(CPPFLAGS, [-DUW=100])
;;
*-unixware2)
APR_ADDTO(CPPFLAGS, [-DUW=200])
APR_ADDTO(LIBS, [-lgen])
;;
*-unixware211)
APR_ADDTO(CPPFLAGS, [-DUW=211])
APR_ADDTO(LIBS, [-lgen])
;;
*-unixware212)
APR_ADDTO(CPPFLAGS, [-DUW=212])
APR_ADDTO(LIBS, [-lgen])
;;
*-unixware7)
APR_ADDTO(CPPFLAGS, [-DUW=700])
APR_ADDTO(LIBS, [-lgen])
;;
maxion-*-sysv4*)
APR_ADDTO(CPPFLAGS, [-DSVR4])
APR_ADDTO(LIBS, [-lc -lgen])
;;
*-*-powermax*)
APR_ADDTO(CPPFLAGS, [-DSVR4])
APR_ADDTO(LIBS, [-lgen])
;;
TPF)
APR_ADDTO(CPPFLAGS, [-DTPF -D_POSIX_SOURCE])
;;
bs2000*-siemens-sysv*)
APR_SETIFNULL(CFLAGS, [-O])
APR_ADDTO(CPPFLAGS, [-DSVR4 -D_XPG_IV -D_KMEMUSER])
APR_ADDTO(LIBS, [-lsocket])
APR_SETIFNULL(enable_threads, [no])
;;
*-siemens-sysv4*)
APR_ADDTO(CPPFLAGS, [-DSVR4 -D_XPG_IV -DHAS_DLFCN -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT])
APR_ADDTO(LIBS, [-lc])
;;
pyramid-pyramid-svr4)
APR_ADDTO(CPPFLAGS, [-DSVR4 -DNO_LONG_DOUBLE])
APR_ADDTO(LIBS, [-lc])
;;
DS/90\ 7000-*-sysv4*)
APR_ADDTO(CPPFLAGS, [-DUXPDS])
;;
*-tandem-sysv4*)
APR_ADDTO(CPPFLAGS, [-DSVR4])
;;
*-ncr-sysv4)
APR_ADDTO(CPPFLAGS, [-DSVR4 -DMPRAS])
APR_ADDTO(LIBS, [-lc -L/usr/ucblib -lucb])
;;
*-sysv4*)
APR_ADDTO(CPPFLAGS, [-DSVR4])
APR_ADDTO(LIBS, [-lc])
;;
88k-encore-sysv4)
APR_ADDTO(CPPFLAGS, [-DSVR4 -DENCORE])
APR_ADDTO(LIBS, [-lPW])
;;
*-uts*)
PLATOSVERS=`echo $host | sed 's/^.*,//'`
case $PLATOSVERS in
2*) APR_ADDTO(CPPFLAGS, [-DUTS21])
APR_ADDTO(CFLAGS, [-Xa -eft])
APR_ADDTO(LIBS, [-lbsd -la])
;;
*) APR_ADDTO(CPPFLAGS, [-DSVR4])
APR_ADDTO(CFLAGS, [-Xa])
;;
esac
;;
*-ultrix)
APR_ADDTO(CPPFLAGS, [-DULTRIX])
APR_SETVAR(SHELL, [/bin/sh5])
;;
*powerpc-tenon-machten*)
APR_ADDTO(LDFLAGS, [-Xlstack=0x14000 -Xldelcsect])
;;
*-machten*)
APR_ADDTO(LDFLAGS, [-stack 0x14000])
;;
*convex-v11*)
APR_ADDTO(CPPFLAGS, [-DCONVEXOS11])
APR_SETIFNULL(CFLAGS, [-O1])
APR_ADDTO(CFLAGS, [-ext])
;;
i860-intel-osf1)
APR_ADDTO(CPPFLAGS, [-DPARAGON])
;;
*-sequent-ptx2.*.*)
APR_ADDTO(CPPFLAGS, [-DSEQUENT=20])
APR_ADDTO(CFLAGS, [-Wc,-pw])
APR_ADDTO(LIBS, [-linet -lc -lseq])
;;
*-sequent-ptx4.0.*)
APR_ADDTO(CPPFLAGS, [-DSEQUENT=40])
APR_ADDTO(CFLAGS, [-Wc,-pw])
APR_ADDTO(LIBS, [-linet -lc])
;;
*-sequent-ptx4.[[123]].*)
APR_ADDTO(CPPFLAGS, [-DSEQUENT=41])
APR_ADDTO(CFLAGS, [-Wc,-pw])
APR_ADDTO(LIBS, [-lc])
;;
*-sequent-ptx4.4.*)
APR_ADDTO(CPPFLAGS, [-DSEQUENT=44])
APR_ADDTO(CFLAGS, [-Wc,-pw])
APR_ADDTO(LIBS, [-lc])
;;
*-sequent-ptx4.5.*)
APR_ADDTO(CPPFLAGS, [-DSEQUENT=45])
APR_ADDTO(CFLAGS, [-Wc,-pw])
APR_ADDTO(LIBS, [-lc])
;;
*-sequent-ptx5.0.*)
APR_ADDTO(CPPFLAGS, [-DSEQUENT=50])
APR_ADDTO(CFLAGS, [-Wc,-pw])
APR_ADDTO(LIBS, [-lc])
;;
*NEWS-OS*)
APR_ADDTO(CPPFLAGS, [-DNEWSOS])
;;
*-riscix)
APR_ADDTO(CPPFLAGS, [-DRISCIX])
APR_SETIFNULL(CFLAGS, [-O])
;;
*-irix*)
APR_ADDTO(CPPFLAGS, [-D_POSIX_THREAD_SAFE_FUNCTIONS])
;;
*beos*)
APR_ADDTO(CPPFLAGS, [-DBEOS])
PLATOSVERS=`uname -r`
APR_SETIFNULL(apr_process_lock_is_global, [yes])
case $PLATOSVERS in
5.0.4)
APR_ADDTO(LDFLAGS, [-L/boot/beos/system/lib])
APR_ADDTO(LIBS, [-lbind -lsocket])
APR_ADDTO(CPPFLAGS,[-DBONE7])
;;
5.1)
APR_ADDTO(LDFLAGS, [-L/boot/beos/system/lib])
APR_ADDTO(LIBS, [-lbind -lsocket])
;;
esac
APR_ADDTO(CPPFLAGS, [-DSIGPROCMASK_SETS_THREAD_MASK -DAP_AUTH_DBM_USE_APR])
;;
4850-*.*)
APR_ADDTO(CPPFLAGS, [-DSVR4 -DMPRAS])
APR_ADDTO(LIBS, [-lc -L/usr/ucblib -lucb])
;;
drs6000*)
APR_ADDTO(CPPFLAGS, [-DSVR4])
APR_ADDTO(LIBS, [-lc -L/usr/ucblib -lucb])
;;
m88k-*-CX/SX|CYBER)
APR_ADDTO(CPPFLAGS, [-D_CX_SX])
APR_ADDTO(CFLAGS, [-Xa])
;;
*-tandem-oss)
APR_ADDTO(CPPFLAGS, [-D_TANDEM_SOURCE -D_XOPEN_SOURCE_EXTENDED=1])
;;
*-ibm-os390)
APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
APR_SETIFNULL(apr_sysvsem_is_global, [yes])
APR_SETIFNULL(apr_gethostbyname_is_thread_safe, [yes])
APR_SETIFNULL(apr_gethostbyaddr_is_thread_safe, [yes])
APR_ADDTO(CPPFLAGS, [-U_NO_PROTO -DPTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR -DPTHREAD_SETS_ERRNO -DPTHREAD_DETACH_ARG1_ADDR -DSIGPROCMASK_SETS_THREAD_MASK -DTCP_NODELAY=1])
;;
*-ibm-as400)
APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
APR_SETIFNULL(apr_process_lock_is_global, [yes])
APR_SETIFNULL(apr_gethostbyname_is_thread_safe, [yes])
APR_SETIFNULL(apr_gethostbyaddr_is_thread_safe, [yes])
;;
*cygwin*)
APR_ADDTO(CPPFLAGS, [-DCYGWIN])
APR_ADDTO(LIBS, [-lcrypt])
;;
esac
fi
])
dnl
dnl APR_CC_HINTS
dnl
dnl Allows us to provide a default choice of compiler which
dnl the user can override.
AC_DEFUN(APR_CC_HINTS, [
case "$host" in
*-apple-aux3*)
APR_SETIFNULL(CC, [gcc])
;;
bs2000*-siemens-sysv*)
APR_SETIFNULL(CC, [c89 -XLLML -XLLMK -XL -Kno_integer_overflow])
;;
*convex-v11*)
APR_SETIFNULL(CC, [cc])
;;
*-ibm-os390)
APR_SETIFNULL(CC, [cc])
;;
*-ibm-as400)
APR_SETIFNULL(CC, [icc])
;;
*-isc4*)
APR_SETIFNULL(CC, [gcc])
;;
m88k-*-CX/SX|CYBER)
APR_SETIFNULL(CC, [cc])
;;
*-next-openstep*)
APR_SETIFNULL(CC, [cc])
;;
*-qnx32)
APR_SETIFNULL(CC, [cc -F])
;;
*-tandem-oss)
APR_SETIFNULL(CC, [c89])
;;
TPF)
APR_SETIFNULL(CC, [c89])
;;
esac
])

View File

@@ -0,0 +1,801 @@
dnl -------------------------------------------------------- -*- autoconf -*-
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 apr_network.m4: APR's autoconf macros for testing network support
dnl
dnl
dnl check for working getaddrinfo()
dnl
dnl Note that if the system doesn't have gai_strerror(), we
dnl can't use getaddrinfo() because we can't get strings
dnl describing the error codes.
dnl
AC_DEFUN(APR_CHECK_WORKING_GETADDRINFO,[
AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
AC_TRY_RUN( [
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
void main(void) {
struct addrinfo hints, *ai;
int error;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo("127.0.0.1", NULL, &hints, &ai);
if (error) {
exit(1);
}
if (ai->ai_addr->sa_family != AF_INET) {
exit(1);
}
exit(0);
}
],[
ac_cv_working_getaddrinfo="yes"
],[
ac_cv_working_getaddrinfo="no"
],[
ac_cv_working_getaddrinfo="yes"
])])
if test "$ac_cv_working_getaddrinfo" = "yes"; then
if test "$ac_cv_func_gai_strerror" != "yes"; then
ac_cv_working_getaddrinfo="no"
else
AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works well enough for APR])
fi
fi
])
dnl Check whether the AI_ADDRCONFIG flag can be used with getaddrinfo
AC_DEFUN(APR_CHECK_GETADDRINFO_ADDRCONFIG, [
AC_CACHE_CHECK(for working AI_ADDRCONFIG, apr_cv_gai_addrconfig, [
AC_TRY_RUN([
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
int main(int argc, char **argv) {
struct addrinfo hints, *ai;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG;
return getaddrinfo("localhost", NULL, &hints, &ai) != 0;
}], [apr_cv_gai_addrconfig=yes],
[apr_cv_gai_addrconfig=no],
[apr_cv_gai_addrconfig=no])])
if test $apr_cv_gai_addrconfig = yes; then
AC_DEFINE(HAVE_GAI_ADDRCONFIG, 1, [Define if getaddrinfo accepts the AI_ADDRCONFIG flag])
fi
])
dnl
dnl check for working getnameinfo()
dnl
AC_DEFUN(APR_CHECK_WORKING_GETNAMEINFO,[
AC_CACHE_CHECK(for working getnameinfo, ac_cv_working_getnameinfo,[
AC_TRY_RUN( [
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
void main(void) {
struct sockaddr_in sa;
char hbuf[256];
int error;
sa.sin_family = AF_INET;
sa.sin_port = 0;
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
#ifdef SIN6_LEN
sa.sin_len = sizeof(sa);
#endif
error = getnameinfo((const struct sockaddr *)&sa, sizeof(sa),
hbuf, 256, NULL, 0,
NI_NUMERICHOST);
if (error) {
exit(1);
} else {
exit(0);
}
}
],[
ac_cv_working_getnameinfo="yes"
],[
ac_cv_working_getnameinfo="no"
],[
ac_cv_working_getnameinfo="yes"
])])
if test "$ac_cv_working_getnameinfo" = "yes"; then
AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define if getnameinfo exists])
fi
])
dnl
dnl check for negative error codes for getaddrinfo()
dnl
AC_DEFUN(APR_CHECK_NEGATIVE_EAI,[
AC_CACHE_CHECK(for negative error codes for getaddrinfo, ac_cv_negative_eai,[
AC_TRY_RUN( [
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
void main(void) {
if (EAI_ADDRFAMILY < 0) {
exit(0);
}
exit(1);
}
],[
ac_cv_negative_eai="yes"
],[
ac_cv_negative_eai="no"
],[
ac_cv_negative_eai="no"
])])
if test "$ac_cv_negative_eai" = "yes"; then
AC_DEFINE(NEGATIVE_EAI, 1, [Define if EAI_ error codes from getaddrinfo are negative])
fi
])
dnl
dnl Checks the definition of gethostbyname_r and gethostbyaddr_r
dnl which are different for glibc, solaris and assorted other operating
dnl systems
dnl
dnl Note that this test is executed too early to see if we have all of
dnl the headers.
AC_DEFUN(APR_CHECK_GETHOSTBYNAME_R_STYLE,[
dnl Try and compile a glibc2 gethostbyname_r piece of code, and set the
dnl style of the routines to glibc2 on success
AC_CACHE_CHECK([style of gethostbyname_r routine], ac_cv_gethostbyname_r_style,
APR_TRY_COMPILE_NO_WARNING([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
],[
int tmp = gethostbyname_r((const char *) 0, (struct hostent *) 0,
(char *) 0, 0, (struct hostent **) 0, &tmp);
], ac_cv_gethostbyname_r_style=glibc2, ac_cv_gethostbyname_r_style=none))
if test "$ac_cv_gethostbyname_r_style" = "glibc2"; then
AC_DEFINE(GETHOSTBYNAME_R_GLIBC2, 1, [Define if gethostbyname_r has the glibc style])
fi
AC_CACHE_CHECK([3rd argument to the gethostbyname_r routines], ac_cv_gethostbyname_r_arg,
APR_TRY_COMPILE_NO_WARNING([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
],[
int tmp = gethostbyname_r((const char *) 0, (struct hostent *) 0,
(struct hostent_data *) 0);],
ac_cv_gethostbyname_r_arg=hostent_data, ac_cv_gethostbyname_r_arg=char))
if test "$ac_cv_gethostbyname_r_arg" = "hostent_data"; then
AC_DEFINE(GETHOSTBYNAME_R_HOSTENT_DATA, 1, [Define if gethostbyname_r has the hostent_data for the third argument])
fi
])
dnl
dnl see if TCP_NODELAY setting is inherited from listening sockets
dnl
AC_DEFUN(APR_CHECK_TCP_NODELAY_INHERITED,[
AC_CACHE_CHECK(if TCP_NODELAY setting is inherited from listening sockets, ac_cv_tcp_nodelay_inherited,[
AC_TRY_RUN( [
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
int main(void) {
int listen_s, connected_s, client_s;
int listen_port, rc;
struct sockaddr_in sa;
socklen_t sa_len;
socklen_t option_len;
int option;
listen_s = socket(AF_INET, SOCK_STREAM, 0);
if (listen_s < 0) {
perror("socket");
exit(1);
}
option = 1;
rc = setsockopt(listen_s, IPPROTO_TCP, TCP_NODELAY, &option, sizeof option);
if (rc < 0) {
perror("setsockopt TCP_NODELAY");
exit(1);
}
memset(&sa, 0, sizeof sa);
sa.sin_family = AF_INET;
#ifdef BEOS
sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#endif
/* leave port 0 to get ephemeral */
rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa);
if (rc < 0) {
perror("bind for ephemeral port");
exit(1);
}
/* find ephemeral port */
sa_len = sizeof(sa);
rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len);
if (rc < 0) {
perror("getsockname");
exit(1);
}
listen_port = sa.sin_port;
rc = listen(listen_s, 5);
if (rc < 0) {
perror("listen");
exit(1);
}
client_s = socket(AF_INET, SOCK_STREAM, 0);
if (client_s < 0) {
perror("socket");
exit(1);
}
memset(&sa, 0, sizeof sa);
sa.sin_family = AF_INET;
sa.sin_port = listen_port;
#ifdef BEOS
sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#endif
/* leave sin_addr all zeros to use loopback */
rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa);
if (rc < 0) {
perror("connect");
exit(1);
}
sa_len = sizeof sa;
connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
if (connected_s < 0) {
perror("accept");
exit(1);
}
option_len = sizeof option;
rc = getsockopt(connected_s, IPPROTO_TCP, TCP_NODELAY, &option, &option_len);
if (rc < 0) {
perror("getsockopt");
exit(1);
}
if (!option) {
fprintf(stderr, "TCP_NODELAY is not set in the child.\n");
exit(1);
}
return 0;
}
],[
ac_cv_tcp_nodelay_inherited="yes"
],[
ac_cv_tcp_nodelay_inherited="no"
],[
ac_cv_tcp_nodelay_inherited="yes"
])])
if test "$ac_cv_tcp_nodelay_inherited" = "yes"; then
tcp_nodelay_inherited=1
else
tcp_nodelay_inherited=0
fi
])
dnl
dnl Determine whether TCP_NODELAY and TCP_CORK can both be set
dnl on a TCP socket.
dnl
AC_DEFUN([APR_CHECK_TCP_NODELAY_WITH_CORK], [
AC_CACHE_CHECK([whether TCP_NODELAY and TCP_CORK can both be enabled],
[apr_cv_tcp_nodelay_with_cork],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#include <stdio.h>
#include <stdlib.h>
]], [[
int fd, flag, rc;
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
exit(1);
}
flag = 1;
rc = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof flag);
if (rc < 0) {
perror("setsockopt TCP_NODELAY");
exit(2);
}
flag = 1;
rc = setsockopt(fd, IPPROTO_TCP, TCP_CORK, &flag, sizeof flag);
if (rc < 0) {
perror("setsockopt TCP_CORK");
exit(3);
}
exit(0);
]])], [apr_cv_tcp_nodelay_with_cork=yes], [apr_cv_tcp_nodelay_with_cork=no])])
if test "$apr_cv_tcp_nodelay_with_cork" = "yes"; then
AC_DEFINE([HAVE_TCP_NODELAY_WITH_CORK], 1,
[Define if TCP_NODELAY and TCP_CORK can be enabled at the same time])
fi
])
dnl
dnl see if O_NONBLOCK setting is inherited from listening sockets
dnl
AC_DEFUN(APR_CHECK_O_NONBLOCK_INHERITED,[
AC_CACHE_CHECK(if O_NONBLOCK setting is inherited from listening sockets, ac_cv_o_nonblock_inherited,[
AC_TRY_RUN( [
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
int main(void) {
int listen_s, connected_s, client_s;
int listen_port, rc;
struct sockaddr_in sa;
socklen_t sa_len;
listen_s = socket(AF_INET, SOCK_STREAM, 0);
if (listen_s < 0) {
perror("socket");
exit(1);
}
memset(&sa, 0, sizeof sa);
sa.sin_family = AF_INET;
#ifdef BEOS
sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#endif
/* leave port 0 to get ephemeral */
rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa);
if (rc < 0) {
perror("bind for ephemeral port");
exit(1);
}
/* find ephemeral port */
sa_len = sizeof(sa);
rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len);
if (rc < 0) {
perror("getsockname");
exit(1);
}
listen_port = sa.sin_port;
rc = listen(listen_s, 5);
if (rc < 0) {
perror("listen");
exit(1);
}
rc = fcntl(listen_s, F_SETFL, O_NONBLOCK);
if (rc < 0) {
perror("fcntl(F_SETFL)");
exit(1);
}
client_s = socket(AF_INET, SOCK_STREAM, 0);
if (client_s < 0) {
perror("socket");
exit(1);
}
memset(&sa, 0, sizeof sa);
sa.sin_family = AF_INET;
sa.sin_port = listen_port;
#ifdef BEOS
sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#endif
/* leave sin_addr all zeros to use loopback */
rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa);
if (rc < 0) {
perror("connect");
exit(1);
}
sa_len = sizeof sa;
connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
if (connected_s < 0) {
perror("accept");
exit(1);
}
rc = fcntl(connected_s, F_GETFL, 0);
if (rc < 0) {
perror("fcntl(F_GETFL)");
exit(1);
}
if (!(rc & O_NONBLOCK)) {
fprintf(stderr, "O_NONBLOCK is not set in the child.\n");
exit(1);
}
return 0;
}
],[
ac_cv_o_nonblock_inherited="yes"
],[
ac_cv_o_nonblock_inherited="no"
],[
ac_cv_o_nonblock_inherited="yes"
])])
if test "$ac_cv_o_nonblock_inherited" = "yes"; then
o_nonblock_inherited=1
else
o_nonblock_inherited=0
fi
])
dnl
dnl check for socklen_t, fall back to unsigned int
dnl
AC_DEFUN(APR_CHECK_SOCKLEN_T,[
AC_CACHE_CHECK(for socklen_t, ac_cv_socklen_t,[
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
],[
socklen_t foo = (socklen_t) 0;
],[
ac_cv_socklen_t=yes
],[
ac_cv_socklen_t=no
])
])
if test "$ac_cv_socklen_t" = "yes"; then
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
fi
])
AC_DEFUN(APR_CHECK_INET_ADDR,[
AC_CACHE_CHECK(for inet_addr, ac_cv_func_inet_addr,[
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
],[
inet_addr("127.0.0.1");
],[
ac_cv_func_inet_addr=yes
],[
ac_cv_func_inet_addr=no
])
])
if test "$ac_cv_func_inet_addr" = "yes"; then
have_inet_addr=1
else
have_inet_addr=0
fi
])
AC_DEFUN(APR_CHECK_INET_NETWORK,[
AC_CACHE_CHECK(for inet_network, ac_cv_func_inet_network,[
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
],[
inet_network("127.0.0.1");
],[
ac_cv_func_inet_network=yes
],[
ac_cv_func_inet_network=no
])
])
if test "$ac_cv_func_inet_network" = "yes"; then
have_inet_network=1
else
have_inet_network=0
fi
])
dnl Check for presence of struct sockaddr_storage.
AC_DEFUN(APR_CHECK_SOCKADDR_STORAGE,[
AC_CACHE_CHECK(for sockaddr_storage, apr_cv_define_sockaddr_storage,[
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
],[struct sockaddr_storage sa;],
[apr_cv_define_sockaddr_storage=yes],
[apr_cv_define_sockaddr_storage=no])])
if test "$apr_cv_define_sockaddr_storage" = "yes"; then
have_sa_storage=1
else
have_sa_storage=0
fi
AC_SUBST(have_sa_storage)
])
dnl Check for presence of struct sockaddr_in6.
AC_DEFUN(APR_CHECK_SOCKADDR_IN6,[
AC_CACHE_CHECK(for sockaddr_in6, ac_cv_define_sockaddr_in6,[
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
],[
struct sockaddr_in6 sa;
],[
ac_cv_define_sockaddr_in6=yes
],[
ac_cv_define_sockaddr_in6=no
])
])
if test "$ac_cv_define_sockaddr_in6" = "yes"; then
have_sockaddr_in6=1
else
have_sockaddr_in6=0
fi
])
dnl
dnl APR_H_ERRNO_COMPILE_CHECK
dnl
AC_DEFUN(APR_H_ERRNO_COMPILE_CHECK,[
if test x$1 != x; then
CPPFLAGS="-D$1 $CPPFLAGS"
fi
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
],[
int h_e = h_errno;
],[
if test x$1 != x; then
ac_cv_h_errno_cppflags="$1"
else
ac_cv_h_errno_cppflags=yes
fi
],[
ac_cv_h_errno_cppflags=no
])])
dnl
dnl APR_CHECK_SCTP
dnl
dnl check for presence of SCTP protocol support
dnl
AC_DEFUN([APR_CHECK_SCTP],
[
AC_CACHE_CHECK([whether SCTP is supported], [apr_cv_sctp], [
AC_TRY_RUN([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_SCTP_H
#include <netinet/sctp.h>
#endif
#ifdef HAVE_NETINET_SCTP_UIO_H
#include <netinet/sctp_uio.h>
#endif
#include <stdlib.h>
int main(void) {
int s, opt = 1;
if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)) < 0)
exit(1);
if (setsockopt(s, IPPROTO_SCTP, SCTP_NODELAY, &opt, sizeof(int)) < 0)
exit(2);
exit(0);
}], [apr_cv_sctp=yes], [apr_cv_sctp=no], [apr_cv_sctp=no])])
if test "$apr_cv_sctp" = "yes"; then
have_sctp=1
else
have_sctp=0
fi
])
dnl APR_CHECK_MCAST: check for multicast interfaces
AC_DEFUN([APR_CHECK_MCAST], [
AC_CACHE_CHECK([for struct ip_mreq], [apr_cv_struct_ipmreq], [
AC_TRY_COMPILE([
#include <sys/types.h>
#include <netinet/in.h>
], [
struct ip_mreq mip;
mip.imr_interface.s_addr = INADDR_ANY;
], [apr_cv_struct_ipmreq=yes], [apr_cv_struct_ipmreq=no], [apr_cv_struct_ipmreq=yes])])
if test $apr_cv_struct_ipmreq = yes; then
AC_DEFINE([HAVE_STRUCT_IPMREQ], 1, [Define if struct impreq was found])
fi
])
dnl
dnl APR_CHECK_H_ERRNO_FLAG
dnl
dnl checks which flags are necessary for <netdb.h> to define h_errno
dnl
AC_DEFUN(APR_CHECK_H_ERRNO_FLAG,[
AC_MSG_CHECKING([for h_errno in netdb.h])
AC_CACHE_VAL(ac_cv_h_errno_cppflags,[
APR_H_ERRNO_COMPILE_CHECK
if test "$ac_cv_h_errno_cppflags" = "no"; then
ac_save="$CPPFLAGS"
for flag in _XOPEN_SOURCE_EXTENDED; do
APR_H_ERRNO_COMPILE_CHECK($flag)
if test "$ac_cv_h_errno_cppflags" != "no"; then
break
fi
done
CPPFLAGS="$ac_save"
fi
])
if test "$ac_cv_h_errno_cppflags" != "no"; then
if test "$ac_cv_h_errno_cppflags" != "yes"; then
CPPFLAGS="-D$ac_cv_h_errno_cppflags $CPPFLAGS"
AC_MSG_RESULT([yes, with -D$ac_cv_h_errno_cppflags])
else
AC_MSG_RESULT([$ac_cv_h_errno_cppflags])
fi
else
AC_MSG_RESULT([$ac_cv_h_errno_cppflags])
fi
])
AC_DEFUN(APR_EBCDIC,[
AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
AC_TRY_RUN( [
int main(void) {
return (unsigned char)'A' != (unsigned char)0xC1;
}
],[
ac_cv_ebcdic="yes"
],[
ac_cv_ebcdic="no"
],[
ac_cv_ebcdic="no"
])])
if test "$ac_cv_ebcdic" = "yes"; then
apr_charset_ebcdic=1
else
apr_charset_ebcdic=0
fi
AC_SUBST(apr_charset_ebcdic)
])

View File

@@ -0,0 +1,207 @@
# 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.
#
#
#
# rules.mk: standard rules for APR
#
@SET_MAKE@
#
# Configuration variables
#
apr_builddir=@apr_builddir@
apr_builders=@apr_builders@
# Some layouts require knowing what version we are at.
APR_MAJOR_VERSION=@APR_MAJOR_VERSION@
APR_DOTTED_VERSION=@APR_DOTTED_VERSION@
CC=@CC@
RM=@RM@
AWK=@AWK@
SHELL=@SHELL@
LIBTOOL=@LIBTOOL@
# compilation and linking flags that are supposed to be set only by the user.
# configure adds to them for tests, but we restore them at the end.
#
CFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
LDFLAGS=@LDFLAGS@
LIBS=@LIBS@
DEFS=@DEFS@
# anything added to the standard flags by configure is moved to EXTRA_*
# at the end of the process.
#
EXTRA_CFLAGS=@EXTRA_CFLAGS@
EXTRA_CPPFLAGS=@EXTRA_CPPFLAGS@
EXTRA_LDFLAGS=@EXTRA_LDFLAGS@
EXTRA_LIBS=@EXTRA_LIBS@
EXTRA_INCLUDES=@EXTRA_INCLUDES@
# NOTEST_* are flags and libraries that can be added by the user without
# causing them to be used in configure tests (necessary for things like
# -Werror and other strict warnings that maintainers like to use).
#
NOTEST_CFLAGS=@NOTEST_CFLAGS@
NOTEST_CPPFLAGS=@NOTEST_CPPFLAGS@
NOTEST_LDFLAGS=@NOTEST_LDFLAGS@
NOTEST_LIBS=@NOTEST_LIBS@
# Finally, combine all of the flags together in the proper order so that
# the user-defined flags can always override the configure ones, if needed.
# Note that includes are listed after the flags because -I options have
# left-to-right precedence and CPPFLAGS may include user-defined overrides.
#
ALL_CFLAGS = $(EXTRA_CFLAGS) $(NOTEST_CFLAGS) $(CFLAGS)
ALL_CPPFLAGS = $(DEFS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS)
ALL_LDFLAGS = $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS)
ALL_LIBS = $(LIBS) $(NOTEST_LIBS) $(EXTRA_LIBS)
ALL_INCLUDES = $(INCLUDES) $(EXTRA_INCLUDES)
LTFLAGS = @LTFLAGS@
LT_LDFLAGS = @LT_LDFLAGS@
# The set of object files that will be linked into the target library.
# The build-outputs.mk specifies a different set for each platform. The
# configure script will select the appropriate set.
#
OBJECTS = @OBJECTS_PLATFORM@
#
# Basic macro setup
#
COMPILE = $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
LT_COMPILE = @lt_compile@
LINK = @link@
APR_MKDIR = $(apr_builders)/mkdir.sh
APR_MKEXPORT = $(AWK) -f $(apr_builders)/make_exports.awk
APR_MKVAREXPORT = $(AWK) -f $(apr_builders)/make_var_export.awk
MKDEP = @MKDEP@
#
# Standard build rules
#
all: all-recursive
depend: depend-recursive
clean: clean-recursive
distclean: distclean-recursive
extraclean: extraclean-recursive
install: all-recursive
all-recursive depend-recursive:
@otarget=`echo $@ | sed s/-recursive//`; \
list='$(SOURCE_DIRS)'; \
for i in $$list; do \
if test -f "$$i/Makefile"; then \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-$$target"; \
fi; \
(cd $$i && $(MAKE) $$target) || exit 1; \
fi; \
done; \
if test "$$otarget" = "all" && test -z "$(TARGETS)"; then \
made_local=yes; \
fi; \
if test "$$made_local" != "yes"; then \
$(MAKE) "local-$$otarget" || exit 1; \
fi
clean-recursive distclean-recursive extraclean-recursive:
@otarget=`echo $@ | sed s/-recursive//`; \
list='$(CLEAN_SUBDIRS)'; \
for i in $$list; do \
if test -f "$$i/Makefile"; then \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
made_local=yes; \
target="local-$$target"; \
fi; \
(cd $$i && $(MAKE) $$target); \
fi; \
done; \
if test "$$otarget" = "all" && test -z "$(TARGETS)"; then \
made_local=yes; \
fi; \
if test "$$made_local" != "yes"; then \
$(MAKE) "local-$$otarget"; \
fi
# autoconf 2.5x is creating a 'autom4te.cache' directory
# In case someone ran autoconf by hand, get rid of that directory
# as well.
local-clean: x-local-clean
@list='. $(SOURCE_DIRS)'; \
for i in $$list; do \
echo $(RM) -f $$i/*.o $$i/*.lo $$i/*.a $$i/*.la $$i/*.so $$i/*.obj; \
$(RM) -f $$i/*.o $$i/*.lo $$i/*.a $$i/*.la $$i/*.so $$i/*.obj; \
echo $(RM) -rf $$i/.libs; \
$(RM) -rf $$i/.libs; \
done
$(RM) -f $(CLEAN_TARGETS) $(PROGRAMS)
$(RM) -rf autom4te.cache
local-distclean: local-clean x-local-distclean
$(RM) -f Makefile $(DISTCLEAN_TARGETS)
local-extraclean: local-distclean x-local-extraclean
@if test -n "$(EXTRACLEAN_TARGETS)"; then \
echo $(RM) -f $(EXTRACLEAN_TARGETS) ; \
$(RM) -f $(EXTRACLEAN_TARGETS) ; \
fi
local-all: $(TARGETS)
local-depend: x-local-depend
@if test -n "`ls $(srcdir)/*.c 2> /dev/null`"; then \
$(RM) -f .deps; \
list='$(srcdir)/*.c'; \
for i in $$list; do \
$(MKDEP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) $$i | sed 's/\.o:/.lo:/' >> .deps; \
done; \
fi
# to be filled in by the actual Makefile
x-local-depend x-local-clean x-local-distclean x-local-extraclean:
#
# Implicit rules for creating outputs from input files
#
.SUFFIXES:
.SUFFIXES: .c .lo .o
.c.o:
$(COMPILE) -c $<
.c.lo:
$(LT_COMPILE)
.PHONY: all all-recursive local-all install \
depend depend-recursive local-depend x-local-depend \
clean clean-recursive local-clean x-local-clean \
distclean distclean-recursive local-distclean x-local-distclean \
extraclean extraclean-recursive local-extraclean x-local-extraclean

View File

@@ -0,0 +1,283 @@
dnl -------------------------------------------------------- -*- autoconf -*-
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 apr_threads.m4: APR's autoconf macros for testing thread support
dnl
dnl
dnl APR_CHECK_PTHREADS_H([ ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl gcc issues warnings when parsing AIX 4.3.3's pthread.h
dnl which causes autoconf to incorrectly conclude that
dnl pthreads is not available.
dnl Turn off warnings if we're using gcc.
dnl
AC_DEFUN(APR_CHECK_PTHREADS_H, [
if test "$GCC" = "yes"; then
SAVE_FL="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -w"
AC_CHECK_HEADERS(pthread.h, [ $1 ] , [ $2 ] )
CPPFLAGS="$SAVE_FL"
else
AC_CHECK_HEADERS(pthread.h, [ $1 ] , [ $2 ] )
fi
])dnl
dnl
dnl APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS
dnl
AC_DEFUN(APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS, [
AC_CACHE_CHECK(whether pthread_getspecific takes two arguments, ac_cv_pthread_getspecific_two_args,[
AC_TRY_COMPILE([
#include <pthread.h>
],[
pthread_key_t key;
void *tmp;
pthread_getspecific(key,&tmp);
],[
ac_cv_pthread_getspecific_two_args=yes
],[
ac_cv_pthread_getspecific_two_args=no
])
])
if test "$ac_cv_pthread_getspecific_two_args" = "yes"; then
AC_DEFINE(PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS, 1, [Define if pthread_getspecific() has two args])
fi
])dnl
dnl
dnl APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG
dnl
AC_DEFUN(APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG, [
AC_CACHE_CHECK(whether pthread_attr_getdetachstate takes one argument, ac_cv_pthread_attr_getdetachstate_one_arg,[
AC_TRY_COMPILE([
#include <pthread.h>
],[
pthread_attr_t *attr;
pthread_attr_getdetachstate(attr);
],[
ac_cv_pthread_attr_getdetachstate_one_arg=yes
],[
ac_cv_pthread_attr_getdetachstate_one_arg=no
])
])
if test "$ac_cv_pthread_attr_getdetachstate_one_arg" = "yes"; then
AC_DEFINE(PTHREAD_ATTR_GETDETACHSTATE_TAKES_ONE_ARG, 1, [Define if pthread_attr_getdetachstate() has one arg])
fi
])dnl
dnl
dnl APR_PTHREADS_TRY_RUN(actions-if-success)
dnl
dnl Try running a program which uses pthreads, executing the
dnl actions-if-success commands on success.
dnl
AC_DEFUN(APR_PTHREADS_TRY_RUN, [
AC_TRY_RUN( [
#include <pthread.h>
#include <stddef.h>
void *thread_routine(void *data) {
return data;
}
int main() {
pthread_t thd;
pthread_mutexattr_t mattr;
pthread_once_t once_init = PTHREAD_ONCE_INIT;
int data = 1;
pthread_mutexattr_init(&mattr);
return pthread_create(&thd, NULL, thread_routine, &data);
} ], [apr_p_t_r=yes], [apr_p_t_r=no], [apr_p_t_r=no])
if test $apr_p_t_r = yes; then
$1
fi
])dnl
dnl
dnl APR_PTHREADS_CHECK()
dnl
dnl Try to find a way to enable POSIX threads. Sets the
dnl pthreads_working variable to "yes" on success.
dnl
AC_DEFUN(APR_PTHREADS_CHECK,[
AC_CACHE_CHECK([for CFLAGS needed for pthreads], [apr_cv_pthreads_cflags],
[apr_ptc_cflags=$CFLAGS
for flag in none -kthread -pthread -pthreads -mt -mthreads -Kthread -threads; do
CFLAGS=$apr_ptc_cflags
test "x$flag" != "xnone" && CFLAGS="$CFLAGS $flag"
APR_PTHREADS_TRY_RUN([
apr_cv_pthreads_cflags="$flag"
break
])
done
CFLAGS=$apr_ptc_cflags
])
if test -n "$apr_cv_pthreads_cflags"; then
pthreads_working=yes
if test "x$apr_cv_pthreads_cflags" != "xnone"; then
APR_ADDTO(CFLAGS,[$apr_cv_pthreads_cflags])
fi
fi
# The CFLAGS may or may not be sufficient to ensure that libapr
# depends on the pthreads library: some versions of libtool
# drop -pthread when passed on the link line; some versions of
# gcc ignore -pthread when linking a shared object. So always
# try and add the relevant library to LIBS too.
AC_CACHE_CHECK([for LIBS needed for pthreads], [apr_cv_pthreads_lib], [
apr_ptc_libs=$LIBS
for lib in -lpthread -lpthreads -lc_r; do
LIBS="$apr_ptc_libs $lib"
APR_PTHREADS_TRY_RUN([
apr_cv_pthreads_lib=$lib
break
])
done
LIBS=$apr_ptc_libs
])
if test -n "$apr_cv_pthreads_lib"; then
pthreads_working=yes
APR_ADDTO(LIBS,[$apr_cv_pthreads_lib])
fi
if test "$pthreads_working" = "yes"; then
threads_result="POSIX Threads found"
else
threads_result="POSIX Threads not found"
fi
])dnl
dnl
dnl APR_PTHREADS_CHECK_SAVE
dnl APR_PTHREADS_CHECK_RESTORE
dnl
dnl Save the global environment variables that might be modified during
dnl the checks for threading support so that they can restored if the
dnl result is not what the caller wanted.
dnl
AC_DEFUN(APR_PTHREADS_CHECK_SAVE, [
apr_pthsv_CFLAGS="$CFLAGS"
apr_pthsv_LIBS="$LIBS"
])dnl
AC_DEFUN(APR_PTHREADS_CHECK_RESTORE, [
CFLAGS="$apr_pthsv_CFLAGS"
LIBS="$apr_pthsv_LIBS"
])dnl
dnl
dnl APR_CHECK_SIGWAIT_ONE_ARG
dnl
AC_DEFUN(APR_CHECK_SIGWAIT_ONE_ARG,[
AC_CACHE_CHECK(whether sigwait takes one argument,ac_cv_sigwait_one_arg,[
AC_TRY_COMPILE([
#if defined(__NETBSD__) || defined(DARWIN)
/* When using the unproven-pthreads package, we need to pull in this
* header to get a prototype for sigwait(). Else things will fail later
* on. XXX Should probably be fixed in the unproven-pthreads package.
* Darwin is declaring sigwait() in the wrong place as well.
*/
#include <pthread.h>
#endif
#include <signal.h>
],[
sigset_t set;
sigwait(&set);
],[
ac_cv_sigwait_one_arg=yes
],[
ac_cv_sigwait_one_arg=no
])])
if test "$ac_cv_sigwait_one_arg" = "yes"; then
AC_DEFINE(SIGWAIT_TAKES_ONE_ARG,1,[ ])
fi
])
dnl Check for recursive mutex support (per SUSv3).
AC_DEFUN([APR_CHECK_PTHREAD_RECURSIVE_MUTEX], [
AC_CACHE_CHECK([for recursive mutex support], [apr_cv_mutex_recursive],
[AC_TRY_RUN([#include <sys/types.h>
#include <pthread.h>
#include <stdlib.h>
int main() {
pthread_mutexattr_t attr;
pthread_mutex_t m;
exit (pthread_mutexattr_init(&attr)
|| pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)
|| pthread_mutex_init(&m, &attr));
}], [apr_cv_mutex_recursive=yes], [apr_cv_mutex_recursive=no],
[apr_cv_mutex_recursive=no])])
if test "$apr_cv_mutex_recursive" = "yes"; then
AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1,
[Define if recursive pthread mutexes are available])
fi
])
dnl Check for robust process-shared mutex support
AC_DEFUN([APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX], [
AC_CACHE_CHECK([for robust cross-process mutex support],
[apr_cv_mutex_robust_shared],
[AC_TRY_RUN([
#include <sys/types.h>
#include <pthread.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
pthread_mutex_t mutex;
pthread_mutexattr_t attr;
if (pthread_mutexattr_init(&attr))
exit(1);
if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
exit(2);
if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP))
exit(3);
if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT))
exit(4);
if (pthread_mutex_init(&mutex, &attr))
exit(5);
if (pthread_mutexattr_destroy(&attr))
exit(6);
if (pthread_mutex_destroy(&mutex))
exit(7);
exit(0);
}], [apr_cv_mutex_robust_shared=yes], [apr_cv_mutex_robust_shared=no])])
if test "$apr_cv_mutex_robust_shared" = "yes"; then
AC_DEFINE([HAVE_PTHREAD_MUTEX_ROBUST], 1,
[Define if cross-process robust mutexes are available])
fi
])

66
libs/apr/build/buildcheck.sh Executable file
View File

@@ -0,0 +1,66 @@
#! /bin/sh
echo "buildconf: checking installation..."
# any python
python=`build/PrintPath python`
if test -z "$python"; then
echo "buildconf: python not found."
echo " You need python installed"
echo " to build APR from SVN."
exit 1
else
py_version=`python -c 'import sys; print sys.version' 2>&1|sed 's/ .*//;q'`
echo "buildconf: python version $py_version (ok)"
fi
# autoconf 2.50 or newer
ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;q'`
if test -z "$ac_version"; then
echo "buildconf: autoconf not found."
echo " You need autoconf version 2.50 or newer installed"
echo " to build APR from SVN."
exit 1
fi
IFS=.; set $ac_version; IFS=' '
if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
echo "buildconf: autoconf version $ac_version found."
echo " You need autoconf version 2.50 or newer installed"
echo " to build APR from SVN."
exit 1
else
echo "buildconf: autoconf version $ac_version (ok)"
fi
# Sample libtool --version outputs:
# ltmain.sh (GNU libtool) 1.3.3 (1.385.2.181 1999/07/02 15:49:11)
# ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
# output is multiline from 1.5 onwards
# Require libtool 1.4 or newer
libtool=`build/PrintPath glibtool libtool libtool15 libtool14`
lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
if test -z "$lt_pversion"; then
echo "buildconf: libtool not found."
echo " You need libtool version 1.4 or newer installed"
echo " to build APR from SVN."
exit 1
fi
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
IFS=.; set $lt_version; IFS=' '
lt_status="good"
if test "$1" = "1"; then
if test "$2" -lt "4"; then
lt_status="bad"
fi
fi
if test $lt_status = "good"; then
echo "buildconf: libtool version $lt_pversion (ok)"
exit 0
fi
echo "buildconf: libtool version $lt_pversion found."
echo " You need libtool version 1.4 or newer installed"
echo " to build APR from SVN."
exit 1

1500
libs/apr/build/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1608
libs/apr/build/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

502
libs/apr/build/cvtdsp.pl Normal file
View File

@@ -0,0 +1,502 @@
use IO::File;
use File::Find;
if ($ARGV[0] eq '-6') {
find(\&tovc6, '.');
}
elsif ($ARGV[0] eq '-5') {
find(\&tovc5, '.');
}
elsif ($ARGV[0] eq '-w3') {
find(\&tow3, '.');
}
elsif ($ARGV[0] eq '-w4') {
find(\&tow4, '.');
}
elsif ($ARGV[0] eq '-ia64') {
find(\&tovc64, '.');
}
elsif ($ARGV[0] eq '-d') {
find(\&todebugpools, '.');
}
elsif ($ARGV[0] eq '-b') {
find(\&tobrowse, '.');
}
elsif ($ARGV[0] eq '-m') {
## 0 - conapp, 1 - dll lib, 2 - static lib
$dsptype = 2;
$name = "apr";
onemake();
}
else {
print "Specify -5 or -6 for Visual Studio 5 or 6 (98) .dsp format\n";
print "Specify -w3 or -w4 for .dsp build with warning level 3 or 4 (strict)\n\n";
print "Specify -ia64 for build targeted at Itanium (req's psdk tools)\n\n";
print "Specify -p for extreme pool debugging\n\n";
die "Missing argument";
}
sub tovc5 {
if (m|\.dsp$|) {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
$srcfl = new IO::File $oname, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
if ($src =~ s|Format Version 6\.00|Format Version 5\.00|) {
$verchg = -1;
}
if ($src =~ s|^(# ADD CPP .*)/ZI (.*)|$1/Zi $2|) {
$verchg = -1;
}
if ($src =~ s|^(# ADD BASE CPP .*)/ZI (.*)|$1/Zi $2|) {
$verchg = -1;
}
if ($src =~ s|^(# ADD CPP .*)/EHsc (.*)|$1/GX $2|) {
$verchg = -1;
}
if ($src =~ s|^(# ADD BASE CPP .*)/EHsc (.*)|$1/GX $2|) {
$verchg = -1;
}
if ($src !~ m|^# PROP AllowPerConfigDependencies|) {
print $dstfl $src; }
else {
$verchg = -1;
}
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted VC6 project " . $oname . " to VC5 in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub tovc6 {
if (m|\.dsp$|) {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
$srcfl = new IO::File $_, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
if ($src =~ s|Format Version 5\.00|Format Version 6\.00|) {
$verchg = -1;
}
if ($src =~ s|^(!MESSAGE .*)\\\n|$1|) {
$cont = <$srcfl>;
$src = $src . $cont;
$verchg = -1;
}
if ($src =~ s|^(# ADD CPP .*)/GX (.*)|$1/EHsc $2|) {
$verchg = -1;
}
if ($src =~ s|^(# ADD BASE CPP .*)/GX (.*)|$1/EHsc $2|) {
$verchg = -1;
}
print $dstfl $src;
if ($verchg && $src =~ m|^# Begin Project|) {
print $dstfl "# PROP AllowPerConfigDependencies 0\n";
}
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted VC5 project " . $oname . " to VC6 in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub tow3 {
if (m|\.dsp$| || m|\.mak$|) {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
$srcfl = new IO::File $_, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
while ($src =~ m|\\\n$|) {
$src = $src . <$srcfl>
}
if ($src =~ s|(\bCPP.*) /W4(.*)|$1 /W3$2|) {
$verchg = -1;
}
print $dstfl $src;
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted project " . $oname . " to warn:3 in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub tow4 {
if (m|\.dsp$| || m|\.mak$|) {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
$srcfl = new IO::File $_, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
while ($src =~ m|\\\n$|) {
$src = $src . <$srcfl>
}
if ($src =~ s|(\bCPP.*) /W3(.*)|$1 /W4$2|) {
$verchg = -1;
}
print $dstfl $src;
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted project " . $oname . " to warn:4 " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub tovc64 {
if (m|\.dsp$| || m|\.mak$|) {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
$srcfl = new IO::File $_, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
while ($src =~ m|\\\n$|) {
$src = $src . <$srcfl>
}
if ($src =~ s|Win32 \(x86\) (Release)|Win32 (IA64) $1|s) {
$verchg = -1;
}
if ($src =~ s|Win32 \(x86\) (Debug)|Win32 (IA64) $1|s) {
$verchg = -1;
}
if ($src =~ s| - Win32 (Release)| - Win32 (IA64) $1|s) {
$verchg = -1;
}
if ($src =~ s| - Win32 (Debug)| - Win32 (IA64) $1|s) {
$verchg = -1;
}
# Cross compilation exceptions
if (!(m|gen[^/]*$| || m|dftables[^/]*$|)) {
if ($src =~ s|(\bCPP.* /W3)(.*) /FD(.*)|$1 /As64 /Wp64$2$3|s) {
$verchg = -1;
}
if ($src =~ s|(\bLINK.*/machine):I386(.*)|$1:IA64$2|s) {
$verchg = -1;
}
}
else {
if ($src =~ s|(\bCPP.* /W3)(.*) /FD(.*)|$1 /As32 /Wp64$2$3|s) {
$verchg = -1;
}
}
print $dstfl $src;
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted build file " . $oname . " to Win64 in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub todebugpools {
if (m|\.dsp$|) {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
$srcfl = new IO::File $oname, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
if ($src =~ s|^(# ADD CPP .* /D "_DEBUG" )|$1/D "APR_POOL_DEBUG" |) {
$verchg = -1;
if ($oname =~ /apr\.dsp$/) {
$src =~ s|^(# ADD CPP .* /D "_DEBUG" )|$1/D "POOL_DEBUG" |;
}
}
print $dstfl $src;
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted project " . $oname . " to debug pools in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub tobrowsesources {
if (m|\.dsp$|) {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
$srcfl = new IO::File $oname, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
if ($src =~ s|^(# ADD CPP .*)( /Fd)|$1 /Fr "/httpd-2.0/srclib/apr"$2|) {
$verchg = -1;
}
print $dstfl $src;
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted project " . $oname . " to browse sources in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub frommakefiles {
if (m|\.mak\.in$|) {
$oname = $_;
$dname = $_;
$_ =~ s/\.mak\.in/.dsp/;
$verchg = 0;
$srcfl = new IO::File $oname, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
if ($src =~ s|^(# ADD CPP .*)( /Fd)|$1 /Fr "/httpd-2.0/srclib/apr"$2|) {
$verchg = -1;
}
print $dstfl $src;
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Converted project " . $oname . " to browse sources in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
}
}
sub onemake {
if ($dsptype == 0) {
$cdefs = qq{/D "WIN32" /D "_CONSOLE"};
$lmodel = qq{/subsystem:console};
$targname = "Win32 (x86) Console Application";
$targid = "0x0103";
$debpath = "Debug"; $relpath = "Release";
} elsif ($dsptype == 1) {
$cdefs = qq{/D "WIN32" /D "_WINDOWS"};
$lmodel = qq{/subsystem:windows /dll};
$targname = "Win32 (x86) Dynamic-Link Library";
$targid = "0x0102";
$debpath = "Debug"; $relpath = "Release";
} elsif($dsptype == 2) {
$cdefs = qq{/D "WIN32" /D "_CONSOLE"};
$lmodel = qq{/subsystem:console};
$targname = "Win32 (x86) Static Library";
$targid = "0x0104";
$debpath = "LibD"; $relpath = "LibR";
}
$file = dspheader();
$second = "";
$model = "Release";
$usedebuglib = "0";
$debugdef = "NDEBUG";
$cflags = "/MD /W3 /O2";
$cincl = qq{/I "./include" /I "./os/win32" /I "./srclib/apr/include" /I "./srclib/apr-util/include"};
$lflags = qq{/map};
$file .= dsponemodel();
$second = "ELSE";
$model = "Debug";
$usedebuglib = "1";
$debugdef = "_DEBUG";
$cflags = "/MDd /W3 /GX /Zi /Od";
$cincl = qq{/I "./include" /I "./os/win32" /I "./srclib/apr/include" /I "./srclib/apr-util/include"};
$lflags = qq{/incremental:no /debug};
$file .= dsponemodel();
$file .= qq{
!ENDIF
# Begin Target
# Name "$name - Win32 Release"
# Name "$name - Win32 Debug"
};
$toroot = ".";
#HERE IS OUR FOREACH!
$file .= qq{# Begin Source File
SOURCE=./server/main.c
# End Source File
};
if ($dsptype == 0) {
#HERE IS OUR ICON!
$icon="$toroot/build/win32/apache.ico";
$file .= qq{# Begin Source File
SOURCE=$icon
# End Source File
};
$icon = "icon=" . $icon . " ";
}
if ($dsptype == 0 || $dsptype == 1) {
$file .= qq{
# Begin Source File
SOURCE=./$name.rc
# End Source File
# Begin Source File
SOURCE=$toroot/include/ap_release.h
# PROP Ignore_Default_Tool 1
# Begin Custom Build - Creating Version Resource
InputPath=$toroot/include/ap_release.h $toroot/build/win32/win32ver.awk
"./$name.rc" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)"
awk -f $toroot/build/win32/win32ver.awk $name "Apache HTTP Server" $toroot/include/ap_release.h $icon> ./Apache.rc
# End Custom Build
# End Source File
};
}
$file .= qq{
# End Target
# End Project
};
print $file;
}
sub dspheader {
if ($dsptype == 1) {
$midl = "MTL=midl.exe\n";
} else {
$midl = ""
}
qq{# Microsoft Developer Studio Project File - Name="$name" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "$targname" $targid
CFG=$name - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "$name.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "$name.mak" CFG="$name - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "$name - Win32 Release" (based on "$targname")
!MESSAGE "$name - Win32 Debug" (based on "$targname")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
${midl}RSC=rc.exe
};
}
sub dsponemodel {
if ($model eq "Release") {
$targpath = $relpath;
} else {
$targpath = $debpath;
}
if ($dsptype == 1) {
$midl =
qq{# ADD BASE MTL /nologo /D "$debugdef" /win32
# ADD MTL /nologo /D "$debugdef" /mktyplib203 /win32
}; }
if ($dsptype == 2) {
$linkop = qq{LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
};
} else {
$linkop = qq{LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo $lmodel $lflags /machine:I386
# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo $lmodel $lflags /machine:I386
};
}
qq{
!${second}IF "\$(CFG)" == "$name - Win32 $model"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries $usedebuglib
# PROP BASE Output_Dir "$targpath"
# PROP BASE Intermediate_Dir "$targpath"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries $usedebuglib
# PROP Output_Dir "$targpath"
# PROP Intermediate_Dir "$targpath"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo $cflags $cincl /D "$debugdef" $cdefs /FD /c
# ADD CPP /nologo $cflags $cincl /D "$debugdef" $cdefs /Fd"$targpath/$name" /FD /c
${midl}# ADD BASE RSC /l 0x409 /d "$debugdef"
# ADD RSC /l 0x409 /d "$debugdef"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
$linkop};
}

167
libs/apr/build/find_apr.m4 Normal file
View File

@@ -0,0 +1,167 @@
dnl -------------------------------------------------------- -*- autoconf -*-
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 find_apr.m4 : locate the APR include files and libraries
dnl
dnl This macro file can be used by applications to find and use the APR
dnl library. It provides a standardized mechanism for using APR. It supports
dnl embedding APR into the application source, or locating an installed
dnl copy of APR.
dnl
dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors)
dnl
dnl where srcdir is the location of the bundled APR source directory, or
dnl empty if source is not bundled.
dnl
dnl where builddir is the location where the bundled APR will will be built,
dnl or empty if the build will occur in the srcdir.
dnl
dnl where implicit-install-check set to 1 indicates if there is no
dnl --with-apr option specified, we will look for installed copies.
dnl
dnl where acceptable-majors is a space separated list of acceptable major
dnl version numbers. Often only a single major version will be acceptable.
dnl If multiple versions are specified, and --with-apr=PREFIX or the
dnl implicit installed search are used, then the first (leftmost) version
dnl in the list that is found will be used. Currently defaults to [0 1].
dnl
dnl Sets the following variables on exit:
dnl
dnl apr_found : "yes", "no", "reconfig"
dnl
dnl apr_config : If the apr-config tool exists, this refers to it. If
dnl apr_found is "reconfig", then the bundled directory
dnl should be reconfigured *before* using apr_config.
dnl
dnl Note: this macro file assumes that apr-config has been installed; it
dnl is normally considered a required part of an APR installation.
dnl
dnl If a bundled source directory is available and needs to be (re)configured,
dnl then apr_found is set to "reconfig". The caller should reconfigure the
dnl (passed-in) source directory, placing the result in the build directory,
dnl as appropriate.
dnl
dnl If apr_found is "yes" or "reconfig", then the caller should use the
dnl value of apr_config to fetch any necessary build/link information.
dnl
AC_DEFUN([APR_FIND_APR], [
apr_found="no"
if test "$target_os" = "os2-emx"; then
# Scripts don't pass test -x on OS/2
TEST_X="test -f"
else
TEST_X="test -x"
fi
ifelse([$4], [], [
ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x]))
acceptable_majors="0 1"],
[acceptable_majors="$4"])
apr_temp_acceptable_apr_config=""
for apr_temp_major in $acceptable_majors
do
case $apr_temp_major in
0)
apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config"
;;
*)
apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config"
;;
esac
done
AC_MSG_CHECKING(for APR)
AC_ARG_WITH(apr,
[ --with-apr=PATH prefix for installed APR, path to APR build tree,
or the full path to apr-config],
[
if test "$withval" = "no" || test "$withval" = "yes"; then
AC_MSG_ERROR([--with-apr requires a directory or file to be provided])
fi
for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
do
for lookdir in "$withval/bin" "$withval"
do
if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then
apr_found="yes"
apr_config="$lookdir/$apr_temp_apr_config_file"
break 2
fi
done
done
if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
apr_found="yes"
apr_config="$withval"
fi
dnl if --with-apr is used, it is a fatal error for its argument
dnl to be invalid
if test "$apr_found" != "yes"; then
AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.])
fi
],[
dnl If we allow installed copies, check those before using bundled copy.
if test -n "$3" && test "$3" = "1"; then
for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
do
if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then
apr_found="yes"
apr_config="$apr_temp_apr_config_file"
break
else
dnl look in some standard places
for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do
if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then
apr_found="yes"
apr_config="$lookdir/bin/$apr_temp_apr_config_file"
break 2
fi
done
fi
done
fi
dnl if we have not found anything yet and have bundled source, use that
if test "$apr_found" = "no" && test -d "$1"; then
apr_temp_abs_srcdir="`cd $1 && pwd`"
apr_found="reconfig"
apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`"
case $apr_bundled_major in
"")
AC_MSG_ERROR([failed to find major version of bundled APR])
;;
0)
apr_temp_apr_config_file="apr-config"
;;
*)
apr_temp_apr_config_file="apr-$apr_bundled_major-config"
;;
esac
if test -n "$2"; then
apr_config="$2/$apr_temp_apr_config_file"
else
apr_config="$1/$apr_temp_apr_config_file"
fi
fi
])
AC_MSG_RESULT($apr_found)
])

View File

@@ -0,0 +1,76 @@
#
# fixwin32mak.pl ::: Apache/Win32 maintanace program
#
# This program, launched from the build/ directory, replaces all nasty absoulute paths
# in the win32 .mak files with the appropriate relative root.
#
# Run this program prior to committing or packaging any newly exported make files.
use Cwd;
use IO::File;
use File::Find;
$root = cwd;
# ignore our own direcory (allowing us to move into any parallel tree)
$root =~ s|^.:(.*)?$|cd "$1|;
$root =~ s|/|\\\\|g;
print "Testing " . $root . "\n";
find(\&fixcwd, '.');
sub fixcwd {
if (m|.mak$|) {
$thisroot = $File::Find::dir;
$thisroot =~ s|^./(.*)$|$1|;
$thisroot =~ s|/|\\\\|g;
$thisroot = $root . "\\\\" . $thisroot;
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
#print "Processing " . $thisroot . " of " . $_ . "\n";
$srcfl = new IO::File $_, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
if ($src =~ m|^\s*($root[^\"]*)\".*$|) {
#print "Found " . $1 . "\"\n";
$orig = $thisroot;
$repl = "cd \".";
while (!($src =~ s|$orig|$repl|)) {
#print "Tried replacing " . $orig . " with " . $repl . "\n";
if (!($orig =~ s|^(.*)\\\\[^\\]+$|$1|)) {
break;
}
$repl .= "\\..";
}
#print "Replaced " . $orig . " with " . $repl . "\n";
$verchg = -1;
}
print $dstfl $src;
}
undef $srcfl;
undef $dstfl;
if ($verchg) {
unlink $oname || die;
rename $tname, $oname || die;
print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n";
}
else {
unlink $tname;
}
$dname = $oname;
$dname =~ s/.mak$/.dsp/;
@dstat = stat($dname);
@ostat = stat($oname);
if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
@onames = ($oname);
utime $dstat[9], $dstat[9], @onames;
print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n";
}
$oname =~ s/.mak$/.dep/;
@ostat = stat($oname);
if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
@onames = ($oname);
utime $dstat[9], $dstat[9], @onames;
print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n";
}
}
}

172
libs/apr/build/gen-build.py Executable file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env python
#
# USAGE: gen-build.py TYPE
#
# where TYPE is one of: make, dsp, vcproj
#
# It reads build.conf from the current directory, and produces its output
# into the current directory.
#
import os
import ConfigParser
import getopt
import string
import glob
import re
#import ezt
#
# legal platforms: aix, beos, netware, os2, os390, unix, win32
# 'make' users: aix, beos, os2, os390, unix
#
PLATFORMS = [ 'aix', 'beos', 'netware', 'os2', 'os390', 'unix', 'win32' ]
MAKE_PLATFORMS = [
('unix', None),
('aix', 'unix'),
('beos', 'unix'),
('os2', 'unix'),
('os390', 'unix'),
]
# note: MAKE_PLATFORMS is an ordered set. we want to generate unix symbols
# first, so that the later platforms can reference them.
def main():
parser = ConfigParser.ConfigParser()
parser.read('build.conf')
headers = get_files(parser.get('options', 'headers'))
# compute the relevant headers, along with the implied includes
legal_deps = { }
for fname in headers:
legal_deps[os.path.basename(fname)] = fname
h_deps = { }
for fname in headers:
h_deps[os.path.basename(fname)] = extract_deps(fname, legal_deps)
resolve_deps(h_deps)
f = open('build-outputs.mk', 'w')
f.write('# DO NOT EDIT. AUTOMATICALLY GENERATED.\n\n')
# write out the platform-independent files
files = get_files(parser.get('options', 'paths'))
objects, dirs = write_objects(f, legal_deps, h_deps, files)
f.write('\nOBJECTS_all = %s\n\n' % string.join(objects))
# for each platform and each subdirectory holding platform-specific files,
# write out their compilation rules, and an OBJECT_<subdir>_<plat> symbol.
for platform, parent in MAKE_PLATFORMS:
# record the object symbols to build for each platform
group = [ '$(OBJECTS_all)' ]
for subdir in string.split(parser.get('options', 'platform_dirs')):
path = '%s/%s' % (subdir, platform)
if not os.path.exists(path):
# this subdir doesn't have a subdir for this platform, so we'll
# use the parent-platform's set of symbols
if parent:
group.append('$(OBJECTS_%s_%s)' % (subdir, parent))
continue
# remember that this directory has files/objects
dirs[path] = None
# write out the compilation lines for this subdir
files = get_files(path + '/*.c')
objects, _unused = write_objects(f, legal_deps, h_deps, files)
symname = 'OBJECTS_%s_%s' % (subdir, platform)
# and write the symbol for the whole group
f.write('\n%s = %s\n\n' % (symname, string.join(objects)))
# and include that symbol in the group
group.append('$(%s)' % symname)
# write out a symbol which contains the necessary files
f.write('OBJECTS_%s = %s\n\n' % (platform, string.join(group)))
f.write('HEADERS = $(top_srcdir)/%s\n\n' % string.join(headers, ' $(top_srcdir)/'))
f.write('SOURCE_DIRS = %s $(EXTRA_SOURCE_DIRS)\n\n' % string.join(dirs.keys()))
# Build a list of all necessary directories in build tree
alldirs = { }
for dir in dirs.keys():
d = dir
while d:
alldirs[d] = None
d = os.path.dirname(d)
# Sort so 'foo' is before 'foo/bar'
keys = alldirs.keys()
keys.sort()
f.write('BUILD_DIRS = %s\n\n' % string.join(keys))
f.write('.make.dirs: $(srcdir)/build-outputs.mk\n' \
'\t@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done\n' \
'\t@echo timestamp > $@\n')
def write_objects(f, legal_deps, h_deps, files):
dirs = { }
objects = [ ]
for file in files:
assert file[-2:] == '.c'
obj = file[:-2] + '.lo'
objects.append(obj)
dirs[os.path.dirname(file)] = None
# what headers does this file include, along with the implied headers
deps = extract_deps(file, legal_deps)
for hdr in deps.keys():
deps.update(h_deps.get(hdr, {}))
f.write('%s: %s .make.dirs %s\n' % (obj, file, string.join(deps.values())))
return objects, dirs
def extract_deps(fname, legal_deps):
"Extract the headers this file includes."
deps = { }
for line in open(fname).readlines():
if line[:8] != '#include':
continue
inc = _re_include.match(line).group(1)
if inc in legal_deps.keys():
deps[inc] = legal_deps[inc]
return deps
_re_include = re.compile('#include *["<](.*)[">]')
def resolve_deps(header_deps):
"Alter the provided dictionary to flatten includes-of-includes."
altered = 1
while altered:
altered = 0
for hdr, deps in header_deps.items():
# print hdr, deps
start = len(deps)
for dep in deps.keys():
deps.update(header_deps.get(dep, {}))
if len(deps) != start:
altered = 1
def get_files(patterns):
files = [ ]
for pat in string.split(patterns):
files.extend(glob.glob(pat))
return files
if __name__ == '__main__':
main()

37
libs/apr/build/get-version.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
#
# extract version numbers from a header file
#
# USAGE: get-version.sh CMD VERSION_HEADER PREFIX
# where CMD is one of: all, major, libtool
# where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines
#
# get-version.sh all returns a dotted version number
# get-version.sh major returns just the major version number
# get-version.sh libtool returns a version "libtool -version-info" format
#
if test $# != 3; then
echo "USAGE: $0 CMD VERSION_HEADER PREFIX"
echo " where CMD is one of: all, major, libtool"
exit 1
fi
major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
major="`sed -n $major_sed $2`"
minor="`sed -n $minor_sed $2`"
patch="`sed -n $patch_sed $2`"
if test "$1" = "all"; then
echo ${major}.${minor}.${patch}
elif test "$1" = "major"; then
echo ${major}
elif test "$1" = "libtool"; then
# Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy.
echo ${minor}:${patch}:${minor}
else
echo "ERROR: unknown version CMD ($1)"
exit 1
fi

112
libs/apr/build/install.sh Executable file
View File

@@ -0,0 +1,112 @@
#!/bin/sh
##
## install.sh -- install a program, script or datafile
##
## Based on `install-sh' from the X Consortium's X11R5 distribution
## as of 89/12/18 which is freely available.
## Cleaned up for Apache's Autoconf-style Interface (APACI)
## by Ralf S. Engelschall <rse@apache.org>
##
#
# This script falls under the Apache License.
# See http://www.apache.org/docs/LICENSE
#
# put in absolute paths if you don't have them in your path;
# or use env. vars.
#
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
#
# parse argument line
#
instcmd="$mvprog"
chmodcmd=""
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
ext=""
src=""
dst=""
while [ "x$1" != "x" ]; do
case $1 in
-c) instcmd="$cpprog"
shift; continue
;;
-m) chmodcmd="$chmodprog $2"
shift; shift; continue
;;
-o) chowncmd="$chownprog $2"
shift; shift; continue
;;
-g) chgrpcmd="$chgrpprog $2"
shift; shift; continue
;;
-s) stripcmd="$stripprog"
shift; continue
;;
-S) stripcmd="$stripprog $2"
shift; shift; continue
;;
-e) ext="$2"
shift; shift; continue
;;
*) if [ "x$src" = "x" ]; then
src=$1
else
dst=$1
fi
shift; continue
;;
esac
done
if [ "x$src" = "x" ]; then
echo "install.sh: no input file specified"
exit 1
fi
if [ "x$dst" = "x" ]; then
echo "install.sh: no destination specified"
exit 1
fi
#
# If destination is a directory, append the input filename; if
# your system does not like double slashes in filenames, you may
# need to add some logic
#
if [ -d $dst ]; then
dst="$dst/`basename $src`"
fi
# Add a possible extension (such as ".exe") to src and dst
src="$src$ext"
dst="$dst$ext"
# Make a temp file name in the proper directory.
dstdir=`dirname $dst`
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$instcmd $src $dsttmp
# And set any options; do chmod last to preserve setuid bits
if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
# Now rename the file to the real destination.
$rmcmd $dst
$mvcmd $dsttmp $dst
exit 0

1857
libs/apr/build/jlibtool.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
# Microsoft Developer Studio Project File - Name="libapr_app" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libapr_app - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libapr_app.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libapr_app.mak" CFG="libapr_app - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libapr_app - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libapr_app - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libapr_app - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "../include" /I "../include/arch" /I "../include/arch/win32" /I "../include/arch/unix" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_APP" /Fd"Release\libapr_app_src" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Release\libapr_app-1.lib"
!ELSEIF "$(CFG)" == "libapr_app - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../include" /I "../include/arch" /I "../include/arch/win32" /I "../include/arch/unix" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "APR_APP" /Fd"Debug\libapr_app_src" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Debug\libapr_app-1.lib"
!ENDIF
# Begin Target
# Name "libapr_app - Win32 Release"
# Name "libapr_app - Win32 Debug"
# Begin Source File
SOURCE=..\misc\win32\apr_app.c
# End Source File
# Begin Source File
SOURCE=..\misc\win32\internal.c
# End Source File
# End Target
# End Project

6184
libs/apr/build/libtool.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

149
libs/apr/build/lineends.pl Normal file
View File

@@ -0,0 +1,149 @@
#!/usr/local/bin/perl
#
# Heuristically converts line endings to the current OS's preferred format
#
# All existing line endings must be identical (e.g. lf's only, or even
# the accedental cr.cr.lf sequence.) If some lines end lf, and others as
# cr.lf, the file is presumed binary. If the cr character appears anywhere
# except prefixed to an lf, the file is presumed binary. If there is no
# change in the resulting file size, or the file is binary, the conversion
# is discarded.
#
# Todo: Handle NULL stdin characters gracefully.
#
use IO::File;
use File::Find;
# The ignore list is '-' seperated, with this leading hyphen and
# trailing hyphens in ever concatinated list below.
$ignore = "-";
# Image formats
$ignore .= "gif-jpg-jpeg-png-ico-bmp-";
# Archive formats
$ignore .= "tar-gz-z-zip-jar-war-bz2-tgz-";
# Many document formats
$ignore .= "eps-psd-pdf-ai-";
# Some encodings
$ignore .= "ucs2-ucs4-";
# Some binary objects
$ignore .= "class-so-dll-exe-obj-a-o-lo-slo-sl-dylib-";
# Some build env files
$ignore .= "mcp-xdc-ncb-opt-pdb-ilk-sbr-";
$preservedate = 1;
$forceending = 0;
$givenpaths = 0;
$notnative = 0;
while (defined @ARGV[0]) {
if (@ARGV[0] eq '--touch') {
$preservedate = 0;
}
elsif (@ARGV[0] eq '--nocr') {
$notnative = -1;
}
elsif (@ARGV[0] eq '--cr') {
$notnative = 1;
}
elsif (@ARGV[0] eq '--force') {
$forceending = 1;
}
elsif (@ARGV[0] eq '--FORCE') {
$forceending = 2;
}
elsif (@ARGV[0] =~ m/^-/) {
die "What is " . @ARGV[0] . " supposed to mean?\n\n"
. "Syntax:\t$0 [option()s] [path(s)]\n\n" . <<'OUTCH'
Where: paths specifies the top level directory to convert (default of '.')
options are;
--cr keep/add one ^M
--nocr remove ^M's
--touch the datestamp (default: keeps date/attribs)
--force mismatched corrections (unbalanced ^M's)
--FORCE all files regardless of file name!
OUTCH
}
else {
find(\&totxt, @ARGV[0]);
print "scanned " . @ARGV[0] . "\n";
$givenpaths = 1;
}
shift @ARGV;
}
if (!$givenpaths) {
find(\&totxt, '.');
print "did .\n";
}
sub totxt {
$oname = $_;
$tname = '.#' . $_;
if (!-f) {
return;
}
@exts = split /\./;
if ($forceending < 2) {
while ($#exts && ($ext = pop(@exts))) {
if ($ignore =~ m|-$ext-|i) {
return;
}
}
}
@ostat = stat($oname);
$srcfl = new IO::File $oname, "r" or die;
$dstfl = new IO::File $tname, "w" or die;
binmode $srcfl;
if ($notnative) {
binmode $dstfl;
}
undef $t;
while (<$srcfl>) {
if (s/(\r*)\n$/\n/) {
$n = length $1;
if (!defined $t) {
$t = $n;
}
if (!$forceending && (($n != $t) || m/\r/)) {
print "mismatch in " .$oname. ":" .$n. " expected " .$t. "\n";
undef $t;
last;
}
elsif ($notnative > 0) {
s/\n$/\r\n/;
}
}
print $dstfl $_;
}
if (defined $t && (tell $srcfl == tell $dstfl)) {
undef $t;
}
undef $srcfl;
undef $dstfl;
if (defined $t) {
unlink $oname or die;
rename $tname, $oname or die;
@anames = ($oname);
if ($preservedate) {
utime $ostat[9], $ostat[9], @anames;
}
chmod $ostat[2] & 07777, @anames;
chown $ostat[5], $ostat[6], @anames;
print "Converted file " . $oname . " to text in " . $File::Find::dir . "\n";
}
else {
unlink $tname or die;
}
}

6530
libs/apr/build/ltmain.sh Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,150 @@
BEGIN {
printf("/*\n")
printf(" * THIS FILE WAS AUTOGENERATED BY make_exports.awk\n")
printf(" *\n")
printf(" * This is an ugly hack that needs to be here, so\n")
printf(" * that libtool will link all of the APR functions\n")
printf(" * into server regardless of whether the base server\n")
printf(" * uses them.\n")
printf(" */\n")
printf("\n")
printf("#define CORE_PRIVATE\n")
printf("\n")
for (i = 1; i < ARGC; i++) {
file = ARGV[i]
sub("([^/]*[/])*", "", file)
printf("#include \"%s\"\n", file)
}
printf("\n")
printf("const void *ap_ugly_hack = NULL;\n")
printf("\n")
TYPE_NORMAL = 0
TYPE_HEADER = 1
stackptr = 0
}
function push(line) {
stack[stackptr] = line
stackptr++
}
function do_output() {
printf("/*\n")
printf(" * %s\n", FILENAME)
printf(" */\n")
for (i = 0; i < stackptr; i++) {
printf("%s\n", stack[i])
}
stackptr = 0
printf("\n");
}
function enter_scope(type) {
scope++
scope_type[scope] = type
scope_stack[scope] = stackptr
delete scope_used[scope]
}
function leave_scope() {
used = scope_used[scope]
if (!used)
stackptr = scope_stack[scope]
scope--
if (used) {
scope_used[scope] = 1
if (!scope)
do_output()
}
}
function add_symbol(symbol) {
if (!index(symbol, "#")) {
push("const void *ap_hack_" symbol " = (const void *)" symbol ";")
scope_used[scope] = 1
}
}
/^[ \t]*AP[RUI]?_(CORE_)?DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
sub("[ \t]*AP[RUI]?_(CORE_)?DECLARE[^(]*[(][^)]*[)][ \t]*", "")
sub("[(].*", "")
sub("([^ ]* (^([ \t]*[(])))+", "")
add_symbol($0)
next
}
/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*/ {
split($0, args, ",")
symbol = args[2]
sub("^[ \t]+", "", symbol)
sub("[ \t]+$", "", symbol)
add_symbol("ap_hook_" symbol)
add_symbol("ap_hook_get_" symbol)
add_symbol("ap_run_" symbol)
next
}
/^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ {
sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0)
sub("[)].*$", "", $0)
add_symbol("apr_" $0 "_pool_get")
next
}
/^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ {
sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0)
sub("[)].*$", "", $0)
add_symbol("apr_" $0 "_inherit_set")
next
}
/^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ {
sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0)
sub("[)].*$", "", $0)
add_symbol("apr_" $0 "_inherit_unset")
next
}
/^#[ \t]*if(ndef| !defined[(])([^_]*_)*H/ {
enter_scope(TYPE_HEADER)
next
}
/^#[ \t]*if([n]?def)? / {
enter_scope(TYPE_NORMAL)
push($0)
next
}
/^#[ \t]*endif/ {
if (scope_type[scope] == TYPE_NORMAL)
push($0)
leave_scope()
next
}
/^#[ \t]*else/ {
push($0)
next
}
/^#[ \t]*elif/ {
push($0)
next
}

View File

@@ -0,0 +1,78 @@
# Based on apr's make_export.awk, which is
# based on Ryan Bloom's make_export.pl
BEGIN {
printf(" (APRLIB)\n")
}
# List of functions that we don't support, yet??
#/apr_##name##_set_inherit/{next}
#/apr_##name##_unset_inherit/{next}
function add_symbol (sym_name) {
if (count) {
found++
}
gsub (/ /, "", sym_name)
line = line sym_name ",\n"
if (count == 0) {
printf(" %s", line)
line = ""
}
}
/^[ \t]*AP[RUI]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
sub("[ \t]*AP[RUI]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
sub("[(].*", "")
sub("([^ ]* (^([ \t]*[(])))+", "")
add_symbol($0)
next
}
/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*/ {
split($0, args, ",")
symbol = args[2]
sub("^[ \t]+", "", symbol)
sub("[ \t]+$", "", symbol)
add_symbol("ap_hook_" symbol)
add_symbol("ap_hook_get_" symbol)
add_symbol("ap_run_" symbol)
next
}
/^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ {
sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0)
sub("[)].*$", "", $0)
add_symbol("apr_" $0 "_pool_get")
next
}
/^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ {
sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0)
sub("[)].*$", "", $0)
add_symbol("apr_" $0 "_inherit_set")
next
}
/^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ {
sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0)
sub("[)].*$", "", $0)
add_symbol("apr_" $0 "_inherit_unset")
next
}
/^[ \t]*AP[RUI]?_DECLARE_DATA .*;$/ {
varname = $NF;
gsub( /[*;]/, "", varname);
gsub( /\[.*\]/, "", varname);
add_symbol(varname);
}
#END {
# printf(" %s", line)
#}

View File

@@ -0,0 +1,59 @@
# Based on apr's make_export.awk, which is
# based on Ryan Bloom's make_export.pl
/^#[ \t]*if(def)? (AP[RUI]?_|!?defined).*/ {
if (old_filename != FILENAME) {
if (old_filename != "") printf("%s", line)
macro_no = 0
found = 0
count = 0
old_filename = FILENAME
line = ""
}
macro_stack[macro_no++] = macro
macro = substr($0, length($1)+2)
count++
line = line "#ifdef " macro "\n"
next
}
/^#[ \t]*endif/ {
if (count > 0) {
count--
line = line "#endif /* " macro " */\n"
macro = macro_stack[--macro_no]
}
if (count == 0) {
if (found != 0) {
printf("%s", line)
}
line = ""
}
next
}
function add_symbol (sym_name) {
if (count) {
found++
}
for (i = 0; i < count; i++) {
line = line "\t"
}
line = line sym_name "\n"
if (count == 0) {
printf("%s", line)
line = ""
}
}
/^[ \t]*(extern[ \t]+)?AP[RUI]?_DECLARE_DATA .*;$/ {
varname = $NF;
gsub( /[*;]/, "", varname);
gsub( /\[.*\]/, "", varname);
add_symbol(varname);
}
END {
printf("%s", line)
}

37
libs/apr/build/mkdir.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
##
## mkdir.sh -- make directory hierarchy
##
## Based on `mkinstalldirs' from Noah Friedman <friedman@prep.ai.mit.edu>
## as of 1994-03-25, which was placed in the Public Domain.
## Cleaned up for Apache's Autoconf-style Interface (APACI)
## by Ralf S. Engelschall <rse@apache.org>
##
#
# This script falls under the Apache License.
# See http://www.apache.org/docs/LICENSE
umask 022
errstatus=0
for file in ${1+"$@"} ; do
set fnord `echo ":$file" |\
sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'`
shift
pathcomp=
for d in ${1+"$@"}; do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
?: ) pathcomp="$pathcomp/"
continue ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp" 1>&2
mkdir "$pathcomp" || errstatus=$?
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus

View File

@@ -0,0 +1,85 @@
/* Must include apr.h first so that we can undefine
the standard prototypes macros after it messes with
them. */
#include "apr.h"
#undef APR_DECLARE
#undef APR_DECLARE_NONSTD
#undef APR_DECLARE_HOOK
#undef APR_POOL_DECLARE_ACCESSOR
#undef APR_DECLARE_DATA
/* Preprocess all of the standard APR headers. */
#include "apr_allocator.h"
#include "apr_atomic.h"
#include "apr_dso.h"
#include "apr_env.h"
#include "apr_errno.h"
#include "apr_file_info.h"
#include "apr_file_io.h"
#include "apr_fnmatch.h"
#include "apr_general.h"
#include "apr_getopt.h"
#include "apr_global_mutex.h"
#include "apr_hash.h"
#include "apr_inherit.h"
#include "apr_lib.h"
#include "apr_mmap.h"
#include "apr_network_io.h"
#include "apr_poll.h"
#include "apr_pools.h"
#include "apr_portable.h"
#include "apr_proc_mutex.h"
#include "apr_ring.h"
#include "apr_random.h"
#include "apr_shm.h"
#include "apr_signal.h"
#include "apr_strings.h"
#include "apr_support.h"
#include "apr_tables.h"
#include "apr_thread_cond.h"
#include "apr_thread_mutex.h"
#include "apr_thread_proc.h"
#include "apr_thread_rwlock.h"
#include "apr_time.h"
#include "apr_user.h"
#include "apr_version.h"
#include "apr_want.h"
/* Must include apu.h first so that we can undefine
the standard prototypes macros after it messes with
them. */
#include "apu.h"
#undef APU_DECLARE
#undef APU_DECLARE_NONSTD
#undef APU_DECLARE_DATA
/* Preprocess all of the standard APR headers. */
#include "apr_anylock.h"
#include "apr_base64.h"
#include "apr_buckets.h"
#include "apr_date.h"
#include "apr_dbd.h"
#include "apr_dbm.h"
#include "apr_hooks.h"
#include "apr_ldap.h"
#include "apr_ldap_url.h"
#include "apr_md4.h"
#include "apr_md5.h"
#include "apr_optional.h"
#include "apr_optional_hooks.h"
#include "apr_queue.h"
#include "apr_reslist.h"
#include "apr_rmm.h"
#include "apr_sdbm.h"
#include "apr_sha1.h"
#include "apr_strmatch.h"
#include "apr_uri.h"
#include "apr_uuid.h"
#include "apr_xlate.h"
#include "apr_xml.h"
#include "apu_version.h"
#include "apu_want.h"

25
libs/apr/build/nw_ver.awk Normal file
View File

@@ -0,0 +1,25 @@
BEGIN {
# fetch APR version numbers from input file and writes them to STDOUT
while ((getline < ARGV[1]) > 0) {
if (match ($0, /^#define APR_MAJOR_VERSION/)) {
ver_major = $3;
}
else if (match ($0, /^#define APR_MINOR_VERSION/)) {
ver_minor = $3;
}
else if (match ($0, /^#define APR_PATCH_VERSION/)) {
ver_str_patch = $3;
if (match (ver_str_patch, /[0-9][0-9]*/)) {
ver_patch = substr(ver_str_patch, RSTART, RLENGTH);
}
}
}
ver = ver_major "," ver_minor "," ver_patch;
ver_str = ver_major "." ver_minor "." ver_str_patch;
print "VERSION = " ver "";
print "VERSION_STR = " ver_str "";
}

20
libs/apr/build/pkg/README Normal file
View File

@@ -0,0 +1,20 @@
The script in this directory will attempt to build a Solaris package
out of a source tree for APR.
To build a package, make sure you are in the root of the source tree,
and run:
build/pkg/buildpkg.sh
A Solaris package called apr-<version>-<architecture>-local.gz will be
created in the root of the source tree.
By default, if you attempt to build packages for apr-util, it will
search for the sources for apr in:
../apr
You may override the location of apr like so:
build/pkg/buildpkg.sh --with-apr=some/other/path

72
libs/apr/build/pkg/buildpkg.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# buildpkg.sh: This script builds a Solaris PKG from the source tree
# provided.
PREFIX=/usr/local
TEMPDIR=/var/tmp/$USER/apr-root
rm -rf $TEMPDIR
apr_src_dir=.
while test $# -gt 0
do
# Normalize
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--with-apr=*)
apr_src_dir=$optarg
;;
esac
shift
done
if [ -f "$apr_src_dir/configure.in" ]; then
cd $apr_src_dir
else
echo "The apr source could not be found within $apr_src_dir"
echo "Usage: buildpkg [--with-apr=dir]"
exit 1
fi
./configure --prefix=$PREFIX
make
make install DESTDIR=$TEMPDIR
rm $TEMPDIR$PREFIX/lib/apr.exp
. build/pkg/pkginfo
cp build/pkg/pkginfo $TEMPDIR$PREFIX
current=`pwd`
cd $TEMPDIR$PREFIX
echo "i pkginfo=./pkginfo" > prototype
find . -print | grep -v ./prototype | grep -v ./pkginfo | pkgproto | awk '{print $1" "$2" "$3" "$4" root bin"}' >> prototype
mkdir $TEMPDIR/pkg
pkgmk -r $TEMPDIR$PREFIX -d $TEMPDIR/pkg
cd $current
pkgtrans -s $TEMPDIR/pkg $current/$NAME-$VERSION-$ARCH-local
gzip $current/$NAME-$VERSION-$ARCH-local
rm -rf $TEMPDIR

View File

@@ -0,0 +1,11 @@
PKG="ASFapr-1"
NAME="apr"
ARCH="@target_cpu@"
VERSION="@APR_DOTTED_VERSION@"
CATEGORY="application"
VENDOR="Apache Software Foundation"
EMAIL="dev@apr.apache.org"
PSTAMP="dev@apr.apache.org"
BASEDIR="@prefix@"
CLASSES="none"

48
libs/apr/build/prebuildNW.bat Executable file
View File

@@ -0,0 +1,48 @@
@echo off
if not "%NovellLibC%" == "" goto CheckNDK
set NovellLibC=\novell\ndk\libc
@echo Could not find the NovellLibC environment variable
@echo Setting NovellLibC = %NovellLibC%
@echo ---------------------
:CheckNDK
if exist %NovellLibC%\include\netware.h goto NDKOK
@echo The path to the NDK "%NovellLibC%" is invalid.
@echo Please set then NovellLibC environment variable to the location of the NDK
@echo ---------------------
goto Done
:NDKOK
@echo # As part of the pre-build process, the utility GenURI.NLM
@echo # (Gen URI Delims) must be built, copied to a NetWare server
@echo # and run using the following command:
@echo #
@echo # "sys:\genuri >sys:\uri_delims.h"
@echo #
@echo # The file "sys:\uri_delims.h" must then be copied to
@echo # "apr-util\uri\uri_delims.h" on the build machine.
@echo Fixing up the APR headers
copy ..\include\apr.hnw ..\include\apr.h
@echo Fixing up the APR-Util headers
copy ..\..\apr-util\include\apu.hnw ..\..\apr-util\include\apu.h
copy ..\..\apr-util\include\apu_want.hnw ..\..\apr-util\include\apu_want.h
copy ..\..\apr-util\include\apr_ldap.hnw ..\..\apr-util\include\apr_ldap.h
copy ..\..\apr-util\include\private\apu_config.hw ..\..\apr-util\include\private\apu_config.h
copy ..\..\apr-util\xml\expat\lib\expat.h.in ..\..\apr-util\xml\expat\lib\expat.h
copy ..\..\apr-util\xml\expat\lib\config.hnw ..\..\apr-util\xml\expat\lib\config.h
copy ..\..\apr-util\include\private\apu_select_dbm.hw ..\..\apr-util\include\private\apu_select_dbm.h
@echo Fixing up the pcre headers
copy ..\..\pcre\config.hw ..\..\pcre\config.h
copy ..\..\pcre\pcre.hw ..\..\pcre\pcre.h
@echo Generating the import list...
set MWCIncludes=..\include;..\include\arch\netware;..\include\arch\unix;..\..\apr-util\include;+%NovellLibC%
mwccnlm -P nw_export.inc -d NETWARE -EP
awk -f make_nw_export.awk nw_export.i |sort >..\aprlib.imp
:Done
pause

View File

@@ -0,0 +1,96 @@
%define aprver 1
Summary: Apache Portable Runtime library
Name: apr
Version: APR_VERSION
Release: APR_RELEASE
License: Apache Software License
Group: System Environment/Libraries
URL: http://apr.apache.org/
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildPrereq: autoconf, libtool, doxygen
%description
The mission of the Apache Portable Runtime (APR) is to provide a
free library of C data structures and routines, forming a system
portability layer to as many operating systems as possible,
including Unices, MS Win32, BeOS and OS/2.
%package devel
Group: Development/Libraries
Summary: APR library development kit
Requires: apr = %{version}
%description devel
This package provides the support files which can be used to
build applications using the APR library. The mission of the
Apache Portable Runtime (APR) is to provide a free library of
C data structures and routines.
%prep
%setup -q
%build
# regenerate configure script etc.
./buildconf
%configure \
--prefix=/usr \
--includedir=%{_includedir}/apr-%{aprver} \
--with-installbuilddir=%{_libdir}/apr/build-%{aprver} \
--with-devrandom=/dev/urandom \
CC=gcc CXX=g++
make %{?_smp_mflags} && make dox
%check
# Run non-interactive tests
pushd test
make %{?_smp_mflags} testall CFLAGS=-fno-strict-aliasing
./testall -v || exit 1
popd
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
# Move docs to more convenient location
mv docs/dox/html html
# Unpackaged files:
rm -f $RPM_BUILD_ROOT%{_libdir}/apr.exp
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc CHANGES LICENSE NOTICE
%{_libdir}/libapr-%{aprver}.so.*
%files devel
%defattr(-,root,root,-)
%doc docs/APRDesign.html docs/canonical_filenames.html
%doc docs/incomplete_types docs/non_apr_programs
%doc --parents html
%{_bindir}/apr*config
%{_libdir}/libapr-%{aprver}.*a
%{_libdir}/libapr-%{aprver}.so
%dir %{_libdir}/apr
%dir %{_libdir}/apr/build-%{aprver}
%{_libdir}/apr/build-%{aprver}/*
%{_libdir}/pkgconfig/apr-%{aprver}.pc
%dir %{_includedir}/apr-%{aprver}
%{_includedir}/apr-%{aprver}/*.h
%changelog
* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
- update to support v1.0.0 of APR
* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
- derived from Fedora Core apr.spec

130
libs/apr/build/run-gcov.sh Executable file
View File

@@ -0,0 +1,130 @@
#!/bin/sh
if [ ! -d coverage ]; then
mkdir coverage
fi
cd coverage
# It would be really nice to find a better way to do this than copying the
# HTML into this script. But, I am being lazy right now.
cat > index.html << EOF
<!-- This is a generated file, do not edit -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="author" content="APR Developers" /><meta name="email" content="dev@apr.apache.org" />
<title>Test Coverage</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76">
<p><a href="/"><img src="./images/apr_logo_wide.png" alt="The Apache Portable Runtime Project" border="0"/></a></p>
<table border="0" width="100%" cellspacing="4">
<tr>
<!-- LEFT SIDE NAVIGATION -->
<td valign="top" nowrap="nowrap">
<a href="http://apachecon.com/"
><img src="http://www.apache.org/images/ac2003-150.gif" height="86"
width="150" border="0" alt="ApacheCon" /></a>
<p><b>Get Involved</b></p>
<menu compact="compact">
<li><a href="/anoncvs.txt">CVS</a></li>
<li><a href="/mailing-lists.html">Mailing Lists</a></li>
<li><a href="http://cvs.apache.org/snapshots/apr/">Snapshots</a></li>
<li><a href="/compiling_win32.html">Build on Win32</a></li>
<li><a href="/compiling_unix.html">Build on Unix</a></li>
</menu>
<p><b>Download!</b></p>
<menu compact="compact">
<li><a href="http://www.apache.org/dyn/closer.cgi/apr/">from a mirror</a></li>
</menu>
<p><b>Docs</b></p>
<menu compact="compact">
<li><a href="/docs/apr/">APR</a></li>
<li><a href="/docs/apr-util/">APR-util</a></li>
<li>APR-iconv</li>
</menu>
<p><b>Guidelines</b></p>
<menu compact="compact">
<li><a href="/guidelines.html">Project Guidelines</a></li>
<li><a href="/patches.html">Contributing</a></li>
<li><a href="/versioning.html">Version Numbers</a></li>
</menu>
<p><b><a href="/info/">Miscellaneous</a></b></p>
<menu compact="compact">
<li><a href="http://www.apache.org/LICENSE.txt">License</a></li>
<li><a href="/projects.html">Projects using APR</a></li>
</menu>
</td>
<!-- RIGHT SIDE INFORMATION -->
<td align="left" valign="top">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>APR Test Coverage</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>This should give us some idea of how well our tests actually stress our
code. To generate this data, do the following:</p>
<menu compact="compact">
<li>./buildconf</li>
<li>CFLAGS="-fprofile-arcs -ftest-coverage ./configure</li>
<li>make</li>
<li>cd test</li>
<li>make</li>
<li>./testall</li>
<li>cd ..</li>
<li>make gcov</li>
</menu>
<p>Note that this will only generate test coverage data for the testall script,
but all tests should be moving to the unified framework, so this is correct.</p>
</blockquote>
<table border="0" width="100%" cellspacing="0">
EOF
for i in `find .. -name "*.bb" -maxdepth 1 | sort`; do
percent=`gcov $i -o .. | grep "%" | awk -F'%' {'print $1'}`
name=`echo $i | awk -F'/' {'print $2'}`
basename=`echo $name | awk -F'.' {'print $1'}`
if [ "x$percent" = "x" ]; then
echo "<tr>" >> index.html
echo "<td bgcolor=#ffffff> Error generating data for $basename<br>" >> index.html
continue;
fi
intpercent=`echo "$percent/1" | bc`
if [ $intpercent -lt 33 ]; then
color="#ffaaaa"
else if [ $intpercent -lt 66 ]; then
color="#ffff77"
else
color="#aaffaa"
fi
fi
echo "<tr>" >> index.html
echo "<td bgcolor=$color><a href=\"$basename.c.gcov\">$basename</a><br>" >> index.html
echo "<td bgcolor=$color>$percent% tested" >> index.html
done
echo "</table><p>Last generated `date`</p>" >> index.html
cat >> index.html << EOF
</td></tr>
</table>
<!-- FOOTER -->
<tr><td colspan="2"><hr noshade="noshade" size="1"/></td></tr>
<tr><td colspan="2" align="center">
<font size="-1">
<em>Copyright &#169; 1999-2004, The Apache Software Foundation</em>
</font>
</td>
</tr>
</table>
</body>
</html>
EOF

121
libs/apr/build/win32ver.awk Normal file
View File

@@ -0,0 +1,121 @@
BEGIN {
# ff bits: 1(debug), 2(prerelease), 4(patched), 8(vendor) and 32(special)
# debug is summed based on the /Define _DEBUG
# prerelease is based on the -dev extension,
# patched is based on a non-standard "-ver" extension,
# special and vendor are toggled by their args.
#
ff = 0;
file=ARGV[1];
desc=ARGV[2];
rel_h=ARGV[3];
filename = file;
if (match(file, /\./)) {
sub(/\.[^\.]*$/, "", file);
}
i = 4;
while (length(ARGV[i])) {
if (match(ARGV[i], /icon=/)) {
icon = substr(ARGV[i], 6);
}
if (match(ARGV[i], /vendor=/)) {
vendor = substr(ARGV[i], 8);
ff = ff + 8;
}
if (match(ARGV[i], /special=/)) {
special = substr(ARGV[i], 9);
ff = ff + 32;
}
i = i + 1
}
i = i - 1;
while (i) {
delete ARGV[i];
i = i - 1;
}
while ((getline < rel_h) > 0) {
if (match ($0, /^#define AP._MAJOR_VERSION/)) {
ver_major = $3;
}
if (match ($0, /^#define AP._MINOR_VERSION/)) {
ver_minor = $3;
}
if (match ($0, /^#define AP._PATCH_VERSION/)) {
ver_patch = $3;
}
if (match ($0, /^#define AP._IS_DEV_VERSION/)) {
ver_suffix = "-dev";
ver_build = "0";
}
if (match ($0, /^#undef AP._IS_DEV_VERSION/)) {
ver_build = "100";
}
if (match ($0, /^.*Copyright /)) {
copyright = substr($0, RLENGTH + 1);
}
}
ver = ver_major "." ver_minor "." ver_patch ver_suffix;
verc = ver_major "," ver_minor "," ver_patch "," ver_build;
if (length(vendor)) {
ff = ff + 8;
}
if (length(icon)) {
print "1 ICON DISCARDABLE \"" icon "\"";
}
print "1 VERSIONINFO";
print " FILEVERSION " verc "";
print " PRODUCTVERSION " verc "";
print " FILEFLAGSMASK 0x3fL";
print "#if defined(_DEBUG)"
print " FILEFLAGS 0x" sprintf("%02x", ff + 1) "L";
print "#else"
print " FILEFLAGS 0x" sprintf("%02x", ff) "L";
print "#endif"
print " FILEOS 0x40004L";
print " FILETYPE 0x1L";
print " FILESUBTYPE 0x0L";
print "BEGIN";
print " BLOCK \"StringFileInfo\"";
print " BEGIN";
print " BLOCK \"040904b0\"";
print " BEGIN";
print " VALUE \"Comments\", "\
"\"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\\r\\n\\r\\n"\
"http://www.apache.org/licenses/LICENSE-2.0\\r\\n\\r\\n"\
"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.\\0\"";
print " VALUE \"CompanyName\", \"Apache Software Foundation\\0\"";
print " VALUE \"FileDescription\", \"" desc "\\0\"";
print " VALUE \"FileVersion\", \"" ver "\\0\"";
print " VALUE \"InternalName\", \"" file "\\0\"";
print " VALUE \"LegalCopyright\", \"Copyright " copyright "\\0\"";
print " VALUE \"OriginalFilename\", \"" filename "\\0\"";
if (vendor) {
print " VALUE \"PrivateBuild\", \"" vendor "\\0\"";
}
if (special) {
print " VALUE \"SpecialBuild\", \"" vendor "\\0\"";
}
print " VALUE \"ProductName\", \"Apache Portable Runtime\\0\"";
print " VALUE \"ProductVersion\", \"" ver "\\0\"";
print " END";
print " END";
print " BLOCK \"VarFileInfo\"";
print " BEGIN";
print " VALUE \"Translation\", 0x409, 1200";
print " END";
print "END";
}

109
libs/apr/buildconf Executable file
View File

@@ -0,0 +1,109 @@
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# buildconf: Build the support scripts needed to compile from a
# checked-out version of the source code.
# Verify that the builder has the right config tools installed
#
build/buildcheck.sh || exit 1
libtoolize=`build/PrintPath glibtoolize libtoolize15 libtoolize14 libtoolize`
if [ "x$libtoolize" = "x" ]; then
echo "libtoolize not found in path"
exit 1
fi
# Create the libtool helper files
#
# Note: we copy (rather than link) them to simplify distribution.
# Note: APR supplies its own config.guess and config.sub -- we do not
# rely on libtool's versions
#
echo "Copying libtool helper files ..."
# Remove any libtool files so one can switch between libtool 1.3
# and libtool 1.4 by simply rerunning the buildconf script.
(cd build ; rm -f ltconfig ltmain.sh libtool.m4)
$libtoolize --copy --automake
if [ -f libtool.m4 ]; then
ltfile=`pwd`/libtool.m4
else
ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
< $libtoolize`"
ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
# Expecting the code above to be very portable, but just in case...
if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
ltpath=`dirname $libtoolize`
ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
fi
fi
if [ ! -f $ltfile ]; then
echo "$ltfile not found"
exit 1
fi
echo "buildconf: Using libtool.m4 at ${ltfile}."
cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build/libtool.m4
# libtool.m4 from 1.6 requires ltsugar.m4
if [ -f ltsugar.m4 ]; then
rm -f build/ltsugar.m4
mv ltsugar.m4 build/ltsugar.m4
fi
# Clean up any leftovers
rm -f aclocal.m4 libtool.m4
#
# Generate the autoconf header and ./configure
#
echo "Creating include/arch/unix/apr_private.h.in ..."
${AUTOHEADER:-autoheader}
echo "Creating configure ..."
### do some work to toss config.cache?
${AUTOCONF:-autoconf}
# Remove autoconf 2.5x's cache directory
rm -rf autom4te*.cache
echo "Generating 'make' outputs ..."
build/gen-build.py make
# Create RPM Spec file
if [ -f `which cut` ]; then
echo rebuilding rpm spec file
( REVISION=`build/get-version.sh all include/apr_version.h APR`
VERSION=`echo $REVISION | cut -d- -s -f1`
RELEASE=`echo $REVISION | cut -d- -s -f2`
if [ "x$VERSION" = "x" ]; then
VERSION=$REVISION
RELEASE=1
fi
cat ./build/rpm/apr.spec.in | \
sed -e "s/APR_VERSION/$VERSION/" \
-e "s/APR_RELEASE/$RELEASE/" \
> apr.spec )
fi
exit 0

231
libs/apr/config.layout Normal file
View File

@@ -0,0 +1,231 @@
##
## config.layout -- Pre-defined Installation Path Layouts
##
## Hints:
## - layouts can be loaded with configure's --enable-layout=ID option
## - when no --enable-layout option is given, the default layout is `apr'
## - a trailing plus character (`+') on paths is replaced with a
## `/<target>' suffix where <target> is currently hardcoded to 'apr'.
## (This may become a configurable parameter at some point.)
##
# Classical APR path layout designed for parallel installs.
<Layout apr>
prefix: /usr/local/apr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/modules
mandir: ${prefix}/man
sysconfdir: ${prefix}/conf
datadir: ${prefix}
installbuilddir: ${datadir}/build-${APR_MAJOR_VERSION}
includedir: ${prefix}/include/apr-${APR_MAJOR_VERSION}
localstatedir: ${prefix}
libsuffix: -${APR_MAJOR_VERSION}
</Layout>
# Classical single-installation APR path layout.
<Layout classic>
prefix: /usr/local/apr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/modules
mandir: ${prefix}/man
sysconfdir: ${prefix}/conf
datadir: ${prefix}
installbuilddir: ${datadir}/build
includedir: ${prefix}/include
localstatedir: ${prefix}
</Layout>
# GNU standards conforming path layout.
# See FSF's GNU project `make-stds' document for details.
<Layout GNU>
prefix: /usr/local
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec
mandir: ${prefix}/man
sysconfdir: ${prefix}/etc+
datadir: ${prefix}/share+
installbuilddir: ${datadir}/build
includedir: ${prefix}/include+
localstatedir: ${prefix}/var+
runtimedir: ${localstatedir}/run
</Layout>
# Mac OS X Server (Rhapsody)
<Layout Mac OS X Server>
prefix: /Local/Library/WebServer
exec_prefix: /usr
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: /System/Library/apr/Modules
mandir: ${exec_prefix}/share/man
sysconfdir: ${prefix}/Configuration
datadir: ${prefix}
installbuilddir: /System/Library/apr/Build
includedir: /System/Library/Frameworks/apr.framework/Versions/2.0/Headers
localstatedir: /var
runtimedir: ${prefix}/Logs
</Layout>
# Darwin/Mac OS Layout
<Layout Darwin>
prefix: /usr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec+
mandir: ${prefix}/share/man
datadir: /Library/WebServer
sysconfdir: /etc+
installbuilddir: ${prefix}/share/httpd/build
includedir: ${prefix}/include+
localstatedir: /var
runtimedir: ${localstatedir}/run
</Layout>
# Red Hat Linux 7.x layout
<Layout RedHat>
prefix: /usr
exec_prefix: ${prefix}
bindir: ${prefix}/bin
sbindir: ${prefix}/sbin
libdir: ${prefix}/lib
libexecdir: ${prefix}/lib/apr
mandir: ${prefix}/man
sysconfdir: /etc/httpd/conf
datadir: /var/www
installbuilddir: ${datadir}/build
includedir: ${prefix}/include/apr
localstatedir: /var
runtimedir: ${localstatedir}/run
</Layout>
# According to the /opt filesystem conventions
<Layout opt>
prefix: /opt/apr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec
mandir: ${prefix}/man
sysconfdir: /etc${prefix}
datadir: ${prefix}/share
installbuilddir: ${datadir}/build
includedir: ${prefix}/include
localstatedir: /var${prefix}
runtimedir: ${localstatedir}/run
</Layout>
# BeOS layout...
<Layout beos>
prefix: /boot/home/apr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec
mandir: ${prefix}/man
sysconfdir: ${prefix}/conf
datadir: ${prefix}
installbuilddir: ${datadir}/build
includedir: ${prefix}/include
localstatedir: ${prefix}
runtimedir: ${localstatedir}/logs
</Layout>
# SuSE 6.x layout
<Layout SuSE>
prefix: /usr
exec_prefix: ${prefix}
bindir: ${prefix}/bin
sbindir: ${prefix}/sbin
libdir: ${prefix}/lib
libexecdir: ${prefix}/lib/apr
mandir: ${prefix}/share/man
sysconfdir: /etc/httpd
datadir: /usr/local/httpd
installbuilddir: ${datadir}/build
includedir: ${prefix}/include/apr
localstatedir: /var/lib/httpd
runtimedir: /var/run
</Layout>
# BSD/OS layout
<Layout BSDI>
prefix: /var/www
exec_prefix: /usr/contrib
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec/apr
mandir: ${exec_prefix}/man
sysconfdir: ${prefix}/conf
datadir: ${prefix}
installbuilddir: ${datadir}/build
includedir: ${exec_prefix}/include/apr
localstatedir: /var
runtimedir: ${localstatedir}/run
</Layout>
# Solaris 8 Layout
<Layout Solaris>
prefix: /usr/apr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec
mandir: ${exec_prefix}/man
sysconfdir: /etc/apr
datadir: /var/apr
installbuilddir: ${datadir}/build
includedir: ${exec_prefix}/include
localstatedir: ${prefix}
runtimedir: /var/run
</Layout>
# OpenBSD Layout
<Layout OpenBSD>
prefix: /var/www
exec_prefix: /usr
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/lib/apr/modules
mandir: ${exec_prefix}/share/man
sysconfdir: ${prefix}/conf
datadir: ${prefix}
installbuilddir: ${prefix}/build
includedir: ${exec_prefix}/lib/apr/include
localstatedir: ${prefix}
runtimedir: ${prefix}/logs
</Layout>
# Debian layout
<Layout Debian>
prefix:
exec_prefix: ${prefix}/usr
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/lib/apr/modules
mandir: ${exec_prefix}/share/man
datadir: ${exec_prefix}/share/apr
includedir: ${exec_prefix}/include/apr-${APR_MAJOR_VERSION}
localstatedir: ${prefix}/var/run
runtimedir: ${prefix}/var/run
infodir: ${exec_prefix}/share/info
libsuffix: -${APR_MAJOR_VERSION}
</Layout>

45061
libs/apr/configure vendored Executable file

File diff suppressed because it is too large Load Diff

2129
libs/apr/configure.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,399 @@
<HTML>
<HEAD><TITLE>APR Design Document</TITLE></HEAD>
<BODY>
<h1>Design of APR</h1>
<p>The Apache Portable Run-time libraries have been designed to provide a common
interface to low level routines across any platform. The original goal of APR
was to combine all code in Apache to one common code base. This is not the
correct approach however, so the goal of APR has changed. There are places
where common code is not a good thing. For example, how to map requests
to either threads or processes should be platform specific. APR's place
is now to combine any code that can be safely combined without sacrificing
performance.</p>
<p>To this end we have created a set of operations that are required for cross
platform development. There may be other types that are desired and those
will be implemented in the future.</p>
<p>This document will discuss the structure of APR, and how best to contribute
code to the effort.</p>
<h2>APR On Windows and Netware</h2>
<p>APR on Windows and Netware is different from APR on all other systems,
because those platforms don't use autoconf. On Unix, apr_private.h (private to
APR) and apr.h (public, used by applications that use APR) are generated by
autoconf from acconfig.h and apr.h.in respectively. On Windows (and Netware),
apr_private.h and apr.h are created from apr_private.hw (apr_private.hwn)
and apr.hw (apr.hwn) respectively.</p>
<p> <strong>
If you add code to acconfig.h or tests to configure.in or aclocal.m4,
please give some thought to whether or not Windows and Netware need
these additions as well. A general rule of thumb, is that if it is
a feature macro, such as APR_HAS_THREADS, Windows and Netware need it.
In other words, if the definition is going to be used in a public APR
header file, such as apr_general.h, Windows needs it.
The only time it is safe to add a macro or test without also adding
the macro to apr*.h[n]w, is if the macro tells APR how to build. For
example, a test for a header file does not need to be added to Windows.
</strong></p>
<h2>APR Features</h2>
<p>One of the goals of APR is to provide a common set of features across all
platforms. This is an admirable goal, it is also not realistic. We cannot
expect to be able to implement ALL features on ALL platforms. So we are
going to do the next best thing. Provide a common interface to ALL APR
features on MOST platforms.</p>
<p>APR developers should create FEATURE MACROS for any feature that is not
available on ALL platforms. This should be a simple definition which has
the form:</p>
<code>APR_HAS_FEATURE</code>
<p>This macro should evaluate to true if APR has this feature on this platform.
For example, Linux and Windows have mmap'ed files, and APR is providing an
interface for mmapp'ing a file. On both Linux and Windows, APR_HAS_MMAP
should evaluate to one, and the ap_mmap_* functions should map files into
memory and return the appropriate status codes.</p>
<p>If your OS of choice does not have mmap'ed files, APR_HAS_MMAP should
evaluate to zero, and all ap_mmap_* functions should not be defined. The
second step is a precaution that will allow us to break at compile time if a
programmer tries to use unsupported functions.</p>
<h2>APR types</h2>
<p>The base types in APR</p>
<ul>
<li>dso<br>
Shared library routines
<li>mmap<br>
Memory-mapped files
<li>poll<br>
Polling I/O
<li>time<br>
Time
<li>user<br>
Users and groups
<li>locks<br>
Process and thread locks (critical sections)
<li>shmem<br>
Shared memory
<li>file_io<br>
File I/O, including pipes
<li>atomic<br>
Atomic integer operations
<li>strings<br>
String handling routines
<li>memory<br>
Pool-based memory allocation
<li>passwd<br>
Reading passwords from the terminal
<li>tables<br>
Tables and hashes
<li>network_io<br>
Network I/O
<li>threadproc<br>
Threads and processes
<li>misc<br>
Any APR type which doesn't have any other place to belong. This
should be used sparingly.
<li>support<br>
Functions meant to be used across multiple APR types. This area
is for internal functions only. If a function is exposed, it should
not be put here.
</ul>
<h2>Directory Structure</h2>
<p>Each type has a base directory. Inside this base directory, are
subdirectories, which contain the actual code. These subdirectories are named
after the platforms the are compiled on. Unix is also used as a common
directory. If the code you are writing is POSIX based, you should look at the
code in the unix directory. A good rule of thumb, is that if more than half
your code needs to be ifdef'ed out, and the structures required for your code
are substantively different from the POSIX code, you should create a new
directory.</p>
<p>Currently, the APR code is written for Unix, BeOS, Windows, and OS/2. An
example of the directory structure is the file I/O directory:</p>
<pre>
apr
|
-> file_io
|
-> unix The Unix and common base code
|
-> win32 The Windows code
|
-> os2 The OS/2 code
</pre>
<p>Obviously, BeOS does not have a directory. This is because BeOS is currently
using the Unix directory for it's file_io.</p>
<p>There are a few special top level directories. These are test and include.
Test is a directory which stores all test programs. It is expected
that if a new type is developed, there will also be a new test program, to
help people port this new type to different platforms. A small document
describing how to create new tests that integrate with the test suite can be
found in the test/ directory. Include is a directory which stores all
required APR header files for external use.</p>
<h2>Creating an APR Type</h2>
<p>The current design of APR requires that most APR types be incomplete.
It is not possible to write flexible portable code if programs can access
the internals of APR types. This is because different platforms are
likely to define different native types. There are only two execptions to
this rule:</p>
<ul>
<li>The first exception to this rule is if the type can only reasonably be
implemented one way. For example, time is a complete type because there
is only one reasonable time implementation.
<li>The second exception to the incomplete type rule can be found in
apr_portable.h. This file defines the native types for each platform.
Using these types, it is possible to extract native types for any APR type.</p>
</ul>
<p>For this reason, each platform defines a structure in their own directories.
Those structures are then typedef'ed in an external header file. For example
in file_io/unix/fileio.h:</p>
<pre>
struct ap_file_t {
apr_pool_t *cntxt;
int filedes;
FILE *filehand;
...
}
</pre>
<p>In include/apr_file_io.h:</p>
</pre>
typedef struct ap_file_t ap_file_t;
</pre>
<p> This will cause a compiler error if somebody tries to access the filedes
field in this structure. Windows does not have a filedes field, so obviously,
it is important that programs not be able to access these.</p>
<p>You may notice the apr_pool_t field. Most APR types have this field. This
type is used to allocate memory within APR. Because every APR type has a pool,
any APR function can allocate memory if it needs to. This is very important
and it is one of the reasons that APR works. If you create a new type, you
must add a pool to it. If you do not, then all functions that operate on that
type will need a pool argument.</p>
<h2>New Function</h2>
<p>When creating a new function, please try to adhere to these rules.</p>
<ul>
<li> Result arguments should be the first arguments.
<li> If a function needs a pool, it should be the last argument.
<li> These rules are flexible, especially if it makes the code easier
to understand because it mimics a standard function.
</ul>
<h2>Documentation</h2>
<p>Whenever a new function is added to APR, it MUST be documented. New
functions will not be committed unless there are docs to go along with them.
The documentation should be a comment block above the function in the header
file.</p>
<p>The format for the comment block is:</p>
<pre>
/**
* Brief description of the function
* @param parma_1_name explanation
* @param parma_2_name explanation
* @param parma_n_name explanation
* @tip Any extra information people should know.
* @deffunc function prototype if required
*/
</pre>
<p>For an actual example, look at any file in the include directory. The
reason the docs are in the header files is to ensure that the docs always
reflect the current code. If you change paramters or return values for a
function, please be sure to update the documentation.</p>
<h2>APR Error reporting</h2>
<p>Most APR functions should return an ap_status_t type. The only time an
APR function does not return an ap_status_t is if it absolutely CAN NOT
fail. Examples of this would be filling out an array when you know you are
not beyond the array's range. If it cannot fail on your platform, but it
could conceivably fail on another platform, it should return an ap_status_t.
Unless you are sure, return an ap_status_t.</p>
<strong>
This includes functions that return TRUE/FALSE values. How that
is handled is discussed below
</strong>
<p>All platforms return errno values unchanged. Each platform can also have
one system error type, which can be returned after an offset is added.
There are five types of error values in APR, each with it's own offset.</p>
<!-- This should be turned into a table, but I am lazy today -->
<pre>
Name Purpose
0) This is 0 for all platforms and isn't really defined
anywhere, but it is the offset for errno values.
(This has no name because it isn't actually defined,
but for completeness we are discussing it here).
1) APR_OS_START_ERROR This is platform dependent, and is the offset at which
APR errors start to be defined. Error values are
defined as anything which caused the APR function to
fail. APR errors in this range should be named
APR_E* (i.e. APR_ENOSOCKET)
2) APR_OS_START_STATUS This is platform dependent, and is the offset at which
APR status values start. Status values do not indicate
success or failure, and should be returned if
APR_SUCCESS does not make sense. APR status codes in
this range should be name APR_* (i.e. APR_DETACH)
4) APR_OS_START_USEERR This is platform dependent, and is the offset at which
APR apps can begin to add their own error codes.
3) APR_OS_START_SYSERR This is platform dependent, and is the offset at which
system error values begin.
</pre>
<strong>The difference in naming between APR_OS_START_ERROR and
APR_OS_START_STATUS mentioned above allows programmers to easily determine if
the error code indicates an error condition or a status codition.</strong>
<p>If your function has multiple return codes that all indicate success, but
with different results, or if your function can only return PASS/FAIL, you
should still return an apr_status_t. In the first case, define one
APR status code for each return value, an example of this is
<code>apr_proc_wait</code>, which can only return APR_CHILDDONE,
APR_CHILDNOTDONE, or an error code. In the second case, please return
APR_SUCCESS for PASS, and define a new APR status code for failure, an
example of this is <code>apr_compare_users</code>, which can only return
APR_SUCCESS, APR_EMISMATCH, or an error code.</p>
<p>All of these definitions can be found in apr_errno.h for all platforms. When
an error occurs in an APR function, the function must return an error code.
If the error occurred in a system call and that system call uses errno to
report an error, then the code is returned unchanged. For example: </p>
<pre>
if (open(fname, oflags, 0777) < 0)
return errno;
</pre>
<p>The next place an error can occur is a system call that uses some error value
other than the primary error value on a platform. This can also be handled
by APR applications. For example:</p>
<pre>
if (CreateFile(fname, oflags, sharemod, NULL,
createflags, attributes, 0) == INVALID_HANDLE_VALUE
return (GetLAstError() + APR_OS_START_SYSERR);
</pre>
<p>These two examples implement the same function for two different platforms.
Obviously even if the underlying problem is the same on both platforms, this
will result in two different error codes being returned. This is OKAY, and
is correct for APR. APR relies on the fact that most of the time an error
occurs, the program logs the error and continues, it does not try to
programatically solve the problem. This does not mean we have not provided
support for programmatically solving the problem, it just isn't the default
case. We'll get to how this problem is solved in a little while.</p>
<p>If the error occurs in an APR function but it is not due to a system call,
but it is actually an APR error or just a status code from APR, then the
appropriate code should be returned. These codes are defined in apr_errno.h
and should be self explanatory.</p>
<p>No APR code should ever return a code between APR_OS_START_USEERR and
APR_OS_START_SYSERR, those codes are reserved for APR applications.</p>
<p>To programmatically correct an error in a running application, the error
codes need to be consistent across platforms. This should make sense. APR
has provided macros to test for status code equivalency. For example, to
determine if the code that you received from the APR function means EOF, you
would use the macro APR_STATUS_IS_EOF().</p>
<p>Why did APR take this approach? There are two ways to deal with error
codes portably.</p>
<ol type=1>
<li> Return the same error code across all platforms.
<li> Return platform specific error codes and convert them when necessary.
</ol>
<p>The problem with option number one is that it takes time to convert error
codes to a common code, and most of the time programs want to just output
an error string. If we convert all errors to a common subset, we have four
steps to output an error string:</p>
<p>The seocnd problem with option 1, is that it is a lossy conversion. For
example, Windows and OS/2 have a couple hundred error codes, but POSIX errno
only defines about 50 errno values. This means that if we convert to a
canonical error value immediately, there is no way for the programmer to
get the actual system error.</p>
<pre>
make syscall that fails
convert to common error code step 1
return common error code
check for success
call error output function step 2
convert back to system error step 3
output error string step 4
</pre>
<p>By keeping the errors platform specific, we can output error strings in two
steps.</p>
<pre>
make syscall that fails
return error code
check for success
call error output function step 1
output error string step 2
</pre>
<p>Less often, programs change their execution based on what error was returned.
This is no more expensive using option 2 than it is using option 1, but we
put the onus of converting the error code on the programmer themselves.
For example, using option 1:</p>
<pre>
make syscall that fails
convert to common error code
return common error code
decide execution based on common error code
</pre>
<p>Using option 2:</p>
<pre>
make syscall that fails
return error code
convert to common error code (using ap_canonical_error)
decide execution based on common error code
</pre>
<p>Finally, there is one more operation on error codes. You can get a string
that explains in human readable form what has happened. To do this using
APR, call ap_strerror().</p>

View File

@@ -0,0 +1,156 @@
<HTML>
<HEAD><TITLE>APR Canonical Filenames</TITLE></HEAD>
<BODY>
<h1>APR Canonical Filename</h1>
<h2>Requirements</h2>
<p>APR porters need to address the underlying discrepancies between
file systems. To achieve a reasonable degree of security, the
program depending upon APR needs to know that two paths may be
compared, and that a mismatch is guarenteed to reflect that the
two paths do not return the same resource</p>.
<p>The first discrepancy is in volume roots. Unix and pure deriviates
have only one root path, "/". Win32 and OS2 share root paths of
the form "D:/", D: is the volume designation. However, this can
be specified as "//./D:/" as well, indicating D: volume of the
'this' machine. Win32 and OS2 also may employ a UNC root path,
of the form "//server/share/" where share is a share-point of the
specified network server. Finally, NetWare root paths are of the
form "server/volume:/", or the simpler "volume:/" syntax for 'this'
machine. All these non-Unix file systems accept volume:path,
without a slash following the colon, as a path relative to the
current working directory, which APR will treat as ambigious, that
is, neither an absolute nor a relative path per se.</p>
<p>The second discrepancy is in the meaning of the 'this' directory.
In general, 'this' must be eliminated from the path where it occurs.
The syntax "path/./" and "path/" are both aliases to path. However,
this isn't file system independent, since the double slash "//" has
a special meaning on OS2 and Win32 at the start of the path name,
and is invalid on those platforms before the "//server/share/" UNC
root path is completed. Finally, as noted above, "//./volume/" is
legal root syntax on WinNT, and perhaps others.</p>
<p>The third discrepancy is in the context of the 'parent' directory.
When "parent/path/.." occurs, the path must be unwound to "parent".
It's also critical to simply truncate leading "/../" paths to "/",
since the parent of the root is root. This gets tricky on the
Win32 and OS2 platforms, since the ".." element is invalid before
the "//server/share/" is complete, and the "//server/share/../"
seqence is the complete UNC root "//server/share/". In relative
paths, leading ".." elements are significant, until they are merged
with an absolute path. The relative form must only retain the ".."
segments as leading segments, to be resolved once merged to another
relative or an absolute path.</p>
<p>The fourth discrepancy occurs with acceptance of alternate character
codes for the same element. Path seperators are not retained within
the APR canonical forms. The OS filesystem and APR (slashed) forms
can both be returned as strings, to be used in the proper context.
Unix, Win32 and Netware all accept slashes and backslashes as the
same path seperator symbol, although unix strictly accepts slashes.
While the APR form of the name strictly uses slashes, always consider
that there could be a platform that actually accepts slashes as a
character within a segment name.</p>
<p>The fifth and worst discrepancy plauges Win32, OS2, Netware, and some
filesystems mounted in Unix. Case insensitivity can permit the same
file to slip through in both it's proper case and alternate cases.
Simply changing the case is insufficient for any character set beyond
ASCII, since various dilectic forms of characters suffer from one to
many or many to one translations. An example would be u-umlaut, which
might be accepted as a single character u-umlaut, a two character
sequence u and the zero-width umlaut, the upper case form of the same,
or perhaps even a captial U alone. This can be handled in different
ways depending on the purposes of the APR based program, but the one
requirement is that the path must be absolute in order to resolve these
ambiguities. Methods employed include comparison of device and inode
file uniqifiers, which is a fairly fast operation, or quering the OS
for the true form of the name, which can be much slower. Only the
acknowledgement of the file names by the OS can validate the equality
of two different cases of the same filename.</p>
<p>The sixth discrepancy, illegal or insignificant characters, is especially
significant in non-unix file systems. Trailing periods are accepted
but never stored, therefore trailing periods must be ignored for any
form of comparison. And all OS's have certain expectations of what
characters are illegal (or undesireable due to confusion.)</p>
<p>A final warning, canonical functions don't transform or resolve case
or character ambiguity issues until they are resolved into an absolute
path. The relative canonical path, while useful, while useful for URL
or similar identifiers, cannot be used for testing or comparison of file
system objects.</p>
<hr>
<h2>Canonical API</h2>
Functions to manipulate the apr_canon_file_t (an opaque type) include:
<ul>
<li>Create canon_file_t (from char* path and canon_file_t parent path)
<li>Merged canon_file_t (from path and parent, both canon_file_t)
<li>Get char* path of all or some segments
<li>Get path flags of IsRelative, IsVirtualRoot, and IsAbsolute
<li>Compare two canon_file_t structures for file equality
</ul>
<p>The path is corrected to the file system case only if is in absolute
form. The apr_canon_file_t should be preserved as long as possible and
used as the parent to create child entries to reduce the number of expensive
stat and case canonicalization calls to the OS.</p>
<p>The comparison operation provides that the APR can postpone correction
of case by simply relying upon the device and inode for equivilance. The
stat implementation provides that two files are the same, while their
strings are not equivilant, and eliminates the need for the operating
system to return the proper form of the name.</p>
<p>In any case, returning the char* path, with a flag to request the proper
case, forces the OS calls to resolve the true names of each segment. Where
there is a penality for this operation and the stat device and inode test
is faster, case correction is postponed until the char* result is requested.
On platforms that identify the inode, device, or proper name interchangably
with no penalities, this may occur when the name is initially processed.</p>
<hr>
<h2>Unix Example</h2>
<p>First the simplest case:</p>
<pre>
Parse Canonical Name
accepts parent path as canonical_t
this path as string
Split this path Segments on '/'
For each of this path Segments
If first Segment
If this Segment is Empty ([nothing]/)
Append this Root Segment (don't merge)
Continue to next Segment
Else is relative
Append parent Segments (to merge)
Continue with this Segment
If Segment is '.' or empty (2 slashes)
Discard this Segment
Continue with next Segment
If Segment is '..'
If no previous Segment or previous Segment is '..'
Append this Segment
Continue with next Segment
If previous Segment and previous is not Root Segment
Discard previous Segment
Discard this Segment
Continue with next Segment
Append this Relative Segment
Continue with next Segment
</pre>
</BODY>
</HTML>

View File

@@ -0,0 +1,38 @@
PROJECT_NAME="Apache Portable Runtime"
INPUT=.
QUIET=YES
RECURSIVE=YES
FILE_PATTERNS=*.h
OUTPUT_DIRECTORY=docs/dox
MACRO_EXPANSION=YES
EXPAND_ONLY_PREDEF=YES
#EXPAND_AS_DEFINED=
# not sure why this doesn't work as EXPAND_AS_DEFINED, it should!
PREDEFINED="APR_DECLARE(x)=x" \
"APR_DECLARE_NONSTD(x)=x" \
"APR_DECLARE_DATA" \
"APR_POOL_DECLARE_ACCESSOR(x)=apr_pool_t* apr_##x##_pool_get (const apr_##x##_t *the##x)" \
"APR_DECLARE_INHERIT_SET(x)=apr_status_t apr_##x##_inherit_set(apr_##x##_t *the##x)" \
"APR_DECLARE_INHERIT_UNSET(x)=apr_status_t apr_##x##_inherit_unset(apr_##x##_t *the##x)" \
"APR_HAS_THREADS" \
"__attribute__(x)=" \
DOXYGEN=
OPTIMIZE_OUTPUT_FOR_C=YES
STRIP_CODE_COMMENTS=NO
FULL_PATH_NAMES=NO
CASE_SENSE_NAMES=NO
# some autoconf guru needs to make configure set this correctly...
# in the meantime, simply listing the headers should be alright
#STRIP_FROM_PATH=/buildpath/apr
EXCLUDE_PATTERNS="*/acconfig.h" \
"*/test/*" \
"*/arch/*"
GENERATE_TAGFILE=docs/dox/apr.tag

View File

@@ -0,0 +1,84 @@
The question has been asked multiple times, "Why is APR using Incomplete
types?" This document will try to explain that.
Incomplete types are used in APR because they can enforce portability, and
they make the APR developers job easier, as well as allowing APR to use native
types on all platforms. Imagine a scenario where APR wasn't using incomplete
types. The ap_file_t type would have to be defined as:
typedef struct ap_file_t {
ap_pool_t *pool
char *fname;
int eof_hit;
int pipe;
ap_interval_time_t timeout;
#ifdef WIN32
HANDLE file_handle;
DWORD dwFileAttributes;
#elif defined(OS2)
HFILE filedes;
HEV PipeSem
#else
int filedes;
int ungetchar;
#endif
#ifndef WIN32
int buffered;
ap_int32_flags
int isopen;
/* Stuff for buffered mode */
char *buffer;
int bufpos;
unsigned long dataRead;
int direction;
unsigned long filePtr;
ap_lock_t *mutex;
#endif
} ap_file_t;
This captures the essense of what is currently being defined for ap_file_t
using incomplete types. However, using this structure leads developers to
believe that they are safe accessing any of the fields in this structure.
This is not true. On some platforms, such as Windows, about half of the
structure disappears. We could combine some of these definitions with
macros, for example:
#ifdef WIN32
#define filetype HANDLE
#elif OS2
#define filetype HFILE
#else
#define filetype int
#endif
And then in the defintion for ap_file_t, we could say:
filetype filedes;
This gets rid of some of the complexity, by moving it off to the side, but
it is still not safe for a programmers to access the filedes field directly
outside of APR, because the programmer has no way of knowing what the actual
type is. So for example printing the filedes using printf would yield wildly
varying results on Windows and OS2 when compared to Unix.
Another option also presents itself. Stick strictly to POSIX. This means
that all code can be shared on any POSIX compliant platform. The problem
with this is performance. One of the benefits to APR, is that it allows
developers to easily use native types on all platforms with the same code.
This has proven to provide a substantial performance boost on most non-Unix
platforms.
Having said all of that, sometimes incomplete types just don't make sense.
For example, the first implementation of time functions used incomplete types,
which added a layer of complexity that turned out to be unnecessary. If
a platform cannot provide a simple number that represents the number of seconds
elapsed since a specifed date and time, then APR doesn't really want to
provide support for that platform.
APR is trying hard to provide a balance of incomplete and complete types,
but like all things, sometimes the developers make mistakes. If you are
using APR and find that there is an incomplete type that doesn't need to be
an incomplete type, please let us know, we are more than willing to listen
and design parts of APR that do not use incomplete types.

View File

@@ -0,0 +1,47 @@
How do I use APR'ized programs in connection with programs that don't
use APR? These darn incomplete types don't let me fill out the APR types.
The APR developers acknowledge that most programs are not using APR, and
we don't expect them to migrate to using APR just because APR has been
released. So, we have provided a way for non-APR'ized programs to interact
very cleanly with APR.
There are a set of functions, all documented in apr_portable.h, which allow
a programmer to either get a native type from an APR type, or to setup an
APR type from a native type.
For example, if you are writing an add-on to another program that does not use
APR for file I/O, but you (in your infinite wisdom) want to use APR to make
sure your section is portable. Assume the program provides a type foo_t with
a file descriptor in it (fd).
void function_using_apr(foo_t non_apr_struct, ap_pool_t *p)
{
ap_file_t *apr_file = NULL;
ap_put_os_file(&apr_file, &non_apr_struct->fd, p);
...
}
There are portable functions for each APR incomplete type. They are all
called ap_put_os_foobar(), and they each take the same basic arguments, a
pointer to a pointer to the incomplete type (the last pointer in that list
should be NULL), a pointer to the native type, and a pool. Each of these can
be found in apr_portable.h.
If you have to do the exact opposite (take an APR type and convert it to a
native type, there are functions for that too. For example:
void function_not_using_apr(apr_file_t *apr_file)
{
int unix_file_desc;
ap_get_os_file(&unix_file_desc, apr_file);
...
}
For each ap_put_os_foobar, there is a corresponding ap_get_os_file. These are
also documented in apr_portable.h.

View File

@@ -0,0 +1,100 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>Using APR Pools</title>
</head>
<body>
<div align="right">
Last modified at [$Date: 2004-11-24 16:51:51 -0600 (Wed, 24 Nov 2004) $]
</div>
<h1>Using APR Pools</h1>
<p>
From <a href="http://subversion.tigris.org/">Subversion</a>, we
have learned a <em>lot</em> about how to use pools in a heavily
structured/object-based environment.
<a href="http://httpd.apache.org/">Apache httpd</a> is a
completely different beast: "allocate a request pool. use
it. destroy it."
</p>
<p>
In a complex app, that request-style of behavior is not
present. Luckily, the "proper" use of pools can be described in
just a few rules:
</p>
<ul>
<li>
Objects should not have their own pools. An object is
allocated into a pool defined by the constructor's caller. The
<strong>caller</strong> knows the lifetime of the object and
will manage it via the pool. Generally, this also means that
objects will not have a "close" or a "free" since those
operations will happen implicitly as part of the destruction
of the pool the objects live within.
</li>
<li>
<p>
Functions should not create/destroy pools for their
operation; they should use a pool provided by the
caller. Again, the <strong>caller</strong> knows more about
how the function will be used, how often, how many times,
etc. Thus, it should be in charge of the function's memory
usage.
</p>
<p>
As an example, the caller might know that the app will exit
upon the function's return. Thus, the function would be
creating extra work if it built and destroyed a
pool. Instead, it should use the passed-in pool, which the
caller is going to be tossing as part of app-exit anyways.
</p>
</li>
<li>
<p>
Whenever an unbounded iteration occurs, a subpool should be
used. The general pattern is:
</p>
<blockquote>
<pre>
subpool = apr_create_subpool(pool);
for (i = 0; i < n; ++i) {
apr_pool_clear(subpool);
do_operation(..., subpool);
}
apr_pool_destroy(subpool);</pre>
</blockquote>
<p>
This pattern prevents the 'pool' from growing unbounded and
consuming all of memory. Note that it is slightly more
optimal to clear the pool on loop-entry. This pattern also
allows for a '<tt>continue</tt>' to occur within the loop,
yet still ensure the pool will be cleared.
</p>
</li>
<li>
Given all of the above, it is pretty well mandatory to pass a
pool to <em>every</em> function. Since objects are not
recording pools for themselves, and the caller is always
supposed to be managing memory, then each function needs a
pool, rather than relying on some hidden magic pool. In
limited cases, objects may record the pool used for their
construction so that they can construct sub-parts, but these
cases should be examined carefully. Internal pools can lead to
unbounded pool usage if the object is not careful.
</li>
</ul>
<hr>
<address>Greg Stein</address>
<!-- Created: Wed Jun 25 14:39:57 PDT 2003 -->
<!-- hhmts start -->
Last modified: Wed Jun 25 14:50:19 PDT 2003
<!-- hhmts end -->
</body></html>

View File

@@ -0,0 +1,57 @@
<HTML>
<HEAD><TITLE>APR Win32 Builds and Debugging</TITLE></HEAD>
<BODY>
<h1>APR Win32 Builds and Debugging</h1>
<h2>Configuration and Flavors</h2>
<p>The Win32 APR Developer Studio projects consist of</p>
<dl>
<dt>apr/apr.dsp</dt>
<dd>Builds the static apr.lib library (-D APR_DECLARE_STATIC)</dd>
<dt>apr/libapr.dsp</dt>
<dd>Builds the dynamic libapr.dll library (no define required)</dd>
<dt>apr-util/aprutil.dsp</dt>
<dd>Builds the static aprutil.lib library (-D APU_DECLARE_STATIC)</dd>
<dt>apr-util/libaprutil.dsp</dt>
<dd>Builds the dynamic libaprutil.dll library (no define required)</dd>
<dt>apr-iconv/apriconv.dsp</dt>
<dd>Builds the static apriconv.lib library (-D API_DECLARE_STATIC)</dd>
<dt>apr-iconv/libapriconv.dsp</dt>
<dd>Builds the dynamic libapriconv.dll library (no define required)</dd>
</dl>
<p>In order to prepare to use one of the <em>static</em> libraries above,
your application must be compiled with the define shown above, so that the
correct linkage is created. The APR authors intended the use of dynamic
libraries by default, so application authors do not need any special
defines in order to link to the dynamic library flavors.</p>
<p>In order to build APR, you must use the proper dependencies. A good
example of those dependencies is given in the apr-util/aprutil.dsw
Developer Studio workspace. You can borrow the parts of that structure
your application needs, that workspace defines both the dynamic and static
library dependencies.</p>
<p>The APR libraries (dynamic and static) are compiled with debugging symbols,
even in Release builds. The dynamic library symbols are always usable,
simply keep the correspond .pdb file in the same path as the library .dll.
(E.g. both libapr.dll and libapr.pdb should be copied to the same path.)</p>
<p>The static symbols will only be fully usable if your application does <em>not<em>
link with the /pdbtype:sept flag! At the time your application links to
an APR library, the corresponding _src.pdb file should exist in the original
path the library was built, or it may be sufficient to keep the _src.pdb file
in the same path as the library file. (E.g. apr.lib and apr_src.pdb should
reside together in your lib directory.) The later option is unconfirmed.</p>
<p>In order to keep the symbols compiled into the static library, your application
must use the linker's /debug flag. If you do not want the application to be
debuggable with its corresponding .pdb file, omit the /debug flag and all debug
symbolic information is discarded. Note that your application can only be
debugged with the corresponding .pdb file created by the linker, unless you use
/debugtype:coff or /debugtype:both in your link options.</p>
</BODY>
</HTML>

714
libs/apr/dso/aix/dso.c Normal file
View File

@@ -0,0 +1,714 @@
/* 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.
*/
/*
* dso.c -- DSO system function emulation for AIX
*
* This is *only* intended for AIX < 4.3.
*/
/*
* Based on libdl (dlfcn.c/dlfcn.h) which is
* Copyright (c) 1992,1993,1995,1996,1997,1988
* Jens-Uwe Mager, Helios Software GmbH, Hannover, Germany.
*
* Not derived from licensed software.
*
* Permission is granted to freely use, copy, modify, and redistribute
* this software, provided that the author is not construed to be liable
* for any results of using the software, alterations are clearly marked
* as such, and this notice is not modified.
*
* Changes marked with `--jwe' were made on April 7 1996 by
* John W. Eaton <jwe@bevo.che.wisc.edu> to support g++
*
* Bundled, stripped and adjusted on April 1998 as one single source file
* for inclusion into the Apache HTTP server by
* Ralf S. Engelschall <rse@apache.org>
*
* Added to APR by David Reid April 2000
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ldr.h>
#include <a.out.h>
#include "apr_arch_dso.h"
#include "apr_portable.h"
#if APR_HAS_DSO
#undef FREAD
#undef FWRITE
#include <ldfcn.h>
/*
* AIX 4.3 does remove some useful definitions from ldfcn.h. Define
* these here to compensate for that lossage.
*/
#ifndef BEGINNING
#define BEGINNING SEEK_SET
#endif
#ifndef FSEEK
#define FSEEK(ldptr,o,p) fseek(IOPTR(ldptr),(p==BEGINNING)?(OFFSET(ldptr) +o):o,p)
#endif
#ifndef FREAD
#define FREAD(p,s,n,ldptr) fread(p,s,n,IOPTR(ldptr))
#endif
/*
* Mode flags for the dlopen routine.
*/
#undef RTLD_LAZY
#define RTLD_LAZY 1 /* lazy function call binding */
#undef RTLD_NOW
#define RTLD_NOW 2 /* immediate function call binding */
#undef RTLD_GLOBAL
#define RTLD_GLOBAL 0x100 /* allow symbols to be global */
/*
* To be able to initialize, a library may provide a dl_info structure
* that contains functions to be called to initialize and terminate.
*/
struct dl_info {
void (*init) (void);
void (*fini) (void);
};
/* APR functions...
*
* As the AIX functions have been declared in the header file we just
* add the basic "wrappers" here.
*/
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
{
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
(*aprdso)->handle = osdso;
(*aprdso)->pool = pool;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
apr_dso_handle_t *aprdso)
{
*osdso = aprdso->handle;
return APR_SUCCESS;
}
static apr_status_t dso_cleanup(void *thedso)
{
apr_dso_handle_t *dso = thedso;
if (dso->handle != NULL && dlclose(dso->handle) != 0)
return APR_EINIT;
dso->handle = NULL;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *ctx)
{
void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL);
*res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
if(os_handle == NULL) {
(*res_handle)->errormsg = dlerror();
return APR_EDSOOPEN;
}
(*res_handle)->handle = (void*)os_handle;
(*res_handle)->pool = ctx;
(*res_handle)->errormsg = NULL;
apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
{
return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup);
}
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
apr_dso_handle_t *handle,
const char *symname)
{
void *retval = dlsym(handle->handle, symname);
if (retval == NULL) {
handle->errormsg = dlerror();
return APR_ESYMNOTFOUND;
}
*ressym = retval;
return APR_SUCCESS;
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen)
{
if (dso->errormsg) {
apr_cpystrn(buffer, dso->errormsg, buflen);
return dso->errormsg;
}
return "No Error";
}
/*
* We simulate dlopen() et al. through a call to load. Because AIX has
* no call to find an exported symbol we read the loader section of the
* loaded module and build a list of exported symbols and their virtual
* address.
*/
typedef struct {
char *name; /* the symbols's name */
void *addr; /* its relocated virtual address */
} Export, *ExportPtr;
/*
* xlC uses the following structure to list its constructors and
* destructors. This is gleaned from the output of munch.
*/
typedef struct {
void (*init) (void); /* call static constructors */
void (*term) (void); /* call static destructors */
} Cdtor, *CdtorPtr;
typedef void (*GccCDtorPtr) (void);
/*
* The void * handle returned from dlopen is actually a ModulePtr.
*/
typedef struct Module {
struct Module *next;
char *name; /* module name for refcounting */
int refCnt; /* the number of references */
void *entry; /* entry point from load */
struct dl_info *info; /* optional init/terminate functions */
CdtorPtr cdtors; /* optional C++ constructors */
GccCDtorPtr gcc_ctor; /* g++ constructors --jwe */
GccCDtorPtr gcc_dtor; /* g++ destructors --jwe */
int nExports; /* the number of exports found */
ExportPtr exports; /* the array of exports */
} Module, *ModulePtr;
/*
* We keep a list of all loaded modules to be able to call the fini
* handlers and destructors at atexit() time.
*/
static ModulePtr modList;
/*
* The last error from one of the dl* routines is kept in static
* variables here. Each error is returned only once to the caller.
*/
static char errbuf[BUFSIZ];
static int errvalid;
/*
* The `fixed' gcc header files on AIX 3.2.5 provide a prototype for
* strdup(). --jwe
*/
extern char *strdup(const char *);
static void caterr(char *);
static int readExports(ModulePtr);
static void terminate(void);
static void *findMain(void);
void *dlopen(const char *path, int mode)
{
register ModulePtr mp;
static void *mainModule;
/*
* Upon the first call register a terminate handler that will
* close all libraries. Also get a reference to the main module
* for use with loadbind.
*/
if (!mainModule) {
if ((mainModule = findMain()) == NULL)
return NULL;
atexit(terminate);
}
/*
* Scan the list of modules if we have the module already loaded.
*/
for (mp = modList; mp; mp = mp->next)
if (strcmp(mp->name, path) == 0) {
mp->refCnt++;
return mp;
}
if ((mp = (ModulePtr) calloc(1, sizeof(*mp))) == NULL) {
errvalid++;
strcpy(errbuf, "calloc: ");
strcat(errbuf, strerror(errno));
return NULL;
}
if ((mp->name = strdup(path)) == NULL) {
errvalid++;
strcpy(errbuf, "strdup: ");
strcat(errbuf, strerror(errno));
free(mp);
return NULL;
}
/*
* load should be declared load(const char *...). Thus we
* cast the path to a normal char *. Ugly.
*/
if ((mp->entry = (void *) loadAndInit((char *) path, L_NOAUTODEFER, NULL)) == NULL) {
free(mp->name);
free(mp);
errvalid++;
strcpy(errbuf, "dlopen: ");
strcat(errbuf, path);
strcat(errbuf, ": ");
/*
* If AIX says the file is not executable, the error
* can be further described by querying the loader about
* the last error.
*/
if (errno == ENOEXEC) {
char *tmp[BUFSIZ / sizeof(char *)];
if (loadquery(L_GETMESSAGES, tmp, sizeof(tmp)) == -1)
strcpy(errbuf, strerror(errno));
else {
char **p;
for (p = tmp; *p; p++)
caterr(*p);
}
}
else
strcat(errbuf, strerror(errno));
return NULL;
}
mp->refCnt = 1;
mp->next = modList;
modList = mp;
if (loadbind(0, mainModule, mp->entry) == -1) {
dlclose(mp);
errvalid++;
strcpy(errbuf, "loadbind: ");
strcat(errbuf, strerror(errno));
return NULL;
}
/*
* If the user wants global binding, loadbind against all other
* loaded modules.
*/
if (mode & RTLD_GLOBAL) {
register ModulePtr mp1;
for (mp1 = mp->next; mp1; mp1 = mp1->next)
if (loadbind(0, mp1->entry, mp->entry) == -1) {
dlclose(mp);
errvalid++;
strcpy(errbuf, "loadbind: ");
strcat(errbuf, strerror(errno));
return NULL;
}
}
if (readExports(mp) == -1) {
dlclose(mp);
return NULL;
}
/*
* If there is a dl_info structure, call the init function.
*/
if (mp->info = (struct dl_info *) dlsym(mp, "dl_info")) {
if (mp->info->init)
(*mp->info->init) ();
}
else
errvalid = 0;
/*
* If the shared object was compiled using xlC we will need
* to call static constructors (and later on dlclose destructors).
*/
if (mp->cdtors = (CdtorPtr) dlsym(mp, "__cdtors")) {
CdtorPtr cp = mp->cdtors;
while (cp->init || cp->term) {
if (cp->init && cp->init != (void (*)(void)) 0xffffffff)
(*cp->init) ();
cp++;
}
/*
* If the shared object was compiled using g++, we will need
* to call global constructors using the _GLOBAL__DI function,
* and later, global destructors using the _GLOBAL_DD
* funciton. --jwe
*/
}
else if (mp->gcc_ctor = (GccCDtorPtr) dlsym(mp, "_GLOBAL__DI")) {
(*mp->gcc_ctor) ();
mp->gcc_dtor = (GccCDtorPtr) dlsym(mp, "_GLOBAL__DD");
}
else
errvalid = 0;
return mp;
}
/*
* Attempt to decipher an AIX loader error message and append it
* to our static error message buffer.
*/
static void caterr(char *s)
{
register char *p = s;
while (*p >= '0' && *p <= '9')
p++;
switch (atoi(s)) {
case L_ERROR_TOOMANY:
strcat(errbuf, "to many errors");
break;
case L_ERROR_NOLIB:
strcat(errbuf, "can't load library");
strcat(errbuf, p);
break;
case L_ERROR_UNDEF:
strcat(errbuf, "can't find symbol");
strcat(errbuf, p);
break;
case L_ERROR_RLDBAD:
strcat(errbuf, "bad RLD");
strcat(errbuf, p);
break;
case L_ERROR_FORMAT:
strcat(errbuf, "bad exec format in");
strcat(errbuf, p);
break;
case L_ERROR_ERRNO:
strcat(errbuf, strerror(atoi(++p)));
break;
default:
strcat(errbuf, s);
break;
}
}
void *dlsym(void *handle, const char *symbol)
{
register ModulePtr mp = (ModulePtr) handle;
register ExportPtr ep;
register int i;
/*
* Could speed up the search, but I assume that one assigns
* the result to function pointers anyways.
*/
for (ep = mp->exports, i = mp->nExports; i; i--, ep++)
if (strcmp(ep->name, symbol) == 0)
return ep->addr;
errvalid++;
strcpy(errbuf, "dlsym: undefined symbol ");
strcat(errbuf, symbol);
return NULL;
}
const char *dlerror(void)
{
if (errvalid) {
errvalid = 0;
return errbuf;
}
return NULL;
}
int dlclose(void *handle)
{
register ModulePtr mp = (ModulePtr) handle;
int result;
register ModulePtr mp1;
if (--mp->refCnt > 0)
return 0;
if (mp->info && mp->info->fini)
(*mp->info->fini) ();
if (mp->cdtors) {
CdtorPtr cp = mp->cdtors;
while (cp->init || cp->term) {
if (cp->term && cp->init != (void (*)(void)) 0xffffffff)
(*cp->term) ();
cp++;
}
/*
* If the function to handle global destructors for g++
* exists, call it. --jwe
*/
}
else if (mp->gcc_dtor) {
(*mp->gcc_dtor) ();
}
result = unload(mp->entry);
if (result == -1) {
errvalid++;
strcpy(errbuf, strerror(errno));
}
if (mp->exports) {
register ExportPtr ep;
register int i;
for (ep = mp->exports, i = mp->nExports; i; i--, ep++)
if (ep->name)
free(ep->name);
free(mp->exports);
}
if (mp == modList)
modList = mp->next;
else {
for (mp1 = modList; mp1; mp1 = mp1->next)
if (mp1->next == mp) {
mp1->next = mp->next;
break;
}
}
free(mp->name);
free(mp);
return result;
}
static void terminate(void)
{
while (modList)
dlclose(modList);
}
/*
* Build the export table from the XCOFF .loader section.
*/
static int readExports(ModulePtr mp)
{
LDFILE *ldp = NULL;
SCNHDR sh, shdata;
LDHDR *lhp;
char *ldbuf;
LDSYM *ls;
int i;
ExportPtr ep;
struct ld_info *lp;
char *buf;
int size = 4 * 1024;
void *dataorg;
/*
* The module might be loaded due to the LIBPATH
* environment variable. Search for the loaded
* module using L_GETINFO.
*/
if ((buf = malloc(size)) == NULL) {
errvalid++;
strcpy(errbuf, "readExports: ");
strcat(errbuf, strerror(errno));
return -1;
}
while ((i = loadquery(L_GETINFO, buf, size)) == -1 && errno == ENOMEM) {
free(buf);
size += 4 * 1024;
if ((buf = malloc(size)) == NULL) {
errvalid++;
strcpy(errbuf, "readExports: ");
strcat(errbuf, strerror(errno));
return -1;
}
}
if (i == -1) {
errvalid++;
strcpy(errbuf, "readExports: ");
strcat(errbuf, strerror(errno));
free(buf);
return -1;
}
/*
* Traverse the list of loaded modules. The entry point
* returned by load() does actually point to the TOC
* entry contained in the data segment.
*/
lp = (struct ld_info *) buf;
while (lp) {
if ((unsigned long) mp->entry >= (unsigned long) lp->ldinfo_dataorg &&
(unsigned long) mp->entry < (unsigned long) lp->ldinfo_dataorg +
lp->ldinfo_datasize) {
dataorg = lp->ldinfo_dataorg;
ldp = ldopen(lp->ldinfo_filename, ldp);
break;
}
if (lp->ldinfo_next == 0)
lp = NULL;
else
lp = (struct ld_info *) ((char *) lp + lp->ldinfo_next);
}
free(buf);
if (!ldp) {
errvalid++;
strcpy(errbuf, "readExports: ");
strcat(errbuf, strerror(errno));
return -1;
}
if (TYPE(ldp) != U802TOCMAGIC) {
errvalid++;
strcpy(errbuf, "readExports: bad magic");
while (ldclose(ldp) == FAILURE);
return -1;
}
/*
* Get the padding for the data section. This is needed for
* AIX 4.1 compilers. This is used when building the final
* function pointer to the exported symbol.
*/
if (ldnshread(ldp, _DATA, &shdata) != SUCCESS) {
errvalid++;
strcpy(errbuf, "readExports: cannot read data section header");
while (ldclose(ldp) == FAILURE);
return -1;
}
if (ldnshread(ldp, _LOADER, &sh) != SUCCESS) {
errvalid++;
strcpy(errbuf, "readExports: cannot read loader section header");
while (ldclose(ldp) == FAILURE);
return -1;
}
/*
* We read the complete loader section in one chunk, this makes
* finding long symbol names residing in the string table easier.
*/
if ((ldbuf = (char *) malloc(sh.s_size)) == NULL) {
errvalid++;
strcpy(errbuf, "readExports: ");
strcat(errbuf, strerror(errno));
while (ldclose(ldp) == FAILURE);
return -1;
}
if (FSEEK(ldp, sh.s_scnptr, BEGINNING) != OKFSEEK) {
errvalid++;
strcpy(errbuf, "readExports: cannot seek to loader section");
free(ldbuf);
while (ldclose(ldp) == FAILURE);
return -1;
}
if (FREAD(ldbuf, sh.s_size, 1, ldp) != 1) {
errvalid++;
strcpy(errbuf, "readExports: cannot read loader section");
free(ldbuf);
while (ldclose(ldp) == FAILURE);
return -1;
}
lhp = (LDHDR *) ldbuf;
ls = (LDSYM *) (ldbuf + LDHDRSZ);
/*
* Count the number of exports to include in our export table.
*/
for (i = lhp->l_nsyms; i; i--, ls++) {
if (!LDR_EXPORT(*ls))
continue;
mp->nExports++;
}
if ((mp->exports = (ExportPtr) calloc(mp->nExports, sizeof(*mp->exports))) == NULL) {
errvalid++;
strcpy(errbuf, "readExports: ");
strcat(errbuf, strerror(errno));
free(ldbuf);
while (ldclose(ldp) == FAILURE);
return -1;
}
/*
* Fill in the export table. All entries are relative to
* the beginning of the data origin.
*/
ep = mp->exports;
ls = (LDSYM *) (ldbuf + LDHDRSZ);
for (i = lhp->l_nsyms; i; i--, ls++) {
char *symname;
char tmpsym[SYMNMLEN + 1];
if (!LDR_EXPORT(*ls))
continue;
if (ls->l_zeroes == 0)
symname = ls->l_offset + lhp->l_stoff + ldbuf;
else {
/*
* The l_name member is not zero terminated, we
* must copy the first SYMNMLEN chars and make
* sure we have a zero byte at the end.
*/
strncpy(tmpsym, ls->l_name, SYMNMLEN);
tmpsym[SYMNMLEN] = '\0';
symname = tmpsym;
}
ep->name = strdup(symname);
ep->addr = (void *) ((unsigned long) dataorg +
ls->l_value - shdata.s_vaddr);
ep++;
}
free(ldbuf);
while (ldclose(ldp) == FAILURE);
return 0;
}
/*
* Find the main modules data origin. This is used as export pointer
* for loadbind() to be able to resolve references to the main part.
*/
static void *findMain(void)
{
struct ld_info *lp;
char *buf;
int size = 4 * 1024;
int i;
void *ret;
if ((buf = malloc(size)) == NULL) {
errvalid++;
strcpy(errbuf, "findMain: ");
strcat(errbuf, strerror(errno));
return NULL;
}
while ((i = loadquery(L_GETINFO, buf, size)) == -1 && errno == ENOMEM) {
free(buf);
size += 4 * 1024;
if ((buf = malloc(size)) == NULL) {
errvalid++;
strcpy(errbuf, "findMain: ");
strcat(errbuf, strerror(errno));
return NULL;
}
}
if (i == -1) {
errvalid++;
strcpy(errbuf, "findMain: ");
strcat(errbuf, strerror(errno));
free(buf);
return NULL;
}
/*
* The first entry is the main module. The data segment
* starts with the TOC entries for all exports, so the
* data segment origin works as argument for loadbind.
*/
lp = (struct ld_info *) buf;
ret = lp->ldinfo_dataorg;
free(buf);
return ret;
}
#endif

98
libs/apr/dso/beos/dso.c Normal file
View File

@@ -0,0 +1,98 @@
/* 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.
*/
#include "apr_arch_dso.h"
#include "apr_portable.h"
#if APR_HAS_DSO
static apr_status_t dso_cleanup(void *thedso)
{
apr_dso_handle_t *dso = thedso;
if (dso->handle > 0 && unload_add_on(dso->handle) < B_NO_ERROR)
return APR_EINIT;
dso->handle = -1;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *pool)
{
image_id newid = -1;
*res_handle = apr_pcalloc(pool, sizeof(*res_handle));
if((newid = load_add_on(path)) < B_NO_ERROR) {
(*res_handle)->errormsg = strerror(newid);
return APR_EDSOOPEN;
}
(*res_handle)->pool = pool;
(*res_handle)->handle = newid;
apr_pool_cleanup_register(pool, *res_handle, dso_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
{
return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup);
}
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_handle_t *handle,
const char *symname)
{
int err;
if (symname == NULL)
return APR_ESYMNOTFOUND;
err = get_image_symbol(handle->handle, symname, B_SYMBOL_TYPE_ANY,
ressym);
if(err != B_OK)
return APR_ESYMNOTFOUND;
return APR_SUCCESS;
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen)
{
strncpy(buffer, strerror(errno), buflen);
return buffer;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
{
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
(*aprdso)->handle = osdso;
(*aprdso)->pool = pool;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
apr_dso_handle_t *aprdso)
{
*osdso = aprdso->handle;
return APR_SUCCESS;
}
#endif

137
libs/apr/dso/netware/dso.c Normal file
View File

@@ -0,0 +1,137 @@
/* 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.
*/
#include "apr_arch_dso.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include <library.h>
#include <unistd.h>
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
{
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
(*aprdso)->handle = osdso;
(*aprdso)->pool = pool;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
apr_dso_handle_t *aprdso)
{
*osdso = aprdso->handle;
return APR_SUCCESS;
}
static apr_status_t dso_cleanup(void *thedso)
{
apr_dso_handle_t *dso = thedso;
sym_list *symbol = NULL;
void *NLMHandle = getnlmhandle();
if (dso->handle == NULL)
return APR_SUCCESS;
if (dso->symbols != NULL) {
symbol = dso->symbols;
while (symbol) {
UnImportPublicObject(NLMHandle, symbol->symbol);
symbol = symbol->next;
}
}
if (dlclose(dso->handle) != 0)
return APR_EINIT;
dso->handle = NULL;
dso->symbols = NULL;
dso->path = NULL;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *pool)
{
void *os_handle = NULL;
char *fullpath = NULL;
apr_status_t rv;
if ((rv = apr_filepath_merge(&fullpath, NULL, path,
APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) {
return rv;
}
os_handle = dlopen(fullpath, RTLD_NOW | RTLD_LOCAL);
*res_handle = apr_pcalloc(pool, sizeof(**res_handle));
if(os_handle == NULL) {
(*res_handle)->errormsg = dlerror();
return APR_EDSOOPEN;
}
(*res_handle)->handle = (void*)os_handle;
(*res_handle)->pool = pool;
(*res_handle)->errormsg = NULL;
(*res_handle)->symbols = NULL;
(*res_handle)->path = apr_pstrdup(pool, fullpath);
apr_pool_cleanup_register(pool, *res_handle, dso_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
{
return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup);
}
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
apr_dso_handle_t *handle,
const char *symname)
{
sym_list *symbol = NULL;
void *retval = dlsym(handle->handle, symname);
if (retval == NULL) {
handle->errormsg = dlerror();
return APR_ESYMNOTFOUND;
}
symbol = apr_pcalloc(handle->pool, sizeof(sym_list));
symbol->next = handle->symbols;
handle->symbols = symbol;
symbol->symbol = apr_pstrdup(handle->pool, symname);
*ressym = retval;
return APR_SUCCESS;
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer,
apr_size_t buflen)
{
if (dso->errormsg) {
apr_cpystrn(buffer, dso->errormsg, buflen);
return dso->errormsg;
}
return "No Error";
}

132
libs/apr/dso/os2/dso.c Normal file
View File

@@ -0,0 +1,132 @@
/* 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.
*/
#include "apr_arch_dso.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include <stdio.h>
#include <string.h>
#if APR_HAS_DSO
static apr_status_t dso_cleanup(void *thedso)
{
apr_dso_handle_t *dso = thedso;
int rc;
if (dso->handle == 0)
return APR_SUCCESS;
rc = DosFreeModule(dso->handle);
if (rc == 0)
dso->handle = 0;
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, const char *path, apr_pool_t *ctx)
{
char failed_module[200];
HMODULE handle;
int rc;
*res_handle = apr_pcalloc(ctx, sizeof(**res_handle));
(*res_handle)->cont = ctx;
(*res_handle)->load_error = APR_SUCCESS;
(*res_handle)->failed_module = NULL;
if ((rc = DosLoadModule(failed_module, sizeof(failed_module), path, &handle)) != 0) {
(*res_handle)->load_error = APR_FROM_OS_ERROR(rc);
(*res_handle)->failed_module = apr_pstrdup(ctx, failed_module);
return APR_FROM_OS_ERROR(rc);
}
(*res_handle)->handle = handle;
apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
{
return apr_pool_cleanup_run(handle->cont, handle, dso_cleanup);
}
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
apr_dso_handle_t *handle,
const char *symname)
{
PFN func;
int rc;
if (symname == NULL || ressym == NULL)
return APR_ESYMNOTFOUND;
if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0) {
handle->load_error = APR_FROM_OS_ERROR(rc);
return handle->load_error;
}
*ressym = func;
return APR_SUCCESS;
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen)
{
char message[200];
apr_strerror(dso->load_error, message, sizeof(message));
if (dso->failed_module != NULL) {
strcat(message, " (");
strcat(message, dso->failed_module);
strcat(message, ")");
}
apr_cpystrn(buffer, message, buflen);
return buffer;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
{
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
(*aprdso)->handle = osdso;
(*aprdso)->cont = pool;
(*aprdso)->load_error = APR_SUCCESS;
(*aprdso)->failed_module = NULL;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
apr_dso_handle_t *aprdso)
{
*osdso = aprdso->handle;
return APR_SUCCESS;
}
#endif

109
libs/apr/dso/os390/dso.c Normal file
View File

@@ -0,0 +1,109 @@
/* 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.
*/
#include "apr_portable.h"
#include "apr_strings.h"
#include "apr_arch_dso.h"
#include <errno.h>
#include <string.h>
#if APR_HAS_DSO
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
{
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
(*aprdso)->handle = osdso;
(*aprdso)->pool = pool;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
apr_dso_handle_t *aprdso)
{
*osdso = aprdso->handle;
return APR_SUCCESS;
}
static apr_status_t dso_cleanup(void *thedso)
{
apr_dso_handle_t *dso = thedso;
int rc;
if (dso->handle == 0)
return APR_SUCCESS;
rc = dllfree(dso->handle);
if (rc == 0) {
dso->handle = 0;
return APR_SUCCESS;
}
dso->failing_errno = errno;
return errno;
}
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *ctx)
{
dllhandle *handle;
int rc;
*res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
(*res_handle)->pool = ctx;
if ((handle = dllload(path)) != NULL) {
(*res_handle)->handle = handle;
apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
(*res_handle)->failing_errno = errno;
return errno;
}
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
{
return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup);
}
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
apr_dso_handle_t *handle,
const char *symname)
{
void *func_ptr;
void *var_ptr;
if ((var_ptr = dllqueryvar(handle->handle, symname)) != NULL) {
*ressym = var_ptr;
return APR_SUCCESS;
}
if ((func_ptr = (void *)dllqueryfn(handle->handle, symname)) != NULL) {
*ressym = func_ptr;
return APR_SUCCESS;
}
handle->failing_errno = errno;
return errno;
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *handle, char *buffer,
apr_size_t buflen)
{
apr_cpystrn(buffer, strerror(handle->failing_errno), buflen);
return buffer;
}
#endif

251
libs/apr/dso/unix/dso.c Normal file
View File

@@ -0,0 +1,251 @@
/* 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.
*/
#include "apr_arch_dso.h"
#include "apr_strings.h"
#include "apr_portable.h"
#if APR_HAS_DSO
#if !defined(DSO_USE_DLFCN) && !defined(DSO_USE_SHL) && !defined(DSO_USE_DYLD)
#error No DSO implementation specified.
#endif
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
#if APR_HAVE_STDLIB_H
#include <stdlib.h> /* malloc(), free() */
#endif
#if APR_HAVE_STRING_H
#include <string.h> /* for strerror() on HP-UX */
#endif
#if defined(DSO_USE_DYLD)
#define DYLD_LIBRARY_HANDLE (void *)-1
#endif
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
{
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
(*aprdso)->handle = osdso;
(*aprdso)->pool = pool;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
apr_dso_handle_t *aprdso)
{
*osdso = aprdso->handle;
return APR_SUCCESS;
}
static apr_status_t dso_cleanup(void *thedso)
{
apr_dso_handle_t *dso = thedso;
if (dso->handle == NULL)
return APR_SUCCESS;
#if defined(DSO_USE_SHL)
shl_unload((shl_t)dso->handle);
#elif defined(DSO_USE_DYLD)
if (dso->handle != DYLD_LIBRARY_HANDLE) {
NSUnLinkModule(dso->handle, FALSE);
}
#elif defined(DSO_USE_DLFCN)
if (dlclose(dso->handle) != 0)
return APR_EINIT;
#endif
dso->handle = NULL;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *pool)
{
#if defined(DSO_USE_SHL)
shl_t os_handle = shl_load(path, BIND_IMMEDIATE, 0L);
#elif defined(DSO_USE_DYLD)
NSObjectFileImage image;
NSModule os_handle = NULL;
NSObjectFileImageReturnCode dsoerr;
const char* err_msg = NULL;
dsoerr = NSCreateObjectFileImageFromFile(path, &image);
if (dsoerr == NSObjectFileImageSuccess) {
#if defined(NSLINKMODULE_OPTION_RETURN_ON_ERROR) && defined(NSLINKMODULE_OPTION_NONE)
os_handle = NSLinkModule(image, path,
NSLINKMODULE_OPTION_RETURN_ON_ERROR |
NSLINKMODULE_OPTION_NONE);
/* If something went wrong, get the errors... */
if (!os_handle) {
NSLinkEditErrors errors;
int errorNumber;
const char *fileName;
NSLinkEditError(&errors, &errorNumber, &fileName, &err_msg);
}
#else
os_handle = NSLinkModule(image, path, FALSE);
#endif
NSDestroyObjectFileImage(image);
}
else if ((dsoerr == NSObjectFileImageFormat ||
dsoerr == NSObjectFileImageInappropriateFile) &&
NSAddLibrary(path) == TRUE) {
os_handle = (NSModule)DYLD_LIBRARY_HANDLE;
}
else {
err_msg = "cannot create object file image or add library";
}
#elif defined(DSO_USE_DLFCN)
#if defined(OSF1) || defined(SEQUENT) || defined(SNI) ||\
(defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)) ||\
defined(__DragonFly__)
void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL);
#else
int flags = RTLD_NOW | RTLD_GLOBAL;
void *os_handle;
#ifdef _AIX
if (strchr(path + 1, '(') && path[strlen(path) - 1] == ')')
{
/* This special archive.a(dso.so) syntax is required for
* the way libtool likes to build shared libraries on AIX.
* dlopen() support for such a library requires that the
* RTLD_MEMBER flag be enabled.
*/
flags |= RTLD_MEMBER;
}
#endif
os_handle = dlopen(path, flags);
#endif
#endif /* DSO_USE_x */
*res_handle = apr_pcalloc(pool, sizeof(**res_handle));
if(os_handle == NULL) {
#if defined(DSO_USE_SHL)
(*res_handle)->errormsg = strerror(errno);
return APR_EDSOOPEN;
#elif defined(DSO_USE_DYLD)
(*res_handle)->errormsg = (err_msg) ? err_msg : "link failed";
return APR_EDSOOPEN;
#elif defined(DSO_USE_DLFCN)
(*res_handle)->errormsg = dlerror();
return APR_EDSOOPEN;
#endif
}
(*res_handle)->handle = (void*)os_handle;
(*res_handle)->pool = pool;
(*res_handle)->errormsg = NULL;
apr_pool_cleanup_register(pool, *res_handle, dso_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
{
return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup);
}
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
apr_dso_handle_t *handle,
const char *symname)
{
#if defined(DSO_USE_SHL)
void *symaddr = NULL;
int status;
errno = 0;
status = shl_findsym((shl_t *)&handle->handle, symname, TYPE_PROCEDURE, &symaddr);
if (status == -1 && errno == 0) /* try TYPE_DATA instead */
status = shl_findsym((shl_t *)&handle->handle, symname, TYPE_DATA, &symaddr);
if (status == -1)
return APR_ESYMNOTFOUND;
*ressym = symaddr;
return APR_SUCCESS;
#elif defined(DSO_USE_DYLD)
void *retval = NULL;
NSSymbol symbol;
char *symname2 = (char*)malloc(sizeof(char)*(strlen(symname)+2));
sprintf(symname2, "_%s", symname);
#ifdef NSLINKMODULE_OPTION_PRIVATE
if (handle->handle == DYLD_LIBRARY_HANDLE) {
symbol = NSLookupAndBindSymbol(symname2);
}
else {
symbol = NSLookupSymbolInModule((NSModule)handle->handle, symname2);
}
#else
symbol = NSLookupAndBindSymbol(symname2);
#endif
free(symname2);
if (symbol == NULL) {
handle->errormsg = "undefined symbol";
return APR_ESYMNOTFOUND;
}
retval = NSAddressOfSymbol(symbol);
if (retval == NULL) {
handle->errormsg = "cannot resolve symbol";
return APR_ESYMNOTFOUND;
}
*ressym = retval;
return APR_SUCCESS;
#elif defined(DSO_USE_DLFCN)
#if defined(DLSYM_NEEDS_UNDERSCORE)
void *retval;
char *symbol = (char*)malloc(sizeof(char)*(strlen(symname)+2));
sprintf(symbol, "_%s", symname);
retval = dlsym(handle->handle, symbol);
free(symbol);
#elif defined(SEQUENT) || defined(SNI)
void *retval = dlsym(handle->handle, (char *)symname);
#else
void *retval = dlsym(handle->handle, symname);
#endif /* DLSYM_NEEDS_UNDERSCORE */
if (retval == NULL) {
handle->errormsg = dlerror();
return APR_ESYMNOTFOUND;
}
*ressym = retval;
return APR_SUCCESS;
#endif /* DSO_USE_x */
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer,
apr_size_t buflen)
{
if (dso->errormsg) {
apr_cpystrn(buffer, dso->errormsg, buflen);
return dso->errormsg;
}
return "No Error";
}
#endif

167
libs/apr/dso/win32/dso.c Normal file
View File

@@ -0,0 +1,167 @@
/* 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.
*/
#include "apr_arch_dso.h"
#include "apr_strings.h"
#include "apr_private.h"
#include "apr_arch_file_io.h"
#include "apr_arch_utf8.h"
#if APR_HAS_DSO
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
{
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
(*aprdso)->handle = osdso;
(*aprdso)->cont = pool;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
apr_dso_handle_t *aprdso)
{
*osdso = aprdso->handle;
return APR_SUCCESS;
}
static apr_status_t dso_cleanup(void *thedso)
{
apr_dso_handle_t *dso = thedso;
if (dso->handle != NULL && !FreeLibrary(dso->handle)) {
return apr_get_os_error();
}
dso->handle = NULL;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle,
const char *path, apr_pool_t *ctx)
{
HINSTANCE os_handle;
apr_status_t rv;
#ifndef _WIN32_WCE
UINT em;
#endif
#if APR_HAS_UNICODE_FS
IF_WIN_OS_IS_UNICODE
{
apr_wchar_t wpath[APR_PATH_MAX];
if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath)
/ sizeof(apr_wchar_t), path))
!= APR_SUCCESS) {
*res_handle = apr_pcalloc(ctx, sizeof(**res_handle));
return ((*res_handle)->load_error = rv);
}
/* Prevent ugly popups from killing our app */
#ifndef _WIN32_WCE
em = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
os_handle = LoadLibraryExW(wpath, NULL, 0);
if (!os_handle)
os_handle = LoadLibraryExW(wpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (!os_handle)
rv = apr_get_os_error();
#ifndef _WIN32_WCE
SetErrorMode(em);
#endif
}
#endif /* APR_HAS_UNICODE_FS */
#if APR_HAS_ANSI_FS
ELSE_WIN_OS_IS_ANSI
{
char fspec[APR_PATH_MAX], *p = fspec;
/* Must convert path from / to \ notation.
* Per PR2555, the LoadLibraryEx function is very picky about slashes.
* Debugging on NT 4 SP 6a reveals First Chance Exception within NTDLL.
* LoadLibrary in the MS PSDK also reveals that it -explicitly- states
* that backslashes must be used for the LoadLibrary family of calls.
*/
apr_cpystrn(fspec, path, sizeof(fspec));
while ((p = strchr(p, '/')) != NULL)
*p = '\\';
/* Prevent ugly popups from killing our app */
em = SetErrorMode(SEM_FAILCRITICALERRORS);
os_handle = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (!os_handle)
os_handle = LoadLibraryEx(path, NULL, 0);
if (!os_handle)
rv = apr_get_os_error();
else
rv = APR_SUCCESS;
SetErrorMode(em);
}
#endif
*res_handle = apr_pcalloc(ctx, sizeof(**res_handle));
(*res_handle)->cont = ctx;
if (rv) {
return ((*res_handle)->load_error = rv);
}
(*res_handle)->handle = (void*)os_handle;
(*res_handle)->load_error = APR_SUCCESS;
apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dso_unload(struct apr_dso_handle_t *handle)
{
return apr_pool_cleanup_run(handle->cont, handle, dso_cleanup);
}
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
struct apr_dso_handle_t *handle,
const char *symname)
{
#ifdef _WIN32_WCE
apr_size_t symlen = strlen(symname) + 1;
apr_size_t wsymlen = 256;
apr_wchar_t wsymname[256];
apr_status_t rv;
rv = apr_conv_utf8_to_ucs2(wsymname, &wsymlen, symname, &symlen);
if (rv != APR_SUCCESS) {
return rv;
}
else if (symlen) {
return APR_ENAMETOOLONG;
}
*ressym = (apr_dso_handle_sym_t)GetProcAddressW(handle->handle, wsymname);
#else
*ressym = (apr_dso_handle_sym_t)GetProcAddress(handle->handle, symname);
#endif
if (!*ressym) {
return apr_get_os_error();
}
return APR_SUCCESS;
}
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize)
{
return apr_strerror(dso->load_error, buf, bufsize);
}
#endif

15
libs/apr/emacs-mode Normal file
View File

@@ -0,0 +1,15 @@
;; M-x load-file <this file>
;; or emacs -l <this file>
;; to use this style: C-c . apache
(c-add-style "apache"
'((inclass . ++)
(defun-block-intro . ++)
(statement-block-intro . ++)
(substatement . ++)
(brace-list-intro . ++)
(statement-case-intro . ++)
(inextern-lang . 0)
))
(setq-default indent-tabs-mode nil)
;; if you forgot to do this at startup, then M-x eval-expression
;; (setq indent-tabs-mode nil) on each buffer

View File

@@ -0,0 +1,4 @@
/* NetWare & Win32 have much in common with regards to file names (both are
* DOSish) so it makes sense to share some code
*/
#include "../win32/filepath.c"

View File

@@ -0,0 +1,389 @@
/* 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.
*/
#include "apr_arch_file_io.h"
#include "fsio.h"
#include "nks/dirio.h"
#include "apr_file_io.h"
#include "apr_general.h"
#include "apr_strings.h"
#include "apr_errno.h"
#include "apr_hash.h"
#include "apr_thread_rwlock.h"
#ifdef HAVE_UTIME_H
#include <utime.h>
#endif
#define APR_HAS_PSA
static apr_filetype_e filetype_from_mode(mode_t mode)
{
apr_filetype_e type = APR_NOFILE;
if (S_ISREG(mode))
type = APR_REG;
else if (S_ISDIR(mode))
type = APR_DIR;
else if (S_ISCHR(mode))
type = APR_CHR;
else if (S_ISBLK(mode))
type = APR_BLK;
else if (S_ISFIFO(mode))
type = APR_PIPE;
else if (S_ISLNK(mode))
type = APR_LNK;
else if (S_ISSOCK(mode))
type = APR_SOCK;
else
type = APR_UNKFILE;
return type;
}
static void fill_out_finfo(apr_finfo_t *finfo, struct stat *info,
apr_int32_t wanted)
{
finfo->valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK
| APR_FINFO_OWNER | APR_FINFO_PROT;
finfo->protection = apr_unix_mode2perms(info->st_mode);
finfo->filetype = filetype_from_mode(info->st_mode);
finfo->user = info->st_uid;
finfo->group = info->st_gid;
finfo->size = info->st_size;
finfo->inode = info->st_ino;
finfo->device = info->st_dev;
finfo->nlink = info->st_nlink;
apr_time_ansi_put(&finfo->atime, info->st_atime.tv_sec);
apr_time_ansi_put(&finfo->mtime, info->st_mtime.tv_sec);
apr_time_ansi_put(&finfo->ctime, info->st_ctime.tv_sec);
/* ### needs to be revisited
* if (wanted & APR_FINFO_CSIZE) {
* finfo->csize = info->st_blocks * 512;
* finfo->valid |= APR_FINFO_CSIZE;
* }
*/
}
APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo,
apr_int32_t wanted,
apr_file_t *thefile)
{
struct stat info;
if (thefile->buffered) {
apr_status_t rv = apr_file_flush(thefile);
if (rv != APR_SUCCESS)
return rv;
}
if (fstat(thefile->filedes, &info) == 0) {
finfo->pool = thefile->pool;
finfo->fname = thefile->fname;
fill_out_finfo(finfo, &info, wanted);
return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
}
else {
return errno;
}
}
APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
apr_fileperms_t perms)
{
mode_t mode = apr_unix_perms2mode(perms);
if (chmod(fname, mode) == -1)
return errno;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
apr_fileattrs_t attributes,
apr_fileattrs_t attr_mask,
apr_pool_t *pool)
{
apr_status_t status;
apr_finfo_t finfo;
/* Don't do anything if we can't handle the requested attributes */
if (!(attr_mask & (APR_FILE_ATTR_READONLY
| APR_FILE_ATTR_EXECUTABLE)))
return APR_SUCCESS;
status = apr_stat(&finfo, fname, APR_FINFO_PROT, pool);
if (status)
return status;
/* ### TODO: should added bits be umask'd? */
if (attr_mask & APR_FILE_ATTR_READONLY)
{
if (attributes & APR_FILE_ATTR_READONLY)
{
finfo.protection &= ~APR_UWRITE;
finfo.protection &= ~APR_GWRITE;
finfo.protection &= ~APR_WWRITE;
}
else
{
/* ### umask this! */
finfo.protection |= APR_UWRITE;
finfo.protection |= APR_GWRITE;
finfo.protection |= APR_WWRITE;
}
}
if (attr_mask & APR_FILE_ATTR_EXECUTABLE)
{
if (attributes & APR_FILE_ATTR_EXECUTABLE)
{
/* ### umask this! */
finfo.protection |= APR_UEXECUTE;
finfo.protection |= APR_GEXECUTE;
finfo.protection |= APR_WEXECUTE;
}
else
{
finfo.protection &= ~APR_UEXECUTE;
finfo.protection &= ~APR_GEXECUTE;
finfo.protection &= ~APR_WEXECUTE;
}
}
return apr_file_perms_set(fname, finfo.protection);
}
#ifndef APR_HAS_PSA
static apr_status_t stat_cache_cleanup(void *data)
{
apr_pool_t *p = (apr_pool_t *)getGlobalPool();
apr_hash_index_t *hi;
apr_hash_t *statCache = (apr_hash_t*)data;
char *key;
apr_ssize_t keylen;
NXPathCtx_t pathctx;
for (hi = apr_hash_first(p, statCache); hi; hi = apr_hash_next(hi)) {
apr_hash_this(hi, (const void**)&key, &keylen, (void**)&pathctx);
if (pathctx) {
NXFreePathContext(pathctx);
}
}
return APR_SUCCESS;
}
int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestmap, apr_pool_t *p)
{
apr_pool_t *gPool = (apr_pool_t *)getGlobalPool();
apr_hash_t *statCache = NULL;
apr_thread_rwlock_t *rwlock = NULL;
NXPathCtx_t pathctx = 0;
char *ptr = NULL, *tr;
int len = 0, x;
char *ppath;
char *pinfo;
if (ctx == 1) {
/* If there isn't a global pool then just stat the file
and return */
if (!gPool) {
char poolname[50];
if (apr_pool_create(&gPool, NULL) != APR_SUCCESS) {
return getstat(ctx, path, buf, requestmap);
}
setGlobalPool(gPool);
apr_pool_tag(gPool, apr_pstrdup(gPool, "cstat_mem_pool"));
statCache = apr_hash_make(gPool);
apr_pool_userdata_set ((void*)statCache, "STAT_CACHE", stat_cache_cleanup, gPool);
apr_thread_rwlock_create(&rwlock, gPool);
apr_pool_userdata_set ((void*)rwlock, "STAT_CACHE_LOCK", apr_pool_cleanup_null, gPool);
}
else {
apr_pool_userdata_get((void**)&statCache, "STAT_CACHE", gPool);
apr_pool_userdata_get((void**)&rwlock, "STAT_CACHE_LOCK", gPool);
}
if (!gPool || !statCache || !rwlock) {
return getstat(ctx, path, buf, requestmap);
}
for (x = 0,tr = path;*tr != '\0';tr++,x++) {
if (*tr == '\\' || *tr == '/') {
ptr = tr;
len = x;
}
if (*tr == ':') {
ptr = "\\";
len = x;
}
}
if (ptr) {
ppath = apr_pstrndup (p, path, len);
strlwr(ppath);
if (ptr[1] != '\0') {
ptr++;
}
/* If the path ended in a trailing slash then our result path
will be a single slash. To avoid stat'ing the root with a
slash, we need to make sure we stat the current directory
with a dot */
if (((*ptr == '/') || (*ptr == '\\')) && (*(ptr+1) == '\0')) {
pinfo = apr_pstrdup (p, ".");
}
else {
pinfo = apr_pstrdup (p, ptr);
}
}
/* If we have a statCache then try to pull the information
from the cache. Otherwise just stat the file and return.*/
if (statCache) {
apr_thread_rwlock_rdlock(rwlock);
pathctx = (NXPathCtx_t) apr_hash_get(statCache, ppath, APR_HASH_KEY_STRING);
apr_thread_rwlock_unlock(rwlock);
if (pathctx) {
return getstat(pathctx, pinfo, buf, requestmap);
}
else {
int err;
err = NXCreatePathContext(0, ppath, 0, NULL, &pathctx);
if (!err) {
apr_thread_rwlock_wrlock(rwlock);
apr_hash_set(statCache, apr_pstrdup(gPool,ppath) , APR_HASH_KEY_STRING, (void*)pathctx);
apr_thread_rwlock_unlock(rwlock);
return getstat(pathctx, pinfo, buf, requestmap);
}
}
}
}
return getstat(ctx, path, buf, requestmap);
}
#endif
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo,
const char *fname,
apr_int32_t wanted, apr_pool_t *pool)
{
struct stat info;
int srv;
NXPathCtx_t pathCtx = 0;
getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD);
#ifdef APR_HAS_PSA
srv = getstat(pathCtx, (char*)fname, &info, ST_STAT_BITS|ST_NAME_BIT);
#else
srv = cstat(pathCtx, (char*)fname, &info, ST_STAT_BITS|ST_NAME_BIT, pool);
#endif
errno = srv;
if (srv == 0) {
finfo->pool = pool;
finfo->fname = fname;
fill_out_finfo(finfo, &info, wanted);
if (wanted & APR_FINFO_LINK)
wanted &= ~APR_FINFO_LINK;
if (wanted & APR_FINFO_NAME) {
finfo->name = apr_pstrdup(pool, info.st_name);
finfo->valid |= APR_FINFO_NAME;
}
return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
}
else {
#if !defined(ENOENT) || !defined(ENOTDIR)
#error ENOENT || ENOTDIR not defined; please see the
#error comments at this line in the source for a workaround.
/*
* If ENOENT || ENOTDIR is not defined in one of the your OS's
* include files, APR cannot report a good reason why the stat()
* of the file failed; there are cases where it can fail even though
* the file exists. This opens holes in Apache, for example, because
* it becomes possible for someone to get a directory listing of a
* directory even though there is an index (eg. index.html) file in
* it. If you do not have a problem with this, delete the above
* #error lines and start the compile again. If you need to do this,
* please submit a bug report to http://www.apache.org/bug_report.html
* letting us know that you needed to do this. Please be sure to
* include the operating system you are using.
*/
/* WARNING: All errors will be handled as not found
*/
#if !defined(ENOENT)
return APR_ENOENT;
#else
/* WARNING: All errors but not found will be handled as not directory
*/
if (errno != ENOENT)
return APR_ENOENT;
else
return errno;
#endif
#else /* All was defined well, report the usual: */
return errno;
#endif
}
}
APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
apr_time_t mtime,
apr_pool_t *pool)
{
apr_status_t status;
apr_finfo_t finfo;
status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool);
if (status) {
return status;
}
#ifdef HAVE_UTIMES
{
struct timeval tvp[2];
tvp[0].tv_sec = apr_time_sec(finfo.atime);
tvp[0].tv_usec = apr_time_usec(finfo.atime);
tvp[1].tv_sec = apr_time_sec(mtime);
tvp[1].tv_usec = apr_time_usec(mtime);
if (utimes(fname, tvp) == -1) {
return errno;
}
}
#elif defined(HAVE_UTIME)
{
struct utimbuf buf;
buf.actime = (time_t) (finfo.atime / APR_USEC_PER_SEC);
buf.modtime = (time_t) (mtime / APR_USEC_PER_SEC);
if (utime(fname, &buf) == -1) {
return errno;
}
}
#else
return APR_ENOTIMPL;
#endif
return APR_SUCCESS;
}

View File

@@ -0,0 +1,106 @@
/* 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.
*/
#include "apr.h"
#include "apr_arch_file_io.h"
#include "apr_strings.h"
apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p)
{
/* See the Windows code to figure out what to do here.
It probably checks to make sure that the root exists
and case it correctly according to the file system.
*/
*rootpath = apr_pstrdup(p, root);
return APR_SUCCESS;
}
apr_status_t filepath_has_drive(const char *rootpath, int only, apr_pool_t *p)
{
char *s;
if (rootpath) {
s = strchr (rootpath, ':');
if (only)
/* Test if the path only has a drive/volume and nothing else
*/
return (s && (s != rootpath) && !s[1]);
else
/* Test if the path includes a drive/volume
*/
return (s && (s != rootpath));
}
return 0;
}
apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p)
{
char *s1, *s2;
if (path1 && path2) {
s1 = strchr (path1, ':');
s2 = strchr (path2, ':');
/* Make sure that they both have a drive/volume delimiter
and are the same size. Then see if they match.
*/
if (s1 && s2 && ((s1-path1) == (s2-path2))) {
return strnicmp (s1, s2, s1-path1);
}
}
return -1;
}
APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags,
apr_pool_t *p)
{
char path[APR_PATH_MAX];
char *ptr;
/* use getcwdpath to make sure that we get the volume name*/
if (!getcwdpath(path, NULL, 0)) {
if (errno == ERANGE)
return APR_ENAMETOOLONG;
else
return errno;
}
/* Strip off the server name if there is one*/
ptr = strpbrk(path, "\\/:");
if (!ptr) {
return APR_ENOENT;
}
if (*ptr == ':') {
ptr = path;
}
*rootpath = apr_pstrdup(p, ptr);
if (!(flags & APR_FILEPATH_NATIVE)) {
for (ptr = *rootpath; *ptr; ++ptr) {
if (*ptr == '\\')
*ptr = '/';
}
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath,
apr_pool_t *p)
{
if (chdir2(rootpath) != 0)
return errno;
return APR_SUCCESS;
}

View File

@@ -0,0 +1,39 @@
/* 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.
*/
#include <nks/fsio.h>
#include "apr_arch_file_io.h"
apr_status_t apr_file_lock(apr_file_t *thefile, int type)
{
int fc;
fc = (type & APR_FLOCK_NONBLOCK) ? NX_RANGE_LOCK_TRYLOCK : NX_RANGE_LOCK_CHECK;
if(NXFileRangeLock(thefile->filedes,fc, 0, 0) == -1)
return errno;
return APR_SUCCESS;
}
apr_status_t apr_file_unlock(apr_file_t *thefile)
{
if(NXFileRangeUnlock(thefile->filedes,NX_RANGE_LOCK_CANCEL,0 , 0) == -1)
return errno;
return APR_SUCCESS;
}

View File

@@ -0,0 +1,50 @@
/* 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.
*/
#include "apr_private.h"
#include "apr_file_io.h" /* prototype of apr_mkstemp() */
#include "apr_strings.h" /* prototype of apr_mkstemp() */
#include "apr_arch_file_io.h" /* prototype of apr_mkstemp() */
#include "apr_portable.h" /* for apr_os_file_put() */
#include <stdlib.h> /* for mkstemp() - Single Unix */
APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_int32_t flags, apr_pool_t *p)
{
int fd;
apr_status_t rv;
flags = (!flags) ? APR_CREATE | APR_READ | APR_WRITE |
APR_DELONCLOSE : flags & ~APR_EXCL;
fd = mkstemp(template);
if (fd == -1) {
return errno;
}
/* We need to reopen the file to get rid of the o_excl flag.
* Otherwise file locking will not allow the file to be shared.
*/
close(fd);
if ((rv = apr_file_open(fp, template, flags|APR_FILE_NOCLEANUP,
APR_UREAD | APR_UWRITE, p)) == APR_SUCCESS) {
apr_pool_cleanup_register((*fp)->pool, (void *)(*fp),
apr_unix_file_cleanup, apr_unix_file_cleanup);
}
return rv;
}

View File

@@ -0,0 +1,187 @@
/* 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.
*/
#include <stdio.h>
#include <nks/fsio.h>
#include <nks/errno.h>
#include "apr_arch_file_io.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_arch_inherit.h"
static apr_status_t pipeblock(apr_file_t *thepipe)
{
#ifdef USE_FLAGS
int err;
unsigned long flags;
if (fcntl(thepipe->filedes, F_GETFL, &flags) != -1)
{
flags &= ~FNDELAY;
fcntl(thepipe->filedes, F_SETFL, flags);
}
#else
errno = 0;
fcntl(thepipe->filedes, F_SETFL, 0);
#endif
if (errno)
return errno;
thepipe->blocking = BLK_ON;
return APR_SUCCESS;
}
static apr_status_t pipenonblock(apr_file_t *thepipe)
{
#ifdef USE_FLAGS
int err;
unsigned long flags;
errno = 0;
if (fcntl(thepipe->filedes, F_GETFL, &flags) != -1)
{
flags |= FNDELAY;
fcntl(thepipe->filedes, F_SETFL, flags);
}
#else
errno = 0;
fcntl(thepipe->filedes, F_SETFL, FNDELAY);
#endif
if (errno)
return errno;
thepipe->blocking = BLK_OFF;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout)
{
if (thepipe->is_pipe == 1) {
thepipe->timeout = timeout;
if (timeout >= 0) {
if (thepipe->blocking != BLK_OFF) { /* blocking or unknown state */
return pipenonblock(thepipe);
}
}
else {
if (thepipe->blocking != BLK_ON) { /* non-blocking or unknown state */
return pipeblock(thepipe);
}
}
return APR_SUCCESS;
}
return APR_EINVAL;
}
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout)
{
if (thepipe->is_pipe == 1) {
*timeout = thepipe->timeout;
return APR_SUCCESS;
}
return APR_EINVAL;
}
APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
apr_os_file_t *thefile,
int register_cleanup,
apr_pool_t *pool)
{
int *dafile = thefile;
(*file) = apr_pcalloc(pool, sizeof(apr_file_t));
(*file)->pool = pool;
(*file)->eof_hit = 0;
(*file)->is_pipe = 1;
(*file)->blocking = BLK_UNKNOWN; /* app needs to make a timeout call */
(*file)->timeout = -1;
(*file)->ungetchar = -1; /* no char avail */
(*file)->filedes = *dafile;
if (!register_cleanup) {
(*file)->flags = APR_FILE_NOCLEANUP;
}
(*file)->buffered = 0;
#if APR_HAS_THREADS
(*file)->thlock = NULL;
#endif
if (register_cleanup) {
apr_pool_cleanup_register((*file)->pool, (void *)(*file),
apr_unix_file_cleanup,
apr_pool_cleanup_null);
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
apr_os_file_t *thefile,
apr_pool_t *pool)
{
return apr_os_pipe_put_ex(file, thefile, 0, pool);
}
APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool)
{
int filedes[2];
int err;
if (pipe(filedes) == -1) {
return errno;
}
(*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
(*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
(*in)->pool =
(*out)->pool = pool;
(*in)->filedes = filedes[0];
(*out)->filedes = filedes[1];
(*in)->flags = APR_INHERIT;
(*out)->flags = APR_INHERIT;
(*in)->is_pipe =
(*out)->is_pipe = 1;
(*out)->fname =
(*in)->fname = NULL;
(*in)->buffered =
(*out)->buffered = 0;
(*in)->blocking =
(*out)->blocking = BLK_ON;
(*in)->timeout =
(*out)->timeout = -1;
(*in)->ungetchar = -1;
(*in)->thlock =
(*out)->thlock = NULL;
(void) apr_pollset_create(&(*in)->pollset, 1, pool, 0);
(void) apr_pollset_create(&(*out)->pollset, 1, pool, 0);
apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup,
apr_pool_cleanup_null);
apr_pool_cleanup_register((*out)->pool, (void *)(*out), apr_unix_file_cleanup,
apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename,
apr_fileperms_t perm, apr_pool_t *pool)
{
return APR_ENOTIMPL;
}

View File

@@ -0,0 +1 @@
#include "../unix/copy.c"

167
libs/apr/file_io/os2/dir.c Normal file
View File

@@ -0,0 +1,167 @@
/* 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.
*/
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include <string.h>
static apr_status_t dir_cleanup(void *thedir)
{
apr_dir_t *dir = thedir;
return apr_dir_close(dir);
}
APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, apr_pool_t *pool)
{
apr_dir_t *thedir = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t));
if (thedir == NULL)
return APR_ENOMEM;
thedir->pool = pool;
thedir->dirname = apr_pstrdup(pool, dirname);
if (thedir->dirname == NULL)
return APR_ENOMEM;
thedir->handle = 0;
thedir->validentry = FALSE;
*new = thedir;
apr_pool_cleanup_register(pool, thedir, dir_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir)
{
int rv = 0;
if (thedir->handle) {
rv = DosFindClose(thedir->handle);
if (rv == 0) {
thedir->handle = 0;
}
}
return APR_FROM_OS_ERROR(rv);
}
APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
apr_dir_t *thedir)
{
int rv;
ULONG entries = 1;
if (thedir->handle == 0) {
thedir->handle = HDIR_CREATE;
rv = DosFindFirst(apr_pstrcat(thedir->pool, thedir->dirname, "/*", NULL), &thedir->handle,
FILE_ARCHIVED|FILE_DIRECTORY|FILE_SYSTEM|FILE_HIDDEN|FILE_READONLY,
&thedir->entry, sizeof(thedir->entry), &entries, FIL_STANDARD);
} else {
rv = DosFindNext(thedir->handle, &thedir->entry, sizeof(thedir->entry), &entries);
}
finfo->pool = thedir->pool;
finfo->fname = NULL;
finfo->valid = 0;
if (rv == 0 && entries == 1) {
thedir->validentry = TRUE;
/* We passed a name off the stack that has popped */
finfo->fname = NULL;
finfo->size = thedir->entry.cbFile;
finfo->csize = thedir->entry.cbFileAlloc;
/* Only directories & regular files show up in directory listings */
finfo->filetype = (thedir->entry.attrFile & FILE_DIRECTORY) ? APR_DIR : APR_REG;
apr_os2_time_to_apr_time(&finfo->mtime, thedir->entry.fdateLastWrite,
thedir->entry.ftimeLastWrite);
apr_os2_time_to_apr_time(&finfo->atime, thedir->entry.fdateLastAccess,
thedir->entry.ftimeLastAccess);
apr_os2_time_to_apr_time(&finfo->ctime, thedir->entry.fdateCreation,
thedir->entry.ftimeCreation);
finfo->name = thedir->entry.achName;
finfo->valid = APR_FINFO_NAME | APR_FINFO_MTIME | APR_FINFO_ATIME |
APR_FINFO_CTIME | APR_FINFO_TYPE | APR_FINFO_SIZE |
APR_FINFO_CSIZE;
return APR_SUCCESS;
}
thedir->validentry = FALSE;
if (rv)
return APR_FROM_OS_ERROR(rv);
return APR_ENOENT;
}
APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir)
{
return apr_dir_close(thedir);
}
APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
{
return APR_FROM_OS_ERROR(DosCreateDir(path, NULL));
}
APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool)
{
return APR_FROM_OS_ERROR(DosDeleteDir(path));
}
APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir)
{
if (dir == NULL) {
return APR_ENODIR;
}
*thedir = &dir->handle;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir, apr_os_dir_t *thedir,
apr_pool_t *pool)
{
if ((*dir) == NULL) {
(*dir) = (apr_dir_t *)apr_pcalloc(pool, sizeof(apr_dir_t));
(*dir)->pool = pool;
}
(*dir)->handle = *thedir;
return APR_SUCCESS;
}

View File

@@ -0,0 +1,86 @@
/* 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.
*/
#include "apr_file_io.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include <string.h>
#define IS_SEP(c) (c == '/' || c == '\\')
/* Remove trailing separators that don't affect the meaning of PATH. */
static const char *path_canonicalize(const char *path, apr_pool_t *pool)
{
/* At some point this could eliminate redundant components. For
* now, it just makes sure there is no trailing slash. */
apr_size_t len = strlen(path);
apr_size_t orig_len = len;
while ((len > 0) && IS_SEP(path[len - 1])) {
len--;
}
if (len != orig_len) {
return apr_pstrndup(pool, path, len);
}
else {
return path;
}
}
/* Remove one component off the end of PATH. */
static char *path_remove_last_component(const char *path, apr_pool_t *pool)
{
const char *newpath = path_canonicalize(path, pool);
int i;
for (i = strlen(newpath) - 1; i >= 0; i--) {
if (IS_SEP(path[i])) {
break;
}
}
return apr_pstrndup(pool, path, (i < 0) ? 0 : i);
}
apr_status_t apr_dir_make_recursive(const char *path, apr_fileperms_t perm,
apr_pool_t *pool)
{
apr_status_t apr_err = APR_SUCCESS;
apr_err = apr_dir_make(path, perm, pool); /* Try to make PATH right out */
if (APR_STATUS_IS_EEXIST(apr_err)) { /* It's OK if PATH exists */
return APR_SUCCESS;
}
if (APR_STATUS_IS_ENOENT(apr_err)) { /* Missing an intermediate dir */
char *dir;
dir = path_remove_last_component(path, pool);
apr_err = apr_dir_make_recursive(dir, perm, pool);
if (!apr_err) {
apr_err = apr_dir_make(path, perm, pool);
}
}
return apr_err;
}

View File

@@ -0,0 +1,18 @@
/* 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.
*/
#include "../unix/fileacc.c"

View File

@@ -0,0 +1,125 @@
/* 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.
*/
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include <string.h>
#include "apr_arch_inherit.h"
static apr_status_t file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p)
{
int rv;
apr_file_t *dup_file;
if (*new_file == NULL) {
dup_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t));
if (dup_file == NULL) {
return APR_ENOMEM;
}
dup_file->filedes = -1;
} else {
dup_file = *new_file;
}
dup_file->pool = p;
rv = DosDupHandle(old_file->filedes, &dup_file->filedes);
if (rv) {
return APR_FROM_OS_ERROR(rv);
}
dup_file->fname = apr_pstrdup(dup_file->pool, old_file->fname);
dup_file->buffered = old_file->buffered;
dup_file->isopen = old_file->isopen;
dup_file->flags = old_file->flags & ~APR_INHERIT;
/* TODO - dup pipes correctly */
dup_file->pipe = old_file->pipe;
if (*new_file == NULL) {
apr_pool_cleanup_register(dup_file->pool, dup_file, apr_file_cleanup,
apr_pool_cleanup_null);
*new_file = dup_file;
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p)
{
if (*new_file) {
apr_file_close(*new_file);
(*new_file)->filedes = -1;
}
return file_dup(new_file, old_file, p);
}
APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, apr_file_t *old_file, apr_pool_t *p)
{
return file_dup(&new_file, old_file, p);
}
APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
apr_file_t *old_file,
apr_pool_t *p)
{
*new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t));
memcpy(*new_file, old_file, sizeof(apr_file_t));
(*new_file)->pool = p;
if (old_file->buffered) {
(*new_file)->buffer = apr_palloc(p, APR_FILE_BUFSIZE);
if (old_file->direction == 1) {
memcpy((*new_file)->buffer, old_file->buffer, old_file->bufpos);
}
else {
memcpy((*new_file)->buffer, old_file->buffer, old_file->dataRead);
}
if (old_file->mutex) {
apr_thread_mutex_create(&((*new_file)->mutex),
APR_THREAD_MUTEX_DEFAULT, p);
apr_thread_mutex_destroy(old_file->mutex);
}
}
if (old_file->fname) {
(*new_file)->fname = apr_pstrdup(p, old_file->fname);
}
if (!(old_file->flags & APR_FILE_NOCLEANUP)) {
apr_pool_cleanup_register(p, (void *)(*new_file),
apr_file_cleanup,
apr_file_cleanup);
}
old_file->filedes = -1;
apr_pool_cleanup_kill(old_file->pool, (void *)old_file,
apr_file_cleanup);
return APR_SUCCESS;
}

View File

@@ -0,0 +1,16 @@
/* 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.
*/
#include "../win32/filepath.c"

View File

@@ -0,0 +1 @@
#include "../unix/filepath_util.c"

View File

@@ -0,0 +1,240 @@
/* 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.
*/
#define INCL_DOS
#define INCL_DOSERRORS
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include "apr_lib.h"
#include <sys/time.h>
#include "apr_strings.h"
static void FS3_to_finfo(apr_finfo_t *finfo, FILESTATUS3 *fstatus)
{
finfo->protection = (fstatus->attrFile & FILE_READONLY) ? 0x555 : 0x777;
if (fstatus->attrFile & FILE_DIRECTORY)
finfo->filetype = APR_DIR;
else
finfo->filetype = APR_REG;
/* XXX: No other possible types from FS3? */
finfo->user = 0;
finfo->group = 0;
finfo->inode = 0;
finfo->device = 0;
finfo->size = fstatus->cbFile;
finfo->csize = fstatus->cbFileAlloc;
apr_os2_time_to_apr_time(&finfo->atime, fstatus->fdateLastAccess,
fstatus->ftimeLastAccess );
apr_os2_time_to_apr_time(&finfo->mtime, fstatus->fdateLastWrite,
fstatus->ftimeLastWrite );
apr_os2_time_to_apr_time(&finfo->ctime, fstatus->fdateCreation,
fstatus->ftimeCreation );
finfo->valid = APR_FINFO_TYPE | APR_FINFO_PROT | APR_FINFO_SIZE
| APR_FINFO_CSIZE | APR_FINFO_MTIME
| APR_FINFO_CTIME | APR_FINFO_ATIME | APR_FINFO_LINK;
}
static apr_status_t handle_type(apr_filetype_e *ftype, HFILE file)
{
ULONG filetype, fileattr, rc;
rc = DosQueryHType(file, &filetype, &fileattr);
if (rc == 0) {
switch (filetype & 0xff) {
case 0:
*ftype = APR_REG;
break;
case 1:
*ftype = APR_CHR;
break;
case 2:
*ftype = APR_PIPE;
break;
default:
/* Brian, is this correct???
*/
*ftype = APR_UNKFILE;
break;
}
return APR_SUCCESS;
}
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t wanted,
apr_file_t *thefile)
{
ULONG rc;
FILESTATUS3 fstatus;
if (thefile->isopen) {
if (thefile->buffered) {
apr_status_t rv = apr_file_flush(thefile);
if (rv != APR_SUCCESS) {
return rv;
}
}
rc = DosQueryFileInfo(thefile->filedes, FIL_STANDARD, &fstatus, sizeof(fstatus));
}
else
rc = DosQueryPathInfo(thefile->fname, FIL_STANDARD, &fstatus, sizeof(fstatus));
if (rc == 0) {
FS3_to_finfo(finfo, &fstatus);
finfo->fname = thefile->fname;
if (finfo->filetype == APR_REG) {
if (thefile->isopen) {
return handle_type(&finfo->filetype, thefile->filedes);
}
} else {
return APR_SUCCESS;
}
}
finfo->protection = 0;
finfo->filetype = APR_NOFILE;
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, apr_fileperms_t perms)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
apr_int32_t wanted, apr_pool_t *cont)
{
ULONG rc;
FILESTATUS3 fstatus;
finfo->protection = 0;
finfo->filetype = APR_NOFILE;
finfo->name = NULL;
rc = DosQueryPathInfo(fname, FIL_STANDARD, &fstatus, sizeof(fstatus));
if (rc == 0) {
FS3_to_finfo(finfo, &fstatus);
finfo->fname = fname;
if (wanted & APR_FINFO_NAME) {
ULONG count = 1;
HDIR hDir = HDIR_SYSTEM;
FILEFINDBUF3 ffb;
rc = DosFindFirst(fname, &hDir,
FILE_DIRECTORY|FILE_HIDDEN|FILE_SYSTEM|FILE_ARCHIVED,
&ffb, sizeof(ffb), &count, FIL_STANDARD);
if (rc == 0 && count == 1) {
finfo->name = apr_pstrdup(cont, ffb.achName);
finfo->valid |= APR_FINFO_NAME;
}
}
} else if (rc == ERROR_INVALID_ACCESS) {
memset(finfo, 0, sizeof(apr_finfo_t));
finfo->valid = APR_FINFO_TYPE | APR_FINFO_PROT;
finfo->protection = 0666;
finfo->filetype = APR_CHR;
if (wanted & APR_FINFO_NAME) {
finfo->name = apr_pstrdup(cont, fname);
finfo->valid |= APR_FINFO_NAME;
}
} else {
return APR_FROM_OS_ERROR(rc);
}
return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
apr_fileattrs_t attributes,
apr_fileattrs_t attr_mask,
apr_pool_t *cont)
{
FILESTATUS3 fs3;
ULONG rc;
/* Don't do anything if we can't handle the requested attributes */
if (!(attr_mask & (APR_FILE_ATTR_READONLY
| APR_FILE_ATTR_HIDDEN)))
return APR_SUCCESS;
rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3));
if (rc == 0) {
ULONG old_attr = fs3.attrFile;
if (attr_mask & APR_FILE_ATTR_READONLY)
{
if (attributes & APR_FILE_ATTR_READONLY) {
fs3.attrFile |= FILE_READONLY;
} else {
fs3.attrFile &= ~FILE_READONLY;
}
}
if (attr_mask & APR_FILE_ATTR_HIDDEN)
{
if (attributes & APR_FILE_ATTR_HIDDEN) {
fs3.attrFile |= FILE_HIDDEN;
} else {
fs3.attrFile &= ~FILE_HIDDEN;
}
}
if (fs3.attrFile != old_attr) {
rc = DosSetPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3), 0);
}
}
return APR_FROM_OS_ERROR(rc);
}
/* ### Somebody please write this! */
APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
apr_time_t mtime,
apr_pool_t *pool)
{
FILESTATUS3 fs3;
ULONG rc;
rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3));
if (rc) {
return APR_FROM_OS_ERROR(rc);
}
apr_apr_time_to_os2_time(&fs3.fdateLastWrite, &fs3.ftimeLastWrite, mtime);
rc = DosSetPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3), 0);
return APR_FROM_OS_ERROR(rc);
}

View File

@@ -0,0 +1,148 @@
/* 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.
*/
#include "apr.h"
#include "apr_arch_file_io.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include <ctype.h>
/* OS/2 Exceptions:
*
* Note that trailing spaces and trailing periods are never recorded
* in the file system.
*
* Leading spaces and periods are accepted, however.
* The * ? < > codes all have wildcard side effects
* The " / \ : are exclusively component separator tokens
* The system doesn't accept | for any (known) purpose
* Oddly, \x7f _is_ acceptable ;)
*/
const char c_is_fnchar[256] =
{/* Reject all ctrl codes... */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/* " * / : < > ? */
1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0, 1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,
/* \ */
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,
/* | */
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,
/* High bit codes are accepted */
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
};
#define IS_SLASH(c) (c == '/' || c == '\\')
apr_status_t filepath_root_test(char *path, apr_pool_t *p)
{
char drive = apr_toupper(path[0]);
if (drive >= 'A' && drive <= 'Z' && path[1] == ':' && IS_SLASH(path[2]))
return APR_SUCCESS;
return APR_EBADPATH;
}
apr_status_t filepath_drive_get(char **rootpath, char drive,
apr_int32_t flags, apr_pool_t *p)
{
char path[APR_PATH_MAX];
char *pos;
ULONG rc;
ULONG bufsize = sizeof(path) - 3;
path[0] = drive;
path[1] = ':';
path[2] = '/';
rc = DosQueryCurrentDir(apr_toupper(drive) - 'A', path+3, &bufsize);
if (rc) {
return APR_FROM_OS_ERROR(rc);
}
if (!(flags & APR_FILEPATH_NATIVE)) {
for (pos=path; *pos; pos++) {
if (*pos == '\\')
*pos = '/';
}
}
*rootpath = apr_pstrdup(p, path);
return APR_SUCCESS;
}
apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p)
{
if (root[0] && apr_islower(root[0]) && root[1] == ':') {
*rootpath = apr_pstrdup(p, root);
(*rootpath)[0] = apr_toupper((*rootpath)[0]);
}
else {
*rootpath = root;
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags,
apr_pool_t *p)
{
char path[APR_PATH_MAX];
ULONG drive;
ULONG drivemap;
ULONG rv, pathlen = sizeof(path) - 3;
char *pos;
DosQueryCurrentDisk(&drive, &drivemap);
path[0] = '@' + drive;
strcpy(path+1, ":\\");
rv = DosQueryCurrentDir(drive, path+3, &pathlen);
*defpath = apr_pstrdup(p, path);
if (!(flags & APR_FILEPATH_NATIVE)) {
for (pos=*defpath; *pos; pos++) {
if (*pos == '\\')
*pos = '/';
}
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p)
{
ULONG rv = 0;
if (path[1] == ':')
rv = DosSetDefaultDisk(apr_toupper(path[0]) - '@');
if (rv == 0)
rv = DosSetCurrentDir(path);
return APR_FROM_OS_ERROR(rv);
}

View File

@@ -0,0 +1,37 @@
/* 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.
*/
#include "apr_arch_file_io.h"
APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type)
{
FILELOCK lockrange = { 0, 0x7fffffff };
ULONG rc;
rc = DosSetFileLocks(thefile->filedes, NULL, &lockrange,
(type & APR_FLOCK_NONBLOCK) ? 0 : (ULONG)-1,
(type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED);
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile)
{
FILELOCK unlockrange = { 0, 0x7fffffff };
ULONG rc;
rc = DosSetFileLocks(thefile->filedes, &unlockrange, NULL, 0, 0);
return APR_FROM_OS_ERROR(rc);
}

View File

@@ -0,0 +1 @@
#include "../unix/fullrw.c"

View File

@@ -0,0 +1,95 @@
/* 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.
*/
#define INCL_DOSERRORS
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include <errno.h>
#include <string.h>
#include "apr_errno.h"
static int errormap[][2] = {
{ NO_ERROR, APR_SUCCESS },
{ ERROR_FILE_NOT_FOUND, APR_ENOENT },
{ ERROR_PATH_NOT_FOUND, APR_ENOENT },
{ ERROR_TOO_MANY_OPEN_FILES, APR_EMFILE },
{ ERROR_ACCESS_DENIED, APR_EACCES },
{ ERROR_SHARING_VIOLATION, APR_EACCES },
{ ERROR_INVALID_PARAMETER, APR_EINVAL },
{ ERROR_OPEN_FAILED, APR_ENOENT },
{ ERROR_DISK_FULL, APR_ENOSPC },
{ ERROR_FILENAME_EXCED_RANGE, APR_ENAMETOOLONG },
{ ERROR_INVALID_FUNCTION, APR_EINVAL },
{ ERROR_INVALID_HANDLE, APR_EBADF },
{ ERROR_NEGATIVE_SEEK, APR_ESPIPE },
{ ERROR_NO_SIGNAL_SENT, ESRCH },
{ ERROR_NO_DATA, APR_EAGAIN },
{ SOCEINTR, EINTR },
{ SOCEWOULDBLOCK, EWOULDBLOCK },
{ SOCEINPROGRESS, EINPROGRESS },
{ SOCEALREADY, EALREADY },
{ SOCENOTSOCK, ENOTSOCK },
{ SOCEDESTADDRREQ, EDESTADDRREQ },
{ SOCEMSGSIZE, EMSGSIZE },
{ SOCEPROTOTYPE, EPROTOTYPE },
{ SOCENOPROTOOPT, ENOPROTOOPT },
{ SOCEPROTONOSUPPORT, EPROTONOSUPPORT },
{ SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT },
{ SOCEOPNOTSUPP, EOPNOTSUPP },
{ SOCEPFNOSUPPORT, EPFNOSUPPORT },
{ SOCEAFNOSUPPORT, EAFNOSUPPORT },
{ SOCEADDRINUSE, EADDRINUSE },
{ SOCEADDRNOTAVAIL, EADDRNOTAVAIL },
{ SOCENETDOWN, ENETDOWN },
{ SOCENETUNREACH, ENETUNREACH },
{ SOCENETRESET, ENETRESET },
{ SOCECONNABORTED, ECONNABORTED },
{ SOCECONNRESET, ECONNRESET },
{ SOCENOBUFS, ENOBUFS },
{ SOCEISCONN, EISCONN },
{ SOCENOTCONN, ENOTCONN },
{ SOCESHUTDOWN, ESHUTDOWN },
{ SOCETOOMANYREFS, ETOOMANYREFS },
{ SOCETIMEDOUT, ETIMEDOUT },
{ SOCECONNREFUSED, ECONNREFUSED },
{ SOCELOOP, ELOOP },
{ SOCENAMETOOLONG, ENAMETOOLONG },
{ SOCEHOSTDOWN, EHOSTDOWN },
{ SOCEHOSTUNREACH, EHOSTUNREACH },
{ SOCENOTEMPTY, ENOTEMPTY },
{ SOCEPIPE, EPIPE }
};
#define MAPSIZE (sizeof(errormap)/sizeof(errormap[0]))
int apr_canonical_error(apr_status_t err)
{
int rv = -1, index;
if (err < APR_OS_START_SYSERR)
return err;
err -= APR_OS_START_SYSERR;
for (index=0; index<MAPSIZE && errormap[index][0] != err; index++);
if (index<MAPSIZE)
rv = errormap[index][1];
else
fprintf(stderr, "apr_canonical_error: Unknown OS/2 error code %d\n", err );
return rv;
}

View File

@@ -0,0 +1 @@
#include "../unix/mktemp.c"

245
libs/apr/file_io/os2/open.c Normal file
View File

@@ -0,0 +1,245 @@
/* 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.
*/
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include "apr_lib.h"
#include "apr_portable.h"
#include "apr_strings.h"
#include "apr_arch_inherit.h"
#include <string.h>
apr_status_t apr_file_cleanup(void *thefile)
{
apr_file_t *file = thefile;
return apr_file_close(file);
}
APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *pool)
{
int oflags = 0;
int mflags = OPEN_FLAGS_FAIL_ON_ERROR|OPEN_SHARE_DENYNONE;
int rv;
ULONG action;
apr_file_t *dafile = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t));
dafile->pool = pool;
dafile->isopen = FALSE;
dafile->eof_hit = FALSE;
dafile->buffer = NULL;
dafile->flags = flag;
dafile->blocking = BLK_ON;
if ((flag & APR_READ) && (flag & APR_WRITE)) {
mflags |= OPEN_ACCESS_READWRITE;
} else if (flag & APR_READ) {
mflags |= OPEN_ACCESS_READONLY;
} else if (flag & APR_WRITE) {
mflags |= OPEN_ACCESS_WRITEONLY;
} else {
dafile->filedes = -1;
return APR_EACCES;
}
dafile->buffered = (flag & APR_BUFFERED) > 0;
if (dafile->buffered) {
dafile->buffer = apr_palloc(pool, APR_FILE_BUFSIZE);
rv = apr_thread_mutex_create(&dafile->mutex, 0, pool);
if (rv)
return rv;
}
if (flag & APR_CREATE) {
oflags |= OPEN_ACTION_CREATE_IF_NEW;
if (!(flag & APR_EXCL) && !(flag & APR_TRUNCATE)) {
oflags |= OPEN_ACTION_OPEN_IF_EXISTS;
}
}
if ((flag & APR_EXCL) && !(flag & APR_CREATE))
return APR_EACCES;
if (flag & APR_TRUNCATE) {
oflags |= OPEN_ACTION_REPLACE_IF_EXISTS;
} else if ((oflags & 0xFF) == 0) {
oflags |= OPEN_ACTION_OPEN_IF_EXISTS;
}
rv = DosOpen(fname, &(dafile->filedes), &action, 0, 0, oflags, mflags, NULL);
if (rv == 0 && (flag & APR_APPEND)) {
ULONG newptr;
rv = DosSetFilePtr(dafile->filedes, 0, FILE_END, &newptr );
if (rv)
DosClose(dafile->filedes);
}
if (rv != 0)
return APR_FROM_OS_ERROR(rv);
dafile->isopen = TRUE;
dafile->fname = apr_pstrdup(pool, fname);
dafile->filePtr = 0;
dafile->bufpos = 0;
dafile->dataRead = 0;
dafile->direction = 0;
dafile->pipe = FALSE;
if (!(flag & APR_FILE_NOCLEANUP)) {
apr_pool_cleanup_register(dafile->pool, dafile, apr_file_cleanup, apr_file_cleanup);
}
*new = dafile;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file)
{
ULONG rc;
apr_status_t status;
if (file && file->isopen) {
apr_file_flush(file);
rc = DosClose(file->filedes);
if (rc == 0) {
file->isopen = FALSE;
status = APR_SUCCESS;
if (file->flags & APR_DELONCLOSE) {
status = APR_FROM_OS_ERROR(DosDelete(file->fname));
}
} else {
return APR_FROM_OS_ERROR(rc);
}
}
if (file->buffered)
apr_thread_mutex_destroy(file->mutex);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool)
{
ULONG rc = DosDelete(path);
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, const char *to_path,
apr_pool_t *p)
{
ULONG rc = DosMove(from_path, to_path);
if (rc == ERROR_ACCESS_DENIED || rc == ERROR_ALREADY_EXISTS) {
rc = DosDelete(to_path);
if (rc == 0 || rc == ERROR_FILE_NOT_FOUND) {
rc = DosMove(from_path, to_path);
}
}
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, apr_file_t *file)
{
*thefile = file->filedes;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, apr_os_file_t *thefile, apr_int32_t flags, apr_pool_t *pool)
{
apr_os_file_t *dafile = thefile;
(*file) = apr_palloc(pool, sizeof(apr_file_t));
(*file)->pool = pool;
(*file)->filedes = *dafile;
(*file)->isopen = TRUE;
(*file)->eof_hit = FALSE;
(*file)->flags = flags;
(*file)->pipe = FALSE;
(*file)->buffered = (flags & APR_BUFFERED) > 0;
if ((*file)->buffered) {
apr_status_t rv;
(*file)->buffer = apr_palloc(pool, APR_FILE_BUFSIZE);
rv = apr_thread_mutex_create(&(*file)->mutex, 0, pool);
if (rv)
return rv;
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr)
{
if (!fptr->isopen || fptr->eof_hit == 1) {
return APR_EOF;
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, apr_pool_t *pool)
{
apr_os_file_t fd = 2;
return apr_os_file_put(thefile, &fd, 0, pool);
}
APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *pool)
{
apr_os_file_t fd = 1;
return apr_os_file_put(thefile, &fd, 0, pool);
}
APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *pool)
{
apr_os_file_t fd = 0;
return apr_os_file_put(thefile, &fd, 0, pool);
}
APR_POOL_IMPLEMENT_ACCESSOR(file);
APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_file_cleanup)
APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, apr_file_cleanup)

177
libs/apr/file_io/os2/pipe.c Normal file
View File

@@ -0,0 +1,177 @@
/* 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.
*/
#define INCL_DOSERRORS
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include <string.h>
#include <process.h>
APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool)
{
ULONG filedes[2];
ULONG rc, action;
static int id = 0;
char pipename[50];
sprintf(pipename, "/pipe/%d.%d", getpid(), id++);
rc = DosCreateNPipe(pipename, filedes, NP_ACCESS_INBOUND, NP_NOWAIT|1, 4096, 4096, 0);
if (rc)
return APR_FROM_OS_ERROR(rc);
rc = DosConnectNPipe(filedes[0]);
if (rc && rc != ERROR_PIPE_NOT_CONNECTED) {
DosClose(filedes[0]);
return APR_FROM_OS_ERROR(rc);
}
rc = DosOpen (pipename, filedes+1, &action, 0, FILE_NORMAL,
OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE,
NULL);
if (rc) {
DosClose(filedes[0]);
return APR_FROM_OS_ERROR(rc);
}
(*in) = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t));
rc = DosCreateEventSem(NULL, &(*in)->pipeSem, DC_SEM_SHARED, FALSE);
if (rc) {
DosClose(filedes[0]);
DosClose(filedes[1]);
return APR_FROM_OS_ERROR(rc);
}
rc = DosSetNPipeSem(filedes[0], (HSEM)(*in)->pipeSem, 1);
if (!rc) {
rc = DosSetNPHState(filedes[0], NP_WAIT);
}
if (rc) {
DosClose(filedes[0]);
DosClose(filedes[1]);
DosCloseEventSem((*in)->pipeSem);
return APR_FROM_OS_ERROR(rc);
}
(*in)->pool = pool;
(*in)->filedes = filedes[0];
(*in)->fname = apr_pstrdup(pool, pipename);
(*in)->isopen = TRUE;
(*in)->buffered = FALSE;
(*in)->flags = 0;
(*in)->pipe = 1;
(*in)->timeout = -1;
(*in)->blocking = BLK_ON;
apr_pool_cleanup_register(pool, *in, apr_file_cleanup, apr_pool_cleanup_null);
(*out) = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t));
(*out)->pool = pool;
(*out)->filedes = filedes[1];
(*out)->fname = apr_pstrdup(pool, pipename);
(*out)->isopen = TRUE;
(*out)->buffered = FALSE;
(*out)->flags = 0;
(*out)->pipe = 1;
(*out)->timeout = -1;
(*out)->blocking = BLK_ON;
apr_pool_cleanup_register(pool, *out, apr_file_cleanup, apr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, apr_fileperms_t perm, apr_pool_t *pool)
{
/* Not yet implemented, interface not suitable */
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout)
{
if (thepipe->pipe == 1) {
thepipe->timeout = timeout;
if (thepipe->timeout >= 0) {
if (thepipe->blocking != BLK_OFF) {
thepipe->blocking = BLK_OFF;
return APR_FROM_OS_ERROR(DosSetNPHState(thepipe->filedes, NP_NOWAIT));
}
}
else if (thepipe->timeout == -1) {
if (thepipe->blocking != BLK_ON) {
thepipe->blocking = BLK_ON;
return APR_FROM_OS_ERROR(DosSetNPHState(thepipe->filedes, NP_WAIT));
}
}
}
return APR_EINVAL;
}
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout)
{
if (thepipe->pipe == 1) {
*timeout = thepipe->timeout;
return APR_SUCCESS;
}
return APR_EINVAL;
}
APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
apr_os_file_t *thefile,
int register_cleanup,
apr_pool_t *pool)
{
(*file) = apr_pcalloc(pool, sizeof(apr_file_t));
(*file)->pool = pool;
(*file)->isopen = TRUE;
(*file)->pipe = 1;
(*file)->blocking = BLK_UNKNOWN; /* app needs to make a timeout call */
(*file)->timeout = -1;
(*file)->filedes = *thefile;
if (register_cleanup) {
apr_pool_cleanup_register(pool, *file, apr_file_cleanup,
apr_pool_cleanup_null);
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
apr_os_file_t *thefile,
apr_pool_t *pool)
{
return apr_os_pipe_put_ex(file, thefile, 0, pool);
}

View File

@@ -0,0 +1,370 @@
/* 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.
*/
#define INCL_DOS
#define INCL_DOSERRORS
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include <malloc.h>
APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes)
{
ULONG rc = 0;
ULONG bytesread;
if (!thefile->isopen) {
*nbytes = 0;
return APR_EBADF;
}
if (thefile->buffered) {
char *pos = (char *)buf;
ULONG blocksize;
ULONG size = *nbytes;
apr_thread_mutex_lock(thefile->mutex);
if (thefile->direction == 1) {
int rv = apr_file_flush(thefile);
if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(thefile->mutex);
return rv;
}
thefile->bufpos = 0;
thefile->direction = 0;
thefile->dataRead = 0;
}
while (rc == 0 && size > 0) {
if (thefile->bufpos >= thefile->dataRead) {
ULONG bytesread;
rc = DosRead(thefile->filedes, thefile->buffer,
APR_FILE_BUFSIZE, &bytesread);
if (bytesread == 0) {
if (rc == 0)
thefile->eof_hit = TRUE;
break;
}
thefile->dataRead = bytesread;
thefile->filePtr += thefile->dataRead;
thefile->bufpos = 0;
}
blocksize = size > thefile->dataRead - thefile->bufpos ? thefile->dataRead - thefile->bufpos : size;
memcpy(pos, thefile->buffer + thefile->bufpos, blocksize);
thefile->bufpos += blocksize;
pos += blocksize;
size -= blocksize;
}
*nbytes = rc == 0 ? pos - (char *)buf : 0;
apr_thread_mutex_unlock(thefile->mutex);
if (*nbytes == 0 && rc == 0 && thefile->eof_hit) {
return APR_EOF;
}
return APR_FROM_OS_ERROR(rc);
} else {
if (thefile->pipe)
DosResetEventSem(thefile->pipeSem, &rc);
rc = DosRead(thefile->filedes, buf, *nbytes, &bytesread);
if (rc == ERROR_NO_DATA && thefile->timeout != 0) {
int rcwait = DosWaitEventSem(thefile->pipeSem, thefile->timeout >= 0 ? thefile->timeout / 1000 : SEM_INDEFINITE_WAIT);
if (rcwait == 0) {
rc = DosRead(thefile->filedes, buf, *nbytes, &bytesread);
}
else if (rcwait == ERROR_TIMEOUT) {
*nbytes = 0;
return APR_TIMEUP;
}
}
if (rc) {
*nbytes = 0;
return APR_FROM_OS_ERROR(rc);
}
*nbytes = bytesread;
if (bytesread == 0) {
thefile->eof_hit = TRUE;
return APR_EOF;
}
return APR_SUCCESS;
}
}
APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes)
{
ULONG rc = 0;
ULONG byteswritten;
if (!thefile->isopen) {
*nbytes = 0;
return APR_EBADF;
}
if (thefile->buffered) {
char *pos = (char *)buf;
int blocksize;
int size = *nbytes;
apr_thread_mutex_lock(thefile->mutex);
if ( thefile->direction == 0 ) {
// Position file pointer for writing at the offset we are logically reading from
ULONG offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
if (offset != thefile->filePtr)
DosSetFilePtr(thefile->filedes, offset, FILE_BEGIN, &thefile->filePtr );
thefile->bufpos = thefile->dataRead = 0;
thefile->direction = 1;
}
while (rc == 0 && size > 0) {
if (thefile->bufpos == APR_FILE_BUFSIZE) // write buffer is full
rc = apr_file_flush(thefile);
blocksize = size > APR_FILE_BUFSIZE - thefile->bufpos ? APR_FILE_BUFSIZE - thefile->bufpos : size;
memcpy(thefile->buffer + thefile->bufpos, pos, blocksize);
thefile->bufpos += blocksize;
pos += blocksize;
size -= blocksize;
}
apr_thread_mutex_unlock(thefile->mutex);
return APR_FROM_OS_ERROR(rc);
} else {
if (thefile->flags & APR_APPEND) {
FILELOCK all = { 0, 0x7fffffff };
ULONG newpos;
rc = DosSetFileLocks(thefile->filedes, NULL, &all, -1, 0);
if (rc == 0) {
rc = DosSetFilePtr(thefile->filedes, 0, FILE_END, &newpos);
if (rc == 0) {
rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);
}
DosSetFileLocks(thefile->filedes, &all, NULL, -1, 0);
}
} else {
rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);
}
if (rc) {
*nbytes = 0;
return APR_FROM_OS_ERROR(rc);
}
*nbytes = byteswritten;
return APR_SUCCESS;
}
}
#ifdef HAVE_WRITEV
APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes)
{
int bytes;
if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) {
*nbytes = 0;
return errno;
}
else {
*nbytes = bytes;
return APR_SUCCESS;
}
}
#endif
APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile)
{
ULONG rc;
ULONG byteswritten;
if (!thefile->isopen) {
return APR_EBADF;
}
rc = DosWrite(thefile->filedes, &ch, 1, &byteswritten);
if (rc) {
return APR_FROM_OS_ERROR(rc);
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile)
{
apr_off_t offset = -1;
return apr_file_seek(thefile, APR_CUR, &offset);
}
APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile)
{
ULONG rc;
apr_size_t bytesread;
if (!thefile->isopen) {
return APR_EBADF;
}
bytesread = 1;
rc = apr_file_read(thefile, ch, &bytesread);
if (rc) {
return rc;
}
if (bytesread == 0) {
thefile->eof_hit = TRUE;
return APR_EOF;
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile)
{
apr_size_t len;
len = strlen(str);
return apr_file_write(thefile, str, &len);
}
APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile)
{
if (thefile->buffered) {
ULONG written = 0;
int rc = 0;
if (thefile->direction == 1 && thefile->bufpos) {
rc = DosWrite(thefile->filedes, thefile->buffer, thefile->bufpos, &written);
thefile->filePtr += written;
if (rc == 0)
thefile->bufpos = 0;
}
return APR_FROM_OS_ERROR(rc);
} else {
/* There isn't anything to do if we aren't buffering the output
* so just return success.
*/
return APR_SUCCESS;
}
}
APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile)
{
apr_size_t readlen;
apr_status_t rv = APR_SUCCESS;
int i;
for (i = 0; i < len-1; i++) {
readlen = 1;
rv = apr_file_read(thefile, str+i, &readlen);
if (rv != APR_SUCCESS) {
break;
}
if (readlen != 1) {
rv = APR_EOF;
break;
}
if (str[i] == '\n') {
i++;
break;
}
}
str[i] = 0;
if (i > 0) {
/* we stored chars; don't report EOF or any other errors;
* the app will find out about that on the next call
*/
return APR_SUCCESS;
}
return rv;
}
APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr,
const char *format, ...)
{
int cc;
va_list ap;
char *buf;
int len;
buf = malloc(HUGE_STRING_LEN);
if (buf == NULL) {
return 0;
}
va_start(ap, format);
len = apr_vsnprintf(buf, HUGE_STRING_LEN, format, ap);
cc = apr_file_puts(buf, fptr);
va_end(ap);
free(buf);
return (cc == APR_SUCCESS) ? len : -1;
}
apr_status_t apr_file_check_read(apr_file_t *fd)
{
int rc;
if (!fd->pipe)
return APR_SUCCESS; /* Not a pipe, assume no waiting */
rc = DosWaitEventSem(fd->pipeSem, SEM_IMMEDIATE_RETURN);
if (rc == ERROR_TIMEOUT)
return APR_TIMEUP;
return APR_FROM_OS_ERROR(rc);
}

119
libs/apr/file_io/os2/seek.c Normal file
View File

@@ -0,0 +1,119 @@
/* 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.
*/
#include "apr_arch_file_io.h"
#include "apr_file_io.h"
#include "apr_lib.h"
#include <string.h>
#include <io.h>
static apr_status_t setptr(apr_file_t *thefile, unsigned long pos )
{
long newbufpos;
ULONG rc;
if (thefile->direction == 1) {
apr_status_t rv = apr_file_flush(thefile);
if (rv != APR_SUCCESS) {
return rv;
}
thefile->bufpos = thefile->direction = thefile->dataRead = 0;
}
newbufpos = pos - (thefile->filePtr - thefile->dataRead);
if (newbufpos >= 0 && newbufpos <= thefile->dataRead) {
thefile->bufpos = newbufpos;
rc = 0;
} else {
rc = DosSetFilePtr(thefile->filedes, pos, FILE_BEGIN, &thefile->filePtr );
if ( !rc )
thefile->bufpos = thefile->dataRead = 0;
}
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset)
{
if (!thefile->isopen) {
return APR_EBADF;
}
thefile->eof_hit = 0;
if (thefile->buffered) {
int rc = EINVAL;
apr_finfo_t finfo;
switch (where) {
case APR_SET:
rc = setptr(thefile, *offset);
break;
case APR_CUR:
rc = setptr(thefile, thefile->filePtr - thefile->dataRead + thefile->bufpos + *offset);
break;
case APR_END:
rc = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile);
if (rc == APR_SUCCESS)
rc = setptr(thefile, finfo.size + *offset);
break;
}
*offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
return rc;
} else {
switch (where) {
case APR_SET:
where = FILE_BEGIN;
break;
case APR_CUR:
where = FILE_CURRENT;
break;
case APR_END:
where = FILE_END;
break;
}
return APR_FROM_OS_ERROR(DosSetFilePtr(thefile->filedes, *offset, where, (ULONG *)offset));
}
}
APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset)
{
int rc = DosSetFileSize(fp->filedes, offset);
if (rc != 0) {
return APR_FROM_OS_ERROR(rc);
}
if (fp->buffered) {
return setptr(fp, offset);
}
return APR_SUCCESS;
}

View File

@@ -0,0 +1 @@
#include "../unix/tempdir.c"

Some files were not shown because too many files have changed in this diff Show More